Skip to content

Commit

Permalink
fix(client): add sanitize-html to MkAutocomplete (misskey-dev#9433)
Browse files Browse the repository at this point in the history
* fix(server): /emoji to accept `@.` host expression

* fix(client): use MkEmoji for custom emoji in MkEmojiPicker

* change convertToWebp

* nanka iroiro

* remove

* fix

* nearLosslessは労多くして益少なしなのでやめる

* do not cleanup tmp for development

* update sharp.js to 0.31.3

* mixed: true

* fix MkAutocomplete of 912791b

* clean up

* misskey-dev#9431 (comment)

* edit mkautocomplete.vue use sanitize-html

* fix package.json
  • Loading branch information
tamaina committed Dec 30, 2022
1 parent f213f30 commit 87a0ed8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions packages/frontend/package.json
Expand Up @@ -45,6 +45,7 @@
"rndstr": "1.0.0",
"rollup": "3.9.0",
"s-age": "1.1.2",
"sanitize-html": "^2.8.1",
"sass": "1.57.1",
"seedrandom": "3.0.5",
"strict-event-emitter-types": "2.0.0",
Expand Down Expand Up @@ -73,6 +74,7 @@
"@types/katex": "0.14.0",
"@types/matter-js": "0.18.2",
"@types/punycode": "2.1.0",
"@types/sanitize-html": "^2.8.0",
"@types/seedrandom": "3.0.3",
"@types/throttle-debounce": "5.0.0",
"@types/tinycolor2": "1.4.3",
Expand Down
10 changes: 9 additions & 1 deletion packages/frontend/src/components/MkAutocomplete.vue
Expand Up @@ -21,7 +21,8 @@
<MkEmoji :emoji="emoji.emoji" />
</div>
<!-- eslint-disable-next-line vue/no-v-html -->
<span class="name" v-html="emoji.name.replace(q ?? '', `<b>${q}</b>`)"></span>
<span v-if="q" class="name" v-html="sanitizeHtml(emoji.name.replace(q, `<b>${q}</b>`))"></span>
<span v-else v-text="emoji.name"></span>
<span v-if="emoji.aliasOf" class="alias">({{ emoji.aliasOf }})</span>
</li>
</ol>
Expand All @@ -44,6 +45,7 @@ import { defaultStore } from '@/store';
import { emojilist } from '@/scripts/emojilist';
import { instance } from '@/instance';
import { i18n } from '@/i18n';
import * as sanitizeHtml from 'sanitize-html';
type EmojiDef = {
emoji: string;
Expand Down Expand Up @@ -453,6 +455,7 @@ onBeforeUnmount(() => {
> .emojis > li {
.emoji {
flex-shrink: 0;
display: flex;
margin: 0 4px 0 0;
height: 24px;
Expand All @@ -469,7 +472,12 @@ onBeforeUnmount(() => {
}
.name {
flex-shrink: 1;
}
.alias {
flex-shrink: 9999999;
margin: 0 0 0 8px;
}
}
Expand Down
6 changes: 4 additions & 2 deletions yarn.lock
Expand Up @@ -2644,7 +2644,7 @@ __metadata:
languageName: node
linkType: hard

"@types/sanitize-html@npm:2.8.0":
"@types/sanitize-html@npm:2.8.0, @types/sanitize-html@npm:^2.8.0":
version: 2.8.0
resolution: "@types/sanitize-html@npm:2.8.0"
dependencies:
Expand Down Expand Up @@ -8055,6 +8055,7 @@ __metadata:
"@types/katex": 0.14.0
"@types/matter-js": 0.18.2
"@types/punycode": 2.1.0
"@types/sanitize-html": ^2.8.0
"@types/seedrandom": 3.0.3
"@types/throttle-debounce": 5.0.0
"@types/tinycolor2": 1.4.3
Expand Down Expand Up @@ -8101,6 +8102,7 @@ __metadata:
rndstr: 1.0.0
rollup: 3.9.0
s-age: 1.1.2
sanitize-html: ^2.8.1
sass: 1.57.1
seedrandom: 3.0.5
start-server-and-test: 1.15.2
Expand Down Expand Up @@ -14944,7 +14946,7 @@ __metadata:
languageName: node
linkType: hard

"sanitize-html@npm:2.8.1":
"sanitize-html@npm:2.8.1, sanitize-html@npm:^2.8.1":
version: 2.8.1
resolution: "sanitize-html@npm:2.8.1"
dependencies:
Expand Down

0 comments on commit 87a0ed8

Please sign in to comment.