Commit ·
37fc5f3
1
Parent(s): 7118729
fix: New document starts empty instead of inheriting old content Previously createDocument() used getEditorText() to save current content into the new doc. Now it creates with empty string and calls loadDocumentText('') to clear the editor.
Browse files
src/js/documents-cloud/documents-ui.js
CHANGED
|
@@ -216,16 +216,17 @@ async function _createNewDocument() {
|
|
| 216 |
return;
|
| 217 |
}
|
| 218 |
|
| 219 |
-
const content = getEditorText();
|
| 220 |
const titleInput = prompt('اسم المستند الجديد:', 'مستند جديد');
|
| 221 |
if (titleInput === null) return; // User pressed Cancel
|
| 222 |
const title = titleInput.trim() || 'مستند جديد';
|
| 223 |
-
const doc = await createDocument(title,
|
| 224 |
if (!doc) {
|
| 225 |
if (typeof showDocToast === 'function') showDocToast('تعذّر إنشاء المستند', 'error');
|
| 226 |
return;
|
| 227 |
}
|
| 228 |
|
|
|
|
|
|
|
| 229 |
setDocState({
|
| 230 |
currentDocumentId: doc.id,
|
| 231 |
currentDocumentTitle: doc.title,
|
|
|
|
| 216 |
return;
|
| 217 |
}
|
| 218 |
|
|
|
|
| 219 |
const titleInput = prompt('اسم المستند الجديد:', 'مستند جديد');
|
| 220 |
if (titleInput === null) return; // User pressed Cancel
|
| 221 |
const title = titleInput.trim() || 'مستند جديد';
|
| 222 |
+
const doc = await createDocument(title, '');
|
| 223 |
if (!doc) {
|
| 224 |
if (typeof showDocToast === 'function') showDocToast('تعذّر إنشاء المستند', 'error');
|
| 225 |
return;
|
| 226 |
}
|
| 227 |
|
| 228 |
+
// Clear the editor for the new empty document
|
| 229 |
+
loadDocumentText('', { analyze: false });
|
| 230 |
setDocState({
|
| 231 |
currentDocumentId: doc.id,
|
| 232 |
currentDocumentTitle: doc.title,
|