Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit ba25dd7

Browse files
committed
Merge pull request #256 from orhanveli/master
multiple editor image toolbar action effects all instances bugfix
2 parents adb9e9d + 49daab0 commit ba25dd7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/js/images.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
function Images (el, options) {
9191
this.el = el;
9292
this.$el = $(el);
93+
this.$currentImage = null;
9394
this.templates = window.MediumInsert.Templates;
9495
this.core = this.$el.data('plugin_'+ pluginName);
9596

@@ -428,6 +429,8 @@
428429
var $image = $(e.target),
429430
that = this;
430431

432+
this.$currentImage = $image;
433+
431434
// Hide keyboard on mobile devices
432435
this.$el.blur();
433436

@@ -470,6 +473,7 @@
470473
} else if ($el.is('figcaption') === false) {
471474
this.core.removeCaptions();
472475
}
476+
this.$currentImage = null;
473477
};
474478

475479
/**
@@ -596,6 +600,7 @@
596600
*/
597601

598602
Images.prototype.toolbarAction = function (e) {
603+
if (this.$currentImage === null) return;
599604
var $button = $(e.target).is('button') ? $(e.target) : $(e.target).closest('button'),
600605
$li = $button.closest('li'),
601606
$ul = $li.closest('ul'),
@@ -637,6 +642,7 @@
637642
*/
638643

639644
Images.prototype.toolbar2Action = function (e) {
645+
if (this.$currentImage === null) return;
640646
var $button = $(e.target).is('button') ? $(e.target) : $(e.target).closest('button'),
641647
callback = this.options.actions[$button.data('action')].clicked;
642648

0 commit comments

Comments
 (0)