Advanced Editor Always On?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Vonlinchen
    New Member
    • Feb 2015
    • 26
    • 5.1.x

    Advanced Editor Always On?

    Is it possible to have the advanced editor for posting always on or toggled on by default?

    Thanks.
  • glennrocksvb
    Former vBulletin Developer
    • Mar 2011
    • 4011
    • 5.7.X

    #2
    It is possible via template hook system wherein you programmatically click on the A icon.

    Here's the code to add to the new template. Hook location is editor_after_secondary_toolbar_icons

    Code:
    <script>
    (function() {
        var loadAdvancedEditor = function() {
            var editorToolbar = document.querySelector('.b-toolbar__item[data-panel="b-content-entry-panel__content--toggle-editor"]:not(.b-toolbar__item--active)');
            editorToolbar && editorToolbar.click();
        };
        if (window.addEventListener) {
            window.addEventListener('load', loadAdvancedEditor, false);
        }
        else if (window.attachEvent) {
            window.attachEvent('onload', loadAdvancedEditor);
        }
    })();
    </script>
    ​I didn't use jQuery because it is not available yet at that hook location.

    Flag Icon Postbit Insert GIPHY Impersonate User BETTER INITIALS AVATAR Better Name Card Quote Selected Text Bookmark Posts Post Footer Translate Stop Links in Posts +MORE!

    Comment


    • vb_nils
      vb_nils commented
      Editing a comment
      Thank You !
  • tomcoleman
    Senior Member
    • Aug 2010
    • 112

    #3
    can this also include advanced editor always on and smilies always on?

    Comment

    • glennrocksvb
      Former vBulletin Developer
      • Mar 2011
      • 4011
      • 5.7.X

      #4
      Try this. I also added to load Upload Attachments panel by default. Remove it if not needed.

      Code:
      <script>
      (function() {
          var loadEditorDefaults = function() {
      
              //Advanced Editor
              var advancedEditorIcon = document.querySelector('.b-toolbar__item[data-panel="b-content-entry-panel__content--toggle-editor"]:not(.b-toolbar__item--active)');
              advancedEditorIcon && advancedEditorIcon.click();
      
              //Smilies
              var smiliesIcon = document.querySelector('.b-toolbar__item[data-panel="b-content-entry-panel__content--smiley"]:not(.b-toolbar__item--active)');
              smiliesIcon && smiliesIcon.click();
      
              //Upload Attachments
              var uploadIcon = document.querySelector('.b-toolbar__item[data-panel="b-content-entry-panel__content--attachment"]:not(.b-toolbar__item--active)');
              uploadIcon && uploadIcon.click();
      
          };
      
          if (window.addEventListener) {
              window.addEventListener('load', loadEditorDefaults, false);
          }
          else if (window.attachEvent) {
              window.attachEvent('onload', loadEditorDefaults);
          }
      })();
      </script>

      Flag Icon Postbit Insert GIPHY Impersonate User BETTER INITIALS AVATAR Better Name Card Quote Selected Text Bookmark Posts Post Footer Translate Stop Links in Posts +MORE!

      Comment

      • tomcoleman
        Senior Member
        • Aug 2010
        • 112

        #5
        Originally posted by Glenn Vergara
        Try this. I also added to load Upload Attachments panel by default. Remove it if not needed.

        Code:
        <script>
        (function() {
        var loadEditorDefaults = function() {
        
        //Advanced Editor
        var advancedEditorIcon = document.querySelector('.b-toolbar__item[data-panel="b-content-entry-panel__content--toggle-editor"]:not(.b-toolbar__item--active)');
        advancedEditorIcon && advancedEditorIcon.click();
        
        //Smilies
        var smiliesIcon = document.querySelector('.b-toolbar__item[data-panel="b-content-entry-panel__content--smiley"]:not(.b-toolbar__item--active)');
        smiliesIcon && smiliesIcon.click();
        
        //Upload Attachments
        var uploadIcon = document.querySelector('.b-toolbar__item[data-panel="b-content-entry-panel__content--attachment"]:not(.b-toolbar__item--active)');
        uploadIcon && uploadIcon.click();
        
        };
        
        if (window.addEventListener) {
        window.addEventListener('load', loadEditorDefaults, false);
        }
        else if (window.attachEvent) {
        window.attachEvent('onload', loadEditorDefaults);
        }
        })();
        </script>
        using that code doesn't have anything activated now - its gone back to default no advanced nothing...

        Comment

        • Vonlinchen
          New Member
          • Feb 2015
          • 26
          • 5.1.x

          #6
          Thanks for the reply, works like a charm!

          Comment

          • tomcoleman
            Senior Member
            • Aug 2010
            • 112

            #7
            not on 5.1.7 with the smiles as well...

            Comment

            • glennrocksvb
              Former vBulletin Developer
              • Mar 2011
              • 4011
              • 5.7.X

              #8
              Originally posted by tomcoleman
              not on 5.1.7 with the smiles as well...
              Link to your forum? You might not have created the hook correctly.

              Flag Icon Postbit Insert GIPHY Impersonate User BETTER INITIALS AVATAR Better Name Card Quote Selected Text Bookmark Posts Post Footer Translate Stop Links in Posts +MORE!

              Comment

              • tomcoleman
                Senior Member
                • Aug 2010
                • 112

                #9
                I just edited the old code from your first post which was working fine.

                Comment

                • IggyP
                  Senior Member
                  • Mar 2012
                  • 680

                  #10
                  nice i like that thank you...one less clicking is usually good stuffs where u can do it...we have alot of smiley so i left that part out...

                  one thing i notice tho....if you make a post....when the page reloads, the adv editor is not open and page must be refreshed to run the script...can that be fixed?

                  Comment

                  • IggyP
                    Senior Member
                    • Mar 2012
                    • 680

                    #11
                    hmm i notice another thing.....i believe the ideal here is for the adv editor to display once content has started to be entered...it seems to happen sometimes as a fluke and sometimes not(edit:after this content posted, all i did was click the content entry box and adv editor comes up, thats how id like to see it function)...i think this is favorable to always open tho...if you are only reading and not posting its not necessary...

                    can that be possible?? such nitpick haha sorry

                    Comment

                    • Mark.B
                      vBulletin Support
                      • Feb 2004
                      • 24286
                      • 6.0.X

                      #12
                      Originally posted by IggyP
                      hmm i notice another thing.....i believe the ideal here is for the adv editor to display once content has started to be entered...it seems to happen sometimes as a fluke and sometimes not(edit:after this content posted, all i did was click the content entry box and adv editor comes up, thats how id like to see it function)...i think this is favorable to always open tho...if you are only reading and not posting its not necessary...

                      can that be possible?? such nitpick haha sorry
                      That's not how it's currently coded. It would require fairly large code changes for it to function like that.
                      MARK.B
                      vBulletin Support
                      ------------
                      My Unofficial vBulletin 6.0.0 Demo: https://www.talknewsuk.com
                      My Unofficial vBulletin Cloud Demo: https://www.adminammo.com

                      Comment

                      • SlowStreamer
                        New Member
                        • Mar 2019
                        • 4
                        • 5.3.x

                        #13
                        I know this is an old post, but I just stumbled across it cause I could not find option to set the Advanced editor as a default for all users.
                        Below is how setup a new template hook using what Glenn provided. After I saved, I went out and looked at "Post Reply" and the advanced options were not displayed by default as they are here on this site. When I clicked in the add text area, the advanced editor opened up. Which I have not problem with if that is how it was designed to work.

                        The problem is, it only worked once. I have refreshed page and reloaded browser, but it will not automatically open up again.

                        Any suggestions are much appreciated.

                        Running 5.5.2 PL2
                        Browser of choice - FireFox.

                        Click image for larger version

