Launching the same inline rich text editor twice from the same page

tenants

Well-known member
If you have two links to your rich text edior

(for instance, two edit links)

If you launch the editor from one link, and then the other, the editor looks skewed, for instance:

edit1)
Code:
<a href="{xen:link posts/edit, $post}" class="item control edit OverlayTrigger"
data-href="{xen:link posts/edit-inline, $post}"
data-overlayOptions="{&quot;fixed&quot;:false}"
data-messageSelector="#post-{$post.post_id}"><span>
</span>{xen:phrase edit1}</a>
and on the same page:

edit2)
Code:
<a href="{xen:link posts/edit, $post}" class="item control edit OverlayTrigger"
data-href="{xen:link posts/edit-inline, $post}"
data-overlayOptions="{&quot;fixed&quot;:false}"
data-messageSelector="#post-{$post.post_id}"><span>
</span>{xen:phrase edit2}</a>
When launching edit1 it looks fine:


1stOpen.webp


On the same page, after opening Edit1, if you now open Edit2 it looks like this:

2nd.webp

If you go back and try to open Edit1 again, it looks like this:

3rdopen.webp


How can you put two edit links on the same page, that open the same inline rich text editor, without causing this issue
 
hmm... I could just use a random param at the end of the url link (I'll try this). This will mean there will be two instances of the same editor hidden (and they may have different content... so that's not good)

I wish Ragtek was still around, he use to answer dev questions :cry:
 
check XenForo_ViewPublic_Post_EditInline


xf is using what you said:) => a random parameter (microtime)
PHP:
<?php
 
class XenForo_ViewPublic_Post_EditInline extends XenForo_ViewPublic_Base
{
public function renderHtml()
{
$this->_params['editorTemplate'] = XenForo_ViewPublic_Helper_Editor::getEditorTemplate(
$this, 'message',
$this->_params['post']['message'],
array('editorId' =>
'message' . $this->_params['post']['post_id'] . '_' . substr(md5(microtime(true)), -8))
);
}
}
 
Cheers phantom, I guess that's what I'll do then

I didn't know there was a place where this could be called from 2 different buttons in the core
 
Tested and it works with that view

There are two instances, so the 2 different editors could have different content... but it's user error if they launch it once from one button and then again from another (and expect the content to still be the same)...

It will do for me, Thanks.
 
Top Bottom