Forum
Perch repeater acting strangely with the editor on textarea
Please see following code:
<perch:repeater id="price_block" label="Price blocks">
<div class="block">
<div class="title">
<perch:content id="block_title" type="textarea" label="Title" textile="true" editor="markitup" />
</div>
<div class="price">
<strong>RRP</strong> £<perch:content id="block_price" type="text" label="Price" />
</div>
<div class="clearall"></div>
</div>
</perch:repeater>
I am able to add the first Price block okay and can make parts of the Title bold, italic etc.
But when adding another when using repeater and trying to do the same, it refreshes the whole page and deletes all the content I've added.
Help!
Could you clarify what that means?
If I was to start adding a new item and had filled in areas that came before this repeater and then tried what I mentioned the problem was, it would refresh the page and I would lose all the content I had filled in.
If I was editing an existing item then the content would still be there but it would still refresh the page.
When you say new item, do you mean an item in a multiple item region, or a new item on the repeater?
Also, do you get any JavaScript errors in your browser console?
I mean a new item in a multiple item region.
So I have a template with a main title, description etc. at the start then half way through my template I have the repeater.
Would it help if I set you up as an editor to see the problem for yourself?
Yes, that would be helpful!
I can confirm what Jack is reporting, this happened to me too.
Fastest and simplest way to reproduce,
a simple region with just a repeater and a markitup textarea:
After assigning the template, add two items and click any "button" of the markitup toolbar of the second repeater item and the page will reload. Happens in Firefox and Chrome.
Drew, did you receive my private ticket?
Little update, not just an issue with markitup but redactor too, although it doesn't reload the page, the button does nothing.
Seems to be an issue with how repeaters clone a field, using the textarea with the editors already initialized.
For markitup, the following works:
in
core/assets/js/repeaters.js
put the trigger call inside a promisethen in
markitup/config.js
This way, the editor is attached after the textarea is cloned. For redactor, it should be a similar solution.
Hope it helps.
Hi Andrés,
Thanks for this although I can't seem to find markitup/config.js?
Also keen to hear from Drew whether there's a solution for this?
This has changed in Perch 2.8, as it's a general class of problem with repeaters and blocks. 2.8 introduces an event callback for reinitialising editors when the UI changes.
Ah right, so just upload newest files and should fix the problem?
When 2.8 is released, yes.
Oh sorry, I wasn't aware of the current version