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

Add XF's Editor in an Addon

Discussion in 'XenForo Development Discussions' started by Lu Jia, Sep 7, 2012.

  1. Lu Jia

    Lu Jia Active Member

    I guess it's possible tu add the TinyMCE Editor in my addon.
    Is there someone who can explain me how to do it?
    Simply I want to add an editor to a textarea in my addon :)

    Thanks in advance
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    It may not be this easy...

    But this is the template code used to add the textarea with TinyMCE (with the fall back to a standard text editor and all of the other good stuff):

    <dl class="ctrlUnit fullWidth">
    <dt></dt>
    <dd>{xen:raw $editorTemplate}</dd>
    </dl>
     
    CyclingTribe likes this.
  3. Lu Jia

    Lu Jia Active Member

  4. Lu Jia

    Lu Jia Active Member

    I miss something, how can I get the text from the editor?
    PHP:
    <?php
     
    class EWRporta_ViewPublic_Edit extends XenForo_ViewPublic_Base
    {
        public function 
    renderHtml()
        {
            
    $this->_params['editorTemplate'] = XenForo_ViewPublic_Helper_Editor::getEditorTemplate(
                
    $this'message'$this->_params['defaultMessage']
            );
        }
    }
    I guess 'message' would be the name of the input but it doesn't work.

    Edit: I found the solution, just add _html :D message => message_html
     
  5. Lu Jia

    Lu Jia Active Member

    New day, new problem :D
    I need to do a second editor, because I need to edit the entry of the first one.
    Atm i'm using:
    PHP:
                $text $this->_request->getPost('message_html');
               
                
    $text addslashes($text);
    and
    PHP:
                $news['hnews_text'] = stripslashes($news['hnews_text']);
    the first one take the input value in $text and prepare the var to be stored in db.
    The second one take the db's value and return it for displaying.
    The problem is when i use this var for 'defaultMessage' in the editor will be showed:

    HTML:
    <p style="margin-right: 2px; margin-bottom: 5px; margin-left: 2px; padding: 2px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 13px; line-height: normal;"><a class="highslide" style="color: #ff76...
    and not WYSIWYG like the input editor.
    Sorry for my bad english I guess you can understand my problem, if you can't just tell me and i'll try to explain it in a different way.

    Thanks in advance
     
  6. Lu Jia

    Lu Jia Active Member

    any suggestions?
     
  7. Lu Jia

    Lu Jia Active Member

    bump :(
     

Share This Page