fix[Tinymce]: fixed width bug

This commit is contained in:
Pan 2019-04-23 11:25:53 +08:00
parent f0ca1735d3
commit 3625f92041
1 changed files with 8 additions and 2 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<div :class="{fullscreen:fullscreen}" class="tinymce-container editor-container"> <div :class="{fullscreen:fullscreen}" class="tinymce-container" :style="{width:containerWidth}">
<textarea :id="tinymceId" class="tinymce-textarea" /> <textarea :id="tinymceId" class="tinymce-textarea" />
<div class="editor-custom-btn-container"> <div class="editor-custom-btn-container">
<editorImage color="#1890ff" class="editor-upload-btn" @successCBK="imageSuccessCBK" /> <editorImage color="#1890ff" class="editor-upload-btn" @successCBK="imageSuccessCBK" />
@ -63,6 +63,13 @@ export default {
computed: { computed: {
language() { language() {
return this.languageTypeList[this.$store.getters.language] return this.languageTypeList[this.$store.getters.language]
},
containerWidth() {
const width = this.width
if (/^[\d]+(\.[\d]+)?$/.test(width)) { // matches `100`, `'100'`
return `${width}px`
}
return width
} }
}, },
watch: { watch: {
@ -96,7 +103,6 @@ export default {
language: this.language, language: this.language,
selector: `#${this.tinymceId}`, selector: `#${this.tinymceId}`,
height: this.height, height: this.height,
width: this.width,
body_class: 'panel-body ', body_class: 'panel-body ',
object_resizing: false, object_resizing: false,
toolbar: this.toolbar.length > 0 ? this.toolbar : toolbar, toolbar: this.toolbar.length > 0 ? this.toolbar : toolbar,