Skip to content

Lexical Fixes: Round 3 #5558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resources/js/components/page-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class PageEditor extends Component {
}

savePage() {
this.container.closest('form').submit();
this.container.closest('form').requestSubmit();
}

async saveDraft() {
Expand Down
5 changes: 4 additions & 1 deletion resources/js/components/wysiwyg-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export class WysiwygEditor extends Component {
textDirection: this.$opts.textDirection,
translations,
});
window.wysiwyg = this.editor;
});

let handlingFormSubmit = false;
Expand All @@ -38,7 +39,9 @@ export class WysiwygEditor extends Component {
handlingFormSubmit = true;
this.editor.getContentAsHtml().then(html => {
this.input.value = html;
this.input.form.submit();
setTimeout(() => {
this.input.form.requestSubmit();
}, 5);
});
} else {
handlingFormSubmit = false;
Expand Down
4 changes: 4 additions & 0 deletions resources/js/wysiwyg/lexical/core/__tests__/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {QuoteNode} from "@lexical/rich-text/LexicalQuoteNode";
import {DetailsNode} from "@lexical/rich-text/LexicalDetailsNode";
import {EditorUiContext} from "../../../../ui/framework/core";
import {EditorUIManager} from "../../../../ui/framework/manager";
import {ImageNode} from "@lexical/rich-text/LexicalImageNode";

type TestEnv = {
readonly container: HTMLDivElement;
Expand Down Expand Up @@ -484,6 +485,9 @@ export function createTestContext(): EditorUiContext {
const editor = createTestEditor({
namespace: 'testing',
theme: {},
nodes: [
ImageNode,
]
});

editor.setRootElement(editorDOM);
Expand Down
14 changes: 13 additions & 1 deletion resources/js/wysiwyg/lexical/list/LexicalListNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,19 @@ function isDomChecklist(domNode: HTMLElement) {
}
// if children are checklist items, the node is a checklist ul. Applicable for googledoc checklist pasting.
for (const child of domNode.childNodes) {
if (isHTMLElement(child) && child.hasAttribute('aria-checked')) {
if (!isHTMLElement(child)) {
continue;
}

if (child.hasAttribute('aria-checked')) {
return true;
}

if (child.classList.contains('task-list-item')) {
return true;
}

if (child.firstElementChild && child.firstElementChild.matches('input[type="checkbox"]')) {
return true;
}
}
Expand Down
Loading