进行了一些小优化

This commit is contained in:
2026-08-30 20:20:31 +08:00
parent 95540ea32c
commit 4c62fda62b
11 changed files with 290 additions and 13 deletions
+5 -1
View File
@@ -464,8 +464,12 @@ if (!function_exists('aksrt_comments_render_form')) :
return;
}
if (function_exists('aksrt_get_comment_virtual_input_html')) {
echo aksrt_get_comment_virtual_input_html($placeholder, '#respond'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
?>
<div id="respond">
<div id="respond" class="mobile-fixed">
<div class="fixed-body"></div>
<form id="commentform" method="post" action="<?php echo esc_url(site_url('/wp-comments-post.php')); ?>">
<div class="flex ac">
<div class="comt-title text-center flex0 mr10">
+27 -2
View File
@@ -1,8 +1,8 @@
<?php
/**
* Comment form partials — expand toolbar (legacy DOM contract).
* Comment form partials — virtual-input + expand toolbar (legacy DOM contract).
*
* Mirrors legacy()
* Mirrors legacy() and legacy()
* from legacy/inc/functions.
*
* @package AKSRT
@@ -10,6 +10,31 @@
defined('ABSPATH') || exit;
if (!function_exists('aksrt_get_comment_virtual_input_html')) :
/**
* Mobile virtual input bar (legacy: legacy).
*
* @param string $placeholder Placeholder text.
* @param string $target CSS selector for the FixedInput target.
* @return string
*/
function aksrt_get_comment_virtual_input_html(string $placeholder = '', string $target = '#respond'): string {
$user_id = get_current_user_id();
$avatar = get_avatar($user_id, 36, '', '', ['class' => 'avatar']);
if ($placeholder === '') {
$placeholder = __('说点什么吧...', 'aksrt');
}
$html = '<div class="flex ac jsb virtual-input" fixed-input="' . esc_attr($target) . '">';
$html .= '<div class="flex flex1 ac">';
$html .= $avatar;
$html .= '<div class="text-ellipsis simulation mr10">' . esc_html($placeholder) . '</div>';
$html .= '</div>';
$html .= '<span class="but c-blue">' . esc_html__('提交', 'aksrt') . '</span>';
$html .= '</div>';
return $html;
}
endif;
if (!function_exists('aksrt_get_input_expand_but')) :
/**
* legacy-style expand toolbar button + dropdown (legacy: legacy).