Also prevents the toolbar from sticking around after the details block
was removed.
*/
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 > *');
details.remove();
});
}
+
editor.focus();
+ editor.selection.moveToBookmark(selectionBm);
}
/**