Skip to content

Commit f6d95fb

Browse files
committed
QA Feedback: Add retry logic on it function, only load and save title draft on page type chosen, ensure 5mb limit on uploaded images
1 parent d8558b2 commit f6d95fb

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

templates/news/v3/create.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ <h1 class="create-post-page__title">Create Post</h1>
319319

320320
saveTitleDraft() {
321321
if (!this.titleEl) return;
322+
if (!this.postType) return;
322323
try {
323324
const value = this.titleEl.value;
324325
if (value) localStorage.setItem(this.titleDraftKey(), value);
@@ -328,6 +329,7 @@ <h1 class="create-post-page__title">Create Post</h1>
328329

329330
restoreTitleDraft({ allowEmpty = false } = {}) {
330331
if (!this.titleEl) return;
332+
if (!this.postType) return;
331333
let saved = null;
332334
try { saved = localStorage.getItem(this.titleDraftKey()); } catch (_) {}
333335
if (saved !== null) this.titleEl.value = saved;

templates/v3/includes/_wysiwyg_editor.html

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,21 @@
2020
<div class="wysiwyg-v3-container">
2121
<div class="wysiwyg-v3" data-wysiwyg="v3" data-wysiwyg-preset="{{ preset|default:'full' }}" x-data="{ jsReady: false }" x-init="
2222
$nextTick(() => {
23-
autoInit('{{textarea_id}}');
24-
jsReady = true;
23+
const initFunc = () => {
24+
let tries = 0;
25+
if(typeof autoInit === 'function') {
26+
autoInit('{{textarea_id}}');
27+
jsReady = true;
28+
}
29+
else if(tries<=3) {
30+
tries++;
31+
setTimeout(initFunc, 500);
32+
}
33+
else {
34+
console.error('Unable to load wysiwyg editor.')
35+
}
36+
}
37+
initFunc();
2538
})"
2639
>
2740
<textarea

0 commit comments

Comments
 (0)