BUGFIX: Closing TinyMCE image, link or flash panel when loading form (ticket #4907)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@98690 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Carlos Barberis 2010-02-10 21:53:07 +00:00 committed by Sam Minnee
parent 16e1941203
commit a94ddab4cd

View File

@ -33,6 +33,11 @@ $(document).ready(function() {
$(this).addClass('loading');
});
$('input[name=action_search]').livequery('click', function() {
$('#contentPanel').fn('closeRightPanel');
});
$("#right").scroll( function () {
positionActionArea();
});
@ -88,7 +93,7 @@ $(document).ready(function() {
*/
$('#SearchForm_holder .tab form:not(#Form_ImportForm)').submit(function () {
var $form = $(this);
$('#contentPanel').fn('closeRightPanel');
// @todo TinyMCE coupling
tinymce_removeAll();
@ -283,11 +288,28 @@ $(document).ready(function() {
$('#' + $(this).attr('href').replace(/.*#/,'')).toggle();
return false;
});
//////////////////////////////////////////////////////////////////
// Helper functions
//////////////////////////////////////////////////////////////////
$('#contentPanel').fn({
/**
* Close TinyMCE image, link or flash panel.
* this function is called everytime a new search, back or add new DataObject are clicked
**/
closeRightPanel: function(){
if($('#contentPanel').is(':visible')) {
$('#contentPanel').hide();
$('#Form_EditorToolbarImageForm').hide();
$('#Form_EditorToolbarFlashForm').hide();
$('#Form_EditorToolbarLinkForm').hide();
}
}
})
$('#ModelAdminPanel').fn({
/**
* Load a detail editing form into the main edit panel
@ -296,7 +318,7 @@ $(document).ready(function() {
loadForm: function(url, successCallback) {
// @todo TinyMCE coupling
tinymce_removeAll();
$('#contentPanel').fn('closeRightPanel');
$('#right #ModelAdminPanel').load(url, standardStatusHandler(function(result) {
if(typeof(successCallback) == 'function') successCallback.apply();
if(!this.future || !this.future.length) {
@ -310,7 +332,9 @@ $(document).ready(function() {
if(window.onresize) window.onresize();
}));
},
startHistory: function(url, data) {
this.history = [];
$(this).fn('addHistory', url, data);