mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 19:35:50 +00:00
perf: 优化富文本输入框
This commit is contained in:
parent
722b3b4788
commit
644d8e22a1
@ -148,32 +148,24 @@
|
|||||||
uploadIng: 0,
|
uploadIng: 0,
|
||||||
uploadFormat: ['jpg', 'jpeg', 'webp', 'png', 'gif', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'esp', 'pdf', 'rar', 'zip', 'gz', 'ai', 'avi', 'bmp', 'cdr', 'eps', 'mov', 'mp3', 'mp4', 'pr', 'psd', 'svg', 'tif'],
|
uploadFormat: ['jpg', 'jpeg', 'webp', 'png', 'gif', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'esp', 'pdf', 'rar', 'zip', 'gz', 'ai', 'avi', 'bmp', 'cdr', 'eps', 'mov', 'mp3', 'mp4', 'pr', 'psd', 'svg', 'tif'],
|
||||||
actionUrl: $A.apiUrl('system/fileupload'),
|
actionUrl: $A.apiUrl('system/fileupload'),
|
||||||
maxSize: 10240
|
maxSize: 10240,
|
||||||
|
|
||||||
|
timer: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.content = this.value;
|
this.content = this.value;
|
||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
|
||||||
if (this.editor !== null) {
|
|
||||||
this.editor.destroy()
|
|
||||||
this.editor = null
|
|
||||||
}
|
|
||||||
this.spinShow = true;
|
|
||||||
$A(this.$refs.myTextarea).show();
|
|
||||||
},
|
|
||||||
activated() {
|
activated() {
|
||||||
this.content = this.value;
|
this.content = this.value;
|
||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
deactivated() {
|
deactivated() {
|
||||||
if (this.editor !== null) {
|
this.destroy();
|
||||||
this.editor.destroy()
|
},
|
||||||
this.editor = null
|
destroyed() {
|
||||||
}
|
this.destroy();
|
||||||
this.spinShow = true;
|
|
||||||
$A(this.$refs.myTextarea).show();
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['themeIsDark']),
|
...mapState(['themeIsDark']),
|
||||||
@ -206,6 +198,7 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
|
this.timer && clearTimeout(this.timer);
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
tinymce.init(this.concatAssciativeArrays(this.option(false), this.options));
|
tinymce.init(this.concatAssciativeArrays(this.option(false), this.options));
|
||||||
});
|
});
|
||||||
@ -217,6 +210,22 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
destroy() {
|
||||||
|
this.timer && clearTimeout(this.timer);
|
||||||
|
this.timer = setTimeout(_ => {
|
||||||
|
if (this.editor !== null) {
|
||||||
|
this.editor.destroy()
|
||||||
|
this.editor = null
|
||||||
|
}
|
||||||
|
if (this.editorT !== null) {
|
||||||
|
this.editorT.destroy();
|
||||||
|
this.editorT = null;
|
||||||
|
}
|
||||||
|
this.spinShow = true;
|
||||||
|
$A(this.$refs.myTextarea).show();
|
||||||
|
}, 500);
|
||||||
|
},
|
||||||
|
|
||||||
plugin(isFull) {
|
plugin(isFull) {
|
||||||
if (isFull) {
|
if (isFull) {
|
||||||
return this.plugins.filter((val) => val != 'autoresize');
|
return this.plugins.filter((val) => val != 'autoresize');
|
||||||
|
|||||||
@ -93,14 +93,14 @@
|
|||||||
<i class="taskfont"></i>
|
<i class="taskfont"></i>
|
||||||
{{$L('上传文件')}}
|
{{$L('上传文件')}}
|
||||||
</div>
|
</div>
|
||||||
<div class="chat-input-popover-item" @click="onToolbar('full')">
|
|
||||||
<i class="taskfont"></i>
|
|
||||||
{{$L('全屏输入')}}
|
|
||||||
</div>
|
|
||||||
<div v-if="canAnon" class="chat-input-popover-item" @click="onToolbar('anon')">
|
<div v-if="canAnon" class="chat-input-popover-item" @click="onToolbar('anon')">
|
||||||
<i class="taskfont"></i>
|
<i class="taskfont"></i>
|
||||||
{{$L('匿名消息')}}
|
{{$L('匿名消息')}}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="chat-input-popover-item" @click="onToolbar('full')">
|
||||||
|
<i class="taskfont"></i>
|
||||||
|
{{$L('全屏输入')}}
|
||||||
|
</div>
|
||||||
</EPopover>
|
</EPopover>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
@ -628,6 +628,10 @@ export default {
|
|||||||
|
|
||||||
wrapperHeight(newVal, oldVal) {
|
wrapperHeight(newVal, oldVal) {
|
||||||
this.$emit('on-height-change', {newVal, oldVal})
|
this.$emit('on-height-change', {newVal, oldVal})
|
||||||
|
},
|
||||||
|
|
||||||
|
fullInput(val) {
|
||||||
|
this.quill?.enable(!val)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -1174,6 +1178,10 @@ export default {
|
|||||||
}, this.options))
|
}, this.options))
|
||||||
this.fullQuill.enable(true)
|
this.fullQuill.enable(true)
|
||||||
this.$refs.editorFull.firstChild.innerHTML = this.$refs.editor.firstChild.innerHTML
|
this.$refs.editorFull.firstChild.innerHTML = this.$refs.editor.firstChild.innerHTML
|
||||||
|
this.$nextTick(_ => {
|
||||||
|
this.fullQuill.setSelection(this.fullQuill.getLength())
|
||||||
|
this.fullQuill.focus()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -74,7 +74,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="project-subbox">
|
<div class="project-subbox">
|
||||||
<div class="project-subtitle" @click="showDesc">
|
<div class="project-subtitle" @click="showDesc">
|
||||||
<MarkdownPreviewNostyle :initialValue="projectData.desc"/>
|
<MarkdownPreviewNostyle ref="descPreview" :initialValue="projectData.desc"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="project-switch">
|
<div class="project-switch">
|
||||||
<div v-if="completedCount > 0" class="project-checkbox">
|
<div v-if="completedCount > 0" class="project-checkbox">
|
||||||
@ -897,7 +897,7 @@ export default {
|
|||||||
$A.modalInfo({
|
$A.modalInfo({
|
||||||
language: false,
|
language: false,
|
||||||
title: this.$L('项目描述'),
|
title: this.$L('项目描述'),
|
||||||
content: this.projectData.desc
|
content: this.$refs.descPreview.$el.innerHTML
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user