Commit 64fc94cb by pangchong

feat: 样式调整

parent 82547a76
...@@ -36,10 +36,13 @@ row { ...@@ -36,10 +36,13 @@ row {
html-thead entry { html-thead entry {
font-weight: bold; font-weight: bold;
} }
tgroup {
border: 1px solid var(--border-color);
}
entry { entry {
flex: 0.5; flex: 0.5;
border-right: 1px solid var(--border-color);
border: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color);
} }
pan { pan {
display: inline-block !important; display: inline-block !important;
......
...@@ -52,12 +52,15 @@ import { ...@@ -52,12 +52,15 @@ import {
compareRightContent compareRightContent
} from '../constants/compare' } from '../constants/compare'
import { clearLeftXml, clearRightXml, handleScrollTopLeft, handleScrollTopRight, uploadLeftXml, uploadRightXml } from '../functions/compare' import { clearLeftXml, clearRightXml, handleScrollTopLeft, handleScrollTopRight, uploadLeftXml, uploadRightXml } from '../functions/compare'
import { handleNativeHtml } from '../functions'
watchEffect(() => { watchEffect(() => {
if (compareLeftContent.value && compareRightContent.value) { if (compareLeftContent.value && compareRightContent.value) {
const xmlProcessing = useXMLProcessing() const xmlProcessing = useXMLProcessing()
const res = xmlProcessing.dualCompareFromString(compareLeftContent.value, compareRightContent.value, nodeSet, contentHoldNode) const res = xmlProcessing.dualCompareFromString(compareLeftContent.value, compareRightContent.value, nodeSet, contentHoldNode)
Object.assign(compareData, res) Object.assign(compareData, res)
compareData.treeOld = handleNativeHtml(compareData.treeOld)
compareData.treeNew = handleNativeHtml(compareData.treeNew)
} }
}) })
</script> </script>
......
...@@ -9,6 +9,7 @@ import { ...@@ -9,6 +9,7 @@ import {
compareRightRef, compareRightRef,
showCompare showCompare
} from '../constants/compare' } from '../constants/compare'
import { handleNativeHtml } from '.'
export const handleClickDom = (event: any) => { export const handleClickDom = (event: any) => {
if (!showCompare.value) return if (!showCompare.value) return
...@@ -43,7 +44,7 @@ export const uploadLeftXml = async () => { ...@@ -43,7 +44,7 @@ export const uploadLeftXml = async () => {
const xmlProcessing = useXMLProcessing() const xmlProcessing = useXMLProcessing()
const res = await xmlProcessing.processFile(file, nodeSet, contentHoldNode) const res = await xmlProcessing.processFile(file, nodeSet, contentHoldNode)
compareLeftContent.value = res.xmlContent compareLeftContent.value = res.xmlContent
compareData.treeOld = res.xmlContent compareData.treeOld = handleNativeHtml(res.xmlContent)
} }
input.remove() input.remove()
}) })
...@@ -61,7 +62,7 @@ export const uploadRightXml = async () => { ...@@ -61,7 +62,7 @@ export const uploadRightXml = async () => {
const xmlProcessing = useXMLProcessing() const xmlProcessing = useXMLProcessing()
const res = await xmlProcessing.processFile(file, nodeSet, contentHoldNode) const res = await xmlProcessing.processFile(file, nodeSet, contentHoldNode)
compareRightContent.value = res.xmlContent compareRightContent.value = res.xmlContent
compareData.treeNew = res.xmlContent compareData.treeNew = handleNativeHtml(res.xmlContent)
} }
input.remove() input.remove()
}) })
......
...@@ -115,16 +115,8 @@ export const uploadXml = async () => { ...@@ -115,16 +115,8 @@ export const uploadXml = async () => {
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.treeData[0].node.attributes) // 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 = xmlContent editorHtml.value = handleNativeHtml(res.xmlContent)
} }
input.remove() input.remove()
}) })
...@@ -137,3 +129,13 @@ export const compareXml = () => { ...@@ -137,3 +129,13 @@ export const compareXml = () => {
compareLeftContent.value = '' compareLeftContent.value = ''
compareRightContent.value = '' compareRightContent.value = ''
} }
//处理原生html标签
export const handleNativeHtml = (html: string) => {
html = html.replace(/<TABLE(?!\s*\/>)([^>]*)>/g, '<HTML-TABLE data-w-e-type="HTML-TABLE" $1>')
html = html.replace(/<\/TABLE>/g, '</HTML-TABLE>')
html = html.replace(/<THEAD(?!\s*\/>)([^>]*)>/g, '<HTML-THEAD data-w-e-type="HTML-THEAD" $1>')
html = html.replace(/<\/THEAD>/g, '</HTML-THEAD>')
html = html.replace(/<TBODY(?!\s*\/>)([^>]*)>/g, '<HTML-TBODY data-w-e-type="HTML-TBODY" $1>')
html = html.replace(/<\/TBODY>/g, '</HTML-TBODY>')
return html
}
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