Skip to content

Commit 5c6671b

Browse files
committed
Lexical: Fixed issues with content not saving
Found that saving via Ctrl+Enter did not save as logic to load editor output into form was bypassed, which this fixes by ensuring submit events are raised during for this shortcut. Submit handling also gets a timeout added since, at least in FF, requestSubmit did not re-submit a form while in a submit event.
1 parent 0ec0913 commit 5c6671b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

resources/js/components/page-editor.js

Lines changed: 1 addition & 1 deletion
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

Lines changed: 4 additions & 1 deletion
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;

0 commit comments

Comments
 (0)