mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-24 03:42:32 +01:00
On WYSIWYG details unwrap, provided better restore of cursor
Also prevents the toolbar from sticking around after the details block was removed.
This commit is contained in:
parent
9283f28e31
commit
1e112f78d8
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user