1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-24 17:10:29 +00:00

Make Stamp-Dropdown sortable by Drag&Drop (#5981)

* Make stamp-dropdown reorderable by list-tagged-draggable macro

* Add stamp-dropdown ItemTemplate tiddler

* Make stamp-entries editable by ctrl-click

* Update stamp-dropdown-item-template.tid

* Add `tc-editortoolbar-stamp-button` class to stamp button

* Make stamp-dropdown look like before

* Update base.tid
This commit is contained in:
Simon Huber 2021-08-29 18:48:32 +02:00 committed by GitHub
parent 33be326ef6
commit c9f178ec87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 64 additions and 43 deletions

View File

@ -0,0 +1,53 @@
title: $:/core/ui/EditorToolbar/StampDropdown/ItemTemplate
<$linkcatcher actions="""
<$list filter="[<modifier>!match[ctrl]]" variable="ignore">
<$list filter="[<currentTiddler>addsuffix[/prefix]is[missing]removesuffix[/prefix]addsuffix[/suffix]is[missing]]" variable="ignore">
<$action-sendmessage
$message="tm-edit-text-operation"
$param="replace-selection"
text={{{ [<currentTiddler>get[text]] }}}
/>
</$list>
<$list filter="[<currentTiddler>addsuffix[/prefix]is[missing]removesuffix[/prefix]addsuffix[/suffix]!is[missing]] [<currentTiddler>addsuffix[/prefix]!is[missing]removesuffix[/prefix]addsuffix[/suffix]is[missing]] [<currentTiddler>addsuffix[/prefix]!is[missing]removesuffix[/prefix]addsuffix[/suffix]!is[missing]]" variable="ignore">
<$action-sendmessage
$message="tm-edit-text-operation"
$param="wrap-selection"
prefix={{{ [<currentTiddler>addsuffix[/prefix]get[text]] }}}
suffix={{{ [<currentTiddler>addsuffix[/suffix]get[text]] }}}
/>
</$list>
</$list>
<$list filter="[<modifier>match[ctrl]]" variable="ignore">
<$action-sendmessage $message="tm-edit-tiddler"/>
</$list>
<$action-deletetiddler
$tiddler=<<dropdown-state>>
/>
""">
<$link tooltip={{{ [<currentTiddler>get[description]] }}}>
<$transclude tiddler=<<currentTiddler>> field="caption" mode="inline">
<$view tiddler=<<currentTiddler>> field="title" />
</$transclude>
</$link>
</$linkcatcher>

View File

@ -1,48 +1,6 @@
title: $:/core/ui/EditorToolbar/stamp-dropdown title: $:/core/ui/EditorToolbar/stamp-dropdown
\define toolbar-button-stamp-inner() <$macrocall $name="list-tagged-draggable" tag="$:/tags/TextEditor/Snippet" subFilter="!is[draft]" itemTemplate="$:/core/ui/EditorToolbar/StampDropdown/ItemTemplate"/>
<$button tag="a">
<$list filter="[[$(snippetTitle)$]addsuffix[/prefix]is[missing]removesuffix[/prefix]addsuffix[/suffix]is[missing]]">
<$action-sendmessage
$message="tm-edit-text-operation"
$param="replace-selection"
text={{$(snippetTitle)$}}
/>
</$list>
<$list filter="[[$(snippetTitle)$]addsuffix[/prefix]is[missing]removesuffix[/prefix]addsuffix[/suffix]!is[missing]] [[$(snippetTitle)$]addsuffix[/prefix]!is[missing]removesuffix[/prefix]addsuffix[/suffix]is[missing]] [[$(snippetTitle)$]addsuffix[/prefix]!is[missing]removesuffix[/prefix]addsuffix[/suffix]!is[missing]]">
<$action-sendmessage
$message="tm-edit-text-operation"
$param="wrap-selection"
prefix={{{ [[$(snippetTitle)$]addsuffix[/prefix]get[text]] }}}
suffix={{{ [[$(snippetTitle)$]addsuffix[/suffix]get[text]] }}}
/>
</$list>
<$action-deletetiddler
$tiddler=<<dropdown-state>>
/>
<$transclude tiddler=<<snippetTitle>> field="caption" mode="inline">
<$view tiddler=<<snippetTitle>> field="title" />
</$transclude>
</$button>
\end
<$list filter="[all[shadows+tiddlers]tag[$:/tags/TextEditor/Snippet]!has[draft.of]sort[caption]]" variable="snippetTitle">
<<toolbar-button-stamp-inner>>
</$list>
---- ----

View File

@ -6,4 +6,5 @@ description: {{$:/language/Buttons/Stamp/Hint}}
condition: [<targetTiddler>type[]] [<targetTiddler>get[type]prefix[text/]] [<targetTiddler>get[type]match[application/javascript]] [<targetTiddler>get[type]match[application/json]] [<targetTiddler>get[type]match[application/x-tiddler-dictionary]] [<targetTiddler>get[type]match[image/svg+xml]] +[first[]] condition: [<targetTiddler>type[]] [<targetTiddler>get[type]prefix[text/]] [<targetTiddler>get[type]match[application/javascript]] [<targetTiddler>get[type]match[application/json]] [<targetTiddler>get[type]match[application/x-tiddler-dictionary]] [<targetTiddler>get[type]match[image/svg+xml]] +[first[]]
shortcuts: ((stamp)) shortcuts: ((stamp))
dropdown: $:/core/ui/EditorToolbar/stamp-dropdown dropdown: $:/core/ui/EditorToolbar/stamp-dropdown
button-classes: tc-editortoolbar-stamp-button
text: text:

View File

@ -1321,6 +1321,15 @@ html body.tc-body.tc-single-tiddler-window {
padding: 0; padding: 0;
} }
.tc-editor-toolbar button.tc-editortoolbar-stamp-button + .tc-popup .tc-drop-down > p {
margin: 0;
padding: 0;
}
.tc-editor-toolbar button.tc-editortoolbar-stamp-button + .tc-popup .tc-drop-down a.tc-tiddlylink {
font-weight: normal;
}
/* /*
** Adjustments for fluid-fixed mode ** Adjustments for fluid-fixed mode
*/ */