From 585b0d2cbc4f4d901227e073d1a65aa240b3d101 Mon Sep 17 00:00:00 2001 From: jamesprior Date: Thu, 3 Apr 2014 16:50:48 -0400 Subject: [PATCH] using jquery fail-safe in custom ckeditor modules --- .../javascripts/ckeditor/plugins/delete_content/plugin.js | 2 ++ .../javascripts/ckeditor/plugins/edit_content/plugin.js | 4 ++++ .../javascripts/ckeditor/plugins/move_content/plugin.js | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/app/assets/javascripts/ckeditor/plugins/delete_content/plugin.js b/app/assets/javascripts/ckeditor/plugins/delete_content/plugin.js index a37890f41..912e8f07f 100644 --- a/app/assets/javascripts/ckeditor/plugins/delete_content/plugin.js +++ b/app/assets/javascripts/ckeditor/plugins/delete_content/plugin.js @@ -28,7 +28,9 @@ CKEDITOR.plugins.add('delete_content', { ], onOk:function () { + jQuery(function ($) { $.cms_editor.deleteContent(); + }); } }; }); diff --git a/app/assets/javascripts/ckeditor/plugins/edit_content/plugin.js b/app/assets/javascripts/ckeditor/plugins/edit_content/plugin.js index c5ad09c58..d3d721119 100644 --- a/app/assets/javascripts/ckeditor/plugins/edit_content/plugin.js +++ b/app/assets/javascripts/ckeditor/plugins/edit_content/plugin.js @@ -11,10 +11,14 @@ CKEDITOR.plugins.add('edit_content', { editor.addCommand('editContent', { exec:function (editor) { var goto_edit = function(){ + jQuery(function ($) { window.parent.location = $.cms_editor.selectedConnector().data('edit-path'); + }); }; if (editor.checkDirty()) { + jQuery(function ($) { $.cms_editor.saveChanges(editor, goto_edit); + }); } else { goto_edit.apply(); } diff --git a/app/assets/javascripts/ckeditor/plugins/move_content/plugin.js b/app/assets/javascripts/ckeditor/plugins/move_content/plugin.js index d1c395b5c..cc5c3e971 100644 --- a/app/assets/javascripts/ckeditor/plugins/move_content/plugin.js +++ b/app/assets/javascripts/ckeditor/plugins/move_content/plugin.js @@ -13,12 +13,16 @@ CKEDITOR.plugins.add('move_content', { }); editor.addCommand('moveContentDown', { exec:function (editor) { + jQuery(function ($) { $.cms_editor.moveContent(editor, 'move-down'); + }); } }); editor.addCommand('moveContentUp', { exec:function (editor) { + jQuery(function ($) { $.cms_editor.moveContent(editor, 'move-up'); + }); } }); }