diff --git a/src/components/preview/SimTextPreview.vue b/src/components/preview/SimTextPreview.vue index 4615329..c5782b0 100644 --- a/src/components/preview/SimTextPreview.vue +++ b/src/components/preview/SimTextPreview.vue @@ -64,7 +64,7 @@
-
+
-
+
- - +
@@ -185,7 +184,11 @@ options: { fontSize: 14, contextmenu: true, - readOnly: !this.$store.state.user.token, + codeLens: true, + readOnly: true, + minimap: { + enabled: this.$pc + }, // 换行 wordWrap: this.lineWrapping ? 'wordWrapColumn':'', wordWrapMinified: true, @@ -252,12 +255,13 @@ }, watch: { //监听file的变化,进行相应的操作即可 file(file) { + console.log('watich:file',file) if(!file.path){ return } this.editableTabs = [] + this.checkReadOnly(file.userId) this.loadEditorSize() - this.loading = this.$message({ iconClass: 'el-icon-loading', type: 'info', @@ -275,12 +279,10 @@ let request = 'previewText' if(this.shareId){ request = 'sharePreviewText' - this.options.readOnly = true } if(this.filepath){ request = 'previewTextByPath' file.path = this.filepath - this.options.readOnly = true } if(!file.id){ request = 'previewTextByPath' @@ -544,6 +546,16 @@ containerResize() { this.loadEditorSize() }, + checkReadOnly(fileUserId){ + console.log('readOnly',this.options.readOnly) + if(this.$store.state.user.token && this.$store.state.user.userId === fileUserId){ + this.options.readOnly = false + } + if(this.options.readOnly){ + this.editorWidth += this.contentsWidth + this.contentsHide = true + } + }, loadEditorSize(){ this.dialogWidth = document.body.clientWidth * this.dialogWidthPercent if(this.contentsHide){ @@ -1208,6 +1220,9 @@ float: right; cursor: nwse-resize; } + .el-button--small.is-circle { + padding: 9px 9px; + } }