From cc39a8643066aca77ca6e680621bf2438c278d39 Mon Sep 17 00:00:00 2001 From: BurningTreeC Date: Mon, 5 Mar 2018 12:05:44 +0100 Subject: [PATCH] KaTeX - EditorToolbar stamp button for wysiwyg katex snippet input (#3131) * add KaTeX logo * add katex stamp button * add katex stamp dropdown * add a snippet so that the dropdown isn't empty * correct dropdown title * change tag * update snippets tag --- plugins/tiddlywiki/katex/katex-logo.tid | 3 ++ plugins/tiddlywiki/katex/snippets/logo.tid | 4 ++ .../katex/ui/EditorToolbar/katex-dropdown.tid | 53 +++++++++++++++++++ .../katex/ui/EditorToolbar/katex.tid | 8 +++ 4 files changed, 68 insertions(+) create mode 100644 plugins/tiddlywiki/katex/katex-logo.tid create mode 100644 plugins/tiddlywiki/katex/snippets/logo.tid create mode 100644 plugins/tiddlywiki/katex/ui/EditorToolbar/katex-dropdown.tid create mode 100644 plugins/tiddlywiki/katex/ui/EditorToolbar/katex.tid diff --git a/plugins/tiddlywiki/katex/katex-logo.tid b/plugins/tiddlywiki/katex/katex-logo.tid new file mode 100644 index 000000000..994e0f0b8 --- /dev/null +++ b/plugins/tiddlywiki/katex/katex-logo.tid @@ -0,0 +1,3 @@ +title: $:/plugins/tiddlywiki/katex/katex-logo + +$$\KaTeX$$ diff --git a/plugins/tiddlywiki/katex/snippets/logo.tid b/plugins/tiddlywiki/katex/snippets/logo.tid new file mode 100644 index 000000000..1e634a139 --- /dev/null +++ b/plugins/tiddlywiki/katex/snippets/logo.tid @@ -0,0 +1,4 @@ +title: $:/plugins/tiddlywiki/katex/snippets/logo +tags: $:/tags/KaTeX/Snippet + +$$\KaTeX$$ diff --git a/plugins/tiddlywiki/katex/ui/EditorToolbar/katex-dropdown.tid b/plugins/tiddlywiki/katex/ui/EditorToolbar/katex-dropdown.tid new file mode 100644 index 000000000..16349b45c --- /dev/null +++ b/plugins/tiddlywiki/katex/ui/EditorToolbar/katex-dropdown.tid @@ -0,0 +1,53 @@ +title: $:/plugins/tiddlywiki/katex/ui/EditorToolbar/katex-dropdown + +\define toolbar-button-stamp-inner() +<$button tag="a"> + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="replace-selection" + text={{$(snippetTitle)$}} +/> + +<$action-deletetiddler + $tiddler=<> +/> + +<$view tiddler=<> field="caption" mode="inline"> + +<$transclude tiddler=<> mode="inline"/> + + + + +\end + +<$list filter="[all[shadows+tiddlers]tag[$:/tags/KaTeX/Snippet]!has[draft.of]sort[caption]]" variable="snippetTitle"> + +<> + + + +---- + +<$button tag="a"> + +<$action-sendmessage + $message="tm-new-tiddler" + tags="$:/tags/KaTeX/Snippet" + text="""$$snippet$$""" +/> + +<$action-deletetiddler + $tiddler=<> +/> + + + +<$text text={{$:/language/Buttons/Stamp/Caption/New}}/> + + + + + +[ext[KaTeX functions catalogue|https://khan.github.io/KaTeX/function-support.html]] diff --git a/plugins/tiddlywiki/katex/ui/EditorToolbar/katex.tid b/plugins/tiddlywiki/katex/ui/EditorToolbar/katex.tid new file mode 100644 index 000000000..3720257d5 --- /dev/null +++ b/plugins/tiddlywiki/katex/ui/EditorToolbar/katex.tid @@ -0,0 +1,8 @@ +title: $:/plugins/tiddlywiki/katex/ui/EditorToolbar/katex +tags: $:/tags/EditorToolbar +icon: $:/plugins/tiddlywiki/katex/katex-logo +caption: katex +description: create and insert preconfigured KaTeX snippets +condition: [!is[image]] +dropdown: $:/plugins/tiddlywiki/katex/ui/EditorToolbar/katex-dropdown +text: