|
@@ -1,451 +0,0 @@
|
|
|
-<!DOCTYPE html>
|
|
|
|
|
-<html lang="en">
|
|
|
|
|
- <head>
|
|
|
|
|
- <meta charset="UTF-8" />
|
|
|
|
|
- <meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
|
- <style>
|
|
|
|
|
- *[data-param] {
|
|
|
|
|
- background-color: yellow;
|
|
|
|
|
- padding: 3px 5px;
|
|
|
|
|
- }
|
|
|
|
|
- .trace {
|
|
|
|
|
- border: 1px solid #2877ff;
|
|
|
|
|
- position: relative;
|
|
|
|
|
- display: inline-block;
|
|
|
|
|
- cursor: pointer;
|
|
|
|
|
- }
|
|
|
|
|
- .trace::after {
|
|
|
|
|
- content: '';
|
|
|
|
|
- position: absolute;
|
|
|
|
|
- width: 0px;
|
|
|
|
|
- height: 0px;
|
|
|
|
|
- z-index: 1;
|
|
|
|
|
- bottom: 0px;
|
|
|
|
|
- right: 0px;
|
|
|
|
|
- border-top: 3px solid transparent;
|
|
|
|
|
- border-left: 3px solid transparent;
|
|
|
|
|
- border-right: 3px solid #2877ff;
|
|
|
|
|
- border-bottom: 3px solid #2877ff;
|
|
|
|
|
- }
|
|
|
|
|
- .trace.popover {
|
|
|
|
|
- border: 1px solid #67c23a;
|
|
|
|
|
- position: relative;
|
|
|
|
|
- cursor: pointer;
|
|
|
|
|
- }
|
|
|
|
|
- .trace.popover::after {
|
|
|
|
|
- border-right-color: #67c23a;
|
|
|
|
|
- border-bottom-color: #67c23a;
|
|
|
|
|
- }
|
|
|
|
|
- </style>
|
|
|
|
|
- <script src="./tinymce5/tinymce.min.js" referrerpolicy="origin"></script>
|
|
|
|
|
- <script scr="./tinymce5/plugins/AI-plugin/plugin.min.js"></script>
|
|
|
|
|
- <script scr="./tinymce5/plugins/indicator-configuration/plugin.min.js"></script>
|
|
|
|
|
-
|
|
|
|
|
- <script>
|
|
|
|
|
- // head标题存储
|
|
|
|
|
- let headings = [];
|
|
|
|
|
- // 窗口页面滚动定时器
|
|
|
|
|
- let scrollTimer = null;
|
|
|
|
|
- // 窗口页面滚动定时器时间间隔
|
|
|
|
|
- const debounceInterval = 500;
|
|
|
|
|
-
|
|
|
|
|
- // 忽略的(不需要渲染上标的)变量名集合
|
|
|
|
|
- const ignoreParams = ['Discribe1'];
|
|
|
|
|
-
|
|
|
|
|
- // 指标配置所在节点
|
|
|
|
|
- let indicatorNode = null;
|
|
|
|
|
-
|
|
|
|
|
- // 获取父元素
|
|
|
|
|
- function getParentElement(element) {
|
|
|
|
|
- if (element.parentNode && element.parentNode.className.includes('Heading-')) {
|
|
|
|
|
- return getParentElement(element.parentNode);
|
|
|
|
|
- } else {
|
|
|
|
|
- return element.className.includes('Heading-') ? element : null;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const example_image_upload_handler = (blobInfo, progress) =>
|
|
|
|
|
- new Promise((resolve, reject) => {
|
|
|
|
|
- resolve(blobInfo.blob());
|
|
|
|
|
- // const formData = new FormData();
|
|
|
|
|
- // formData.append('file', blobInfo.blob(), blobInfo.filename());
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- // 上标鼠标悬停移动事件
|
|
|
|
|
- function traceElementMousemove(e) {
|
|
|
|
|
- const target = e.target || e.srcElement;
|
|
|
|
|
- if (target) {
|
|
|
|
|
- const computedStyle = window.getComputedStyle(target);
|
|
|
|
|
- window.parent.postMessage({
|
|
|
|
|
- purpose: 'trace-element-mousemove',
|
|
|
|
|
- payload: {
|
|
|
|
|
- screenPosition: { x: e.clientX, y: e.clientY },
|
|
|
|
|
- targetHTML: target.outerHTML,
|
|
|
|
|
- targetRect: target.getBoundingClientRect(),
|
|
|
|
|
- },
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 上标鼠标点击事件
|
|
|
|
|
- function traceElementClick(e) {
|
|
|
|
|
- const target = e.target || e.srcElement;
|
|
|
|
|
- if (target) {
|
|
|
|
|
- let variable = '';
|
|
|
|
|
- if (target.nodeName === 'SPAN') {
|
|
|
|
|
- const span = document.createElement('SPAN');
|
|
|
|
|
- span.innerHTML = target.outerHTML;
|
|
|
|
|
- variable = span.querySelector('span[data-variable]').getAttribute('data-variable');
|
|
|
|
|
- } else if (target.nodeName === 'IMG') {
|
|
|
|
|
- variable = target.getAttribute('data-variable');
|
|
|
|
|
- }
|
|
|
|
|
- if (variable) {
|
|
|
|
|
- window.parent.postMessage({
|
|
|
|
|
- purpose: 'trace-element-click',
|
|
|
|
|
- payload: { variable },
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 提示弹出框
|
|
|
|
|
- function tooltip(text, duration = 2000) {
|
|
|
|
|
- const tooltipContainer = document.querySelector('.AI-tooltip-container');
|
|
|
|
|
- if (!tooltipContainer) {
|
|
|
|
|
- const container = document.createElement('DIV');
|
|
|
|
|
- const mask = document.createElement('DIV');
|
|
|
|
|
- const content = document.createElement('SPAN');
|
|
|
|
|
- container.className = 'AI-tooltip-container';
|
|
|
|
|
- content.innerText = text || '';
|
|
|
|
|
- container.style.position = 'fixed';
|
|
|
|
|
- container.style.top = '50%';
|
|
|
|
|
- container.style.left = '50%';
|
|
|
|
|
- container.style.height = '60px';
|
|
|
|
|
- container.style.lineHeight = '60px';
|
|
|
|
|
- container.style.padding = '0 18px';
|
|
|
|
|
- container.style.textAlign = 'center';
|
|
|
|
|
- container.style.borderRadius = '8px';
|
|
|
|
|
- container.style.background = 'transparent';
|
|
|
|
|
- container.style.transform = 'translate(-50%, -50%)';
|
|
|
|
|
-
|
|
|
|
|
- mask.style.position = 'absolute';
|
|
|
|
|
- mask.style.top = '0';
|
|
|
|
|
- mask.style.left = '0';
|
|
|
|
|
- mask.style.zIndex = '1';
|
|
|
|
|
- mask.style.width = '100%';
|
|
|
|
|
- mask.style.height = '100%';
|
|
|
|
|
- mask.style.background = 'rgb(0 0 0 / 80%)';
|
|
|
|
|
- mask.style.opacity = '0.7';
|
|
|
|
|
- mask.style.borderRadius = '8px';
|
|
|
|
|
-
|
|
|
|
|
- content.style.position = 'relative';
|
|
|
|
|
- content.style.zIndex = '2';
|
|
|
|
|
- content.style.fontSize = '14px';
|
|
|
|
|
- content.style.color = '#fff';
|
|
|
|
|
-
|
|
|
|
|
- container.appendChild(mask);
|
|
|
|
|
- container.appendChild(content);
|
|
|
|
|
- document.body.appendChild(container);
|
|
|
|
|
-
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- document.body.removeChild(container);
|
|
|
|
|
- }, duration);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const initConfig = {
|
|
|
|
|
- selector: '.editor-content',
|
|
|
|
|
- license_key: 'gpl',
|
|
|
|
|
- menubar: false,
|
|
|
|
|
- statusbar: false,
|
|
|
|
|
- inline: true,
|
|
|
|
|
- resize_img_proportional: false,
|
|
|
|
|
- language: 'zh_CN',
|
|
|
|
|
- toolbar_mode: 'sliding',
|
|
|
|
|
- toolbar_location: 'top',
|
|
|
|
|
- toolbar_persist: false,
|
|
|
|
|
- content_style: 'body { padding-top: 20px; }',
|
|
|
|
|
- plugins: ['link', 'lists', 'autolink', 'image', 'table', 'AI-plugin'],
|
|
|
|
|
- toolbar: [
|
|
|
|
|
- 'undo redo bold italic underline fontfamily fontsize forecolor backcolor alignleft aligncenter alignright alignfull image numlist bullist outdent indent table AI',
|
|
|
|
|
- ],
|
|
|
|
|
- images_upload_handler: example_image_upload_handler,
|
|
|
|
|
- powerpaste_word_import: 'clean',
|
|
|
|
|
- powerpaste_html_import: 'clean',
|
|
|
|
|
- setup: (editor) => {
|
|
|
|
|
- editor.on('click', (e) => {
|
|
|
|
|
- const target = e.target || e.srcElement;
|
|
|
|
|
- const nodeName = target.nodeName;
|
|
|
|
|
- const url = target.getAttribute('data-url');
|
|
|
|
|
- let source = target.getAttribute('data-source');
|
|
|
|
|
- const innerHTML = nodeName === 'IMG' ? target.src : target.innerHTML;
|
|
|
|
|
- if (source && typeof source === 'string' && source.includes('[') && source !== '[]') {
|
|
|
|
|
- try {
|
|
|
|
|
- source = JSON.parse(source);
|
|
|
|
|
- if (source && source.constructor === Array && source.length) {
|
|
|
|
|
- window.parent.postMessage({
|
|
|
|
|
- purpose: 'element-click',
|
|
|
|
|
- payload: { source, url, nodeName, innerHTML },
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- } catch (err) {
|
|
|
|
|
- console.log(err);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- // 元素通用的点击
|
|
|
|
|
- window.parent.postMessage({
|
|
|
|
|
- purpose: 'element-common-click',
|
|
|
|
|
- payload: {
|
|
|
|
|
- className: target.className,
|
|
|
|
|
- nodeName: target.nodeName,
|
|
|
|
|
- nodeType: target.nodeType,
|
|
|
|
|
- nodeValue: target.nodeValue,
|
|
|
|
|
- rect: target.getBoundingClientRect(),
|
|
|
|
|
- },
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
- editor.on('input', () => {
|
|
|
|
|
- window.parent.postMessage({ purpose: 'editor-content-upload', payload: editor.getContent() });
|
|
|
|
|
- });
|
|
|
|
|
- editor.on('Redo', () => {
|
|
|
|
|
- window.parent.postMessage({ purpose: 'editor-content-upload', payload: editor.getContent() });
|
|
|
|
|
- });
|
|
|
|
|
- editor.on('Undo', () => {
|
|
|
|
|
- window.parent.postMessage({ purpose: 'editor-content-upload', payload: editor.getContent() });
|
|
|
|
|
- });
|
|
|
|
|
- editor.on('ScrollWindow', (e) => {
|
|
|
|
|
- let target = e.target || e.srcElement;
|
|
|
|
|
- if (target.nodeName === '#document') {
|
|
|
|
|
- target = target.querySelector('body')
|
|
|
|
|
- }
|
|
|
|
|
- if (indicatorNode) {
|
|
|
|
|
- target = indicatorNode;
|
|
|
|
|
- }
|
|
|
|
|
- const collapsed = editor.selection?.getRng().collapsed;
|
|
|
|
|
- let selectionRect = null;
|
|
|
|
|
-
|
|
|
|
|
- if (!collapsed) {
|
|
|
|
|
- // 获取选中文本的边界矩形
|
|
|
|
|
- selectionRect = editor.selection?.getRng().getBoundingClientRect();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- window.parent.postMessage({
|
|
|
|
|
- purpose: 'container-scroll',
|
|
|
|
|
- payload: {
|
|
|
|
|
- outerHTML: target.outerHTML,
|
|
|
|
|
- selectionRect,
|
|
|
|
|
- nodeRect: indicatorNode ? indicatorNode.getBoundingClientRect() : null,
|
|
|
|
|
- },
|
|
|
|
|
- });
|
|
|
|
|
- // if (scrollTimer) clearTimeout(scrollTimer)
|
|
|
|
|
- // scrollTimer = setTimeout(() => {
|
|
|
|
|
- // const scrollTop = e.target.body.parentNode.scrollTop
|
|
|
|
|
- // const list = []
|
|
|
|
|
- // headings.forEach((head, h) => {
|
|
|
|
|
- // list.push({ distance: head.offsetTop - scrollTop, dom: head, id: h + 1 })
|
|
|
|
|
- // })
|
|
|
|
|
- // const min = Math.min(...list.map(i => Math.abs(i.distance)))
|
|
|
|
|
- // const target = list.find(i => i.distance === min)
|
|
|
|
|
- // if (target) {
|
|
|
|
|
- // console.log('target: ', target)
|
|
|
|
|
- // window.parent.postMessage({
|
|
|
|
|
- // purpose: 'element-scroll-to-view',
|
|
|
|
|
- // payload: {
|
|
|
|
|
- // id: target.id,
|
|
|
|
|
- // dom: tinymce.dom.Serializer().serialize(target.dom)
|
|
|
|
|
- // }
|
|
|
|
|
- // })
|
|
|
|
|
- // }
|
|
|
|
|
- // }, debounceInterval)
|
|
|
|
|
- });
|
|
|
|
|
- editor.on('AI', (event) => {
|
|
|
|
|
- const { target, data } = event;
|
|
|
|
|
- if (target && data) {
|
|
|
|
|
- const isCollapsed = data.isCollapsed;
|
|
|
|
|
- if (isCollapsed) {
|
|
|
|
|
- tooltip('请先选中优化的文案');
|
|
|
|
|
- // // 未选中文本内容
|
|
|
|
|
- // window.parent.postMessage({ purpose: 'AI-plugin-click-selection-is-collapse' })
|
|
|
|
|
- } else {
|
|
|
|
|
- const range = data.range;
|
|
|
|
|
- if (range) {
|
|
|
|
|
- window.parent.postMessage({
|
|
|
|
|
- purpose: 'get-range-rect',
|
|
|
|
|
- payload: {
|
|
|
|
|
- collapsed: range.collapsed,
|
|
|
|
|
- endOffset: range.endOffset,
|
|
|
|
|
- startOffset: range.startOffset,
|
|
|
|
|
- content: range.toString(),
|
|
|
|
|
- rect: range.getBoundingClientRect(),
|
|
|
|
|
- startContainer: {
|
|
|
|
|
- className: range.startContainer.className,
|
|
|
|
|
- nodeName: range.startContainer.nodeName,
|
|
|
|
|
- nodeType: range.startContainer.nodeType,
|
|
|
|
|
- nodeValue: range.startContainer.nodeValue,
|
|
|
|
|
- },
|
|
|
|
|
- endContainer: {
|
|
|
|
|
- className: range.endContainer.className,
|
|
|
|
|
- nodeName: range.endContainer.nodeName,
|
|
|
|
|
- nodeType: range.endContainer.nodeType,
|
|
|
|
|
- nodeValue: range.endContainer.nodeValue,
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- editor.on('indicator-configuration', (event) => {
|
|
|
|
|
- const { target, data } = event;
|
|
|
|
|
- if (target && data) {
|
|
|
|
|
- const { node, selection } = data;
|
|
|
|
|
- indicatorNode = node;
|
|
|
|
|
- window.parent.postMessage({
|
|
|
|
|
- purpose: 'indicator-configuration',
|
|
|
|
|
- payload: {
|
|
|
|
|
- node: node.outerHTML,
|
|
|
|
|
- nodeRect: node.getBoundingClientRect(),
|
|
|
|
|
- },
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- init_instance_callback: (editor) => {
|
|
|
|
|
- const elementList = editor.dom.select('*[data-type]');
|
|
|
|
|
- if (elementList && elementList.length) {
|
|
|
|
|
- Array.from(elementList).forEach((element, index) => {
|
|
|
|
|
- element.setAttribute('data-variable', element.getAttribute('data-param'));
|
|
|
|
|
- const isPopover = element.getAttribute('data-type') === 'popover';
|
|
|
|
|
- const isClick = element.getAttribute('data-type') === 'click';
|
|
|
|
|
- let className = element.className;
|
|
|
|
|
- if (className.includes('trace')) {
|
|
|
|
|
- className.replace(' trace', '').replace('trace ', '').replace(' trace ', '');
|
|
|
|
|
- className.replace(' popover', '').replace('popover ', '').replace(' popover ', '');
|
|
|
|
|
- }
|
|
|
|
|
- className += className ? ' trace' : 'trace';
|
|
|
|
|
- if (isPopover) {
|
|
|
|
|
- className += ' popover';
|
|
|
|
|
- }
|
|
|
|
|
- className += ' remove-class-when-submit';
|
|
|
|
|
- element.setAttribute('class', className);
|
|
|
|
|
- if (isPopover) {
|
|
|
|
|
- element.removeEventListener('mousemove', traceElementMousemove);
|
|
|
|
|
- element.addEventListener('mousemove', traceElementMousemove);
|
|
|
|
|
- } else if (isClick) {
|
|
|
|
|
- element.removeEventListener('click', traceElementClick);
|
|
|
|
|
- element.addEventListener('click', traceElementClick);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const { bodyElement } = tinymce.activeEditor;
|
|
|
|
|
- window.parent.postMessage({
|
|
|
|
|
- purpose: 'editor-instance-loaded',
|
|
|
|
|
- payload: { html: tinymce.activeEditor.save(), height: getComputedStyle(bodyElement, null).height },
|
|
|
|
|
- });
|
|
|
|
|
- window.parent.postMessage({ purpose: 'content-setting', payload: false });
|
|
|
|
|
- window.parent.postMessage({ purpose: 'editor-content-upload', payload: editor.getContent() });
|
|
|
|
|
- headings = Array.from(editor.bodyElement.querySelectorAll('p[class^=Heading-]')).filter(
|
|
|
|
|
- (item) => !item.parentNode || !['TH', 'TD'].includes(item.parentNode.nodeName),
|
|
|
|
|
- );
|
|
|
|
|
- },
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- window.addEventListener('message', handleMessage, false);
|
|
|
|
|
- // 接收方的 message event handler
|
|
|
|
|
- function handleMessage({ data }) {
|
|
|
|
|
- const { purpose, payload } = data;
|
|
|
|
|
- if (purpose === 'set-content') {
|
|
|
|
|
- if (!payload) return;
|
|
|
|
|
- window.parent.postMessage({ purpose: 'content-setting', payload: true });
|
|
|
|
|
- if (payload && Array.isArray(payload)) {
|
|
|
|
|
- const fragment = document.createDocumentFragment();
|
|
|
|
|
- payload.forEach((item) => {
|
|
|
|
|
- const content = item.replace(/\n/g, '');
|
|
|
|
|
- const body_match = content.match(/\<body.+\>.+[\<\/body\>]{0,1}/);
|
|
|
|
|
- let body = body_match && body_match[0] ? body_match[0] : '';
|
|
|
|
|
- const container = document.createElement('div');
|
|
|
|
|
- container.className = 'editor-container';
|
|
|
|
|
- container.innerHTML = body.replace('<body>', '').replace('</body>', '');
|
|
|
|
|
- fragment.appendChild(container);
|
|
|
|
|
- });
|
|
|
|
|
- document.body.querySelector('.editor-content').appendChild(fragment);
|
|
|
|
|
- tinymce.init(initConfig);
|
|
|
|
|
- } else {
|
|
|
|
|
- let { content, config } = payload;
|
|
|
|
|
- if (content && Array.isArray(content)) {
|
|
|
|
|
- const fragment = document.createDocumentFragment();
|
|
|
|
|
- content.forEach((item) => {
|
|
|
|
|
- const value = item.replace(/\n/g, '');
|
|
|
|
|
- const body_match = value.match(/\<body.+\>.+[\<\/body\>]{0,1}/);
|
|
|
|
|
- let body = body_match && body_match[0] ? body_match[0] : '';
|
|
|
|
|
- const container = document.createElement('div');
|
|
|
|
|
- container.className = 'editor-container';
|
|
|
|
|
- container.innerHTML = body.replace('<body>', '').replace('</body>', '');
|
|
|
|
|
- fragment.appendChild(container);
|
|
|
|
|
- });
|
|
|
|
|
- document.body.querySelector('.editor-content').appendChild(fragment);
|
|
|
|
|
- }
|
|
|
|
|
- let finalConfig = initConfig;
|
|
|
|
|
- if (config) {
|
|
|
|
|
- finalConfig = Object.assign(finalConfig, config);
|
|
|
|
|
- }
|
|
|
|
|
- tinymce.init(finalConfig);
|
|
|
|
|
- }
|
|
|
|
|
- } else if (purpose === 'get-document') {
|
|
|
|
|
- // 获取document
|
|
|
|
|
- const body = tinymce.activeEditor.contentDocument.body;
|
|
|
|
|
- window.parent.postMessage({ purpose: 'get-document', payload: tinymce.dom.Serializer().serialize(body) });
|
|
|
|
|
- } else if (purpose === 'anchor-label') {
|
|
|
|
|
- // 锚定到label
|
|
|
|
|
- if (!payload || !tinymce) return;
|
|
|
|
|
- if (!tinymce.DOM) return;
|
|
|
|
|
- if (!tinymce.DOM.doc) return;
|
|
|
|
|
- if (!tinymce.DOM.doc.body) return;
|
|
|
|
|
- const doc = tinymce.DOM.doc;
|
|
|
|
|
- const list = payload.split('&');
|
|
|
|
|
- const level = list.find((i) => i.includes('level=')).replace('level=', '');
|
|
|
|
|
- const label = list.find((i) => i.includes('label=')).replace('label=', '');
|
|
|
|
|
- const targetElement = getElement({ level, label, container: tinymce.DOM.doc.body });
|
|
|
|
|
- if (targetElement) targetElement.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest' });
|
|
|
|
|
- } else if (purpose === 'sync-catalogue') {
|
|
|
|
|
- // 同步目录
|
|
|
|
|
- } else if (purpose === 'clear-indicator-node') {
|
|
|
|
|
- indicatorNode = null;
|
|
|
|
|
- } else if (purpose === 'set-read-only') {
|
|
|
|
|
- // 设置是否只读
|
|
|
|
|
- if (tinymce.activeEditor && tinymce.activeEditor.mode) {
|
|
|
|
|
- tinymce.activeEditor.mode.set(payload ? 'readonly' : 'design');
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- function getElement({ level, label, container } = {}) {
|
|
|
|
|
- if (!level || !label || !container) return null;
|
|
|
|
|
- let element;
|
|
|
|
|
- if (
|
|
|
|
|
- container.innerText === label &&
|
|
|
|
|
- (!container.parentNode ||
|
|
|
|
|
- container.className === `Heading-${level}` ||
|
|
|
|
|
- container.parentNode.className === `Heading-${level}`)
|
|
|
|
|
- ) {
|
|
|
|
|
- element = container;
|
|
|
|
|
- }
|
|
|
|
|
- if (element) return element;
|
|
|
|
|
- else {
|
|
|
|
|
- if (container.children.length) {
|
|
|
|
|
- for (let i = 0; i < container.children.length; i++) {
|
|
|
|
|
- element = getElement({ level, label, container: container.children[i] });
|
|
|
|
|
- if (element) break;
|
|
|
|
|
- }
|
|
|
|
|
- if (element) return element;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- </script>
|
|
|
|
|
- </head>
|
|
|
|
|
- <body>
|
|
|
|
|
- <div class="editor-content"></div>
|
|
|
|
|
- </body>
|
|
|
|
|
-</html>
|
|
|