The forum of the forums

Would you like to react to this message? Create an account in a few clicks or log in to continue.
The forum of the forums
4 posters

    i want add indent & remove one indent buttons in SCEditor

    coolkool
    coolkool
    Forumember


    Male Posts : 140
    Reputation : 3
    Language : Arabic
    Location : SA

    Solved i want add indent & remove one indent buttons in SCEditor

    Post by coolkool September 23rd 2015, 7:22 pm



    Last edited by coolkool on September 24th 2015, 4:05 pm; edited 1 time in total
    Niko
    Niko
    Helper
    Helper


    Male Posts : 3231
    Reputation : 248
    Language : English, Italian, French
    Location : Italy

    Solved Re: i want add indent & remove one indent buttons in SCEditor

    Post by Niko September 24th 2015, 1:43 pm

    Hello @coolkool

    Ange Tuteur has developed a javascript code to add/remove/edit the BBcode buttons of the new editor. You can find the documentation here: https://github.com/SethClydesdale/fa-sceditor-customization

    Full javascript code => https://github.com/SethClydesdale/fa-sceditor-customization/blob/master/fa-sceditor-options.js

    Have a nice day :rose:
    coolkool
    coolkool
    Forumember


    Male Posts : 140
    Reputation : 3
    Language : Arabic
    Location : SA

    Solved Re: i want add indent & remove one indent buttons in SCEditor

    Post by coolkool September 24th 2015, 1:59 pm

    i want only this button please
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: i want add indent & remove one indent buttons in SCEditor

    Post by Ange Tuteur September 24th 2015, 2:18 pm

    Can't remember if these buttons are in our Editor code, but try the following :
    Code:
    $(function() {
      if (toolbar) toolbar += '|indent,outdent';
    });
    coolkool
    coolkool
    Forumember


    Male Posts : 140
    Reputation : 3
    Language : Arabic
    Location : SA

    Solved Re: i want add indent & remove one indent buttons in SCEditor

    Post by coolkool September 24th 2015, 2:22 pm

    I'm Sorry , but it does not work
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: i want add indent & remove one indent buttons in SCEditor

    Post by Ange Tuteur September 24th 2015, 2:45 pm

    I pulled the indent and outdent commands from the update to date sceditor source. Try adding this script in all the pages.

    Code:
    $(function() {
      if ($.sceditor) {
        $.sceditor.command.set('indent', {
          state: function (parents, firstBlock) {
            var range, startParent, endParent,
            $firstBlock = $(firstBlock),
            parentLists = $firstBlock.parents('ul,ol,menu'),
            parentList  = parentLists.first();

            if (parentLists.length > 1 ||
              parentList.children().length > 1) {
              return 0;
            }

            if ($firstBlock.is('ul,ol,menu')) {
              range = this.getRangeHelper().selectedRange();

              if (window.Range && range instanceof Range) {
                  startParent = range.startContainer.parentNode;
                  endParent = range.endContainer.parentNode;

                  if (startParent !== startParent.parentNode.firstElementChild || ($(endParent).is('li') && endParent !== endParent.parentNode.lastElementChild)) {
                    return 0;
                  }
                } else {
                  return $firstBlock.is('li,ul,ol,menu') ? 0 : -1;
                }
              }
              return -1;
            },

            exec: function () {
              var editor = this,
              $elm = $(editor.getRangeHelper().getFirstBlockParent());

              editor.focus();

              if ($elm.parents('ul,ol,menu')) {
                editor.execCommand('indent');
              }
            },

            tooltip: 'Add indent'
        });

        $.sceditor.command.set('outdent', {
          state: function (parents, firstBlock) {
            return $(firstBlock).is('ul,ol,menu') || $(firstBlock).parents('ul,ol,menu').length > 0 ? 0 : -1;
          },

          exec: function () {
            var editor = this,
            $elm = $(editor.getRangeHelper().getFirstBlockParent());

            if ($elm.parents('ul,ol,menu')) {
              editor.execCommand('outdent');
            }
          },

          tooltip: 'Remove one indent'
        });

        toolbar += '|indent,outdent';
      }
    });

    You'll of course need to add images yourself since our source doesn't contain them.

    CSS :
    Code:
    .sceditor-button-indent div { background-image:url('IMAGE') !important }
    .sceditor-button-outdent div { background-image:url('IMAGE') !important }
    coolkool
    coolkool
    Forumember


    Male Posts : 140
    Reputation : 3
    Language : Arabic
    Location : SA

    Solved Re: i want add indent & remove one indent buttons in SCEditor

    Post by coolkool September 24th 2015, 3:05 pm

    thank you but look here :
    i want add indent & remove one indent buttons in SCEditor L2S0EJG

    Indent repeatedly button twice
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: i want add indent & remove one indent buttons in SCEditor

    Post by Ange Tuteur September 24th 2015, 3:13 pm

    coolkool
    coolkool
    Forumember


    Male Posts : 140
    Reputation : 3
    Language : Arabic
    Location : SA

    Solved Re: i want add indent & remove one indent buttons in SCEditor

    Post by coolkool September 24th 2015, 3:21 pm

    Thank you very much my brother, but how I can change their places?
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: i want add indent & remove one indent buttons in SCEditor

    Post by Ange Tuteur September 24th 2015, 3:26 pm

    In this script you have to modify this part which modified the editor toolbar :
    Code:
    toolbar += '|indent,outdent';

    Currently it's adding them to the end in a new group.
    coolkool
    coolkool
    Forumember


    Male Posts : 140
    Reputation : 3
    Language : Arabic
    Location : SA

    Solved Re: i want add indent & remove one indent buttons in SCEditor

    Post by coolkool September 24th 2015, 3:47 pm

    I've done as you told me, but not the most successful can you do instead of me?
    I want more before Button
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: i want add indent & remove one indent buttons in SCEditor

    Post by Ange Tuteur September 24th 2015, 3:50 pm

    Sure.

    Replace :
    Code:
    toolbar += '|indent,outdent';

    by :
    Code:
    toolbar = toolbar.replace(/more/, 'more,indent,outdent');
    coolkool
    coolkool
    Forumember


    Male Posts : 140
    Reputation : 3
    Language : Arabic
    Location : SA

    Solved Re: i want add indent & remove one indent buttons in SCEditor

    Post by coolkool September 24th 2015, 4:03 pm

    thank you ^.^
    it's work 100%
    I ask you to go to:
    I want you to help me a bit if you can
    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19325
    Reputation : 2005
    Language : fluent in dork / mumbojumbo & English haha

    Solved Re: i want add indent & remove one indent buttons in SCEditor

    Post by Ape September 24th 2015, 6:03 pm

    @coolkool is this topic now solved or do you need more help ?



    i want add indent & remove one indent buttons in SCEditor Left1212i want add indent & remove one indent buttons in SCEditor Center11i want add indent & remove one indent buttons in SCEditor Right112
    i want add indent & remove one indent buttons in SCEditor Ape_b110
    i want add indent & remove one indent buttons in SCEditor Ape1010
    coolkool
    coolkool
    Forumember


    Male Posts : 140
    Reputation : 3
    Language : Arabic
    Location : SA

    Solved Re: i want add indent & remove one indent buttons in SCEditor

    Post by coolkool September 24th 2015, 6:12 pm

    No thanks you can locked this topic now ^^
    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19325
    Reputation : 2005
    Language : fluent in dork / mumbojumbo & English haha

    Solved Re: i want add indent & remove one indent buttons in SCEditor

    Post by Ape September 24th 2015, 6:13 pm

    Thank you @coolkool Have a really Nice day Wink

    Topic solved and archived



    i want add indent & remove one indent buttons in SCEditor Left1212i want add indent & remove one indent buttons in SCEditor Center11i want add indent & remove one indent buttons in SCEditor Right112
    i want add indent & remove one indent buttons in SCEditor Ape_b110
    i want add indent & remove one indent buttons in SCEditor Ape1010

      Current date/time is September 23rd 2024, 2:18 am