feat:backup

This commit is contained in:
1708-huayu 2024-09-28 22:21:21 +08:00
parent b6b1847b92
commit 1aba426886
4 changed files with 80 additions and 69 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -1,3 +1,4 @@
// 通过预加载脚本从渲染器访问Node.js
// 预加载脚本 在上下文隔离渲染器进程中导入 Node.js 和 Electron 模块的概念
// 所有的 Node.js API接口 都可以在 preload 进程中被调用.
// 它拥有与Chrome扩展一样的沙盒。

View File

@ -36,6 +36,7 @@ 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 <div className="editor-placeholder">记录一些灵感吧</div>;
}
@ -57,25 +58,29 @@ export default function Hlexical(props) {
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 (
// <Spin size="large" fullscreen="ture" spinning={spinningState}>
<LexicalComposer initialConfig={editorConfig}>
<div className="editor-container">
{/* 富文本插件 */}
<ToolbarPlugin/>
<div className="editor-inner">
<Spin size="large" fullscreen="ture" spinning={spinningState}>
<RichTextPlugin
contentEditable={<ContentEditable className="editor-input"/>}
placeholder={<Placeholder/>}
ErrorBoundary={LexicalErrorBoundary}
/> </Spin>
/>
<HistoryPlugin/>
{/*黑窗口动态记录当前操作*/}
{/*<TreeViewPlugin/>*/}
@ -121,15 +126,13 @@ export default function Hlexical(props) {
style={{
right: 94,
}}
icon={<CustomerServiceOutlined />}
>
icon={<CustomerServiceOutlined/>}>
<FloatButton/>
<FloatButton icon={<CommentOutlined/>}/>
</FloatButton.Group>
</div>
</div>
</LexicalComposer>
// </Spin>
);
}