This commit is contained in:
2025-01-23 11:13:12 +08:00
parent 49ee596932
commit d652ab2354
5 changed files with 67 additions and 60 deletions

View File

@@ -232,8 +232,8 @@
>
<el-form ref="editMes" :model="commentForm" label-width="115px">
<el-form-item label="Select Content:" v-if="commentForm.content">
<p style="background: #eef0f4; line-height: 20px; padding: 10px; box-sizing: border-box">
{{ commentForm.content }}
<p style="background: #eef0f4; line-height: 20px; padding: 10px; box-sizing: border-box" v-html="commentForm.content">
</p>
</el-form-item>
<el-form-item label="Word">

View File

@@ -357,7 +357,7 @@ export default {
statusbar: false, // 关闭底部状态栏
custom_colors: false,
color_map: ['0082AA', 'TMR Blue'],
plugins: 'forecolor code paste table image mathType', // 启用 forecolor 和 code 插件
plugins: 'forecolor code paste table image mathType searchreplace', // 启用 forecolor 和 code 插件
end_container_on_empty_block: true,
content_css: 'default', // 加载 TinyMCE 默认样式表
mathjax: {

View File

@@ -15,7 +15,7 @@
:value="value"
:typesettingType="typesettingType"
class="paste-area text-container"
:toolbar="['bold italic|customBlue removeBlue|subscript superscript|clearButton']"
:toolbar="['bold italic|customBlue removeBlue|subscript superscript|searchreplace|clearButton']"
style="
/* white-space: pre-line; */
line-height: 12px;

View File

@@ -11,7 +11,7 @@
:value="updatedHtml"
:typesettingType="typesettingType"
class="paste-area text-container"
:toolbar="['bold italic|customBlue removeBlue|subscript superscript|table tabledelete| mathType |clearButton']"
:toolbar="['bold italic|customBlue removeBlue|subscript superscript|table tabledelete| searchreplace |clearButton']"
style="
/* white-space: pre-line; */
line-height: 12px;

View File

@@ -60,38 +60,46 @@
</font>
</div>
<div
id="drop-target"
@dragover="handleDragOver"
@dragenter="handleDragEnter"
@dragleave="handleDragLeave"
@drop="handleDrop"
@click="initializeEditor(item.am_id, 'table', item)"
class="thumbnailTableBox wordTableHtml table_Box pMain myeditabledivTable drop-target"
v-else-if="item.type == 2"
:main-state="item.state"
:remark="item.checks.length > 0 ? 1 : 0"
:contenteditable="!readonly && !isPreview"
:data-id="item.amt_id"
:type="item.type"
:id="'editor' + item.am_id"
:main-id="item.am_id"
>
<font class="font" :style="`width: ${item.width ? `${item.width}px` : '100%'}`">
<span v-html="item.table.title ? item.table.title : ''"></span>
</font>
id="drop-target"
@dragover="handleDragOver"
@dragenter="handleDragEnter"
@dragleave="handleDragLeave"
@drop="handleDrop"
@click="initializeEditor(item.am_id, 'table', item)"
class="thumbnailTableBox wordTableHtml table_Box pMain myeditabledivTable drop-target"
v-else-if="item.type == 2"
:main-state="item.state"
:remark="item.checks.length > 0 ? 1 : 0"
:contenteditable="!readonly && !isPreview"
:data-id="item.amt_id"
:type="item.type"
:id="'editor' + item.am_id"
:main-id="item.am_id"
>
<!-- 标题部分 -->
<font class="font" :style="`width: ${item.width ? `${item.width}px` : '100%'}`">
<span v-html="highlightText(item.table.title || '', item.checks)"></span>
</font>
<table border="1" style="width: auto; border-collapse: collapse; text-align: center">
<tr v-for="(row, i) in JSON.parse(item.table.table_data)">
<td :colspan="`${cell.colspan || 1}`" :rowspan="`${cell.rowspan || 1}`" v-for="(cell, i1) in row">
<span v-html="cell.text"></span>
</td>
</tr>
</table>
<!-- 表格部分 -->
<table border="1" style="width: auto; border-collapse: collapse; text-align: center">
<tr v-for="(row, i) in JSON.parse(item.table.table_data)" :key="i">
<td
v-for="(cell, i1) in row"
:key="i1"
:colspan="`${cell.colspan || 1}`"
:rowspan="`${cell.rowspan || 1}`">
<span v-html="highlightText(cell.text || '', item.checks)"></span>
</td>
</tr>
</table>
<!-- 备注部分 -->
<font class="font" :style="`width: ${item.width ? `${item.width}px` : '100%'}`">
<span v-html="highlightText(item.table.note || '', item.checks)"></span>
</font>
</div>
<font class="font" :style="`width: ${item.width ? `${item.width}px` : '100%'}`">
<span v-html="item.table.note ? item.table.note : ''"></span
></font>
</div>
<div
id="drop-target"
@@ -716,7 +724,7 @@ export default {
image_advtab: false, // 禁用图片高级选项卡(防止自动调整大小)
valid_elements: '*[*]',
plugins: 'forecolor code paste table image resize searchreplace dragdrop',
plugins: 'forecolor code paste table image resize dragdrop',
menubar: false,
toolbar: _this.isEditComment ? ['commentAdd |delete| level1 level2 level3|addRow|Edit'] : ['delete|addRow| Edit'],
@@ -775,7 +783,7 @@ export default {
image_advtab: false, // 禁用图片高级选项卡(防止自动调整大小)
valid_elements: '*[*]',
plugins: 'forecolor code paste table image resize searchreplace',
plugins: 'forecolor code paste table image resize ',
content_style: `${tableStyle + this.wordStyle}
@@ -860,7 +868,7 @@ export default {
table_resize_bars: true,
valid_elements: '*[*]',
image_advtab: false, // 禁用图片高级选项卡(防止自动调整大小)
plugins: 'forecolor code paste table image resize searchreplace',
plugins: 'forecolor code paste table image resize ',
content_style: `${tableStyle + this.wordStyle}
`,
@@ -1076,29 +1084,28 @@ export default {
const regExp = new RegExp(placeholder, 'gi');
tempText = tempText.replace(regExp, (match) => {
// 随机生成浅色透明背景颜色
const randomColor = this.getRandomLightColor();
const randomColor = this.getRandomLightColor();
return `
<span
class="remarkbg"
style="background-color: ${randomColor};
position: relative;
display: inline-block;
white-space: nowrap;
overflow-wrap: anywhere;
border-left: 2px solid #cd5454;
border-right: 2px solid #cd5454;"
comment-Id="${annotation.amc_id}"
>
${annotation.content}
<span class="positionRemarkIndex"
style="position: absolute; top: -14px; right: -10px; font-size: 0.8em; color: red;">
${index + 1}
</span>
</span>
`;
});
let highlightedText = `
<span class="remarkbg"
ref="remark_${annotation.amc_id}"
style="background-color: ${randomColor} !important;
position: relative !important;
border-left: 2px solid #cd5454 !important;
border-right: 2px solid #cd5454 !important;"
comment-Id="${annotation.amc_id}"
>
${annotation.content}
<span class="positionRemarkIndex"
style="position: absolute; top: -14px; right: -10px; font-size: 0.8em; color: red;">
${index + 1}
</span>
</span>
`;
return highlightedText;
});
});
// 3. 返回处理后的文本