diff --git a/README.md b/README.md index 68f91552..5b586e27 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ + 删除文件/目录:`Shift + 右键文件/目录` + 重命名文件/目录:`Ctrl + 右键文件/目录` + 切换文档预览显示:`Alt + V` 或点击状态栏 `切换预览` 按钮 ++ 切换编辑器自动换行:`Alt + W` 或点击状态栏 `切换换行` 按钮 + 将外链或 BASE64 图片转换为本地图片:`Ctrl + Shift + 单击图片` + 默认文件存储在 `./data` 目录下,添加更多仓库请编辑 `./config.json` 文件 + 默认快捷键参考 [vscode](https://code.visualstudio.com/) diff --git a/frontend/src/components/Editor.vue b/frontend/src/components/Editor.vue index df1b2957..a133a46c 100644 --- a/frontend/src/components/Editor.vue +++ b/frontend/src/components/Editor.vue @@ -28,11 +28,13 @@ export default { } window.addEventListener('resize', this.resize) this.$bus.on('editor-replace-value', this.replaceValue) + this.$bus.on('editor-toggle-wrap', this.toggleWrap) }, beforeDestroy () { window.removeEventListener('paste', this.paste) window.removeEventListener('resize', this.resize) this.$bus.off('editor-replace-value', this.replaceValue) + this.$bus.off('editor-toggle-wrap', this.toggleWrap) }, methods: { resize () { @@ -51,7 +53,7 @@ export default { language: 'markdown', theme: 'vs-dark', fontSize: '20', - wordWrap: true, + wordWrap: false, // wordWrapColumn: 40, // Set this to false to not auto word wrap minified files wordWrapMinified: true, @@ -221,6 +223,10 @@ export default { setPosition (position) { console.log(position) this.editor.setScrollTop(0) + }, + toggleWrap () { + const isWrapping = this.editor.getConfiguration().wrappingInfo.isViewportWrapping + this.editor.updateOptions({wordWrap: !isWrapping}) } } } diff --git a/frontend/src/components/RepositorySwitch.vue b/frontend/src/components/RepositorySwitch.vue index 64a90fbc..e955505e 100644 --- a/frontend/src/components/RepositorySwitch.vue +++ b/frontend/src/components/RepositorySwitch.vue @@ -66,6 +66,7 @@ export default { .repository-switch { width: 100px; cursor: pointer; + user-select: none; } .current { diff --git a/frontend/src/components/StatusBar.vue b/frontend/src/components/StatusBar.vue index 677cab3a..a78ddb8b 100644 --- a/frontend/src/components/StatusBar.vue +++ b/frontend/src/components/StatusBar.vue @@ -3,6 +3,7 @@
切换预览
+
切换换行
行:{{documentInfo.line}} 列:{{documentInfo.column}} @@ -49,12 +50,21 @@ export default { toggleView () { this.$bus.emit('toggle-view') }, + toggleWrap () { + this.$bus.emit('editor-toggle-wrap') + }, keydownHandler (e) { if (e.key === 'v' && e.altKey) { this.toggleView() e.preventDefault() e.stopPropagation() } + + if (e.key === 'w' && e.altKey) { + this.toggleWrap() + e.preventDefault() + e.stopPropagation() + } } }, watch: { @@ -87,13 +97,14 @@ export default { padding: 0 .2em; } -.view-control { +.view-control, .wrap-control { padding: 0 .5em; - margin-left: 1em; + /* margin-left: 1em; */ cursor: pointer; + user-select: none; } -.view-control:hover { +.view-control:hover, .wrap-control:hover { background: #2e2e2e; }