diff --git a/src/assets/css/style.css b/src/assets/css/style.css index b1ba8dd..0ec4bbe 100644 --- a/src/assets/css/style.css +++ b/src/assets/css/style.css @@ -39,12 +39,13 @@ } .rightDiv { height: calc(100% - 7px); - width: calc(100% - 372px); + width:100%; + /* width: calc(100% - 372px); */ /* background: lightcoral; */ /* height: 600px; */ overflow: hidden; /* overflow: hidden auto; */ - padding: 20px; + padding: 20px 0; padding-top: 4px; padding-right: 0; padding-bottom: 0; @@ -536,13 +537,30 @@ button:hover { /* border-radius: 8px; */ position: relative; } +.tree-container { + width: 100% !important; /* 确保容器占满父元素宽度 */ + overflow-x: auto !important; /* 允许容器横向滚动 */ + padding-bottom: 10px; /* 预留横向滚动条空间 */ +} +/* 确保树形组件不被限制宽度 */ +.elTree { + min-width: 100% !important; /* 至少占满容器宽度 */ + width: auto !important; /* 允许根据内容自动扩展宽度 */ + overflow-x: auto !important; /* 强制显示横向滚动条 */ + padding-right: 8px; + padding-bottom: 8px; /* 避免内容被横向滚动条遮挡 */ +} + .el-tree-node__children{ overflow:auto; } .el-tree-node__content { - max-width: 280px; + max-width: none !important; /* 取消最大宽度限制 */ + width: auto !important; /* 允许内容撑开宽度 */ + overflow: visible !important; + /* max-width: 280px; height: 30px; - overflow: auto; + overflow: auto; */ } .el-tree-node__content span div{ /* overflow: auto; */ @@ -879,18 +897,49 @@ button:hover { } /* 针对树形组件容器添加横向滚动支持 */ .tree-container { - /* 限制容器最大宽度(可根据实际布局调整) */ - width: 100%; - height:calc(100% - 90px); - overflow-x: hidden; /* 横向溢出时显示滚动条 */ - padding-bottom: 0; /* 预留底部空间,避免滚动条遮挡内容 */ + /* 保留现有样式,添加高度限制 */ + height: calc(100% - 40px); /* 减去标题高度(根据实际调整) */ + overflow: hidden; /* 避免容器自身滚动 */ +} +/* 添加以下样式 */ +.el-scrollbar { + /* 让滚动条占满容器剩余高度 */ + height: calc(100% - 80px); /* 36px 为 navTitle 的大致高度 */ + display: block; /* 确保高度生效 */ +} + +/* 调整树形组件高度,使其在滚动区域内 */ +.elTree { + max-height: 100% !important; /* 覆盖原有 max-height,使用滚动条高度 */ + height: 100% !important; +} +/* 修复滚动条容器的隐藏问题 */ +.el-scrollbar__wrap { + overflow-x: auto !important; + overflow-y: auto !important; + margin-right: -17px; /* 补偿滚动条宽度,避免内容被截断 */ + margin-bottom: -17px; +} + +/* 确保滚动条轨道可见 */ +.el-scrollbar__track { + background: rgba(0, 0, 0, 0.05); +} + +.el-scrollbar__thumb { + background: rgba(0, 0, 0, 0.2); + border-radius: 4px; } /* 确保树形组件本身不限制宽度,让内容能撑开容器 */ .elTree { - min-width: 100%; /* 至少占满容器宽度 */ - display: inline-block; /* 让树组件宽度由内容决定 */ - white-space: nowrap; /* 防止节点内容自动换行 */ +/* + min-width: 100%; + display: inline-block; / + white-space: nowrap; */ + max-height: calc(100% - 38px); + overflow: visible !important; /* 避免覆盖滚动条 */ + padding-right: 8px; } /* 优化节点文本显示,避免过长文本被截断 */ @@ -1095,7 +1144,10 @@ button:hover { text-align: left !important; } .navTitle{ - position: relative; + position: relative; /* 保持在文档流中 */ + z-index: 10; /* 避免被树形组件遮挡 */ + padding-bottom: 8px; /* 与树形组件保持间距 */ + border-bottom: 1px solid #f0f0f0; /* 可选:添加分隔线 */ } .navTitle p { margin: 0; @@ -1107,10 +1159,10 @@ button:hover { /* 可选样式 */ } .iconImgMulu{ - position: absolute; - right: 0; - /* bottom: 0; */ - top: 7px; + position: absolute; + right: 10px; + bottom: 0; + top: 0; margin: auto; height: 20px; cursor: pointer; diff --git a/src/assets/img/zw.jpg b/src/assets/img/zw.jpg new file mode 100644 index 0000000..13776ef Binary files /dev/null and b/src/assets/img/zw.jpg differ diff --git a/src/components/wang.vue b/src/components/wang.vue index 3417cb4..a61a3ef 100644 --- a/src/components/wang.vue +++ b/src/components/wang.vue @@ -1,17 +1,17 @@ + + + - -
+ + +
{{getBookName}}
+
- +
+ +
请加载有需编辑的项目
+ + +
+

目标容器: {{ countTarget }}

+

总DOM节点数量: {{ domCount }}

+

元素节点数量: {{ elementCount }}

+

文本节点数量: {{ textCount }}

+

注释节点数量: {{ commentCount }}

+
+ + 关闭 + +
+ 修改 -
@@ -518,11 +545,20 @@ import WangEditor from 'wangeditor'; import brImg from '../assets/img/br.png'; import '../assets/css/style.css' export default { - name: 'RichTextEditor', + name: 'WangEditor', components: { }, data() { return { + countDialogVisible: false, + domCount: 0, + elementCount: 0, + textCount: 0, + commentCount: 0, + countTarget: '', + leftWidth: 380, + isDragging: false, + isLoadMsg:false, minLevel:'', maxLevel:'', maxPermission:'', @@ -903,19 +939,20 @@ export default { currentImage: '',//暂无用 scale: 1,//暂无用 rotation: 0,//暂无用 - isDragging: false,//暂无用 startX: 0,//暂无用 startY: 0,//暂无用 translateX: 0,//暂无用 translateY: 0,//暂无用 containerHeight: '90vh', //暂无用 动态控制高度 //查看图片end - oldSelector:[//基础标签模块 - 'div','code','hr','br','h1,h2,h3,h4','p','img','table','a','ul','ol','blockquote','pre', - ], - newSelector:[//替换后的标签模块 - 'pDiv','pCode','pHr','pBr','pTitle','pDiv','pImg','pTable','pA','pUl','pOl','pBlockquote','pPre', - ], + // oldSelector:[//基础标签模块 + // 'div','code','hr','br','h1,h2,h3,h4','p','img','table','a','ul','ol','blockquote','pre', + // ], + // newSelector:[//替换后的标签模块 + // 'pDiv','pCode','pHr','pBr','pTitle','pDiv','pImg','pTable','pA','pUl','pOl','pBlockquote','pPre', + // ], + newSelector:[], + oldSelector:[], tempDivData:{//当前富文本str innerHTML:'五' }, @@ -1039,7 +1076,7 @@ export default { //接收富文本内容信息 FrontLoadDM_g1(e) { console.log("加载文档数据 1111") - console.log('FrontLoadDM 参数接收111:',e,e.detail) + // console.log('FrontLoadDM 参数接收111:',e,e.detail) // this.editorShow = true; let xmlContent = e.detail.trim(); @@ -1054,10 +1091,10 @@ export default { // console.log("xmlContent",xmlContent) const parser = new DOMParser() const xmlDoc = parser.parseFromString(xmlContent, "text/xml") - console.log("xmlDoc",xmlDoc) + // console.log("xmlDoc",xmlDoc) const contentNodes = xmlDoc.getElementsByTagName('content')[0]; - console.log("xmlDoc.getElementsByTagName('content')",xmlDoc.getElementsByTagName('content')) - console.log("contentNodes",contentNodes) + // console.log("xmlDoc.getElementsByTagName('content')",xmlDoc.getElementsByTagName('content')) + // console.log("contentNodes",contentNodes) const rdfDescription = xmlDoc.querySelector('rdf\\:Description, Description'); @@ -1076,7 +1113,7 @@ export default { qualityVerification: this.getNodeValue(rdfDescription, 'dc\\:qualityVerification, qualityVerification'), permission: this.getNodeValue(rdfDescription, 'dc\\:permission, permission') }; - console.log('XML解析成功', this.form); + // console.log('XML解析成功', this.form); }else{ this.form = { name: '', @@ -1092,10 +1129,10 @@ export default { console.log("目录解析不成功 置空",this.form) } if (contentNodes) { - console.log("处理前",contentNodes.innerHTML) + // console.log("处理前",contentNodes.innerHTML) let htmlContent = this.convertXmlContentToHtml(contentNodes.innerHTML) let htmlContent2 = this.completeModel3DTags(htmlContent) - console.log("处理后",htmlContent2) + // console.log("处理后",htmlContent2) const htmlContent3 = this.replaceModel3dToImg(htmlContent2); // this.editor.txt.html(htmlContent) //处理过后再导入 @@ -1481,7 +1518,7 @@ export default { if(src){ const imgUrl = src?src:'http://localhost:5432/DM_Material/a1.jpg'; console.log("地址",src,imgUrl) - this.editor.cmd.do('insertHTML', `图片`) + this.editor.cmd.do('insertHTML', `图片`) } } }, @@ -1509,55 +1546,7 @@ export default { // 替换标签名,保留所有属性 return htmlString.replace(regex, ''); }, - - - // // 插入视频 - // insertVideo() { - // // const videoUrl = 'http://youneed.top:10017/uploads/video.mp4' - // const videoUrl = 'https://r1.realme.net/general/20250530/17485780109181ed6767541a64e7d90626e0a3fd1aaae.mp4?type=video/mp4'; - // const videoId = `video-${Date.now()}` - - // // 创建视频HTML - // const videoHtml = ` - //
- // - // - //
- //


- // ` - - // // 使用编辑器命令插入 - // this.editor.cmd.do('insertHTML', videoHtml) - - // // 添加删除事件监听 - - // this.$nextTick(() => { - // const btn = document.querySelector(`button[data-video-id="${videoId}"]`) - // if (btn) { - // btn.onclick = (e) => { - // e.preventDefault() - // this.deleteVideoById(videoId) - // } - // } - // }) - - - // }, - - - - // // 根据ID删除视频(修正版) - // deleteVideoById(videoId) { - // const container = document.querySelector(`.video-container[data-video-id="${videoId}"]`) - // if (container) { - // container.remove() - // this.editor.txt.html(this.editor.txt.html()) // 刷新编辑器 - // } - // }, + dmcTable() { if(this.dmcHint){ this.dmcHint = false; @@ -2537,18 +2526,23 @@ export default { //富文本内容打标签 dataXmlProcessing(type,saveId) { - let html = this.editor.txt.html() - console.log('保存内容',html); - // 正则表达式:匹配img、audio、video标签的src属性 - // 支持三种标签: