mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
ui: fix comment action
This commit is contained in:
1 parent
25f1a4ce81
commit
5e4cdd3164
5 files changed
+15
-15
No files matched your search
@@ -24,13 +24,13 @@ const xss = new Xss.FilterXSS({
|
||||
dd: [],
|
||||
del: ['datetime'],
|
||||
details: ['open'],
|
||||
div: ['id','class'],
|
||||
div: ['id', 'class'],
|
||||
dl: [],
|
||||
dt: [],
|
||||
em: [],
|
||||
font: ['color', 'size', 'face'],
|
||||
h1: ['id'],
|
||||
h2: ['id','class'],
|
||||
h2: ['id', 'class'],
|
||||
h3: ['id'],
|
||||
h4: ['id'],
|
||||
h5: ['id'],
|
||||
@@ -66,8 +66,11 @@ const xss = new Xss.FilterXSS({
|
||||
var: [],
|
||||
video: ['autoplay', 'controls', 'loop', 'preload', 'src', 'height', 'width'],
|
||||
},
|
||||
allowCommentTag: false,
|
||||
stripIgnoreTagBody: ['script'],
|
||||
safeAttrValue(tag, name, value) {
|
||||
if (name === 'id') return `xss-id-${value}`;
|
||||
if (name === 'class') return value.replace(/badge/g, 'xss-badge');
|
||||
return value;
|
||||
},
|
||||
});
|
||||
|
||||
@@ -64,9 +64,6 @@ $downvote-color = red
|
||||
// FIXME doesn't work on IE 11
|
||||
display: flex
|
||||
|
||||
>.media__body
|
||||
width: calc(100% - (50px + 0.625rem))
|
||||
|
||||
&:last-child
|
||||
>.media
|
||||
padding-bottom: 0
|
||||
|
||||
@@ -111,6 +111,7 @@ async function onCommentClickReplyComment(ev, options: any = {}) {
|
||||
}
|
||||
|
||||
async function onCommentClickReplyReply(ev) {
|
||||
console.log(ev);
|
||||
const $evTarget = $(ev.currentTarget);
|
||||
const $mediaBody = $evTarget.closest('.media__body');
|
||||
const uid = $mediaBody
|
||||
@@ -119,7 +120,7 @@ async function onCommentClickReplyReply(ev) {
|
||||
|
||||
$evTarget
|
||||
.closest('.dczcomments__item')
|
||||
.find('[name="dczcomments__op-reply-comment"]').eq(0)
|
||||
.find('[data-op="reply"][data-type="comment"]').eq(0)
|
||||
.trigger('click', { initialText: `@[](/user/${uid.trim()}) ` });
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.31.7",
|
||||
"version": "4.31.8",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
|
||||
@@ -109,22 +109,21 @@
|
||||
<div class="media__body top">
|
||||
<div class="clearfix">
|
||||
<div class="supplementary dczcomments__supplementary">
|
||||
{{ user.render_inline(udoc) }}
|
||||
@ {{ datetimeSpan(doc._id)|safe }}
|
||||
{{ user.render_inline(udoc) }} @ {{ datetimeSpan(doc._id)|safe }}
|
||||
</div>
|
||||
<div class="dczcomments__operations nojs--hide">
|
||||
{% if handler.user.hasPerm(reply_post_perm) %}
|
||||
<a href="javascript:;" data-tooltip="{{ _('Reply') }}" name="dczcomments__op-reply-comment"
|
||||
<a href="javascript:;" data-tooltip="{{ _('Reply') }}" data-op="reply" data-type="comment"
|
||||
data-form="{{ {operation: reply_post_op, psid: doc._id}|json }}"
|
||||
><span class="icon icon-reply"></span></a>
|
||||
{% endif %}
|
||||
{% if (handler.user.hasPerm(comment_edit_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(comment_edit_perm) %}
|
||||
<a href="javascript:;" data-tooltip="{{ _('Edit') }}" name="dczcomments__op-edit-comment"
|
||||
<a href="javascript:;" data-tooltip="{{ _('Edit') }}" data-op="edit" data-type="comment"
|
||||
data-form="{{ {operation: comment_edit_op, psid: doc._id}|json }}"
|
||||
><span class="icon icon-edit"></span></a>
|
||||
{% endif %}
|
||||
{% if (handler.user.hasPerm(comment_delete_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(comment_delete_perm) %}
|
||||
<a href="javascript:;" data-tooltip="{{ _('Delete') }}" name="dczcomments__op-delete-comment"
|
||||
<a href="javascript:;" data-tooltip="{{ _('Delete') }}" data-op="delete" data-type="comment"
|
||||
data-form="{{ {operation: comment_delete_op, psid: doc._id}|json }}"
|
||||
><span class="icon icon-delete"></span></a>
|
||||
{% endif %}
|
||||
@@ -146,15 +145,15 @@
|
||||
</div>
|
||||
<div class="dczcomments__operations nojs--hide">
|
||||
{% if handler.user.hasPerm(reply_post_perm) %}
|
||||
<a href="javascript:;" data-tooltip="{{ _('Reply') }}" name="dczcomments__op-reply-reply"><span class="icon icon-reply"></span></a>
|
||||
<a href="javascript:;" data-tooltip="{{ _('Reply') }}" data-op="reply" data-type="reply"><span class="icon icon-reply"></span></a>
|
||||
{% endif %}
|
||||
{% if (handler.user.hasPerm(reply_edit_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(reply_edit_perm) %}
|
||||
<a href="javascript:;" data-tooltip="{{ _('Edit') }}" name="dczcomments__op-edit-reply"
|
||||
<a href="javascript:;" data-tooltip="{{ _('Edit') }}" data-op="edit" data-type="reply"
|
||||
data-form="{{ {operation: reply_edit_op, psid: doc._id, psrid: rdoc._id}|json }}"
|
||||
><span class="icon icon-edit"></span></a>
|
||||
{% endif %}
|
||||
{% if (handler.user.hasPerm(reply_delete_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(reply_delete_perm) %}
|
||||
<a href="javascript:;" data-tooltip="{{ _('Delete') }}" name="dczcomments__op-delete-reply"
|
||||
<a href="javascript:;" data-tooltip="{{ _('Delete') }}" data-op="delete" data-type="reply"
|
||||
data-form="{{ {operation: reply_delete_op, psid: doc._id, psrid: rdoc._id}|json }}"
|
||||
><span class="icon icon-delete"></span></a>
|
||||
{% endif %}
|
||||
|
||||
Reference in new issue
Block a user