From 2c007ff36fd7f05d470dd0f60bf1538858c04b12 Mon Sep 17 00:00:00 2001 From: syuilo <syuilotan@yahoo.co.jp> Date: Sat, 24 Feb 2018 07:54:37 +0900 Subject: [PATCH] Fix #1130 --- .../app/common/views/components/post-html.ts | 6 ++- .../desktop/views/components/posts.post.vue | 49 +++++++++---------- .../mobile/views/components/posts.post.vue | 28 ++++++----- 3 files changed, 44 insertions(+), 39 deletions(-) diff --git a/src/web/app/common/views/components/post-html.ts b/src/web/app/common/views/components/post-html.ts index 37954cd7e7..adb025589d 100644 --- a/src/web/app/common/views/components/post-html.ts +++ b/src/web/app/common/views/components/post-html.ts @@ -81,7 +81,11 @@ export default Vue.component('mk-post-html', { case 'code': return createElement('pre', [ - createElement('code', token.html) + createElement('code', { + domProps: { + innerHTML: token.html + } + }) ]); case 'inline-code': diff --git a/src/web/app/desktop/views/components/posts.post.vue b/src/web/app/desktop/views/components/posts.post.vue index 4ae980648c..4898de0b6b 100644 --- a/src/web/app/desktop/views/components/posts.post.vue +++ b/src/web/app/desktop/views/components/posts.post.vue @@ -37,7 +37,7 @@ <a :href="`${_CH_URL_}/${p.channel.id}`" target="_blank">{{ p.channel.title }}</a>: </p> <a class="reply" v-if="p.reply">%fa:reply%</a> - <mk-post-html v-if="p.ast" :ast="p.ast" :i="os.i"/> + <mk-post-html v-if="p.ast" :ast="p.ast" :i="os.i" :class="$style.text"/> <a class="quote" v-if="p.repost">RP:</a> <mk-url-preview v-for="url in urls" :url="url" :key="url"/> </div> @@ -413,9 +413,6 @@ export default Vue.extend({ font-size 1.1em color #717171 - > .dummy - display none - .mk-url-preview margin-top 8px @@ -431,27 +428,6 @@ export default Vue.extend({ font-style oblique color #a0bf46 - code - padding 4px 8px - margin 0 0.5em - font-size 80% - color #525252 - background #f8f8f8 - border-radius 2px - - pre > code - padding 16px - margin 0 - - [data-is-me]:after - content "you" - padding 0 4px - margin-left 4px - font-size 80% - color $theme-color-foreground - background $theme-color - border-radius 4px - > .mk-poll font-size 80% @@ -505,3 +481,26 @@ export default Vue.extend({ </style> +<style lang="stylus" module> +.text + code + padding 4px 8px + margin 0 0.5em + font-size 80% + color #525252 + background #f8f8f8 + border-radius 2px + + pre > code + padding 16px + margin 0 + + [data-is-me]:after + content "you" + padding 0 4px + margin-left 4px + font-size 80% + color $theme-color-foreground + background $theme-color + border-radius 4px +</style> diff --git a/src/web/app/mobile/views/components/posts.post.vue b/src/web/app/mobile/views/components/posts.post.vue index 87b8032c89..ae1dfc59ab 100644 --- a/src/web/app/mobile/views/components/posts.post.vue +++ b/src/web/app/mobile/views/components/posts.post.vue @@ -34,7 +34,7 @@ <a class="reply" v-if="p.reply"> %fa:reply% </a> - <mk-post-html v-if="p.ast" :ast="p.ast" :i="os.i"/> + <mk-post-html v-if="p.ast" :ast="p.ast" :i="os.i" :class="$style.text"/> <mk-url-preview v-for="url in urls" :url="url" :key="url"/> <a class="quote" v-if="p.repost != null">RP:</a> </div> @@ -364,18 +364,6 @@ export default Vue.extend({ font-style oblique color #a0bf46 - code - padding 4px 8px - margin 0 0.5em - font-size 80% - color #525252 - background #f8f8f8 - border-radius 2px - - pre > code - padding 16px - margin 0 - [data-is-me]:after content "you" padding 0 4px @@ -445,3 +433,17 @@ export default Vue.extend({ </style> +<style lang="stylus" module> +.text + code + padding 4px 8px + margin 0 0.5em + font-size 80% + color #525252 + background #f8f8f8 + border-radius 2px + + pre > code + padding 16px + margin 0 +</style>