this.editorType = this.$opts.editorType;
this.pageId = Number(this.$opts.pageId);
this.isNewDraft = this.$opts.pageNewDraft === 'true';
- this.hasDefaultTitle = this.$opts.isDefaultTitle || false;
+ this.hasDefaultTitle = this.$opts.hasDefaultTitle || false;
// Elements
this.container = this.$el;
frequency: 30000,
last: 0,
};
+ this.shownWarningsCache = new Set();
if (this.pageId !== 0 && this.draftsEnabled) {
window.setTimeout(() => {
}
this.draftNotifyChange(`${resp.data.message} ${Dates.utcTimeStampToLocalTime(resp.data.timestamp)}`);
this.autoSave.last = Date.now();
+ if (resp.data.warning && !this.shownWarningsCache.has(resp.data.warning)) {
+ window.$events.emit('warning', resp.data.warning);
+ this.shownWarningsCache.add(resp.data.warning);
+ }
} catch (err) {
// Save the editor content in LocalStorage as a last resort, just in case.
try {
this.draftDisplay.innerText = this.editingPageText;
this.toggleDiscardDraftVisibility(false);
- window.$events.emit('editor-html-update', response.data.html || '');
- window.$events.emit('editor-markdown-update', response.data.markdown || response.data.html);
+ window.$events.emit('editor::replace', {
+ html: response.data.html,
+ markdown: response.data.markdown,
+ });
this.titleElem.value = response.data.name;
window.setTimeout(() => {