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

Commit e1a765f

Browse files
committed
* 'master' of https://github.com/orthes/medium-editor-images-plugin: fixing bug of activate/deactivate editor without initing the plugin Fixes #102 But for embeds added check to preparePreviousImages, so it doesn't create a placeholder inside a placeholder
2 parents 9668091 + d2154dd commit e1a765f

11 files changed

+40
-22
lines changed

dist/js/addons/medium-editor-insert-embeds.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@
7474
preparePreviousEmbeds: function () {
7575
this.$el.find('.mediumInsert-embeds').each(function() {
7676
var $parent = $(this).parent();
77-
$parent.html('<div class="mediumInsert-placeholder" draggable="true">' + $parent.html() + '</div>');
77+
if (!$parent.hasClass('mediumInsert-placeholder')) {
78+
$parent.html('<div class="mediumInsert-placeholder" draggable="true">' + $parent.html() + '</div>');
79+
}
7880
});
7981
},
8082

dist/js/addons/medium-editor-insert-embeds.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/addons/medium-editor-insert-images.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,11 @@
147147
preparePreviousImages: function () {
148148
this.$el.find('.mediumInsert-images').each(function() {
149149
var $parent = $(this).parent();
150-
$parent.html($.fn.mediumInsert.insert.getButtons('images') +
151-
'<div class="mediumInsert-placeholder" draggable="true">' + $parent.html() + '</div>'
152-
);
150+
if (!$parent.hasClass('mediumInsert-placeholder')) {
151+
$parent.html($.fn.mediumInsert.insert.getButtons('images') +
152+
'<div class="mediumInsert-placeholder" draggable="true">' + $parent.html() + '</div>'
153+
);
154+
}
153155
});
154156
},
155157

dist/js/addons/medium-editor-insert-images.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/addons/medium-editor-insert-plugin.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@
8484
this.elements[i].removeAttribute('contentEditable');
8585
}
8686

87-
$.fn.mediumInsert.insert.$el.mediumInsert('disable');
87+
if ($.fn.mediumInsert.insert.$el)
88+
$.fn.mediumInsert.insert.$el.mediumInsert('disable');
8889
};
8990

9091
/**
@@ -109,7 +110,8 @@
109110
}
110111
this.bindSelect();
111112

112-
$.fn.mediumInsert.insert.$el.mediumInsert('enable');
113+
if ($.fn.mediumInsert.insert.$el)
114+
$.fn.mediumInsert.insert.$el.mediumInsert('enable');
113115
};
114116
}
115117

0 commit comments

Comments
 (0)