Skip to content

Commit

Permalink
Moves sui shortcode registration outside of domready function to prev…
Browse files Browse the repository at this point in the history
…ent view race condition in WP 5.6.1

Fixes issue wp-shortcake#822
Also includes:
Update for node-sass to be compatible with OS X Big Sur
Updating a couple of deprecated jQuery functions
  • Loading branch information
joeyblake committed Feb 16, 2021
1 parent 26227c9 commit b87c4af
Show file tree
Hide file tree
Showing 6 changed files with 7,230 additions and 41 deletions.
13 changes: 2 additions & 11 deletions css/shortcode-ui.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/shortcode-ui.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions js/build/shortcode-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,22 +363,22 @@ var sui = require('./utils/sui.js'),
wp = (typeof window !== "undefined" ? window['wp'] : typeof global !== "undefined" ? global['wp'] : null),
$ = (typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null);

$(document).ready(function(){
// Create collection of shortcode models from data.
sui.shortcodes.add( shortcodeUIData.shortcodes );

// Create collection of shortcode models from data.
sui.shortcodes.add( shortcodeUIData.shortcodes );
wp.media.view.MediaFrame.Post = mediaFrame;

wp.media.view.MediaFrame.Post = mediaFrame;
// Register a view for each shortcode.
sui.shortcodes.each( function( shortcode ) {
if ( wp.mce.views ) {
wp.mce.views.register(
shortcode.get('shortcode_tag'),
shortcodeViewConstructor
);
}
} );

// Register a view for each shortcode.
sui.shortcodes.each( function( shortcode ) {
if ( wp.mce.views ) {
wp.mce.views.register(
shortcode.get('shortcode_tag'),
shortcodeViewConstructor
);
}
} );
$(function(){

$(document.body).on( 'click', '.shortcake-add-post-element', function( event ) {

Expand All @@ -397,7 +397,7 @@ $(document).ready(function(){
// Remove focus from the `.shortcake-add-post-element` button.
// Prevents Opera from showing the outline of the button above the modal.
// See: https://core.trac.wordpress.org/ticket/22445
$el.blur();
$el.trigger('blur');

if ( frame ) {
frame.mediaController.setActionSelect();
Expand Down
28 changes: 14 additions & 14 deletions js/src/shortcode-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ var sui = require('sui-utils/sui'),
wp = require('wp'),
$ = require('jquery');

$(document).ready(function(){
// Create collection of shortcode models from data.
sui.shortcodes.add( shortcodeUIData.shortcodes );

// Create collection of shortcode models from data.
sui.shortcodes.add( shortcodeUIData.shortcodes );
wp.media.view.MediaFrame.Post = mediaFrame;

wp.media.view.MediaFrame.Post = mediaFrame;
// Register a view for each shortcode.
sui.shortcodes.each( function( shortcode ) {
if ( wp.mce.views ) {
wp.mce.views.register(
shortcode.get('shortcode_tag'),
shortcodeViewConstructor
);
}
} );

// Register a view for each shortcode.
sui.shortcodes.each( function( shortcode ) {
if ( wp.mce.views ) {
wp.mce.views.register(
shortcode.get('shortcode_tag'),
shortcodeViewConstructor
);
}
} );
$(function(){

$(document.body).on( 'click', '.shortcake-add-post-element', function( event ) {

Expand All @@ -39,7 +39,7 @@ $(document).ready(function(){
// Remove focus from the `.shortcake-add-post-element` button.
// Prevents Opera from showing the outline of the button above the modal.
// See: https://core.trac.wordpress.org/ticket/22445
$el.blur();
$el.trigger('blur');

if ( frame ) {
frame.mediaController.setActionSelect();
Expand Down
Loading

0 comments on commit b87c4af

Please sign in to comment.