anki/ts/editor/EditorToolbar.svelte

52 lines
1.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";
import { writable } from "svelte/store";
const disabled = writable(false);
export function enableButtons(): void {
disabled.set(false);
}
export function disableButtons(): void {
disabled.set(true);
}
</script>
2021-03-25 23:32:23 +01:00
<script lang="typescript">
import { setContext } from "svelte";
2021-04-27 23:08:47 +02:00
import { disabledKey, nightModeKey } from "components/contextKeys";
import WithTheming from "components/WithTheming.svelte";
import StickyBar from "components/StickyBar.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";
2021-03-25 23:32:23 +01:00
export let nightMode: boolean;
setContext(nightModeKey, nightMode);
2021-03-31 03:34:08 +02:00
setContext(disabledKey, disabled);
export let size: number = 30;
export let wraps: boolean = true;
$: style = `--toolbar-size: ${size}px; --toolbar-wrap: ${
wraps ? "wrap" : "nowrap"
}`;
2021-03-25 21:11:40 +01:00
</script>
<WithTheming {style}>
<StickyBar>
<NoteTypeButtons />
<FormatInlineButtons />
</StickyBar>
</WithTheming>