3.2.25: 评论框改为所见即所得编辑器(B/I/颜色/表情可视化+序列化白名单+纯文本粘贴);后台资源 enqueue 版本号改跟 THEME_VERSION(修设置页重排被浏览器缓存挡住的问题)

This commit is contained in:
2026-10-24 22:38:10 +08:00
parent fd27b4d218
commit fb12d58067
5 changed files with 174 additions and 69 deletions
+11 -4
View File
@@ -241,13 +241,11 @@ if ($yang_per_page <= 0) {
<div class="comment-toolbar" role="toolbar"
aria-label="<?php esc_attr_e('评论格式工具条', 'kratos'); ?>">
<button type="button" class="comment-tool-btn" id="yang-tool-bold"
data-wrap-before="&lt;strong&gt;" data-wrap-after="&lt;/strong&gt;"
title="<?php esc_attr_e('加粗', 'kratos'); ?>"
aria-label="<?php esc_attr_e('加粗', 'kratos'); ?>">
<span class="comment-tool-glyph comment-tool-glyph-bold" aria-hidden="true">B</span>
</button>
<button type="button" class="comment-tool-btn" id="yang-tool-italic"
data-wrap-before="&lt;em&gt;" data-wrap-after="&lt;/em&gt;"
title="<?php esc_attr_e('斜体', 'kratos'); ?>"
aria-label="<?php esc_attr_e('斜体', 'kratos'); ?>">
<span class="comment-tool-glyph comment-tool-glyph-italic" aria-hidden="true">I</span>
@@ -304,8 +302,17 @@ if ($yang_per_page <= 0) {
</div>
<textarea class="comment-input" id="comment" name="comment" rows="6"
placeholder="<?php esc_attr_e('说点什么…(支持 :smile: 这类表情代码)', 'kratos'); ?>"
required="required" maxlength="65525"></textarea>
hidden aria-hidden="true" tabindex="-1"></textarea>
<?php /* 3.2.25 所见即所得编辑区:格式/表情所见即所得,
不再往框里插 <strong> 这类源码。真实内容提交前由
comments.js 序列化进上面隐藏的 #comment。
required 不能放隐藏 textarea 上(display:none 的
控件无法聚焦,原生校验会报错),空值检查在 JS 做。 */ ?>
<div class="comment-editor" id="yang-editor" contenteditable="true"
role="textbox" aria-multiline="true"
aria-label="<?php esc_attr_e('评论内容', 'kratos'); ?>"
data-placeholder="<?php esc_attr_e('说点什么…(加粗、颜色、表情点上方按钮)', 'kratos'); ?>"></div>
<div class="comment-bar">
<div class="comment-bar-right">