diff --git a/core/language/en-GB/ControlPanel.multids b/core/language/en-GB/ControlPanel.multids index 7621842ab..c81381aea 100644 --- a/core/language/en-GB/ControlPanel.multids +++ b/core/language/en-GB/ControlPanel.multids @@ -47,6 +47,8 @@ LoadedModules/Hint: These are the currently loaded tiddler modules linked to the Palette/Caption: Palette Palette/Editor/Clone/Caption: clone Palette/Editor/Clone/Prompt: It is recommended that you clone this shadow palette before editing it +Palette/Editor/Delete/Hint: delete this entry from the current palette +Palette/Editor/Names/External/Show: Show color names that are not part of the current palette Palette/Editor/Prompt/Modified: This shadow palette has been modified Palette/Editor/Prompt: Editing Palette/Editor/Reset/Caption: reset diff --git a/core/ui/ControlPanel/Palette.tid b/core/ui/ControlPanel/Palette.tid index c76b4984e..335a3632d 100644 --- a/core/ui/ControlPanel/Palette.tid +++ b/core/ui/ControlPanel/Palette.tid @@ -15,7 +15,7 @@ caption: {{$:/language/ControlPanel/Palette/Caption}} <$reveal type="match" state="$:/state/ShowPaletteEditor" text="yes"> <$button set="$:/state/ShowPaletteEditor" setTo="no"><> -{{$:/snippets/paletteeditor}} +{{$:/PaletteManager}} diff --git a/core/ui/PaletteManager.tid b/core/ui/PaletteManager.tid new file mode 100644 index 000000000..c1a46df3c --- /dev/null +++ b/core/ui/PaletteManager.tid @@ -0,0 +1,93 @@ +title: $:/PaletteManager + +\define lingo-base() $:/language/ControlPanel/Palette/Editor/ +\define describePaletteColour(colour) +<$transclude tiddler="$:/language/Docs/PaletteColours/$colour$"><$text text="$colour$"/> +\end +\define edit-colour-placeholder() + edit $(colourName)$ +\end +\define colour-tooltip(showhide) $showhide$ editor for $(newColourName)$ +\define resolve-colour(macrocall) +\import $:/core/macros/utils +\whitespace trim +<$wikify name="name" text="""$macrocall$"""> +<> + +\end +\define delete-colour-index-actions() <$action-setfield $index=<>/> +\define palette-manager-colour-row-segment() +\whitespace trim +<$edit-text index=<> tag="input" placeholder=<> default=""/> +
+<$edit-text index=<> type="color" tag="input" class="tc-palette-manager-colour-input"/> +<$list filter="[getindexremoveprefix[<<]removesuffix[>>]] [getindexremoveprefix[<$]removesuffix[/>]]" variable="ignore"> +<$set name="state" value={{{ [[$:/state/palettemanager/]addsuffixaddsuffix[/]addsuffix] }}}> +<$wikify name="newColourName" text="""<$macrocall $name="resolve-colour" macrocall={{{ [getindex] }}}/>"""> +<$reveal state=<> type="nomatch" text="show"> +<$button tooltip=<> aria-label=<> class="tc-btn-invisible" set=<> setTo="show">{{$:/core/images/down-arrow}} <$text text=<>/>
+ +<$reveal state=<> type="match" text="show"> +<$button tooltip=<> aria-label=<> class="tc-btn-invisible" actions="""<$action-deletetiddler $tiddler=<>/>""">{{$:/core/images/up-arrow}} <$text text=<>/>
+ +<$reveal state=<> type="match" text="show"> +<$set name="colourName" value=<>> +
+<> +

+ + + + + +\end +\define palette-manager-colour-row() +\whitespace trim + + + +<$button tooltip=<> aria-label=<> class="tc-btn-invisible" actions=<>> +{{$:/core/images/delete-button}} + +''<$macrocall $name="describePaletteColour" colour=<>/>''
+<$macrocall $name="colourName" $output="text/plain"/> + + +<> + + +\end +\define palette-manager-table() +\whitespace trim + + +<$list filter="[all[shadows+tiddlers]tag[$:/tags/Palette]indexes[]]" variable="colourName"> +<$list filter="[indexes[]removeprefixsuffix[]]" variable="ignore" emptyMessage=""" +<$list filter="[{$:/state/palettemanager/showexternal}removeprefix[yes]suffix[]]" variable="ignore"> +<> + +"""> +<> + + + +
+\end +<$set name="currentTiddler" value={{$:/palette}}> + +<> <$link to={{$:/palette}}><$macrocall $name="currentTiddler" $output="text/plain"/> + +<$list filter="[all[current]is[shadow]is[tiddler]]" variable="listItem"> +<> +<$button message="tm-delete-tiddler" param={{$:/palette}}><> + + +<$list filter="[all[current]is[shadow]!is[tiddler]]" variable="listItem"> +<> + + +<$button message="tm-new-tiddler" param={{$:/palette}}><> + +<$checkbox tiddler="$:/state/palettemanager/showexternal" field="text" checked="yes" unchecked="no"> <> + +<> diff --git a/core/wiki/macros/utils.tid b/core/wiki/macros/utils.tid new file mode 100644 index 000000000..f17c6cadc --- /dev/null +++ b/core/wiki/macros/utils.tid @@ -0,0 +1,5 @@ +title: $:/core/macros/utils + +\define colour(colour) +$colour$ +\end diff --git a/core/wiki/paletteeditor.tid b/core/wiki/paletteeditor.tid index b1d57dbd1..8e6c9fea8 100644 --- a/core/wiki/paletteeditor.tid +++ b/core/wiki/paletteeditor.tid @@ -1,39 +1,3 @@ title: $:/snippets/paletteeditor -\define lingo-base() $:/language/ControlPanel/Palette/Editor/ -\define describePaletteColour(colour) -<$transclude tiddler="$:/language/Docs/PaletteColours/$colour$"><$text text="$colour$"/> -\end -<$set name="currentTiddler" value={{$:/palette}}> - -<> <$link to={{$:/palette}}><$macrocall $name="currentTiddler" $output="text/plain"/> - -<$list filter="[all[current]is[shadow]is[tiddler]]" variable="listItem"> -<> -<$button message="tm-delete-tiddler" param={{$:/palette}}><> - - -<$list filter="[all[current]is[shadow]!is[tiddler]]" variable="listItem"> -<> - - -<$button message="tm-new-tiddler" param={{$:/palette}}><> - - - -<$list filter="[all[current]indexes[]]" variable="colourName"> - - - - - - -
-''<$macrocall $name="describePaletteColour" colour=<>/>''
-<$macrocall $name="colourName" $output="text/plain"/> -
-<$edit-text index=<> tag="input"/> -
-<$edit-text index=<> type="color" tag="input"/> -
- +<$transclude tiddler="$:/PaletteManager"/> diff --git a/themes/tiddlywiki/vanilla/base.tid b/themes/tiddlywiki/vanilla/base.tid index dd3b20e06..775bee9f5 100644 --- a/themes/tiddlywiki/vanilla/base.tid +++ b/themes/tiddlywiki/vanilla/base.tid @@ -2266,6 +2266,11 @@ a.tc-tiddlylink.tc-plugin-info:hover .tc-plugin-info > .tc-plugin-info-chunk > s border: 1px solid #888; } +input.tc-palette-manager-colour-input { + width: 100%; + padding: 0; +} + /* ** Table of contents */