youssefreda9 commited on
Commit
780b95e
·
1 Parent(s): 7e5f112

fix: Cancel on create document prompt now actually cancels

Browse files
src/js/documents-cloud/documents-ui.js CHANGED
@@ -217,7 +217,9 @@ async function _createNewDocument() {
217
  }
218
 
219
  const content = getEditorText();
220
- const title = prompt('اسم المستند الجديد:', 'مستند جديد') || 'مستند جديد';
 
 
221
  const doc = await createDocument(title, content);
222
  if (!doc) {
223
  if (typeof showDocToast === 'function') showDocToast('تعذّر إنشاء المستند', 'error');
 
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, content);
224
  if (!doc) {
225
  if (typeof showDocToast === 'function') showDocToast('تعذّر إنشاء المستند', 'error');