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
64dfeb22
Commit
64dfeb22
authored
Apr 28, 2025
by
pangchong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 样式
parent
bd5ce05e
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
20 deletions
+30
-20
src/assets/css/element.less
+5
-2
src/configs/node.config.ts
+5
-2
src/views/editor/components/Tree.vue
+2
-2
src/views/editor/constants/tree.ts
+1
-0
src/views/editor/functions/index.ts
+13
-4
src/views/editor/functions/tree.ts
+4
-10
No files found.
src/assets/css/element.less
View file @
64dfeb22
...
@@ -33,9 +33,12 @@ row {
...
@@ -33,9 +33,12 @@ row {
display: flex !important;
display: flex !important;
flex-wrap: wrap;
flex-wrap: wrap;
}
}
entry {
html-thead entry {
flex: 1;
font-weight: bold;
font-weight: bold;
}
entry {
flex: 0.5;
border: 1px solid var(--border-color);
border: 1px solid var(--border-color);
}
}
pan {
pan {
...
...
src/configs/node.config.ts
View file @
64dfeb22
...
@@ -43,7 +43,10 @@ export const nodeSet = [
...
@@ -43,7 +43,10 @@ export const nodeSet = [
'IMGAREA'
,
'IMGAREA'
,
'KEY'
,
'KEY'
,
'REVDATE'
,
'REVDATE'
,
'SHEETNBR'
'SHEETNBR'
,
//处理原生html标签
'HTML-TABLE'
,
'HTML-THEAD'
,
'HTML-TBODY'
]
]
export
const
htmlNode
=
[
'TABLE'
,
'THEAD'
,
'TBODY'
]
export
const
contentHoldNode
=
[
'PARA'
,
'PARAC'
,
'TITLE'
,
'TITLEC'
,
'REFEXT'
,
'STDNAME'
,
'ZONE'
,
'PAN'
,
'REFBLOCK'
]
export
const
contentHoldNode
=
[
'PARA'
,
'PARAC'
,
'TITLE'
,
'TITLEC'
,
'REFEXT'
,
'STDNAME'
,
'ZONE'
,
'PAN'
,
'REFBLOCK'
]
src/views/editor/components/Tree.vue
View file @
64dfeb22
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<div
class=
"p-[10px]"
>
<div
class=
"p-[10px]"
>
<n-input
v-model:value=
"searchKey"
placeholder=
"搜索"
/>
<n-input
v-model:value=
"searchKey"
placeholder=
"搜索"
/>
</div>
</div>
<div
class=
"flex-auto overflow-auto"
>
<div
class=
"flex-auto overflow-auto"
ref=
"treeContainer"
>
<n-tree
<n-tree
ref=
"treeRef"
ref=
"treeRef"
v-model:expanded-keys=
"expandedKeys"
v-model:expanded-keys=
"expandedKeys"
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
</
template
>
</
template
>
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
{
treeSelectedKeys
,
treeRef
,
searchKey
,
expandedKeys
,
treeData
}
from
'../constants/tree'
import
{
treeSelectedKeys
,
treeRef
,
searchKey
,
expandedKeys
,
treeData
,
treeContainer
}
from
'../constants/tree'
import
{
buildFilteredTree
,
getAllKeys
,
nodeProps
,
renderLabel
}
from
'../functions/tree'
import
{
buildFilteredTree
,
getAllKeys
,
nodeProps
,
renderLabel
}
from
'../functions/tree'
const
realComposableData
=
computed
(
function
()
{
const
realComposableData
=
computed
(
function
()
{
...
...
src/views/editor/constants/tree.ts
View file @
64dfeb22
...
@@ -5,3 +5,4 @@ export const treeData: Ref<TreeOption[]> = ref([])
...
@@ -5,3 +5,4 @@ export const treeData: Ref<TreeOption[]> = ref([])
export
const
treeSelectedKeys
=
ref
<
string
[]
>
([])
export
const
treeSelectedKeys
=
ref
<
string
[]
>
([])
export
const
treeRef
=
ref
()
export
const
treeRef
=
ref
()
export
const
searchKey
=
ref
(
''
)
export
const
searchKey
=
ref
(
''
)
export
const
treeContainer
=
ref
()
src/views/editor/functions/index.ts
View file @
64dfeb22
import
{
showLoading
}
from
'../constants'
import
{
showLoading
}
from
'../constants'
import
{
IDomEditor
}
from
'@wangeditor/editor'
import
{
IDomEditor
}
from
'@wangeditor/editor'
import
{
treeData
,
treeRef
,
treeSelectedKeys
}
from
'../constants/tree'
import
{
tree
Container
,
tree
Data
,
treeRef
,
treeSelectedKeys
}
from
'../constants/tree'
import
{
dropdownConfig
,
editorRef
,
editorHtml
}
from
'../constants'
import
{
dropdownConfig
,
editorRef
,
editorHtml
}
from
'../constants'
import
{
getUUID
}
from
'@/utils'
import
{
getUUID
}
from
'@/utils'
import
{
compareData
,
compareLeftContent
,
compareRightContent
,
showCompare
}
from
'../constants/compare'
import
{
compareData
,
compareLeftContent
,
compareRightContent
,
showCompare
}
from
'../constants/compare'
...
@@ -14,7 +14,8 @@ export const handleCreated = (editor: IDomEditor) => {
...
@@ -14,7 +14,8 @@ export const handleCreated = (editor: IDomEditor) => {
}
}
export
const
handleClick
=
(
event
:
any
)
=>
{
export
const
handleClick
=
(
event
:
any
)
=>
{
const
key
=
getKey
(
event
.
target
)
const
key
=
getKey
(
event
.
target
)
treeRef
.
value
?.
scrollTo
({
key
})
const
node
=
treeContainer
.
value
?.
querySelector
(
`[data-key="
${
key
}
"]`
)
node
.
scrollIntoView
({
behavior
:
'smooth'
})
treeSelectedKeys
.
value
=
[
key
]
treeSelectedKeys
.
value
=
[
key
]
setEditorActive
(
key
)
setEditorActive
(
key
)
}
}
...
@@ -113,9 +114,17 @@ export const uploadXml = async () => {
...
@@ -113,9 +114,17 @@ export const uploadXml = async () => {
const
xmlProcessing
=
useXMLProcessing
()
const
xmlProcessing
=
useXMLProcessing
()
showLoading
.
value
=
true
showLoading
.
value
=
true
const
res
=
await
xmlProcessing
.
processFile
(
file
,
nodeSet
,
contentHoldNode
)
const
res
=
await
xmlProcessing
.
processFile
(
file
,
nodeSet
,
contentHoldNode
)
console
.
log
(
res
)
// console.log(res.treeData[0].node.attributes)
let
xmlContent
=
res
.
xmlContent
//处理原生html标签
xmlContent
=
xmlContent
.
replace
(
/<TABLE
(?!\s
*
\/
>
)([^
>
]
*
)
>/g
,
'<HTML-TABLE data-w-e-type="HTML-TABLE" $1>'
)
xmlContent
=
xmlContent
.
replace
(
/<
\/
TABLE>/g
,
'</HTML-TABLE>'
)
xmlContent
=
xmlContent
.
replace
(
/<THEAD
(?!\s
*
\/
>
)([^
>
]
*
)
>/g
,
'<HTML-THEAD data-w-e-type="HTML-THEAD" $1>'
)
xmlContent
=
xmlContent
.
replace
(
/<
\/
THEAD>/g
,
'</HTML-THEAD>'
)
xmlContent
=
xmlContent
.
replace
(
/<TBODY
(?!\s
*
\/
>
)([^
>
]
*
)
>/g
,
'<HTML-TBODY data-w-e-type="HTML-TBODY" $1>'
)
xmlContent
=
xmlContent
.
replace
(
/<
\/
TBODY>/g
,
'</HTML-TBODY>'
)
showLoading
.
value
=
false
showLoading
.
value
=
false
editorHtml
.
value
=
res
.
xmlContent
editorHtml
.
value
=
xmlContent
}
}
input
.
remove
()
input
.
remove
()
})
})
...
...
src/views/editor/functions/tree.ts
View file @
64dfeb22
...
@@ -6,18 +6,12 @@ import { TreeOption } from 'naive-ui'
...
@@ -6,18 +6,12 @@ import { TreeOption } from 'naive-ui'
export
const
renderLabel
=
({
option
}:
{
option
:
TreeOption
})
=>
{
export
const
renderLabel
=
({
option
}:
{
option
:
TreeOption
})
=>
{
const
container
=
editorRef
.
value
?.
getEditableContainer
()
const
container
=
editorRef
.
value
?.
getEditableContainer
()
const
dom
=
container
!
.
querySelector
(
`[data-key="
${
option
.
key
}
"]`
)
as
HTMLElement
const
dom
=
container
!
.
querySelector
(
`[data-key="
${
option
.
key
}
"]`
)
as
HTMLElement
//处理原生html标签
const
label
=
option
.
label
?.
replace
(
/HTML-/g
,
''
)
if
(
dom
&&
dom
.
firstElementChild
?.
tagName
==
'SPAN'
)
{
if
(
dom
&&
dom
.
firstElementChild
?.
tagName
==
'SPAN'
)
{
return
{
return
[
h
(
'span'
,
{
'data-key'
:
option
.
key
},
label
),
h
(
'span'
,
{
class
:
'text-textColorDisabled ml-[5px]'
},
dom
.
innerText
)]
default
:
()
=>
{
return
[
h
(
'span'
,
{},
option
.
label
),
h
(
'span'
,
{
class
:
'text-textColorDisabled ml-[5px]'
},
dom
.
innerText
)]
}
}
}
else
{
}
else
{
return
{
return
h
(
'span'
,
{
'data-key'
:
option
.
key
},
{
default
:
()
=>
label
})
default
:
()
=>
{
return
option
.
label
}
}
}
}
}
}
//点击节点
//点击节点
...
...
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