BUGFIX: Content wasn't saving on subsequent page loads, after TinyMCE3 upgrade

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@64812 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-10-28 04:32:30 +00:00
parent 2dda8bb253
commit 884795b6e8
3 changed files with 12 additions and 9 deletions

View File

@ -321,8 +321,6 @@ function ingize(val) {
*/ */
function ajaxSubmitForm(automated, callAfter, form, action, verb) { function ajaxSubmitForm(automated, callAfter, form, action, verb) {
// tinyMCE.triggerSave(true);
var alreadySaved = false; var alreadySaved = false;
if($(form).elements.length < 2) alreadySaved = true; if($(form).elements.length < 2) alreadySaved = true;

View File

@ -40,7 +40,10 @@ CMSForm.prototype = {
closeIfSetTo: function(id) { closeIfSetTo: function(id) {
if(this.elements.ID && this.elements.ID.value == id) { if(this.elements.ID && this.elements.ID.value == id) {
this.innerHTML = "<p>This page was deleted. To edit a page, select it from the left.</p>"; this.innerHTML = "<p>This page was deleted. To edit a page, select it from the left.</p>";
if(typeof tinyMCE != 'undefined') tinyMCE.instances = []; // Note: TinyMCE coupling
if((typeof tinymce != 'undefined') && tinymce.EditorManager) {
tinymce.EditorManager.editors = {};
}
} }
}, },
@ -123,8 +126,9 @@ CMSForm.prototype = {
for(var i=0;i<tabs.length;i++) if(tabs[i].tagName) initTabstrip(tabs[i]); for(var i=0;i<tabs.length;i++) if(tabs[i].tagName) initTabstrip(tabs[i]);
} catch(er) { /*alert('b: '+ er.message + '\n' + er.line);*/ } } catch(er) { /*alert('b: '+ er.message + '\n' + er.line);*/ }
// Note: TinyMCE coupling
if((typeof tinymce != 'undefined') && tinymce.EditorManager) { if((typeof tinymce != 'undefined') && tinymce.EditorManager) {
tinymce.EditorManager.editors = []; tinymce.EditorManager.editors = {};
} }
// We assume that an evaluated response is generated by FormResponse // We assume that an evaluated response is generated by FormResponse
@ -152,6 +156,7 @@ CMSForm.prototype = {
*/ */
save: function(ifChanged, callAfter, action, publish) { save: function(ifChanged, callAfter, action, publish) {
_AJAX_LOADING = true; _AJAX_LOADING = true;
// Note: TinyMCE coupling
if(typeof tinyMCE != 'undefined') tinyMCE.triggerSave(); if(typeof tinyMCE != 'undefined') tinyMCE.triggerSave();
if(!action) action = "save"; if(!action) action = "save";
@ -402,6 +407,7 @@ ActionPropertiesForm.prototype = {
* If confirmation is true it will ask for confirmation. * If confirmation is true it will ask for confirmation.
*/ */
function autoSave(confirmation, callAfter) { function autoSave(confirmation, callAfter) {
// Note: TinyMCE coupling
if(typeof tinyMCE != 'undefined') tinyMCE.triggerSave(); if(typeof tinyMCE != 'undefined') tinyMCE.triggerSave();
var __forms = [] var __forms = []

View File

@ -98,11 +98,10 @@ Behaviour.register({
for(var i=0;i<tabs.length;i++) if(tabs[i].tagName) initTabstrip(tabs[i]); for(var i=0;i<tabs.length;i++) if(tabs[i].tagName) initTabstrip(tabs[i]);
} catch(er) { /*alert('b: '+ er.message + '\n' + er.line); */} } catch(er) { /*alert('b: '+ er.message + '\n' + er.line); */}
if((typeof tinyMCE != 'undefined') && tinyMCE.instances) { // Note: TinyMCE coupling
tinyMCE.instances = []; if((typeof tinymce != 'undefined') && tinymce.EditorManager) {
tinyMCE.isLoaded = false; tinymce.EditorManager.editors = {};
tinyMCE.onLoad(); }
}
// if(this.prepareForm) this.prepareForm(); // if(this.prepareForm) this.prepareForm();
Behaviour.apply($('Form_EditForm')); Behaviour.apply($('Form_EditForm'));