feat: 合同富文本改为表头调列宽、首列调行高,避免拖拽把邻列挤窄。

产品表按像素列宽重排,水印改到页面右下角,打开编辑时不再铺满整表绿线。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
wuzilongandCursor committed 2026-10-29 11:57:39 +08:00
1 parent bde19c0644
commit 3aa0f0ff2e
12 files changed
+734 -161

No files matched your search

@@ -10,7 +10,7 @@ import Editor from '@tinymce/tinymce-vue';
import { fetchUploadAttachment } from '@/api/admin';
import { resolveCrmAttachmentUrl } from '@/utils/crm-attachment';
import { buildAttachmentUploadFormData, CRM_UPLOAD_BIZ_TYPE } from '@/utils/crm-upload';
import { setupExcelLikeTableResize } from '@/utils/tinymce-table-excel-resize';
import { setupTableEdgeResize } from '@/utils/tinymce-table-edge-resize';
/** 须高于 ElConfigProvider 初始 z-index(3000) 及多层 el-dialog 叠加 */
const TINYMCE_Z_INDEX_FLOOR = 10000;
@@ -125,20 +125,19 @@ const editorInit = computed(() => {
const baseZIndex = resolveTinyMceBaseZIndex();
const backgroundStyle = isSXSupplier.value
? `
/* 水印背景层 - 使用伪元素覆盖整个编辑器区域 */
/* 编辑区水印贴在视口右下角,避免盖住产品表单价。 */
html { background: #fff; }
body { background: transparent !important; }
body::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
min-height: 100vh;
position: fixed;
inset: 0;
background-image: url('/watermask.jpg');
background-repeat: no-repeat;
background-size: 50% auto;
background-position: center center;
opacity: 0.15;
background-position: right 16px bottom 16px;
background-size: 140px auto;
opacity: 0.18;
mix-blend-mode: multiply;
pointer-events: none;
z-index: 0;
}
@@ -208,11 +207,6 @@ const editorInit = computed(() => {
width: 100%;
}
${backgroundStyle}
/* 确保内容在水印上方;排除 snooker / Excel 调整层 */
body > *:not(.ephox-snooker-resizer-bar):not(#sx-excel-resize-layer) {
position: relative;
z-index: 1;
}
/* 表格:固定布局;不抢占内联宽高/对齐/边框 */
table {
border-collapse: collapse;
@@ -236,13 +230,9 @@ const editorInit = computed(() => {
background-color: #f5f5f5;
font-weight: bold;
}
/* 原生调整条仅作可视提示,勿改 width/height/margin(会破坏拖拽几何) */
/* 列宽/行高拖拽已关闭,避免调整条改写表格列宽 */
.ephox-snooker-resizer-bar {
background-color: #10b981 !important;
}
.ephox-snooker-resizer-bar:hover,
.ephox-snooker-resizer-bar.ephox-snooker-resizer-bar-dragging {
opacity: 0.9 !important;
display: none !important;
}
h1 {
text-align: center;
@@ -288,14 +278,13 @@ const editorInit = computed(() => {
extended_valid_elements: '*[*]',
valid_elements: '*[*]',
// 表格配置:像素列宽 + 拖拽条,表格总宽在拖列时尽量保持(更接近 Excel)
// 表格配置:固定像素列宽,不显示列/行拖拽条
table_toolbar:
'tableprops tablecellprops tabledelete | tablemergecells tablesplitcells | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol | tablecellhalign tablecellvalign tablecellwrap',
table_appearance_options: true,
table_grid: true,
table_resize_bars: true,
table_resize_bars: false,
table_sizing_mode: 'fixed',
table_column_resizing: 'preservetable',
table_use_colgroups: true,
table_default_attributes: {
border: '1'
@@ -357,7 +346,7 @@ const editorInit = computed(() => {
image_caption: true,
image_title: true,
// 图片可拖拽缩放;表格列宽/行高改由 setupExcelLikeTableResize(类 Excel 边线拖拽)
// 图片仍可拖拽缩放;表格只在第一行右边界、第一列下边界拖拽
object_resizing: 'img,figure.image,div,video,iframe',
// 允许拖拽图片
@@ -366,7 +355,7 @@ const editorInit = computed(() => {
// 初始化回调
setup: (editor: any) => {
props.editorSetupExtra?.(editor)
setupExcelLikeTableResize(editor)
setupTableEdgeResize(editor)
const applyCellStyle = (style: string, value: string) => {
if (editor.queryCommandSupported('mceTableApplyCellStyle')) {