Permalink
Browse files

API CHANGE Removed tinymce_removeAll() javacsript method in favour of…

… a cleanup() method in #Form_EditForm

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92642 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent eba09df commit 07e8d2e1e7369f5d316c9c4069e0568cdbb17633 @chillu chillu committed Nov 21, 2009
Showing with 21 additions and 26 deletions.
  1. +14 −2 javascript/LeftAndMain.js
  2. +3 −20 javascript/LeftAndMain_right.js
  3. +3 −3 javascript/ModelAdmin.js
  4. +1 −1 javascript/ReportAdmin_right.js
View
16 javascript/LeftAndMain.js
@@ -200,15 +200,27 @@
},
+ /**
+ * Remove all the currently active TinyMCE editors.
+ * Note: Everything that calls this externally has an inappropriate coupling to TinyMCE.
+ */
+ cleanup: function() {
+ if((typeof tinymce != 'undefined') && tinymce.EditorManager) {
+ var id;
+ for(id in tinymce.EditorManager.editors) {
+ tinymce.EditorManager.editors[id].remove();
+ }
+ tinymce.EditorManager.editors = {};
+ }
+ },
/**
* @param {String} result Either HTML for straight insertion, or eval'ed JavaScript.
* If passed as HTML, it is assumed that everying inside the <form> tag is replaced,
* but the old <form> tag itself stays intact.
*/
_loadResponse: function(response) {
- // TinyMCE coupling
- if(typeof tinymce_removeAll != 'undefined') tinymce_removeAll();
+ this.cleanup();
var html = response;
View
23 javascript/LeftAndMain_right.js
@@ -38,7 +38,7 @@ CMSForm.prototype = {
closeIfSetTo: function(id) {
if(this.elements.ID && this.elements.ID.value == id) {
// Note: TinyMCE coupling
- tinymce_removeAll();
+ jQuery('#Form_EditForm').concrete('ss').cleanup();
this.innerHTML = "<p>" + ss.i18n._t('LeftAndMain.PAGEWASDELETED') + "</p>";
}
},
@@ -84,7 +84,7 @@ CMSForm.prototype = {
rightHTML = rightHTML.replace(/(<iframe[^>]*src=")([^"]+)("[^>]*>)/g, '$1' + jQuery('base').attr('href') + '$2$3');
// Note: TinyMCE coupling
- tinymce_removeAll();
+ jQuery('#Form_EditForm').concrete('ss').cleanup();
// Prepare iframes for removal, otherwise we get loading bugs
var i, allIframes = this.getElementsByTagName('iframe');
@@ -420,21 +420,4 @@ StageLink.prototype = {
StageLink.applyTo('#viewStageSite', '?stage=Stage', 'StageURLSegment');
StageLink.applyTo('#viewLiveSite', '?stage=Live', 'LiveURLSegment');
-StageLink.applyTo('#viewArchivedSite', '', 'URLSegment');
-
-/**
- * Remove all the currently active TinyMCE editors.
- * Note: everything that calls this has an inappropriate coupling to TinyMCE.
- * Perhaps an observer pattern could be used, where TinyMCE listens to a onBeforeCMSPageLoad
- * event?
- */
-function tinymce_removeAll() {
- if((typeof tinymce != 'undefined') && tinymce.EditorManager) {
- var id;
- for(id in tinymce.EditorManager.editors) {
- tinymce.EditorManager.editors[id].remove();
- }
- tinymce.EditorManager.editors = {};
- }
-
-}
+StageLink.applyTo('#viewArchivedSite', '', 'URLSegment');
View
6 javascript/ModelAdmin.js
@@ -90,7 +90,7 @@ $(document).ready(function() {
var $form = $(this);
// @todo TinyMCE coupling
- tinymce_removeAll();
+ jQuery('#Form_EditForm').concrete('ss').cleanup();
$('#ModelAdminPanel').fn('startHistory', $(this).attr('action'), $(this).formToArray());
$('#ModelAdminPanel').load($(this).attr('action'), $(this).formToArray(), standardStatusHandler(function(result) {
@@ -204,7 +204,7 @@ $(document).ready(function() {
// Post the data to save
$.post(formAction, form.formToArray(), function(result){
// @todo TinyMCE coupling
- tinymce_removeAll();
+ jQuery('#Form_EditForm').concrete('ss').cleanup();
$('#right #ModelAdminPanel').html(result);
@@ -295,7 +295,7 @@ $(document).ready(function() {
*/
loadForm: function(url, successCallback) {
// @todo TinyMCE coupling
- tinymce_removeAll();
+ jQuery('#Form_EditForm').concrete('ss').cleanup();
$('#right #ModelAdminPanel').load(url, standardStatusHandler(function(result) {
if(typeof(successCallback) == 'function') successCallback.apply();
View
2 javascript/ReportAdmin_right.js
@@ -71,7 +71,7 @@ Behaviour.register({
rightHTML = rightHTML.replace(/href *= *"#/g, 'href="' + window.location.href.replace(/#.*$/,'') + '#');
// Note: TinyMCE coupling
- tinymce_removeAll();
+ jQuery('#Form_EditForm').concrete('ss').cleanup();
// Prepare iframes for removal, otherwise we get loading bugs
var i, allIframes = this.getElementsByTagName('iframe');

0 comments on commit 07e8d2e

Please sign in to comment.