Skip to content

Commit 3625f92

Browse files
committed
fix[Tinymce]: fixed width bug
1 parent f0ca173 commit 3625f92

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/components/Tinymce/index.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div :class="{fullscreen:fullscreen}" class="tinymce-container editor-container">
2+
<div :class="{fullscreen:fullscreen}" class="tinymce-container" :style="{width:containerWidth}">
33
<textarea :id="tinymceId" class="tinymce-textarea" />
44
<div class="editor-custom-btn-container">
55
<editorImage color="#1890ff" class="editor-upload-btn" @successCBK="imageSuccessCBK" />
@@ -63,6 +63,13 @@ export default {
6363
computed: {
6464
language() {
6565
return this.languageTypeList[this.$store.getters.language]
66+
},
67+
containerWidth() {
68+
const width = this.width
69+
if (/^[\d]+(\.[\d]+)?$/.test(width)) { // matches `100`, `'100'`
70+
return `${width}px`
71+
}
72+
return width
6673
}
6774
},
6875
watch: {
@@ -96,7 +103,6 @@ export default {
96103
language: this.language,
97104
selector: `#${this.tinymceId}`,
98105
height: this.height,
99-
width: this.width,
100106
body_class: 'panel-body ',
101107
object_resizing: false,
102108
toolbar: this.toolbar.length > 0 ? this.toolbar : toolbar,

0 commit comments

Comments
 (0)