diff --git a/ts/components/ButtonDropdown.svelte b/ts/components/ButtonDropdown.svelte index 65e778e6a..7f8246e5c 100644 --- a/ts/components/ButtonDropdown.svelte +++ b/ts/components/ButtonDropdown.svelte @@ -3,17 +3,18 @@ Copyright: Ankitects Pty Ltd and contributors License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html --> - + + + diff --git a/ts/components/DropdownItem.svelte b/ts/components/DropdownItem.svelte index 6ea252f92..321b7db15 100644 --- a/ts/components/DropdownItem.svelte +++ b/ts/components/DropdownItem.svelte @@ -7,12 +7,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import { nightModeKey } from "./contextKeys"; export let id: string; - export let className = ""; - export let tooltip: string; - export let label: string; - export let shortcutLabel: string | undefined; + let className = ""; + export { className as class }; - export let onClick: (event: MouseEvent) => void; + export let tooltip: string; let buttonRef: HTMLButtonElement; @@ -28,6 +26,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html button { display: flex; justify-content: space-between; + + font-size: calc(var(--toolbar-size) / 2.3); } .btn-day { @@ -52,15 +52,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html color: white; } } - - span { - font-size: calc(var(--toolbar-size) / 2.3); - color: inherit; - } - - .monospace { - font-family: monospace; - } diff --git a/ts/components/DropdownMenu.svelte b/ts/components/DropdownMenu.svelte index 707ac07ad..4ffd9b361 100644 --- a/ts/components/DropdownMenu.svelte +++ b/ts/components/DropdownMenu.svelte @@ -3,23 +3,21 @@ Copyright: Ankitects Pty Ltd and contributors License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html --> - +
+ +
diff --git a/ts/components/IconButton.svelte b/ts/components/IconButton.svelte index 0987167fe..56269538e 100644 --- a/ts/components/IconButton.svelte +++ b/ts/components/IconButton.svelte @@ -4,8 +4,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html --> @@ -71,13 +66,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {id} class={`btn ${className}`} class:active - class:dropdown-toggle={dropdownToggle} class:btn-day={!nightMode} class:btn-night={nightMode} tabindex="-1" title={tooltip} disabled={_disabled} - {...extraProps} + class:dropdown-toggle={Boolean(dropdown)} + {...dropdownProps} on:click on:mousedown|preventDefault> diff --git a/ts/components/WithDropdownMenu.svelte b/ts/components/WithDropdownMenu.svelte index bf48a4152..12b43cddb 100644 --- a/ts/components/WithDropdownMenu.svelte +++ b/ts/components/WithDropdownMenu.svelte @@ -3,39 +3,33 @@ Copyright: Ankitects Pty Ltd and contributors License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html --> - + diff --git a/ts/components/contextKeys.ts b/ts/components/contextKeys.ts index 7a3b267e3..bbf71738c 100644 --- a/ts/components/contextKeys.ts +++ b/ts/components/contextKeys.ts @@ -4,3 +4,4 @@ export const nightModeKey = Symbol("nightMode"); export const disabledKey = Symbol("disabled"); export const buttonGroupKey = Symbol("buttonGroup"); +export const dropdownKey = Symbol("dropdown"); diff --git a/ts/editor/EditorToolbar.svelte b/ts/editor/EditorToolbar.svelte index 256e57b9d..5ed197d9b 100644 --- a/ts/editor/EditorToolbar.svelte +++ b/ts/editor/EditorToolbar.svelte @@ -57,5 +57,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + diff --git a/ts/editor/FormatBlockButtons.svelte b/ts/editor/FormatBlockButtons.svelte index c186e7707..d66de7cde 100644 --- a/ts/editor/FormatBlockButtons.svelte +++ b/ts/editor/FormatBlockButtons.svelte @@ -42,52 +42,120 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } - - - - {@html justifyLeftIcon} - - - - {@html justifyCenterIcon} - - - - {@html justifyCenterIcon} - - - - {@html justifyRightIcon} - - - - {@html justifyFullIcon} - - - - - - {@html outdentIcon} - - - - {@html indentIcon} - - - - - - {@html ulIcon} - + document.queryCommandState('insertUnorderedList')} + let:state={active} + let:updateState> + { + document.execCommand('insertUnorderedList'); + updateState(event); + }}> + {@html ulIcon} + + - - {@html olIcon} - + document.queryCommandState('insertOrderedList')} + let:state={active} + let:updateState> + { + document.execCommand('insertOrderedList'); + updateState(event); + }}> + {@html olIcon} + + - - + + createDropdown(event.detail.button)}> {@html listOptionsIcon} + + + + document.queryCommandState('justifyLeft')} + let:state={active} + let:updateState> + { + document.execCommand('justifyLeft'); + updateState(event); + }}> + {@html justifyLeftIcon} + + + + document.queryCommandState('justifyCenter')} + let:state={active} + let:updateState> + { + document.execCommand('justifyCenter'); + updateState(event); + }}> + {@html justifyCenterIcon} + + + + document.queryCommandState('justifyRight')} + let:state={active} + let:updateState> + { + document.execCommand('justifyRight'); + updateState(event); + }}> + {@html justifyRightIcon} + + + + document.queryCommandState('justifyFull')} + let:state={active} + let:updateState> + { + document.execCommand('justifyFull'); + updateState(event); + }}> + {@html justifyFullIcon} + + + + + + + {@html outdentIcon} + + + + {@html indentIcon} + + +