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

Adding to the TinyMCE Editor

Discussion in 'XenForo Development Discussions' started by Jeremy, Nov 6, 2010.

  1. Jeremy

    Jeremy Well-Known Member

    Hey Kier & Mike (mainly),

    I remember you saying somewhere that the TinyMCE editor that you have coded here doesn't allow for custom images / text.... So, if I wanted to add custom BB Codes to them, would I have to extend the controller (I doubt that's possible for the editor) & manually edit the template? Or is there some magical way you guys have hidden from us to add items to the editor?

    Thanks,
    Jeremy
     
    Shelley likes this.
  2. mizter1nho

    mizter1nho Well-Known Member

    How to add own button to editor (TinyMce)?
    Thanks.
     
  3. Brogan

    Brogan XenForo Moderator Staff Member

    I've merged your thread with an earlier one asking the same thing.
     
  4. Jeremy

    Jeremy Well-Known Member

    And... to answer this question. If I am correct (I haven't written any code) you can use the template hook for editor_js_init (I believe that is the name) and add a JS line in it for buttons to be added.
     
  5. mizter1nho

    mizter1nho Well-Known Member

    I have no idea how to add a button to TinyMce. I do not know any JS code is required. :)
     
  6. Jeremy

    Jeremy Well-Known Member

    If I am correct, you need to add something to editor_js_setup under xenforo: to set up hovers... And then add appropriate CSS. I'm not 100% sure, haven't gotten around to developing tha.t
     
  7. James

    James Well-Known Member

    TinyMCE is initialised in the editor_js_setup between the hook editor_tinymce_init.

    You should be able to plug parameters straight into that from the TinyMCE Reference.

    Let me know if you get anywhere.
     
  8. Nek

    Nek Member

    I've added button for custom BB code by copying and modifying code from "quote" button. There are three files must be modified for this task:
    editor_template.js ( TinyMCE theme definition )
    editor_js_setup
    editor_ui.css
    and adding new phrase to used languages
    I have not any web programming experience, so it's maybe a creepy way, but at least, it works :D
     
  9. EQnoble

    EQnoble Well-Known Member

    Can I see a screenshot?
     
  10. Nek

    Nek Member

    If you mean an editor screenshot, this is it:

    screen.jpg
     
    EQnoble likes this.
  11. EQnoble

    EQnoble Well-Known Member

  12. Brogan

    Brogan XenForo Moderator Staff Member

    Don't forget you will have to redo the file edits after an upgrade.
     
    Nek likes this.
  13. mizter1nho

    mizter1nho Well-Known Member

    Can you share code? Thank you.
     
  14. Nek

    Nek Member

    This pack contains three txt files which shows code changes. You can find them by arrows at left side.
    BTW, editor_template.js changes were applied to a copy of original theme placed in another directory in "js\tinymce\themes\". And this files shows theme changing code too.
     

    Attached Files:

    mizter1nho likes this.
  15. ragtek

    ragtek Guest

  16. Cool

    Cool Active Member

    this unfortunately is (at least for me) the big minus for xenforo. i personally need a fully working tinymce editor for admins.
     
  17. James

    James Well-Known Member

    I asked a while back if it'd be possible to edit the editor using TinyMCE code and I believe Mike replied saying it was possible. I cannot find the thread though, and I figured out it wasn't possible too.
     
  18. ragtek

    ragtek Guest

    I've stopped trying to add them into the editor and i placed them under the editor^^
     

Share This Page