Skip to content

Commit 4f6ce68

Browse files
committed
feat: v.1.4.3
1 parent 0a04482 commit 4f6ce68

5 files changed

Lines changed: 39 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# 更新日志
22

3+
## 1.4.3
4+
5+
- 新增:图片查看,支持同级快速预览
6+
- 新增:PDF 阅读,支持索引跳转和缩放
7+
- 支持:兼容 arm 设备
8+
39
## 1.4.2
410

511
- 新增:支持在刷新目录和在目录下创建文件

backend/src/utils/type.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const mimeMap = {
22
// 文本类型
33
css: "text/css",
4+
mjs: "text/javascript",
45
js: "text/javascript",
56
html: "text/html",
67
htm: "text/html",

frontend/components.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ declare module 'vue' {
3030
FileView: typeof import('./src/components/FileView.vue')['default']
3131
ImageView: typeof import('./src/components/ImageView.vue')['default']
3232
MonacoEditor: typeof import('./src/components/MonacoEditor.vue')['default']
33-
PdfEditor: typeof import('./src/components/PdfEditor.vue')['default']
3433
PdfView: typeof import('./src/components/PdfView.vue')['default']
3534
}
3635
}
@@ -55,6 +54,5 @@ declare global {
5554
const FileView: typeof import('./src/components/FileView.vue')['default']
5655
const ImageView: typeof import('./src/components/ImageView.vue')['default']
5756
const MonacoEditor: typeof import('./src/components/MonacoEditor.vue')['default']
58-
const PdfEditor: typeof import('./src/components/PdfEditor.vue')['default']
5957
const PdfView: typeof import('./src/components/PdfView.vue')['default']
6058
}

frontend/src/components/PdfView.vue

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,15 @@
4343
</div>
4444

4545
<div class="body">
46-
<div class="left" v-show="left.outline">
46+
<div class="left" v-show="left.outline" :style="{ width: `${left.width}px` }">
4747
<el-tree
4848
:data="outline"
4949
:props="{ children: 'items', label: 'title' }"
5050
:expand-on-click-node="false"
5151
@node-click="outlineClick"
5252
/>
53+
54+
<ClickMove @move="(v) => changeLeftWidth(v.x)" />
5355
</div>
5456
<div class="right">
5557
<div class="pages" ref="views" @scroll="onScroll">
@@ -75,6 +77,8 @@ import { debounce } from 'lodash'
7577
import * as pdfjsLib from 'pdfjs-dist'
7678
import workerUrl from 'pdfjs-dist/build/pdf.worker.min.mjs?url'
7779
80+
import ClickMove from '@/components/ClickMove.vue'
81+
7882
import { getFullPath } from '@/utils/file'
7983
import type { TreeNodeData } from 'element-plus'
8084
@@ -88,7 +92,7 @@ interface OutlineModel {
8892
8993
const $props = defineProps<{ src: string }>()
9094
91-
const left = ref({ outline: true })
95+
const left = ref({ outline: true, width: 240 })
9296
9397
const pdf = ref<pdfjsLib.PDFDocumentProxy>()
9498
const params = ref({ dpr: 1, width: 0, height: 0 })
@@ -196,6 +200,16 @@ const outlineClick = async (data: TreeNodeData) => {
196200
changeCur(page + 1)
197201
}
198202
}
203+
204+
const changeLeftWidth = (v: number) => {
205+
const newVal = left.value.width + v
206+
207+
if (newVal > 500 || newVal < 200) {
208+
return
209+
}
210+
211+
left.value.width = newVal
212+
}
199213
</script>
200214

201215
<style lang="scss" scoped>
@@ -235,7 +249,6 @@ const outlineClick = async (data: TreeNodeData) => {
235249
236250
> .left {
237251
position: relative;
238-
width: 300px;
239252
border-right: 1px solid var(--el-border-color);
240253
241254
> .el-tree {
@@ -246,6 +259,20 @@ const outlineClick = async (data: TreeNodeData) => {
246259
width: 100%;
247260
overflow: auto;
248261
}
262+
263+
> .click-move {
264+
position: absolute;
265+
top: 0;
266+
bottom: 0;
267+
right: 0;
268+
width: 7px;
269+
transform: translateX(4px);
270+
cursor: e-resize;
271+
272+
&:hover {
273+
background-color: var(--el-text-color-placeholder);
274+
}
275+
}
249276
}
250277
251278
> .right {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "code.editor",
3-
"version": "1.4.2",
4-
"changelog": "<div>新增:目录管理,支持打开、切换目录,便于用户操作</div><div>新增:打开时展示历史记录,便于快速访问</div><div>新增:偏好设置中新增启动时询问、自动换行</div><div>新增:图片预览功能</div><div>修复:偏好设置恢复默认不生效的问题</div>",
3+
"version": "1.4.3",
4+
"changelog": "<div>新增:图片查看,支持同级快速预览</div><div>新增:PDF 阅读,支持索引跳转和缩放</div><div>新增:支持刷新目录和在目录下创建文件</div><div>新增:偏好设置-启动时询问,可在桌面图标访问时不询问开启</div>",
55
"scripts": {
66
"dev": "node src/app.js",
77
"install": "npm i --prefix=backend && npm i --prefix=frontend",

0 commit comments

Comments
 (0)