修复md编辑器预览开关
parent
9f1da23216
commit
875514e47b
|
@ -128,8 +128,8 @@ export default {
|
|||
elem.classList.toggle('active', this.props.fullscreen)
|
||||
},
|
||||
preview(elem) {
|
||||
this.props.preview = !this.props.preview
|
||||
this.__VIEW__.classList.toggle('active', this.props.preview)
|
||||
elem.classList.toggle('active', this.props.preview)
|
||||
this.state.preview = !this.state.preview
|
||||
this.__VIEW__.classList.toggle('active', this.state.preview)
|
||||
elem.classList.toggle('active', this.state.preview)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -771,25 +771,33 @@ export default class Meditor {
|
|||
}
|
||||
}
|
||||
|
||||
_stat__(name, val) {
|
||||
var type = typeof val
|
||||
var k = name
|
||||
if (k === 'readonly') {
|
||||
k = 'readOnly'
|
||||
}
|
||||
if (val === this.props[name]) {
|
||||
return
|
||||
}
|
||||
|
||||
if ((type === 'boolean' && val) || type !== 'boolean') {
|
||||
this.props[name] = true
|
||||
this.__EDITOR__[k] = true
|
||||
this.setAttribute(name, '')
|
||||
} else {
|
||||
this.props[name] = false
|
||||
this.__EDITOR__[k] = false
|
||||
this.removeAttribute(name)
|
||||
}
|
||||
}
|
||||
|
||||
get readOnly() {
|
||||
return this.props.readonly
|
||||
}
|
||||
|
||||
set readOnly(val) {
|
||||
var type = typeof val
|
||||
|
||||
if (val === this.props.readonly) {
|
||||
return
|
||||
}
|
||||
if ((type === 'boolean' && val) || type !== 'boolean') {
|
||||
this.props.readonly = true
|
||||
this.__EDITOR__.readOnly = true
|
||||
this.setAttribute('readonly', '')
|
||||
} else {
|
||||
this.props.readonly = false
|
||||
this.__EDITOR__.readOnly = false
|
||||
this.removeAttribute('readonly')
|
||||
}
|
||||
this.__stat__('readonly', val)
|
||||
}
|
||||
|
||||
get disabled() {
|
||||
|
@ -797,20 +805,7 @@ export default class Meditor {
|
|||
}
|
||||
|
||||
set disabled(val) {
|
||||
var type = typeof val
|
||||
|
||||
if (val === this.props.disabled) {
|
||||
return
|
||||
}
|
||||
if ((type === 'boolean' && val) || type !== 'boolean') {
|
||||
this.props.disabled = true
|
||||
this.__EDITOR__.disabled = true
|
||||
this.setAttribute('disabled', '')
|
||||
} else {
|
||||
this.props.disabled = false
|
||||
this.__EDITOR__.disabled = false
|
||||
this.removeAttribute('disabled')
|
||||
}
|
||||
this.__stat__('disabled', val)
|
||||
}
|
||||
|
||||
mounted() {
|
||||
|
@ -1053,9 +1048,6 @@ export default class Meditor {
|
|||
}
|
||||
this[k] = val !== null
|
||||
break
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue