bianjiang 1 year ago
parent
commit
f0f94c9310

+ 7 - 11
src/modules/editor/components/CompUI/basicUI/Text/component.tsx

@@ -7,7 +7,7 @@ import { FontColor, FontFamily, FontSize } from "@ckeditor/ckeditor5-font";
 import { Link } from "@ckeditor/ckeditor5-link";
 import { Paragraph } from "@ckeditor/ckeditor5-paragraph";
 import { css } from "@linaria/core";
-import { defineComponent, ref, watch, watchEffect } from "vue";
+import { defineComponent, ref, watch, watchEffect, reactive } from "vue";
 import { string } from "vue-types";
 import { useCompData } from ".";
 import { View } from "../View";
@@ -54,10 +54,12 @@ export const Component = defineComponent({
 
     let editorInstance: InlineEditor;
     let timeOut = ref();
+    const state = reactive({
+      textEditing: false,
+    });
 
     watchEffect(() => {
-      console.log("1111", store.textEditingState);
-      if (!store.textEditingState) {
+      if (!state.textEditing) {
         editorInstance?.setData(comp.value);
       }
     });
@@ -79,21 +81,15 @@ export const Component = defineComponent({
           class={textStyle}
           editor={InlineEditor}
           onBlur={() => {
-            // actions.updateCompData(
-            //   helper.findComp(props.compId) as DesignComp,
-            //   "value",
-            //   editorInstance.getData()
-            // );
-            // store.setTextEditingState(false);
-
-            // console.log("blur", editorInstance);
             timeOut.value = setTimeout(() => {
+              state.textEditing = false;
               store.setTextEditingState(false);
               controls.historyCtrl.history.submit();
             }, 500);
           }}
           onFocus={() => {
             store.setTextEditingState(true);
+            state.textEditing = true;
           }}
           onInput={(e: any) => {
             if (editorInstance) {

+ 2 - 0
src/modules/editor/controllers/HistoryCtrl/HistoryController.ts

@@ -51,11 +51,13 @@ export class HistoryController {
   undo() {
     if (!this.state.canUndo) return;
     this.queue[this.state.opIndex--].undo();
+    console.log(this)
   }
 
   redo() {
     if (!this.state.canRedo) return;
     this.queue[++this.state.opIndex].redo();
+    console.log(this)
   }
 
   //清除操作