diff --git a/editor/index.html b/iframes/editor.html similarity index 100% rename from editor/index.html rename to iframes/editor.html diff --git a/package.json b/package.json index 2c95b22..756961c 100644 --- a/package.json +++ b/package.json @@ -5,29 +5,31 @@ "type": "module", "scripts": { "dev": "vite", - "build": "vite build", + "build": "npm run build:plugin && npm run build:iframes", + "build:plugin": "vite build --mode plugin", + "build:iframes": "vite build --mode iframes", "preview": "vite preview", "check": "svelte-check --tsconfig ./tsconfig.json" }, "devDependencies": { + "@monaco-editor/loader": "^1.3.3", "@sveltejs/vite-plugin-svelte": "^2.4.2", "@tsconfig/svelte": "^4.0.1", - "@types/node": "^20.4.1", + "@types/node": "^20.4.2", + "deepmerge": "^4.3.1", "less": "^4.1.3", + "monaco-editor": "^0.40.0", "svelte": "^3.59.2", - "svelte-check": "^3.4.5", + "svelte-check": "^3.4.6", "svelte-preprocess-less": "^0.4.0", "tslib": "^2.6.0", "typescript": "^5.1.6", - "vite": "^4.4.2", - "vite-plugin-monaco-editor": "^1.1.0", + "vite": "^4.4.4", "vite-plugin-static-copy": "^0.16.0" }, "dependencies": { - "@monaco-editor/loader": "^1.3.3", "@workspace/components": "workspace:^", "@workspace/types": "workspace:^", - "@workspace/utils": "workspace:^", - "monaco-editor": "^0.40.0" + "@workspace/utils": "workspace:^" } } diff --git a/public/README.md b/public/README.md new file mode 100644 index 0000000..e69de29 diff --git a/public/README_zh_CN.md b/public/README_zh_CN.md new file mode 100644 index 0000000..e69de29 diff --git a/public/i18n/en_US.json b/public/i18n/en_US.json index 6e0d1a6..69ed0dc 100644 --- a/public/i18n/en_US.json +++ b/public/i18n/en_US.json @@ -1,3 +1,22 @@ { - "displayName": "Code Editor" + "displayName": "Code Editor", + "dock": { + "kramdown": { + "ariaLabel": "Edit kramdown" + }, + "title": "Code Edit" + }, + "editor": { + "action": { + "save": { + "label": "Save" + }, + "saveAs": { + "label": "Save As" + }, + "toggleWordWrap": { + "label": "Toggle Word Wrap" + } + } + } } diff --git a/public/i18n/zh_CHT.json b/public/i18n/zh_CHT.json index 50e318d..58a9d6a 100644 --- a/public/i18n/zh_CHT.json +++ b/public/i18n/zh_CHT.json @@ -1,3 +1,22 @@ { - "displayName": "代碼編輯器" + "displayName": "程式碼編輯器", + "dock": { + "kramdown": { + "ariaLabel": "編輯 kramdown" + }, + "title": "程式碼編輯" + }, + "editor": { + "action": { + "save": { + "label": "保存" + }, + "saveAs": { + "label": "另存為" + }, + "toggleWordWrap": { + "label": "切換自動換行" + } + } + } } diff --git a/public/i18n/zh_CN.json b/public/i18n/zh_CN.json index fcd8f06..6cdb14d 100644 --- a/public/i18n/zh_CN.json +++ b/public/i18n/zh_CN.json @@ -1,3 +1,22 @@ { - "displayName": "代码编辑器" + "displayName": "代码编辑器", + "dock": { + "kramdown": { + "ariaLabel": "编辑 kramdown" + }, + "title": "代码编辑" + }, + "editor": { + "action": { + "save": { + "label": "保存" + }, + "saveAs": { + "label": "另存为" + }, + "toggleWordWrap": { + "label": "切换自动换行" + } + } + } } diff --git a/public/icon.png b/public/icon.png new file mode 100644 index 0000000..fbc5e13 Binary files /dev/null and b/public/icon.png differ diff --git a/public/plugin.json b/public/plugin.json index e69de29..d33b86e 100644 --- a/public/plugin.json +++ b/public/plugin.json @@ -0,0 +1,39 @@ +{ + "name": "monaco-editor", + "author": "Zuoqiu Yingyi", + "url": "https://github.com/Zuoqiu-Yingyi/siyuan-plugin-webview", + "version": "0.0.0", + "minAppVersion": "2.9.5", + "backends": [ + "all" + ], + "frontends": [ + "desktop", + "desktop-window", + "browser-desktop" + ], + "displayName": { + "default": "Code Editor", + "zh_CN": "代码编辑器", + "zh_CHT": "程式碼編輯器" + }, + "description": { + "default": "Use the Monaco Editor to view and edit code.", + "zh_CN": "使用 Monaco Editor 查看与编辑代码。", + "zh_CHT": "使用 Monaco Editor 檢視與編輯程式碼。" + }, + "readme": { + "default": "README.md", + "zh_CN": "README_zh_CN.md", + "zh_CHT": "README_zh_CN.md" + }, + "funding": { + "openCollective": "", + "patreon": "", + "github": "", + "custom": [ + "https://afdian.net/a/zuoqiu", + "https://ko-fi.com/zuoqiu" + ] + } +} diff --git a/src/components/Dock.svelte b/src/components/Dock.svelte new file mode 100644 index 0000000..eb96d7e --- /dev/null +++ b/src/components/Dock.svelte @@ -0,0 +1,74 @@ + + + + + + diff --git a/src/components/Editor.svelte b/src/components/Editor.svelte index 2d10d85..2e9709a 100644 --- a/src/components/Editor.svelte +++ b/src/components/Editor.svelte @@ -16,33 +16,114 @@ --> @@ -69,7 +242,8 @@