anki/ts/editor-toolbar/format.ts

82 lines
1.7 KiB
TypeScript
Raw Normal View History

import CommandIconButton from "./CommandIconButton.svelte";
import { lazyProperties } from "anki/lazy";
import * as tr from "anki/i18n";
2021-03-29 21:05:30 +02:00
import boldIcon from "./type-bold.svg";
import italicIcon from "./type-italic.svg";
import underlineIcon from "./type-underline.svg";
import superscriptIcon from "./format-superscript.svg";
import subscriptIcon from "./format-subscript.svg";
import eraserIcon from "./eraser.svg";
const boldButton = {
2021-03-29 21:05:30 +02:00
component: CommandIconButton,
icon: boldIcon,
command: "bold",
};
lazyProperties(boldButton, {
title: tr.editingBoldTextCtrlandb,
});
const italicButton = {
2021-03-29 21:05:30 +02:00
component: CommandIconButton,
icon: italicIcon,
command: "italic",
};
lazyProperties(italicButton, {
title: tr.editingItalicTextCtrlandi,
});
const underlineButton = {
2021-03-29 21:05:30 +02:00
component: CommandIconButton,
icon: underlineIcon,
command: "underline",
};
lazyProperties(underlineButton, {
title: tr.editingUnderlineTextCtrlandu,
});
const superscriptButton = {
2021-03-29 21:05:30 +02:00
component: CommandIconButton,
icon: superscriptIcon,
command: "superscript",
};
lazyProperties(superscriptButton, {
title: tr.editingSuperscriptCtrlandand,
});
const subscriptButton = {
2021-03-29 21:05:30 +02:00
component: CommandIconButton,
icon: subscriptIcon,
command: "subscript",
};
lazyProperties(subscriptButton, {
title: tr.editingSubscriptCtrland,
});
const removeFormatButton = {
2021-03-29 21:05:30 +02:00
component: CommandIconButton,
icon: eraserIcon,
command: "removeFormat",
activatable: false,
2021-03-29 21:05:30 +02:00
};
lazyProperties(removeFormatButton, {
title: tr.editingRemoveFormattingCtrlandr,
});
export const formatButtons = [
boldButton,
italicButton,
underlineButton,
superscriptButton,
subscriptButton,
removeFormatButton,
];