优化语言包选择逻辑;优化switch组件checked属性和样式;meditor增加revise回调,允许用户对md编译后的修正
parent
020a142bfb
commit
e25ff4286e
|
@ -155,12 +155,12 @@
|
||||||
&.dark.checked &__label {background:nth($cd, 1) + a0;}
|
&.dark.checked &__label {background:nth($cd, 1) + a0;}
|
||||||
|
|
||||||
&.disabled.checked &__dot {background:#fff;}
|
&.disabled.checked &__dot {background:#fff;}
|
||||||
&.disabled &__label, &.disabled.checked &__label {background:nth($cp, 1);
|
&.disabled &__label, &.disabled.checked &__label {
|
||||||
|
|
||||||
&::before {display:block;position:absolute;top:6px;width:8px;height:4px;border-radius:2px;background:#fff;content:"";}
|
&::before {display:block;position:absolute;top:5px;width:8px;height:4px;border-radius:2px;background:#fff;content:"";}
|
||||||
}
|
}
|
||||||
&.disabled &__label::before {right:7px;}
|
&.disabled &__label::before {right:5px;}
|
||||||
&.disabled.checked &__label::before {left:7px;}
|
&.disabled.checked &__label::before {left:5px;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -128,6 +128,12 @@ Anot.component('switch', {
|
||||||
if (props.hasOwnProperty('disabled')) {
|
if (props.hasOwnProperty('disabled')) {
|
||||||
state.disabled = true
|
state.disabled = true
|
||||||
}
|
}
|
||||||
|
if (props.hasOwnProperty('checked')) {
|
||||||
|
if (state.value === null) {
|
||||||
|
state.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
state.value = !!state.value
|
||||||
|
|
||||||
this.classList.add('do-switch')
|
this.classList.add('do-switch')
|
||||||
this.classList.add('do-fn-noselect')
|
this.classList.add('do-fn-noselect')
|
||||||
|
@ -145,7 +151,7 @@ Anot.component('switch', {
|
||||||
`
|
`
|
||||||
},
|
},
|
||||||
state: {
|
state: {
|
||||||
value: false,
|
value: null,
|
||||||
disabled: false
|
disabled: false
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -36,7 +36,8 @@ const LANGUAGES = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LANGUAGES['zh-CN'] = LANGUAGES.zh
|
LANGUAGES['zh-CN'] = LANGUAGES.zh
|
||||||
const lang = LANGUAGES[Anot.language || navigator.language] || LANGUAGES.en
|
const lang =
|
||||||
|
LANGUAGES[window.__ENV_LANG__ || navigator.language] || LANGUAGES.en
|
||||||
let layerDom = {}
|
let layerDom = {}
|
||||||
let layerObj = {}
|
let layerObj = {}
|
||||||
let unique = null // 储存当前打开的1/2/3类型的弹窗
|
let unique = null // 储存当前打开的1/2/3类型的弹窗
|
||||||
|
|
|
@ -81,7 +81,8 @@ const LANGUAGES = {
|
||||||
}
|
}
|
||||||
LANGUAGES['zh-CN'] = LANGUAGES.zh
|
LANGUAGES['zh-CN'] = LANGUAGES.zh
|
||||||
LANGUAGES['zh-TW'] = LANGUAGES.zh
|
LANGUAGES['zh-TW'] = LANGUAGES.zh
|
||||||
const lang = LANGUAGES[Anot.language || navigator.language] || LANGUAGES.en
|
const lang =
|
||||||
|
LANGUAGES[window.__ENV_LANG__ || navigator.language] || LANGUAGES.en
|
||||||
|
|
||||||
const fixCont = function(vm, tool) {
|
const fixCont = function(vm, tool) {
|
||||||
let limit = false
|
let limit = false
|
||||||
|
|
|
@ -79,7 +79,8 @@ const LANGUAGES = {
|
||||||
}
|
}
|
||||||
LANGUAGES['zh-CN'] = LANGUAGES.zh
|
LANGUAGES['zh-CN'] = LANGUAGES.zh
|
||||||
LANGUAGES['zh-TW'] = LANGUAGES.zh
|
LANGUAGES['zh-TW'] = LANGUAGES.zh
|
||||||
const lang = LANGUAGES[Anot.language || navigator.language] || LANGUAGES.en
|
const lang =
|
||||||
|
LANGUAGES[window.__ENV_LANG__ || navigator.language] || LANGUAGES.en
|
||||||
|
|
||||||
class Uploader {
|
class Uploader {
|
||||||
constructor(url) {
|
constructor(url) {
|
||||||
|
|
|
@ -140,7 +140,8 @@ const LANGUAGES = {
|
||||||
}
|
}
|
||||||
LANGUAGES['zh-CN'] = LANGUAGES.zh
|
LANGUAGES['zh-CN'] = LANGUAGES.zh
|
||||||
LANGUAGES['zh-TW'] = LANGUAGES.zh
|
LANGUAGES['zh-TW'] = LANGUAGES.zh
|
||||||
const lang = LANGUAGES[Anot.language || navigator.language] || LANGUAGES.en
|
const lang =
|
||||||
|
LANGUAGES[window.__ENV_LANG__ || navigator.language] || LANGUAGES.en
|
||||||
|
|
||||||
marked.setOptions({
|
marked.setOptions({
|
||||||
highlight: function(code, lang) {
|
highlight: function(code, lang) {
|
||||||
|
@ -507,6 +508,7 @@ Anot.component('meditor', {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
safeMode: true,
|
safeMode: true,
|
||||||
|
revise: Anot.PropsTypes.isFunction(),
|
||||||
created: Anot.PropsTypes.isFunction(),
|
created: Anot.PropsTypes.isFunction(),
|
||||||
onUpdate: Anot.PropsTypes.isFunction(),
|
onUpdate: Anot.PropsTypes.isFunction(),
|
||||||
onFullscreen: Anot.PropsTypes.isFunction()
|
onFullscreen: Anot.PropsTypes.isFunction()
|
||||||
|
@ -606,6 +608,9 @@ Anot.component('meditor', {
|
||||||
}
|
}
|
||||||
//只解析,不渲染
|
//只解析,不渲染
|
||||||
this.__tmp__ = marked(txt)
|
this.__tmp__ = marked(txt)
|
||||||
|
if (typeof this.props.revise === 'function') {
|
||||||
|
this.__tmp__ = this.props.revise(this.__tmp__)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Reference in New Issue