Force hallo to save changes after a paste or drag

This commit is contained in:
Matt 2016-05-12 12:55:30 +01:00 committed by Matt Westcott
parent b2962955e3
commit a049721358

View file

@ -32,6 +32,14 @@ function makeRichTextEditable(id) {
removeStylingPending = false;
}
/* Workaround for faulty change-detection in hallo */
function setModified() {
var hallo = richText.data('IKS-hallo');
if (hallo) {
hallo.setModified();
}
}
var closestObj = input.closest('.object');
richText.hallo({
@ -44,8 +52,11 @@ function makeRichTextEditable(id) {
setTimeout(removeStyling, 100);
removeStylingPending = true;
}
}).bind('paste', function(event, data) {
setTimeout(removeStyling, 1);
}).bind('paste drop', function(event, data) {
setTimeout(function() {
removeStyling();
setModified();
}, 1);
/* Animate the fields open when you click into them. */
}).bind('halloactivated', function(event, data) {
$(event.target).addClass('expanded', 200, function(e) {