[phpBB Debug] PHP Warning: in file [ROOT]/ext/tas2580/seourls/event/listener.php on line 213: Undefined array key "FORUM_NAME"
REDAXO Forum • mblock_reindex redactor2
Seite 1 von 1

mblock_reindex redactor2

Verfasst: 30. Nov 2016, 11:31
von poing
ich nutze mblock für ein accordion in verbindung mit redactor2

$mform->addTextAreaField("$id.0.text", array('label'=>'Text', 'class'=>'redactorEditor2-full'));

füge ich nun in mblock ein neues accordion item hinzu, verschwindet überall der redactor editor.

ich habe mir das jetzt in der mblock.js angeschaut. so wie hier schon dikutiert:

https://github.com/FriendsOfREDAXO/mblock/issues/16

komme aber irgendwie nicht weiter bzw. steh auf'm schlauch.

Re: mblock_reindex redactor2

Verfasst: 30. Nov 2016, 11:55
von poing
komme der lösung gerade näher. die geclonten editoren verlieren ihre klasse.

mblock.js zeile 232

// neue variable
var redactor_class;

$(this).find('.redactor-box').each(function(key){
initredactor = true;
eindex = key + 1;
sindex = index + 1;
$(this).find('textarea').each(function(){
// klasse an Variable zuweisen
redactor_class = $(this).attr('class').split(' ')[1];
console.log(redactor_class);
if($(this).attr('id')) {
$(this).attr('id', $(this).attr('id').replace(/\d+/, sindex + '00' + eindex));
}
});
});

so zeile 260 rum

if (initredactor) {

$('.redactor-box').each(function(){
var area;
var content = '';
$(this).find('div.redactor-in').each(function () {
if ($(this).attr('role')) {
content = $(this).html();
}
});
$(this).find('textarea').each(function(){
// Klasse zuweisen
$(this).addClass(redactor_class);
if ($(this).css('display') == 'none') {
area = $(this).clone().css('display','block');
}
});
if (typeof area === 'object') {
if (area.length) {
$(this).parent().append(area);
$(this).parent().find('textarea').val(content);
$(this).remove();
}
}
});

if(typeof redactorInit === 'function') redactorInit();
}

Re: mblock_reindex redactor2

Verfasst: 30. Nov 2016, 12:43
von poing
und die variable

var redactor_class = '';

ganz oben bei in der funktion mblock_reindex()...

deklarieren, dann klappt es auch mit dem Nachbarn.

var initredactor = false,
initmarkitup = false,
redactor_class = '';

Re: mblock_reindex redactor2

Verfasst: 30. Nov 2016, 15:28
von Joachim.Dörr
Hi, magst du dazu ein Issue aufmachen bzw. ein Pull-Request fertigen?

Re: mblock_reindex redactor2

Verfasst: 30. Nov 2016, 18:24
von poing
später. fluppt noch nicht ganz.

ich muss da nochmal in ruhe drüber nachdenken ;-)

Re: mblock_reindex redactor2

Verfasst: 1. Dez 2016, 20:31
von Joachim.Dörr
So hab das jetzt in der 1.6.2 gefixt. Danke für den Hinweis.

lg