asdasd
This commit is contained in:
@@ -48,11 +48,19 @@
|
|||||||
candidates.forEach((model) => {
|
candidates.forEach((model) => {
|
||||||
const content = model && model.get ? String(model.get('content') || '') : '';
|
const content = model && model.get ? String(model.get('content') || '') : '';
|
||||||
const id = model && (model.getId ? model.getId() : model.get && model.get('id'));
|
const id = model && (model.getId ? model.getId() : model.get && model.get('id'));
|
||||||
const tag = (model && model.get && (model.get('tagName') || model.get('tag'))) || 'div';
|
const viewEl = model && model.view && model.view.el ? model.view.el : null;
|
||||||
|
const tag = (model && model.get && (model.get('tagName') || model.get('tag')))
|
||||||
|
|| (viewEl && viewEl.tagName)
|
||||||
|
|| 'div';
|
||||||
if (!content || !id) return;
|
if (!content || !id) return;
|
||||||
const tagName = String(tag).toLowerCase();
|
const tagName = String(tag).toLowerCase();
|
||||||
|
if (tagName && tagName !== 'div') {
|
||||||
const rx = new RegExp(`<${tagName}([^>]*\\\\bid=[\"']${id}[\"'][^>]*)>([\\\\s\\\\S]*?)<\\\\/${tagName}>`, 'i');
|
const rx = new RegExp(`<${tagName}([^>]*\\\\bid=[\"']${id}[\"'][^>]*)>([\\\\s\\\\S]*?)<\\\\/${tagName}>`, 'i');
|
||||||
html = html.replace(rx, `<${tagName}$1>${content}</${tagName}>`);
|
html = html.replace(rx, `<${tagName}$1>${content}</${tagName}>`);
|
||||||
|
} else {
|
||||||
|
const rxAny = new RegExp(`<([a-z0-9-]+)([^>]*\\\\bid=[\"']${id}[\"'][^>]*)>([\\\\s\\\\S]*?)<\\\\/\\1>`, 'i');
|
||||||
|
html = html.replace(rxAny, `<$1$2>${content}</$1>`);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
@@ -186,6 +194,11 @@
|
|||||||
}
|
}
|
||||||
if (component.view && typeof component.view.render === 'function') {
|
if (component.view && typeof component.view.render === 'function') {
|
||||||
component.view.render();
|
component.view.render();
|
||||||
|
try {
|
||||||
|
if (component.view && component.view.el) {
|
||||||
|
component.view.el.innerHTML = content;
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
}
|
}
|
||||||
if (component.trigger) {
|
if (component.trigger) {
|
||||||
component.trigger('change:content');
|
component.trigger('change:content');
|
||||||
@@ -330,7 +343,12 @@
|
|||||||
this.allowClose = true;
|
this.allowClose = true;
|
||||||
this.modalOpen = false;
|
this.modalOpen = false;
|
||||||
if (rteInstance && typeof rteInstance.enable === 'function' && rteTargetEl) {
|
if (rteInstance && typeof rteInstance.enable === 'function' && rteTargetEl) {
|
||||||
try { rteInstance.enable(rteTargetEl); } catch {}
|
try {
|
||||||
|
const res = rteInstance.enable(rteTargetEl);
|
||||||
|
if (res && typeof res.catch === 'function') {
|
||||||
|
res.catch(() => {});
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
}
|
}
|
||||||
if (this.B.allowModalCloseOnce) this.B.allowModalCloseOnce();
|
if (this.B.allowModalCloseOnce) this.B.allowModalCloseOnce();
|
||||||
if (typeof modal.close === 'function') {
|
if (typeof modal.close === 'function') {
|
||||||
|
|||||||
Reference in New Issue
Block a user