数字公式优化

This commit is contained in:
2026-06-02 09:32:21 +08:00
parent 08aa3327db
commit def97d62ef
5 changed files with 62 additions and 9 deletions

View File

@@ -1702,12 +1702,13 @@ export default {
this.lineStyle1[type] = str;
}
},
onEdit(dataId) {
onEdit(dataId, options) {
this.currentContent = {};
this.picStyle = {};
this.lineStyle = {};
this.currentId = null;
this.clearButton();
const wmathId = options && options.wmathId;
var data = this.Main_List.find((item) => item.am_id == dataId);
// console.log('data at line 667:', data);
if (data.type == 1) {
@@ -1742,8 +1743,21 @@ export default {
this.editVisible = true;
this.currentId = dataId;
if (wmathId) {
this.$nextTick(() => this.openWmathInEditDialog(wmathId));
}
}
},
openWmathInEditDialog(wmathId, retry = 0) {
const content = this.$refs.commonContent;
if (!content || typeof content.openWmathForEdit !== 'function') {
if (retry < 40) {
setTimeout(() => this.openWmathInEditDialog(wmathId, retry + 1), 100);
}
return;
}
content.openWmathForEdit(wmathId);
},
onAddContent(dataId) {
this.addContentVisible = true;
this.addContent = {};

View File

@@ -1448,12 +1448,13 @@ export default {
this.lineStyle1[type] = str;
}
},
onEdit(dataId) {
onEdit(dataId, options) {
this.currentContent = {};
this.picStyle = {};
this.lineStyle = {};
this.currentId = null;
this.clearButton();
const wmathId = options && options.wmathId;
var data = this.Main_List.find((item) => item.am_id == dataId);
// console.log('data at line 667:', data);
if (data.type == 1) {
@@ -1488,8 +1489,21 @@ export default {
this.editVisible = true;
this.currentId = dataId;
if (wmathId) {
this.$nextTick(() => this.openWmathInEditDialog(wmathId));
}
}
},
openWmathInEditDialog(wmathId, retry = 0) {
const content = this.$refs.commonContent;
if (!content || typeof content.openWmathForEdit !== 'function') {
if (retry < 40) {
setTimeout(() => this.openWmathInEditDialog(wmathId, retry + 1), 100);
}
return;
}
content.openWmathForEdit(wmathId);
},
onAddContent(dataId) {
this.addContentVisible = true;
this.addContent = {};

View File

@@ -163,6 +163,24 @@ export default {
this.destroyTinymce();
},
methods: {
openWmathForEdit(wmathId, retry = 0) {
if (!wmathId) return;
const ed = window.tinymce.get(this.tinymceId);
if (!ed || !this.hasInit) {
if (retry < 40) {
setTimeout(() => this.openWmathForEdit(wmathId, retry + 1), 100);
}
return;
}
const wmath = ed.getBody().querySelector('wmath[data-id="' + wmathId + '"]');
if (wmath) {
this.$commonJS.editInlineMathWithMathlive(ed, wmath);
return;
}
if (retry < 40) {
setTimeout(() => this.openWmathForEdit(wmathId, retry + 1), 100);
}
},
handleSetContent(val) {
if (!this.editorInstance) return;

View File

@@ -84,6 +84,11 @@ export default {
getTinymceContent(type) {
this.$refs.tinymceChild1.getContent(type);
},
openWmathForEdit(wmathId) {
if (this.$refs.tinymceChild1 && typeof this.$refs.tinymceChild1.openWmathForEdit === 'function') {
this.$refs.tinymceChild1.openWmathForEdit(wmathId);
}
},
getContent(type, content) {
this.$emit('getContent', type, content);

View File

@@ -61,7 +61,6 @@
class="latex-toolbar-trigger"
@click.stop="toggleLatexPopover"
>
<i class="el-icon-s-data latex-toolbar-icon"></i>
{{ $t('commonTable.mathFormula') }}
</span>
</el-popover>
@@ -3036,6 +3035,14 @@ export default {
this.onProofSpanClick(event);
}
const wmathEl = event.target && event.target.closest && event.target.closest('wmath');
if (wmathEl && !this.isPreview) {
const wmathId = wmathEl.getAttribute('data-id');
await this.initializeEditor(event, item.am_id, 'text', item, index);
this.$emit('onEdit', item.am_id, wmathId ? { wmathId } : undefined);
return;
}
await this.initializeEditor(event, item.am_id, 'text', item, index);
},
initializeEditor: throttle(async function (event, id, type, data, index) {
@@ -4545,6 +4552,7 @@ export default {
wmath {
font-size: 14px !important;
cursor: pointer;
}
.word-tool {
border-bottom: 2px solid #c7cdcf;
@@ -4696,12 +4704,6 @@ font-weight: bold !important;
opacity: 0.9;
color: #fff;
}
.latex-toolbar-icon {
margin-right: 4px;
font-size: 13px;
color: #fff;
}
</style>
<style>
.latex-toolbar-popover {