diff --git a/src/components/SuperSideBar/impl/ClipAssistant/index.module.less b/src/components/SuperSideBar/impl/ClipAssistant/index.module.less index 3cc54686..56a5c7f1 100644 --- a/src/components/SuperSideBar/impl/ClipAssistant/index.module.less +++ b/src/components/SuperSideBar/impl/ClipAssistant/index.module.less @@ -25,8 +25,8 @@ .headerWrapper { flex: 0 0 auto; display: flex; - padding: 16px 10px 0; - gap: 30px; + padding: 16px 18px 0; + gap: 20px; .headerItem { cursor: pointer; @@ -53,7 +53,7 @@ flex: 0 0 auto; .title { - padding: 0 16px; + padding: 0 24px; color: @text-primary; font-weight: 500; font-size: @font-size-lg; diff --git a/src/components/lake-editor/template-html.ts b/src/components/lake-editor/template-html.ts index 59027083..77b09d6d 100644 --- a/src/components/lake-editor/template-html.ts +++ b/src/components/lake-editor/template-html.ts @@ -56,7 +56,7 @@ export const templateHtml = ` height: 100%; } .ne-layout-mode-fixed .ne-engine, .ne-layout-mode-adapt .ne-engine { - padding: 16px 16px 0; + padding: 16px 24px 0; min-height: calc(100vh - 10px) } .ne-layout-mode-fixed .ne-editor-wrap-content { diff --git a/src/pages/inject/WordMark/Editor/index.tsx b/src/pages/inject/WordMark/Editor/index.tsx index ae529f40..74f16b9e 100644 --- a/src/pages/inject/WordMark/Editor/index.tsx +++ b/src/pages/inject/WordMark/Editor/index.tsx @@ -4,6 +4,7 @@ import React, { useEffect, useImperativeHandle, useRef, + useState, } from 'react'; import { EDITOR_IFRAME_CONTAINER_ID, @@ -75,6 +76,7 @@ const getRequestID = (() => { export default forwardRef((props, ref) => { const iframeRef = useRef(null); const sendMessageRef = useRef<(data: any) => Promise>(); + const [needLoadEditor, setNeedLoadEditor] = useState(true); useEffect(() => { const resolveCache: Map void> = new Map(); @@ -169,6 +171,25 @@ export default forwardRef((props, ref) => { [sendMessage], ); + useEffect(() => { + // 当页面可见性发生改变时,如果发现用户未使用过插件,释放掉 editor iframe + const onVisibilitychange = () => { + if (document.hidden) { + setNeedLoadEditor(false); + } else { + setNeedLoadEditor(true); + } + }; + document.addEventListener('visibilitychange', onVisibilitychange); + return () => { + document.removeEventListener('visibilitychange', onVisibilitychange); + }; + }, []); + + if (!needLoadEditor) { + return null; + } + return (