Somewhere between 2.10 and 2.11.1 a change on line 1425 breaks link insertion for insertImage.
Either the modal box disappears and nothing is added in the editor or a new insertImage modal box appears on top of the previous one.
// Build out of ModalBox, it's the mask for animations
var $modal = $('<div/>', {
class: prefix + 'modal ' + prefix + 'fixed-top'
}).css({
top: t.$box.offset().top + t.$btnPane.height(),
zIndex: 99999
}).appendTo($(document.body));
Line 1425 in 2.11.1 is '}).appendTo($(document.body));'
Line 1425 in 2.10 is '}).appendTo(t.$box);'
Changing 'only' that single line in 2.11.1 code makes the insertImage work again.
Browser version: Safari 12, Firefox 62.0.3
OS: Mac
It's from this fix: https://github.com/Alex-D/Trumbowyg/commit/a250a58b9c6cd203545d1189a19696e339507ab4#diff-a57e0e52aed1451208c5f2010cd3b537
@JackTR-M
I managed to fix this temporarily without changing source code by adding this:
success: function(data, trumbowyg, _$modal, values) {
trumbowyg.doc.execCommand("insertHTML", false, "<img src='" + data.url + "' alt='" + values.alt + "'>")
trumbowyg.closeModal();
}
Hello,
I have this problem.
Did you try t.doc.body instead of t.$box?
Just tried and it doesn't work
I would just add to what @causztic has said that it seems like (at least for me) that there needs to be after modal closing line also added following: trumbowyg.syncCode(); Without it, the returned HTML code in textarea doesn't get updated until you change some other content after.
@JackTR-M
I managed to fix this temporarily without changing source code by adding this:
success: function(data, trumbowyg, _$modal, values) { trumbowyg.doc.execCommand("insertHTML", false, "<img src='" + data.url + "' alt='" + values.alt + "'>") trumbowyg.closeModal(); }
@causztic so after lot of surfing I found that I fall in love with your solution, thanks alot buddy you made my day!!!
Most helpful comment
@JackTR-M
I managed to fix this temporarily without changing source code by adding this: