浏览代码

Blank Canvas Blocks: Enqueue editor styles on admin_init

Ben Dwyer 4 年之前
父节点
当前提交
3301d5c16c

+ 1 - 1
blank-canvas-blocks/assets/ponyfill.css

@@ -256,8 +256,8 @@ input[type=checkbox] + label {
 
 h1, h2, h3, h4, h5, h6 {
 	clear: both;
-	font-family: var(--wp--custom--heading--typography--font-family);
 	font-weight: var(--wp--custom--heading--typography--font-weight);
+	font-family: var(--wp--custom--fonts--primary);
 }
 
 /**

+ 8 - 0
blank-canvas-blocks/experimental-theme.json

@@ -85,6 +85,14 @@
 				]
 			},
 			"custom": {
+				"fonts": {
+					"primary": "'Playfair Display', Georgia, Times, serif",
+					"secondary": "'Fira Sans', Helvetica, Arial, sans-serif"
+				},
+				"fontsToLoadFromGoogle": [
+					"family=Fira Sans:ital,wght@0,400;0,500;1,400",
+					"family=Playfair Display:ital,wght@0,400;0,700;1,400"
+				],
 				"color": {
 					"primary": "var(--wp--preset--color--black)",
 					"secondary": "var(--wp--preset--color--blue)",

+ 13 - 7
blank-canvas-blocks/functions.php

@@ -17,17 +17,23 @@ if ( ! function_exists( 'blank_canvas_blocks_support' ) ) :
 
 		// Add support for editor styles.
 		add_theme_support( 'editor-styles' );
-
-		// Enqueue editor styles.
-		add_editor_style( array(
-			blank_canvas_blocks_fonts_url(),
-			'/assets/ponyfill.css'
-		) );
-
     }
     add_action( 'after_setup_theme', 'blank_canvas_blocks_support' );
 endif;
 
+/**
+ *
+ * Enqueue scripts and styles.
+ */
+function blank_canvas_editor_styles() {
+	// Enqueue editor styles.
+	add_editor_style( array(
+		blank_canvas_blocks_fonts_url(),
+		'/assets/ponyfill.css'
+	) );
+}
+add_action( 'admin_init', 'blank_canvas_editor_styles' );
+
 /**
  *
  * Enqueue scripts and styles.

+ 2 - 1
blank-canvas-blocks/sass/blocks/_heading.scss

@@ -1,5 +1,6 @@
 h1, h2, h3, h4, h5, h6 {
 	clear: both;
-	font-family: var(--wp--custom--heading--typography--font-family);
+	//font-family: var(--wp--custom--heading--typography--font-family);
 	font-weight: var(--wp--custom--heading--typography--font-weight);
+	font-family: var(--wp--custom--fonts--primary);
 }