2021-11-23 01:27:32 +01:00
|
|
|
<!--
|
|
|
|
Copyright: Ankitects Pty Ltd and contributors
|
|
|
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
-->
|
|
|
|
<script lang="ts">
|
2022-02-04 09:36:34 +01:00
|
|
|
import { createEventDispatcher } from "svelte";
|
|
|
|
|
2021-11-23 01:27:32 +01:00
|
|
|
import ButtonGroup from "../../components/ButtonGroup.svelte";
|
2022-02-04 09:36:34 +01:00
|
|
|
import ButtonToolbar from "../../components/ButtonToolbar.svelte";
|
2021-11-23 01:27:32 +01:00
|
|
|
import IconButton from "../../components/IconButton.svelte";
|
2022-01-08 02:46:01 +01:00
|
|
|
import { hasBlockAttribute } from "../../lib/dom";
|
2022-02-04 09:36:34 +01:00
|
|
|
import * as tr from "../../lib/ftl";
|
2022-05-13 05:04:20 +02:00
|
|
|
import ClozeButtons from "../ClozeButtons.svelte";
|
2022-02-04 09:36:34 +01:00
|
|
|
import { blockIcon, deleteIcon, inlineIcon } from "./icons";
|
2021-11-23 01:27:32 +01:00
|
|
|
|
2022-01-08 02:46:01 +01:00
|
|
|
export let element: Element;
|
|
|
|
|
|
|
|
$: isBlock = hasBlockAttribute(element);
|
|
|
|
|
|
|
|
function updateBlock() {
|
|
|
|
element.setAttribute("block", String(isBlock));
|
|
|
|
}
|
2021-11-23 01:27:32 +01:00
|
|
|
|
|
|
|
const dispatch = createEventDispatcher();
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<ButtonToolbar size={1.6} wrap={false}>
|
2022-02-03 05:52:11 +01:00
|
|
|
<ButtonGroup>
|
|
|
|
<IconButton
|
|
|
|
tooltip={tr.editingMathjaxInline()}
|
|
|
|
active={!isBlock}
|
|
|
|
on:click={() => {
|
|
|
|
isBlock = false;
|
|
|
|
updateBlock();
|
|
|
|
}}
|
|
|
|
on:click
|
|
|
|
--border-left-radius="5px">{@html inlineIcon}</IconButton
|
|
|
|
>
|
2021-11-23 01:27:32 +01:00
|
|
|
|
2022-02-03 05:52:11 +01:00
|
|
|
<IconButton
|
|
|
|
tooltip={tr.editingMathjaxBlock()}
|
|
|
|
active={isBlock}
|
|
|
|
on:click={() => {
|
|
|
|
isBlock = true;
|
|
|
|
updateBlock();
|
|
|
|
}}
|
|
|
|
on:click
|
|
|
|
--border-right-radius="5px">{@html blockIcon}</IconButton
|
|
|
|
>
|
|
|
|
</ButtonGroup>
|
2021-11-23 01:27:32 +01:00
|
|
|
|
2022-05-13 05:04:20 +02:00
|
|
|
<ClozeButtons on:surround />
|
|
|
|
|
2022-02-03 05:52:11 +01:00
|
|
|
<ButtonGroup>
|
|
|
|
<IconButton
|
|
|
|
tooltip={tr.actionsDelete()}
|
|
|
|
on:click={() => dispatch("delete")}
|
|
|
|
--border-left-radius="5px"
|
|
|
|
--border-right-radius="5px">{@html deleteIcon}</IconButton
|
|
|
|
>
|
|
|
|
</ButtonGroup>
|
2021-11-23 01:27:32 +01:00
|
|
|
</ButtonToolbar>
|