修复markd解析代码中有_和*时不正常的bug

master
yutent 2023-04-04 15:52:12 +08:00
parent 64f2637c93
commit cccedf0321
2 changed files with 8 additions and 8 deletions

View File

@ -111,7 +111,6 @@ class Layer extends Component {
::slotted(&__input) { ::slotted(&__input) {
flex: 1; flex: 1;
height: 36px;
} }
::slotted(&__toast) { ::slotted(&__toast) {
@ -255,11 +254,11 @@ class Layer extends Component {
#dragIns = null #dragIns = null
mounted() { mounted() {
this.$refs.box.$anim.start() this.$refs.box.$animate()
} }
updated() { updated() {
this.$refs.box.$anim.start() this.$refs.box.$animate()
} }
/** /**
@ -306,15 +305,13 @@ class Layer extends Component {
if (ev.target.tagName === 'BUTTON') { if (ev.target.tagName === 'BUTTON') {
let idx = +ev.target.dataset.idx let idx = +ev.target.dataset.idx
this.$refs.box.$anim.start(true) this.$refs.box.$animate(true).then(_ => this.close())
this.close()
} }
} }
render() { render() {
return html` return html`
<div ref="box" #animation=${{ type: 'fade' }} class="layer"> <div ref="box" #animation=${{ type: 'micro-bounce' }} class="layer">
<div <div
class="layer__title noselect" class="layer__title noselect"
style=${styleMap({ display: !!this.title ? '' : 'none' })} style=${styleMap({ display: !!this.title ? '' : 'none' })}

View File

@ -88,7 +88,10 @@ const Decoder = {
// 内联样式 // 内联样式
inline(str) { inline(str) {
return str return str
.replace(INLINE.code, '<code class="inline">$1</code>') .replace(INLINE.code, (m, str) => {
str = str.replace(/([_*~])/g, '\\$1')
return `<code class="inline">${str}</code>`
})
.replace(INLINE.strong[0], '<strong>$1</strong>') .replace(INLINE.strong[0], '<strong>$1</strong>')
.replace(INLINE.strong[1], '<strong>$1</strong>') .replace(INLINE.strong[1], '<strong>$1</strong>')
.replace(INLINE.em[0], '<em>$1</em>') .replace(INLINE.em[0], '<em>$1</em>')