fix(comments): align image upload with Zibll
Unify comment image upload settings, REST permissions, preview, progress, and response handling while removing obsolete compatibility paths.
This commit is contained in:
@@ -68,21 +68,36 @@ if (!function_exists('aksrt_get_input_expand_but')) :
|
||||
$dropdown .= '</div>';
|
||||
break;
|
||||
|
||||
case 'image':
|
||||
$upload = !empty($arg1) || !empty($ctx['upload']);
|
||||
$but = '<a class="but btn-input-expand input-image mr6" href="javascript:;"><i class="fa fas fa-fw fa-image" aria-hidden="true"></i><span class="hide-sm">' . esc_html__('图片', 'aksrt') . '</span></a>';
|
||||
case 'image':
|
||||
$upload = !empty($arg1) || !empty($ctx['upload']);
|
||||
$upload_id = 'comment';
|
||||
$but = '<a class="but btn-input-expand input-image mr6" href="javascript:;"><i class="fa fas fa-fw fa-image" aria-hidden="true"></i><span class="hide-sm">' . esc_html__('图片', 'aksrt') . '</span></a>';
|
||||
|
||||
$dropdown = '<div class="dropdown-image">';
|
||||
$dropdown .= '<p>' . esc_html__('请填写图片地址:', 'aksrt') . '</p>';
|
||||
$dropdown .= '<p><textarea rows="2" tabindex="1" class="form-control input-textarea input-image-url" style="height:95px;" placeholder="http://..."></textarea></p>';
|
||||
$dropdown .= '<div class="text-right">';
|
||||
if ($upload) {
|
||||
$dropdown .= '<a class="but c-yellow mr10 pw-1em input-image-upload" href="javascript:;">' . esc_html__('上传图片', 'aksrt') . '</a>';
|
||||
}
|
||||
$dropdown .= '<a type="submit" class="but c-blue pw-1em input-image-submit" href="javascript:;">' . esc_html__('确认', 'aksrt') . '</a>';
|
||||
$dropdown .= '</div>';
|
||||
$dropdown .= '</div>';
|
||||
break;
|
||||
$dropdown = '<div class="tab-content comment-image-tabs">';
|
||||
$dropdown .= '<div class="tab-pane fade in active dropdown-image" id="image-tab-' . esc_attr($upload_id) . '-1">';
|
||||
$dropdown .= '<p>' . esc_html__('请填写图片地址:', 'aksrt') . '</p>';
|
||||
$dropdown .= '<p><textarea rows="2" tabindex="1" class="form-control input-textarea input-image-url" style="height:95px;" placeholder="http://..."></textarea></p>';
|
||||
$dropdown .= '<div class="text-right">';
|
||||
if ($upload) {
|
||||
$dropdown .= '<a class="but c-yellow mr10 pw-1em input-image-upload-tab" data-image-tab="#image-tab-' . esc_attr($upload_id) . '-2" href="javascript:;">' . esc_html__('上传图片', 'aksrt') . '</a>';
|
||||
}
|
||||
$dropdown .= '<a type="submit" class="but c-blue pw-1em input-image-submit" href="javascript:;">' . esc_html__('确认', 'aksrt') . '</a>';
|
||||
$dropdown .= '</div></div>';
|
||||
|
||||
if ($upload) {
|
||||
$placeholder = get_template_directory_uri() . '/assets/img/upload-add.svg';
|
||||
$dropdown .= '<div class="tab-pane fade dropdown-image" id="image-tab-' . esc_attr($upload_id) . '-2">';
|
||||
$dropdown .= '<p><a class="muted-color input-image-address-tab" data-image-tab="#image-tab-' . esc_attr($upload_id) . '-1" href="javascript:;"><i class="fa fa-angle-left mr6" aria-hidden="true"></i>' . esc_html__('填写图片地址', 'aksrt') . '</a></p>';
|
||||
$dropdown .= '<div class="form-upload comment-image-upload">';
|
||||
$dropdown .= '<label class="pointer comment-image-upload-label">';
|
||||
$dropdown .= '<div class="preview text-center mb6"><img src="' . esc_url($placeholder) . '" alt="" /></div>';
|
||||
$dropdown .= '<input class="hide comment-image-file" type="file" id="input_' . esc_attr($upload_id) . '_image_upload" accept="image/gif,image/jpeg,image/jpg,image/png" name="image">';
|
||||
$dropdown .= '</label>';
|
||||
$dropdown .= '<div class="text-right"><button type="button" class="but jb-blue pw-1em input-expand-upload" data-comment-upload-submit="1">' . esc_html__('确认上传', 'aksrt') . '</button></div>';
|
||||
$dropdown .= '</div></div>';
|
||||
}
|
||||
$dropdown .= '</div>';
|
||||
break;
|
||||
|
||||
default:
|
||||
return '';
|
||||
|
||||
Reference in New Issue
Block a user