-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
58 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,9 @@ | ||
title: $:/core/ui/EditorToolbar/file-import | ||
tags: $:/tags/EditorTools | ||
image: [img[$title$]] | ||
file: [[$title$]] | ||
regexp-search: | ||
regexp-replace: | ||
condition: [<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]] | ||
|
||
\define lingo-base() $:/language/Import/ | ||
|
||
\define closePopupActions() | ||
<$action-deletetiddler $filter="[title<importState>] [title<importTitle>]"/> | ||
\end | ||
|
||
\define replacement-text-image() [img[$title$]] | ||
|
||
\define replacement-text-file() [[$title$]] | ||
|
||
\define postImportActions() | ||
\whitespace trim | ||
<$list filter="[<importTitle>links[]] :reduce[get[type]prefix[image]then<replacement-text-image>else<replacement-text-file>search-replace[$title$],<currentTiddler>addprefix<accumulator>]" variable="imageTitle"> | ||
<$action-sendmessage | ||
$message="tm-edit-text-operation" | ||
$param="insert-text" | ||
text=<<imageTitle>> | ||
/> | ||
</$list> | ||
<<closePopupActions>> | ||
\end | ||
|
||
\define buttons() | ||
\whitespace trim | ||
<$button class="tc-btn-invisible" actions=<<closePopupActions>> ><<lingo Listing/Cancel/Caption>></$button> | ||
  | ||
<$button class="tc-btn-invisible" message="tm-perform-import" param=<<importTitle>> actions=<<postImportActions>> ><<lingo Listing/Import/Caption>></$button> | ||
\end | ||
|
||
\whitespace trim | ||
<$reveal type="popup" state=<<importState>> tag="div" class="tc-editor-importpopup"> | ||
<div class="tc-editor-import"> | ||
<$list filter="[<importTitle>field:plugin-type[import]]"> | ||
<h2><<lingo Editor/Import/Heading>></h2> | ||
<$tiddler tiddler=<<importTitle>>> | ||
{{||$:/core/ui/ImportListing}} | ||
<<buttons>> | ||
</$tiddler> | ||
</$list> | ||
</div> | ||
</$reveal> | ||
{{||$:/core/ui/FileImportTemplate}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
title: $:/core/ui/FileImportTemplate | ||
|
||
\whitespace trim | ||
|
||
\procedure lingo-base() $:/language/Import/ | ||
|
||
\procedure closePopupActions() | ||
<$action-deletetiddler $filter="[title<importState>] [title<importTitle>]"/> | ||
\end | ||
|
||
\procedure postImportActions() | ||
<$list filter="[<importTitle>links[]]"> | ||
<$let escaped-title={{{ [<currentTiddler>search-replace:g:regexp<replacement-regexp>,<replacement-replace>] }}}> | ||
<$let insertText={{{ [get[type]prefix[image]then<replacement-text-image>else<replacement-text-file>search-replace[$title$],<escaped-title>] }}}> | ||
<$action-sendmessage | ||
$message="tm-edit-text-operation" | ||
$param="insert-text" | ||
text=<<insertText>> | ||
/> | ||
</$let> | ||
</$let> | ||
</$list> | ||
<<closePopupActions>> | ||
\end | ||
|
||
\procedure buttons() | ||
<$button class="tc-btn-invisible tc-small-gap-right" actions=<<closePopupActions>> ><<lingo Listing/Cancel/Caption>></$button> | ||
<$button class="tc-btn-invisible" message="tm-perform-import" param=<<importTitle>> actions=<<postImportActions>> ><<lingo Listing/Import/Caption>></$button> | ||
\end | ||
|
||
<$let replacement-text-image={{!!image}} replacement-text-file={{!!file}} replacement-regexp={{!!regexp-search}} replacement-replace={{!!regexp-replace}}> | ||
<$reveal type="popup" state=<<importState>> tag="div" class="tc-editor-importpopup"> | ||
<div class="tc-editor-import"> | ||
<$list filter="[<importTitle>field:plugin-type[import]]"> | ||
<h2><<lingo Editor/Import/Heading>></h2> | ||
<$tiddler tiddler=<<importTitle>>> | ||
{{||$:/core/ui/ImportListing}} | ||
<<buttons>> | ||
</$tiddler> | ||
</$list> | ||
</div> | ||
</$reveal> | ||
</$let> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
title: $:/config/Editor/EnableImportFilter | ||
type: text/vnd.tiddlywiki | ||
|
||
[all[current]type[text/vnd.tiddlywiki]] [all[current]!has[type]] | ||
[all[current]type[text/vnd.tiddlywiki]] [all[current]!has[type]] [all[current]type[text/markdown]] [all[current]type[text/x-markdown]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
title: $:/plugins/tiddlywiki/markdown/EditorToolbar/file-import | ||
tags: $:/tags/EditorTools | ||
image: ![](<#$title$>) | ||
file: [](<#$title$>) | ||
regexp-search: [()<>\\] | ||
regexp-replace: \$& | ||
condition: [<targetTiddler>type[text/x-markdown]] [<targetTiddler>type[text/markdown]] | ||
|
||
{{||$:/core/ui/FileImportTemplate}} |