mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 07:22:23 -04:00
Make all buttons functional
This commit is contained in:
parent
2f808fe60c
commit
12021228a5
2 changed files with 36 additions and 6 deletions
|
@ -1,10 +1,40 @@
|
||||||
|
import { bridgeCommand } from "anki/bridgecommand";
|
||||||
|
|
||||||
import IconButton from "./IconButton.svelte";
|
import IconButton from "./IconButton.svelte";
|
||||||
import bracketsIcon from "./code-brackets.svg";
|
import bracketsIcon from "./code-brackets.svg";
|
||||||
import paperclipIcon from "./paperclip.svg";
|
import paperclipIcon from "./paperclip.svg";
|
||||||
import micIcon from "./mic.svg";
|
import micIcon from "./mic.svg";
|
||||||
import threeDotsIcon from "./three-dots.svg";
|
import threeDotsIcon from "./three-dots.svg";
|
||||||
|
|
||||||
export const clozeButton = { component: IconButton, icon: bracketsIcon };
|
function onCloze(): void {
|
||||||
export const attachmentButton = { component: IconButton, icon: paperclipIcon };
|
bridgeCommand("cloze");
|
||||||
export const micButton = { component: IconButton, icon: micIcon };
|
}
|
||||||
export const etcButton = { component: IconButton, icon: threeDotsIcon };
|
|
||||||
|
function onAttachment(): void {
|
||||||
|
bridgeCommand("attach");
|
||||||
|
}
|
||||||
|
|
||||||
|
function onRecord(): void {
|
||||||
|
bridgeCommand("record");
|
||||||
|
}
|
||||||
|
|
||||||
|
function onMore(): void {
|
||||||
|
bridgeCommand("more");
|
||||||
|
}
|
||||||
|
|
||||||
|
export const clozeButton = {
|
||||||
|
component: IconButton,
|
||||||
|
icon: bracketsIcon,
|
||||||
|
onClick: onCloze,
|
||||||
|
};
|
||||||
|
export const attachmentButton = {
|
||||||
|
component: IconButton,
|
||||||
|
icon: paperclipIcon,
|
||||||
|
onClick: onAttachment,
|
||||||
|
};
|
||||||
|
export const recordButton = { component: IconButton, icon: micIcon, onClick: onRecord };
|
||||||
|
export const moreButton = {
|
||||||
|
component: IconButton,
|
||||||
|
icon: threeDotsIcon,
|
||||||
|
onClick: onMore,
|
||||||
|
};
|
||||||
|
|
|
@ -15,7 +15,7 @@ import {
|
||||||
|
|
||||||
import { forecolorButton, colorpickerButton } from "./color";
|
import { forecolorButton, colorpickerButton } from "./color";
|
||||||
|
|
||||||
import { clozeButton, attachmentButton, micButton, etcButton } from "./extra";
|
import { clozeButton, attachmentButton, recordButton, moreButton } from "./extra";
|
||||||
|
|
||||||
const defaultButtons = [
|
const defaultButtons = [
|
||||||
[
|
[
|
||||||
|
@ -31,7 +31,7 @@ const defaultButtons = [
|
||||||
eraserButton,
|
eraserButton,
|
||||||
],
|
],
|
||||||
[forecolorButton, colorpickerButton],
|
[forecolorButton, colorpickerButton],
|
||||||
[clozeButton, attachmentButton, micButton, etcButton],
|
[clozeButton, attachmentButton, recordButton, moreButton],
|
||||||
];
|
];
|
||||||
|
|
||||||
class EditorToolbar extends HTMLElement {
|
class EditorToolbar extends HTMLElement {
|
||||||
|
|
Loading…
Reference in a new issue