anki/ts/editor-toolbar/index.ts

30 lines
995 B
TypeScript
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
import type { ToolbarItem, IterableToolbarItem } from "./types";
import EditorToolbar from "./EditorToolbar.svelte";
export { default as EditorToolbar } from "./EditorToolbar.svelte";
2021-03-25 21:11:40 +01:00
2021-04-14 14:37:14 +02:00
import "./bootstrap.css";
export function editorToolbar(
target: HTMLElement,
buttons: IterableToolbarItem[] = [],
menus: ToolbarItem[] = []
): EditorToolbar {
return new EditorToolbar({
target,
props: {
buttons,
menus,
nightMode: document.documentElement.classList.contains("night-mode"),
},
});
}
2021-04-01 02:26:56 +02:00
/* Exports for editor */
2021-04-22 19:19:39 +02:00
// @ts-expect-error insufficient typing of svelte modules
export { updateActiveButtons, clearActiveButtons } from "./CommandIconButton.svelte";
2021-04-22 19:19:39 +02:00
// @ts-expect-error insufficient typing of svelte modules
export { enableButtons, disableButtons } from "./EditorToolbar.svelte";