mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-30 05:09:06 +02:00
ENHANCEMENT Added custom 'onafterinsert' event to forms dealing with link/image/flash insertion through tiny_mce_improvements.js, which allows e.g. to close them automatically after insertion (AIR-14)
This commit is contained in:
parent
afeccbc9cb
commit
37dc807866
12
javascript/tiny_mce_improvements.js
vendored
12
javascript/tiny_mce_improvements.js
vendored
@ -274,6 +274,8 @@ LinkForm.prototype = {
|
|||||||
ed.dom.remove(e, 1);
|
ed.dom.remove(e, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jQuery(linkFormObj).trigger('onafterinsert', attributes);
|
||||||
|
|
||||||
this.respondToNodeChange(ed);
|
this.respondToNodeChange(ed);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -589,14 +591,17 @@ ImageThumbnail.prototype = {
|
|||||||
if(!tinyMCE.selectedInstance) tinyMCE.selectedInstance = tinyMCE.activeEditor;
|
if(!tinyMCE.selectedInstance) tinyMCE.selectedInstance = tinyMCE.activeEditor;
|
||||||
if(tinyMCE.selectedInstance.contentWindow.focus) tinyMCE.selectedInstance.contentWindow.focus();
|
if(tinyMCE.selectedInstance.contentWindow.focus) tinyMCE.selectedInstance.contentWindow.focus();
|
||||||
|
|
||||||
this.ssInsertImage(tinyMCE.activeEditor, {
|
var data = {
|
||||||
'src' : relativeHref,
|
'src' : relativeHref,
|
||||||
'alt' : altText,
|
'alt' : altText,
|
||||||
'width' : $('Form_EditorToolbarImageForm_Width').value,
|
'width' : $('Form_EditorToolbarImageForm_Width').value,
|
||||||
'height' : $('Form_EditorToolbarImageForm_Height').value,
|
'height' : $('Form_EditorToolbarImageForm_Height').value,
|
||||||
'title' : titleText,
|
'title' : titleText,
|
||||||
'class' : cssClass
|
'class' : cssClass
|
||||||
}, captionText);
|
};
|
||||||
|
this.ssInsertImage(tinyMCE.activeEditor, data, captionText);
|
||||||
|
|
||||||
|
jQuery(formObj).trigger('onafterinsert', data);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
@ -717,6 +722,9 @@ FlashThumbnail.prototype = {
|
|||||||
tinyMCE.selectedInstance.execCommand("mceInsertContent", false, html);
|
tinyMCE.selectedInstance.execCommand("mceInsertContent", false, html);
|
||||||
tinyMCE.selectedInstance.execCommand('mceRepaint');
|
tinyMCE.selectedInstance.execCommand('mceRepaint');
|
||||||
// ed.execCommand('mceInsertContent', false, html, {skip_undo : 1});
|
// ed.execCommand('mceInsertContent', false, html, {skip_undo : 1});
|
||||||
|
|
||||||
|
jQuery(formObj).trigger('onafterinsert', {html: html, href: relativeHref, width: width, height: height});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user