feat:backup
This commit is contained in:
parent
b6b1847b92
commit
1aba426886
|
@ -20,6 +20,10 @@ class UploadUtils {
|
||||||
UploadUtils.staticStore = store;
|
UploadUtils.staticStore = store;
|
||||||
}
|
}
|
||||||
getActiveFile() {
|
getActiveFile() {
|
||||||
|
let persist = this.store.get("persist:tableBarItem");
|
||||||
|
if (persist === undefined){
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
let tableBarItem = JSON.parse(this.store.get("persist:tableBarItem"));
|
let tableBarItem = JSON.parse(this.store.get("persist:tableBarItem"));
|
||||||
if (!tableBarItem) {
|
if (!tableBarItem) {
|
||||||
return;
|
return;
|
||||||
|
|
5
main.js
5
main.js
|
@ -15,6 +15,9 @@ const createWindow = () => {
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
// 启用后nodeIntegration会无效
|
// 启用后nodeIntegration会无效
|
||||||
contextIsolation: false,
|
contextIsolation: false,
|
||||||
|
// 添加预加载脚本
|
||||||
|
// __dirname 字符串指向当前正在执行脚本的路径
|
||||||
|
// path.join API 将多个路径联结在一起,创建一个跨平台的路径字符串。
|
||||||
preload: path.join(__dirname, 'preload.js')
|
preload: path.join(__dirname, 'preload.js')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -40,7 +43,7 @@ const createWindow = () => {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
}
|
}
|
||||||
// console.log('Pressed ',input.key)
|
// 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()
|
win.reload()
|
||||||
}
|
}
|
||||||
if (input.key.toUpperCase() === 'F12' && input.type.toLowerCase() === "keydown" && input.isAutoRepeat === false) {
|
if (input.key.toUpperCase() === 'F12' && input.type.toLowerCase() === "keydown" && input.isAutoRepeat === false) {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// 通过预加载脚本从渲染器访问Node.js
|
||||||
// 预加载脚本 在上下文隔离渲染器进程中导入 Node.js 和 Electron 模块的概念
|
// 预加载脚本 在上下文隔离渲染器进程中导入 Node.js 和 Electron 模块的概念
|
||||||
// 所有的 Node.js API接口 都可以在 preload 进程中被调用.
|
// 所有的 Node.js API接口 都可以在 preload 进程中被调用.
|
||||||
// 它拥有与Chrome扩展一样的沙盒。
|
// 它拥有与Chrome扩展一样的沙盒。
|
||||||
|
|
|
@ -36,6 +36,7 @@ import { CommentOutlined, CustomerServiceOutlined } from '@ant-design/icons';
|
||||||
import {useState} from "react";
|
import {useState} from "react";
|
||||||
import DragDropPaste from "@/pages/Note/Hlexical/plugins/DragDropPastePlugin";
|
import DragDropPaste from "@/pages/Note/Hlexical/plugins/DragDropPastePlugin";
|
||||||
import TreeViewPlugin from "@/pages/Note/Hlexical/plugins/TreeViewPlugin";
|
import TreeViewPlugin from "@/pages/Note/Hlexical/plugins/TreeViewPlugin";
|
||||||
|
|
||||||
function Placeholder() {
|
function Placeholder() {
|
||||||
return <div className="editor-placeholder">记录一些灵感吧</div>;
|
return <div className="editor-placeholder">记录一些灵感吧</div>;
|
||||||
}
|
}
|
||||||
|
@ -57,25 +58,29 @@ export default function Hlexical(props) {
|
||||||
setSpinningState(false)
|
setSpinningState(false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
editorConfig={...editorConfig,editorState: () => $convertFromMarkdownString(value.toString(), TRANSFORMERS)}
|
editorConfig = {
|
||||||
|
...editorConfig,
|
||||||
|
editorState: () => $convertFromMarkdownString(value.toString(), TRANSFORMERS)
|
||||||
|
}
|
||||||
setSpinningState(false)
|
setSpinningState(false)
|
||||||
}).catch(error =>
|
}).catch(error =>
|
||||||
console.error(error)
|
console.error(error)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
// <Spin size="large" fullscreen="ture" spinning={spinningState}>
|
||||||
<LexicalComposer initialConfig={editorConfig}>
|
<LexicalComposer initialConfig={editorConfig}>
|
||||||
<div className="editor-container">
|
<div className="editor-container">
|
||||||
{/* 富文本插件 */}
|
{/* 富文本插件 */}
|
||||||
<ToolbarPlugin/>
|
<ToolbarPlugin/>
|
||||||
<div className="editor-inner">
|
<div className="editor-inner">
|
||||||
<Spin size="large" fullscreen="ture" spinning={spinningState}>
|
|
||||||
<RichTextPlugin
|
<RichTextPlugin
|
||||||
contentEditable={<ContentEditable className="editor-input"/>}
|
contentEditable={<ContentEditable className="editor-input"/>}
|
||||||
placeholder={<Placeholder/>}
|
placeholder={<Placeholder/>}
|
||||||
ErrorBoundary={LexicalErrorBoundary}
|
ErrorBoundary={LexicalErrorBoundary}
|
||||||
/> </Spin>
|
/>
|
||||||
|
|
||||||
<HistoryPlugin/>
|
<HistoryPlugin/>
|
||||||
{/*黑窗口动态记录当前操作*/}
|
{/*黑窗口动态记录当前操作*/}
|
||||||
{/*<TreeViewPlugin/>*/}
|
{/*<TreeViewPlugin/>*/}
|
||||||
|
@ -121,15 +126,13 @@ export default function Hlexical(props) {
|
||||||
style={{
|
style={{
|
||||||
right: 94,
|
right: 94,
|
||||||
}}
|
}}
|
||||||
icon={<CustomerServiceOutlined />}
|
icon={<CustomerServiceOutlined/>}>
|
||||||
>
|
|
||||||
<FloatButton/>
|
<FloatButton/>
|
||||||
<FloatButton icon={<CommentOutlined/>}/>
|
<FloatButton icon={<CommentOutlined/>}/>
|
||||||
</FloatButton.Group>
|
</FloatButton.Group>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</LexicalComposer>
|
</LexicalComposer>
|
||||||
|
// </Spin>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue