From 9e40c4240ad98e7b6b3d43f1bdb6b8bd5f70f5af Mon Sep 17 00:00:00 2001 From: MarkMindCkm <616421019@qq.com> Date: Wed, 6 Mar 2024 19:59:47 +0800 Subject: [PATCH] v0.0.1 --- .gitignore | 4 + README.md | 2 - dist-electron/main.js | 79 +- dist-electron/preload.js | 74 +- dist/assets/index-6e919d14.js | 1015 --------------- dist/assets/index-d41d1478.css | 26 - dist/index.html | 6 +- electron/main.ts | 34 +- index.html | 2 + package.json | 5 +- public/main.css | 0 public/styles.css | 2106 ++++++++++++++++++++++++++++++++ 12 files changed, 2128 insertions(+), 1225 deletions(-) delete mode 100644 README.md delete mode 100644 dist/assets/index-6e919d14.js delete mode 100644 dist/assets/index-d41d1478.css create mode 100644 public/main.css create mode 100644 public/styles.css diff --git a/.gitignore b/.gitignore index 234f2f1..ec42731 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,10 @@ pnpm-debug.log* lerna-debug.log* node_modules +dist +dist-ssr +dist-electron +release *.local # Editor directories and files diff --git a/README.md b/README.md deleted file mode 100644 index 8354ea4..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# MarkMind-ltd -A mindmap and pdf annotate tool . 一个强大的思维导图和 PDF 标注软件 diff --git a/dist-electron/main.js b/dist-electron/main.js index c27cf98..c4aae9b 100644 --- a/dist-electron/main.js +++ b/dist-electron/main.js @@ -1,78 +1 @@ -"use strict"; -const electron = require("electron"); -const path = require("node:path"); -var Store = require("electron-store"); -const store = new Store(); -require("@electron/remote/main").initialize(); -var t = store.get("localTime"); -if (!t) { - store.set("localTime", (/* @__PURE__ */ new Date()).getTime()); -} -process.env.DIST = path.join(__dirname, "../dist"); -process.env.VITE_PUBLIC = electron.app.isPackaged ? process.env.DIST : path.join(process.env.DIST, "../public"); -let win; -const VITE_DEV_SERVER_URL = process.env["VITE_DEV_SERVER_URL"]; -function createWindow() { - win = new electron.BrowserWindow({ - width: 1200, - height: 800, - icon: path.join(process.env.VITE_PUBLIC, "icon.png"), - webPreferences: { - // preload: path.join(__dirname, 'preload.js'), - nodeIntegration: true, - contextIsolation: false, - webSecurity: false, - enableRemoteModule: true - } - }); - require("@electron/remote/main").enable(win.webContents); - win.webContents.on("did-finish-load", () => { - win == null ? void 0 : win.webContents.send("main-process-message", ""); - }); - electron.Menu.setApplicationMenu(null); - if (VITE_DEV_SERVER_URL) { - win.loadURL(VITE_DEV_SERVER_URL); - } else { - win.loadFile(path.join(process.env.DIST, "index.html")); - } -} -electron.app.on("window-all-closed", () => { - if (process.platform !== "darwin") { - electron.app.quit(); - win = null; - } -}); -electron.app.on("activate", () => { - if (electron.BrowserWindow.getAllWindows().length === 0) { - createWindow(); - } -}); -electron.app.whenReady().then(createWindow); -electron.ipcMain.on("openExportWindow", (e, arg) => { - var w = new electron.BrowserWindow({ - // icon: path.join(process.env.VITE_PUBLIC, 'icon.png') - webPreferences: { - // preload: path.join(__dirname, 'preload.js'), - nodeIntegration: true, - contextIsolation: false, - webSecurity: false, - enableRemoteModule: true - } - }); - require("@electron/remote/main").enable(w.webContents); - w.webContents.on("did-finish-load", () => { - w == null ? void 0 : w.webContents.send("main-process-message", arg); - }); - if (VITE_DEV_SERVER_URL) { - win.loadURL(VITE_DEV_SERVER_URL); - } else { - win.loadFile(path.join(process.env.DIST, "index.html")); - } -}); -electron.app.on("window-all-closed", () => { - electron.app.quit(); -}); -electron.ipcMain.on("relaunch", (e, arg) => { - electron.app.relaunch(); - electron.app.exit(); -}); +"use strict";const e=require("electron"),o=require("node:path");var l=require("electron-store");const t=new l;require("@electron/remote/main").initialize();var p=t.get("localTime");p||t.set("localTime",new Date().getTime());process.env.DIST=o.join(__dirname,"../dist");process.env.VITE_PUBLIC=e.app.isPackaged?process.env.DIST:o.join(process.env.DIST,"../public");let n;const i=process.env.VITE_DEV_SERVER_URL;function s(){n=new e.BrowserWindow({width:1200,height:800,icon:o.join(process.env.VITE_PUBLIC,"icon.png"),webPreferences:{nodeIntegration:!0,contextIsolation:!1,webSecurity:!1,enableRemoteModule:!0}}),require("@electron/remote/main").enable(n.webContents),n.webContents.on("did-finish-load",()=>{n==null||n.webContents.send("main-process-message","")}),i?n.loadURL(i):n.loadFile(o.join(process.env.DIST,"index.html"))}e.app.on("window-all-closed",()=>{process.platform!=="darwin"&&(e.app.quit(),n=null)});e.app.on("activate",()=>{e.BrowserWindow.getAllWindows().length===0&&s()});e.app.whenReady().then(s);e.ipcMain.on("openDevTools",(a,r)=>{n&&n.webContents.openDevTools()});e.app.on("window-all-closed",()=>{e.app.quit()});e.ipcMain.on("relaunch",(a,r)=>{e.app.relaunch(),e.app.exit()}); diff --git a/dist-electron/preload.js b/dist-electron/preload.js index 4603186..2ba6995 100644 --- a/dist-electron/preload.js +++ b/dist-electron/preload.js @@ -1,56 +1,11 @@ -"use strict"; -const electron = require("electron"); -electron.contextBridge.exposeInMainWorld("ipcRenderer", withPrototype(electron.ipcRenderer)); -function withPrototype(obj) { - const protos = Object.getPrototypeOf(obj); - for (const [key, value] of Object.entries(protos)) { - if (Object.prototype.hasOwnProperty.call(obj, key)) - continue; - if (typeof value === "function") { - obj[key] = function(...args) { - return value.call(obj, ...args); - }; - } else { - obj[key] = value; - } - } - return obj; -} -function domReady(condition = ["complete", "interactive"]) { - return new Promise((resolve) => { - if (condition.includes(document.readyState)) { - resolve(true); - } else { - document.addEventListener("readystatechange", () => { - if (condition.includes(document.readyState)) { - resolve(true); - } - }); - } - }); -} -const safeDOM = { - append(parent, child) { - if (!Array.from(parent.children).find((e) => e === child)) { - parent.appendChild(child); - } - }, - remove(parent, child) { - if (Array.from(parent.children).find((e) => e === child)) { - parent.removeChild(child); - } - } -}; -function useLoading() { - const className = `loaders-css__square-spin`; - const styleContent = ` +"use strict";const i=require("electron");i.contextBridge.exposeInMainWorld("ipcRenderer",s(i.ipcRenderer));function s(e){const t=Object.getPrototypeOf(e);for(const[n,o]of Object.entries(t))Object.prototype.hasOwnProperty.call(e,n)||(typeof o=="function"?e[n]=function(...d){return o.call(e,...d)}:e[n]=o);return e}function c(e=["complete","interactive"]){return new Promise(t=>{e.includes(document.readyState)?t(!0):document.addEventListener("readystatechange",()=>{e.includes(document.readyState)&&t(!0)})})}const r={append(e,t){Array.from(e.children).find(n=>n===t)||e.appendChild(t)},remove(e,t){Array.from(e.children).find(n=>n===t)&&e.removeChild(t)}};function p(){const e="loaders-css__square-spin",t=` @keyframes square-spin { 25% { transform: perspective(100px) rotateX(180deg) rotateY(0); } 50% { transform: perspective(100px) rotateX(180deg) rotateY(180deg); } 75% { transform: perspective(100px) rotateX(0) rotateY(180deg); } 100% { transform: perspective(100px) rotateX(0) rotateY(0); } } -.${className} > div { +.${e} > div { animation-fill-mode: both; width: 50px; height: 50px; @@ -69,27 +24,4 @@ function useLoading() { background: #282c34; z-index: 9; } - `; - const oStyle = document.createElement("style"); - const oDiv = document.createElement("div"); - oStyle.id = "app-loading-style"; - oStyle.innerHTML = styleContent; - oDiv.className = "app-loading-wrap"; - oDiv.innerHTML = `
"+su(e[n].content)+`
-`};wo.fence=function(e,n,i,r,a){var s=e[n],o=s.info?kCe(s.info).trim():"",l="",c="",u,d,h,m,f;return o&&(h=o.split(/(\s+)/g),l=h[0],c=h.slice(2).join("")),i.highlight?u=i.highlight(s.content,l,c)||su(s.content):u=su(s.content),u.indexOf(""+u+`
-`):""+u+`
-`};wo.image=function(e,n,i,r,a){var s=e[n];return s.attrs[s.attrIndex("alt")][1]=a.renderInlineAsText(s.children,i,r),a.renderToken(e,n,i)};wo.hardbreak=function(e,n,i){return i.xhtmlOut?`