Changeset 1989393
- Timestamp:
- 12/08/2018 05:38:30 PM (7 years ago)
- Location:
- yamap-block-gutenberg
- Files:
-
- 12 added
- 1 edited
-
tags/1.0.0 (added)
-
tags/1.0.0/assets (added)
-
tags/1.0.0/assets/block-editor.build.css (added)
-
tags/1.0.0/assets/block-editor.build.js (added)
-
tags/1.0.0/assets/block-front.build.js (added)
-
tags/1.0.0/languages (added)
-
tags/1.0.0/languages/guyamap-ru_RU.mo (added)
-
tags/1.0.0/languages/guyamap-ru_RU.po (added)
-
tags/1.0.0/languages/guyamap.pot (added)
-
tags/1.0.0/readme.txt (added)
-
tags/1.0.0/yamap-block-gutenberg.php (added)
-
trunk/languages/guyamap-ru_RU-guyamap-editor-script.json (added)
-
trunk/yamap-block-gutenberg.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
yamap-block-gutenberg/trunk/yamap-block-gutenberg.php
r1989369 r1989393 84 84 85 85 add_action( 'init', array( $this, 'init' ), 0 ); 86 add_action( ' enqueue_block_editor_assets', array( $this, 'editor_assets' ) );86 add_action( 'init', array( $this, 'editor_assets' ) ); 87 87 add_action( 'wp_enqueue_scripts', array( $this, 'load_assets' ) ); 88 88 add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 ); … … 104 104 wp_register_script( 105 105 'guyamap-editor-script', 106 $this->plugin_url() . '/assets/block-editor.build.js',106 $this->plugin_url() . '/assets/block-editor.build.js', 107 107 array( 'wp-i18n', 'wp-blocks', 'wp-element', 'wp-components', 'wp-editor' ), 108 108 filemtime( $this->plugin_path() . '/assets/block-editor.build.js' ) … … 122 122 'editor_style' => 'guyamap-editor-style' 123 123 ) ); 124 125 126 // Get All Translations @al5dy hack 127 $locale_data = $this->get_jed_locale_data( 'guyamap' ); 128 wp_add_inline_script( 129 'wp-i18n', 130 'wp.i18n.setLocaleData( ' . json_encode( $locale_data ) . ', \'guyamap\' );' 131 ); 132 124 125 126 if(function_exists('wp_set_script_translations')) { 127 /* 128 * Pass already loaded translations to our JavaScript. 129 * 130 * This happens _before_ our JavaScript runs, afterwards it's too late. 131 */ 132 wp_add_inline_script( 133 'guyamap-editor-script', 134 sprintf( 135 'var guyamap_editor_script = { localeData: %s };', 136 json_encode( wp_set_script_translations( 'guyamap-editor-script', 'guyamap', $this->plugin_path() . '/languages' ) ) 137 ), 138 'before' 139 ); 140 } else { 141 // Get All Translations @al5dy hack 142 $locale_data = $this->get_jed_locale_data( 'guyamap' ); 143 wp_add_inline_script( 144 'wp-i18n', 145 'wp.i18n.setLocaleData( ' . json_encode( $locale_data ) . ', \'guyamap\' );' 146 ); 147 148 } 133 149 134 150 } … … 175 191 wp_enqueue_script( 'gutenberg-yamap-api' ); 176 192 177 wp_register_script( 'gutenberg-yamap-front', $this->plugin_url() . '/assets/block-front.build.js' , array( 'gutenberg-yamap-api' ), GUYAMAP_VERSION, true );193 wp_register_script( 'gutenberg-yamap-front', $this->plugin_url() . '/assets/block-front.build.js', array( 'gutenberg-yamap-api' ), GUYAMAP_VERSION, true ); 178 194 wp_enqueue_script( 'gutenberg-yamap-front' ); 179 195 }
Note: See TracChangeset
for help on using the changeset viewer.