tijiao
This commit is contained in:
@@ -3,7 +3,14 @@
|
||||
registry: 'https://registry.npmmirror.com',
|
||||
pkgs: [
|
||||
{
|
||||
name: 'spellchecker',
|
||||
name: 'tinymce',
|
||||
version: 'latest',
|
||||
type: 'tag',
|
||||
alias: undefined,
|
||||
arg: [Result]
|
||||
},
|
||||
{
|
||||
name: 'tinymce-kityformula-editor',
|
||||
version: 'latest',
|
||||
type: 'tag',
|
||||
alias: undefined,
|
||||
@@ -15,7 +22,7 @@
|
||||
cacheDir: 'C:\\Users\\Administrator\\.npminstall_tarball',
|
||||
env: {
|
||||
npm_config_registry: 'https://registry.npmmirror.com',
|
||||
npm_config_argv: '{"remain":[],"cooked":["--fix-bug-versions","--china","--userconfig=C:\\\\Users\\\\Administrator\\\\.cnpmrc","--disturl=https://cdn.npmmirror.com/binaries/node","--registry=https://registry.npmmirror.com","spellchecker"],"original":["--fix-bug-versions","--china","--userconfig=C:\\\\Users\\\\Administrator\\\\.cnpmrc","--disturl=https://cdn.npmmirror.com/binaries/node","--registry=https://registry.npmmirror.com","spellchecker"]}',
|
||||
npm_config_argv: '{"remain":[],"cooked":["--fix-bug-versions","--china","--userconfig=C:\\\\Users\\\\Administrator\\\\.cnpmrc","--disturl=https://cdn.npmmirror.com/binaries/node","--registry=https://registry.npmmirror.com","tinymce","tinymce-kityformula-editor"],"original":["--fix-bug-versions","--china","--userconfig=C:\\\\Users\\\\Administrator\\\\.cnpmrc","--disturl=https://cdn.npmmirror.com/binaries/node","--registry=https://registry.npmmirror.com","tinymce","tinymce-kityformula-editor"]}',
|
||||
npm_config_user_agent: 'npminstall/7.12.0 npm/? node/v16.14.1 win32 x64',
|
||||
npm_config_cache: 'C:\\Users\\Administrator\\.npminstall_tarball',
|
||||
NODE: 'C:\\Program Files\\nodejs\\node.exe',
|
||||
@@ -119,7 +126,10 @@
|
||||
},
|
||||
fsevents: { host: 'https://cdn.npmmirror.com/binaries/fsevents' },
|
||||
nodejieba: { host: 'https://cdn.npmmirror.com/binaries/nodejieba' },
|
||||
canvas: { host: 'https://cdn.npmmirror.com/binaries/canvas' },
|
||||
canvas: {
|
||||
host: 'https://cdn.npmmirror.com/binaries/canvas',
|
||||
remote_path: 'v{version}'
|
||||
},
|
||||
'skia-canvas': { host: 'https://cdn.npmmirror.com/binaries/skia-canvas' },
|
||||
'flow-bin': {
|
||||
replaceHost: 'https://github.com/facebook/flow/releases/download/v',
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
"html2canvas": "^1.4.1",
|
||||
"install": "^0.13.0",
|
||||
"jszip": "^3.10.1",
|
||||
"katex": "^0.16.21",
|
||||
"mammoth": "^1.5.1",
|
||||
"mathlive": "^0.104.0",
|
||||
"mavon-editor": "^2.6.17",
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body><script src="<%=BASE_URL %>/tinymce/tinymce.min.js"></script>
|
||||
|
||||
<script async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
||||
<script src="/js/global-math.js"></script>
|
||||
<script src="https://www.paypal.com/sdk/js?client-id=ATqBigrhcNdqR8J83aDjTOoJHsAVz0U45JRY4H0stcEcv0mQrMDHQmyrydQInYd1w4lJ1ee3Wsblm2WP"></script>
|
||||
|
||||
</html>
|
||||
|
||||
110
public/js/global-math.js
Normal file
110
public/js/global-math.js
Normal file
@@ -0,0 +1,110 @@
|
||||
// 确保 MathJax 配置正确
|
||||
window.MathJax = window.MathJax || {
|
||||
loader: {
|
||||
load: ['[tex]/ams', '[tex]/newcommand']
|
||||
},
|
||||
tex: {
|
||||
inlineMath: [['$', '$'], ['\\(', '\\)']],
|
||||
displayMath: [['$$', '$$'], ['\\[', '\\]']]
|
||||
},
|
||||
a11y: {
|
||||
// 启用 MathJax 可访问性功能,确保使用 aria-label
|
||||
texHints: true,
|
||||
screenReader: true,
|
||||
mathml: {
|
||||
enable: true,
|
||||
},
|
||||
label: {
|
||||
// 公式的 aria-label 配置
|
||||
enable: true,
|
||||
texClass: 'MathJax-Label',
|
||||
form: 'LaTeX'
|
||||
}
|
||||
},
|
||||
svg: { fontCache: 'global' }
|
||||
};
|
||||
|
||||
// **定义全局渲染方法**
|
||||
window.renderMathJax = function (tinymceId) {
|
||||
// if (window.MathJax && typeof window.MathJax.typesetPromise === "function") {
|
||||
// console.log("正在渲染 MathJax 公式...");
|
||||
|
||||
// // 如果提供了 TinyMCE 编辑器 ID
|
||||
// if (tinymceId) {
|
||||
// const editorInstance = window.tinymce.get(tinymceId); // 根据 ID 获取编辑器实例
|
||||
// if (!editorInstance) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // 获取指定的 TinyMCE 编辑器中的内容
|
||||
// const editorBody = editorInstance.getBody();
|
||||
|
||||
// // 渲染 editorBody 中所有 <wmath> 标签,并使用 data-latex 的值
|
||||
// const wmathElements = editorBody.querySelectorAll('wmath');
|
||||
// wmathElements.forEach((element) => {
|
||||
// // 检查 <wmath> 标签是否包含有效的 data-latex 属性值
|
||||
// const latexContent = element.getAttribute('data-latex');
|
||||
// if (latexContent) {
|
||||
// // 将元素的内部内容替换为 data-latex 的值
|
||||
// element.innerHTML = latexContent;
|
||||
|
||||
// // 渲染 MathJax 公式
|
||||
// window.MathJax.typesetPromise([element]).catch((err) => {
|
||||
// console.warn("TinyMCE MathJax 渲染失败:", err);
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
|
||||
// // 渲染 editorBody 中所有 <math> 标签(MathML 内容)
|
||||
// const mathElements = editorBody.querySelectorAll('math');
|
||||
// mathElements.forEach((element) => {
|
||||
// // 渲染 MathJax 公式
|
||||
// window.MathJax.typesetPromise([element]).catch((err) => {
|
||||
// console.warn("MathJax 渲染失败:", err);
|
||||
// });
|
||||
// });
|
||||
|
||||
// } else {
|
||||
// // 处理全局文档中的 <wmath> 标签
|
||||
// const wmathElements = document.querySelectorAll('wmath');
|
||||
// wmathElements.forEach((element) => {
|
||||
// // 检查 <wmath> 标签是否包含有效的 data-latex 属性值
|
||||
// const latexContent = element.getAttribute('data-latex');
|
||||
// if (latexContent) {
|
||||
// // 将元素的内部内容替换为 data-latex 的值
|
||||
// element.innerHTML = latexContent;
|
||||
|
||||
// // 渲染 MathJax 公式
|
||||
// window.MathJax.typesetPromise([element]).catch((err) => {
|
||||
// console.warn("MathJax 渲染失败:", err);
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
|
||||
// // 处理全局文档中的 <math> 标签(MathML 内容)
|
||||
// const mathElements = document.querySelectorAll('math');
|
||||
// mathElements.forEach((element) => {
|
||||
// // 渲染 MathJax 公式
|
||||
// window.MathJax.typesetPromise([element]).catch((err) => {
|
||||
// console.warn("MathJax 渲染失败:", err);
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
|
||||
// } else {
|
||||
// console.warn("MathJax 未正确加载!");
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1258,7 +1258,7 @@ a {
|
||||
/* 自动调整列宽 */
|
||||
text-align: left;
|
||||
font-family: 'Charis SIL' !important;
|
||||
font-size: 12px !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -1274,7 +1274,7 @@ a {
|
||||
/* 长单词自动换行 */
|
||||
word-break: normal;
|
||||
font-family: 'Charis SIL' !important;
|
||||
font-size: 12px !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -1303,7 +1303,7 @@ a {
|
||||
|
||||
margin: 0;
|
||||
font-family: 'Charis SIL' !important;
|
||||
font-size: 12px !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -1313,7 +1313,7 @@ a {
|
||||
color: #000000;
|
||||
text-align: left !important;
|
||||
font-family: 'Charis SIL' !important;
|
||||
font-size: 12px !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -1322,7 +1322,7 @@ a {
|
||||
.word-container table .color-highlight {
|
||||
color: rgb(0, 130, 170) !important;
|
||||
font-family: 'Charis SIL' !important;
|
||||
font-size: 12px !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -1433,4 +1433,12 @@ a {
|
||||
/* 设置字体颜色 */
|
||||
text-decoration: line-through !important;
|
||||
/* 设置字体颜色 */
|
||||
}
|
||||
}
|
||||
mjx-container {
|
||||
font-size: 14px !important;
|
||||
}
|
||||
wmath{
|
||||
width: 100%;
|
||||
display: block;display: flex;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Vue from 'vue';
|
||||
import katex from 'katex';
|
||||
import JSZip from 'jszip';
|
||||
import Common from '@/components/common/common'
|
||||
import Tiff from 'tiff.js';
|
||||
@@ -18,6 +19,90 @@ const capitalizeFirstLetter = function (text) {
|
||||
});
|
||||
};
|
||||
export default {
|
||||
extractLatexFromMathJax() {
|
||||
// 获取所有 MathJax 渲染的公式容器
|
||||
const mathContainers = document.querySelectorAll('mjx-container');
|
||||
|
||||
mathContainers.forEach(container => {
|
||||
// 查找每个渲染公式对应的 MathML 部分
|
||||
const mathElement = container.querySelector('mjx-math');
|
||||
console.log('mathElement at line 28:', mathElement)
|
||||
|
||||
if (mathElement) {
|
||||
// 获取 MathJax 渲染的公式对象
|
||||
const jax = window.MathJax.getJaxFor(mathElement);
|
||||
console.log('jax at line 32:', jax)
|
||||
|
||||
if (jax) {
|
||||
// 使用 MathJax API 获取公式的 LaTeX 代码
|
||||
const latex = jax.getLiteral(); // 获取 LaTeX 表达式
|
||||
console.log('提取到的 LaTeX 公式:', latex); // 输出 LaTeX 代码
|
||||
} else {
|
||||
console.warn('MathJax 对象未找到');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
replaceWMathContent(inputHtml, callback) {
|
||||
// 使用正则表达式查找所有 <wmath> 标签,并提取 data-latex 的内容
|
||||
var str = inputHtml.replace(/<wmath data-latex="([^"]+)">[^<]*<\/wmath>/g, function(match, latexContent) {
|
||||
// 返回 <wmath> 标签,内容替换为 data-latex 的值
|
||||
return `<wmath data-latex="${latexContent}">${latexContent}</wmath>`;
|
||||
});
|
||||
|
||||
// 调用回调函数并传递处理后的结果
|
||||
callback(str);
|
||||
|
||||
// 输出结果到控制台
|
||||
console.log('Processed HTML:', str);
|
||||
}
|
||||
|
||||
|
||||
,
|
||||
// **解析 MathJax 公式,获取 LaTeX**
|
||||
async extractMathJaxLatex(cell, callback) {
|
||||
console.log('cell at line 67:', cell)
|
||||
return new Promise((resolve, reject) => {
|
||||
// Step 1: First, process the math content and extract LaTeX from <wmath> tags
|
||||
let updatedContent = cell.innerHTML; // Start with the cell's inner HTML
|
||||
console.log('cell content at the start:', updatedContent);
|
||||
|
||||
// Find all <wmath> elements
|
||||
const wmathElements = cell.querySelectorAll('wmath');
|
||||
wmathElements.forEach((element) => {
|
||||
// Get the LaTeX content from the data-latex attribute
|
||||
const latexContent = element.getAttribute('data-latex');
|
||||
console.log('LaTeX content from data-latex:', latexContent);
|
||||
|
||||
// Replace the <wmath> tag with its LaTeX content wrapped in $$...$$
|
||||
updatedContent = updatedContent.replace(element.outerHTML, `<wmath data-latex="${latexContent}">${latexContent}</wmath>`);
|
||||
});
|
||||
|
||||
console.log('updatedContent after processing wmath tags:', updatedContent);
|
||||
|
||||
// Step 2: Now extract content without the outer <span> tags
|
||||
updatedContent = this.extractContentWithoutOuterSpan(updatedContent);
|
||||
console.log('updatedContent after extractContentWithoutOuterSpan:', updatedContent);
|
||||
|
||||
// Step 3: Call the callback function with the final updated content
|
||||
// callback(updatedContent);
|
||||
|
||||
// Resolve the promise with the final content
|
||||
resolve(updatedContent);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
,
|
||||
renderLatex(latexString) {
|
||||
return katex.renderToString(latexString, {
|
||||
throwOnError: false
|
||||
});
|
||||
},
|
||||
decodeHtml(html) {
|
||||
var txt = document.createElement('textarea');
|
||||
txt.innerHTML = html;
|
||||
@@ -25,9 +110,15 @@ export default {
|
||||
},
|
||||
//去掉最外层自定义的span标签
|
||||
extractContentWithoutOuterSpan(cell) {
|
||||
console.log('cell at line 90:', cell)
|
||||
var str = ''
|
||||
if(!cell){
|
||||
return ''
|
||||
}
|
||||
// 获取单元格的 HTML 内容
|
||||
let htmlContent = cell.innerHTML.trim();
|
||||
let htmlContent = cell.trim();
|
||||
|
||||
console.log('htmlContent at line 94:', htmlContent)
|
||||
|
||||
str = this.transformHtmlString(htmlContent)
|
||||
|
||||
@@ -68,9 +159,10 @@ export default {
|
||||
|
||||
|
||||
|
||||
|
||||
console.log('str at line 141:', str)
|
||||
// 如果没有 <span> 标签,直接返回原始 HTML 内容
|
||||
return str;
|
||||
|
||||
},
|
||||
async extractPastedWordTablesToArrays(pastedHtml, callback) {
|
||||
try {
|
||||
@@ -236,31 +328,31 @@ export default {
|
||||
rowspan = 1; // 初始化 rowspan
|
||||
let nextRowIdx = rowIndex + 1;
|
||||
let maxRowspan = rows.length - rowIndex; // 确保 rowspan 不会超过剩余行数
|
||||
|
||||
|
||||
while (nextRowIdx < rows.length) {
|
||||
const nextRowCells = rows[nextRowIdx].getElementsByTagNameNS(namespace, "tc");
|
||||
// console.log(`🔍 检查下一行单元格 at row ${nextRowIdx}, col ${cellIndex}:`, nextRowCells);
|
||||
|
||||
|
||||
if (nextRowCells.length > cellIndex) {
|
||||
const nextCell = nextRowCells[cellIndex];
|
||||
|
||||
|
||||
if (!nextCell) {
|
||||
// console.warn(`⚠️ nextCell 未定义 at row ${nextRowIdx}, col ${cellIndex}`);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
const nextVMerge = nextCell.getElementsByTagNameNS(namespace, "vMerge")[0];
|
||||
// console.log(`🔍 检查 nextVMerge at row ${nextRowIdx}, col ${cellIndex}:`, nextVMerge);
|
||||
|
||||
|
||||
// **如果 nextVMerge 为空,则不应继续增长 rowspan**
|
||||
if (!nextVMerge) {
|
||||
// console.log(`⚠️ nextVMerge 为空 at row ${nextRowIdx}, col ${cellIndex} - 停止扩展`);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// **解析 nextVMerge 的值**
|
||||
const vMergeVal = nextVMerge.getAttribute("w:val");
|
||||
|
||||
|
||||
if (!vMergeVal || vMergeVal === "continue") {
|
||||
if (rowspan < maxRowspan) { // 限制 rowspan 最大值
|
||||
rowspan++;
|
||||
@@ -286,7 +378,7 @@ export default {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
console.log('rowspan at line 265:', rowspan)
|
||||
const currentLevelNumbers = {};
|
||||
for (const paragraph of paragraphs) {
|
||||
@@ -621,11 +713,23 @@ export default {
|
||||
|
||||
// inputHtml = inputHtml.replace(/(<[^>]+) style="[^"]*"/g, '$1'); // 移除style属性
|
||||
// inputHtml = inputHtml.replace(/(<[^>]+) class="[^"]*"/g, '$1'); // 移除class属性
|
||||
inputHtml = inputHtml.replace(/<([a-zA-Z0-9]+)[^>]*>/g, '<$1>'); // 删除标签上的所有属性
|
||||
// inputHtml = inputHtml.replace(/<([a-zA-Z0-9]+)[^>]*>/g, '<$1>'); // 删除标签上的所有属性
|
||||
|
||||
inputHtml = inputHtml.replace(/<([a-zA-Z0-9]+)([^>]*)>/g, function (match, tag, attributes) {
|
||||
// 使用正则表达式删除属性(保留 data-latex)
|
||||
let updatedAttributes = attributes.replace(/\s([a-zA-Z0-9-]+)(="[^"]*")?/g, function (attrMatch, attrName) {
|
||||
// 只保留 data-latex 属性,其他属性删除
|
||||
if (attrName === "data-latex") {
|
||||
return attrMatch;
|
||||
}
|
||||
return ''; // 删除其他属性
|
||||
});
|
||||
|
||||
// 返回标签,保留 data-latex 属性
|
||||
return `<${tag}${updatedAttributes}>`;
|
||||
});
|
||||
// 2. 删除所有不需要的标签 (除 `strong`, `em`, `sub`, `sup`, `b`, `i` 外的所有标签)
|
||||
inputHtml = inputHtml.replace(/<(?!\/?(strong|em|sub|sup|b|i|blue))[^>]+>/g, ''); // 删除不需要的标签
|
||||
inputHtml = inputHtml.replace(/<(?!\/?(strong|em|sub|sup|b|i|blue|wmath))[^>]+>/g, ''); // 删除不需要的标签
|
||||
|
||||
// 3. 如果有 `<strong>` 和 `<em>` 标签,去掉内部样式并保留内容
|
||||
inputHtml = inputHtml.replace(/<span[^>]*>/g, '').replace(/<\/span>/g, ''); // 去除span标签
|
||||
@@ -645,62 +749,74 @@ export default {
|
||||
let tempDiv = document.createElement('div');
|
||||
tempDiv.innerHTML = content; // 解析 HTML 内容
|
||||
let paragraphs = tempDiv.querySelectorAll("p"); // 选取所有 <p> 作为数据项
|
||||
|
||||
|
||||
// 2️⃣ 将 <p> 内容转换为数组,并处理内容
|
||||
let parsedData = Array.from(paragraphs).map(p => {
|
||||
let text = p.innerHTML.trim(); // 获取内容,去除两端空格
|
||||
|
||||
text= this.transformHtmlString(text)
|
||||
// 3️⃣ **正确移除 <o:p>(Word 复制的无效标签)**
|
||||
text = text.replace(/<\/?o:p[^>]*>/g, "");
|
||||
|
||||
text = text.replace(/<\/?o:p[^>]*>/g, "");
|
||||
|
||||
// 4️⃣ **移除所有 style="..."**
|
||||
text = text.replace(/\s*style="[^"]*"/gi, "");
|
||||
|
||||
|
||||
// 5️⃣ **修正标签替换**
|
||||
text = text.replace(/<strong>/gi, "<b>").replace(/<\/strong>/gi, "</b>");
|
||||
text = text.replace(/<em>/gi, "<i>").replace(/<\/em>/gi, "</i>");
|
||||
|
||||
|
||||
// 6️⃣ **移除空的 span、b、i 标签**
|
||||
text = text.replace(/<span>\s*<\/span>/gi, "");
|
||||
text = text.replace(/<b>\s*<\/b>/gi, "");
|
||||
text = text.replace(/<i>\s*<\/i>/gi, "");
|
||||
|
||||
|
||||
// 7️⃣ **确保不移除半个标签(修复匹配规则)**
|
||||
text = text.replace(/<[^\/>]+>\s*<\/[^>]+>/gi, match => {
|
||||
return match.trim() === "" ? "" : match;
|
||||
});
|
||||
|
||||
|
||||
// 8️⃣ **返回最终内容**
|
||||
return text.trim() === "" ? "" : text;
|
||||
});
|
||||
|
||||
|
||||
console.log(parsedData); // 输出数组,方便调试
|
||||
return parsedData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
,
|
||||
|
||||
|
||||
parseTableToArray(tableString, callback) {
|
||||
async parseTableToArray(tableString, callback) {
|
||||
const parser = new DOMParser();
|
||||
const doc = parser.parseFromString(tableString, 'text/html');
|
||||
const rows = doc.querySelectorAll('table tr'); // 获取所有的行(<tr>)
|
||||
|
||||
callback(Array.from(rows).map(row => {
|
||||
const cells = row.querySelectorAll('th, td'); // 获取每个行中的单元格(包括 <th> 和 <td>)
|
||||
return Array.from(cells).map(cell => ({
|
||||
// 使用 Promise 来处理异步的 MathJax 解析
|
||||
const result = await Promise.all(
|
||||
Array.from(rows).map(async (row) => {
|
||||
const cells = row.querySelectorAll('th, td'); // 获取每个行中的单元格(包括 <th> 和 <td>)
|
||||
return await Promise.all(
|
||||
Array.from(cells).map(async (cell) => {
|
||||
const text = await this.extractMathJaxLatex(cell);
|
||||
return {
|
||||
text,
|
||||
colspan: cell.getAttribute('colspan') ? parseInt(cell.getAttribute('colspan')) : 1, // 提取 colspan,默认值为 1
|
||||
rowspan: cell.getAttribute('rowspan') ? parseInt(cell.getAttribute('rowspan')) : 1 // 提取 rowspan,默认值为 1
|
||||
};
|
||||
})
|
||||
);
|
||||
})
|
||||
);
|
||||
console.log('result at line 78611:', result)
|
||||
callback(result)
|
||||
// 返回处理后的数组
|
||||
|
||||
text: this.extractContentWithoutOuterSpan(cell),
|
||||
colspan: cell.getAttribute('colspan') ? parseInt(cell.getAttribute('colspan')) : 1, // 提取 colspan,默认值为 1
|
||||
rowspan: cell.getAttribute('rowspan') ? parseInt(cell.getAttribute('rowspan')) : 1 // 提取 rowspan,默认值为 1
|
||||
}));
|
||||
}));
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
parseNumbering(numberingDoc) {
|
||||
const numberingMap = new Map();
|
||||
if (!numberingDoc) return numberingMap;
|
||||
@@ -1834,19 +1950,14 @@ export default {
|
||||
});
|
||||
ed.ui.registry.addButton('LateX', {
|
||||
text: 'LateX', // 按钮文本
|
||||
className: 'custom-button-blue', // 添加自定义类
|
||||
// className: 'custom-button-blue', // 添加自定义类
|
||||
// shortcut: "Ctrl+J",
|
||||
onAction: function () {
|
||||
// 在选中的文本周围包裹 <blue> 标签
|
||||
// var selectedText = ed.selection.getContent();
|
||||
// console.log('selectedText at line 529:', selectedText);
|
||||
// if (selectedText) {
|
||||
// var wrappedText = `<blue>${selectedText}</blue>`;
|
||||
// ed.selection.setContent(wrappedText);
|
||||
// } else {
|
||||
// this.$message.error('请选择要添加蓝色的文本');
|
||||
// }
|
||||
}
|
||||
window.open('/LateX?id=4477', '_blank', 'width=600,height=400');
|
||||
|
||||
// 在新页面中插入 MathLive 编辑器
|
||||
// formulaWindow.document.write(``);
|
||||
}
|
||||
});
|
||||
|
||||
ed.ui.registry.addButton('myuppercase', {
|
||||
|
||||
@@ -1,31 +1,42 @@
|
||||
<template>
|
||||
<div class="wrapper">
|
||||
<template v-if="!this.$route.meta.hideSidebar">
|
||||
<v-head></v-head>
|
||||
<template v-if="!this.$route.meta.hideTitle"
|
||||
><template v-if="!this.$route.meta.hideSidebar">
|
||||
<v-head></v-head>
|
||||
|
||||
<v-sidebar></v-sidebar>
|
||||
<div class="content-box" :class="{ 'content-collapse': collapse }">
|
||||
<v-tags></v-tags>
|
||||
<div class="content">
|
||||
<transition name="move" mode="out-in">
|
||||
<keep-alive :include="tagsList">
|
||||
<router-view></router-view>
|
||||
</keep-alive>
|
||||
</transition>
|
||||
<el-backtop target=".content"></el-backtop>
|
||||
<v-sidebar></v-sidebar>
|
||||
<div class="content-box" :class="{ 'content-collapse': collapse }">
|
||||
<v-tags></v-tags>
|
||||
<div class="content">
|
||||
<transition name="move" mode="out-in">
|
||||
<keep-alive :include="tagsList">
|
||||
<router-view></router-view>
|
||||
</keep-alive>
|
||||
</transition>
|
||||
<el-backtop target=".content"></el-backtop>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-head2 :home="true"></v-head2>
|
||||
<div style="width: 100%; height: calc(100% - 62px); overflow: hidden">
|
||||
<div class="content" style="padding: 0; overflow: hidden">
|
||||
<!-- <transition name="move" mode="out-in"> -->
|
||||
<!-- <keep-alive :include="tagsList"> -->
|
||||
<router-view></router-view>
|
||||
<!-- </keep-alive> -->
|
||||
<!-- </transition> -->
|
||||
<el-backtop target=".content"></el-backtop>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-head2 :home="true"></v-head2>
|
||||
<div style="width: 100%;height: calc(100% - 62px);overflow: hidden;">
|
||||
|
||||
<div class="content" style="padding: 0;overflow: hidden;">
|
||||
<!-- <transition name="move" mode="out-in"> -->
|
||||
<!-- <keep-alive :include="tagsList"> -->
|
||||
<router-view></router-view>
|
||||
<!-- </keep-alive> -->
|
||||
<!-- </transition> -->
|
||||
<div style="width: 100%; height: calc(100%); overflow: hidden">
|
||||
<div class="content" style="padding: 0; overflow: hidden">
|
||||
|
||||
<router-view></router-view>
|
||||
|
||||
<el-backtop target=".content"></el-backtop>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -162,25 +162,30 @@
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="pictVisible = false"> Cancel </el-button>
|
||||
<el-button type="primary" @click="savePic">
|
||||
<i class="el-icon-finished" style="margin-right: 5px"></i>
|
||||
<el-button type="primary" @click="savePic" >
|
||||
<i class="el-icon-finished" style="margin-right: 5px;"></i>
|
||||
Save Figure
|
||||
</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 添加表格 -->
|
||||
<el-dialog
|
||||
class="editTableDialog"
|
||||
<el-drawer
|
||||
title="我嵌套了表格!"
|
||||
class="editTableDialog"
|
||||
destroy-on-close
|
||||
v-if="threeVisible"
|
||||
:title="lineStyle.visiTitle"
|
||||
:visible.sync="threeVisible"
|
||||
width="1200px"
|
||||
:wrapperClosable ="false"
|
||||
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-form ref="editMes" :model="lineStyle" label-width="115px">
|
||||
<el-form-item label="Table Title :">
|
||||
direction="rtl"
|
||||
size="70%">
|
||||
<el-form ref="editMes" :model="lineStyle" label-width="80px">
|
||||
<!-- <common-late-x></common-late-x> -->
|
||||
<el-form-item label="Title:">
|
||||
|
||||
<common-content
|
||||
:id="`editor-${new Date().getTime()}-${lineStyle.am_id}-${lineStyle.amt_id}-title`"
|
||||
:isAutomaticUpdate="true"
|
||||
@@ -196,7 +201,62 @@
|
||||
<el-form-item label="Word">
|
||||
<span slot="label">
|
||||
<font style="color: #f56c6c; margin-right: 5px">*</font>
|
||||
Table :
|
||||
Table:
|
||||
</span>
|
||||
<common-table
|
||||
@getContent="getContent"
|
||||
v-if="threeVisible"
|
||||
ref="commonTable"
|
||||
|
||||
:lineStyle="lineStyle"
|
||||
></common-table>
|
||||
</el-form-item>
|
||||
<el-form-item label="Note:">
|
||||
<common-content
|
||||
:id="`editor-${new Date().getTime()}-${lineStyle.am_id}-${lineStyle.amt_id}-note`"
|
||||
:isAutomaticUpdate="true"
|
||||
:value="lineStyle.note"
|
||||
@getContent="getContent"
|
||||
v-if="threeVisible"
|
||||
@updateChange="(res) => updateChange(res, 'note')"
|
||||
:height="120"
|
||||
ref="tinymceChildNote"
|
||||
|
||||
></common-content>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<p style="margin-top: 20px; text-align: right">
|
||||
<el-button @click="threeVisible = false"> Cancel </el-button>
|
||||
<el-button type="primary" plain @click="handleSaveTable" style="background-color: #006699 !important;background: #006699 !important;margin-right: 20px;color: #fff !important;"> save Table </el-button>
|
||||
</p>
|
||||
</el-drawer>
|
||||
<!-- <el-dialog
|
||||
class="editTableDialog"
|
||||
destroy-on-close
|
||||
v-if="threeVisible"
|
||||
:title="lineStyle.visiTitle"
|
||||
:visible.sync="threeVisible"
|
||||
width="1200px"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-form ref="editMes" :model="lineStyle" label-width="80px">
|
||||
<el-form-item label="Title:">
|
||||
<common-content
|
||||
:id="`editor-${new Date().getTime()}-${lineStyle.am_id}-${lineStyle.amt_id}-title`"
|
||||
:isAutomaticUpdate="true"
|
||||
:value="lineStyle.title"
|
||||
@getContent="getContent"
|
||||
v-if="threeVisible"
|
||||
@updateChange="(res) => updateChange(res, 'title')"
|
||||
:height="120"
|
||||
ref="tinymceChildTitle"
|
||||
style="margin-left: -115px"
|
||||
></common-content>
|
||||
</el-form-item>
|
||||
<el-form-item label="Word">
|
||||
<span slot="label">
|
||||
<font style="color: #f56c6c; margin-right: 5px">*</font>
|
||||
Table:
|
||||
</span>
|
||||
<common-table
|
||||
@getContent="getContent"
|
||||
@@ -206,7 +266,7 @@
|
||||
:lineStyle="lineStyle"
|
||||
></common-table>
|
||||
</el-form-item>
|
||||
<el-form-item label="Bottom Title :">
|
||||
<el-form-item label="Note:">
|
||||
<common-content
|
||||
:id="`editor-${new Date().getTime()}-${lineStyle.am_id}-${lineStyle.amt_id}-note`"
|
||||
:isAutomaticUpdate="true"
|
||||
@@ -224,7 +284,7 @@
|
||||
<el-button @click="threeVisible = false"> Cancel </el-button>
|
||||
<el-button type="primary" plain @click="handleSaveTable"> save Table </el-button>
|
||||
</p>
|
||||
</el-dialog>
|
||||
</el-dialog> -->
|
||||
<el-dialog
|
||||
destroy-on-close
|
||||
v-if="commentVisible"
|
||||
@@ -541,10 +601,8 @@ export default {
|
||||
async getContent(type, content) {
|
||||
console.log('content at line 539:', content);
|
||||
if (type == 'content') {
|
||||
content = content.replace(/<(?!\/?(img|b|i|sub|sup|span|strong|em |blue)\b)[^>]+>/g, '');
|
||||
|
||||
content = content.replace(/\s*style="[^"]*"/g, '');
|
||||
|
||||
content = this.$commonJS.transformHtmlString(content);
|
||||
console.log('content at line 604:', content)
|
||||
var div = document.createElement('div');
|
||||
div.innerHTML = content; // 将 HTML 字符串加载到 div 中
|
||||
// 替换所有 <strong> 为 <b>
|
||||
@@ -581,6 +639,7 @@ export default {
|
||||
|
||||
this.saveContentList(list, this.currentId);
|
||||
} else if (type == 'table') {
|
||||
|
||||
this.saveTable(content);
|
||||
} else if (type == 'comment') {
|
||||
this.addComment(content);
|
||||
@@ -1093,7 +1152,8 @@ export default {
|
||||
}
|
||||
},
|
||||
updateChange(content, type) {
|
||||
console.log('content at line 976:', content);
|
||||
console.log('content at line 1154:', content)
|
||||
// console.log('content at line 976:', content);
|
||||
var str = this.$commonJS.transformHtmlString(content);
|
||||
if (type == 'imgNote') {
|
||||
this.picStyle.note = str;
|
||||
@@ -2063,4 +2123,5 @@ export default {
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: #555; /* 滑块悬停时的颜色 */
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -215,8 +215,7 @@
|
||||
localStorage.setItem('U_role', 'superadmin');
|
||||
localStorage.setItem('U_name', res.userinfo.account);
|
||||
localStorage.setItem('U_id', res.userinfo.user_id);
|
||||
return false
|
||||
// localStorage.setItem('U_id', res.userinfo.admin_id);
|
||||
|
||||
this.$router.push('/');
|
||||
} else if (res.data.roles.includes('editor')) {
|
||||
localStorage.setItem('U_status', '1'); //编辑
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</div>
|
||||
|
||||
<div class="manu_add" style="width: 960px" v-loading="loading">
|
||||
<el-form ref="articleform" :model="form" :rules="rules" label-width="160px">
|
||||
<el-form ref="articleform" :model="form" :rules="rules" label-width="120px">
|
||||
<div class="bag_color" v-if="show_step == 1">
|
||||
<div>
|
||||
<h3>Manuscript Information</h3>
|
||||
@@ -56,8 +56,8 @@
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="Research areas :" prop="major">
|
||||
<common-major-list :list="majorValueList" @load="(e)=>this.majorValueList=e"></common-major-list>
|
||||
<el-form-item label="Research areas :" prop="major" label-width="160px">
|
||||
<common-major-list :list="majorValueList" @load="(e) => (this.majorValueList = e)"></common-major-list>
|
||||
<!-- <el-select
|
||||
v-model="form.major_a"
|
||||
placeholder="Please select major"
|
||||
@@ -102,7 +102,7 @@
|
||||
></el-option>
|
||||
</el-select> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="Manuscript Title :" prop="title">
|
||||
<el-form-item label="Manuscript Title :" prop="title" label-width="160px">
|
||||
<el-input v-model="form.title" placeholder="Please enter title"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="Whether ethical approval was obtained ?" prop="approval" label-width="300px">
|
||||
@@ -189,17 +189,19 @@
|
||||
>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="Article Processing Charge :" v-if="ms_alias == null" label-width="180px">
|
||||
<el-form-item label="Article Processing Charge :" v-if="form.journal != 0" label-width="180px">
|
||||
$ {{ getFee(form.journal) }}
|
||||
<div style="color: #8c8d8f"v-if=" getFee(form.journal)&&getFee(form.journal)!='0.00'">
|
||||
<i class="el-icon-warning" style="color: #517fd5; margin-right: 4px"></i>The article processing fee applies to papers submitted and ultimately accepted for publication after January 1, 2025. For authors seeking to apply for fee discounts, please <a
|
||||
<div style="color: #8c8d8f" v-if="getFee(form.journal) && getFee(form.journal) != '0.00'">
|
||||
<i class="el-icon-warning" style="color: #517fd5; margin-right: 4px"></i>The article processing fee
|
||||
applies to papers submitted and ultimately accepted for publication after January 1, 2025. For
|
||||
authors seeking to apply for fee discounts, please
|
||||
<a
|
||||
style="color: rgb(81, 127, 213); cursor: pointer; text-decoration: underline"
|
||||
href="https://www.tmrjournals.com/apc/"
|
||||
target="_blank"
|
||||
>click here</a
|
||||
> to view detailed policies.
|
||||
|
||||
|
||||
>
|
||||
to view detailed policies.
|
||||
</div>
|
||||
</el-form-item>
|
||||
<div style="text-align: center; margin: 40px 0 0 0">
|
||||
@@ -967,7 +969,7 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
majorValueList:[],
|
||||
majorValueList: [],
|
||||
baseUrl: this.Common.baseUrl,
|
||||
usercap: localStorage.getItem('U_role'),
|
||||
ms_alias: localStorage.getItem('ms_journal_alias'),
|
||||
@@ -1008,7 +1010,7 @@ export default {
|
||||
],
|
||||
form: {
|
||||
article_id: 0,
|
||||
journal: localStorage.getItem('ms_journal_alias') ? parseInt(localStorage.getItem('ms_journal_alias')) : 1,
|
||||
journal: localStorage.getItem('ms_journal_alias') ? parseInt(localStorage.getItem('ms_journal_alias')) : '',
|
||||
username: localStorage.getItem('U_name'),
|
||||
user_id: localStorage.getItem('U_id'),
|
||||
title: '',
|
||||
@@ -1196,21 +1198,20 @@ export default {
|
||||
}
|
||||
],
|
||||
major: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
console.log('value at line 1202:', this.form);
|
||||
var major=this.majorValueList.map(item => item.selectedValue[item.selectedValue.length - 1]).toString(',')
|
||||
if (major=='') {
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
console.log('value at line 1202:', this.form);
|
||||
var major = this.majorValueList.map((item) => item.selectedValue[item.selectedValue.length - 1]).toString(',');
|
||||
if (major == '') {
|
||||
callback(new Error('Please select the Research areas'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
// 如果你需要在此处使用 this 访问 Vue 实例的数据,使用箭头函数保持上下文
|
||||
// 其他逻辑
|
||||
}
|
||||
}
|
||||
|
||||
// 如果你需要在此处使用 this 访问 Vue 实例的数据,使用箭头函数保持上下文
|
||||
// 其他逻辑
|
||||
}
|
||||
}
|
||||
],
|
||||
abstrart: [
|
||||
{
|
||||
@@ -2509,10 +2510,27 @@ export default {
|
||||
this.form.checkedjours = [];
|
||||
this.form.istransfer = false;
|
||||
this.form.becomeRev = false;
|
||||
if (this.$route.query.id) {
|
||||
this.saveArticle();
|
||||
}
|
||||
this.initMajor();
|
||||
// this.getTopics()
|
||||
},
|
||||
saveArticle() {
|
||||
// api/Article/changeJournal
|
||||
|
||||
this.$api
|
||||
.post('api/Article/changeJournal', {
|
||||
article_id: this.$route.query.id,
|
||||
journal_id: this.form.journal
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code == 0) {
|
||||
} else {
|
||||
// this.$message.error(res.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 点击tab变化
|
||||
StepCode(e) {
|
||||
console.log('🚀 ~ StepCode ~ e111:', e);
|
||||
@@ -2610,14 +2628,17 @@ export default {
|
||||
},
|
||||
|
||||
// 点击进行下一步
|
||||
onStep(e) {
|
||||
|
||||
console.log('this.majorValueList at line 2604:', this.majorValueList)
|
||||
console.log('this.form at line 2622:', this.form)
|
||||
|
||||
onStep(e) {
|
||||
console.log('this.majorValueList at line 2604:', this.majorValueList);
|
||||
console.log('this.form at line 2622:', this.form);
|
||||
|
||||
this.$refs.articleform.validate((valid) => {
|
||||
if (valid) {
|
||||
if (e == 1) {
|
||||
if (this.form.journal == 0 || !this.form.journal) {
|
||||
this.$message.error('Please select the Journal');
|
||||
return false;
|
||||
}
|
||||
// this.onStaging(1)
|
||||
// setTimeout(() => {
|
||||
// console.log('456')
|
||||
@@ -2633,13 +2654,15 @@ export default {
|
||||
}
|
||||
}
|
||||
this.form.keyWords = fstr == '' ? '' : fstr.substring(0, fstr.length - 1);
|
||||
this.form.major=this.majorValueList.map(item => item.selectedValue[item.selectedValue.length - 1]).toString(',')
|
||||
if(this.form.major==''){
|
||||
this.$message.error('Please select the Research areas')
|
||||
return false
|
||||
}
|
||||
this.form.major = this.majorValueList
|
||||
.map((item) => item.selectedValue[item.selectedValue.length - 1])
|
||||
.toString(',');
|
||||
if (this.form.major == '') {
|
||||
this.$message.error('Please select the Research areas');
|
||||
return false;
|
||||
}
|
||||
|
||||
this.$api.post('api/Article/addArticlePart1', this.form).then((res) => {
|
||||
|
||||
if (res.code == 0) {
|
||||
this.stagingID = res.data.article_id;
|
||||
this.form.article_id = res.data.article_id;
|
||||
@@ -2716,7 +2739,12 @@ export default {
|
||||
onStaging(e) {
|
||||
var that = this;
|
||||
console.log('e at line 2584:', e);
|
||||
console.log('this.form at line 2622:', this.form);
|
||||
if (e == 1) {
|
||||
if (this.form.journal == 0 || !this.form.journal) {
|
||||
this.$message.error('Please select the Journal');
|
||||
return false;
|
||||
}
|
||||
var flist = this.keywordsList;
|
||||
var fstr = '';
|
||||
for (var fu in flist) {
|
||||
@@ -2724,15 +2752,14 @@ export default {
|
||||
fstr += flist[fu].ke.trim() + ',';
|
||||
}
|
||||
}
|
||||
console.log('this.form at line 2707:', this.form)
|
||||
console.log('this.form at line 2707:', this.form);
|
||||
this.form.keyWords = fstr == '' ? '' : fstr.substring(0, fstr.length - 1);
|
||||
this.form.major=this.majorValueList.map(item => item.selectedValue[item.selectedValue.length - 1]).toString(',')
|
||||
if(this.form.major==''){
|
||||
this.$message.error('Please select the Research areas')
|
||||
return false
|
||||
}
|
||||
this.form.major = this.majorValueList.map((item) => item.selectedValue[item.selectedValue.length - 1]).toString(',');
|
||||
if (this.form.major == '') {
|
||||
this.$message.error('Please select the Research areas');
|
||||
return false;
|
||||
}
|
||||
this.$api.post('api/Article/addArticlePart1', this.form).then((res) => {
|
||||
|
||||
if (res.code == 0) {
|
||||
this.stagingID = res.data.article_id;
|
||||
this.form.article_id = res.data.article_id;
|
||||
@@ -2869,10 +2896,14 @@ export default {
|
||||
console.log(res.data.base);
|
||||
// this.form.topics = res.data.base.topics
|
||||
// 领域
|
||||
this.majorValueList = res.data.majors.map(item => ({
|
||||
|
||||
selectedValue: Array.isArray(item.major) ? item.major : (typeof item.major === 'string' ? item.major.split(',').map(Number) : [item.major])
|
||||
})); console.log('this.majorValueList at line 2853:', this.majorValueList)
|
||||
this.majorValueList = res.data.majors.map((item) => ({
|
||||
selectedValue: Array.isArray(item.major)
|
||||
? item.major
|
||||
: typeof item.major === 'string'
|
||||
? item.major.split(',').map(Number)
|
||||
: [item.major]
|
||||
}));
|
||||
console.log('this.majorValueList at line 2853:', this.majorValueList);
|
||||
// this.$api
|
||||
// .post('api/Major/getMajorForAddArticle', {
|
||||
// journal_id: this.form.journal,
|
||||
@@ -3310,26 +3341,30 @@ export default {
|
||||
}
|
||||
|
||||
.jour_ku_all {
|
||||
font-size: 12px;
|
||||
font-size: 14px;
|
||||
float: left;
|
||||
width: 265px;
|
||||
width: 48%;
|
||||
padding-left: 10px;
|
||||
cursor: pointer;
|
||||
color: #666;
|
||||
line-height: 26px;
|
||||
}
|
||||
|
||||
.jour_ku_all:nth-child(3n + 1) {
|
||||
/* .jour_ku_all:nth-child(3n + 1) {
|
||||
width: 230px;
|
||||
}
|
||||
|
||||
.jour_ku_all:nth-child(3n + 2) {
|
||||
width: 220px;
|
||||
}
|
||||
} */
|
||||
|
||||
.jour_ku_all.B_style {
|
||||
color: #006699;
|
||||
color: #1161ea;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
background: #ebf5ff;
|
||||
border-radius: 4px;
|
||||
/* border: 1px solid #b3d8ff ; */
|
||||
}
|
||||
|
||||
.tally_jour {
|
||||
|
||||
@@ -41,7 +41,7 @@ const tableStyle = ` b span{
|
||||
table-layout: auto; /* 自动调整列宽 */
|
||||
text-align:left;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -53,7 +53,7 @@ const tableStyle = ` b span{
|
||||
word-wrap: break-word; /* 长单词自动换行 */
|
||||
word-break: break-word;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -80,7 +80,7 @@ const tableStyle = ` b span{
|
||||
|
||||
margin:0;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -89,7 +89,7 @@ const tableStyle = ` b span{
|
||||
|
||||
color:#000000;text-align:left !important;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -97,7 +97,7 @@ const tableStyle = ` b span{
|
||||
table .color-highlight{
|
||||
color:rgb(0,130,170) !important;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
|
||||
@@ -41,7 +41,7 @@ const tableStyle = ` b span{
|
||||
table-layout: auto; /* 自动调整列宽 */
|
||||
text-align:left;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -53,7 +53,7 @@ const tableStyle = ` b span{
|
||||
word-wrap: break-word; /* 长单词自动换行 */
|
||||
word-break: break-word;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -82,7 +82,7 @@ const tableStyle = ` b span{
|
||||
|
||||
margin:0;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -91,7 +91,7 @@ const tableStyle = ` b span{
|
||||
|
||||
color:#000000;text-align:left !important;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -99,7 +99,7 @@ const tableStyle = ` b span{
|
||||
table .color-highlight{
|
||||
color:rgb(0,130,170) !important;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -118,6 +118,15 @@ const tableStyle = ` b span{
|
||||
.wordTableHtml table tr.table-header-row:nth-of-type(2) td {
|
||||
border-bottom: 1px solid #000 !important;
|
||||
}
|
||||
mjx-container {
|
||||
font-size: 14px !important;
|
||||
;
|
||||
}
|
||||
wmath{
|
||||
width: 100%;
|
||||
display: block;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
`;
|
||||
export default {
|
||||
@@ -148,7 +157,7 @@ export default {
|
||||
height: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 360
|
||||
default: 400
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
@@ -220,9 +229,12 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
value(val) {
|
||||
console.log('val at line 208:', val);
|
||||
// console.log('val at line 208:', val);
|
||||
if (!this.hasChange && this.hasInit) {
|
||||
this.$nextTick(() => window.tinymce.get(this.tinymceId).setContent(val));
|
||||
this.$nextTick(() => {
|
||||
window.tinymce.get(this.tinymceId).setContent(val);
|
||||
// window.renderMathJax(); // 主动触发 MathJax 渲染
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -238,6 +250,9 @@ export default {
|
||||
this.destroyTinymce();
|
||||
},
|
||||
methods: {
|
||||
onpenLatex() {
|
||||
console.log('at line 254:', '打开数字公式');
|
||||
},
|
||||
handleSubmit() {
|
||||
this.$refs.uploadImage.handleSubmit();
|
||||
},
|
||||
@@ -275,20 +290,17 @@ export default {
|
||||
window.tinymce.init({
|
||||
inline: false, // 使用 iframe 模式
|
||||
selector: `#${this.tinymceId}`,
|
||||
// noneditable_regexp: "/<wmath>.*?<\/wmath>/g",
|
||||
content_css: false, // 禁用默认样式
|
||||
table_resize_bars: true, // 启用拖动调整功能
|
||||
valid_elements: this.type == 'table' ? '*[*]' : 'img[src|alt|width|height],strong,em,sub,sup,blue,table,b,i', // 允许的标签和属性
|
||||
valid_elements: this.type == 'table' ? '*[*]' : 'img[src|alt|width|height],strong,em,sub,sup,blue,table,b,i,wmath', // 允许的标签和属性
|
||||
// valid_elements: '*[*]', // 允许所有 HTML 标签
|
||||
|
||||
noneditable_editable_class: 'MathJax',
|
||||
height: this.height,
|
||||
paste_preprocess: function (plugin, args) {
|
||||
let content = args.content;
|
||||
|
||||
// 创建一个临时 div 元素来解析粘贴的 HTML
|
||||
let content = args.content; // 获取粘贴的内容
|
||||
let tempDiv = document.createElement('div');
|
||||
tempDiv.innerHTML = content;
|
||||
|
||||
// 检查粘贴的内容是否包含 <table> 元素
|
||||
if (tempDiv.querySelector('table')) {
|
||||
console.log('粘贴的内容包含表格');
|
||||
if (_this.type == 'table') {
|
||||
@@ -324,30 +336,121 @@ export default {
|
||||
// _this.updateTableStyles(container); // 根据需要应用额外的样式
|
||||
args.content = container.innerHTML; // 更新处理后的内容
|
||||
});
|
||||
}else{
|
||||
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
if (_this.isAutomaticUpdate) {
|
||||
args.content = _this.$commonJS.transformHtmlString(args.content); // 更新处理后的内容
|
||||
|
||||
}
|
||||
console.log('粘贴的内容不包含表格');
|
||||
console.log('Original content:', content); // 输出原始粘贴内容
|
||||
|
||||
// 改进的正则表达式,匹配 $$...$$ 格式的 LaTeX 公式
|
||||
const mathRegex = /\$\$([^$]+)\$\$/g;
|
||||
|
||||
// 如果粘贴的内容包含 $$...$$ 格式的公式,进行处理
|
||||
content = content.replace(mathRegex, function (match, formula) {
|
||||
console.log('Matched formula:', formula); // 输出每个匹配的公式
|
||||
// 将公式包裹在 <wmath> 标签中,保留 $$...$$ 结构
|
||||
return `<wmath data-latex="${match}">${match}</wmath>`;
|
||||
});
|
||||
|
||||
console.log('Processed content:', content); // 输出处理后的内容
|
||||
}
|
||||
// 阻止默认的粘贴行为
|
||||
|
||||
// 更新 args.content 为处理后的内容
|
||||
|
||||
// 阻止默认的粘贴行为,确保自定义处理优先执行
|
||||
if (args.event) {
|
||||
args.event.preventDefault(); // 阻止默认的粘贴处理
|
||||
args.event.stopPropagation(); // 阻止事件冒泡,确保自定义处理优先执行
|
||||
args.event.preventDefault();
|
||||
args.event.stopPropagation();
|
||||
}
|
||||
|
||||
if (_this.isAutomaticUpdate) {
|
||||
args.content = _this.$commonJS.transformHtmlString(content); // 更新处理后的内容
|
||||
} else {
|
||||
args.content = content;
|
||||
}
|
||||
setTimeout(() => {
|
||||
window.renderMathJax(_this.tinymceId);
|
||||
}, 10);
|
||||
},
|
||||
|
||||
// paste_preprocess: function (plugin, args) {
|
||||
// let content = args.content;
|
||||
|
||||
// // 创建一个临时 div 元素来解析粘贴的 HTML
|
||||
// let tempDiv = document.createElement('div');
|
||||
// tempDiv.innerHTML = content;
|
||||
|
||||
// // 检查粘贴的内容是否包含 <table> 元素
|
||||
// if (tempDiv.querySelector('table')) {
|
||||
// console.log('粘贴的内容包含表格');
|
||||
// if (_this.type == 'table') {
|
||||
// _this.$commonJS.parseTableToArray(content, (tableList) => {
|
||||
// console.log('res at line 104:', tableList);
|
||||
// var contentHtml = `
|
||||
// <div class="thumbnailTableBox wordTableHtml table_Box" style="">
|
||||
// <table border="1" style="width: auto; border-collapse: collapse; text-align: center;">
|
||||
// ${tableList
|
||||
// .map((row) => {
|
||||
// return `
|
||||
// <tr>
|
||||
// ${row
|
||||
// .map((cell) => {
|
||||
// return `
|
||||
// <td colspan="${cell.colspan || 1}" rowspan="${cell.rowspan || 1}">
|
||||
// <span>${cell.text || ''}</span>
|
||||
// </td>
|
||||
// `;
|
||||
// })
|
||||
// .join('')}
|
||||
// </tr>
|
||||
// `;
|
||||
// })
|
||||
// .join('')}
|
||||
// </table>
|
||||
// </div>
|
||||
// `;
|
||||
|
||||
// const container = document.createElement('div');
|
||||
// container.innerHTML = contentHtml;
|
||||
|
||||
// // _this.updateTableStyles(container); // 根据需要应用额外的样式
|
||||
// args.content = container.innerHTML; // 更新处理后的内容
|
||||
// });
|
||||
// } else {
|
||||
// }
|
||||
// } else {
|
||||
// const mathRegex = /\$\$([^$]+)\$\$/g;
|
||||
// // 如果粘贴的内容包含 $$...$$ 格式的公式,进行处理
|
||||
// content = content.replace(mathRegex, function (match, formula) {
|
||||
// console.log('Matched formula:', formula); // 输出每个匹配的公式
|
||||
// // 将公式包裹在 <wmath> 标签中,保留 $$...$$ 结构
|
||||
// return `<wmath data-latex="${match}">${match}</wmath>`;
|
||||
// });
|
||||
|
||||
// // 更新 args.content 为处理后的内容
|
||||
|
||||
// if (_this.isAutomaticUpdate) {
|
||||
// args.content = _this.$commonJS.transformHtmlString(content); // 更新处理后的内容
|
||||
// }
|
||||
// setTimeout(() => {
|
||||
// window.renderMathJax(_this.tinymceId);
|
||||
// }, 50);
|
||||
|
||||
// console.log('粘贴的内容不包含表格');
|
||||
// }
|
||||
// // 阻止默认的粘贴行为
|
||||
// if (args.event) {
|
||||
// args.event.preventDefault(); // 阻止默认的粘贴处理
|
||||
// args.event.stopPropagation(); // 阻止事件冒泡,确保自定义处理优先执行
|
||||
// }
|
||||
// },
|
||||
|
||||
content_style: `
|
||||
${tableStyle}
|
||||
${_this.wordStyle}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
`,
|
||||
|
||||
formats: {
|
||||
@@ -362,7 +465,7 @@ export default {
|
||||
custom_colors: false,
|
||||
color_map: ['0082AA', 'TMR Blue'],
|
||||
|
||||
plugins: 'texttransform', // 启用 forecolor 和 code 插件
|
||||
plugins: 'texttransform kityformula-editor noneditable', // 启用 forecolor 和 code 插件
|
||||
// plugins: 'forecolor code paste table image mathType searchreplace raw', // 启用 forecolor 和 code 插件
|
||||
end_container_on_empty_block: true,
|
||||
content_css: 'default', // 加载 TinyMCE 默认样式表
|
||||
@@ -374,7 +477,15 @@ export default {
|
||||
//设置自定义按钮 myCustomToolbarButton
|
||||
setup(ed) {
|
||||
_this.$commonJS.initEditorButton(_this, ed);
|
||||
ed.on('click', function (e) {
|
||||
console.log('e at line 471:', e);
|
||||
// 判断点击是否为 wmath 标签
|
||||
|
||||
const wmathElement = e.target.closest('wmath');
|
||||
if (wmathElement) {
|
||||
// 执行点击 wmath 标签时的操作
|
||||
}
|
||||
});
|
||||
ed.ui.registry.addButton('uploadWord', {
|
||||
text: 'Word',
|
||||
icon: 'import-word', // 使用自定义图标
|
||||
@@ -421,15 +532,18 @@ export default {
|
||||
ed.on('init', function () {
|
||||
_this.$commonJS.inTinymceButtonClass();
|
||||
const editorBody = ed.getBody();
|
||||
|
||||
// 创建 MutationObserver 监听内容变化
|
||||
const observer = new MutationObserver(() => {
|
||||
const currentContent = ed.getContent();
|
||||
console.log('currentContent at line 447:', currentContent);
|
||||
|
||||
if (_this.isAutomaticUpdate) {
|
||||
|
||||
|
||||
// _this.$emit('updateChange', _this.$commonJS.decodeHtml(currentContent));
|
||||
_this.$emit('updateChange',currentContent);
|
||||
_this.$commonJS.replaceWMathContent(currentContent, (res) => {
|
||||
console.log('res at line 451:', res);
|
||||
_this.$emit('updateChange', res);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -486,11 +600,21 @@ export default {
|
||||
init_instance_callback: (editor) => {
|
||||
if (_this.value) {
|
||||
editor.setContent(_this.value);
|
||||
|
||||
console.log('at line 489:', ' 页面');
|
||||
setTimeout(() => {
|
||||
window.renderMathJax(_this.tinymceId); // 初始化时渲染 MathJax
|
||||
}, 10);
|
||||
}
|
||||
_this.hasInit = true;
|
||||
editor.on('NodeChange Change KeyUp SetContent', () => {
|
||||
this.hasChange = true;
|
||||
this.$emit('input', editor.getContent());
|
||||
|
||||
console.log('at line 518:', '改变');
|
||||
// setTimeout(() => {
|
||||
// window.renderMathJax(); // 初始化时渲染 MathJax
|
||||
// }, 50);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -516,16 +640,16 @@ export default {
|
||||
window.tinymce.get(this.tinymceId).setContent(value);
|
||||
},
|
||||
//获取内容
|
||||
async getContent(type) {
|
||||
async getContent(type) {
|
||||
var content = window.tinymce.get(this.tinymceId).getContent();
|
||||
content = content.replace(/<span[^>]*>/g, '').replace(/<\/span>/g, ''); // 去除span标签
|
||||
|
||||
|
||||
console.log('content at line 627:', content);
|
||||
content = content.replace(/<span[^>]*>/g, '').replace(/<\/span>/g, ''); // 去除span标签
|
||||
|
||||
content = content.replace(/<strong>/g, '<b>').replace(/<\/strong>/g, '</b>');
|
||||
content = content.replace(/<em>/g, '<i>').replace(/<\/em>/g, '</i>');
|
||||
content = content.replace(/ /g, ' '); // 将所有 替换为空格
|
||||
this.$emit('getContent', type, content);
|
||||
|
||||
console.log('content at line 632:', content);
|
||||
this.$emit('getContent', type, content);
|
||||
},
|
||||
|
||||
async export(type, data) {
|
||||
|
||||
@@ -1,56 +1,151 @@
|
||||
<template>
|
||||
<div>
|
||||
<label>输入 LaTeX 公式:</label>
|
||||
<div ref="mathField" class="math-container"></div>
|
||||
<p>LaTeX 代码: {{ latex }}</p>
|
||||
<div style="position: fixed;top: 0;left: 0;background-color: #f8f8f8; width: 100%; height: 100%; overflow: hidden; background: linear-gradient(to top, #fbfffe, #ebf9ff);">
|
||||
<div class="navbar-default">
|
||||
<div class="nav commonWidth" style="height: 100%">
|
||||
<div class="title">Digital Formula Editor</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="commonWidth" style="padding:40px 20px; box-sizing: border-box;">
|
||||
<!-- <div style="margin-bottom: 20px;font-size: 20px;">Numerical formula:</div> -->
|
||||
<div style="display: flex;align-items: center;justify-content: space-between;">
|
||||
<div ref="mathField" class="math-container" style="width: calc(100% - 100px);"></div>
|
||||
<span @click="copyLatex" style="font-size: 20px;width: 80px;cursor: pointer;">📋 Copy </span>
|
||||
</div>
|
||||
|
||||
<!-- 公式显示框 -->
|
||||
<div class="formula-box" :style="{ opacity: showLatex ? 1 : 0 }">
|
||||
<p>LaTeX 代码:</p>
|
||||
<textarea ref="latexBox" class="latex-text" readonly>$${{ latex }}$$</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { MathfieldElement } from 'mathlive'; // 直接导入 MathLive 组件
|
||||
import { MathfieldElement } from 'mathlive';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
latex: '\\frac{a}{b} + \\sqrt{x^2 + y^2} + e^{i\\pi}', // 默认 LaTeX 公式,
|
||||
mathFieldInstance: null
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
latex(newVal) {
|
||||
if (this.mathFieldInstance && this.mathFieldInstance.value !== newVal) {
|
||||
this.mathFieldInstance.setValue(newVal);
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
latex: '', // 默认公式
|
||||
// latex: '\\frac{a}{b} + \\sqrt{x^2 + y^2} + e^{i\\pi}', // 默认公式
|
||||
mathFieldInstance: null,
|
||||
showLatex: false, // 控制 LaTeX 代码框的显示与隐藏
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
if (this.$refs.mathField) {
|
||||
// 创建 MathfieldElement 组件
|
||||
const mf = new MathfieldElement();
|
||||
mf.style.width = '100%';
|
||||
mf.virtualKeyboardMode = 'manual'; // 显示虚拟键盘
|
||||
mf.value = this.latex; // 设置默认值
|
||||
|
||||
mounted() {
|
||||
if (this.$refs.mathField) {
|
||||
// 创建 MathfieldElement 组件
|
||||
const mf = new MathfieldElement();
|
||||
mf.style.width = '100%'; // 让输入框撑满
|
||||
mf.virtualKeyboardMode = 'manual'; // 显示虚拟键盘
|
||||
mf.addEventListener('input', (event) => {
|
||||
this.latex = event.target.value; // 监听输入并更新 LaTeX 公式
|
||||
});
|
||||
mf.value = this.latex; // 设置默认值
|
||||
this.$refs.mathField.appendChild(mf); // 挂载到 DOM
|
||||
this.mathFieldInstance = mf;
|
||||
} else {
|
||||
console.error('MathLive 未正确加载');
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.mathFieldInstance = null; // 组件销毁时清除实例
|
||||
// 监听输入变化,更新 LaTeX 代码
|
||||
mf.addEventListener('input', (event) => {
|
||||
this.latex = event.target.value;
|
||||
});
|
||||
|
||||
// 挂载到 DOM
|
||||
this.$refs.mathField.appendChild(mf);
|
||||
this.mathFieldInstance = mf;
|
||||
|
||||
// 强制显示虚拟键盘并保持显示
|
||||
mf.executeCommand('showVirtualKeyboard');
|
||||
|
||||
// 保证虚拟键盘持续显示
|
||||
this.keepKeyboardVisible(mf);
|
||||
} else {
|
||||
console.error('MathLive 未正确加载');
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
keepKeyboardVisible(mf) {
|
||||
// 每秒确保虚拟键盘显示
|
||||
setInterval(() => {
|
||||
mf.executeCommand('showVirtualKeyboard');
|
||||
}, 20); // 每秒确保键盘显示
|
||||
},
|
||||
copyLatex() {
|
||||
if (this.$refs.latexBox) {
|
||||
this.$refs.latexBox.select(); // 选中文本
|
||||
document.execCommand('copy'); // 复制到剪贴板
|
||||
setTimeout(( )=>{
|
||||
window.close();
|
||||
},100)
|
||||
|
||||
}
|
||||
},
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.mathFieldInstance = null; // 组件销毁时清除实例
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
<style scoped>
|
||||
.commonWidth {
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.title {
|
||||
font-size: 32px;
|
||||
font-weight: bold;
|
||||
line-height: 80px;
|
||||
background-color: #0f4eb6;
|
||||
color: #fff;
|
||||
}
|
||||
.navbar-default {
|
||||
width: 100%;
|
||||
height: 80px;
|
||||
background-color: #0f4eb6;
|
||||
border-color: #e7e7e7;
|
||||
}
|
||||
.math-container {
|
||||
min-height: 40px;
|
||||
border: 1px solid #ccc;
|
||||
padding: 5px;
|
||||
font-size: 18px;
|
||||
min-height: 40px;
|
||||
border: 1px solid #ccc;
|
||||
padding: 5px;
|
||||
font-size: 18px;
|
||||
/* margin-bottom: 20px; */
|
||||
}
|
||||
|
||||
/* 公式弹出框样式 */
|
||||
.formula-box {
|
||||
margin-top: 10px;
|
||||
padding: 10px;
|
||||
border: 1px solid #ccc;
|
||||
background-color: #f9f9f9;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
/* LaTeX 代码框 */
|
||||
.latex-text {
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
font-size: 16px;
|
||||
border: 1px solid #ccc;
|
||||
padding: 5px;
|
||||
margin-bottom: 10px;
|
||||
resize: none;
|
||||
}
|
||||
|
||||
/* 复制按钮 */
|
||||
button {
|
||||
padding: 5px 10px;
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
|
||||
/* 防止虚拟键盘覆盖 */
|
||||
::v-deep .ML__virtual-keyboard-toggle {
|
||||
opacity: 1 !important; /* 确保虚拟键盘的按钮可见 */
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
max-height: 60vh;
|
||||
overflow: auto;
|
||||
font-size: 12px;
|
||||
font-size: 7.5pt; /* 字体大小 */
|
||||
font-size: 14px; /* 字体大小 */
|
||||
|
||||
margin-top: 0pt; /* 段前间距 */
|
||||
margin-bottom: 0pt; /* 段后间距 */
|
||||
|
||||
@@ -92,7 +92,7 @@ b span{
|
||||
table-layout: auto; /* 自动调整列宽 */
|
||||
text-align:left;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -104,7 +104,7 @@ b span{
|
||||
word-wrap: nomarl; /* 长单词自动换行 */
|
||||
word-break: nomarl;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -134,7 +134,7 @@ b span{
|
||||
|
||||
margin:0;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -143,7 +143,7 @@ b span{
|
||||
|
||||
color:#000000;text-align:left !important;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -151,7 +151,7 @@ b span{
|
||||
table .color-highlight{
|
||||
color:rgb(0,130,170) !important;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>
|
||||
|
||||
<!--uploadWord |customButtonExportWord |customButtonExportImg -->
|
||||
|
||||
<tinymce
|
||||
@@ -8,23 +8,24 @@
|
||||
ref="tinymceChild1"
|
||||
:wordStyle="wordStyle"
|
||||
@getContent="getContent"
|
||||
:height="calcDynamicWidth()"
|
||||
:value="updatedHtml"
|
||||
:typesettingType="typesettingType"
|
||||
class="paste-area text-container"
|
||||
:toolbar="['bold italic|customBlue removeBlue|myuppercase myuppercasea Line|subscript superscript|table tabledelete| searchreplace |clearButton']"
|
||||
:toolbar="['bold italic|customBlue removeBlue|kityformula-editor |myuppercase myuppercasea Line|subscript superscript|table tabledelete| searchreplace |clearButton']"
|
||||
style="
|
||||
/* white-space: pre-line; */
|
||||
line-height: 12px;
|
||||
max-height: 60vh;
|
||||
/* max-height: 60vh; */
|
||||
overflow: auto;
|
||||
font-size: 12px;
|
||||
font-size: 7.5pt; /* 字体大小 */
|
||||
font-size: 14px; /* 字体大小 */
|
||||
|
||||
margin-top: 0pt; /* 段前间距 */
|
||||
margin-bottom: 0pt; /* 段后间距 */
|
||||
"
|
||||
></tinymce>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -100,6 +101,11 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
calcDynamicWidth() {
|
||||
const parentWidth = window.innerHeight; // 获取窗口宽度
|
||||
const result = parentWidth - 420; // 计算 `100% - 200px`
|
||||
return result ;
|
||||
},
|
||||
isHeaderRow(rowIndex,table) {
|
||||
|
||||
|
||||
@@ -113,11 +119,12 @@ export default {
|
||||
},
|
||||
getContent(type, content) {
|
||||
if (content) {
|
||||
console.log('content at line 121:', content)
|
||||
const container = document.createElement('div');
|
||||
container.innerHTML = content;
|
||||
this.$commonJS.parseTableToArray(content, (table) => {
|
||||
console.log('res at line 104:', table);
|
||||
|
||||
// return false
|
||||
this.$emit('getContent', type, { html_data: content, table: table });
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -373,7 +373,7 @@ b span{
|
||||
table-layout: auto; /* 自动调整列宽 */
|
||||
text-align:left;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -385,7 +385,7 @@ b span{
|
||||
word-wrap: nomarl; /* 长单词自动换行 */
|
||||
word-break: nomarl;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -413,7 +413,7 @@ b span{
|
||||
|
||||
margin:0;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -422,7 +422,7 @@ b span{
|
||||
|
||||
color:#000000;text-align:left !important;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -430,7 +430,7 @@ b span{
|
||||
table .color-highlight{
|
||||
color:rgb(0,130,170) !important;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
|
||||
@@ -65,7 +65,6 @@
|
||||
<i class="el-icon-document"> </i>
|
||||
Batch Add content
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -117,8 +116,7 @@
|
||||
position: relative;
|
||||
"
|
||||
>
|
||||
|
||||
<!-- <common-late-x></common-late-x> -->
|
||||
<!-- <common-late-x></common-late-x> -->
|
||||
<template v-for="(item, index) in wordList">
|
||||
<el-checkbox
|
||||
@change="updateUniqueIds"
|
||||
@@ -155,7 +153,7 @@
|
||||
<el-button
|
||||
v-if="currentId == item.am_id"
|
||||
style="background-color: #006699d1; font-weight: bold; color: #fff; font-size: 16px !important"
|
||||
:style="index==0?' opacity: 0.2;':' opacity: 1;'"
|
||||
:style="index == 0 ? ' opacity: 0.2;' : ' opacity: 1;'"
|
||||
size="mini"
|
||||
plain
|
||||
:disabled="index != 0 ? false : true"
|
||||
@@ -164,15 +162,9 @@
|
||||
>
|
||||
<el-button
|
||||
v-if="currentId == item.am_id"
|
||||
style="
|
||||
|
||||
background-color: #006699d1;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
font-size: 16px !important;
|
||||
"
|
||||
style="background-color: #006699d1; font-weight: bold; color: #fff; font-size: 16px !important"
|
||||
size="mini"
|
||||
:style="index == wordList.length - 1 ?' opacity: 0.2;':' opacity: 1;'"
|
||||
:style="index == wordList.length - 1 ? ' opacity: 0.2;' : ' opacity: 1;'"
|
||||
plain
|
||||
:disabled="index == wordList.length - 1 ? true : false"
|
||||
@click="changeSort('down')"
|
||||
@@ -181,6 +173,7 @@
|
||||
</div>
|
||||
|
||||
<div
|
||||
@dblclick="dblclickEdit(item.am_id, 'img', item, index)"
|
||||
:key="item.am_id"
|
||||
id="drop-target"
|
||||
:class="highlightImg(item.ami_id, item.checks ? item.checks : [])"
|
||||
@@ -208,6 +201,7 @@
|
||||
</font>
|
||||
</div>
|
||||
<div
|
||||
@dblclick="dblclickEdit(item.am_id, 'table', item, index)"
|
||||
id="drop-target"
|
||||
@dragover="handleDragOver"
|
||||
@dragenter="handleDragEnter"
|
||||
@@ -253,6 +247,7 @@
|
||||
</div>
|
||||
|
||||
<div
|
||||
@dblclick="dblclickEdit(item.am_id, 'text', item, index)"
|
||||
v-else
|
||||
id="drop-target"
|
||||
@dragover="handleDragOver"
|
||||
@@ -518,7 +513,7 @@ b span{
|
||||
table-layout: auto; /* 自动调整列宽 */
|
||||
text-align:left;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -530,7 +525,7 @@ b span{
|
||||
word-wrap: nomarl; /* 长单词自动换行 */
|
||||
word-break: nomarl;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -558,7 +553,7 @@ b span{
|
||||
|
||||
margin:0;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -567,7 +562,7 @@ b span{
|
||||
|
||||
color:#000000;text-align:left !important;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -575,7 +570,7 @@ b span{
|
||||
table .color-highlight{
|
||||
color:rgb(0,130,170) !important;
|
||||
font-family:'Charis SIL' !important;
|
||||
font-size: 7.5000pt !important;
|
||||
font-size: 14px !important;
|
||||
mso-font-kerning: 1.0000pt !important;
|
||||
line-height: 20px !important;
|
||||
mos-line-height: 20px !important;
|
||||
@@ -736,6 +731,7 @@ export default {
|
||||
if (val) {
|
||||
this.wordList = [...this.contentList];
|
||||
this.$nextTick(() => {
|
||||
window.renderMathJax(); // 主动触发 MathJax 渲染
|
||||
this.getCommentsData();
|
||||
});
|
||||
}
|
||||
@@ -754,6 +750,7 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
window.renderMathJax(); // 主动触发 MathJax 渲染
|
||||
this.getCommentsData();
|
||||
if (!this.isPreview && localStorage.getItem('scrollPosition')) {
|
||||
this.$refs.scrollDiv.scrollTop = localStorage.getItem('scrollPosition'); // 滚动到 500px 位置
|
||||
@@ -770,6 +767,7 @@ export default {
|
||||
this.$refs.scrollDiv.addEventListener('scroll', this.divOnScroll, { passive: true });
|
||||
},
|
||||
activated() {
|
||||
window.renderMathJax(); // 主动触发 MathJax 渲染
|
||||
this.isShowEditComment();
|
||||
this.typesettingType = 1;
|
||||
this.editors = {};
|
||||
@@ -797,10 +795,10 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
changeSort(type) {
|
||||
console.log('type at line 782:', type);
|
||||
console.log('type at line 782:', type);
|
||||
if (this.currentId) {
|
||||
this.$emit('changeSort',type, this.currentId);
|
||||
}
|
||||
this.$emit('changeSort', type, this.currentId);
|
||||
}
|
||||
},
|
||||
addContent() {
|
||||
if (this.currentId) {
|
||||
@@ -808,7 +806,6 @@ export default {
|
||||
} else {
|
||||
this.$message.warning('Please select content');
|
||||
}
|
||||
|
||||
},
|
||||
cacheSelection() {
|
||||
const selection = window.getSelection();
|
||||
@@ -1251,6 +1248,7 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
initializeEditor(id, type, data, index) {
|
||||
this.clearHighlight();
|
||||
this.selectedIds = [];
|
||||
@@ -1261,7 +1259,6 @@ export default {
|
||||
this.currentId = id;
|
||||
this.currentIndex = index;
|
||||
this.currentData = data;
|
||||
|
||||
|
||||
// const editorId = `editor${index}`;
|
||||
// // 检查当前编辑器是否已经初始化
|
||||
@@ -1285,6 +1282,19 @@ export default {
|
||||
// this.$set(this.editors, editorId, tinymce.get(`editor${index}`));
|
||||
}
|
||||
},
|
||||
dblclickEdit(id, type, data, index) {
|
||||
if (!this.isPreview) {
|
||||
this.currentId = id;
|
||||
this.currentIndex = index;
|
||||
this.currentData = data;
|
||||
this.onEdit();
|
||||
}
|
||||
this.clearHighlight();
|
||||
this.selectedIds = [];
|
||||
this.wordList.forEach((item, index) => {
|
||||
item.checked = false;
|
||||
});
|
||||
},
|
||||
deleteComment(data) {
|
||||
this.$emit('deleteComment', data);
|
||||
},
|
||||
|
||||
24
src/main.js
24
src/main.js
@@ -15,7 +15,24 @@ import Common from './components/common/common'
|
||||
Vue.prototype.$validateString = function (str) {
|
||||
return /^[a-zA-Z\s\u00C0-\u00FF\u0100-\u017F-]+$/.test(str);
|
||||
}
|
||||
|
||||
window.MathJax = {
|
||||
tex: {
|
||||
inlineMath: [['$', '$'], ['\\(', '\\)']], // 行内公式
|
||||
displayMath: [['$$', '$$'], ['\\[', '\\]']], // 块级公式
|
||||
},
|
||||
svg: { fontCache: 'global' }
|
||||
};
|
||||
|
||||
// 监听 DOM 变化,并自动渲染公式
|
||||
Vue.prototype.$renderMath = function () {
|
||||
if (window.MathJax && window.MathJax.typeset) {
|
||||
setTimeout(() => {
|
||||
window.MathJax.typeset();
|
||||
}, 100); // 延迟防止 Vue 还未完全渲染
|
||||
} else {
|
||||
console.warn('MathJax 未正确加载');
|
||||
}
|
||||
};
|
||||
import VXETable from 'vxe-table'
|
||||
import 'vxe-table/lib/style.css'
|
||||
|
||||
@@ -146,5 +163,8 @@ router.beforeEach((to, from, next) => {
|
||||
new Vue({
|
||||
router,
|
||||
i18n,
|
||||
render: h => h(App)
|
||||
render: h => h(App),
|
||||
mounted() {
|
||||
this.$renderMath(); // 页面加载后自动渲染
|
||||
}
|
||||
}).$mount('#app');
|
||||
|
||||
@@ -992,6 +992,15 @@ export default new Router({
|
||||
hideSidebar: true
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/LateX', //用户端预收录-引用编辑
|
||||
component: () => import('../components/page/components/table/LateX.vue'),
|
||||
meta: {
|
||||
title: 'LateX',
|
||||
hideSidebar: true,
|
||||
hideTitle: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'PreIngestedEditor',
|
||||
path: '/PreIngestedEditor', // 编辑端 - 预收录编辑页面
|
||||
|
||||
Reference in New Issue
Block a user