From da45b954c5fe4174678d3fbb6e91c71dfd4cd7da Mon Sep 17 00:00:00 2001 From: Oliver Green Date: Thu, 11 Jan 2018 09:02:27 +0000 Subject: [PATCH] Editor fixes for version 8. --- blocks/vivid_simple_accordion/form.php | 35 +++++++++++++------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/blocks/vivid_simple_accordion/form.php b/blocks/vivid_simple_accordion/form.php index f09bdfc..6376156 100644 --- a/blocks/vivid_simple_accordion/form.php +++ b/blocks/vivid_simple_accordion/form.php @@ -73,7 +73,7 @@
- +
@@ -100,7 +100,12 @@ var deleteItem = function(i) { var confirmDelete = confirm(''); if(confirmDelete == true) { - $(".item[data-order='"+i+"']").remove(); + var $el = $(".item[data-order='"+i+"']"); + var itemId = $el.find('.editor-content').attr('id'); + if (typeof CKEDITOR === 'object') { + CKEDITOR.instances[itemId].destroy(); + } + $el.remove(); indexItems(); } }; @@ -131,6 +136,11 @@ function indexItems(){ //use when using Redactor (wysiwyg) var CCM_EDITOR_SECURITY_TOKEN = "generate('editor')?>"; + + outputStandardEditorInitJSFunction(); + ?> + var launchEditor = ; //Define container and items var itemsContainer = $('.items-container'); @@ -171,18 +181,14 @@ function indexItems(){ //Init Index indexItems(); - //Init Redactor - $('.redactor-content').redactor({ - minHeight: '200', - 'concrete5': { - filemanager: canAccessFileManager()?>, - sitemap: canAccessSitemap()?>, - lightbox: true + //Init editor + $(function() { // activate editors + if ($('.editor-content-').length) { + launchEditor($('.editor-content-')); } }); //CREATE NEW ITEM - $('.btn-add-item').click(function(){ //Use the template to create a new item. @@ -202,14 +208,7 @@ function indexItems(){ thisModal.scrollTop(newItem.offset().top); //Init Redactor - newItem.find('.redactor-content').redactor({ - minHeight: '100', - 'concrete5': { - filemanager: canAccessFileManager()?>, - sitemap: canAccessSitemap()?>, - lightbox: true - } - }); + launchEditor(newItem.find('.editor-content')); //Init Index indexItems();