feat:文件夹中打开

This commit is contained in:
1708-huayu 2024-09-29 16:38:59 +08:00
parent 1aba426886
commit 8a73b6f5b3
5 changed files with 384 additions and 376 deletions

View File

@ -1,4 +1,4 @@
const {app, Menu, BrowserWindow,ipcMain,dialog} = require('electron')
const {app, Menu, BrowserWindow,ipcMain,dialog,shell } = require('electron')
const path = require('path')
const {menuRebuild} = require('./elsrc/TopMenu.js')
const UploadUtils = require("./elsrc/sync/tencent/UploadUtils")
@ -93,6 +93,12 @@ app.whenReady().then(() => {
console.log("electronStoreDelete")
return store.delete(args)
})
ipcMain.handle("showOpenDialog",(listen,args)=>{
console.log("showOpenDialog:"+args)
// return dialog.showOpenDialog({defaultPath:args.filePath,
// properties: ['openFile']} )
return shell.openPath(args)
})
console.log("配置文件地址",app.getPath('userData')+"/config.json")
console.log("操作系统:"+process.platform)
})

View File

@ -11,6 +11,7 @@ import {
TRANSFORMERS, $convertFromMarkdownString,
} from "@lexical/markdown";
import "@/pages/Note/Hlexical/index.less"
import "@/pages/Note/Hlexical/theme.less"
import {importFile} from "@/utils/File"
import {isEmpty} from "@/utils/ObjectUtils";

View File

