The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

i want add indent & remove one indent buttons in SCEditor

View previous topic View next topic Go down

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

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



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

coolkool
Forumember

Posts : 116
Reputation : 3
Language : arabic

http://x-gaming.lforum.biz

Back to top Go down

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

Post by Niko on 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:

Niko
Hyperactive

Male Posts : 2166
Reputation : 93
Language : English, French, Italian, Spanish, Latin

https://www.translationscloud.com/?utm_source=forumotion&utm

Back to top Go down

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

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

i want only this button please

coolkool
Forumember

Posts : 116
Reputation : 3
Language : arabic

http://x-gaming.lforum.biz

Back to top Go down

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

Post by Ange Tuteur on 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';
});

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2684
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

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

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

I'm Sorry , but it does not work

coolkool
Forumember

Posts : 116
Reputation : 3
Language : arabic

http://x-gaming.lforum.biz

Back to top Go down

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

Post by Ange Tuteur on 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 }

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2684
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

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

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

thank you but look here :

Indent repeatedly button twice

coolkool
Forumember

Posts : 116
Reputation : 3
Language : arabic

http://x-gaming.lforum.biz

Back to top Go down

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

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


Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2684
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

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

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

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

coolkool
Forumember

Posts : 116
Reputation : 3
Language : arabic

http://x-gaming.lforum.biz

Back to top Go down

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

Post by Ange Tuteur on 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.

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2684
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

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

Post by coolkool on 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

coolkool
Forumember

Posts : 116
Reputation : 3
Language : arabic

http://x-gaming.lforum.biz

Back to top Go down

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

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

Sure.

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

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

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2684
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

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

Post by coolkool on 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

coolkool
Forumember

Posts : 116
Reputation : 3
Language : arabic

http://x-gaming.lforum.biz

Back to top Go down

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

Post by APE on September 24th 2015, 6:03 pm

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





APE
Manager
Manager

Male Posts : 8339
Reputation : 718
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

http://chatworld.forumotion.co.uk/

Back to top Go down

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

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

No thanks you can locked this topic now ^^

coolkool
Forumember

Posts : 116
Reputation : 3
Language : arabic

http://x-gaming.lforum.biz

Back to top Go down

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

Post by APE on September 24th 2015, 6:13 pm

Thank you @coolkool Have a really Nice day Wink

Topic solved and archived





APE
Manager
Manager

Male Posts : 8339
Reputation : 718
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

http://chatworld.forumotion.co.uk/

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum