1、English name这块,除了中文,数字不能用,其他都可以

2、blue空格
This commit is contained in:
2026-02-13 11:44:31 +08:00
parent 10348d1e75
commit a2497a8885
11 changed files with 68 additions and 72 deletions

View File

@@ -219,9 +219,15 @@ export default {
}
// 获取单元格的 HTML 内容
let htmlContent = cell.trim();
// 在第 21 行之后添加
let processedContent = htmlContent.replace(/(<\/p>)\s*(?=<p)/gi, '$1<br>');
str = this.transformHtmlString(htmlContent, 'table')
str = this.transformHtmlString(processedContent, 'table',{ keepBr: true })
console.log("🚀 ~ extractContentWithoutOuterSpan888888 ~ str:", str);
// 创建一个临时的 DOM 元素来解析 HTML
const div = document.createElement('div');
@@ -971,10 +977,14 @@ str = str.replace(regex, function (match, content, offset, fullString) {
async parseTableToArray(tableString, callback) {
const parser = new DOMParser();
const doc = parser.parseFromString(tableString, 'text/html');
const rows = doc.querySelectorAll('table tr'); // 获取所有的行(<tr>
// 使用 Promise 来处理异步的 MathJax 解析
const result = await Promise.all(
@@ -982,6 +992,8 @@ str = str.replace(regex, function (match, content, offset, fullString) {
const cells = row.querySelectorAll('th, td'); // 获取每个行中的单元格(包括 <th> 和 <td>
return await Promise.all(
Array.from(cells).map(async (cell) => {
console.log("🚀 ~ parseTableToArray777 ~ cell:", cell);
const text = await this.extractMathJaxLatex(cell);
return {
text,
@@ -2125,14 +2137,18 @@ str = str.replace(regex, function (match, content, offset, fullString) {
text: 'Blue',
className: 'custom-button-blue',
onAction: function () {
// 必须获取带 HTML 的内容,否则里面的 em/i 标签在拼接前就丢了
// 获取选中的 HTML
var selectedText = ed.selection.getContent({ format: 'html' });
if (selectedText) {
// 这就是你想要的:直接外层套一个 blue
var wrappedText = `<blue>${selectedText}</blue>`;
// 使用 setContent 强行回写
if (selectedText && selectedText.trim().length > 0) {
var processedText = selectedText.replace(/ /g, '&nbsp;');
var wrappedText = `<blue>${processedText}</blue>`;
// 使用 setContent 插入
ed.selection.setContent(wrappedText);
}
}

View File

@@ -2,14 +2,14 @@
//记得切换
//正式
// const mediaUrl = '/public/';
// const baseUrl = '/';
const mediaUrl = '/public/';
const baseUrl = '/';
//正式环境
const mediaUrl = 'https://submission.tmrjournals.com/public/';
// const mediaUrl = 'http://zmzm.tougao.dev.com/public/';
const baseUrl = '/api'
// const mediaUrl = 'https://submission.tmrjournals.com/public/';
// // const mediaUrl = 'http://zmzm.tougao.dev.com/public/';
// const baseUrl = '/api'
//测试环境

View File

@@ -1974,6 +1974,7 @@ export default {
});
},
async saveTable(content) {
const cleanTableData = (tableList) => {
if (tableList.length == 0) {
return [];
@@ -1981,7 +1982,8 @@ export default {
// 定义清理函数:去掉所有 br 标签和 TinyMCE 占位符
const cleanText = (text) => {
if (!text) return "";
return text.replace(/<br\s*\/?>/gi, '').trim();
// return text.replace(/<br\s*\/?>/gi, '').trim();
return text
};
// 1. 获取处理后的干净表头

View File

@@ -3135,12 +3135,10 @@ export default {
} else {
var date1 = new Date(parseInt(date * 1000));
var date2 = new Date().getTime();
console.log('date2 at line 1564:', date2);
// 计算时间差(以毫秒为单位)
var timeDiff = Number(date2 - date1);
console.log('timeDiff at line 1569:', timeDiff);
// 将半年转换为毫秒
var halfYearInMilliseconds = 1000 * 60 * 60 * 24 * 182.5; // 假设一年有 365 天
@@ -3152,7 +3150,7 @@ export default {
}
return status;
console.log('status at line 1578:', status);
},
changeSelectTabs(e) {
console.log('e at line 1536:', e);

View File

@@ -2209,11 +2209,10 @@ export default {
} else {
var date1 = new Date(parseInt(date * 1000));
var date2 = new Date().getTime();
console.log('date2 at line 1564:', date2);
// 计算时间差(以毫秒为单位)
var timeDiff = Number(date2 - date1);
console.log('timeDiff at line 1569:', timeDiff);
// 将半年转换为毫秒
var halfYearInMilliseconds = 1000 * 60 * 60 * 24 * 182.5; // 假设一年有 365 天

View File

@@ -473,18 +473,16 @@ export default {
const cells = doc.querySelectorAll('td, th');
cells.forEach((cell) => {
// 1. 先把单元格内的非法 < 转义
let cellText = cell.innerHTML;
// let cellText = escapeIllegalLT(cell.innerHTML);
// 2. 再清理空标签和多余空格
cell.innerHTML = cellText
.replace(cleanEmptyTags, '')
.replace(replaceSpaces, '&nbsp;');
});
processedHtml = doc.body.innerHTML;
} else {
// 非表格逻辑也同样处理转义
// processedHtml = escapeIllegalLT(rawValue)
processedHtml = rawValue
.replace(cleanEmptyTags, '')
.replace(replaceSpaces, '&nbsp;');
@@ -817,13 +815,7 @@ export default {
if (tempDiv.querySelector('table')) {
if (_this.type == 'table') {
// 3. 在这里直接消费外部变量 currentPasteBase64Images
// content = content.replace(new RegExp(`src="${silentPlaceholder}"`, 'gi'), () => {
// // 按顺序取图
// const base64Data = currentPasteBase64Images[globalImgCounter] || '';
// globalImgCounter++;
// return `src="${base64Data}"`;
// });
_this.$commonJS.parseTableToArray(content, (tableList) => {
var contentHtml = `
<div class="thumbnailTableBox wordTableHtml table_Box table_Box3333" style="">
@@ -835,10 +827,10 @@ export default {
${row
.map((cell) => {
return `
<td colspan="${cell.colspan || 1}" rowspan="${cell.rowspan || 1}">
<span>${cell.text || ''}</span>
</td>
`;
<td colspan="${cell.colspan || 1}" rowspan="${cell.rowspan || 1}">
<span>${cell.text || ''}</span>
</td>
`;
})
.join('')}
</tr>
@@ -851,21 +843,9 @@ export default {
const container = document.createElement('div');
container.innerHTML = contentHtml;
// _this.updateTableStyles(container); // 根据需要应用额外的样式
args.content = container.innerHTML; // 更新处理后的内容
});
} else {
// _this.$confirm('检测到粘贴内容包含表格,是否需要以表格形式添加?', '提示', {
// confirmButtonText: '添加表格',
// cancelButtonText: '纯文本添加',
// type: 'info'
// }).then(() => {
// _this.$emit('openAddTable', content);
// return false
// }).catch(() => {
// });
}
}
} else {
const mathRegex = /\$\$([\s\S]+?)\$\$|\$([\s\S]+?)\$/g;
content = content.replace(mathRegex, function (match, blockFormula, inlineFormula) {

View File

@@ -989,9 +989,9 @@ export default {
}
if (this.$validateString(data.realname)) {
console.log('Input string is valid.');
} else {
console.log('Input string is invalid.');
this.$message.error(this.$t('info.realname'));
return false;
}

View File

@@ -70,14 +70,11 @@ export default {
this.tableData.forEach((row, i) => {
modalContent += `<tr class="${this.isHeaderRow(i, this.tableData) ? 'table-header-row' : ''}">`;
row.forEach((cell) => {
modalContent += `
<td
modalContent += `<td
colspan="${cell.colspan || 1}"
rowspan="${cell.rowspan || 1}"
style=""
>
<span>${cell.text}</span>
</td>`;
><span>${cell.text}</span></td>`;
});
modalContent += `</tr>`;
});

View File

@@ -394,9 +394,9 @@
if (this.$validateString(this.addForm.realname)) {
console.log('Input string is valid.');
} else {
console.log('Input string is invalid.');
this.$message.error(this.$t('info.realname'))
return false
}

View File

@@ -1608,7 +1608,7 @@ export default {
this.userMessage.majorStr = res.data.baseInfo.majorStr;
this.cvitaForm.user_id = res.data.baseInfo.user_id;
this.userMessage.website = res.data.baseInfo.website;
console.log('res.data.baseInfo.majors.map at line 16124:', res.data.baseInfo.majors)
this.userMessage.majors=res.data.baseInfo.majors
this.majorValueList = res.data.baseInfo.majors.map((item) => ({
@@ -1617,7 +1617,7 @@ export default {
: typeof item.shu === 'string'
? item.shu.split(',').map(Number)
: [item.shu]
}));console.log('this.majorValueList at line 1612:', this.majorValueList)
}));
this.$forceUpdate()
this.coreTable = res.data.baseInfo;
this.cvitaTable = res.data.cvs;
@@ -1746,9 +1746,9 @@ export default {
// 保存个人信息
saveMessage() {
if (this.$validateString(this.MessForm.realname)) {
console.log('Input string is valid.');
} else {
console.log('Input string is invalid.');
this.$message.error(this.$t('info.realname'));
return false;
}
@@ -1818,13 +1818,13 @@ export default {
},
isEditIndex(data) {
console.log('data at line 1543:', this.userMessage);
var status;
var date = '';
switch (data) {
case 'wos':
date = this.userMessage.wos_time;
console.log('date at line 1714:', date);
break;
case 'scopus':
date = this.userMessage.scopus_time;
@@ -1833,17 +1833,16 @@ export default {
date = this.userMessage.google_time;
break;
}
console.log('date at line 1714:', date);
if (date == 0) {
status = true;
} else {
var date1 = new Date(parseInt(date * 1000));
var date2 = new Date().getTime();
console.log('date2 at line 1564:', date2);
// 计算时间差(以毫秒为单位)
var timeDiff = Number(date2 - date1);
console.log('timeDiff at line 1569:', timeDiff);
// 将半年转换为毫秒
var halfYearInMilliseconds = 1000 * 60 * 60 * 24 * 182.5; // 假设一年有 365 天
@@ -1854,7 +1853,7 @@ export default {
status = true;
}
}
console.log('status at line 1578:', status);
return status;
},
// 个人指数修改

View File

@@ -18,8 +18,13 @@ import store from './store' // 引入 store
Vue.prototype.$bus = new Vue();
// Vue.prototype.$validateString = function (str) {
// return /^[a-zA-Z\s\u00C0-\u00FF\u0100-\u017F-]+$/.test(str);
// }
//除了中文,数字不能用,其他都可以
Vue.prototype.$validateString = function (str) {
return /^[a-zA-Z\s\u00C0-\u00FF\u0100-\u017F-]+$/.test(str);
// 匹配规则:不包含数字 (0-9) 且 不包含中文字符 (\u4e00-\u9fa5)
return !/[0-9\u4e00-\u9fa5]/.test(str);
}
window.MathJax = {
tex: {