This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

修复md编辑器预览开关

old
宇天 2021-05-27 14:02:37 +08:00
parent 9f1da23216
commit 875514e47b
2 changed files with 26 additions and 34 deletions

View File

@ -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)
}
}

View File

@ -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
}
}
}