diff --git a/js/build/shortcode-ui.js b/js/build/shortcode-ui.js index adf1e6f5..1eb30410 100644 --- a/js/build/shortcode-ui.js +++ b/js/build/shortcode-ui.js @@ -106,7 +106,9 @@ var MediaController = wp.media.controller.State.extend({ menuItem.render(); this.frame.setState( 'insert' ); - this.frame.uploader.uploader.uploader.init(); + // This string is duplicating "Uploading images" + // This bug has appeared from fix issue https://github.com/wp-shortcake/shortcake/issues/788 + //this.frame.uploader.uploader.uploader.init(); }, setActionSelect: function() { @@ -407,6 +409,18 @@ $(document).ready(function(){ frame = wp.media.editor.open( editor, options ); } + // This feature fixed some bugs: + // - duplicate images while loading https://wordpress.org/support/topic/weird-conflict-shortcake-ui-arve-plugins-images-being-uploaded-multiple-times/ + // - fix unclickable button, after insert shortcake shortcode https://github.com/wp-shortcake/shortcake/issues/788 + // This fix on based solution "zoliszabo (@zoliszabo)", but with my changes (Fix zoliszabo has errors duplicating upload-window on each image) + // Because I have hung initialization uploader on click's event ".shortcake-add-post-element" + // ( https://github.com/zoliszabo/shortcake/commit/32097ce6989509558bbcdab5906aa43474bebef8 ). + frame.uploader.uploader.uploader.setOption( + 'runtimes', + frame.uploader.uploader.uploader.getOption('runtimes'), + false + ); + // Make sure to reset state when closed. frame.once( 'close submit', function() { frame.mediaController.reset(); @@ -1532,7 +1546,7 @@ var insertShortcodeList = wp.Backbone.View.extend({ this.displayShortcodes( options ); }, - + refresh: function( shortcodeData ) { var options; if ( shortcodeData instanceof Backbone.Collection ) { @@ -1542,10 +1556,10 @@ var insertShortcodeList = wp.Backbone.View.extend({ } this.displayShortcodes( options ); }, - + displayShortcodes: function(options) { var t = this; - + t.$el.find('.add-shortcode-list').html(''); t.options = {}; t.options.shortcodes = options.shortcodes; @@ -1722,10 +1736,10 @@ var SearchShortcode = wp.media.view.Search.extend({ tagName: 'input', className: 'search', id: 'media-search-input', - + initialize: function( options ) { this.shortcodeList = options.shortcodeList; - }, + }, attributes: { type: 'search', @@ -1743,7 +1757,7 @@ var SearchShortcode = wp.media.view.Search.extend({ this.el.value = this.model.escape('search'); return this; }, - + refreshShortcodes: function( shortcodeData ) { this.shortcodeList.refresh( shortcodeData ); }, @@ -1856,7 +1870,7 @@ sui.views.editAttributeSelect2Field = sui.views.editAttributeField.extend( { render: function() { var self = this, - defaults = { + defaults = { multiple: false, allowClear: false }; diff --git a/js/src/controllers/media-controller.js b/js/src/controllers/media-controller.js index 2aac6366..d3980eac 100644 --- a/js/src/controllers/media-controller.js +++ b/js/src/controllers/media-controller.js @@ -69,7 +69,9 @@ var MediaController = wp.media.controller.State.extend({ menuItem.render(); this.frame.setState( 'insert' ); - this.frame.uploader.uploader.uploader.init(); + // This string is duplicating "Uploading images" + // This bug has appeared from fix issue https://github.com/wp-shortcake/shortcake/issues/788 + //this.frame.uploader.uploader.uploader.init(); }, setActionSelect: function() { diff --git a/js/src/shortcode-ui.js b/js/src/shortcode-ui.js index b4ccb780..ad4caa9d 100644 --- a/js/src/shortcode-ui.js +++ b/js/src/shortcode-ui.js @@ -49,6 +49,18 @@ $(document).ready(function(){ frame = wp.media.editor.open( editor, options ); } + // This feature fixed some bugs: + // - duplicate images while loading https://wordpress.org/support/topic/weird-conflict-shortcake-ui-arve-plugins-images-being-uploaded-multiple-times/ + // - fix unclickable button, after insert shortcake shortcode https://github.com/wp-shortcake/shortcake/issues/788 + // This fix on based solution "zoliszabo (@zoliszabo)", but with my changes (Fix zoliszabo has errors duplicating upload-window on each image) + // Because I have hung initialization uploader on click's event ".shortcake-add-post-element" + // ( https://github.com/zoliszabo/shortcake/commit/32097ce6989509558bbcdab5906aa43474bebef8 ). + frame.uploader.uploader.uploader.setOption( + 'runtimes', + frame.uploader.uploader.uploader.getOption('runtimes'), + false + ); + // Make sure to reset state when closed. frame.once( 'close submit', function() { frame.mediaController.reset();