Skip to content

Commit 78a0a2f

Browse files
authored
Merge pull request #5558 from BookStackApp/lexical_round3
Lexical Fixes: Round 3
2 parents 42cbd6a + bb44334 commit 78a0a2f

File tree

11 files changed

+329
-180
lines changed

11 files changed

+329
-180
lines changed

resources/js/components/page-editor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export class PageEditor extends Component {
112112
}
113113

114114
savePage() {
115-
this.container.closest('form').submit();
115+
this.container.closest('form').requestSubmit();
116116
}
117117

118118
async saveDraft() {

resources/js/components/wysiwyg-editor.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export class WysiwygEditor extends Component {
2525
textDirection: this.$opts.textDirection,
2626
translations,
2727
});
28+
window.wysiwyg = this.editor;
2829
});
2930

3031
let handlingFormSubmit = false;
@@ -38,7 +39,9 @@ export class WysiwygEditor extends Component {
3839
handlingFormSubmit = true;
3940
this.editor.getContentAsHtml().then(html => {
4041
this.input.value = html;
41-
this.input.form.submit();
42+
setTimeout(() => {
43+
this.input.form.requestSubmit();
44+
}, 5);
4245
});
4346
} else {
4447
handlingFormSubmit = false;

resources/js/wysiwyg/lexical/core/__tests__/utils/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {QuoteNode} from "@lexical/rich-text/LexicalQuoteNode";
3737
import {DetailsNode} from "@lexical/rich-text/LexicalDetailsNode";
3838
import {EditorUiContext} from "../../../../ui/framework/core";
3939
import {EditorUIManager} from "../../../../ui/framework/manager";
40+
import {ImageNode} from "@lexical/rich-text/LexicalImageNode";
4041

4142
type TestEnv = {
4243
readonly container: HTMLDivElement;
@@ -484,6 +485,9 @@ export function createTestContext(): EditorUiContext {
484485
const editor = createTestEditor({
485486
namespace: 'testing',
486487
theme: {},
488+
nodes: [
489+
ImageNode,
490+
]
487491
});
488492

489493
editor.setRootElement(editorDOM);

resources/js/wysiwyg/lexical/list/LexicalListNode.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,19 @@ function isDomChecklist(domNode: HTMLElement) {
332332
}
333333
// if children are checklist items, the node is a checklist ul. Applicable for googledoc checklist pasting.
334334
for (const child of domNode.childNodes) {
335-
if (isHTMLElement(child) && child.hasAttribute('aria-checked')) {
335+
if (!isHTMLElement(child)) {
336+
continue;
337+
}
338+
339+
if (child.hasAttribute('aria-checked')) {
340+
return true;
341+
}
342+
343+
if (child.classList.contains('task-list-item')) {
344+
return true;
345+
}
346+
347+
if (child.firstElementChild && child.firstElementChild.matches('input[type="checkbox"]')) {
336348
return true;
337349
}
338350
}

0 commit comments

Comments
 (0)