mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 03:57:21 +00:00
Import rename (#4928)
* Add UI for renaming tiddlers before import in the import listing * Removed spurious whitespace
This commit is contained in:
parent
49b11bc493
commit
9605d94b6c
@ -13,6 +13,9 @@ Listing/Preview/TextRaw: Text (Raw)
|
|||||||
Listing/Preview/Fields: Fields
|
Listing/Preview/Fields: Fields
|
||||||
Listing/Preview/Diff: Diff
|
Listing/Preview/Diff: Diff
|
||||||
Listing/Preview/DiffFields: Diff (Fields)
|
Listing/Preview/DiffFields: Diff (Fields)
|
||||||
|
Listing/Rename/Tooltip: Rename tiddler before importing
|
||||||
|
Listing/Rename/ConfirmRename : Rename tiddler
|
||||||
|
Listing/Rename/CancelRename : Cancel
|
||||||
Upgrader/Plugins/Suppressed/Incompatible: Blocked incompatible or obsolete plugin
|
Upgrader/Plugins/Suppressed/Incompatible: Blocked incompatible or obsolete plugin
|
||||||
Upgrader/Plugins/Suppressed/Version: Blocked plugin (due to incoming <<incoming>> being older than existing <<existing>>)
|
Upgrader/Plugins/Suppressed/Version: Blocked plugin (due to incoming <<incoming>> being older than existing <<existing>>)
|
||||||
Upgrader/Plugins/Upgraded: Upgraded plugin from <<incoming>> to <<upgraded>>
|
Upgrader/Plugins/Upgraded: Upgraded plugin from <<incoming>> to <<upgraded>>
|
||||||
|
@ -558,10 +558,14 @@ NavigatorWidget.prototype.handlePerformImportEvent = function(event) {
|
|||||||
$tw.utils.each(importData.tiddlers,function(tiddlerFields) {
|
$tw.utils.each(importData.tiddlers,function(tiddlerFields) {
|
||||||
var title = tiddlerFields.title;
|
var title = tiddlerFields.title;
|
||||||
if(title && importTiddler && importTiddler.fields["selection-" + title] !== "unchecked") {
|
if(title && importTiddler && importTiddler.fields["selection-" + title] !== "unchecked") {
|
||||||
var tiddler = new $tw.Tiddler(tiddlerFields);
|
if($tw.utils.hop(importTiddler.fields,["rename-" + title])) {
|
||||||
|
var tiddler = new $tw.Tiddler(tiddlerFields,{title : importTiddler.fields["rename-" + title]});
|
||||||
|
} else {
|
||||||
|
var tiddler = new $tw.Tiddler(tiddlerFields);
|
||||||
|
}
|
||||||
tiddler = $tw.hooks.invokeHook("th-importing-tiddler",tiddler);
|
tiddler = $tw.hooks.invokeHook("th-importing-tiddler",tiddler);
|
||||||
self.wiki.addTiddler(tiddler);
|
self.wiki.addTiddler(tiddler);
|
||||||
importReport.push("# [[" + tiddlerFields.title + "]]");
|
importReport.push("# [[" + tiddler.fields.title + "]]");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Replace the $:/Import tiddler with an import report
|
// Replace the $:/Import tiddler with an import report
|
||||||
|
@ -10,20 +10,30 @@ message-$(payloadTiddler)$
|
|||||||
selection-$(payloadTiddler)$
|
selection-$(payloadTiddler)$
|
||||||
\end
|
\end
|
||||||
|
|
||||||
|
\define renameField()
|
||||||
|
rename-$(payloadTiddler)$
|
||||||
|
\end
|
||||||
|
|
||||||
|
\define newImportTitleTiddler() $:/temp/NewImportTitle-$(payloadTiddler)$
|
||||||
|
|
||||||
\define previewPopupState()
|
\define previewPopupState()
|
||||||
$(currentTiddler)$!!popup-$(payloadTiddler)$
|
$(currentTiddler)$!!popup-$(payloadTiddler)$
|
||||||
\end
|
\end
|
||||||
|
|
||||||
|
\define renameFieldState()
|
||||||
|
$:/state/import-rename-$(payloadTiddler)$
|
||||||
|
\end
|
||||||
|
|
||||||
\define select-all-actions()
|
\define select-all-actions()
|
||||||
<$list filter="[all[current]plugintiddlers[]sort[title]]" variable="payloadTiddler">
|
<$list filter="[all[current]plugintiddlers[]sort[title]]" variable="payloadTiddler">
|
||||||
<$action-setfield $field={{{ [<payloadTiddler>addprefix[selection-]] }}} $value={{$:/state/import/select-all}}/>
|
<$action-setfield $field={{{ [<payloadTiddler>addprefix[selection-]] }}} $value={{$:/state/import/select-all}}/>
|
||||||
</$list>
|
</$list>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
<table>
|
<table class="tc-import-table">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th align="left">
|
||||||
<$checkbox tiddler="$:/state/import/select-all" field="text" checked="checked" unchecked="unchecked" default="checked" actions=<<select-all-actions>>>
|
<$checkbox tiddler="$:/state/import/select-all" field="text" checked="checked" unchecked="unchecked" default="checked" actions=<<select-all-actions>>>
|
||||||
<<lingo Listing/Select/Caption>>
|
<<lingo Listing/Select/Caption>>
|
||||||
</$checkbox>
|
</$checkbox>
|
||||||
@ -41,16 +51,22 @@ $(currentTiddler)$!!popup-$(payloadTiddler)$
|
|||||||
<$checkbox field=<<selectionField>> checked="checked" unchecked="unchecked" default="checked"/>
|
<$checkbox field=<<selectionField>> checked="checked" unchecked="unchecked" default="checked"/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
<$reveal type="nomatch" stateTitle=<<renameFieldState>> text="yes" tag="div">
|
||||||
<$reveal type="nomatch" state=<<previewPopupState>> text="yes" tag="div">
|
<$reveal type="nomatch" state=<<previewPopupState>> text="yes" tag="div">
|
||||||
<$button class="tc-btn-invisible tc-btn-dropdown" set=<<previewPopupState>> setTo="yes">
|
<$button class="tc-btn-invisible tc-btn-dropdown" set=<<previewPopupState>> setTo="yes">
|
||||||
{{$:/core/images/right-arrow}}<span class="tc-small-gap-left"><$text text=<<payloadTiddler>>/></span>
|
{{$:/core/images/right-arrow}}<span class="tc-small-gap-left"><$text text={{{[<currentTiddler>get<renameField>minlength[1]else<payloadTiddler>]}}}/></span>
|
||||||
</$button>
|
</$button>
|
||||||
|
<$button class="tc-btn-invisible" setTitle=<<renameFieldState>> setTo="yes" tooltip={{{[<lingo-base>addsuffix[Listing/Rename/Tooltip]get[text]]}}}>{{$:/core/images/edit-button}}</$button>
|
||||||
</$reveal>
|
</$reveal>
|
||||||
<$reveal type="match" state=<<previewPopupState>> text="yes" tag="div">
|
<$reveal type="match" state=<<previewPopupState>> text="yes" tag="div">
|
||||||
<$button class="tc-btn-invisible tc-btn-dropdown" set=<<previewPopupState>> setTo="no">
|
<$button class="tc-btn-invisible tc-btn-dropdown" set=<<previewPopupState>> setTo="no">
|
||||||
{{$:/core/images/down-arrow}}<span class="tc-small-gap-left"><$text text=<<payloadTiddler>>/></span>
|
{{$:/core/images/down-arrow}}<span class="tc-small-gap-left"><$text text=<<payloadTiddler>>/></span>
|
||||||
</$button>
|
</$button>
|
||||||
</$reveal>
|
</$reveal>
|
||||||
|
</$reveal>
|
||||||
|
<$reveal type="match" stateTitle=<<renameFieldState>> text="yes" tag="div">
|
||||||
|
<$edit-text tiddler=<<newImportTitleTiddler>> default=<<payloadTiddler>> tag="input" class="tc-import-rename"/><$button class="tc-btn-invisible" setTitle=<<renameFieldState>> setTo="no" tooltip={{{[<lingo-base>addsuffix[Listing/Rename/CancelRename]get[text]]}}}>{{$:/core/images/close-button}}<$action-deletetiddler $tiddler=<<newImportTitleTiddler>>/></$button> <$button class="tc-btn-invisible" setTitle=<<renameFieldState>> setTo="no" tooltip={{{[<lingo-base>addsuffix[Listing/Rename/ConfirmRename]get[text]]}}}>{{$:/core/images/done-button}}<$action-setfield $field=<<renameField>> $value={{{[<newImportTitleTiddler>get[text]minlength[1]else<payloadTiddler>]}}} /><$action-deletetiddler $tiddler=<<newImportTitleTiddler>>/></$button>
|
||||||
|
</$reveal>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<$view field=<<messageField>>/>
|
<$view field=<<messageField>>/>
|
||||||
|
@ -2024,6 +2024,19 @@ html body.tc-body.tc-single-tiddler-window {
|
|||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Import table
|
||||||
|
*/
|
||||||
|
|
||||||
|
.tc-import-table {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
input.tc-import-rename {
|
||||||
|
width: 85%;
|
||||||
|
margin-right: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Alerts
|
** Alerts
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user