提交 c93df65a authored 作者: 钟是志's avatar 钟是志

一站式wangEditor组件开发

上级 6e0792ea
...@@ -27,6 +27,7 @@ export default function Index({ ...@@ -27,6 +27,7 @@ export default function Index({
value, value,
domKey, domKey,
onChangeValue, onChangeValue,
menus,
}) { }) {
useEffect(() => { useEffect(() => {
editor = new WangEditor(`#wangEditor${domKey}`); editor = new WangEditor(`#wangEditor${domKey}`);
...@@ -61,7 +62,7 @@ export default function Index({ ...@@ -61,7 +62,7 @@ export default function Index({
editor.config.pasteFilterStyle = false; // 关闭粘贴样式的过滤 editor.config.pasteFilterStyle = false; // 关闭粘贴样式的过滤
editor.config.uploadImgMaxSize = 3 * 1024 * 1024; // 上传的图片不能大于3M editor.config.uploadImgMaxSize = 3 * 1024 * 1024; // 上传的图片不能大于3M
editor.config.uploadImgMaxLength = 1; // 一次最多上传 1 个图片 editor.config.uploadImgMaxLength = 1; // 一次最多上传 1 个图片
editor.config.menus = [ editor.config.menus = menus || [
// 配置菜单 // 配置菜单
'head', 'head',
'bold', 'bold',
...@@ -81,7 +82,7 @@ export default function Index({ ...@@ -81,7 +82,7 @@ export default function Index({
// 'emoticon', // 'emoticon',
'image', 'image',
'video', 'video',
'table', // 'table',
// 'code', // 'code',
'splitLine', 'splitLine',
// 'undo', // 'undo',
......
import React, { useState, useEffect, forwardRef } from 'react'; import React, { useState, useEffect, forwardRef } from 'react';
import WangEditor from './OneStopWangEditor'; import WangEditor from './OneStopWangEditor';
function Index({ onChange, value, otherProps, dataColumn, disabled }) { function Index({ onChange, value, otherProps, dataColumn, disabled, json }) {
const [ready, setReady] = useState(false); const [ready, setReady] = useState(false);
const domKey = dataColumn.base52 || 'wang-editor-dom-content'; const domKey = dataColumn.base52 || 'wang-editor-dom-content';
useEffect(() => { useEffect(() => {
...@@ -18,11 +18,13 @@ function Index({ onChange, value, otherProps, dataColumn, disabled }) { ...@@ -18,11 +18,13 @@ function Index({ onChange, value, otherProps, dataColumn, disabled }) {
return ( return (
<WangEditor <WangEditor
key={'cmsContent'} key={'cmsContent'}
zIndex={otherProps?.zIndex || undefined}
menus={otherProps?.menus || undefined}
placeholder={json.placeholder || ''}
height={otherProps?.height || 450} height={otherProps?.height || 450}
value={value || ''} value={value || ''}
domKey={dataColumn.base52 || 'wang-editor-dom-content'} domKey={dataColumn.base52 || 'wang-editor-dom-content'}
onChangeValue={onChange} onChangeValue={onChange}
otherProps={otherProps}
/> />
); );
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论