feat(comments): full 1:1 zibll comment kernel for posts, forum, shop

Extract shared comment helpers (content/item/form/geo/actions), port GIF
[g=] smilies + FixedInput/moveForm UX, wire close_comments/city/quick
settings, REST comment get, and align product review chrome with zibll.
This commit is contained in:
2026-07-18 15:51:47 +08:00
parent 9edd39c33d
commit 276a2891ba
116 changed files with 2658 additions and 1848 deletions
+22 -7
View File
@@ -116,6 +116,8 @@ trait ScriptsPart1c {
'aksrt-core-slider' => 'slider.js',
'aksrt-core-article' => 'article.js',
'aksrt-core-comments' => 'comments.js',
'aksrt-core-comment-fixed' => 'comment-fixed-input.js',
'aksrt-core-comment-move' => 'comment-move-form.js',
'aksrt-core-pagination' => 'pagination.js',
'aksrt-core-archive' => 'archive.js',
'aksrt-core-footer-tabbar' => 'footer-tabbar.js',
@@ -424,28 +426,38 @@ trait ScriptsPart1c {
}
// Comment toolbar (emoji, code, bold, Ctrl+Enter) — only when the form is open.
if (is_singular() && comments_open()) {
// Comment toolbar (smilie/code/image/quick shortcodes) — post form or forum topic reply.
$load_comment_tools = (is_singular() && comments_open())
|| (is_singular('aksrt_forum_topic') || is_singular('forum_topic'));
if ($load_comment_tools) {
$comment_tools_path = get_template_directory() . '/assets/js/comment-tools.js';
wp_enqueue_script(
'aksrt-comment-tools',
$base_uri . '/assets/js/comment-tools.js',
['aksrt-script'],
['aksrt-script', 'aksrt-core-comment-fixed', 'aksrt-core-comment-move'],
file_exists($comment_tools_path) ? (string) filemtime($comment_tools_path) : $version,
true
);
$comment_tools_css = get_template_directory() . '/assets/css/frontend/comment-tools.css';
if (file_exists($comment_tools_css)) {
wp_enqueue_style(
'aksrt-comment-tools',
$base_uri . '/assets/css/frontend/comment-tools.css',
['aksrt-comments'],
(string) filemtime($comment_tools_css)
);
}
}
// Comment actions client (like / edit / delete / moderate / pin) — load
// wherever comments can exist, including closed-comment posts. Submission
// itself is handled by main.js initCommentSystem().
// Comment actions client (like / edit / delete / moderate / pin).
// Submit path lives in assets/js/core/comments.js (REST).
if (is_singular() && (comments_open() || (int) get_comments_number() > 0)) {
$comment_ajax_path = get_template_directory() . '/assets/js/comment-ajax.js';
if (file_exists($comment_ajax_path)) {
wp_enqueue_script(
'aksrt-comment-ajax',
$base_uri . '/assets/js/comment-ajax.js',
['aksrt-script'],
['aksrt-script', 'aksrt-core-comments'],
(string) filemtime($comment_ajax_path),
true
);
@@ -534,6 +546,9 @@ trait ScriptsPart1c {
'commentUploadUrl' => esc_url_raw(rest_url('aksrt/v1/comment/upload-image')),
'commentUploadMaxSize' => 2 * 1024 * 1024,
'commentIasMax' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_comment_display_settings()['paging_ajax_ias_max'] : 3,
'commentQuickPhrases' => class_exists('\AKSRT\Settings\Settings') ? (\AKSRT\Settings\Settings::get_comment_display_settings()['quick_phrases'] ?? []) : [],
'commentSmiliesBase' => function_exists('aksrt_comment_smilies_base_uri') ? aksrt_comment_smilies_base_uri() : (trailingslashit(get_template_directory_uri()) . 'assets/img/smilies/'),
'restUrl' => esc_url_raw(rest_url('aksrt/v1')),
'stickyEnabled' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_post_list_style_settings()['sticky_enabled'] : true,
'stickyPages' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_post_list_style_settings()['sticky_pages'] : ['home', 'cat'],
'badgeShow' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_post_list_style_settings()['badge_show'] : true,