From c1adebf2da99e01a43498365b48660d1fd540b4c Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Wed, 28 Apr 2021 23:31:45 +0200 Subject: [PATCH] Add .dropdown-menu class to DropdownMenu --- ts/components/DropdownMenu.svelte | 2 +- ts/editor/EditorToolbar.svelte | 1 + ts/editor/TemplateButtons.svelte | 115 ++++++++++++++++++------------ ts/editor/helpers.ts | 4 ++ 4 files changed, 75 insertions(+), 47 deletions(-) diff --git a/ts/components/DropdownMenu.svelte b/ts/components/DropdownMenu.svelte index 4ffd9b361..12cc0fbee 100644 --- a/ts/components/DropdownMenu.svelte +++ b/ts/components/DropdownMenu.svelte @@ -18,6 +18,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } -
+
diff --git a/ts/editor/EditorToolbar.svelte b/ts/editor/EditorToolbar.svelte index 45c9403ef..217475d15 100644 --- a/ts/editor/EditorToolbar.svelte +++ b/ts/editor/EditorToolbar.svelte @@ -59,5 +59,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + diff --git a/ts/editor/TemplateButtons.svelte b/ts/editor/TemplateButtons.svelte index 2b2042702..2df8ce46f 100644 --- a/ts/editor/TemplateButtons.svelte +++ b/ts/editor/TemplateButtons.svelte @@ -15,6 +15,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import ClozeButton from "./ClozeButton.svelte"; import { wrap } from "./wrap"; + import { appendInParentheses } from "./helpers"; import { paperclipIcon, micIcon, functionIcon, xmlIcon } from "./icons"; function onAttachment(): void { @@ -28,72 +29,94 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html function onHtmlEdit(): void { bridgeCommand("htmlEdit"); } - - const mathjaxMenuId = "mathjaxMenu"; {@html paperclipIcon} - + {@html micIcon} - - {@html functionIcon} - + + + {@html functionIcon} + + + + + wrap('\\(', '\\)')}> + {tr.editingMathjaxInline()} + + + + + wrap('\\[', '\\]')}> + {tr.editingMathjaxBlock()} + + + + + wrap('\\(\\ce{', '}\\)')}> + {tr.editingMathjaxChemistry()} + + + + + wrap('[latex]', '[/latex]')}> + {tr.editingLatex()} + + + + + wrap('[$]', '[/$]')}> + {tr.editingLatexEquation()} + + + + + wrap('[$$]', '[/$$]')}> + {tr.editingLatexMathEnv()} + + + + - + {@html xmlIcon} - - - - wrap('\\(', '\\)')}> - {tr.editingMathjaxInline} - - - - - wrap('\\[', '\\]')}> - {tr.editingMathjaxBlock} - - - - - wrap('\\(\\ce{', '}\\)')}> - {tr.editingMathjaxChemistry} - - - - - wrap('[latex]', '[/latex]')}> - {tr.editingLatex} - - - - - wrap('[$]', '[/$]')}> - {tr.editingLatexEquation} - - - - - wrap('[$$]', '[/$$]')}> - {tr.editingLatexMathEnv} - - - diff --git a/ts/editor/helpers.ts b/ts/editor/helpers.ts index cffcb1480..6d752e752 100644 --- a/ts/editor/helpers.ts +++ b/ts/editor/helpers.ts @@ -110,3 +110,7 @@ const isBlockElement = ( export const getListItem = getAnchorParent(isListItem); export const getParagraph = getAnchorParent(isParagraph); export const getBlockElement = getAnchorParent(isBlockElement); + +export function appendInParentheses(text: string, appendix: string): string { + return `${text} (${appendix})`; +}