Skip to content

Commit

Permalink
fix: centbrowser gutenberg (#492)
Browse files Browse the repository at this point in the history
  • Loading branch information
seatonjiang committed May 1, 2022
1 parent 46eec95 commit 8abed76
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
11 changes: 11 additions & 0 deletions assets/css/admin.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.editor-styles-wrapper .wp-site-blocks,
.editor-styles-wrapper>.is-root-container,
.editor-styles-wrapper .edit-post-visual-editor__post-title-wrapper,
.editor-styles-wrapper .wp-block-group.alignfull,
.editor-styles-wrapper .wp-block-group.has-background,
.editor-styles-wrapper .wp-block-cover.alignfull,
.editor-styles-wrapper .is-root-container .wp-block[data-align="full"]>.wp-block-group,
.editor-styles-wrapper .is-root-container .wp-block[data-align="full"]>.wp-block-cover {
padding-left: max(1.25rem, 5vw);
padding-right: max(1.25rem, 5vw);
}
9 changes: 5 additions & 4 deletions inc/theme-article.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 文章相关函数
* @author Seaton Jiang <[email protected]>
* @license GPL-3.0 License
* @version 2022.02.20
* @version 2022.05.01
*/

// 文章链接添加 target 和 rel
Expand Down Expand Up @@ -455,9 +455,10 @@ function post_seo_callback($post)
}

if (kratos_option('g_image_filter', true)) {
add_action( 'admin_footer-post-new.php', 'fanly_mediapanel_lock_uploaded' );
add_action( 'admin_footer-post.php', 'fanly_mediapanel_lock_uploaded' );
function fanly_mediapanel_lock_uploaded() {
add_action('admin_footer-post-new.php', 'fanly_mediapanel_lock_uploaded');
add_action('admin_footer-post.php', 'fanly_mediapanel_lock_uploaded');
function fanly_mediapanel_lock_uploaded()
{
echo '<script type="text/javascript">var $i=0;jQuery(document).on("DOMNodeInserted", function(){if(jQuery("#media-attachment-filters").length>0&&$i==0){jQuery(\'select.attachment-filters [value="uploaded"]\').attr(\'selected\',true).parent().trigger(\'change\');$i++;}});</script>';
}
}
Expand Down
14 changes: 11 additions & 3 deletions inc/theme-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 核心函数
* @author Seaton Jiang <[email protected]>
* @license GPL-3.0 License
* @version 2022.04.30
* @version 2022.05.01
*/

// CDN 资源地址
Expand Down Expand Up @@ -76,10 +76,10 @@ function theme_autoload()
wp_add_inline_style('kratos', "
@media screen and (min-width: 992px) {
.k-nav .navbar-brand h1 {
color: ". kratos_option('g_nav', '#ffffff') .";
color: " . kratos_option('g_nav', '#ffffff') . ";
}
.k-nav .navbar-nav > li.nav-item > a {
color: ". kratos_option('g_nav', '#ffffff') .";
color: " . kratos_option('g_nav', '#ffffff') . ";
}
}
");
Expand Down Expand Up @@ -114,6 +114,14 @@ function theme_autoload()
}
add_action('wp_enqueue_scripts', 'theme_autoload');

// 后台资源加载
function kratos_admin_enqueue()
{
wp_enqueue_style('admin-custom-css', get_template_directory_uri() . '/assets/css/admin.css', array(), filemtime(get_stylesheet_directory() . '/assets/css/admin.css'));
}

add_action('admin_enqueue_scripts', 'kratos_admin_enqueue', 20);

// 前台管理员导航
if (!kratos_option('g_adminbar', true)) {
add_filter('show_admin_bar', '__return_false');
Expand Down

0 comments on commit 8abed76

Please sign in to comment.