From dce5430e83079a77977737e82a71a4b82d078a57 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 18 二月 2025 18:35:22 +0800 Subject: [PATCH] 2025-02-18 --- src/menu/components/editor/braft-editor/index.jsx | 14 ++++++ src/menu/components/editor/braft-editor/options.jsx | 31 ++++++++++++--- src/tabviews/custom/components/editor/braft-editor/index.jsx | 50 ++++++++++++++++-------- src/templates/zshare/codemirror/index.scss | 7 ++- 4 files changed, 75 insertions(+), 27 deletions(-) diff --git a/src/menu/components/editor/braft-editor/index.jsx b/src/menu/components/editor/braft-editor/index.jsx index fe1197a..149ff0b 100644 --- a/src/menu/components/editor/braft-editor/index.jsx +++ b/src/menu/components/editor/braft-editor/index.jsx @@ -162,6 +162,17 @@ res.tbStyle = res.tbStyle.join(' ') } + if (res.loads) { + if (res.loads.includes('preload')) { + res.preload = 'true' + } + if (res.loads.includes('loaded')) { + res.loaded = 'true' + } + + delete res.loads + } + delete res.splitLine let _card = {...card, wrap: res} @@ -214,7 +225,8 @@ } trigger="hover"> <ToolOutlined /> </Popover> - <BraftContent value={card.wrap.datatype !== 'static' ? '<p class="empty-content"><span>瀵屾枃鏈�<span>瀛楃鏇挎崲锛�$blank_space_**$(绌烘牸锛屽叾涓�**浠h〃绌烘牸鏁�)銆� </span></span></p>' : card.html}/> + {/* <BraftContent value={card.wrap.datatype !== 'static' ? '<p class="empty-content"><span>瀵屾枃鏈�<span>瀛楃鏇挎崲锛�$blank_space_**$(绌烘牸锛屽叾涓�**浠h〃绌烘牸鏁�)銆� </span></span></p>' : card.html}/> */} + <BraftContent value={card.wrap.datatype !== 'static' ? '<p class="empty-content"><span>瀵屾枃鏈�</span></p>' : card.html}/> <div className="component-name"> <div className="center"> <div className="title">{card.name}</div> diff --git a/src/menu/components/editor/braft-editor/options.jsx b/src/menu/components/editor/braft-editor/options.jsx index bd9e84c..91f403e 100644 --- a/src/menu/components/editor/braft-editor/options.jsx +++ b/src/menu/components/editor/braft-editor/options.jsx @@ -37,6 +37,13 @@ tbStyle = tbStyle.filter(n => n !== 'deep-split') splitLine = 'true' } + let loads = [] + if (wrap.loaded === 'true') { + loads.push('loaded') + } + if (wrap.preload === 'true') { + loads.push('preload') + } const cardWrapForm = [ { @@ -166,23 +173,33 @@ ], }, { - type: 'radio', - field: 'loaded', + type: 'checkbox', + field: 'loads', label: '甯冨眬璋冩暣', - initval: wrap.loaded || 'false', + initval: loads, required: false, + tooltip: '棰勫鐞嗗叆鍙俬tml銆乨ata锛岃繑鍥炰慨鏀瑰悗鐨刪tml锛涘悗澶勭悊鍏ュ弬涓篽tml锛屽彲閫氳繃椤甸潰鍏冪礌鐨勬牱寮忚皟鏁村苟杩斿洖澶勭悊鍚庣殑html銆�', options: [ - {value: 'false', label: '鍏抽棴'}, - {value: 'true', label: '寮�鍚�'}, + {value: 'preload', label: '棰勫鐞�'}, + {value: 'loaded', label: '鍚庡鐞�'}, ], controlFields: [ - {field: 'loadedfunc', values: ['true']}, + {field: 'prefunc', values: ['preload']}, + {field: 'loadedfunc', values: ['loaded']}, ] }, { type: 'codemirror', + field: 'prefunc', + label: '棰勫鐞嗚剼鏈�', + initval: wrap.prefunc || '', + required: true, + span: 24 + }, + { + type: 'codemirror', field: 'loadedfunc', - label: '澶勭悊鑴氭湰', + label: '鍚庡鐞嗚剼鏈�', initval: wrap.loadedfunc || '', required: true, span: 24 diff --git a/src/tabviews/custom/components/editor/braft-editor/index.jsx b/src/tabviews/custom/components/editor/braft-editor/index.jsx index eff5b65..5158f7d 100644 --- a/src/tabviews/custom/components/editor/braft-editor/index.jsx +++ b/src/tabviews/custom/components/editor/braft-editor/index.jsx @@ -64,15 +64,18 @@ _data = [_data] } } else if (_config.html) { - if (/\$blank_space_\d+\$/ig.test(_config.html)) { - _config.html = _config.html.replace(/\$blank_space_\d+\$/ig, (w) => { - let n = +w.replace(/blank_space_|\$/ig, '') - if (n) { - return new Array(n).fill(' ').join('') - } + if (_config.wrap.prefunc) { + let _html = '' + try { + // eslint-disable-next-line + let func = new Function('html', 'data', _config.wrap.prefunc) + _html = func(_config.html, {}) + } catch (e) { + _html = '' + console.warn(e) + } - return w - }) + _config.html = _html || _config.html } } @@ -273,16 +276,29 @@ }) } - if (/\$blank_space_\d+\$/ig.test(item.$html)) { - item.$html = item.$html.replace(/\$blank_space_\d+\$/ig, (w) => { - let n = +w.replace(/blank_space_|\$/ig, '') - if (n) { - return new Array(n).fill(' ').join('') - } + if (wrap.prefunc) { + let _html = '' + try { + // eslint-disable-next-line + let func = new Function('html', 'data', wrap.prefunc) + _html = func(item.$html, item) + } catch (e) { + _html = '' + console.warn(e) + } - return w - }) + item.$html = _html || item.$html } + // if (/\$blank_space_\d+\$/ig.test(item.$html)) { + // item.$html = item.$html.replace(/\$blank_space_\d+\$/ig, (w) => { + // let n = +w.replace(/blank_space_|\$/ig, '') + // if (n) { + // return new Array(n).fill(' ').join('') + // } + + // return w + // }) + // } } }) @@ -308,7 +324,7 @@ /> : data.map((item, index) => <BraftContent key={index} value={item.$html} - script={config.wrap.loaded === 'true' ? config.wrap.loadedfunc : ''} + script={config.wrap.loadedfunc || ''} />)} </div> ) diff --git a/src/templates/zshare/codemirror/index.scss b/src/templates/zshare/codemirror/index.scss index bcd1d5a..1cf9614 100644 --- a/src/templates/zshare/codemirror/index.scss +++ b/src/templates/zshare/codemirror/index.scss @@ -29,7 +29,7 @@ } .anticon-fullscreen-exit { position: fixed; - z-index: 11; + z-index: 13; right: 10px; top: 5px; font-size: 20px; @@ -66,7 +66,7 @@ .CodeMirror-fullscreen.CodeMirror { border-radius: 0; position: fixed; - z-index: 10; + z-index: 12; } .CodeMirror-linenumber { font-size: 14px; @@ -104,6 +104,9 @@ .anticon-fullscreen-exit { display: inline-block; } + .anticon-font-size { + z-index: 13; + } .anticon-fullscreen { display: none; } -- Gitblit v1.8.0