diff --git a/elsrc/sync/tencent/UploadUtils.js b/elsrc/sync/tencent/UploadUtils.js index 748d104..3256e12 100644 --- a/elsrc/sync/tencent/UploadUtils.js +++ b/elsrc/sync/tencent/UploadUtils.js @@ -20,6 +20,10 @@ class UploadUtils { UploadUtils.staticStore = store; } getActiveFile() { + let persist = this.store.get("persist:tableBarItem"); + if (persist === undefined){ + return undefined + } let tableBarItem = JSON.parse(this.store.get("persist:tableBarItem")); if (!tableBarItem) { return; diff --git a/main.js b/main.js index ce82780..84616d4 100644 --- a/main.js +++ b/main.js @@ -15,6 +15,9 @@ const createWindow = () => { nodeIntegration: true, // 启用后nodeIntegration会无效 contextIsolation: false, + // 添加预加载脚本 + // __dirname 字符串指向当前正在执行脚本的路径 + // path.join API 将多个路径联结在一起,创建一个跨平台的路径字符串。 preload: path.join(__dirname, 'preload.js') } }) @@ -40,7 +43,7 @@ const createWindow = () => { event.preventDefault() } // console.log('Pressed ',input.key) - if (input.key.toUpperCase() === 'F5' && input.type.toLowerCase() === "keydown" && input.isAutoRepeat === false) { + if (input.key.toUpperCase() === 'F5' && input.isAutoRepeat === false) { win.reload() } if (input.key.toUpperCase() === 'F12' && input.type.toLowerCase() === "keydown" && input.isAutoRepeat === false) { diff --git a/preload.js b/preload.js index b31d73f..ad7fb1c 100644 --- a/preload.js +++ b/preload.js @@ -1,3 +1,4 @@ +// 通过预加载脚本从渲染器访问Node.js // 预加载脚本 在上下文隔离渲染器进程中导入 Node.js 和 Electron 模块的概念 // 所有的 Node.js API接口 都可以在 preload 进程中被调用. // 它拥有与Chrome扩展一样的沙盒。 diff --git a/src/pages/Note/Hlexical/index.jsx b/src/pages/Note/Hlexical/index.jsx index 2e6ae7d..73b6b7b 100644 --- a/src/pages/Note/Hlexical/index.jsx +++ b/src/pages/Note/Hlexical/index.jsx @@ -31,11 +31,12 @@ import TableCellActionMenuPlugin from '@/pages/Note/Hlexical/plugins/TableAction import ExcalidrawPlugin from "@/pages/Note/Hlexical/plugins/ExcalidrawPlugin"; import TableOfContentsPlugin from "@/pages/Note/Hlexical/plugins/TableOfContentsPlugin"; import ContextMenuPlugin from "@/pages/Note/Hlexical/plugins/ContextMenuPlugin" -import {Spin,FloatButton } from "antd"; -import { CommentOutlined, CustomerServiceOutlined } from '@ant-design/icons'; +import {Spin, FloatButton} from "antd"; +import {CommentOutlined, CustomerServiceOutlined} from '@ant-design/icons'; import {useState} from "react"; import DragDropPaste from "@/pages/Note/Hlexical/plugins/DragDropPastePlugin"; import TreeViewPlugin from "@/pages/Note/Hlexical/plugins/TreeViewPlugin"; + function Placeholder() { return
记录一些灵感吧
; } @@ -48,88 +49,90 @@ export default function Hlexical(props) { }, nodes: UsefulNodes }; - const [spinningState,setSpinningState]=useState(!isEmpty(props.filePath)) + const [spinningState, setSpinningState] = useState(!isEmpty(props.filePath)) console.log("Hlexical(props):this.props.filePath:", props.filePath) - if (!isEmpty(props.filePath)&&props.filePath.endsWith(".md")){ + if (!isEmpty(props.filePath) && props.filePath.endsWith(".md")) { let promise = importFile(props.filePath); promise.then(value => { if (isEmpty(value)) { setSpinningState(false) return } - editorConfig={...editorConfig,editorState: () => $convertFromMarkdownString(value.toString(), TRANSFORMERS)} + editorConfig = { + ...editorConfig, + editorState: () => $convertFromMarkdownString(value.toString(), TRANSFORMERS) + } setSpinningState(false) }).catch(error => console.error(error) ) } return ( + // + +
+ {/* 富文本插件 */} + +
- -
- {/* 富文本插件 */} - -
- - } - placeholder={} - ErrorBoundary={LexicalErrorBoundary} - /> - - {/*黑窗口动态记录当前操作*/} - {/**/} - - - - - - - {/* 表格操作 */} - - {/* 表格单元格操作 */} - - - {/*markdown 快捷键*/} - - {/*图片加载*/} - - + } + placeholder={} + ErrorBoundary={LexicalErrorBoundary} + /> - {/*分割线 */} - - {/*页分割线*/} + + {/*黑窗口动态记录当前操作*/} + {/**/} + + + + + + + {/* 表格操作 */} + + {/* 表格单元格操作 */} + + + {/*markdown 快捷键*/} + + {/*图片加载*/} + + - {/*目录加载*/} - - {/*右键菜单*/} - - {/* 画图 */} - - {/* 拖拽复制*/} - - - - {/*文件操作导入文件*/} - {/**/} - } - > - - } /> - + {/*分割线 */} + + {/*页分割线*/} + + {/*目录加载*/} + + {/*右键菜单*/} + + {/* 画图 */} + + {/* 拖拽复制*/} + + + + {/*文件操作导入文件*/} + {/**/} + }> + + }/> + +
-
- - - + + // ); }