Optimisation htmx / js par claude

This commit is contained in:
2025-11-11 11:35:11 +01:00
parent cd9a96c760
commit 439880b08f
2 changed files with 154 additions and 147 deletions

View File

@ -77,6 +77,8 @@ class MarkdownEditor {
if (saveStatus) {
saveStatus.textContent = 'Sauvegarde...';
}
// Synchroniser le contenu de CodeMirror vers le textarea
this.syncToTextarea();
form.requestSubmit();
}
}, 2000); // Auto-save after 2 seconds of inactivity
@ -88,6 +90,8 @@ class MarkdownEditor {
run: () => {
const form = this.textarea.closest('form');
if (form) {
// Synchroniser le contenu de CodeMirror vers le textarea
this.syncToTextarea();
form.requestSubmit();
}
return true;
@ -209,6 +213,12 @@ class MarkdownEditor {
}
}
syncToTextarea() {
if (this.editorView && this.textarea) {
this.textarea.value = this.editorView.state.doc.toString();
}
}
destroy() {
if (this._updateTimeout) {
clearTimeout(this._updateTimeout);