@ -64,7 +64,8 @@ h1 {
.editor-inner {
background: #fff;
position: relative;
height: 95%;
margin:20px;
height: 90%;
overflow: hidden auto;
}
@ -93,38 +94,6 @@ h1 {
pointer-events: none;
}
.editor-text-bold {
font-weight: bold;
}
.editor-text-italic {
font-style: italic;
}
.editor-text-underline {
text-decoration: underline;
}
.editor-text-strikethrough {
text-decoration: line-through;
}
.editor-text-underlineStrikethrough {
text-decoration: underline line-through;
}
.editor-text-code {
background-color: rgb(240, 242, 245);
padding: 1px 0.25rem;
font-family: Menlo, Consolas, Monaco, monospace;
font-size: 94%;
}
.editor-link {
color: rgb(33, 111, 219);
text-decoration: none;
}
.tree-view-output {
display: block;
background: #222;
@ -141,177 +110,6 @@ h1 {
line-height: 14px;
}
.editor-code {
background-color: rgb(240, 242, 245);
font-family: Menlo, Consolas, Monaco, monospace;
display: block;
padding: 8px 8px 8px 52px;
line-height: 1.53;
font-size: 13px;
margin: 0;
margin-top: 8px;
margin-bottom: 8px;
tab-size: 2;
white-space: pre;
overflow: auto;
position: relative;
}
.editor-code:before {
content: attr(data-gutter);
position: absolute;
background-color: #eee;
left: 0;
top: 0;
border-right: 1px solid #ccc;
padding: 8px;
color: #777;
white-space: pre-wrap;
text-align: right;
min-width: 25px;
}
.editor-code:after {
content: attr(data-highlight-language);
top: 0;
right: 3px;
padding: 3px;
font-size: 10px;
text-transform: uppercase;
position: absolute;
color: rgba(0, 0, 0, 0.5);
}
.editor-tokenComment {
color: slategray;
}
.editor-tokenPunctuation {
color: #999;
}
.editor-tokenProperty {
color: #905;
}
.editor-tokenSelector {
color: #690;
}
.editor-tokenOperator {
color: #9a6e3a;
}
.editor-tokenAttr {
color: #07a;
}
.editor-tokenVariable {
color: #e90;
}
.editor-tokenFunction {
color: #dd4a68;
}
.editor-paragraph {
margin: 0;
margin-bottom: 8px;
position: relative;
}
.editor-paragraph:last-child {
margin-bottom: 0;
}
.editor-heading-h1 {
font-size: 50px;
color: rgb(5, 5, 5);
font-weight: 400;
margin: 0;
margin-bottom: 25px;
padding: 0;
}
.editor-heading-h2 {
font-size: 45px;
//color: rgb(101, 103, 107);
//font-weight: 400;
color: rgb(5, 5, 5);
font-weight: 400;
margin: 0;
margin-top: 25px;
padding: 0;
//text-transform: uppercase;
}
.editor-heading-h3 {
font-size: 40px;
color: rgb(5, 5, 5);
font-weight: 400;
margin: 0;
margin-top: 20px;
padding: 0;
//text-transform: uppercase;
}
.editor-heading-h4 {
font-size: 35px;
color: rgb(5, 5, 5);
font-weight: 400;
margin: 0;
margin-top: 20px;
padding: 0;
//text-transform: uppercase;
}
.editor-heading-h5 {
font-size: 30px;
color: rgb(5, 5, 5);
font-weight: 400;
margin: 0;
margin-top: 15px;
padding: 0;
//text-transform: uppercase;
}
.editor-heading-h6 {
font-size: 25px;
color: rgb(5, 5, 5);
font-weight: 400;
margin: 0;
margin-top: 15px;
padding: 0;
//text-transform: uppercase;
}
.editor-quote {
margin: 0;
margin-left: 20px;
font-size: 15px;
color: rgb(101, 103, 107);
border-left-color: rgb(206, 208, 212);
border-left-width: 4px;
border-left-style: solid;
padding-left: 16px;
}
.editor-list-ol {
padding: 0;
margin: 0;
margin-left: 16px;
}
.editor-list-ul {
padding: 0;
margin: 0;
margin-left: 16px;
}
.editor-listitem {
margin: 8px 32px 8px 32px;
}
.editor-nested-listitem {
list-style-type: none;
}
pre::-webkit-scrollbar {
background: transparent;
width: 10px;
@ -814,143 +612,6 @@ i.justify-align {
background-image: url(images/icons/justify.svg);
}
.editor-table {
border-collapse: collapse;
border-spacing: 0;
overflow-y: scroll;
overflow-x: scroll;
table-layout: fixed;
width: max-content;
margin: 30px 0;
}
.editor-tableSelection *::selection {
background-color: transparent;
}
.editor-tableSelected {
outline: 2px solid rgb(60, 132, 244);
}
.editor-tableCell {
border: 1px solid #bbb;
width: 75px;
min-width: 75px;
vertical-align: top;
text-align: start;
padding: 6px 8px;
position: relative;
outline: none;
}
.editor-tableCellSortedIndicator {
display: block;
opacity: 0.5;
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 4px;
background-color: #999;
}
.editor-tableCellResizer {
position: absolute;
right: -4px;
height: 100%;
width: 8px;
cursor: ew-resize;
z-index: 10;
top: 0;
}
.editor-tableCellHeader {
background-color: #f2f3f5;
text-align: start;
}
.editor-tableCellSelected {
background-color: #c9dbf0;
}
.editor-tableCellPrimarySelected {
border: 2px solid rgb(60, 132, 244);
display: block;
height: calc(100% - 2px);
position: absolute;
width: calc(100% - 2px);
left: -1px;
top: -1px;
z-index: 2;
}
.editor-tableCellEditing {
box-shadow: 0 0 5px rgba(0, 0, 0, 0.4);
border-radius: 3px;
}
.editor-tableAddColumns {
position: absolute;
top: 0;
width: 20px;
background-color: #eee;
height: 100%;
right: -25px;
animation: table-controls 0.2s ease;
border: 0;
cursor: pointer;
}
.editor-tableAddColumns:after {
background-image: url(images/icons/plus.svg);
background-size: contain;
background-position: center;
background-repeat: no-repeat;
display: block;
content: ' ';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0.4;
}
.editor-tableAddColumns:hover {
background-color: #c9dbf0;
}
.editor-tableAddRows {
position: absolute;
bottom: -25px;
width: calc(100% - 25px);
background-color: #eee;
height: 20px;
left: 0;
animation: table-controls 0.2s ease;
border: 0;
cursor: pointer;
}
.editor-tableAddRows:after {
background-image: url(images/icons/plus.svg);
background-size: contain;
background-position: center;
background-repeat: no-repeat;
display: block;
content: ' ';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0.4;
}
.editor-tableAddRows:hover {
background-color: #c9dbf0;
}
@keyframes table-controls {
0% {
opacity: 0;
@ -960,37 +621,4 @@ i.justify-align {
}
}
.editor-tableCellResizeRuler {
display: block;
position: absolute;
width: 1px;
background-color: rgb(60, 132, 244);
height: 100%;
top: 0;
}
.editor-tableCellActionButtonContainer {
display: block;
right: 5px;
top: 6px;
position: absolute;
z-index: 4;
width: 20px;
height: 20px;
}
.editor-tableCellActionButton {
background-color: #eee;
display: block;
border: 0;
border-radius: 20px;
width: 20px;
height: 20px;
color: #222;
cursor: pointer;
}
.editor-tableCellActionButton:hover {
background-color: #ddd;
}

View File

@ -0,0 +1,371 @@
.editor-text-bold {
font-weight: bold;
}
.editor-text-italic {
font-style: italic;
}
.editor-text-underline {
text-decoration: underline;
}
.editor-text-strikethrough {
text-decoration: line-through;
}
.editor-text-underlineStrikethrough {
text-decoration: underline line-through;
}
.editor-text-code {
background-color: rgb(240, 242, 245);
padding: 1px 0.25rem;
font-family: Menlo, Consolas, Monaco, monospace;
font-size: 94%;
}
.editor-link {
color: rgb(33, 111, 219);
text-decoration: none;
}
.editor-code {
background-color: rgb(240, 242, 245);
font-family: Menlo, Consolas, Monaco, monospace;
display: block;
padding: 8px 8px 8px 52px;
line-height: 1.53;
font-size: 13px;
margin: 0;
margin-top: 8px;
margin-bottom: 8px;
tab-size: 2;
white-space: pre;
overflow: auto;
position: relative;
}
.editor-code:before {
content: attr(data-gutter);
position: absolute;
background-color: #eee;
left: 0;
top: 0;
border-right: 1px solid #ccc;
padding: 8px;
color: #777;
white-space: pre-wrap;
text-align: right;
min-width: 25px;
}
.editor-code:after {
content: attr(data-highlight-language);
top: 0;
right: 3px;
padding: 3px;
font-size: 10px;
text-transform: uppercase;
position: absolute;
color: rgba(0, 0, 0, 0.5);
}
.editor-tokenComment {
color: slategray;
}
.editor-tokenPunctuation {
color: #999;
}
.editor-tokenProperty {
color: #905;
}
.editor-tokenSelector {
color: #690;
}
.editor-tokenOperator {
color: #9a6e3a;
}
.editor-tokenAttr {
color: #07a;
}
.editor-tokenVariable {
color: #e90;
}
.editor-tokenFunction {
color: #dd4a68;
}
.editor-paragraph {
margin: 0;
margin-bottom: 8px;
position: relative;
}
.editor-paragraph:last-child {
margin-bottom: 0;
}
.editor-heading-h1 {
//font-size: 50px;
//color: rgb(5, 5, 5);
//font-weight: 400;
//margin: 0;
//margin-bottom: 25px;
//padding: 0;
}
.editor-heading-h2 {
//font-size: 45px;
//color: rgb(101, 103, 107);
//font-weight: 400;
//color: rgb(5, 5, 5);
//font-weight: 400;
//margin: 0;
//margin-top: 25px;
//padding: 0;
//text-transform: uppercase;
}
.editor-heading-h3 {
//font-size: 40px;
//color: rgb(5, 5, 5);
//font-weight: 400;
//margin: 0;
//margin-top: 20px;
//padding: 0;
//text-transform: uppercase;
}
.editor-heading-h4 {
//font-size: 35px;
//color: rgb(5, 5, 5);
//font-weight: 400;
//margin: 0;
//margin-top: 20px;
//padding: 0;
//text-transform: uppercase;
}
.editor-heading-h5 {
//font-size: 30px;
//color: rgb(5, 5, 5);
//font-weight: 400;
//margin: 0;
//margin-top: 15px;
//padding: 0;
//text-transform: uppercase;
}
.editor-heading-h6 {
//font-size: 25px;
//color: rgb(5, 5, 5);
//font-weight: 400;
//margin: 0;
//margin-top: 15px;
//padding: 0;
//text-transform: uppercase;
}
.editor-quote {
margin: 0;
margin-left: 20px;
font-size: 15px;
color: rgb(101, 103, 107);
border-left-color: rgb(206, 208, 212);
border-left-width: 4px;
border-left-style: solid;
padding-left: 16px;
}
.editor-list-ol {
padding: 0;
margin: 0;
margin-left: 16px;
}
.editor-list-ul {
padding: 0;
margin: 0;
margin-left: 16px;
}
.editor-listitem {
margin: 8px 32px 8px 32px;
}
.editor-nested-listitem {
list-style-type: none;
}
.editor-table {
border-collapse: collapse;
border-spacing: 0;
overflow-y: scroll;
overflow-x: scroll;
table-layout: fixed;
width: max-content;
margin: 30px 0;
}
.editor-tableSelection *::selection {
background-color: transparent;
}
.editor-tableSelected {
outline: 2px solid rgb(60, 132, 244);
}
.editor-tableCell {
border: 1px solid #bbb;
width: 75px;
min-width: 75px;
vertical-align: top;
text-align: start;
padding: 6px 8px;
position: relative;
outline: none;
}
.editor-tableCellSortedIndicator {
display: block;
opacity: 0.5;
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 4px;
background-color: #999;
}
.editor-tableCellResizer {
position: absolute;
right: -4px;
height: 100%;
width: 8px;
cursor: ew-resize;
z-index: 10;
top: 0;
}
.editor-tableCellHeader {
background-color: #f2f3f5;
text-align: start;
}
.editor-tableCellSelected {
background-color: #c9dbf0;
}
.editor-tableCellPrimarySelected {
border: 2px solid rgb(60, 132, 244);
display: block;
height: calc(100% - 2px);
position: absolute;
width: calc(100% - 2px);
left: -1px;
top: -1px;
z-index: 2;
}
.editor-tableCellEditing {
box-shadow: 0 0 5px rgba(0, 0, 0, 0.4);
border-radius: 3px;
}
.editor-tableAddColumns {
position: absolute;
top: 0;
width: 20px;
background-color: #eee;
height: 100%;
right: -25px;
animation: table-controls 0.2s ease;
border: 0;
cursor: pointer;
}
.editor-tableAddColumns:after {
background-image: url(images/icons/plus.svg);
background-size: contain;
background-position: center;
background-repeat: no-repeat;
display: block;
content: ' ';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0.4;
}
.editor-tableAddColumns:hover {
background-color: #c9dbf0;
}
.editor-tableAddRows {
position: absolute;
bottom: -25px;
width: calc(100% - 25px);
background-color: #eee;
height: 20px;
left: 0;
animation: table-controls 0.2s ease;
border: 0;
cursor: pointer;
}
.editor-tableAddRows:after {
background-image: url(images/icons/plus.svg);
background-size: contain;
background-position: center;
background-repeat: no-repeat;
display: block;
content: ' ';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0.4;
}
.editor-tableAddRows:hover {
background-color: #c9dbf0;
}
.editor-tableCellResizeRuler {
display: block;
position: absolute;
width: 1px;
background-color: rgb(60, 132, 244);
height: 100%;
top: 0;
}
.editor-tableCellActionButtonContainer {
display: block;
right: 5px;
top: 6px;
position: absolute;
z-index: 4;
width: 20px;
height: 20px;
}
.editor-tableCellActionButton {
background-color: #eee;
display: block;
border: 0;
border-radius: 20px;
width: 20px;
height: 20px;
color: #222;
cursor: pointer;
}
.editor-tableCellActionButton:hover {
background-color: #ddd;
}

View File

@ -54,5 +54,7 @@ export async function saveFileWithName(){
}
export async function openInDir(filePath){
return dialog.showOpenDialog({defaultPath:"filePath",properties: ['openDirectory']} )
// return dialog.showOpenDialog({defaultPath:filePath,properties: ['openDirectory']} )
console.log("pathOp.dirname(filePath.filePath)"+pathOp.dirname(filePath.filePath))
return ipcRenderer.invoke("showOpenDialog",pathOp.dirname(filePath.filePath))
}