mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
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
This commit is contained in:
parent
eba09dff2d
commit
07e8d2e1e7
@ -200,6 +200,19 @@
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 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.
|
||||
@ -207,8 +220,7 @@
|
||||
* 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;
|
||||
|
||||
|
@ -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');
|
@ -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();
|
||||
|
@ -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');
|
||||
|
Loading…
Reference in New Issue
Block a user