Commit bdf9aa2b by pangchong

feat: 富文本数据修改

parent fc3298df
...@@ -5,8 +5,6 @@ const elemToHtml = (type: string) => { ...@@ -5,8 +5,6 @@ const elemToHtml = (type: string) => {
const dataKey = (elem as any).dataKey || '' const dataKey = (elem as any).dataKey || ''
return `<${type} return `<${type}
data-w-e-type="${type}" data-w-e-type="${type}"
data-w-e-is-void
data-w-e-is-inline
data-key="${dataKey}" data-key="${dataKey}"
>${childrenHtml}</${type}>` >${childrenHtml}</${type}>`
} }
......
...@@ -20,8 +20,7 @@ export const handleEditor = (editor: IDomEditor) => { ...@@ -20,8 +20,7 @@ export const handleEditor = (editor: IDomEditor) => {
export const nodeProps = ({ option }: { option: TreeOption }) => { export const nodeProps = ({ option }: { option: TreeOption }) => {
return { return {
onClick() { onClick() {
console.log(editorRef.value?.editorRef.getEditableContainer()) editorRef.value?.editorRef.scrollToElem([option.key])
editorRef.value?.editorRef.scrollToElem(['w-e-element-124'])
} }
} }
} }
...@@ -4,7 +4,7 @@ import { IDomEditor, IModuleConf, SlateElement } from '@wangeditor/editor' ...@@ -4,7 +4,7 @@ import { IDomEditor, IModuleConf, SlateElement } from '@wangeditor/editor'
const renderElem = (type: string, style = { display: 'block' }) => { const renderElem = (type: string, style = { display: 'block' }) => {
return (elem: SlateElement, children: VNode[] | null, editor: IDomEditor): VNode => { return (elem: SlateElement, children: VNode[] | null, editor: IDomEditor): VNode => {
const dataKey = (elem as any).dataKey const dataKey = (elem as any).dataKey
return h(type, { style, props: { id: dataKey } }, children) return h(type, { style, attrs: { dataKey: dataKey } }, children)
} }
} }
const createRenderConfig = (types: string | string[]) => { const createRenderConfig = (types: string | string[]) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment