进行了一些小修复
This commit is contained in:
@@ -43,8 +43,36 @@ $is_can_new = !empty($ctx['is_can_new']);
|
||||
<?php else : ?>
|
||||
<div class="newposts-editor">
|
||||
<?php
|
||||
$toolbar1 = 'formatselect,bold,italic,bullist,numlist,alignleft,aligncenter,alignright,link,blockquote,code,fullscreen';
|
||||
$toolbar1 = ['formatselect', 'bold', 'italic', 'bullist', 'numlist', 'alignleft', 'aligncenter', 'alignright', 'link'];
|
||||
if (!empty($ctx['can_upload_img'])) {
|
||||
$toolbar1[] = 'aksrt_image';
|
||||
}
|
||||
if (!empty($ctx['can_hide'])) {
|
||||
$toolbar1[] = 'aksrt_hide';
|
||||
}
|
||||
$toolbar1 = implode(',', array_merge($toolbar1, ['blockquote', 'code', 'fullscreen']));
|
||||
$plugins = 'paste,link,lists,fullscreen,wordpress,wplink,charmap';
|
||||
$editor_plugin_path = get_template_directory() . '/assets/js/front-submit-editor.js';
|
||||
$editor_plugin_url = get_template_directory_uri() . '/assets/js/front-submit-editor.js';
|
||||
if (file_exists($editor_plugin_path)) {
|
||||
$editor_plugin_url = add_query_arg('ver', (string) filemtime($editor_plugin_path), $editor_plugin_url);
|
||||
}
|
||||
$editor_css_path = get_template_directory() . '/assets/css/frontend/pages/submit-editor.css';
|
||||
$editor_css_url = get_template_directory_uri() . '/assets/css/frontend/pages/submit-editor.css';
|
||||
if (file_exists($editor_css_path)) {
|
||||
$editor_css_url = add_query_arg('ver', (string) filemtime($editor_css_path), $editor_css_url);
|
||||
}
|
||||
$external_plugins = static function (array $external, string $editor_id) use ($editor_plugin_url): array {
|
||||
if ($editor_id === 'post_content') {
|
||||
$external['aksrt_editor_tools'] = $editor_plugin_url;
|
||||
}
|
||||
return $external;
|
||||
};
|
||||
$editor_content_css = static function (string $styles) use ($editor_css_url): string {
|
||||
return $styles . ($styles !== '' ? ',' : '') . $editor_css_url;
|
||||
};
|
||||
add_filter('mce_external_plugins', $external_plugins, 10, 2);
|
||||
add_filter('mce_css', $editor_content_css);
|
||||
$editor_settings = [
|
||||
'textarea_name' => 'post_content',
|
||||
'textarea_rows' => 20,
|
||||
@@ -61,34 +89,10 @@ $is_can_new = !empty($ctx['is_can_new']);
|
||||
],
|
||||
];
|
||||
wp_editor((string) $ctx['current_content'], 'post_content', $editor_settings);
|
||||
remove_filter('mce_external_plugins', $external_plugins, 10);
|
||||
remove_filter('mce_css', $editor_content_css, 10);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($ctx['can_hide']) || !empty($ctx['can_pay']) || !empty($ctx['can_upload_img'])) : ?>
|
||||
<div class="newposts-editor-tools">
|
||||
<?php if (!empty($ctx['can_upload_img'])) : ?>
|
||||
<button type="button" class="but" data-insert-upload-image>
|
||||
<i class="fa fas fa-image"></i> <?php esc_html_e('上传图片', 'aksrt'); ?>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($ctx['can_hide'])) : ?>
|
||||
<button type="button" class="but" data-insert-shortcode="hide" title="<?php esc_attr_e('插入登录后可见', 'aksrt'); ?>">
|
||||
<i class="fa fas fa-eye-slash"></i> <?php esc_html_e('登录可见', 'aksrt'); ?>
|
||||
</button>
|
||||
<button type="button" class="but" data-insert-shortcode="reply" title="<?php esc_attr_e('插入回复后可见', 'aksrt'); ?>">
|
||||
<i class="fa fas fa-comment-dots"></i> <?php esc_html_e('回复可见', 'aksrt'); ?>
|
||||
</button>
|
||||
<button type="button" class="but" data-insert-shortcode="vip" title="<?php esc_attr_e('插入 VIP 可见', 'aksrt'); ?>">
|
||||
<i class="fa fas fa-certificate"></i> <?php esc_html_e('VIP 可见', 'aksrt'); ?>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($ctx['can_pay'])) : ?>
|
||||
<button type="button" class="but" data-insert-shortcode="payshow" title="<?php esc_attr_e('插入付费可见内容', 'aksrt'); ?>">
|
||||
<i class="fa fas fa-lock"></i> <?php esc_html_e('付费可见', 'aksrt'); ?>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="flex ac jsb mt10">
|
||||
|
||||
Reference in New Issue
Block a user