1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

Made a bunch of tinymce 6 upgrade fixes

- Added workaround for new 'srcdoc' usage that's breaking content in
  Firefox, added new 'custom-changes.md' file to document for future.
- Updated old usages of 'new' when creating nodes.
- Tested and changed logic, where required, where 'editor.dom.select'
  has been used to replace the old '$' usages.
- Fixed bad boolean value being passed to 'setActive' in task list
  logic.
This commit is contained in:
Dan Brown
2022-07-18 13:18:46 +01:00
parent c519f707e8
commit cd929b2555
8 changed files with 33 additions and 17 deletions

View File

@ -26,7 +26,7 @@ function register(editor, url) {
editor.on('NodeChange', event => {
const parentListEl = event.parents.find(el => el.nodeName === 'LI');
const inList = parentListEl && parentListEl.classList.contains('task-list-item');
api.setActive(inList);
api.setActive(Boolean(inList));
});
}
});
@ -39,7 +39,7 @@ function register(editor, url) {
const parentList = event.parents.find(el => el.nodeName === 'LI');
const inTaskList = parentList && parentList.classList.contains('task-list-item');
const inUlList = parentList && parentList.parentNode.nodeName === 'UL';
api.setActive(inUlList && !inTaskList);
api.setActive(Boolean(inUlList && !inTaskList));
});
};
existingBullListButton.onAction = function() {
@ -157,7 +157,7 @@ function serializeTaskListNode(node) {
}
// Create & insert checkbox input element
const checkbox = new tinymce.html.Node.create('input', inputAttrs);
const checkbox = tinymce.html.Node.create('input', inputAttrs);
checkbox.shortEnded = true;
node.firstChild ? node.insert(checkbox, node.firstChild, true) : node.append(checkbox);
}