This commit is contained in:
2025-02-19 11:38:34 +08:00
parent 7e0b342758
commit 36fe09527a
14 changed files with 167 additions and 55 deletions

View File

@@ -19,8 +19,8 @@ const service = axios.create({
// baseURL: 'https://submission.tmrjournals.com/', //正式 记得切换
// baseURL: 'http://www.tougao.com/', //测试本地 记得切换
// baseURL: 'http://192.168.110.110/tougao/public/index.php/',
baseURL: '/api', //本地
// baseURL: '/', //正式
// baseURL: '/api', //本地
baseURL: '/', //正式
});

View File

@@ -1106,6 +1106,7 @@ a {
.wordTableHtml table {
border: 0px !important;
border-bottom: 1px solid #000 !important;
border-collapse: collapse;
/* 去除单元格间隙 */
width: auto;
@@ -1125,9 +1126,10 @@ a {
padding: 5px;
text-align: left !important;
word-wrap: break-word;
word-wrap: normal;
/* 长单词自动换行 */
word-break: break-word;
word-break: normal;
font-family: 'Charis SIL' !important;
font-size: 7.5pt !important;
mso-font-kerning: 1pt !important;
@@ -1268,9 +1270,9 @@ a {
text-align: left !important;
white-space: pre-wrap;
/* 保留换行符并换行 */
word-wrap: break-word;
word-wrap: normal;
/* 长单词自动换行 */
word-break: break-word;
word-break: normal;
font-family: 'Charis SIL' !important;
font-size: 7.5pt !important;
mso-font-kerning: 1pt !important;
@@ -1292,6 +1294,7 @@ a {
border-left: 1px dashed #dcdfe6 !important;
border-right: 1px dashed #dcdfe6 !important;
word-break: keep-all !important;
white-space: pre-wrap !important;
/* text-align: justify !important; */
}

View File

@@ -28,7 +28,7 @@ export default {
var str = ''
// 获取单元格的 HTML 内容
let htmlContent = cell.innerHTML.trim();
console.log('htmlContent at line 30111:', htmlContent)
str = this.transformHtmlString(htmlContent)
// 创建一个临时的 DOM 元素来解析 HTML
@@ -49,13 +49,25 @@ export default {
str = capitalizeFirstLetter(str);
// 添加蓝色标签
const regex = /\[(\d+(?:\d+)?(?:,\d+(?:\d+)?)*)\]/g;
const regex = /\[(\d+(?:\d+)?(?:, ?\d+(?:\d+)?)*)\]/g;
str = str.replace(/<blue>/g, '').replace(/<\/blue>/g, ''); // 先去掉所有的 <blue> 标签
str = str.replace(/<blue>/g, '').replace(/<\/blue>/g, ''); // 先去掉所有的 <blue> 标签
if (regex.test(str)) {
str = str.replace(regex, function(match) {
// 提取出方括号中的内容,并进行匹配
const content = match.slice(1, match.length - 1); // 去掉方括号
// 判断是否符合条件,纯数字、逗号后有空格、连字符
if (/^\d+$/.test(content) || /, ?/.test(content) || //.test(content)) {
return `<blue>${match}</blue>`; // 如果符合条件则加上蓝色标签
}
return match; // 如果不符合条件,则保持原样
});
}
if (regex.test(str)) {
str = str.replace(regex, `<blue>$&</blue>`); // 然后再进行替换
}
// 如果没有 <span> 标签,直接返回原始 HTML 内容
return str;
@@ -284,13 +296,28 @@ if (regex.test(str)) {
// 添加蓝色标签
const regex = /\[(\d+(?:\d+)?(?:,\d+(?:\d+)?)*)\]/g;
formattedText = formattedText.replace(/<blue>/g, '').replace(/<\/blue>/g, ''); // 先去掉所有的 <blue> 标签
if (regex.test(formattedText)) {
formattedText = formattedText.replace(regex, `<blue>$&</blue>`); // 然后再进行替换
}
const regex = /\[(\d+(?:\d+)?(?:, ?\d+(?:\d+)?)*)\]/g;
formattedText = formattedText.replace(/<blue>/g, '').replace(/<\/blue>/g, ''); // 先去掉所有的 <blue> 标签
if (regex.test(formattedText)) {
formattedText = formattedText.replace(regex, function(match) {
// 提取出方括号中的内容,并进行匹配
const content = match.slice(1, match.length - 1); // 去掉方括号
// 判断是否符合条件,纯数字、逗号后有空格、连字符
if (/^\d+$/.test(content) || /, ?/.test(content) || //.test(content)) {
return `<blue>${match}</blue>`; // 如果符合条件则加上蓝色标签
}
return match; // 如果不符合条件,则保持原样
});
}
console.log("After replacement:", formattedText); // 调试:查看替换后的文本
paragraphText += formattedText;
}
@@ -339,7 +366,7 @@ if (regex.test(str)) {
}
},
transformHtmlString(inputHtml) {
console.log('inputHtml at line 332:', inputHtml)
inputHtml = inputHtml.replace(/(<[^>]+) style="[^"]*"/g, '$1'); // 移除style属性
inputHtml = inputHtml.replace(/(<[^>]+) class="[^"]*"/g, '$1'); // 移除class属性
@@ -1273,7 +1300,7 @@ if (regex.test(str)) {
emTags[i].parentNode.replaceChild(iTag, emTags[i]);
}
content = div.innerHTML;
console.log('content at line 486:', content);
vueInstance.$emit('saveContent', content, dataId);
}
}
@@ -1363,6 +1390,8 @@ if (regex.test(str)) {
}
}
});
ed.ui.registry.addButton('commentAdd', {
icon: 'comment-add',
text: 'Comment Add',
@@ -1508,6 +1537,80 @@ if (regex.test(str)) {
}
}
});
ed.ui.registry.addButton('myuppercase', {
text: 'A', // 按钮文本
onAction: function () {
// 在选中的文本周围包裹 <blue> 标签
var selectedText = ed.selection.getContent({ format: 'html' });
// 确保选中的文本是单个单词,包括空格
if (selectedText.trim() && /^[\s\w]+$/.test(selectedText)) {
// 使用正则将选中的文本中的第一个字母大写
var capitalizedText = selectedText.replace(/(^|\s)([a-zA-Z])/g, function(match, p1, p2) {
return p1 + p2.toUpperCase();
});
// 替换选中的文本,保持空格和其他内容
ed.selection.setContent(capitalizedText);
} else {
vueInstance.$message.error(vueInstance.$t('commonTable.selectWord'));
}
}
});
ed.ui.registry.addButton('myuppercase', {
text: 'A', // 按钮文本
onAction: function () {
// 在选中的文本周围包裹 <blue> 标签
var selectedText = ed.selection.getContent({ format: 'html' });
// 确保选中的文本是单个单词,包括空格
if (selectedText.trim() && /^[\s\w]+$/.test(selectedText)) {
// 使用正则将选中的文本中的第一个字母大写
var capitalizedText = selectedText.replace(/(^|\s)([a-zA-Z])/g, function(match, p1, p2) {
return p1 + p2.toUpperCase();
});
// 替换选中的文本,保持空格和其他内容
ed.selection.setContent(capitalizedText);
} else {
vueInstance.$message.error(vueInstance.$t('commonTable.selectWord'));
}
}
});
ed.ui.registry.addButton('myuppercasea', {
text: 'a', // 按钮文本(小写字母)
onAction: function () {
// 获取选中的文本,保留 HTML 格式
var selectedText = ed.selection.getContent({ format: 'html' });
// 确保选中的文本是单个有效的单词,包括空格
if (selectedText.trim() && /^[\s\w]+$/.test(selectedText)) {
// 使用正则将选中的文本中的第一个字母转换为小写
var lowercasedText = selectedText.replace(/(^|\s)([a-zA-Z])/g, function(match, p1, p2) {
return p1 + p2.toLowerCase();
});
// 替换选中的文本,保持空格和其他内容
ed.selection.setContent(lowercasedText);
} else {
vueInstance.$message.error(vueInstance.$t('commonTable.selectWord'));
}
}
});
ed.ui.registry.addButton('Line', {
text: '', // 按钮文本
onAction: function () {
// 插入 `` 符号到当前光标位置
ed.insertContent('');
}
});
ed.ui.registry.addButton('removeBlue', {
text: 'Blue', // 按钮文本
onAction: function () {

View File

@@ -380,6 +380,7 @@ const en = {
reContent:'Are you sure you want to restore this content?',
uploadImageInfo:'Figures can only upload files in JPG, JPEG, and PNG formats!',
selectComment:'Please select the text to add annotations to!',
selectWord:'Please select only a single word',
alreadyCommented:'There are already annotations in the text, please select again!'
},
pendingPayment:{

View File

@@ -373,6 +373,7 @@ const zh = {
reContent: '确定要恢复这条内容吗?',
uploadImageInfo: 'Figures 只能上传 JPG、JPEG 和 PNG 格式的文件',
selectComment: '请选择要添加批注的文本',
selectWord:'请只选中单个单词!',
alreadyCommented:'文本中已有批注内容请重新选择',
},
pendingPayment: {

View File

@@ -496,7 +496,7 @@ export default {
},
async getContent(type, content) {
console.log('content at line 498:', content)
if (type == 'content') {
content = content.replace(/<(?!\/?(img|b|i|sub|sup|span|strong|em |blue)\b)[^>]+>/g, '');
@@ -522,7 +522,7 @@ export default {
// 获取最终修改后的 HTML
content = div.innerHTML;
console.log('content at line 486:', content);
this.saveContent(content, this.currentContent.am_id);

View File

@@ -359,6 +359,7 @@ export default {
custom_colors: false,
color_map: ['0082AA', 'TMR Blue'],
plugins: 'texttransform', // 启用 forecolor 和 code 插件
// plugins: 'forecolor code paste table image mathType searchreplace raw', // 启用 forecolor 和 code 插件
end_container_on_empty_block: true,
content_css: 'default', // 加载 TinyMCE 默认样式表
@@ -516,7 +517,7 @@ export default {
var content = window.tinymce.get(this.tinymceId).getContent();
content = content.replace(/<span[^>]*>/g, '').replace(/<\/span>/g, ''); // 去除span标签
console.log('content at line 513:', content)
content = content.replace(/<strong>/g, '<b>').replace(/<\/strong>/g, '</b>');
content = content.replace(/<em>/g, '<i>').replace(/<\/em>/g, '</i>');
content = content.replace(/&nbsp;/g, ' '); // 将所有 &nbsp; 替换为空格

View File

@@ -15,7 +15,7 @@
:value="value"
:typesettingType="typesettingType"
class="paste-area text-container"
:toolbar="['bold italic|customBlue removeBlue|subscript superscript|searchreplace|clearButton']"
:toolbar="['bold italic|customBlue removeBlue|myuppercase myuppercasea Line|subscript superscript|searchreplace|clearButton']"
style="
/* white-space: pre-line; */
line-height: 12px;
@@ -80,7 +80,7 @@ export default {
this.$refs.tinymceChild1.getContent(type);
},
getContent(type, content) {
console.log('content at line 75:', content)
this.$emit('getContent', type, content);
}
}

View File

@@ -101,8 +101,8 @@ b span{
padding: 5px;
text-align:left !important;
white-space: pre-wrap; /* 保留换行符并换行 */
word-wrap: break-word; /* 长单词自动换行 */
word-break: break-word;
word-wrap: nomarl; /* 长单词自动换行 */
word-break: nomarl;
font-family:'Charis SIL' !important;
font-size: 7.5000pt !important;
mso-font-kerning: 1.0000pt !important;

View File

@@ -11,7 +11,7 @@
:value="updatedHtml"
:typesettingType="typesettingType"
class="paste-area text-container"
:toolbar="['bold italic|customBlue removeBlue|subscript superscript|table tabledelete| searchreplace |clearButton']"
:toolbar="['bold italic|customBlue removeBlue|myuppercase myuppercasea Line|subscript superscript|table tabledelete| searchreplace |clearButton']"
style="
/* white-space: pre-line; */
line-height: 12px;
@@ -102,10 +102,9 @@ export default {
methods: {
isHeaderRow(rowIndex,table) {
console.log('table at line 697:', table)
var head=table[0]
console.log('head at line 699:', head[0].rowspan)
return rowIndex < head[0].rowspan; // 假设前两行是表头
},

View File

@@ -1,9 +1,9 @@
<template>
<div class="tinymce-container editor-container word-container" :style="!isPreview ? 'padding:20px;' : 'padding:0px;'" ref="scrollDiv">
<div class="tinymce-container editor-container word-container" :style="!isPreview ? 'padding:10px 20px 10px 10px;' : 'padding:0px;'" ref="scrollDiv">
<div
style="
box-shadow: 0 2px 2px -2px rgba(34, 47, 62, 0.1), 0 8px 8px -4px rgba(34, 47, 62, 0.07);
margin: 10px 0;
margin: 0px 0;
box-sizing: border-box;
display: flex;
"
@@ -86,7 +86,7 @@
</font>
<!-- 表格部分 -->
<table border="1" style="width: auto; border-collapse: collapse; text-align: center">
<table border="1" style="width: 100%; border-collapse: collapse; text-align: center">
<tr v-for="(row, i) in JSON.parse(item.table.table_data)" :key="i" :class="{ 'table-header-row': isHeaderRow(i,item.table.table_data) }">
<td
v-for="(cell, i1) in row"
@@ -133,7 +133,7 @@
style="
width: 310px;
position: fixed;
top: 60px;
top: 70px;
box-sizing: border-box;
right: 10px;
bottom: 0;
@@ -146,7 +146,7 @@
v-for="(item, index) in commentList"
class="comment-item annotation"
:data-target="`main-${item.am_id}`"
style="width: 100%; margin: 10px 0; background: #fafafa; box-sizing: border-box"
style="width: 100%; margin:0 0 10px; background: #fafafa; box-sizing: border-box"
>
<div>
<div style="display: flex; align-items: center; justify-content: space-between; background-color: #f3d5d5c2">
@@ -163,8 +163,8 @@
</div>
<div
style="
margin-bottom: 10px;
padding: 10px 10px;
padding:6px 6px;
box-sizing: border-box;
border-bottom: 1px solid rgba(243, 213, 213);
"
@@ -173,10 +173,10 @@
@click="highlightLeftComment(commont.amc_id, item.am_id)"
>
<div style="width: 100%; display: flex; align-items: center; justify-content: space-between">
<div style="display: flex; align-items: center">
<div style="display: flex; align-items: center;line-height: 20px;">
<span
:style="commont.estate == 1 ? 'opacity:0.6;color:rgb(19, 188, 32);' : ''"
style="color: #e61a12; font-weight: bold"
style="color: #e61a12; font-weight: bold;font-size: 12px;"
>{{ commentIndex + 1 }}</span
>
<span
@@ -195,7 +195,7 @@
$t('commonTable.Resolved')
}}</span>
</div>
<div style="display: flex; align-items: center; justify-content: center">
<div style="display: flex; align-items: center; justify-content: center;line-height: 20px;">
<span style="color: #b8b7b7; font-size: 12px">{{ getTime(commont.ctime) }}</span
><span
style="color: #aaa; font-size: 13px; margin: 0 4px"
@@ -302,7 +302,7 @@
"
>
<i class="el-icon-user-solid" style="color: #333; padding: 0 4px"></i>
<div v-html="commont.author_remark" style="width: calc(100% - 20px); font-size: 14px"></div>
<div v-html="commont.author_remark" style="width: calc(100% - 20px); font-size: 13px;line-height: 14px;"></div>
</div>
<i
class="el-icon-edit"
@@ -382,8 +382,8 @@ b span{
padding: 5px;
text-align: !important;
white-space: pre-wrap; /* 保留换行符并换行 */
word-wrap: break-word; /* 长单词自动换行 */
word-break: break-word;
word-wrap: nomarl; /* 长单词自动换行 */
word-break: nomarl;
font-family:'Charis SIL' !important;
font-size: 7.5000pt !important;
mso-font-kerning: 1.0000pt !important;
@@ -623,7 +623,7 @@ export default {
this.editors = {};
},
beforeDestroy() {
console.log('at line 523:', '是否走了销毁');
for (const key in this.editors) {
if (this.editors[key]) {
@@ -693,9 +693,9 @@ export default {
isHeaderRow(rowIndex,table) {
var table=JSON.parse(table)
console.log('table at line 697:', table)
var head=table[0]
console.log('head at line 699:', head[0].rowspan)
return rowIndex < head[0].rowspan; // 假设前两行是表头
},
@@ -1134,7 +1134,7 @@ export default {
});
});
if (type == 0 && tempText == '') {
console.log('tempText at line 1122:', tempText);
tempText =
tempText +
`<img contenteditable="${false}" src="${this.imagePath}" alt="" style="width: 20px;height: 20px;opacity:0.6;">`;
@@ -1925,10 +1925,11 @@ export default {
/* color: #000; */
color: #fff;
box-sizing: border-box;
padding: 2px 4px;
padding: 1px 2px;
border-radius: 2px;
font-size: 12px;
font-size: 11px;
font-weight: 400;
line-height: 14px;
}
.MaxPicture img {
width: 580px !important;

View File

@@ -325,7 +325,7 @@ export default {
this.filterData();
},
filterData(type) {
console.log('type at line 374:', type);
if (type) {
if (type == 'img') {
this.imagesList = [...this.images];
@@ -542,7 +542,7 @@ export default {
this.$commonJS.createImageModal(index, modalContent, 'table', '');
});
}
console.log('this.tables at line 533:', this.tables);
});
}
},
@@ -582,6 +582,7 @@ export default {
::v-deep .wordTableHtml table {
cursor: pointer;
background-color: #fff !important;
border-bottom: 1px solid #000 !important;
}
.el-menu-vertical-demo {
width: 85px;

View File

@@ -631,7 +631,7 @@ export default {
})
.then((res) => {
this.comments = res.data.list;
console.log('this.comments at line 537:', this.comments);
});
},
addImage() {
@@ -663,7 +663,7 @@ export default {
this.filterData();
},
filterData(type) {
console.log('type at line 374:', type);
if (type) {
if (type == 'img') {
this.imagesList = [...this.images];
@@ -866,7 +866,7 @@ export default {
this.$commonJS.createImageModal(index, modalContent, 'table', '');
});
}
console.log('this.tables at line 533:', this.tables);
});
}
},
@@ -908,6 +908,7 @@ export default {
::v-deep .wordTableHtml table {
cursor: pointer;
background-color: #fff !important;
border-bottom: 1px solid #000 !important;
}
.el-menu-vertical-demo {
width: 85px;

View File

@@ -313,5 +313,6 @@ export default {
::v-deep .wordTableHtml table {
cursor: pointer;
background-color: #fff !important;
border-bottom: 1px solid #000 !important;
}
</style>