king
2025-02-18 dce5430e83079a77977737e82a71a4b82d078a57
2025-02-18
4个文件已修改
102 ■■■■ 已修改文件
src/menu/components/editor/braft-editor/index.jsx 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/editor/braft-editor/options.jsx 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/editor/braft-editor/index.jsx 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/codemirror/index.scss 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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_**$(空格,其中**代表空格数)。 </span></span></p>' : card.html}/>
        {/* <BraftContent value={card.wrap.datatype !== 'static' ? '<p class="empty-content"><span>富文本<span>字符替换:$blank_space_**$(空格,其中**代表空格数)。 </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>
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: '预处理入参html、data,返回修改后的html;后处理入参为html,可通过页面元素的样式调整并返回处理后的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
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('&nbsp;').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('&nbsp;').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('&nbsp;').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>
    )
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;
  }