Announcement

Collapse
No announcement yet.

Advanced Editor Always On?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Advanced Editor Always On?

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

    Thanks.

  • #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.

    GIPHY for vB5 AutoLinker Auto-Create Flag Report Topic Social Icons in Postbit Clear Cache Cron DragDrop Upload Topic AJAX AutoUpdate Custom Avatars Selector Stop Links in Posts...and more!

    Comment


    • vb_nils
      vb_nils commented
      Editing a comment
      Thank You !

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

    Comment


    • #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>

      GIPHY for vB5 AutoLinker Auto-Create Flag Report Topic Social Icons in Postbit Clear Cache Cron DragDrop Upload Topic AJAX AutoUpdate Custom Avatars Selector Stop Links in Posts...and more!

      Comment


      • #5
        Originally posted by Glenn Vergara View Post
        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


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

          Comment


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

            Comment


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

              GIPHY for vB5 AutoLinker Auto-Create Flag Report Topic Social Icons in Postbit Clear Cache Cron DragDrop Upload Topic AJAX AutoUpdate Custom Avatars Selector Stop Links in Posts...and more!

              Comment


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

                www.thesaltybox.com

                Comment


                • #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


                  • #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


                    • #12
                      Originally posted by IggyP View Post
                      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

                      TalkNewsUK - My vBulletin 5.5.6 Demo
                      AdminAmmo - My Cloud Demo

                      Comment


                      • #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:	34
Size:	192.1 KB
ID:	4424295

                        Comment


                        • #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 - Full / Mobile
                          Vote for your favorite feature requests and the bugs you want to see fixed.

                          Comment


                          • #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...
                            X