anki/ts/editor/EditorToolbar.svelte

77 lines
2.4 KiB
Svelte
Raw Normal View History

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
-->
<script context="module" lang="typescript">
import "./legacy.css";
// @ts-expect-error Insufficient typing
import { updateAllState, resetAllState } from "components/WithState.svelte";
export function updateActiveButtons(event: Event) {
2021-04-28 14:01:55 +02:00
updateAllState(event);
}
export function clearActiveButtons() {
resetAllState(false);
}
/* Export components */
2021-05-06 20:29:55 +02:00
import AddonButtons from "./AddonButtons.svelte";
import PreviewButton from "./PreviewButton.svelte";
import LabelButton from "components/LabelButton.svelte";
import IconButton from "components/IconButton.svelte";
export const editorToolbar = {
2021-05-06 20:29:55 +02:00
AddonButtons,
PreviewButton,
LabelButton,
IconButton,
};
</script>
2021-03-25 23:32:23 +01:00
<script lang="typescript">
2021-04-27 23:08:47 +02:00
import StickyBar from "components/StickyBar.svelte";
import ButtonToolbar from "components/ButtonToolbar.svelte";
import ButtonToolbarItem from "components/ButtonToolbarItem.svelte";
import NoteTypeButtons from "./NoteTypeButtons.svelte";
import FormatInlineButtons from "./FormatInlineButtons.svelte";
import FormatBlockButtons from "./FormatBlockButtons.svelte";
import ColorButtons from "./ColorButtons.svelte";
import TemplateButtons from "./TemplateButtons.svelte";
export const toolbar = {};
export const notetypeButtons = {};
export const formatInlineButtons = {};
export const formatBlockButtons = {};
export const colorButtons = {};
export const templateButtons = {};
export let size = 1.85;
export let wrap = true;
2021-03-25 21:11:40 +01:00
</script>
<StickyBar>
<ButtonToolbar {size} {wrap} api={toolbar}>
<ButtonToolbarItem id="notetype">
<NoteTypeButtons api={notetypeButtons} />
</ButtonToolbarItem>
<ButtonToolbarItem id="inlineFormatting">
<FormatInlineButtons api={formatInlineButtons} />
</ButtonToolbarItem>
<ButtonToolbarItem id="blockFormatting">
<FormatBlockButtons api={formatBlockButtons} />
</ButtonToolbarItem>
<ButtonToolbarItem id="color">
<ColorButtons api={colorButtons} />
</ButtonToolbarItem>
<ButtonToolbarItem id="template">
<TemplateButtons api={templateButtons} />
</ButtonToolbarItem>
</ButtonToolbar>
</StickyBar>