修复新闻工作台换号联动流程
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
15 files changed
+203
-34
No files matched your search
@@ -172,7 +172,7 @@ const cleanText = value => String(value || '').replace(/\s+/g, ' ').trim();
|
||||
}
|
||||
|
||||
window.DWW11Formatter = Object.freeze({
|
||||
format(expectedSource) {
|
||||
format(expectedSource, {verifyImages = true} = {}) {
|
||||
if (Number(window.wysiwyg) !== 1) throw new Error('请切换到可视化编辑器后排版');
|
||||
const body = document.querySelector('#e_iframe')?.contentDocument?.body;
|
||||
if (!body) throw new Error('编辑器未就绪');
|
||||
@@ -185,7 +185,7 @@ window.DWW11Formatter = Object.freeze({
|
||||
footer.remove();
|
||||
formatBody(body, expectedSource, expected);
|
||||
const after = [...body.querySelectorAll('img')].map(x => [x.id, x.getAttribute('aid'), x.getAttribute('src')].join(':'));
|
||||
if (JSON.stringify(images) !== JSON.stringify(after)) throw new Error('排版后图片标识或顺序改变');
|
||||
if (verifyImages && JSON.stringify(images) !== JSON.stringify(after)) throw new Error('排版后图片标识或顺序改变');
|
||||
if (body.querySelectorAll('[data-dww11-wx-source="1"]').length !== 1) throw new Error('来源尾注数量异常');
|
||||
body.dispatchEvent(new Event('input', {bubbles:true}));
|
||||
return {images: after, source: expected};
|
||||
|
||||
Reference in new issue
Block a user