Name:	advance_editor_hook.jpg
Views:	188
Size:	192.1 KB
ID:	4424295

                        Comment

                        • Wayne Luke
                          vBulletin Technical Support Lead
                          • Aug 2000
                          • 73979

                          #14
                          The editor will remember its status now. The above third-party modification is neither supported or actually needed in the with current versions of the vBulletin 5.5 series. This is the problem with replying to old posts. They become irrelevant very quickly as we continue to update the software. 5-6 releases a year changes a lot in a relatively short period of time. The above javascript code is most likely breaking the display of the editor on your vBulletin 5.5.2.

                          Simply click on the button to show the Rich Editor toolbar and the system will store it with your user account. The status will be reflected on all devices that the user utilizes.
                          Translations provided by Google.

                          Wayne Luke
                          The Rabid Badger - a vBulletin Cloud demonstration site.
                          vBulletin 5 API

                          Comment

                          • SlowStreamer
                            New Member
                            • Mar 2019
                            • 4
                            • 5.3.x

                            #15
                            Interesting observation to add. I just noticed, that if I have initially clicked on the Advanced editor button, then refresh, the advanced editor options are not displayed, but once I click in the text input it advanced editor bar opens up.

                            However, if I then click on the Advanced button to close the bar and refresh, and click in the text input, the bar will not open automatically.

                            Therefore, it looks like you the Advanced editor must be initially activated for the hook to work. However, I do not have to do that on this site. Is it because this site is at 5.5.4 and I'm running 5.5.2 ?

                            Comment

                            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                            Working...