MyBB Community Forums

Full Version: [1.8] How add sceditor in quick reply and quick edit
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
This tutorial not more supported.

Plz use plugin: http://community.mybb.com/thread-158367.html or http://community.mybb.com/thread-157946.html

Ps. This only work with latest version of mybb 1.8 Beta 3 of Github
https://github.com/mybb/mybb/archive/feature.zip

Ps2. If need modification in final version of mybb 1.8 to this work, i will update this tutorial, don´t worry.
Ps3. Plz, not request to me or send PM asking how to add buttons in the editor. I'll just ignore it.

With Smilies box and without Quick Edit:

1 - Create quickadveditor.php in notepad++

<?php 
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
    die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

// Plugin info
function quickadveditor_info ()
{
    return array(
        "name"            => "Quick Advanced Editor",
        "description"    => "Advanced editor in quick reply",
        "website"        => "",
        "author"        => "martec",
        "authorsite"    => "",
        "version"        => "1.2",
        "guid"             => "",
        "compatibility" => "17*,18*"
    );
}

function quickadveditor_activate()
{
    include_once MYBB_ROOT.'inc/adminfunctions_templates.php';

    find_replace_templatesets(
        'showthread_quickreply',
        '#' . preg_quote('</textarea>') . '#i',
        '</textarea>{$codebuttons}'
    );

    find_replace_templatesets(
        'showthread_quickreply',
        '#' . preg_quote('<span class="smalltext">{$lang->message_note}<br />') . '#i',
        '<span class="smalltext">{$lang->message_note}<br />{$smilieinserter}'
    );

    find_replace_templatesets(
        'codebuttons',
        '#' . preg_quote('plugins: "bbcode",') . '#i',
        'plugins: "bbcode",
	height: 270,'
    );

    find_replace_templatesets(
        'codebuttons',
        '#' . preg_quote('});
</script>') . '#i',
        '});

/**********************************
 * Thread compatibility functions *
 **********************************/
if(typeof Thread !== \'undefined\')
{
    var quickReplyFunc = Thread.quickReply;
    Thread.quickReply = function(e) {

        if(MyBBEditor) {
            MyBBEditor.updateOriginal();
			$(\'form[id*="quick_reply_form"]\').bind(\'reset\', function() {
				MyBBEditor.val(\'\').emoticons(true);
			});
		}
		
        return quickReplyFunc.call(this, e);		
	};
};
</script>'
    );	

}

function quickadveditor_deactivate()
{
    include_once MYBB_ROOT."inc/adminfunctions_templates.php";

    find_replace_templatesets(
        'showthread_quickreply',
        '#' . preg_quote('</textarea>{$codebuttons}') . '#i',
        '</textarea>'
    );

    find_replace_templatesets(
        'showthread_quickreply',
        '#' . preg_quote('<span class="smalltext">{$lang->message_note}<br />{$smilieinserter}') . '#i',
        '<span class="smalltext">{$lang->message_note}<br />'
    );

    find_replace_templatesets(
        'codebuttons',
        '#' . preg_quote('plugins: "bbcode",
	height: 270,') . '#i',
        'plugins: "bbcode",'
    );

    find_replace_templatesets(
        'codebuttons',
        '#' . preg_quote('});

/**********************************
 * Thread compatibility functions *
 **********************************/
if(typeof Thread !== \'undefined\')
{
    var quickReplyFunc = Thread.quickReply;
    Thread.quickReply = function(e) {

        if(MyBBEditor) {
            MyBBEditor.updateOriginal();
			$(\'form[id*="quick_reply_form"]\').bind(\'reset\', function() {
				MyBBEditor.val(\'\').emoticons(true);
			});
		}
		
        return quickReplyFunc.call(this, e);		
	};
};
</script>') . '#i',
        '});
</script>'
    );

}

$plugins->add_hook("showthread_start", "codebuttons");     

function codebuttons () {

    global $smilieinserter, $codebuttons;
	
    $codebuttons = build_mycode_inserter();
    $smilieinserter = build_clickable_smilies();
}

?>

2 - upload quickadveditor.php to root/inc/plugins and activate.



With Smilies box and with Quick Edit:

1 - Create quickadveditor.php in notepad++

<?php 
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
    die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

// Plugin info
function quickadveditor_info ()
{
    return array(
        "name"            => "Quick Advanced Editor",
        "description"    => "Advanced editor in quick reply",
        "website"        => "",
        "author"        => "martec",
        "authorsite"    => "",
        "version"        => "1.2",
        "guid"             => "",
        "compatibility" => "17*,18*"
    );
}

function quickadveditor_activate()
{
    include_once MYBB_ROOT.'inc/adminfunctions_templates.php';

    find_replace_templatesets(
        'showthread_quickreply',
        '#' . preg_quote('</textarea>') . '#i',
        '</textarea>{$codebuttons}'
    );

    find_replace_templatesets(
        'showthread_quickreply',
        '#' . preg_quote('<span class="smalltext">{$lang->message_note}<br />') . '#i',
        '<span class="smalltext">{$lang->message_note}<br />{$smilieinserter}'
    );

    find_replace_templatesets(
        'codebuttons',
        '#' . preg_quote('plugins: "bbcode",') . '#i',
        'plugins: "bbcode",
    height: 270,'
    );

    find_replace_templatesets(
        'codebuttons',
        '#' . preg_quote('});
</script>') . '#i',
        '});

($.fn.on || $.fn.live).call($(document), \'focus\', \'textarea[name*="value"]\', function () {
    $(this).sceditor(opt_editor);
    {$sourcemode}
});
  
/**********************************
 * Thread compatibility functions *
 **********************************/
if(typeof Thread !== \'undefined\')
{
    var quickReplyFunc = Thread.quickReply;
    Thread.quickReply = function(e) {

        if(MyBBEditor) {
            MyBBEditor.updateOriginal();
            $(\'form[id*="quick_reply_form"]\').bind(\'reset\', function() {
                MyBBEditor.val(\'\').emoticons(true);
            });
        }
        
        return quickReplyFunc.call(this, e);        
    };
};
</script>'
    );    

}

function quickadveditor_deactivate()
{
    include_once MYBB_ROOT."inc/adminfunctions_templates.php";

    find_replace_templatesets(
        'showthread_quickreply',
        '#' . preg_quote('</textarea>{$codebuttons}') . '#i',
        '</textarea>'
    );

    find_replace_templatesets(
        'showthread_quickreply',
        '#' . preg_quote('<span class="smalltext">{$lang->message_note}<br />{$smilieinserter}') . '#i',
        '<span class="smalltext">{$lang->message_note}<br />'
    );

    find_replace_templatesets(
        'codebuttons',
        '#' . preg_quote('plugins: "bbcode",
    height: 270,') . '#i',
        'plugins: "bbcode",'
    );

    find_replace_templatesets(
        'codebuttons',
        '#' . preg_quote('});

($.fn.on || $.fn.live).call($(document), \'focus\', \'textarea[name*="value"]\', function () {
    $(this).sceditor(opt_editor);
    {$sourcemode}
});
  
/**********************************
 * Thread compatibility functions *
 **********************************/
if(typeof Thread !== \'undefined\')
{
    var quickReplyFunc = Thread.quickReply;
    Thread.quickReply = function(e) {

        if(MyBBEditor) {
            MyBBEditor.updateOriginal();
            $(\'form[id*="quick_reply_form"]\').bind(\'reset\', function() {
                MyBBEditor.val(\'\').emoticons(true);
            });
        }
        
        return quickReplyFunc.call(this, e);        
    };
};
</script>') . '#i',
        '});
</script>'
    );

}

$plugins->add_hook("showthread_start", "codebuttons");     

function codebuttons () {

    global $smilieinserter, $codebuttons;
    
    $codebuttons = build_mycode_inserter();
    $smilieinserter = build_clickable_smilies();
}

?>

2 - upload quickadveditor.php to root/inc/plugins and activate.



Without Smilies box and with Quick Edit:

1 - Create quickadveditor.php in notepad++

<?php 
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
    die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

// Plugin info
function quickadveditor_info ()
{
    return array(
        "name"            => "Quick Advanced Editor",
        "description"    => "Advanced editor in quick reply",
        "website"        => "",
        "author"        => "martec",
        "authorsite"    => "",
        "version"        => "1.2",
        "guid"             => "",
        "compatibility" => "17*,18*"
    );
}

function quickadveditor_activate()
{
    include_once MYBB_ROOT.'inc/adminfunctions_templates.php';

    find_replace_templatesets(
        'showthread_quickreply',
        '#' . preg_quote('</textarea>') . '#i',
        '</textarea>{$codebuttons}'
    );

    find_replace_templatesets(
        'codebuttons',
        '#' . preg_quote('plugins: "bbcode",') . '#i',
        'plugins: "bbcode",
	height: 270,'
    );

    find_replace_templatesets(
        'codebuttons',
        '#' . preg_quote('});
</script>') . '#i',
        '});

($.fn.on || $.fn.live).call($(document), \'focus\', \'textarea[name*="value"]\', function () {
    $(this).sceditor(opt_editor);
    {$sourcemode}
});
  
/**********************************
 * Thread compatibility functions *
 **********************************/
if(typeof Thread !== \'undefined\')
{
    var quickReplyFunc = Thread.quickReply;
    Thread.quickReply = function(e) {

        if(MyBBEditor) {
            MyBBEditor.updateOriginal();
			$(\'form[id*="quick_reply_form"]\').bind(\'reset\', function() {
				MyBBEditor.val(\'\').emoticons(true);
			});
		}
		
        return quickReplyFunc.call(this, e);		
	};
};
</script>'
    );	

}

function quickadveditor_deactivate()
{
    include_once MYBB_ROOT."inc/adminfunctions_templates.php";

    find_replace_templatesets(
        'showthread_quickreply',
        '#' . preg_quote('</textarea>{$codebuttons}') . '#i',
        '</textarea>'
    );

    find_replace_templatesets(
        'codebuttons',
        '#' . preg_quote('plugins: "bbcode",
	height: 270,') . '#i',
        'plugins: "bbcode",'
    );

    find_replace_templatesets(
        'codebuttons',
        '#' . preg_quote('});

($.fn.on || $.fn.live).call($(document), \'focus\', \'textarea[name*="value"]\', function () {
    $(this).sceditor(opt_editor);
    {$sourcemode}
});
  
/**********************************
 * Thread compatibility functions *
 **********************************/
if(typeof Thread !== \'undefined\')
{
    var quickReplyFunc = Thread.quickReply;
    Thread.quickReply = function(e) {

        if(MyBBEditor) {
            MyBBEditor.updateOriginal();
			$(\'form[id*="quick_reply_form"]\').bind(\'reset\', function() {
				MyBBEditor.val(\'\').emoticons(true);
			});
		}
		
        return quickReplyFunc.call(this, e);		
	};
};
</script>') . '#i',
        '});
</script>'
    );

}

$plugins->add_hook("showthread_start", "codebuttons");     

function codebuttons () {

    global $codebuttons;
	
    $codebuttons = build_mycode_inserter();
}

?>

2 - upload quickadveditor.php to root/inc/plugins and activate.



Without Smilies box and Without Quick Edit:

1 - Create quickadveditor.php in notepad++

<?php 
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
    die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

// Plugin info
function quickadveditor_info ()
{
    return array(
        "name"            => "Quick Advanced Editor",
        "description"    => "Advanced editor in quick reply",
        "website"        => "",
        "author"        => "martec",
        "authorsite"    => "",
        "version"        => "1.2",
        "guid"             => "",
        "compatibility" => "17*,18*"
    );
}

function quickadveditor_activate()
{
    include_once MYBB_ROOT.'inc/adminfunctions_templates.php';

    find_replace_templatesets(
        'showthread_quickreply',
        '#' . preg_quote('</textarea>') . '#i',
        '</textarea>{$codebuttons}'
    );

    find_replace_templatesets(
        'codebuttons',
        '#' . preg_quote('plugins: "bbcode",') . '#i',
        'plugins: "bbcode",
	height: 270,'
    );

    find_replace_templatesets(
        'codebuttons',
        '#' . preg_quote('});
</script>') . '#i',
        '});
  
/**********************************
 * Thread compatibility functions *
 **********************************/
if(typeof Thread !== \'undefined\')
{
    var quickReplyFunc = Thread.quickReply;
    Thread.quickReply = function(e) {

        if(MyBBEditor) {
            MyBBEditor.updateOriginal();
			$(\'form[id*="quick_reply_form"]\').bind(\'reset\', function() {
				MyBBEditor.val(\'\').emoticons(true);
			});
		}
		
        return quickReplyFunc.call(this, e);		
	};
};
</script>'
    );	

}

function quickadveditor_deactivate()
{
    include_once MYBB_ROOT."inc/adminfunctions_templates.php";

    find_replace_templatesets(
        'showthread_quickreply',
        '#' . preg_quote('</textarea>{$codebuttons}') . '#i',
        '</textarea>'
    );

    find_replace_templatesets(
        'codebuttons',
        '#' . preg_quote('plugins: "bbcode",
	height: 270,') . '#i',
        'plugins: "bbcode",'
    );

    find_replace_templatesets(
        'codebuttons',
        '#' . preg_quote('});
  
/**********************************
 * Thread compatibility functions *
 **********************************/
if(typeof Thread !== \'undefined\')
{
    var quickReplyFunc = Thread.quickReply;
    Thread.quickReply = function(e) {

        if(MyBBEditor) {
            MyBBEditor.updateOriginal();
			$(\'form[id*="quick_reply_form"]\').bind(\'reset\', function() {
				MyBBEditor.val(\'\').emoticons(true);
			});
		}
		
        return quickReplyFunc.call(this, e);		
	};
};
</script>') . '#i',
        '});
</script>'
    );

}

$plugins->add_hook("showthread_start", "codebuttons");     

function codebuttons () {

    global $codebuttons;
	
    $codebuttons = build_mycode_inserter();
}

?>

2 - upload quickadveditor.php to root/inc/plugins and activate.
Amazing!

Thanks for this!
Thanks
Thanks... maybe it would be better to create a plugin for mybb 1.8 (stable) for unskilled users.
(2014-07-13, 09:29 PM)Eldenroot Wrote: [ -> ]Thanks... maybe it would be better to create a plugin for mybb 1.8 (stable) for unskilled users.

this is practically a plugin and i will reduce steps here...
not worry...
@martec - no problem, but I think this should be in core - I dont know why mybb team doenst wanna this with enable/disable settings... every other board soft has it inside
@Eldenroot

I do not understand why you're worried about it.
Are simple modifications.
You should worry about how to add new buttons (ex: spoiler button) that is very complicated for people not familiar with sceditor .. http://community.mybb.com/thread-155941.html
(2014-07-14, 08:52 AM)Eldenroot Wrote: [ -> ]@martec - no problem, but I think this should be in core - I dont know why mybb team doenst wanna this with enable/disable settings... every other board soft has it inside

Quick Reply means quick reply. It doesn't mean full editor.
(2014-07-16, 08:21 AM)dragonexpert Wrote: [ -> ]Quick Reply means quick reply. It doesn't mean full editor.
+1

i dont understand why we need the editor if we want to post a "quick reply"... the idea of quick reply spoils there, and its no more a quick reply... if we need editor we have to use the "new reply" button.... if quick reply includes editor, then the newreply page would become unnecessary....
(2014-07-13, 09:29 PM)Eldenroot Wrote: [ -> ]Thanks... maybe it would be better to create a plugin for mybb 1.8 (stable) for unskilled users.

now 100% plugin...
not need any edit...
Pages: 1 2