2021-04-28 02:27:38 +02:00
|
|
|
<!--
|
|
|
|
Copyright: Ankitects Pty Ltd and contributors
|
|
|
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
-->
|
|
|
|
<script lang="typescript">
|
|
|
|
import * as tr from "lib/i18n";
|
|
|
|
import { bridgeCommand } from "lib/bridgecommand";
|
|
|
|
|
|
|
|
import ButtonGroup from "components/ButtonGroup.svelte";
|
2021-05-06 01:58:14 +02:00
|
|
|
import ButtonGroupItem from "components/ButtonGroupItem.svelte";
|
|
|
|
import IconButton from "components/IconButton.svelte";
|
2021-04-28 02:27:38 +02:00
|
|
|
import DropdownMenu from "components/DropdownMenu.svelte";
|
|
|
|
import DropdownItem from "components/DropdownItem.svelte";
|
|
|
|
import WithDropdownMenu from "components/WithDropdownMenu.svelte";
|
|
|
|
import WithShortcut from "components/WithShortcut.svelte";
|
|
|
|
import ClozeButton from "./ClozeButton.svelte";
|
|
|
|
|
|
|
|
import { wrap } from "./wrap";
|
2021-04-28 23:31:45 +02:00
|
|
|
import { appendInParentheses } from "./helpers";
|
2021-04-28 02:27:38 +02:00
|
|
|
import { paperclipIcon, micIcon, functionIcon, xmlIcon } from "./icons";
|
|
|
|
|
2021-05-06 16:10:26 +02:00
|
|
|
export let api = {};
|
|
|
|
|
2021-04-28 02:27:38 +02:00
|
|
|
function onAttachment(): void {
|
|
|
|
bridgeCommand("attach");
|
|
|
|
}
|
|
|
|
|
|
|
|
function onRecord(): void {
|
|
|
|
bridgeCommand("record");
|
|
|
|
}
|
|
|
|
|
|
|
|
function onHtmlEdit(): void {
|
|
|
|
bridgeCommand("htmlEdit");
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2021-05-06 19:26:50 +02:00
|
|
|
<ButtonGroup {api}>
|
2021-05-06 01:58:14 +02:00
|
|
|
<ButtonGroupItem>
|
2021-05-20 18:28:59 +02:00
|
|
|
<WithShortcut shortcut={[['F3']]} let:createShortcut let:shortcutLabel>
|
2021-05-06 01:58:14 +02:00
|
|
|
<IconButton
|
|
|
|
tooltip={appendInParentheses(tr.editingAttachPicturesaudiovideo(), shortcutLabel)}
|
|
|
|
on:click={onAttachment}
|
|
|
|
on:mount={createShortcut}>
|
|
|
|
{@html paperclipIcon}
|
|
|
|
</IconButton>
|
|
|
|
</WithShortcut>
|
|
|
|
</ButtonGroupItem>
|
|
|
|
|
|
|
|
<ButtonGroupItem>
|
2021-05-20 18:28:59 +02:00
|
|
|
<WithShortcut shortcut={[['F5']]} let:createShortcut let:shortcutLabel>
|
2021-05-06 01:58:14 +02:00
|
|
|
<IconButton
|
|
|
|
tooltip={appendInParentheses(tr.editingRecordAudio(), shortcutLabel)}
|
2021-05-06 02:49:59 +02:00
|
|
|
on:click={onRecord}
|
|
|
|
on:mount={createShortcut}>
|
2021-05-06 01:58:14 +02:00
|
|
|
{@html micIcon}
|
|
|
|
</IconButton>
|
|
|
|
</WithShortcut>
|
|
|
|
</ButtonGroupItem>
|
|
|
|
|
2021-05-06 16:10:26 +02:00
|
|
|
<ButtonGroupItem id="cloze">
|
2021-05-06 01:58:14 +02:00
|
|
|
<ClozeButton />
|
|
|
|
</ButtonGroupItem>
|
2021-04-28 02:27:38 +02:00
|
|
|
|
2021-05-06 23:49:59 +02:00
|
|
|
<ButtonGroupItem>
|
2021-05-18 16:32:29 +02:00
|
|
|
<WithDropdownMenu let:createDropdown let:menuId>
|
2021-05-06 01:58:14 +02:00
|
|
|
<IconButton on:mount={createDropdown}>
|
|
|
|
{@html functionIcon}
|
|
|
|
</IconButton>
|
2021-05-06 23:49:59 +02:00
|
|
|
|
|
|
|
<DropdownMenu id={menuId}>
|
|
|
|
<WithShortcut
|
2021-05-20 18:28:59 +02:00
|
|
|
shortcut={[['Control', 'm'], ['m']]}
|
2021-05-06 23:49:59 +02:00
|
|
|
let:createShortcut
|
|
|
|
let:shortcutLabel>
|
|
|
|
<DropdownItem
|
|
|
|
on:click={() => wrap('\\(', '\\)')}
|
|
|
|
on:mount={createShortcut}>
|
|
|
|
{tr.editingMathjaxInline()}
|
|
|
|
<span class="ps-1 float-end">{shortcutLabel}</span>
|
|
|
|
</DropdownItem>
|
|
|
|
</WithShortcut>
|
|
|
|
|
|
|
|
<WithShortcut
|
2021-05-20 18:28:59 +02:00
|
|
|
shortcut={[['Control', 'm'], ['e']]}
|
2021-05-06 23:49:59 +02:00
|
|
|
let:createShortcut
|
|
|
|
let:shortcutLabel>
|
|
|
|
<DropdownItem
|
|
|
|
on:click={() => wrap('\\[', '\\]')}
|
|
|
|
on:mount={createShortcut}>
|
|
|
|
{tr.editingMathjaxBlock()}
|
|
|
|
<span class="ps-1 float-end">{shortcutLabel}</span>
|
|
|
|
</DropdownItem>
|
|
|
|
</WithShortcut>
|
|
|
|
|
|
|
|
<WithShortcut
|
2021-05-20 18:28:59 +02:00
|
|
|
shortcut={[['Control', 'm'], ['c']]}
|
2021-05-06 23:49:59 +02:00
|
|
|
let:createShortcut
|
|
|
|
let:shortcutLabel>
|
|
|
|
<DropdownItem
|
|
|
|
on:click={() => wrap('\\(\\ce{', '}\\)')}
|
|
|
|
on:mount={createShortcut}>
|
|
|
|
{tr.editingMathjaxChemistry()}
|
|
|
|
<span class="ps-1 float-end">{shortcutLabel}</span>
|
|
|
|
</DropdownItem>
|
|
|
|
</WithShortcut>
|
|
|
|
|
|
|
|
<WithShortcut
|
2021-05-20 18:28:59 +02:00
|
|
|
shortcut={[['Control', 't'], ['t']]}
|
2021-05-06 23:49:59 +02:00
|
|
|
let:createShortcut
|
|
|
|
let:shortcutLabel>
|
|
|
|
<DropdownItem
|
|
|
|
on:click={() => wrap('[latex]', '[/latex]')}
|
|
|
|
on:mount={createShortcut}>
|
|
|
|
{tr.editingLatex()}
|
|
|
|
<span class="ps-1 float-end">{shortcutLabel}</span>
|
|
|
|
</DropdownItem>
|
|
|
|
</WithShortcut>
|
|
|
|
|
|
|
|
<WithShortcut
|
2021-05-20 18:28:59 +02:00
|
|
|
shortcut={[['Control', 't'], ['e']]}
|
2021-05-06 23:49:59 +02:00
|
|
|
let:createShortcut
|
|
|
|
let:shortcutLabel>
|
|
|
|
<DropdownItem
|
|
|
|
on:click={() => wrap('[$]', '[/$]')}
|
|
|
|
on:mount={createShortcut}>
|
|
|
|
{tr.editingLatexEquation()}
|
|
|
|
<span class="ps-1 float-end">{shortcutLabel}</span>
|
|
|
|
</DropdownItem>
|
|
|
|
</WithShortcut>
|
|
|
|
|
|
|
|
<WithShortcut
|
2021-05-20 18:28:59 +02:00
|
|
|
shortcut={[['Control', 't'], ['m']]}
|
2021-05-06 23:49:59 +02:00
|
|
|
let:createShortcut
|
|
|
|
let:shortcutLabel>
|
|
|
|
<DropdownItem
|
|
|
|
on:click={() => wrap('[$$]', '[/$$]')}
|
|
|
|
on:mount={createShortcut}>
|
|
|
|
{tr.editingLatexMathEnv()}
|
|
|
|
<span class="ps-1 float-end">{shortcutLabel}</span>
|
|
|
|
</DropdownItem>
|
|
|
|
</WithShortcut>
|
|
|
|
</DropdownMenu>
|
|
|
|
</WithDropdownMenu>
|
|
|
|
</ButtonGroupItem>
|
2021-04-28 02:27:38 +02:00
|
|
|
|
2021-05-06 01:58:14 +02:00
|
|
|
<ButtonGroupItem>
|
|
|
|
<WithShortcut
|
2021-05-20 18:28:59 +02:00
|
|
|
shortcut={[['Control', 'Shift', 'X']]}
|
2021-05-06 01:58:14 +02:00
|
|
|
let:createShortcut
|
|
|
|
let:shortcutLabel>
|
|
|
|
<IconButton
|
|
|
|
tooltip={appendInParentheses(tr.editingHtmlEditor(), shortcutLabel)}
|
|
|
|
on:click={onHtmlEdit}
|
|
|
|
on:mount={createShortcut}>
|
|
|
|
{@html xmlIcon}
|
|
|
|
</IconButton>
|
|
|
|
</WithShortcut>
|
|
|
|
</ButtonGroupItem>
|
2021-04-28 02:27:38 +02:00
|
|
|
</ButtonGroup>
|