From 2601c399b148f7c3845b1fa1adead80fa21d6470 Mon Sep 17 00:00:00 2001 From: Simon Radner Date: Thu, 17 Dec 2020 08:50:49 +0100 Subject: [PATCH] [rte] Support blockquote --- .../comet-admin-rte/src/core/Controls/useBlockTypes.tsx | 6 ++++++ packages/comet-admin-rte/src/core/Rte.tsx | 1 + .../src/core/filterEditor/removeUnsupportedBlockTypes.ts | 1 + .../src/react-admin-rte/RteAllOptions.tsx | 1 + .../comet-admin-stories/src/react-admin-rte/helper.tsx | 9 +++++++++ 5 files changed, 18 insertions(+) diff --git a/packages/comet-admin-rte/src/core/Controls/useBlockTypes.tsx b/packages/comet-admin-rte/src/core/Controls/useBlockTypes.tsx index 9c022c36b8..099108966a 100644 --- a/packages/comet-admin-rte/src/core/Controls/useBlockTypes.tsx +++ b/packages/comet-admin-rte/src/core/Controls/useBlockTypes.tsx @@ -41,6 +41,10 @@ const defaultDropdownFeatures = [ name: "header-six", label: , }, + { + name: "blockquote", + label: , + }, ]; const defaultListsFeatures = [ @@ -87,6 +91,8 @@ export default function useBlockTypes({ editorState, setEditorState, supportedTh return supportedThings.includes("header-five"); case "header-six": return supportedThings.includes("header-six"); + case "blockquote": + return supportedThings.includes("blockquote"); default: return false; } diff --git a/packages/comet-admin-rte/src/core/Rte.tsx b/packages/comet-admin-rte/src/core/Rte.tsx index 6224e6c171..4c7089632b 100644 --- a/packages/comet-admin-rte/src/core/Rte.tsx +++ b/packages/comet-admin-rte/src/core/Rte.tsx @@ -37,6 +37,7 @@ export type SupportedThings = | "header-six" | "ordered-list" | "unordered-list" + | "blockquote" | "history" | "link" | "links-remove"; diff --git a/packages/comet-admin-rte/src/core/filterEditor/removeUnsupportedBlockTypes.ts b/packages/comet-admin-rte/src/core/filterEditor/removeUnsupportedBlockTypes.ts index e356c388f5..bdd6f091d9 100644 --- a/packages/comet-admin-rte/src/core/filterEditor/removeUnsupportedBlockTypes.ts +++ b/packages/comet-admin-rte/src/core/filterEditor/removeUnsupportedBlockTypes.ts @@ -14,6 +14,7 @@ const removeUnsupportedBlockTypes: FilterEditorStateBeforeUpdateFn = (newState, "header-four": "header-four", "header-five": "header-five", "header-six": "header-six", + blockquote: "blockquote", "ordered-list": "ordered-list-item", "unordered-list": "unordered-list-item", }; diff --git a/packages/comet-admin-stories/src/react-admin-rte/RteAllOptions.tsx b/packages/comet-admin-stories/src/react-admin-rte/RteAllOptions.tsx index 524a23f918..eec9c0006c 100644 --- a/packages/comet-admin-stories/src/react-admin-rte/RteAllOptions.tsx +++ b/packages/comet-admin-stories/src/react-admin-rte/RteAllOptions.tsx @@ -40,6 +40,7 @@ export const rteOptions: IRteOptions = { "header-four", "header-five", "header-six", + "blockquote", "ordered-list", "unordered-list", "history", diff --git a/packages/comet-admin-stories/src/react-admin-rte/helper.tsx b/packages/comet-admin-stories/src/react-admin-rte/helper.tsx index 6ce1247edb..0ef05a4e8a 100644 --- a/packages/comet-admin-stories/src/react-admin-rte/helper.tsx +++ b/packages/comet-admin-stories/src/react-admin-rte/helper.tsx @@ -165,6 +165,15 @@ export const exampleContent = { entityRanges: [], data: {}, }, + { + key: "eggda", + text: "Blockquote", + type: "blockquote", + depth: 0, + inlineStyleRanges: [], + entityRanges: [], + data: {}, + }, { key: "2fi99", text: "Überschrift Custom",