From 553938e2ab9013884fa79a575f9bf681c6879880 Mon Sep 17 00:00:00 2001 From: thecodrr Date: Sat, 16 Oct 2021 10:28:05 +0500 Subject: [PATCH] feat: add blockescape plugin for easy escaping from block elements --- packages/tinymce-plugins/blockescape/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 packages/tinymce-plugins/blockescape/index.js diff --git a/packages/tinymce-plugins/blockescape/index.js b/packages/tinymce-plugins/blockescape/index.js new file mode 100644 index 000000000..1e2940171 --- /dev/null +++ b/packages/tinymce-plugins/blockescape/index.js @@ -0,0 +1,14 @@ +const { addPluginToPluginManager } = require("../utils"); + +function register(editor) { + editor.on("NewBlock", (e) => { + const element = e.newBlock; + if (element && element.parentElement.tagName === "BLOCKQUOTE") { + editor.execCommand("mceToggleFormat", false, "blockquote"); + } + }); +} + +(function init() { + addPluginToPluginManager("blockescape", register); +})();