Bugfix + visual tweak

next
neobooru 2021-11-23 18:26:27 +01:00
parent 349894d4f9
commit c59caef23a
3 changed files with 19 additions and 7 deletions

View File

@ -46,7 +46,7 @@ export default class SzuruWrapper {
}
async updateTag(tag: Tag): Promise<any> {
return (await this.apiPut("tag/" + tag.names[0], tag)).data;
return (await this.apiPut("tag/" + encodeURIComponent(tag.names[0]), tag)).data;
}
async getTags(
@ -75,7 +75,7 @@ export default class SzuruWrapper {
tags: post.tags.map(x => x.name),
safety: post.rating,
source: post.source,
notes: post.notes.map(note => <SzuruNote>{ polygon: note.polygons, text: note.text }),
notes: post.notes,
contentUrl: post.contentUrl
};
@ -86,10 +86,7 @@ export default class SzuruWrapper {
}
async reverseSearch(contentUrl: string): Promise<ImageSearchResult> {
var obj = {
contentUrl: contentUrl
};
var obj = { contentUrl };
return (await this.apiPost("posts/reverse-search", obj)).data;
}

View File

@ -54,6 +54,15 @@ select {
display: inline;
}
.compact-tags > li {
/*
Ident each newline but not the first line.
This makes tagName line breaks look better, though it is a bit hacky.
*/
text-indent: -1.5ch;
padding-left: 1.5ch;
}
.tag-general {
color: #24aadd;
}
@ -94,6 +103,8 @@ a.remove-tag {
.tag-usages {
font-size: 90%;
/* Reset text-indent set by ".compact-tags > li" because it clashes with our margin */
text-indent: initial;
margin-left: 0.7em;
}

View File

@ -82,7 +82,7 @@
<ul class="compact-tags">
<li v-for="tag in selectedPost.tags" :key="tag.name">
<a class="remove-tag" @click="removeTag(tag)">x</a>
<span :class="getTagClasses(tag)">{{ tag.name }}</span>
<span :class="getTagClasses(tag)" v-html="breakTagName(tag.name)"></span>
<span
v-if="showTagUsages"
class="tag-usages tag-usages-reserve-space"
@ -232,6 +232,10 @@ export default Vue.extend({
return classes;
},
breakTagName(tagName: string) {
// Based on https://stackoverflow.com/a/6316913
return tagName.replace(/\_/g, "_<wbr>");
},
// Remove tag from post's taglist
removeTag(tag: TagViewModel) {
if (this.selectedPost) {