mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-08-26 04:05:57 +00: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) {
|
function unwrapDetailsInSelection(editor) {
|
||||||
const details = editor.selection.getNode().closest('details');
|
const details = editor.selection.getNode().closest('details');
|
||||||
|
const selectionBm = editor.selection.getBookmark();
|
||||||
|
|
||||||
if (details) {
|
if (details) {
|
||||||
const elements = details.querySelectorAll('details > *:not(summary, doc-root), doc-root > *');
|
const elements = details.querySelectorAll('details > *:not(summary, doc-root), doc-root > *');
|
||||||
@ -180,7 +181,9 @@ function unwrapDetailsInSelection(editor) {
|
|||||||
details.remove();
|
details.remove();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.focus();
|
editor.focus();
|
||||||
|
editor.selection.moveToBookmark(selectionBm);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user