Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vue3_onlineEditor
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pangchong
vue3_onlineEditor
Commits
df7be9ee
Commit
df7be9ee
authored
Mar 28, 2025
by
qlintonger xeno
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: AI格式化processing+4
parent
35ba9b8b
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
7 deletions
+11
-7
src/lib/XMLProcessor/src/core/Processing.ts
+8
-2
src/views/editor/components/ContentTree.vue
+1
-3
src/views/editor/constants/dummy.ts
+0
-0
src/views/editor/functions/index.ts
+1
-1
src/views/editor/functions/render-elem.ts
+1
-1
No files found.
src/lib/XMLProcessor/src/core/Processing.ts
View file @
df7be9ee
...
...
@@ -7,10 +7,16 @@ import { UUID } from 'uuidjs';
export
class
Processing
{
// 私有属性,用于解析 XML 字符串为 DOM 对象
private
domParser
:
DOMParser
;
private
xmlSerializer
:
XMLSerializer
// 构造函数,初始化 DOMParser 实例
constructor
()
{
this
.
domParser
=
new
DOMParser
();
this
.
xmlSerializer
=
new
XMLSerializer
();
}
serializeXML
(
xmlDOM
:
Document
):
string
{
return
this
.
xmlSerializer
.
serializeToString
(
xmlDOM
);
}
// 处理 XML 字符串的方法,返回树形数据和 XML DOM 对象
...
...
@@ -64,7 +70,7 @@ export class Processing {
private
innerHandle
(
domNode
:
Element
,
handledNode
:
string
[]):
TreeRenderResult
[]
{
let
treeData
:
TreeRenderResult
[]
=
[];
// 生成唯一的 key
const
targetKey
=
UUID
.
generate
();
const
targetKey
=
'g-'
+
UUID
.
generate
();
// 创建树形数据项
const
treeItem
:
TreeRenderResult
=
{
key
:
targetKey
,
...
...
@@ -101,7 +107,7 @@ export class Processing {
}
realIndex
++
;
// 生成唯一的 key
const
targetKey
=
UUID
.
generate
();
const
targetKey
=
'g-'
+
UUID
.
generate
();
// 创建树形数据项
const
treeItem
:
TreeRenderResult
=
{
key
:
targetKey
,
...
...
src/views/editor/components/ContentTree.vue
View file @
df7be9ee
...
...
@@ -17,11 +17,10 @@
</
template
>
<
script
setup
lang=
"ts"
>
import
{
searchKey
,
treeData
,
realComposabl
eData
,
xmlDOM
}
from
'../constants'
import
{
realComposableData
,
searchKey
,
tre
eData
,
xmlDOM
}
from
'../constants'
import
FileXML
from
'@/assets/file/CES-QEC-V250-A.xml?raw'
import
type
{
TreeOption
}
from
'naive-ui'
import
{
nodeProps
}
from
'../functions'
import
{
contentDummy
}
from
'@/views/editor/constants/dummy.ts'
const
xmlProcessing
=
useXMLProcessing
()
const
nodeSet
=
[
...
...
@@ -53,7 +52,6 @@ onMounted(function () {
const
res
=
xmlProcessing
.
processXML
(
FileXML
,
nodeSet
)
treeData
.
value
=
res
.
treeData
xmlDOM
.
value
=
res
.
xmlDOM
console
.
log
(
'dummy-ts'
,
contentDummy
,
xmlProcessing
.
processXML
(
contentDummy
,
nodeSet
))
})
function
getAllKeys
(
item
:
TreeOption
[])
{
return
item
.
reduce
(
function
(
q
,
w
)
{
...
...
src/views/editor/constants/dummy.ts
deleted
100644 → 0
View file @
35ba9b8b
This diff is collapsed.
Click to expand it.
src/views/editor/functions/index.ts
View file @
df7be9ee
...
...
@@ -3,7 +3,7 @@ import { editorRef } from '../constants'
import
{
TreeOption
}
from
'naive-ui'
export
const
handleEditor
=
(
editor
:
IDomEditor
)
=>
{
console
.
log
(
editor
.
getHtml
())
// console.log(editor.getElemsByTypePrefix('JOBCARD'))
// console.log(editor)
// const headers = editor.getElemsByTypePrefix('header')
...
...
src/views/editor/functions/render-elem.ts
View file @
df7be9ee
...
...
@@ -4,7 +4,7 @@ import { IDomEditor, IModuleConf, SlateElement } from '@wangeditor/editor'
const
renderElem
=
(
type
:
string
,
style
=
{
display
:
'block'
})
=>
{
return
(
elem
:
SlateElement
,
children
:
VNode
[]
|
null
,
editor
:
IDomEditor
):
VNode
=>
{
const
dataKey
=
(
elem
as
any
).
dataKey
return
h
(
type
,
{
style
,
attrs
:
{
dataKey
:
dataKey
}
},
children
)
return
h
(
type
,
{
style
,
attrs
:
{
dataKey
:
dataKey
,
id
:
dataKey
}
},
children
)
}
}
const
createRenderConfig
=
(
types
:
string
|
string
[])
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment