perf[Tinymce]: add width prop (#1951)

This commit is contained in:
anson 2019-04-23 10:09:15 +08:00 committed by 花裤衩
parent d8dbf92b47
commit f0ca1735d3
2 changed files with 10 additions and 4 deletions

View File

@ -40,14 +40,14 @@ export default {
mounted() { mounted() {
this.height = this.$el.getBoundingClientRect().height this.height = this.$el.getBoundingClientRect().height
window.addEventListener('scroll', this.handleScroll) window.addEventListener('scroll', this.handleScroll)
window.addEventListener('resize', this.handleReize) window.addEventListener('resize', this.handleResize)
}, },
activated() { activated() {
this.handleScroll() this.handleScroll()
}, },
destroyed() { destroyed() {
window.removeEventListener('scroll', this.handleScroll) window.removeEventListener('scroll', this.handleScroll)
window.removeEventListener('resize', this.handleReize) window.removeEventListener('resize', this.handleResize)
}, },
methods: { methods: {
sticky() { sticky() {
@ -81,7 +81,7 @@ export default {
} }
this.handleReset() this.handleReset()
}, },
handleReize() { handleResize() {
if (this.isSticky) { if (this.isSticky) {
this.width = this.$el.getBoundingClientRect().width + 'px' this.width = this.$el.getBoundingClientRect().width + 'px'
} }

View File

@ -38,9 +38,14 @@ export default {
default: 'file edit insert view format table' default: 'file edit insert view format table'
}, },
height: { height: {
type: Number, type: [Number, String],
required: false, required: false,
default: 360 default: 360
},
width: {
type: [Number, String],
required: false,
default: 'auto'
} }
}, },
data() { data() {
@ -91,6 +96,7 @@ 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,