Quantcast
Channel: MyBB Community Forums - Tutorials
Viewing all articles
Browse latest Browse all 690

A simple way to adding a button in SCEditor

$
0
0
A simple way to adding a button in SCEditor. Tested in Mybb 1.8.4 .

First of all see Screenshots .

===============

.png   2015-03-29_012521.png (Size: 5.01 KB / Downloads: 12)
.png   2015-03-29_012512.png (Size: 7.58 KB / Downloads: 9)
===============
If you want this button then you must work step by step with me Big Grin

1 : go to jscripts/bbcodes_sceditor.js

open it and find

PHP Code:
$.sceditor.command.set('video'
and add before that

PHP Code:
/* + Midori + */ $.sceditor.command.set('midori', {
/* + Midori + */ _dropDown: function (editorcaller) {
/* + Midori + */ var $content;
/* + Midori + */ $content = $(
/* + Midori + */ '<div>' +
/* + Midori + */ '<label for="midori">' editor._('Name') + '</label> ' +
/* + Midori + */ '<input type="text" id="midori" />' +
/* + Midori + */ '</div>' +
/* + Midori + */ '<div>' +
/* + Midori + */ '<label for="link">' editor._('Link:') + '</label> ' +
/* + Midori + */ '<input type="text" id="midoriurl" value="http://" />' +
/* + Midori + */ '</div>' +
/* + Midori + */ '<div><input type="button" class="button" value="' editor._('Insert') + '" /></div>'
/* + Midori + */ );
/* + Midori + */ $content.find('.button').click(function (e) {
/* + Midori + */ var    val $content.find('#midori').val();
/* + Midori + */ midoriurl  $content.find('#midoriurl').val();
/* + Midori + */ if(val) {
/* + Midori + */ editor.focus();
/* + Midori + */ editor.insert('[midori='+val+']'+midoriurl+'[/midori]');
/* + Midori + */ editor.closeDropDown(true);
/* + Midori + */ e.preventDefault();
/* + Midori + */ }
/* + Midori + */ });
/* + Midori + */ editor.createDropDown(caller'midori'$content);
/* + Midori + */ },
/* + Midori + */ exec: function (caller) {
/* + Midori + */ $.sceditor.command.get('midori')._dropDown(thiscaller);
/* + Midori + */ },
/* + Midori + */ txtExec: function (caller) {
/* + Midori + */ $.sceditor.command.get('midori')._dropDown(thiscaller);
/* + Midori + */ },
/* + Midori + */ tooltip'Midori'
/* + Midori + */ }); 

*change "midori" with your button name.
2 : go to jscripts/sceditor/editor_themes/mybb.css
and find
PHP Code:
/* Additional buttons (for MyBB) */
.sceditor-button-video div  {
 
 background-imageurl(video.png);


add below codes after that
PHP Code:
/* + Midori + */ .sceditor-button-midori div  {
/* + Midori + */ background-imageurl(midori.png);
/* + Midori + */ 

3 : go to "codebuttons" template
and find

PHP Code:
{$code}quote

replace below codes with that
PHP Code:
{$code}quote|midori


4 : in finally upload your image in 16x16 size in jscripts/sceditor/editor_themes folder

image for test:
.png   midori.png (Size: 808 bytes / Downloads: 35)

5 : now you can make your Mycode for your editor.

That's it . Heart

source : http://www.midorinco.ir/showthread.php?tid=1602

Viewing all articles
Browse latest Browse all 690

Trending Articles