diff --git a/ts/editor-toolbar/ColorPicker.svelte b/ts/editor-toolbar/ColorPicker.svelte index c4a950225..38b78965e 100644 --- a/ts/editor-toolbar/ColorPicker.svelte +++ b/ts/editor-toolbar/ColorPicker.svelte @@ -6,11 +6,19 @@ - + diff --git a/ts/editor-toolbar/CommandIconButton.svelte b/ts/editor-toolbar/CommandIconButton.svelte new file mode 100644 index 000000000..e5f19189b --- /dev/null +++ b/ts/editor-toolbar/CommandIconButton.svelte @@ -0,0 +1,57 @@ + + + + + + + {@html icon} + + diff --git a/ts/editor-toolbar/EditorToolbar.svelte b/ts/editor-toolbar/EditorToolbar.svelte index e6e802d48..7de984a03 100644 --- a/ts/editor-toolbar/EditorToolbar.svelte +++ b/ts/editor-toolbar/EditorToolbar.svelte @@ -5,19 +5,20 @@ import LabelButton from "./LabelButton.svelte"; import IconButton from "./IconButton.svelte"; - import boldIcon from "./type-bold.svg"; - import italicIcon from "./type-italic.svg"; - import underlineIcon from "./type-underline.svg"; - - import superscriptIcon from "./format-superscript.svg"; - import subscriptIcon from "./format-subscript.svg"; import bracketsIcon from "./code-brackets.svg"; - import eraserIcon from "./eraser.svg"; import paperclipIcon from "./paperclip.svg"; import micIcon from "./mic.svg"; import threeDotsIcon from "./three-dots.svg"; + import { + boldButton, + italicButton, + underlineButton, + superscriptButton, + subscriptButton, + eraserButton, + } from "./format"; import { forecolorButton, colorpickerButton } from "./color"; export let leftButtons = [ @@ -26,14 +27,12 @@ ]; export let rightButtons = [ - { component: IconButton, icon: boldIcon }, - { component: IconButton, icon: italicIcon }, - { component: IconButton, icon: underlineIcon }, - - { component: IconButton, icon: superscriptIcon }, - { component: IconButton, icon: subscriptIcon }, - - { component: IconButton, icon: eraserIcon }, + boldButton, + italicButton, + underlineButton, + superscriptButton, + subscriptButton, + eraserButton, forecolorButton, colorpickerButton, diff --git a/ts/editor-toolbar/IconButton.svelte b/ts/editor-toolbar/IconButton.svelte index 133128a3d..443ad0055 100644 --- a/ts/editor-toolbar/IconButton.svelte +++ b/ts/editor-toolbar/IconButton.svelte @@ -1,31 +1,14 @@ - - - - {#if icon} - {@html icon} - {/if} - + + {@html icon} + diff --git a/ts/editor-toolbar/IconButtonInner.svelte b/ts/editor-toolbar/IconButtonInner.svelte new file mode 100644 index 000000000..f98b0ccef --- /dev/null +++ b/ts/editor-toolbar/IconButtonInner.svelte @@ -0,0 +1,36 @@ + + + + + diff --git a/ts/editor-toolbar/_buttons.scss b/ts/editor-toolbar/_buttons.scss index bdb515e5b..42250394a 100644 --- a/ts/editor-toolbar/_buttons.scss +++ b/ts/editor-toolbar/_buttons.scss @@ -10,10 +10,6 @@ button.linkb { opacity: 0.3; cursor: not-allowed; } - - .nightMode & > img { - filter: invert(180); - } } button:focus { @@ -28,13 +24,4 @@ button.highlighted { background: linear-gradient(0deg, #333333 0%, #434343 100%); } } - - #topbutsright & { - border-bottom: 3px solid black; - border-radius: 3px; - - .nightMode & { - border-bottom-color: white; - } - } } diff --git a/ts/editor-toolbar/format.ts b/ts/editor-toolbar/format.ts new file mode 100644 index 000000000..ddf656fca --- /dev/null +++ b/ts/editor-toolbar/format.ts @@ -0,0 +1,48 @@ +// @ts-ignore +import CommandIconButton, { updateButtons } from "./CommandIconButton.svelte"; +import boldIcon from "./type-bold.svg"; +import italicIcon from "./type-italic.svg"; +import underlineIcon from "./type-underline.svg"; +import superscriptIcon from "./format-superscript.svg"; +import subscriptIcon from "./format-subscript.svg"; +import eraserIcon from "./eraser.svg"; + +export const boldButton = { + component: CommandIconButton, + icon: boldIcon, + command: "bold", +}; + +export const italicButton = { + component: CommandIconButton, + icon: italicIcon, + command: "italic", +}; + +export const underlineButton = { + component: CommandIconButton, + icon: underlineIcon, + command: "underline", +}; + +export const superscriptButton = { + component: CommandIconButton, + icon: superscriptIcon, + command: "superscript", +}; + +export const subscriptButton = { + component: CommandIconButton, + icon: subscriptIcon, + command: "subscript", +}; + +export const eraserButton = { + component: CommandIconButton, + icon: eraserIcon, + command: "removeFormat", + highlightable: false, +}; + +// TODO +setInterval(updateButtons, 2000);