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
5aaa8926
Commit
5aaa8926
authored
Mar 28, 2025
by
qlintonger xeno
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: AI格式化processing+41567
parent
ff6336ef
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
14 deletions
+10
-14
components.d.ts
+0
-4
src/lib/XMLProcessor/src/core/Processing.ts
+2
-3
src/lib/XMLProcessor/src/index.ts
+4
-4
src/views/editor/functions/index.ts
+2
-1
src/views/editor/index.vue
+2
-2
No files found.
components.d.ts
View file @
5aaa8926
...
...
@@ -7,7 +7,6 @@ export {}
declare
module
'vue'
{
export
interface
GlobalComponents
{
NButton
:
typeof
import
(
'naive-ui'
)[
'NButton'
]
NCard
:
typeof
import
(
'naive-ui'
)[
'NCard'
]
NConfigProvider
:
typeof
import
(
'naive-ui'
)[
'NConfigProvider'
]
NInput
:
typeof
import
(
'naive-ui'
)[
'NInput'
]
...
...
@@ -16,10 +15,7 @@ declare module 'vue' {
NLayoutFooter
:
typeof
import
(
'naive-ui'
)[
'NLayoutFooter'
]
NLayoutHeader
:
typeof
import
(
'naive-ui'
)[
'NLayoutHeader'
]
NMessageProvider
:
typeof
import
(
'naive-ui'
)[
'NMessageProvider'
]
NResult
:
typeof
import
(
'naive-ui'
)[
'NResult'
]
NSpace
:
typeof
import
(
'naive-ui'
)[
'NSpace'
]
NTree
:
typeof
import
(
'naive-ui'
)[
'NTree'
]
NUpload
:
typeof
import
(
'naive-ui'
)[
'NUpload'
]
RouterLink
:
typeof
import
(
'vue-router'
)[
'RouterLink'
]
RouterView
:
typeof
import
(
'vue-router'
)[
'RouterView'
]
}
...
...
src/lib/XMLProcessor/src/core/Processing.ts
View file @
5aaa8926
...
...
@@ -55,11 +55,10 @@ export class Processing {
const
content
=
fr
.
result
as
string
;
try
{
// 调用 processXML 方法处理读取的文件内容
const
{
treeData
,
xmlDOM
}
=
this
.
processXML
(
content
,
handledNode
);
xmlDOM
.
documentElement
.
querySelectorAll
(
':not([data-key])'
).
forEach
((
node
)
=>
node
.
remove
())
const
{
treeData
,
xmlDOM
,
xmlContent
}
=
this
.
processXML
(
content
,
handledNode
);
// 解析成功,返回树形数据和 XML DOM 对象
resolve
({
treeData
,
xmlDOM
,
xmlContent
:
this
.
serializeXML
(
xmlDOM
)
});
resolve
({
treeData
,
xmlDOM
,
xmlContent
});
}
catch
(
error
)
{
// 解析失败,拒绝 Promise 并返回错误信息
reject
(
error
);
...
...
src/lib/XMLProcessor/src/index.ts
View file @
5aaa8926
import
{
Processing
}
from
'@/lib/XMLProcessor/src/core/Processing.ts'
import
{
Plugin
}
from
'vue'
import
{
Plugin
,
getCurrentInstance
,
getCurrentScope
}
from
'vue'
const
p
=
new
Processing
()
export
const
XMLProcessing
:
Plugin
=
function
(
app
)
{
...
...
@@ -7,9 +7,8 @@ export const XMLProcessing: Plugin = function(app) {
}
export
function
useXMLProcessing
():
Processing
{
try
{
if
(
getCurrentInstance
())
{
return
<
Processing
>
inject
(
'xmlProcessing'
)
}
catch
(
e
)
{
return
p
}
return
p
}
\ No newline at end of file
src/views/editor/functions/index.ts
View file @
5aaa8926
...
...
@@ -2,6 +2,7 @@ import { IDomEditor } from '@wangeditor/editor'
import
{
editorRef
,
treeData
,
xmlContent
,
xmlDOM
}
from
'../constants'
import
{
TreeOption
}
from
'naive-ui'
import
{
nodeSet
}
from
'../constants/nodeParsed'
import
{
getCurrentInstance
,
getCurrentScope
}
from
'vue'
export
const
handleEditor
=
(
editor
:
IDomEditor
)
=>
{
// console.log(editor.getElemsByTypePrefix('JOBCARD'))
...
...
@@ -34,8 +35,8 @@ export const nodeProps = ({ option }: { option: TreeOption }) => {
}
}
}
const
xmlProcessing
=
useXMLProcessing
()
export
const
uploadXml
=
async
(
file
:
File
)
=>
{
const
xmlProcessing
=
useXMLProcessing
()
const
res
=
await
xmlProcessing
.
processFile
(
file
,
nodeSet
)
treeData
.
value
=
res
.
treeData
xmlDOM
.
value
=
res
.
xmlDOM
...
...
src/views/editor/index.vue
View file @
5aaa8926
...
...
@@ -15,9 +15,9 @@ import { editorRef, formData, xmlContent } from './constants'
import
{
handleEditor
}
from
'./functions'
onMounted
(()
=>
{
nextTick
(()
=>
{
watchEffect
(
function
()
{
editorRef
.
value
?.
editorRef
?.
setHtml
(
xmlContent
.
value
)
})
}
,
{
flush
:
'post'
}
)
})
</
script
>
<
style
lang=
"less"
scoped
>
...
...
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