• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Adapt FieldAdder function for RTE

Allan

Well-known member
#1
Hello,

I would like to use the FieldAdder function for duplicate some inputs, but there is an RTE Editor that I would duplicate.
When I click on the button fot duplicate the inputs, I got 2 editors as you can see here : http://prntscr.com/9b1yzh ; The first duplicated editor is not activated, however the second is activated, I can type some texts...

Looking through how the editor duplicates, I noticed that the editor is in another editor <div> like this :
Code:
<div class="redactor_box"> // editor's code <div class="redactor_box activated"> // editor's code</div></div>
The second editor is in the same <div> as the first editor.

Complete code :
Code:
<div class="redactor_box"><ul class="redactor_toolbar"><li class="redactor_btn_group redactor_btn_right"><ul><li class="redactor_btn_container_switchmode"><a href="javascript:void(null);" title="Use BB Code Editor" class="redactor_btn_switchmode" unselectable="on" tabindex="-1"></a></li></ul></li><li class="redactor_btn_group redactor_btn_right"><ul><li class="redactor_btn_container_removeformat"><a href="javascript:void(null);" title="Remove Formatting" class="redactor_btn_removeformat" unselectable="on" tabindex="-1"></a></li></ul></li><li class="redactor_btn_group"><ul><li class="redactor_btn_container_bold"><a href="javascript:void(null);" title="Bold (Ctrl+B)" class="redactor_btn_bold" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_italic"><a href="javascript:void(null);" title="Italic (Ctrl+I)" class="redactor_btn_italic" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_underline"><a href="javascript:void(null);" title="Underline (Ctrl+U)" class="redactor_btn_underline" unselectable="on" tabindex="-1"></a></li></ul></li><li class="redactor_btn_group"><ul><li class="redactor_btn_container_fontcolor"><a href="javascript:void(null);" title="Text Color" class="redactor_btn_fontcolor" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_fontsize"><a href="javascript:void(null);" title="Font Size" class="redactor_btn_fontsize" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_fontfamily"><a href="javascript:void(null);" title="Font Family" class="redactor_btn_fontfamily" unselectable="on" tabindex="-1"></a></li></ul></li><li class="redactor_btn_group"><ul><li class="redactor_btn_container_createlink"><a href="javascript:void(null);" title="Link" class="redactor_btn_createlink" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_unlink"><a href="javascript:void(null);" title="Unlink" class="redactor_btn_unlink" unselectable="on" tabindex="-1"></a></li></ul></li><li class="redactor_btn_group"><ul><li class="redactor_btn_container_alignment"><a href="javascript:void(null);" title="Alignment" class="redactor_btn_alignment" unselectable="on" tabindex="-1"></a></li></ul></li><li class="redactor_btn_group"><ul><li class="redactor_btn_container_unorderedlist"><a href="javascript:void(null);" title="• Unordered List" class="redactor_btn_unorderedlist" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_orderedlist"><a href="javascript:void(null);" title="1. Ordered List" class="redactor_btn_orderedlist" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_outdent"><a href="javascript:void(null);" title="< Outdent" class="redactor_btn_outdent" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_indent"><a href="javascript:void(null);" title="> Indent" class="redactor_btn_indent" unselectable="on" tabindex="-1"></a></li></ul></li><li class="redactor_btn_group"><ul><li class="redactor_btn_container_smilies"><a href="javascript:void(null);" title="Smilies" class="redactor_btn_smilies" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_image"><a href="javascript:void(null);" title="Image" class="redactor_btn_image" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_media"><a href="javascript:void(null);" title="Media" class="redactor_btn_media" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_insert"><a href="javascript:void(null);" title="Insert..." class="redactor_btn_insert" unselectable="on" tabindex="-1"></a></li></ul></li><li class="redactor_btn_group"><ul><li class="redactor_btn_container_undo"><a href="javascript:void(null);" title="Undo (Ctrl+Z)" class="redactor_btn_undo" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_redo"><a href="javascript:void(null);" title="Redo (Ctrl+Y)" class="redactor_btn_redo" unselectable="on" tabindex="-1"></a></li></ul></li></ul><iframe style="width: 100%; height: 260px;" frameborder="0" class="redactor_textCtrl redactor_MessageEditor redactor_BbCodeWysiwygEditor redactor_"></iframe><div class="redactor_editor_drop"><span>Drop files here to upload</span></div><div class="redactor_box activated"><ul class="redactor_toolbar"><li class="redactor_btn_group redactor_btn_right"><ul><li class="redactor_btn_container_switchmode"><a href="javascript:void(null);" title="Use BB Code Editor" class="redactor_btn_switchmode" unselectable="on" tabindex="-1"></a></li></ul></li><li class="redactor_btn_group redactor_btn_right"><ul><li class="redactor_btn_container_removeformat"><a href="javascript:void(null);" title="Remove Formatting" class="redactor_btn_removeformat" unselectable="on" tabindex="-1"></a></li></ul></li><li class="redactor_btn_group"><ul><li class="redactor_btn_container_bold"><a href="javascript:void(null);" title="Bold (Ctrl+B)" class="redactor_btn_bold" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_italic"><a href="javascript:void(null);" title="Italic (Ctrl+I)" class="redactor_btn_italic" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_underline"><a href="javascript:void(null);" title="Underline (Ctrl+U)" class="redactor_btn_underline" unselectable="on" tabindex="-1"></a></li></ul></li><li class="redactor_btn_group"><ul><li class="redactor_btn_container_fontcolor"><a href="javascript:void(null);" title="Text Color" class="redactor_btn_fontcolor" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_fontsize"><a href="javascript:void(null);" title="Font Size" class="redactor_btn_fontsize" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_fontfamily"><a href="javascript:void(null);" title="Font Family" class="redactor_btn_fontfamily" unselectable="on" tabindex="-1"></a></li></ul></li><li class="redactor_btn_group"><ul><li class="redactor_btn_container_createlink"><a href="javascript:void(null);" title="Link" class="redactor_btn_createlink" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_unlink"><a href="javascript:void(null);" title="Unlink" class="redactor_btn_unlink" unselectable="on" tabindex="-1"></a></li></ul></li><li class="redactor_btn_group"><ul><li class="redactor_btn_container_alignment"><a href="javascript:void(null);" title="Alignment" class="redactor_btn_alignment" unselectable="on" tabindex="-1"></a></li></ul></li><li class="redactor_btn_group"><ul><li class="redactor_btn_container_unorderedlist"><a href="javascript:void(null);" title="• Unordered List" class="redactor_btn_unorderedlist" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_orderedlist"><a href="javascript:void(null);" title="1. Ordered List" class="redactor_btn_orderedlist" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_outdent"><a href="javascript:void(null);" title="< Outdent" class="redactor_btn_outdent" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_indent"><a href="javascript:void(null);" title="> Indent" class="redactor_btn_indent" unselectable="on" tabindex="-1"></a></li></ul></li><li class="redactor_btn_group"><ul><li class="redactor_btn_container_smilies"><a href="javascript:void(null);" title="Smilies" class="redactor_btn_smilies" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_image"><a href="javascript:void(null);" title="Image" class="redactor_btn_image" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_media"><a href="javascript:void(null);" title="Media" class="redactor_btn_media" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_insert"><a href="javascript:void(null);" title="Insert..." class="redactor_btn_insert" unselectable="on" tabindex="-1"></a></li></ul></li><li class="redactor_btn_group"><ul><li class="redactor_btn_container_undo"><a href="javascript:void(null);" title="Undo (Ctrl+Z)" class="redactor_btn_undo" unselectable="on" tabindex="-1"></a></li><li class="redactor_btn_container_redo"><a href="javascript:void(null);" title="Redo (Ctrl+Y)" class="redactor_btn_redo" unselectable="on" tabindex="-1"></a></li></ul></li></ul><iframe style="width: 100%; height: 260px;" frameborder="0" class="redactor_textCtrl redactor_MessageEditor redactor_BbCodeWysiwygEditor redactor_"></iframe><div class="redactor_editor_drop"><span>Drop files here to upload</span></div><textarea name="tab_content[_html]" id="ctrl_tab_content[]_html" class="textCtrl MessageEditor BbCodeWysiwygEditor " style="height: 260px; display: none;" data-css-url="css.php?style=1&amp;css=editor_contents&amp;d=1449509904" data-dialog-url="index.php?editor/dialog&amp;style=1" data-options="{&quot;bbCodes&quot;:[]}"></textarea></div></div>

The JavaScript code that handle the FieldAdder is here : js/xenforo/full/xenforo.js on line 9361 (full file, so you can have a better view for the function)

If you can tell me how to adapt the code, it would be Awesome :D

Thanks you.
 

Attachments