From a54a5882e396c6bc6b5d70ae77c49d27084d8e98 Mon Sep 17 00:00:00 2001 From: Arcady Usov Date: Mon, 5 May 2014 19:22:44 +0600 Subject: [PATCH] Remove loop from ".add-row" buttons. --- .../templates/cms/plugins/widgets/ckeditor.html | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/djangocms_text_ckeditor/templates/cms/plugins/widgets/ckeditor.html b/djangocms_text_ckeditor/templates/cms/plugins/widgets/ckeditor.html index dd854e9..2b079c3 100644 --- a/djangocms_text_ckeditor/templates/cms/plugins/widgets/ckeditor.html +++ b/djangocms_text_ckeditor/templates/cms/plugins/widgets/ckeditor.html @@ -53,15 +53,14 @@ $(document).ready(function () { initCMSCKEditor(); // initialize ckeditor in admin inline for "add-row" link - if ($('.add-row a').length > 0) { - $('.add-row a').each(function() { - if ($(this).data('isInitCMSCKEditor') !== 'yes') { - $(this).click(function() { - initCMSCKEditor(); - }); - $(this).data('isInitCMSCKEditor', 'yes'); - } - }) + var add_buttons = $('.add-row a'); + if (add_buttons.length > 0) { + if (add_buttons.data('isInitCMSCKEditor') !== 'yes') { + add_buttons.click(function () { + initCMSCKEditor(); + }); + add_buttons.data('isInitCMSCKEditor', 'yes'); + } } }); })(CMS.$);