2021-03-30 06:14:00 +02:00
|
|
|
import CommandIconButton from "./CommandIconButton.svelte";
|
2021-04-08 16:29:28 +02:00
|
|
|
import type { CommandIconButtonProps } from "./CommandIconButton";
|
2021-04-01 01:22:06 +02:00
|
|
|
|
2021-04-08 16:29:28 +02:00
|
|
|
import { dynamicComponent } from "sveltelib/dynamicComponent";
|
2021-04-01 01:22:06 +02:00
|
|
|
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";
|
|
|
|
|
2021-04-08 16:29:28 +02:00
|
|
|
const commandIconButton = dynamicComponent(CommandIconButton);
|
|
|
|
|
2021-04-08 16:40:42 +02:00
|
|
|
const boldButton = commandIconButton<CommandIconButtonProps, "tooltip">(
|
2021-04-01 01:38:50 +02:00
|
|
|
{
|
|
|
|
icon: boldIcon,
|
|
|
|
command: "bold",
|
|
|
|
},
|
|
|
|
{
|
2021-04-08 16:40:42 +02:00
|
|
|
tooltip: tr.editingBoldTextCtrlandb,
|
2021-04-01 01:38:50 +02:00
|
|
|
}
|
|
|
|
);
|
2021-03-29 21:05:30 +02:00
|
|
|
|
2021-04-08 16:40:42 +02:00
|
|
|
const italicButton = commandIconButton<CommandIconButtonProps, "tooltip">(
|
2021-04-01 01:38:50 +02:00
|
|
|
{
|
|
|
|
icon: italicIcon,
|
|
|
|
command: "italic",
|
|
|
|
},
|
|
|
|
{
|
2021-04-08 16:40:42 +02:00
|
|
|
tooltip: tr.editingItalicTextCtrlandi,
|
2021-04-01 01:38:50 +02:00
|
|
|
}
|
|
|
|
);
|
2021-04-01 01:22:06 +02:00
|
|
|
|
2021-04-08 16:40:42 +02:00
|
|
|
const underlineButton = commandIconButton<CommandIconButtonProps, "tooltip">(
|
2021-04-01 01:38:50 +02:00
|
|
|
{
|
|
|
|
icon: underlineIcon,
|
|
|
|
command: "underline",
|
|
|
|
},
|
|
|
|
{
|
2021-04-08 16:40:42 +02:00
|
|
|
tooltip: tr.editingUnderlineTextCtrlandu,
|
2021-04-01 01:38:50 +02:00
|
|
|
}
|
|
|
|
);
|
2021-03-29 21:05:30 +02:00
|
|
|
|
2021-04-08 16:40:42 +02:00
|
|
|
const superscriptButton = commandIconButton<CommandIconButtonProps, "tooltip">(
|
2021-04-01 01:38:50 +02:00
|
|
|
{
|
|
|
|
icon: superscriptIcon,
|
|
|
|
command: "superscript",
|
|
|
|
},
|
|
|
|
{
|
2021-04-08 16:40:42 +02:00
|
|
|
tooltip: tr.editingSuperscriptCtrlandand,
|
2021-04-01 01:38:50 +02:00
|
|
|
}
|
|
|
|
);
|
2021-04-01 01:22:06 +02:00
|
|
|
|
2021-04-08 16:40:42 +02:00
|
|
|
const subscriptButton = commandIconButton<CommandIconButtonProps, "tooltip">(
|
2021-04-01 01:38:50 +02:00
|
|
|
{
|
|
|
|
icon: subscriptIcon,
|
|
|
|
command: "subscript",
|
|
|
|
},
|
|
|
|
{
|
2021-04-08 16:40:42 +02:00
|
|
|
tooltip: tr.editingSubscriptCtrland,
|
2021-04-01 01:38:50 +02:00
|
|
|
}
|
|
|
|
);
|
2021-03-29 21:05:30 +02:00
|
|
|
|
2021-04-08 16:40:42 +02:00
|
|
|
const removeFormatButton = commandIconButton<CommandIconButtonProps, "tooltip">(
|
2021-04-01 01:38:50 +02:00
|
|
|
{
|
|
|
|
icon: eraserIcon,
|
|
|
|
command: "removeFormat",
|
|
|
|
activatable: false,
|
|
|
|
},
|
|
|
|
{
|
2021-04-08 16:40:42 +02:00
|
|
|
tooltip: tr.editingRemoveFormattingCtrlandr,
|
2021-04-01 01:38:50 +02:00
|
|
|
}
|
|
|
|
);
|
2021-04-01 01:22:06 +02:00
|
|
|
|
2021-04-01 00:45:02 +02:00
|
|
|
export const formatButtons = [
|
|
|
|
boldButton,
|
|
|
|
italicButton,
|
|
|
|
underlineButton,
|
|
|
|
superscriptButton,
|
|
|
|
subscriptButton,
|
2021-04-01 01:22:06 +02:00
|
|
|
removeFormatButton,
|
2021-04-01 00:45:02 +02:00
|
|
|
];
|