pdf生成与显示

This commit is contained in:
2026-01-26 09:47:55 +08:00
parent 5c7fbb76fa
commit 68b2172a35
12 changed files with 299 additions and 4379 deletions

View File

@@ -162,6 +162,7 @@
Figure Title :
</span>
<common-content
type="content"
:isAutomaticUpdate="true"
:value="picStyle.title"
@getContent="getContent"
@@ -175,6 +176,7 @@
</el-form-item>
<el-form-item label="Figure Describe :">
<common-content
type="content"
:isAutomaticUpdate="true"
:value="picStyle.note"
@getContent="getContent"
@@ -219,6 +221,7 @@
Title:
</span>
<common-content
type="content"
:id="`editor-${new Date().getTime()}-${lineStyle.am_id}-${lineStyle.amt_id}-title`"
:isAutomaticUpdate="true"
:value="lineStyle.title"
@@ -249,6 +252,7 @@
<el-form-item label="Note:">
<!-- :id="`editor-${new Date().getTime()}-${lineStyle.am_id}-${lineStyle.amt_id}-note`" -->
<common-content
type="content"
:id="`editor-${new Date().getTime()}-${lineStyle.am_id}-${lineStyle.amt_id}-note`"
:isAutomaticUpdate="true"
:value="lineStyle.note"
@@ -366,6 +370,8 @@
Content :
</span>
<common-content
type="content"
@openAddTable="openAddTable"
:value="currentContent.content"
@getContent="getContent"
@openLatexEditor="openLatexEditor"
@@ -401,6 +407,7 @@
<common-content
:value="addContent.content"
@getContent="getContent"
type="content"
@openLatexEditor="openLatexEditor"
v-if="addContentVisible"
ref="addContent"
@@ -595,7 +602,19 @@ export default {
this.getCommentList();
},
mounted() {},
mounted() {
document.addEventListener('copy', (event) => {
// 获取用户选中的文本
const selection = document.getSelection().toString();
// 你可以修改剪贴板内容
// event.clipboardData.setData('text/plain', selection + '\n---来自我的系统---');
console.log('用户复制了内容:', selection);
// 阻止默认行为(如果需要自定义复制逻辑的话)
// event.preventDefault();
});
},
async activated() {
this.isShowEditComment();
@@ -604,6 +623,11 @@ export default {
},
methods: {
openAddTable(content) {
this.editVisible = false;
this.threeVisible = true;
this.$forceUpdate();
},
async copyArray(data) {
try {
// 将数组内容转换为字符串,使用换行符分隔
@@ -848,30 +872,45 @@ export default {
}
},
saveLateX(data) {
console.log('data at line 735:', data);
const { editorId, wmathId, latex } = data;
const newLatex = latex ? latex.trim() : '';
if (!editorId || !wmathId) return;
const targetEditor = tinymce.get(editorId);
if (!targetEditor) return;
const targetWmath = targetEditor.dom.select(`wmath[data-id="${wmathId}"]`, targetEditor.getBody())[0];
if (targetWmath) {
if (!newLatex) {
// ❌ 删除公式
targetEditor.dom.remove(targetWmath);
} else {
// ✅ 更新公式
targetWmath.setAttribute('data-latex', newLatex);
targetWmath.innerHTML = newLatex;
setTimeout(() => {
if (typeof renderMathJax === 'function') {
// this.window.renderMathJax(editorId);
}
}, 10);
}
console.log('data at line 735:', data);
// 1. 从 data 中解构出 wrap (或者你命名的模式变量)
const { editorId, wmathId, latex, wrap } = data;
const newLatex = latex ? latex.trim() : '';
if (!editorId || !wmathId) return;
const targetEditor = tinymce.get(editorId);
if (!targetEditor) return;
// 2. 找到编辑器中现有的 wmath 标签
const targetWmath = targetEditor.dom.select(`wmath[data-id="${wmathId}"]`, targetEditor.getBody())[0];
if (targetWmath) {
if (!newLatex) {
// ❌ 删除公式
targetEditor.dom.remove(targetWmath);
} else {
// ✅ 更新公式
// 保持属性纯净:同时更新 latex 内容和 wrap 属性
targetWmath.setAttribute('data-latex', newLatex);
// 如果 data 中传了 wrap 模式就更新它,否则可以保留原样或设为默认
if (wrap) {
targetWmath.setAttribute('data-wrap', wrap);
}
},
// 内部只放纯 latex 文本,不包裹 $ 符号
targetWmath.innerHTML = newLatex;
setTimeout(() => {
if (typeof renderMathJax === 'function') {
// 重新渲染该编辑器内的数学公式
renderMathJax(editorId);
}
}, 10);
}
}
},
async huifu(id) {
var that = this;
await this.$confirm(this.$t('commonTable.reContent'), 'Prompt', {
@@ -2532,4 +2571,9 @@ export default {
background-color: #0066990d;
/* display: block !important; */
}
wmath[data-wrap="inline"] {
display: inline-block !important;
width: auto !important;
}
</style>