feat(creator-studio): icon toolbar with block tools, drop author strip

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Opus 5 committed 2026-11-06 22:30:08 +08:00
1 parent 7bdf7cf018
commit 7c33482be7
19 files changed
+600 -241

No files matched your search

-33
View File
@@ -153,8 +153,6 @@ final class CreatorRest {
'titlePlaceholder' => (string) $settings['title_placeholder'],
'contentPlaceholder' => (string) $settings['content_placeholder'],
],
// 作者行数据由服务端给出,前端不自行拼装昵称/头像。
'author' => $this->author_payload($editable, $user_id),
'privateUploads' => $this->private_upload_rows($user_id, $post_id),
'privateStorage' => PrivateAssets::is_available(),
'media' => [
@@ -566,37 +564,6 @@ final class CreatorRest {
];
}
/**
* 作者行数据:昵称、头像与身份说明。
*
* @return array{name:string,avatar:string,meta:string}
*/
private function author_payload(?\WP_Post $editable, int $user_id): array {
$author_id = $editable instanceof \WP_Post ? (int) $editable->post_author : $user_id;
$user = $author_id > 0 ? get_userdata($author_id) : null;
if (!$user) {
return ['name' => '', 'avatar' => '', 'meta' => ''];
}
$avatar = function_exists('jio_get_avatar_url') ? (string) jio_get_avatar_url($author_id, ['size' => 64]) : '';
if ($avatar === '' && function_exists('get_avatar_url')) {
$avatar = (string) get_avatar_url($author_id, ['size' => 64]);
}
$meta = '';
if ($author_id !== $user_id) {
$meta = __('原作者', 'jio');
} elseif (function_exists('jio_get_user_vip_level') && (int) jio_get_user_vip_level($user_id) > 0) {
$meta = sprintf(__('VIP%s', 'jio'), (string) max(1, min(2, (int) jio_get_user_vip_level($user_id))));
}
return [
'name' => (string) $user->display_name,
'avatar' => $avatar,
'meta' => $meta,
];
}
/**
* @param array<string, mixed> $post_meta
* @return array<string, mixed>