markdown 读取
This commit is contained in:
parent
de64b9a766
commit
d96232128a
53
app.go
53
app.go
@ -1,53 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
)
|
||||
|
||||
// App struct
|
||||
type App struct {
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
// NewApp creates a new App application struct
|
||||
// NewApp 创建一个新的 App 应用程序
|
||||
func NewApp() *App {
|
||||
return &App{}
|
||||
}
|
||||
|
||||
// startup is called at application startup
|
||||
// startup 在应用程序启动时调用
|
||||
func (a *App) startup(ctx context.Context) {
|
||||
// Perform your setup here
|
||||
// 在这里执行初始化设置
|
||||
a.ctx = ctx
|
||||
}
|
||||
|
||||
// domReady is called after the front-end dom has been loaded
|
||||
// domReady 在前端Dom加载完毕后调用
|
||||
func (a *App) domReady(ctx context.Context) {
|
||||
// Add your action here
|
||||
// 在这里添加你的操作
|
||||
}
|
||||
|
||||
// beforeClose is called when the application is about to quit,
|
||||
// either by clicking the window close button or calling runtime.Quit.
|
||||
// Returning true will cause the application to continue,
|
||||
// false will continue shutdown as normal.
|
||||
// beforeClose在单击窗口关闭按钮或调用runtime.Quit即将退出应用程序时被调用.
|
||||
// 返回 true 将导致应用程序继续,false 将继续正常关闭。
|
||||
func (a *App) beforeClose(ctx context.Context) (prevent bool) {
|
||||
return false
|
||||
}
|
||||
|
||||
// shutdown is called at application termination
|
||||
// 在应用程序终止时被调用
|
||||
func (a *App) shutdown(ctx context.Context) {
|
||||
// Perform your teardown here
|
||||
// 在此处做一些资源释放的操作
|
||||
}
|
||||
|
||||
func (a *App) Exit() {
|
||||
os.Exit(0)
|
||||
}
|
@ -19,6 +19,7 @@
|
||||
"@toast-ui/vue-editor": "^3.2.3",
|
||||
"@types/prismjs": "^1.26.3",
|
||||
"@vueuse/core": "^10.7.2",
|
||||
"axios": "^1.6.7",
|
||||
"element-plus": "^2.5.5",
|
||||
"eruda": "^3.0.1",
|
||||
"pinia": "^2.0.21",
|
||||
|
@ -1 +1 @@
|
||||
ed9d649d63f25396331411c05754112e
|
||||
c5ef7295ec7f4bb6126fdb8f810346b1
|
@ -1,16 +1,26 @@
|
||||
<script setup lang="ts">
|
||||
import {useI18n} from "vue-i18n";
|
||||
import {WindowMinimise} from "../wailsjs/runtime";
|
||||
import {ForceClose} from "../wailsjs/go/core/App";
|
||||
import {ForceClose, GetConfig} from "../wailsjs/go/core/App";
|
||||
import {useGlobalConfig} from "@/stores/globalConfig";
|
||||
import {watch,onBeforeUnmount } from "vue";
|
||||
import {useMagicKeys, whenever} from "@vueuse/core";
|
||||
import {destroyDebugger, switchDebugger} from "@/utils/debugger/eruda";
|
||||
import {initApi} from "@/api";
|
||||
|
||||
const {t, availableLocales: languages, locale} = useI18n();
|
||||
let globalConfig = useGlobalConfig();
|
||||
const elementUIConfig = globalConfig.ui
|
||||
|
||||
GetConfig().then((config)=>{
|
||||
let host = config.server.host;
|
||||
if(host === "0.0.0.0"){
|
||||
host = "127.0.0.1"
|
||||
}
|
||||
initApi(`http://${host}:${config.server.port}`)
|
||||
})
|
||||
|
||||
|
||||
watch(locale,(value)=>{
|
||||
if(elementUIConfig.supportLocale[value]){
|
||||
elementUIConfig.locale = elementUIConfig.supportLocale[value]
|
||||
|
36
frontend/src/api/index.ts
Normal file
36
frontend/src/api/index.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import {getAxiosInstance} from "@/utils/axios";
|
||||
|
||||
export const http = getAxiosInstance({
|
||||
timeout: 60 * 1000
|
||||
})
|
||||
|
||||
export default http;
|
||||
|
||||
export interface ReadFileParams {
|
||||
chunkSize?: number
|
||||
offset?: number,
|
||||
path: string
|
||||
}
|
||||
|
||||
export class Api {
|
||||
server:string
|
||||
constructor(server:string) {
|
||||
this.server = server
|
||||
}
|
||||
|
||||
readFile(params: ReadFileParams){
|
||||
return http.get(`${this.server}/s/file/`,{
|
||||
params: params
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
let api = new Api("")
|
||||
|
||||
export function initApi(server:string){
|
||||
api = new Api(server)
|
||||
}
|
||||
|
||||
export function useApi(){
|
||||
return api
|
||||
}
|
@ -24,6 +24,8 @@ import tableMergedCell from "@toast-ui/editor-plugin-table-merged-cell"
|
||||
import uml from "@toast-ui/editor-plugin-uml"
|
||||
|
||||
import {useI18n} from "vue-i18n";
|
||||
import {OpenFileDialog} from "../../../wailsjs/go/core/App";
|
||||
import {useApi} from "@/api";
|
||||
|
||||
const emit = defineEmits([
|
||||
"update:modelValue"
|
||||
@ -49,7 +51,6 @@ function initEditor(editorRef:Ref<any>){
|
||||
let editor = new Editor({
|
||||
theme: "dark",
|
||||
el: editorRef.value,
|
||||
// language: 'en-US',
|
||||
language: locale.value,
|
||||
previewStyle: 'vertical',
|
||||
height: '85vh',
|
||||
@ -88,9 +89,9 @@ function initEditor(editorRef:Ref<any>){
|
||||
|
||||
return editor;
|
||||
}
|
||||
|
||||
let editor:any = {}
|
||||
onMounted(() => {
|
||||
let editor = initEditor(editorRef);
|
||||
editor = initEditor(editorRef);
|
||||
watch(locale, value => {
|
||||
let markdown = editor.getMarkdown()
|
||||
editor.destroy()
|
||||
@ -103,9 +104,33 @@ onMounted(() => {
|
||||
const ctx = reactive({
|
||||
data: ""
|
||||
})
|
||||
|
||||
function openFile(){
|
||||
OpenFileDialog({
|
||||
title: "打开 markdown 文件",
|
||||
filters: [
|
||||
{
|
||||
displayName: "Markdown",
|
||||
pattern: "*.md;*.markdown"
|
||||
}
|
||||
]
|
||||
}).then(path=>{
|
||||
console.log(path)
|
||||
|
||||
if(!path){
|
||||
return
|
||||
}
|
||||
|
||||
useApi().readFile({path}).then(resp=>{
|
||||
editor.setMarkdown(resp.data)
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-button type="primary" @click="openFile">打开</el-button>
|
||||
<el-button type="success">保存</el-button>
|
||||
<div ref="editorRef" class="overscroll-none"/>
|
||||
</template>
|
||||
|
||||
|
@ -1,13 +1,14 @@
|
||||
import { createApp } from "vue";
|
||||
import { createPinia } from "pinia";
|
||||
|
||||
import "./style.scss";
|
||||
import App from "./App.vue";
|
||||
import router from "./router";
|
||||
import i18n from "./i18n";
|
||||
import ElementPlus from "element-plus";
|
||||
import "element-plus/dist/index.css"
|
||||
|
||||
import "./style.scss";
|
||||
|
||||
|
||||
// import "./assets/main.css";
|
||||
|
||||
|
63
frontend/src/utils/axios/index.ts
Normal file
63
frontend/src/utils/axios/index.ts
Normal file
@ -0,0 +1,63 @@
|
||||
import type {AxiosInstance, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig} from "axios";
|
||||
import axios from "axios";
|
||||
import {ElNotification} from "element-plus";
|
||||
|
||||
export function getAxiosInstance(axiosRequestConfig: AxiosRequestConfig): AxiosInstance {
|
||||
let instance = axios.create(axiosRequestConfig);
|
||||
// 全局 请求拦截器
|
||||
instance.interceptors.request.use(async (config: InternalAxiosRequestConfig) => {
|
||||
let headers = config.headers || {}
|
||||
return config;
|
||||
})
|
||||
// 全局 响应拦截器
|
||||
instance.interceptors.response.use(successCB, rejectCB);
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
// 请求成功回调
|
||||
export function successCB(response: AxiosResponse | Promise<AxiosResponse>): AxiosResponse | Promise<AxiosResponse> {
|
||||
function processResponse(response: AxiosResponse) {
|
||||
if (response.status === 200) { // 响应成功
|
||||
if (response.data.code === 401) {
|
||||
ElNotification.warning({
|
||||
message: "登录状态失效, 请重新登录",
|
||||
})
|
||||
console.log(response,response.data.msg)
|
||||
} else if (response.data.code === 403) {
|
||||
setTimeout(() => {
|
||||
console.log(response,response.data.msg)
|
||||
}, 0)
|
||||
}
|
||||
return response;
|
||||
} else {
|
||||
return Promise.reject(response);
|
||||
}
|
||||
}
|
||||
|
||||
if (response instanceof Promise) {
|
||||
let resp: AxiosResponse
|
||||
return new Promise((resolve)=>{
|
||||
response.then((r: AxiosResponse) => {
|
||||
resp = r;
|
||||
resolve(processResponse(resp))
|
||||
});
|
||||
})
|
||||
} else {
|
||||
return processResponse(response);
|
||||
}
|
||||
}
|
||||
|
||||
// 请求失败回调
|
||||
export function rejectCB(error: any): any {
|
||||
let response = error.response
|
||||
if(response.status === 401){
|
||||
return response;
|
||||
} else if(response.status === 403){
|
||||
setTimeout(() => {
|
||||
console.log(response.data.msg)
|
||||
}, 0)
|
||||
return response;
|
||||
}
|
||||
return Promise.reject(error);
|
||||
}
|
92
frontend/src/utils/file/file.ts
Normal file
92
frontend/src/utils/file/file.ts
Normal file
@ -0,0 +1,92 @@
|
||||
export interface FileUnitType {
|
||||
size: number,
|
||||
unit: string
|
||||
}
|
||||
|
||||
export const FileUnit: Record<string, FileUnitType> = {
|
||||
B: {
|
||||
size: 1,
|
||||
unit: "B",
|
||||
},
|
||||
KB: {
|
||||
size: 2 ** 10,
|
||||
unit: "KB",
|
||||
},
|
||||
MB: {
|
||||
size: 2 ** (10 * 2),
|
||||
unit: "MB",
|
||||
},
|
||||
GB: {
|
||||
size: 2 ** (10 * 3),
|
||||
unit: "GB",
|
||||
},
|
||||
TB: {
|
||||
size: 2 ** (10 * 4),
|
||||
unit: "TB",
|
||||
},
|
||||
PB: {
|
||||
size: 2 ** (10 * 5),
|
||||
unit: "PB",
|
||||
},
|
||||
EB: {
|
||||
size: 2 ** (10 * 6),
|
||||
unit: "EB",
|
||||
},
|
||||
ZB: {
|
||||
size: 2 ** (10 * 7),
|
||||
unit: "ZB",
|
||||
},
|
||||
YB: {
|
||||
size: 2 ** (10 * 8),
|
||||
unit: "YB",
|
||||
},
|
||||
DB: {
|
||||
size: 2 ** (10 * 9),
|
||||
unit: "DB",
|
||||
},
|
||||
NB: {
|
||||
size: 2 ** (10 * 10),
|
||||
unit: "NB",
|
||||
},
|
||||
}
|
||||
|
||||
export function convertToFileSizeWithUnit(anySize:string, defaultUnit:FileUnitType = FileUnit.B){
|
||||
let units = Object.values(FileUnit).map(item=>item.unit)
|
||||
units = units.concat(Object.values(FileUnit).slice(1).map(item=>item.unit.replace("B","")))
|
||||
let unitsReg = units.toString().replace(/,/g,"|")
|
||||
let reg = new RegExp(`^(\\d+\\.?\\d*)(\\s*(${unitsReg})?)?$`,"i")
|
||||
|
||||
let matchResult = anySize.match(reg)
|
||||
if(!matchResult){
|
||||
return "未知大小"
|
||||
} else {
|
||||
if(!matchResult[3]){
|
||||
return bytesToSizeWithUnit(Number(matchResult[1]))
|
||||
} else {
|
||||
return calcSize(Number(matchResult[1]), defaultUnit)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function bytesToSizeWithUnit(byteSize?:number){
|
||||
if(byteSize == null || byteSize < 0){
|
||||
return `0${FileUnit.B.unit}`
|
||||
}
|
||||
|
||||
let targetUnitIndex = Object.values(FileUnit).findIndex(item => item.size > byteSize) || 0
|
||||
let targetUnit:FileUnitType
|
||||
if(targetUnitIndex > 0){
|
||||
targetUnit = Object.values(FileUnit)[targetUnitIndex - 1]
|
||||
} else {
|
||||
targetUnit = Object.values(FileUnit)[0]
|
||||
}
|
||||
return `${calcSize(byteSize,targetUnit)} ${targetUnit.unit}`
|
||||
}
|
||||
|
||||
export function numberToHz(number:number){
|
||||
return bytesToSizeWithUnit(number).replace(FileUnit.B.unit,"")
|
||||
}
|
||||
|
||||
export function calcSize(byteSize:number,targetUnit:FileUnitType){
|
||||
return Number((byteSize / targetUnit.size).toFixed(2))
|
||||
}
|
8
frontend/wailsjs/go/core/App.d.ts
vendored
8
frontend/wailsjs/go/core/App.d.ts
vendored
@ -1,9 +1,17 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
import {context} from '../models';
|
||||
import {config} from '../models';
|
||||
import {frontend} from '../models';
|
||||
|
||||
export function Ctx():Promise<context.Context>;
|
||||
|
||||
export function ForceClose():Promise<void>;
|
||||
|
||||
export function GetConfig():Promise<config.Config>;
|
||||
|
||||
export function OpenFileDialog(arg1:frontend.OpenDialogOptions):Promise<string>;
|
||||
|
||||
export function ReloadApp():Promise<void>;
|
||||
|
||||
export function SaveFileDialog(arg1:frontend.SaveDialogOptions):Promise<string>;
|
||||
|
@ -10,6 +10,18 @@ export function ForceClose() {
|
||||
return window['go']['core']['App']['ForceClose']();
|
||||
}
|
||||
|
||||
export function GetConfig() {
|
||||
return window['go']['core']['App']['GetConfig']();
|
||||
}
|
||||
|
||||
export function OpenFileDialog(arg1) {
|
||||
return window['go']['core']['App']['OpenFileDialog'](arg1);
|
||||
}
|
||||
|
||||
export function ReloadApp() {
|
||||
return window['go']['core']['App']['ReloadApp']();
|
||||
}
|
||||
|
||||
export function SaveFileDialog(arg1) {
|
||||
return window['go']['core']['App']['SaveFileDialog'](arg1);
|
||||
}
|
||||
|
64
frontend/wailsjs/go/models.ts
Normal file
64
frontend/wailsjs/go/models.ts
Normal file
@ -0,0 +1,64 @@
|
||||
export namespace config {
|
||||
|
||||
export class DebuggerConfig {
|
||||
enable: boolean;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new DebuggerConfig(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.enable = source["enable"];
|
||||
}
|
||||
}
|
||||
export class ServerConfig {
|
||||
host: string;
|
||||
port: number;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new ServerConfig(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.host = source["host"];
|
||||
this.port = source["port"];
|
||||
}
|
||||
}
|
||||
export class Config {
|
||||
server?: ServerConfig;
|
||||
debug?: DebuggerConfig;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new Config(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.server = this.convertValues(source["server"], ServerConfig);
|
||||
this.debug = this.convertValues(source["debug"], DebuggerConfig);
|
||||
}
|
||||
|
||||
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||
if (!a) {
|
||||
return a;
|
||||
}
|
||||
if (a.slice) {
|
||||
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||
} else if ("object" === typeof a) {
|
||||
if (asMap) {
|
||||
for (const key of Object.keys(a)) {
|
||||
a[key] = new classs(a[key]);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return new classs(a);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -897,6 +897,11 @@ async-validator@^4.2.5:
|
||||
resolved "https://registry.npmmirror.com/async-validator/-/async-validator-4.2.5.tgz#c96ea3332a521699d0afaaceed510a54656c6339"
|
||||
integrity sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==
|
||||
|
||||
asynckit@^0.4.0:
|
||||
version "0.4.0"
|
||||
resolved "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
|
||||
integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==
|
||||
|
||||
autoprefixer@^10.4.12:
|
||||
version "10.4.17"
|
||||
resolved "https://registry.npmmirror.com/autoprefixer/-/autoprefixer-10.4.17.tgz#35cd5695cbbe82f536a50fa025d561b01fdec8be"
|
||||
@ -914,6 +919,15 @@ available-typed-arrays@^1.0.5, available-typed-arrays@^1.0.6:
|
||||
resolved "https://registry.npmmirror.com/available-typed-arrays/-/available-typed-arrays-1.0.6.tgz#ac812d8ce5a6b976d738e1c45f08d0b00bc7d725"
|
||||
integrity sha512-j1QzY8iPNPG4o4xmO3ptzpRxTciqD3MgEHtifP/YnJpIo58Xu+ne4BejlbkuaLfXn/nz6HFiw29bLpj2PNMdGg==
|
||||
|
||||
axios@^1.6.7:
|
||||
version "1.6.7"
|
||||
resolved "https://registry.npmmirror.com/axios/-/axios-1.6.7.tgz#7b48c2e27c96f9c68a2f8f31e2ab19f59b06b0a7"
|
||||
integrity sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==
|
||||
dependencies:
|
||||
follow-redirects "^1.15.4"
|
||||
form-data "^4.0.0"
|
||||
proxy-from-env "^1.1.0"
|
||||
|
||||
babel-plugin-prismjs@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.npmmirror.com/babel-plugin-prismjs/-/babel-plugin-prismjs-2.1.0.tgz#ade627896106326ad04d6d77fba92877618de571"
|
||||
@ -1053,6 +1067,13 @@ color-name@~1.1.4:
|
||||
resolved "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
||||
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
||||
|
||||
combined-stream@^1.0.8:
|
||||
version "1.0.8"
|
||||
resolved "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
|
||||
integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==
|
||||
dependencies:
|
||||
delayed-stream "~1.0.0"
|
||||
|
||||
commander@^4.0.0:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.npmmirror.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068"
|
||||
@ -1133,6 +1154,11 @@ define-properties@^1.1.3, define-properties@^1.2.0, define-properties@^1.2.1:
|
||||
has-property-descriptors "^1.0.0"
|
||||
object-keys "^1.1.1"
|
||||
|
||||
delayed-stream@~1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
|
||||
integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==
|
||||
|
||||
didyoumean@^1.2.2:
|
||||
version "1.2.2"
|
||||
resolved "https://registry.npmmirror.com/didyoumean/-/didyoumean-1.2.2.tgz#989346ffe9e839b4555ecf5666edea0d3e8ad037"
|
||||
@ -1620,6 +1646,11 @@ flatted@^3.2.9:
|
||||
resolved "https://registry.npmmirror.com/flatted/-/flatted-3.2.9.tgz#7eb4c67ca1ba34232ca9d2d93e9886e611ad7daf"
|
||||
integrity sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==
|
||||
|
||||
follow-redirects@^1.15.4:
|
||||
version "1.15.5"
|
||||
resolved "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.5.tgz#54d4d6d062c0fa7d9d17feb008461550e3ba8020"
|
||||
integrity sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==
|
||||
|
||||
for-each@^0.3.3:
|
||||
version "0.3.3"
|
||||
resolved "https://registry.npmmirror.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e"
|
||||
@ -1635,6 +1666,15 @@ foreground-child@^3.1.0:
|
||||
cross-spawn "^7.0.0"
|
||||
signal-exit "^4.0.1"
|
||||
|
||||
form-data@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.npmmirror.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452"
|
||||
integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==
|
||||
dependencies:
|
||||
asynckit "^0.4.0"
|
||||
combined-stream "^1.0.8"
|
||||
mime-types "^2.1.12"
|
||||
|
||||
fraction.js@^4.3.7:
|
||||
version "4.3.7"
|
||||
resolved "https://registry.npmmirror.com/fraction.js/-/fraction.js-4.3.7.tgz#06ca0085157e42fda7f9e726e79fefc4068840f7"
|
||||
@ -2187,6 +2227,18 @@ micromatch@^4.0.4, micromatch@^4.0.5:
|
||||
braces "^3.0.2"
|
||||
picomatch "^2.3.1"
|
||||
|
||||
mime-db@1.52.0:
|
||||
version "1.52.0"
|
||||
resolved "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70"
|
||||
integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==
|
||||
|
||||
mime-types@^2.1.12:
|
||||
version "2.1.35"
|
||||
resolved "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a"
|
||||
integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==
|
||||
dependencies:
|
||||
mime-db "1.52.0"
|
||||
|
||||
minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2:
|
||||
version "3.1.2"
|
||||
resolved "https://registry.npmmirror.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
|
||||
@ -2583,6 +2635,11 @@ prosemirror-view@^1.18.7, prosemirror-view@^1.27.0, prosemirror-view@^1.31.0:
|
||||
prosemirror-state "^1.0.0"
|
||||
prosemirror-transform "^1.1.0"
|
||||
|
||||
proxy-from-env@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
|
||||
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==
|
||||
|
||||
punycode@^2.1.0:
|
||||
version "2.3.1"
|
||||
resolved "https://registry.npmmirror.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5"
|
||||
|
1
main.go
1
main.go
@ -28,7 +28,6 @@ func main() {
|
||||
// Create application with options
|
||||
// 使用选项创建应用
|
||||
err := wails.Run(&options.App{
|
||||
|
||||
Title: "wails-app-dock",
|
||||
Width: 1024,
|
||||
Height: 768,
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"skapp/pkg/config"
|
||||
|
||||
"skapp/pkg/config/toml"
|
||||
"skapp/pkg/global"
|
||||
@ -130,3 +131,15 @@ func (a *App) Shutdown(ctx context.Context) {
|
||||
logger.Log.Fatalf("Server Shutdown:", err)
|
||||
}
|
||||
}
|
||||
|
||||
func (a *App) GetConfig() *config.Config {
|
||||
return global.Config
|
||||
}
|
||||
|
||||
func (a *App) OpenFileDialog(options runtime.OpenDialogOptions) (string, error) {
|
||||
return runtime.OpenFileDialog(a.ctx, options)
|
||||
}
|
||||
|
||||
func (a *App) SaveFileDialog(options runtime.SaveDialogOptions) (string, error) {
|
||||
return runtime.SaveFileDialog(a.ctx, options)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user