Index: openacs-4/packages/xowiki/www/resources/repeat.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/repeat.js,v diff -u -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/xowiki/www/resources/repeat.js 13 Apr 2015 20:41:06 -0000 1.1.2.2 +++ openacs-4/packages/xowiki/www/resources/repeat.js 22 Apr 2015 06:42:27 -0000 1.1.2.3 @@ -9,20 +9,22 @@ xowiki.repeat.addItem = function(e, json) { var data = eval("(" + json + ')'); var items = $(e.parentNode).children(".repeatable:hidden"); + var currentItem = ''; // the loop starts with 1 because items[0] is the template for (var j = 1; j < items.length; j++) { - if (items[j].nodeName != 'DIV') { continue; } - if (items[j].style.display == 'none') { + currentItem = items[j]; + if (currentItem.nodeName != 'DIV') { continue; } + if (currentItem.style.display == 'none') { if (j == (items.length)-1) { // this is the final item: hide add item button $(e.parentNode).children(".repeat-add-link").hide(); } // Make an existing but invisible item visible. - items[j].style.display = 'block'; + currentItem.style.display = 'block'; // IPAD HACK START // for ipad we have to set the contenteditiable to true for the ckeditor inline if it is false - var ck_editors = $(items[j]).find('.xowiki-ckeditor.cke_editable.cke_editable_inline.cke_contents_ltr'); + var ck_editors = $(currentItem.find('.xowiki-ckeditor.cke_editable.cke_editable_inline.cke_contents_ltr'); for (var k = 0; k < ck_editors.length; k++) { if ($(ck_editors[k]).attr('contenteditable') == 'false') { console.log('we have to set the contenteditable to true'); @@ -31,9 +33,22 @@ } // IPAD HACK ENDE - return false; + break; } } + + $(".xowiki-ckeditor", currentItem).each(function (i,e) { + //console.debug('load ckeditor' +e.id); + if ($(e).is(':visible')) { + var functionname = 'load_' + e.id; + try { + window[functionname](); + } catch(err) { + //console.log('function: ' + functionname + ' not found'); + } + } + }); + // We could add another item here by adding a copy of the template // and renaming the field like in delItems. We have to care as // well in RepeatContainer.initialize() to check, how many