Remove paragraph button

This commit is contained in:
Henrik Giesel 2021-04-21 14:36:24 +02:00
parent 64db04f1bb
commit 1f97f5208e
2 changed files with 2 additions and 29 deletions

View file

@ -59,7 +59,6 @@ copy_bootstrap_icons(
"mic.svg",
# block formatting
"paragraph.svg",
"list-ul.svg",
"list-ol.svg",
"text-paragraph.svg",

View file

@ -17,9 +17,8 @@ import {
withDropdownMenu,
} from "editor-toolbar/dynamicComponents";
import { getListItem, getParagraph } from "./helpers";
import { getListItem } from "./helpers";
import paragraphIcon from "./paragraph.svg";
import ulIcon from "./list-ul.svg";
import olIcon from "./list-ol.svg";
import listOptionsIcon from "./text-paragraph.svg";
@ -46,23 +45,6 @@ const indentListItem = () => {
}
};
const toggleParagraph = (): void => {
const currentField = document.activeElement as EditingArea;
const paragraph = getParagraph(currentField.shadowRoot!);
if (!paragraph) {
document.execCommand("formatBlock", false, "p");
} else {
paragraph.insertAdjacentElement("beforeend", document.createElement("br"));
paragraph.replaceWith(...paragraph.childNodes);
}
};
const checkForParagraph = (): boolean => {
const currentField = document.activeElement as EditingArea;
return Boolean(getParagraph(currentField.shadowRoot!));
};
export function getFormatBlockMenus(): (DynamicSvelteComponent<typeof ButtonDropdown> &
ButtonDropdownProps)[] {
const justifyLeftButton = commandIconButton({
@ -126,14 +108,6 @@ export function getFormatBlockMenus(): (DynamicSvelteComponent<typeof ButtonDrop
export function getFormatBlockGroup(): DynamicSvelteComponent<typeof ButtonGroup> &
ButtonGroupProps {
const paragraphButton = commandIconButton({
icon: paragraphIcon,
command: "formatBlock",
onClick: toggleParagraph,
onUpdate: checkForParagraph,
tooltip: tr.editingParagraph(),
});
const ulButton = commandIconButton({
icon: ulIcon,
command: "insertUnorderedList",
@ -157,6 +131,6 @@ export function getFormatBlockGroup(): DynamicSvelteComponent<typeof ButtonGroup
return buttonGroup({
id: "blockFormatting",
buttons: [paragraphButton, ulButton, olButton, listFormatting],
buttons: [ulButton, olButton, listFormatting],
});
}