From 1e112f78d8d54d5802575cc47e332598bc1d2893 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Thu, 24 Feb 2022 15:02:23 +0000 Subject: [PATCH] On WYSIWYG details unwrap, provided better restore of cursor Also prevents the toolbar from sticking around after the details block was removed. --- resources/js/wysiwyg/plugins-details.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/resources/js/wysiwyg/plugins-details.js b/resources/js/wysiwyg/plugins-details.js index 9b5287947..bcecf7131 100644 --- a/resources/js/wysiwyg/plugins-details.js +++ b/resources/js/wysiwyg/plugins-details.js @@ -169,6 +169,7 @@ function setSummary(editor, summaryContent) { */ function unwrapDetailsInSelection(editor) { const details = editor.selection.getNode().closest('details'); + const selectionBm = editor.selection.getBookmark(); if (details) { const elements = details.querySelectorAll('details > *:not(summary, doc-root), doc-root > *'); @@ -180,7 +181,9 @@ function unwrapDetailsInSelection(editor) { details.remove(); }); } + editor.focus(); + editor.selection.moveToBookmark(selectionBm); } /**