feat(client): Convert text mfm node to text (v)dom node instead of span tag (#6399)

* Convert text mfm node to text (v)dom node
instead of span tag

* Update mfm.ts

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
tamaina 2020-05-31 12:57:21 +09:00 committed by GitHub
parent a1e0c866aa
commit 8d48e4c76e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
import Vue, { VNode } from 'vue'; import Vue, { VNode } from 'vue';
import { MfmForest } from '../../mfm/types'; import { MfmForest } from '../../mfm/prelude';
import { parse, parsePlain } from '../../mfm/parse'; import { parse, parsePlain } from '../../mfm/parse';
import MkUrl from './url.vue'; import MkUrl from './url.vue';
import MkLink from './link.vue'; import MkLink from './link.vue';
@ -53,11 +53,11 @@ export default Vue.component('misskey-flavored-markdown', {
if (!this.plain) { if (!this.plain) {
const x = text.split('\n') const x = text.split('\n')
.map(t => t == '' ? [createElement('br')] : [createElement('span', t), createElement('br')]); .map(t => t == '' ? [createElement('br')] : [this._v(t), createElement('br')]); // NOTE: this._vはHACK SEE: https://github.com/syuilo/misskey/pull/6399#issuecomment-632820283
x[x.length - 1].pop(); x[x.length - 1].pop();
return x; return x;
} else { } else {
return [createElement('span', text.replace(/\n/g, ' '))]; return [this._v(text.replace(/\n/g, ' '))];
} }
} }