Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
PanJiaChen committed Apr 23, 2019
1 parent b3a7b78 commit fa8638f
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions src/components/Tinymce/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div :class="{fullscreen:fullscreen}" class="tinymce-container editor-container" :style="containerStyle">
<div :class="{fullscreen:fullscreen}" class="tinymce-container editor-container">
<textarea :id="tinymceId" class="tinymce-textarea" />
<div class="editor-custom-btn-container">
<editorImage color="#1890ff" class="editor-upload-btn" @successCBK="imageSuccessCBK" />
Expand Down Expand Up @@ -38,14 +38,14 @@ export default {
default: 'file edit insert view format table'
},
height: {
type: Number,
type: [Number, String],
required: false,
default: 360
},
width: {
type: [Number, String],
required: false,
default: ''
default: 'auto'
}
},
data() {
Expand All @@ -63,19 +63,6 @@ export default {
computed: {
language() {
return this.languageTypeList[this.$store.getters.language]
},
/**
* Computes style for `div.editor-container`
* @return {Object}
*/
containerStyle() {
const style = {}
if (/^[\d]+(\.[\d]+)?$/.test(this.width)) { // Matches `100`, `'100'`
style.width = `${this.width}px`
} else if (/^[\d]+(\.[\d]+)?([a-z]{2,4}|%)$/.test(this.width)) { // Matches `100px`, `100rem`, `70%`, etc
style.width = `${this.width}`
}
return style
}
},
watch: {
Expand Down Expand Up @@ -109,6 +96,7 @@ export default {
language: this.language,
selector: `#${this.tinymceId}`,
height: this.height,
width: this.width,
body_class: 'panel-body ',
object_resizing: false,
toolbar: this.toolbar.length > 0 ? this.toolbar : toolbar,
Expand Down

0 comments on commit fa8638f

Please sign in to comment.