bianjiang 1 ano atrás
pai
commit
c26225ec23

+ 10 - 57
src/modules/editor/components/CompUI/basicUI/Text/component2.tsx

@@ -106,6 +106,11 @@ const EditorComp = defineComponent({
           out.in = true;
           return out;
         }
+        const ckBodyWrapper = document.querySelector(".ck-body-wrapper");
+        if (ckBodyWrapper === dom || ckBodyWrapper?.contains(dom)) {
+          out.in = true;
+          return out;
+        }
       }
 
       let n = 0;
@@ -113,12 +118,12 @@ const EditorComp = defineComponent({
       do {
         if (
           curr.id == "toptoolbar" ||
-          curr.class.contains(".pcr-app") ||
-          curr.class.contains(".editor_toolbar_drop") ||
-          curr.class.contains(".ant-select-dropdown") ||
-          curr.class.contains(".ck-body-wrapper")
+          curr.classList.contains("pcr-app") ||
+          curr.classList.contains("editor_toolbar_drop") ||
+          curr.classList.contains("ant-select-dropdown")
         ) {
           out.in = true;
+          out.stop = false;
           return out;
         }
         curr = curr.parentElement;
@@ -207,50 +212,6 @@ const EditorComp = defineComponent({
     return () => {
       return <div class={textStyle} id={`editor_${props.compId}`}></div>;
     };
-
-    // return () => (
-
-    //   <ckeditor
-    //     class={textStyle}
-    //     ref={inputRef}
-    //     editor={InlineEditor}
-    //     onInput={(value: any) => {
-    //       if (editorInstance.value && comp.value !== value) {
-    //         actions.updateCompData(comp, "value", value);
-    //         nextTick(() => {
-    //           const h = helper.pxToDesignSize(inputRef.value?.$el.clientHeight);
-    //           const isChange = Math.abs(preHeight.value - h) > 1;
-    //           preHeight.value = h;
-    //           actions.updateCompDatas(
-    //             comp,
-    //             ["value", "layout.size.1"],
-    //             [value, preHeight.value]
-    //           );
-    //           helper.extendStreamCard(store.currStreamCardId);
-    //           if (isChange) {
-    //             console.log("changing=>", isChange);
-    //             actions.selectObjs([]);
-    //             setTimeout(() => {
-    //               actions.selectObjs([props.compId]);
-    //             }, 0);
-    //           }
-    //         });
-    //       }
-    //     }}
-    //     onReady={(editor: InlineEditor) => {
-    //       editorInstance.value = editor;
-    //       console.log("editor");
-    //       editor.setData(comp.value);
-    //       editor.focus();
-    //       const range = document.createRange();
-    //       range.selectNodeContents(inputRef.value.$el);
-    //       const selection = window.getSelection();
-    //       selection?.removeAllRanges();
-    //       selection?.addRange(range);
-    //     }}
-    //     config={GetConfig()}
-    //   />
-    // );
   },
 });
 
@@ -259,15 +220,7 @@ const textStyle = css`
   width: 100%;
   color: #666;
   word-break: break-all;
-  h2 {
-    color: #111;
-    font-size: 24px;
-    font-weight: 600;
-  }
-  h3 {
-    font-size: 18px;
-    color: #333;
-  }
+
   p {
     margin: 0;
   }

+ 2 - 2
src/modules/editor/components/Viewport/Slider/SliderLeft/Text.tsx

@@ -33,7 +33,7 @@ export default defineUI({
                 class={"btn_item text-16px font-600"}
                 onClick={() => {
                   const h2 =
-                    '<h2 style="line-height:1.5;text-align:center;">请输入标题</h2>';
+                    '<p style="line-height:1.5;text-align:center;"><span style="color:#111111;font-size:24px"><strong>请输入标题</strong></span></p>';
                   editor.actions.clickCompToDesign(
                     "Text",
                     (comp: DesignComp) => {
@@ -48,7 +48,7 @@ export default defineUI({
                 class={"btn_item font-600"}
                 onClick={() => {
                   const h3 =
-                    '<h3 style="line-height:1.5;text-align:center;">请输入副标题</h3>';
+                    '<p style="line-height:1.5;text-align:center;"><span style="color:#333333;font-size:18px">请输入副标题</span></p>';
                   editor.actions.clickCompToDesign(
                     "Text",
                     (comp: DesignComp) => {