From 6f09319def608286218e562d8b270ee9e58444b4 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 09 三月 2023 15:33:35 +0800 Subject: [PATCH] 2023-03-09 --- src/tabviews/custom/components/editor/braft-editor/index.jsx | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/tabviews/custom/components/editor/braft-editor/index.jsx b/src/tabviews/custom/components/editor/braft-editor/index.jsx index d6c7450..434ed5d 100644 --- a/src/tabviews/custom/components/editor/braft-editor/index.jsx +++ b/src/tabviews/custom/components/editor/braft-editor/index.jsx @@ -31,7 +31,7 @@ const { data, initdata } = this.props let _config = fromJS(this.props.config).toJS() - let _data = {} + let _data = { $$empty: true } let _sync = false let BID = '' @@ -50,20 +50,18 @@ _sync = _config.setting.sync === 'true' if (_sync && data) { - _data = data[_config.dataName] || {} + _data = data[_config.dataName] || {$$empty: true} if (_data && Array.isArray(_data)) { - _data = _data[0] || {} + _data = _data[0] || {$$empty: true} } _sync = false } else if (_sync && initdata) { - _data = initdata || {} + _data = initdata if (_data && Array.isArray(_data)) { - _data = _data[0] || {} + _data = _data[0] || {$$empty: true} } _sync = false } - } else { - _data = {} } if (_config.wrap.minHeight) { @@ -116,11 +114,11 @@ const { sync, config } = this.state if (sync && !is(fromJS(this.props.data), fromJS(nextProps.data))) { - let _data = {} + let _data = {$$empty: true} if (nextProps.data && nextProps.data[config.dataName]) { _data = nextProps.data[config.dataName] if (_data && Array.isArray(_data)) { - _data = _data[0] + _data = _data[0] || {$$empty: true} } } @@ -172,13 +170,13 @@ if (config.wrap.datatype === 'static') { this.setState({ - data: {}, + data: {$$empty: true}, loading: false }) return } else if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� this.setState({ - data: {}, + data: {$$empty: true}, loading: false }) return @@ -200,7 +198,7 @@ let result = await Api.genericInterface(param) if (result.status) { - let _data = result.data && result.data[0] ? result.data[0] : {} + let _data = result.data && result.data[0] ? result.data[0] : {$$empty: true} this.setState({ data: _data, @@ -221,6 +219,8 @@ render() { const { config, loading, data } = this.state + if (config.wrap.empty === 'hidden' && (!data || data.$$empty)) return null + return ( <div className="custom-braft-editor-box" id={'anchor' + config.uuid} style={config.style}> {loading ? -- Gitblit v1.8.0