4 posters
i want add indent & remove one indent buttons in SCEditor
coolkool- Forumember
- Posts : 140
Reputation : 3
Language : Arabic
Location : SA
Last edited by coolkool on September 24th 2015, 4:05 pm; edited 1 time in total
Niko- Helper
- Posts : 3231
Reputation : 248
Language : English, Italian, French
Location : Italy
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
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
coolkool- Forumember
- Posts : 140
Reputation : 3
Language : Arabic
Location : SA
i want only this button please
Ange Tuteur- Forumaster
- Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania
Can't remember if these buttons are in our Editor code, but try the following :
- Code:
$(function() {
if (toolbar) toolbar += '|indent,outdent';
});
coolkool- Forumember
- Posts : 140
Reputation : 3
Language : Arabic
Location : SA
I'm Sorry , but it does not work
Ange Tuteur- Forumaster
- Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania
I pulled the indent and outdent commands from the update to date sceditor source. Try adding this script in all the pages.
You'll of course need to add images yourself since our source doesn't contain them.
CSS :
- 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- Forumember
- Posts : 140
Reputation : 3
Language : Arabic
Location : SA
Ange Tuteur- Forumaster
- Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania
Did you remove the previous script I gave you ?
https://help.forumotion.com/t143510-i-want-add-indent-remove-one-indent-buttons-in-sceditor#978707
https://help.forumotion.com/t143510-i-want-add-indent-remove-one-indent-buttons-in-sceditor#978707
coolkool- Forumember
- Posts : 140
Reputation : 3
Language : Arabic
Location : SA
Thank you very much my brother, but how I can change their places?
Ange Tuteur- Forumaster
- Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania
In this script you have to modify this part which modified the editor toolbar :
Currently it's adding them to the end in a new group.
- Code:
toolbar += '|indent,outdent';
Currently it's adding them to the end in a new group.
coolkool- Forumember
- Posts : 140
Reputation : 3
Language : Arabic
Location : SA
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- Forumaster
- Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania
Sure.
Replace :
by :
Replace :
- Code:
toolbar += '|indent,outdent';
by :
- Code:
toolbar = toolbar.replace(/more/, 'more,indent,outdent');
coolkool- Forumember
- Posts : 140
Reputation : 3
Language : Arabic
Location : SA
thank you ^.^
it's work 100%
I ask you to go to:
I want you to help me a bit if you can
Ape- Administrator
- Posts : 19325
Reputation : 2005
Language : fluent in dork / mumbojumbo & English haha
@coolkool is this topic now solved or do you need more help ?
coolkool- Forumember
- Posts : 140
Reputation : 3
Language : Arabic
Location : SA
No thanks you can locked this topic now ^^
Ape- Administrator
- Posts : 19325
Reputation : 2005
Language : fluent in dork / mumbojumbo & English haha