开源软件名称(OpenSource Name):craftzdog/electron-markdown-editor-tutorial开源软件地址(OpenSource Url):https://github.com/craftzdog/electron-markdown-editor-tutorial开源编程语言(OpenSource Language):JavaScript 63.3%开源软件介绍(OpenSource Introduction):Markdown Editor TutorialA tutorial for building a beautiful Markdown editor Sponsor
Stack
Get startednpm i
npm run watch Project StructureThe structure of this project is very similar to the structure of a monorepo. The entire source code of the program is divided into three modules (packages) that are bundled each independently:
Build web resourcesPackages The build of web resources is performed in the Compile AppNext step is run packaging and compilation a ready for distribution Electron app for macOS, Windows and Linux with "auto update" support out of the box. To do this, using the electron-builder:
Using Node.js API in rendererAccording to Electron's security guidelines, Node.js integration is disabled for remote content. This means that you cannot call any Node.js api in the // packages/preload/src/index.ts
import {readFile} from 'fs/promises'
const api = {
readConfig: () => readFile('/path/to/config.json', {encoding: 'utf-8'}),
}
contextBridge.exposeInMainWorld('electron', api) // packages/renderer/src/App.vue
import {useElectron} from '/@/use/electron'
const {readConfig} = useElectron() Read more about Security Considerations. Note: Context isolation disabled for Modes and Environment VariablesAll environment variables set as part of the You can also build type definitions of your variables by running The mode option is used to specify the value of By default, there are two modes:
When running building, environment variables are loaded from the following files in your project root:
Note: only variables prefixed with AuthorTakuya Matsuyama (@craftzdog) |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论