diff --git a/src/api/index.js b/src/api/index.js index 170e883..0b11630 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -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: '/', //正式 }); diff --git a/src/assets/css/main.css b/src/assets/css/main.css index e034263..7a52444 100644 --- a/src/assets/css/main.css +++ b/src/assets/css/main.css @@ -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; */ } diff --git a/src/common/js/commonJS.js b/src/common/js/commonJS.js index 570bffd..6ff51a2 100644 --- a/src/common/js/commonJS.js +++ b/src/common/js/commonJS.js @@ -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(//g, '').replace(/<\/blue>/g, ''); // 先去掉所有的 标签 + str = str.replace(//g, '').replace(/<\/blue>/g, ''); // 先去掉所有的 标签 + + 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 `${match}`; // 如果符合条件则加上蓝色标签 + } + return match; // 如果不符合条件,则保持原样 + }); + } + + -if (regex.test(str)) { - str = str.replace(regex, `$&`); // 然后再进行替换 -} // 如果没有 标签,直接返回原始 HTML 内容 return str; @@ -284,13 +296,28 @@ if (regex.test(str)) { // 添加蓝色标签 - const regex = /\[(\d+(?:–\d+)?(?:,\d+(?:–\d+)?)*)\]/g; + - formattedText = formattedText.replace(//g, '').replace(/<\/blue>/g, ''); // 先去掉所有的 标签 - - if (regex.test(formattedText)) { - formattedText = formattedText.replace(regex, `$&`); // 然后再进行替换 - } + const regex = /\[(\d+(?:–\d+)?(?:, ?\d+(?:–\d+)?)*)\]/g; + + formattedText = formattedText.replace(//g, '').replace(/<\/blue>/g, ''); // 先去掉所有的 标签 + + 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 `${match}`; // 如果符合条件则加上蓝色标签 + } + 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 () { + // 在选中的文本周围包裹 标签 + 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 () { + // 在选中的文本周围包裹 标签 + 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 () { diff --git a/src/components/common/langs/en.js b/src/components/common/langs/en.js index b77b830..4fa2d20 100644 --- a/src/components/common/langs/en.js +++ b/src/components/common/langs/en.js @@ -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:{ diff --git a/src/components/common/langs/zh.js b/src/components/common/langs/zh.js index 0a058d2..75c0541 100644 --- a/src/components/common/langs/zh.js +++ b/src/components/common/langs/zh.js @@ -373,6 +373,7 @@ const zh = { reContent: '确定要恢复这条内容吗?', uploadImageInfo: 'Figures 只能上传 JPG、JPEG 和 PNG 格式的文件', selectComment: '请选择要添加批注的文本', + selectWord:'请只选中单个单词!', alreadyCommented:'文本中已有批注内容请重新选择', }, pendingPayment: { diff --git a/src/components/page/GenerateCharts.vue b/src/components/page/GenerateCharts.vue index 5f445c6..1f2f230 100644 --- a/src/components/page/GenerateCharts.vue +++ b/src/components/page/GenerateCharts.vue @@ -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); diff --git a/src/components/page/components/Tinymce/index.vue b/src/components/page/components/Tinymce/index.vue index e98bf6b..230150e 100644 --- a/src/components/page/components/Tinymce/index.vue +++ b/src/components/page/components/Tinymce/index.vue @@ -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(/]*>/g, '').replace(/<\/span>/g, ''); // 去除span标签 - console.log('content at line 513:', content) + content = content.replace(//g, '').replace(/<\/strong>/g, ''); content = content.replace(//g, '').replace(/<\/em>/g, ''); content = content.replace(/ /g, ' '); // 将所有   替换为空格 diff --git a/src/components/page/components/table/content.vue b/src/components/page/components/table/content.vue index d76efa1..c1b13aa 100644 --- a/src/components/page/components/table/content.vue +++ b/src/components/page/components/table/content.vue @@ -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); } } diff --git a/src/components/page/components/table/editTable.vue b/src/components/page/components/table/editTable.vue index a7e23af..3dfb656 100644 --- a/src/components/page/components/table/editTable.vue +++ b/src/components/page/components/table/editTable.vue @@ -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; diff --git a/src/components/page/components/table/table.vue b/src/components/page/components/table/table.vue index 58252b2..7f58bab 100644 --- a/src/components/page/components/table/table.vue +++ b/src/components/page/components/table/table.vue @@ -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; // 假设前两行是表头 }, diff --git a/src/components/page/components/table/word.vue b/src/components/page/components/table/word.vue index 4bf8a49..ec645cf 100644 --- a/src/components/page/components/table/word.vue +++ b/src/components/page/components/table/word.vue @@ -1,9 +1,9 @@