diff --git a/build-config.js b/build-config.js index a824b21..6dabd71 100644 --- a/build-config.js +++ b/build-config.js @@ -44,6 +44,7 @@ module.exports = { '!{build,build/**}', // Ignore build/ and contents '!{tests,tests/**}', // Ignore tests/ and contents '!{tmp,tmp/**}', // Ignore tmp/ and contents + '!{dist,dist/**}', // Ignore dist/ and contents '!phpunit.xml', // Not the unit tests configuration file. '!so-css.php', // Not the base plugin file. It is copied by the 'version' task. '!readme.txt', // Not the readme.txt file. It is copied by the 'version' task. diff --git a/js/editor.js b/js/editor.js index b9dab8f..8899f2a 100644 --- a/js/editor.js +++ b/js/editor.js @@ -511,7 +511,6 @@ currentUri: null, events: { - 'load #preview-iframe': 'initPreview', 'mouseleave #preview-iframe': 'clearHighlight', 'keydown #preview-navigator input[type="text"]': 'reloadPreview', }, @@ -548,7 +547,10 @@ this.$( '#preview-navigator input' ).val( this.currentUri.toString() ); this.currentUri.addQuery( 'so_css_preview', 1 ); - this.$( '#preview-iframe' ).attr( 'src', this.currentUri.toString() ); + this.$( '#preview-iframe' ) + .attr( 'src', this.currentUri.toString() ) + // 'load' event doesn't bubble so can't be used in the events hash + .on( 'load', this.initPreview.bind( this ) ); }, initPreview: function () { diff --git a/readme.txt b/readme.txt index 696203a..71aa98c 100644 --- a/readme.txt +++ b/readme.txt @@ -65,6 +65,10 @@ We offer free support on the [SiteOrigin support forums](https://siteorigin.com/ == Changelog == += 1.2.3 - 25 June 2018 = +* Add preview iframe 'load' event listener in `render` function. +* Reverted change to stylesheet hook. + = 1.2.2 - 16 June 2018 = * Removed reference to non-existent view. diff --git a/so-css.php b/so-css.php index 868b72f..4128849 100644 --- a/so-css.php +++ b/so-css.php @@ -32,7 +32,7 @@ function __construct() { add_action( 'plugins_loaded', array( $this, 'set_plugin_textdomain' ) ); // Priority 20 is necessary to ensure our CSS takes precedence. - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 20 ); + add_action( 'wp_head', array( $this, 'enqueue_css' ), 20 ); // All the admin actions add_action( 'admin_menu', array( $this, 'action_admin_menu' ) );