2021-04-15 15:59:52 +02:00
|
|
|
<!--
|
|
|
|
Copyright: Ankitects Pty Ltd and contributors
|
|
|
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
-->
|
2021-04-07 23:53:09 +02:00
|
|
|
<script context="module" lang="typescript">
|
2021-04-09 20:55:49 +02:00
|
|
|
import "./legacy.css";
|
2021-05-06 23:15:41 +02:00
|
|
|
// @ts-expect-error Insufficient typing
|
2021-04-28 13:32:25 +02:00
|
|
|
import { updateAllState, resetAllState } from "components/WithState.svelte";
|
|
|
|
|
|
|
|
export function updateActiveButtons(event: Event) {
|
2021-04-28 14:01:55 +02:00
|
|
|
updateAllState(event);
|
2021-04-28 13:32:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export function clearActiveButtons() {
|
|
|
|
resetAllState(false);
|
2021-04-07 23:53:09 +02:00
|
|
|
}
|
2021-05-05 01:22:51 +02:00
|
|
|
|
2021-07-05 16:19:03 +02:00
|
|
|
/* Our dynamic components */
|
2021-05-06 20:29:55 +02:00
|
|
|
import AddonButtons from "./AddonButtons.svelte";
|
2021-05-06 16:10:26 +02:00
|
|
|
import PreviewButton from "./PreviewButton.svelte";
|
|
|
|
|
|
|
|
export const editorToolbar = {
|
2021-05-06 20:29:55 +02:00
|
|
|
AddonButtons,
|
2021-05-06 16:10:26 +02:00
|
|
|
PreviewButton,
|
|
|
|
};
|
2021-04-07 23:53:09 +02:00
|
|
|
</script>
|
|
|
|
|
2021-03-25 23:32:23 +01:00
|
|
|
<script lang="typescript">
|
2021-06-05 03:28:36 +02:00
|
|
|
import { isApplePlatform } from "lib/platform";
|
2021-04-27 23:08:47 +02:00
|
|
|
import StickyBar from "components/StickyBar.svelte";
|
2021-05-06 18:51:44 +02:00
|
|
|
import ButtonToolbar from "components/ButtonToolbar.svelte";
|
2021-05-29 17:44:08 +02:00
|
|
|
import Item from "components/Item.svelte";
|
2021-03-30 06:14:00 +02:00
|
|
|
|
2021-04-27 21:01:44 +02:00
|
|
|
import NoteTypeButtons from "./NoteTypeButtons.svelte";
|
2021-04-28 02:27:38 +02:00
|
|
|
import FormatInlineButtons from "./FormatInlineButtons.svelte";
|
|
|
|
import FormatBlockButtons from "./FormatBlockButtons.svelte";
|
|
|
|
import ColorButtons from "./ColorButtons.svelte";
|
|
|
|
import TemplateButtons from "./TemplateButtons.svelte";
|
2021-04-27 21:01:44 +02:00
|
|
|
|
2021-05-27 15:50:49 +02:00
|
|
|
export let size = isApplePlatform() ? 1.6 : 2.0;
|
|
|
|
export let wrap = true;
|
|
|
|
|
2021-08-02 23:12:00 +02:00
|
|
|
export let textColor: string;
|
|
|
|
export let highlightColor: string;
|
|
|
|
|
2021-05-06 19:26:50 +02:00
|
|
|
export const toolbar = {};
|
2021-05-05 01:22:51 +02:00
|
|
|
export const notetypeButtons = {};
|
2021-05-06 16:10:26 +02:00
|
|
|
export const formatInlineButtons = {};
|
|
|
|
export const formatBlockButtons = {};
|
|
|
|
export const colorButtons = {};
|
|
|
|
export const templateButtons = {};
|
2021-03-25 21:11:40 +01:00
|
|
|
</script>
|
|
|
|
|
2021-05-27 17:13:36 +02:00
|
|
|
<StickyBar>
|
|
|
|
<ButtonToolbar {size} {wrap} api={toolbar}>
|
2021-05-29 17:44:08 +02:00
|
|
|
<Item id="notetype">
|
2021-05-27 17:13:36 +02:00
|
|
|
<NoteTypeButtons api={notetypeButtons} />
|
2021-05-29 17:44:08 +02:00
|
|
|
</Item>
|
2021-05-06 19:26:50 +02:00
|
|
|
|
2021-05-29 17:44:08 +02:00
|
|
|
<Item id="inlineFormatting">
|
2021-05-27 17:13:36 +02:00
|
|
|
<FormatInlineButtons api={formatInlineButtons} />
|
2021-05-29 17:44:08 +02:00
|
|
|
</Item>
|
2021-05-06 19:26:50 +02:00
|
|
|
|
2021-05-29 17:44:08 +02:00
|
|
|
<Item id="blockFormatting">
|
2021-05-27 17:13:36 +02:00
|
|
|
<FormatBlockButtons api={formatBlockButtons} />
|
2021-05-29 17:44:08 +02:00
|
|
|
</Item>
|
2021-05-06 19:26:50 +02:00
|
|
|
|
2021-05-29 17:44:08 +02:00
|
|
|
<Item id="color">
|
2021-08-02 23:12:00 +02:00
|
|
|
<ColorButtons {textColor} {highlightColor} api={colorButtons} />
|
2021-05-29 17:44:08 +02:00
|
|
|
</Item>
|
2021-05-06 19:26:50 +02:00
|
|
|
|
2021-05-29 17:44:08 +02:00
|
|
|
<Item id="template">
|
2021-05-27 17:13:36 +02:00
|
|
|
<TemplateButtons api={templateButtons} />
|
2021-05-29 17:44:08 +02:00
|
|
|
</Item>
|
2021-05-27 17:13:36 +02:00
|
|
|
</ButtonToolbar>
|
|
|
|
</StickyBar>
|