Эх сурвалжийг харах

设置文档不自动更新

yangg 9 сар өмнө
parent
commit
5fb7576dbb

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/index.html


+ 0 - 0
dist/static/css/chunk-1e29e156.ce959b8e.css → dist/static/css/chunk-055b9087.ce959b8e.css


+ 0 - 0
dist/static/css/chunk-2dc9c3d8.68741a84.css → dist/static/css/chunk-d38ceedc.68741a84.css


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/app.e130f54f.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/chunk-055b9087.1f98206c.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/chunk-1e29e156.0417b509.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/chunk-2dc9c3d8.995e1d81.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/chunk-d38ceedc.52772c66.js


+ 19 - 7
src/views/document/com/components/TextArea/index.vue

@@ -916,7 +916,7 @@ export default {
 
           // Update the content and notify parent component
           this.$nextTick(() => {
-            this.updateContentWithNewImage(uploadedUrl);
+            this.updateContentWithNewImage(imgElement, uploadedUrl);
           });
         }
       } catch (error) {
@@ -924,14 +924,26 @@ export default {
       }
     },
 
-    updateContentWithNewImage(newImageUrl) {
-      // Get the latest DOM content
-      const latestContent = this.$refs.richEditor.innerHTML;
+    updateContentWithNewImage(imgElement, newImageUrl) {
+      // Get the rich-editor div
+      const richEditor = this.$refs.richEditor;
 
-      // Update this.content with the latest DOM content
-      this.content = latestContent;
+      // Create a new Image element with the new URL
+      const newImg = document.createElement("img");
+      newImg.src = newImageUrl;
+
+      // Copy attributes from the old image to the new one
+      for (let attr of imgElement.attributes) {
+        if (attr.name !== "src") {
+          newImg.setAttribute(attr.name, attr.value);
+        }
+      }
+
+      // Replace the old image with the new one
+      imgElement.parentNode.replaceChild(newImg, imgElement);
 
-      console.log("Updated content:", this.content);
+      // Update this.content with the latest DOM content
+      this.content = richEditor.innerHTML;
 
       // Update the com object
       this.com.content = this.content;

+ 8 - 3
src/views/document/create.vue

@@ -402,7 +402,7 @@
             <span v-else>查看模版</span>
           </div>
           <div
-          v-if="type !== 'document'"
+            v-if="type !== 'document'"
             class="sidebar-item"
             :class="showView == 1 ? 'active-item' : ''"
             @click="viewModule"
@@ -1289,6 +1289,7 @@ export default {
     },
     //加载文档信息
     async onLoadArticle(id) {
+      console.log("文档");
       try {
         this.loading = true;
         const res = await getDocumentInfo({ id });
@@ -1317,13 +1318,16 @@ export default {
 
         const updatedComs = await Promise.all(
           templateData.map(async (el) => {
-            const templateInfo = await getTemplateInfo({ id: el.id });
+            let templateInfo = { data: {} };
+            if (this.type !== "document") {
+              templateInfo = await getTemplateInfo({ id: el.id });
+            }
             const formulaData = await searchFormula({ page: 1, pageSize: 999 });
 
             const attrs =
               typeof templateInfo.data.attrs === "string"
                 ? JSON.parse(templateInfo.data.attrs)
-                : templateInfo.data.attrs;
+                : templateInfo.data.attrs || []; // Add a fallback empty array
 
             attrs.forEach((item) => {
               const matchedFormula = formulaData.data.dataList.find(
@@ -1355,6 +1359,7 @@ export default {
     },
     /* 加载模版信息 */
     async onTemplateInfo(id) {
+      console.log("模版");
       try {
         this.loading = true;
         const res = await getDocumentInfo({ id });

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно