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 type { EditingArea } from "./editingArea";
|
|
|
|
import * as tr from "lib/i18n";
|
|
|
|
|
|
|
|
import IconButton from "components/IconButton.svelte";
|
|
|
|
import ButtonGroup from "components/ButtonGroup.svelte";
|
|
|
|
import ButtonDropdown from "components/ButtonDropdown.svelte";
|
2021-04-28 13:09:25 +02:00
|
|
|
import WithState from "components/WithState.svelte";
|
2021-04-28 02:27:38 +02:00
|
|
|
import WithDropdownMenu from "components/WithDropdownMenu.svelte";
|
|
|
|
|
|
|
|
import { getListItem } from "./helpers";
|
|
|
|
import {
|
|
|
|
ulIcon,
|
|
|
|
olIcon,
|
|
|
|
listOptionsIcon,
|
|
|
|
justifyFullIcon,
|
|
|
|
justifyLeftIcon,
|
|
|
|
justifyRightIcon,
|
|
|
|
justifyCenterIcon,
|
|
|
|
indentIcon,
|
|
|
|
outdentIcon,
|
|
|
|
} from "./icons";
|
|
|
|
|
|
|
|
export let api = {};
|
|
|
|
|
|
|
|
function outdentListItem() {
|
|
|
|
const currentField = document.activeElement as EditingArea;
|
|
|
|
if (getListItem(currentField.shadowRoot!)) {
|
|
|
|
document.execCommand("outdent");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function indentListItem() {
|
|
|
|
const currentField = document.activeElement as EditingArea;
|
|
|
|
if (getListItem(currentField.shadowRoot!)) {
|
|
|
|
document.execCommand("indent");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<ButtonDropdown id="listFormatting">
|
|
|
|
<ButtonGroup id="justify" {api}>
|
2021-04-28 13:09:25 +02:00
|
|
|
<IconButton command="justifyLeft" tooltip={tr.editingAlignLeft()}>
|
2021-04-28 02:27:38 +02:00
|
|
|
{@html justifyLeftIcon}
|
2021-04-28 13:09:25 +02:00
|
|
|
</IconButton>
|
2021-04-28 02:27:38 +02:00
|
|
|
|
2021-04-28 13:09:25 +02:00
|
|
|
<IconButton command="justifyCenter" tooltip={tr.editingCenter()}>
|
2021-04-28 02:27:38 +02:00
|
|
|
{@html justifyCenterIcon}
|
2021-04-28 13:09:25 +02:00
|
|
|
</IconButton>
|
2021-04-28 02:27:38 +02:00
|
|
|
|
2021-04-28 13:09:25 +02:00
|
|
|
<IconButton command="justifyCenter" tooltip={tr.editingCenter()}>
|
2021-04-28 02:27:38 +02:00
|
|
|
{@html justifyCenterIcon}
|
2021-04-28 13:09:25 +02:00
|
|
|
</IconButton>
|
2021-04-28 02:27:38 +02:00
|
|
|
|
2021-04-28 13:09:25 +02:00
|
|
|
<IconButton command="justifyRight" tooltip={tr.editingAlignRight()}>
|
2021-04-28 02:27:38 +02:00
|
|
|
{@html justifyRightIcon}
|
2021-04-28 13:09:25 +02:00
|
|
|
</IconButton>
|
2021-04-28 02:27:38 +02:00
|
|
|
|
2021-04-28 13:09:25 +02:00
|
|
|
<IconButton command="justifyFull" tooltip={tr.editingJustify()}>
|
2021-04-28 02:27:38 +02:00
|
|
|
{@html justifyFullIcon}
|
2021-04-28 13:09:25 +02:00
|
|
|
</IconButton>
|
2021-04-28 02:27:38 +02:00
|
|
|
</ButtonGroup>
|
|
|
|
|
|
|
|
<ButtonGroup id="indentation" {api}>
|
|
|
|
<IconButton on:click={outdentListItem} tooltip={tr.editingOutdent}>
|
|
|
|
{@html outdentIcon}
|
|
|
|
</IconButton>
|
|
|
|
|
|
|
|
<IconButton on:click={indentListItem} tooltip={tr.editingIndent}>
|
|
|
|
{@html indentIcon}
|
|
|
|
</IconButton>
|
|
|
|
</ButtonGroup>
|
|
|
|
</ButtonDropdown>
|
|
|
|
|
|
|
|
<ButtonGroup id="blockFormatting" {api}>
|
2021-04-28 13:09:25 +02:00
|
|
|
<IconButton command="insertUnorderedList" tooltip={tr.editingUnorderedList()}>
|
2021-04-28 02:27:38 +02:00
|
|
|
{@html ulIcon}
|
2021-04-28 13:09:25 +02:00
|
|
|
</IconButton>
|
2021-04-28 02:27:38 +02:00
|
|
|
|
2021-04-28 13:09:25 +02:00
|
|
|
<IconButton command="insertOrderedList" tooltip={tr.editingOrderedList()}>
|
2021-04-28 02:27:38 +02:00
|
|
|
{@html olIcon}
|
2021-04-28 13:09:25 +02:00
|
|
|
</IconButton>
|
2021-04-28 02:27:38 +02:00
|
|
|
|
|
|
|
<WithDropdownMenu menuId="listFormatting">
|
|
|
|
<IconButton>
|
|
|
|
{@html listOptionsIcon}
|
|
|
|
</IconButton>
|
|
|
|
</WithDropdownMenu>
|
|
|
|
</ButtonGroup>
|