|
|
@@ -2,7 +2,7 @@
|
|
|
<template>
|
|
|
<ModuleBase ref="base" :type="data.type">
|
|
|
<template #content>
|
|
|
- <div :style="{ width: data.note_list.length > 0 ? '' : '100%' }">
|
|
|
+ <div v-loading="loading" :style="{ width: data.note_list.length > 0 ? '' : '100%' }">
|
|
|
<RichText
|
|
|
v-if="property.isGetContent"
|
|
|
ref="richText"
|
|
|
@@ -161,6 +161,7 @@ export default {
|
|
|
inited: false,
|
|
|
paragraphVersion: 0,
|
|
|
tempNoteData: null,
|
|
|
+ loading: false,
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -337,38 +338,45 @@ export default {
|
|
|
data.is_match_annota = hasNotes; // 是否匹配注释,默认为 false
|
|
|
data.annota_list = hasNotes ? this.data.note_list : [];
|
|
|
|
|
|
- await PinyinBuild_OldFormat(data).then(({ parsed_text, rich_text }) => {
|
|
|
- if (parsed_text) {
|
|
|
- const mergedData = parsed_text.paragraph_list.map((outerArr, i) =>
|
|
|
- outerArr.map((innerArr, j) =>
|
|
|
- innerArr.map((newItem, k) => {
|
|
|
- const originalItem = this.data.paragraph_list[i]?.[j]?.[k];
|
|
|
- // 唯一性校验:位置+内容哈希
|
|
|
- const isSameItem =
|
|
|
- originalItem &&
|
|
|
- originalItem.hash === this.hashText(newItem.text) &&
|
|
|
- originalItem.id === `p${i}-l${j}-i${k}`;
|
|
|
- if (!newItem.pinyin) newItem.pinyin = newItem.text;
|
|
|
- let tmp = {
|
|
|
- ...newItem,
|
|
|
- id: `p${i}-l${j}-i${k}`,
|
|
|
- hash: this.hashText(newItem.text),
|
|
|
- ...(isSameItem && originalItem.activeTextStyle && { activeTextStyle: originalItem.activeTextStyle }),
|
|
|
- };
|
|
|
- if (styles) {
|
|
|
- if (!tmp.activeTextStyle) tmp.activeTextStyle = {};
|
|
|
- Object.assign(tmp.activeTextStyle, styles);
|
|
|
- }
|
|
|
- return tmp;
|
|
|
- }),
|
|
|
- ),
|
|
|
- );
|
|
|
- this.$set(this.data, 'paragraph_list', mergedData);
|
|
|
- this.paragraphVersion += 1;
|
|
|
- this.parseFClist(); // 确保在这里调用
|
|
|
- }
|
|
|
- this.$set(this.data, 'rich_text_list', rich_text.text_list);
|
|
|
- });
|
|
|
+ this.loading = true;
|
|
|
+ await PinyinBuild_OldFormat(data)
|
|
|
+ .then(({ parsed_text, rich_text }) => {
|
|
|
+ this.loading = false;
|
|
|
+ if (parsed_text) {
|
|
|
+ const mergedData = parsed_text.paragraph_list.map((outerArr, i) =>
|
|
|
+ outerArr.map((innerArr, j) =>
|
|
|
+ innerArr.map((newItem, k) => {
|
|
|
+ const originalItem = this.data.paragraph_list[i]?.[j]?.[k];
|
|
|
+ // 唯一性校验:位置+内容哈希
|
|
|
+ const isSameItem =
|
|
|
+ originalItem &&
|
|
|
+ originalItem.hash === this.hashText(newItem.text) &&
|
|
|
+ originalItem.id === `p${i}-l${j}-i${k}`;
|
|
|
+ if (!newItem.pinyin) newItem.pinyin = newItem.text;
|
|
|
+ let tmp = {
|
|
|
+ ...newItem,
|
|
|
+ id: `p${i}-l${j}-i${k}`,
|
|
|
+ hash: this.hashText(newItem.text),
|
|
|
+ ...(isSameItem &&
|
|
|
+ originalItem.activeTextStyle && { activeTextStyle: originalItem.activeTextStyle }),
|
|
|
+ };
|
|
|
+ if (styles) {
|
|
|
+ if (!tmp.activeTextStyle) tmp.activeTextStyle = {};
|
|
|
+ Object.assign(tmp.activeTextStyle, styles);
|
|
|
+ }
|
|
|
+ return tmp;
|
|
|
+ }),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ this.$set(this.data, 'paragraph_list', mergedData);
|
|
|
+ this.paragraphVersion += 1;
|
|
|
+ this.parseFClist(); // 确保在这里调用
|
|
|
+ }
|
|
|
+ this.$set(this.data, 'rich_text_list', rich_text.text_list);
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
},
|
|
|
// 开启拼音之后,拼音样式要跟随标题样式
|
|
|
createParsedTextStyleForTitle(styles) {
|
|
|
@@ -555,7 +563,11 @@ export default {
|
|
|
this.isViewExplanatoryNoteDialog = false;
|
|
|
},
|
|
|
// 设置备注
|
|
|
- selectContentSetMemo(data) {
|
|
|
+ selectContentSetMemo(data, annota_id) {
|
|
|
+ if (annota_id) {
|
|
|
+ this.data.note_list = this.data.note_list.filter((p) => p.id !== annota_id && p.annota_id !== annota_id);
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (!data) return;
|
|
|
// 统一 ID 字段,方便查找
|
|
|
const currentId = data.annota_id || data.id;
|