MyBB Community Forums

Full Version: [1.8] Quick Advanced Editor (Show 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
(2014-09-23, 06:34 AM)Omar G. Wrote: [ -> ]@martec can you provide minified code (template code) that simply loads the editor as soon as the page is loaded? Removing as much JS as possible.

I have this:


So I want to remove unnecessary code (smiles box, load on focus, etc).

@Omar G. check this http://community.mybb.com/thread-155797.html
you can use Without Smilies box and with Quick Edit or Without Smilies box and Without Quick Edit of 1.2 version
but if you will use 1.2, you need unistall 4.0 completely....
The plugin works fine for me, I just want to remove unnecessary JS code from the template if possible.

If not, it is fine as it is.
(2014-09-24, 06:28 AM)Omar G. Wrote: [ -> ]The plugin works fine for me, I just want to remove unnecessary JS code from the template if possible.

If not, it is fine as it is.

???
link above exactly what are you looking for...

anyway...
in codebutquick

replace all code with (Ps. Not tested):


<link rel="stylesheet" href="{$mybb->asset_url}/jscripts/sceditor/editor_themes/{$theme['editortheme']}" type="text/css" media="all" />
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/sceditor/jquery.sceditor.bbcode.min.js"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/bbcodes_sceditor.js"></script>
<script type="text/javascript">
if($('#clickable_smilies').length) {
	$('#clickable_smilies').closest('div').hide();
}
var partialmode = {$mybb->settings['partialmode']},
opt_editor = {
	plugins: "bbcode",
	height: 270,
	style: "{$mybb->asset_url}/jscripts/sceditor/jquery.sceditor.mybb.css",
	rtl: {$lang->settings['rtl']},
	locale: "mybblang",
	emoticonsEnabled: {$emoticons_enabled},
	emoticons: {
		// Emoticons to be included in the dropdown
		dropdown: {
			{$dropdownsmilies}
		},
		// Emoticons to be included in the more section
		more: {
			{$moresmilies}
		},
		// Emoticons that are not shown in the dropdown but will still be converted. Can be used for things like aliases
		hidden: {
			{$hiddensmilies}
		}
	},
	emoticonsCompat: true,
	toolbar: "{$basic1}{$align}{$font}{$size}{$color}{$removeformat}{$basic2}image,{$email}{$link}|video{$emoticon}|{$list}{$code}quote|maximize,source",
};
{$editor_language}

if({$mybb->settings['quickadveditor_qedit']}!=0) {
	($.fn.on || $.fn.live).call($(document), 'focus', 'textarea[name*="value"]', function () {
		$(this).sceditor(opt_editor);
		setTimeout(function() {
			if ($('textarea[name*="value"]').sceditor('instance')) {
				$('textarea[name*="value"]').sceditor('instance').focus();
			}
			offset = $('textarea[name*="value"]').next().offset().top - 60;
			setTimeout(function() {
				$('html, body').animate({
					scrollTop: offset
				}, 700);
			},200);
		},100);
		{$sourcemode}
	});
}

$(document).ready(function() {
	$('#message').sceditor(opt_editor);
	MyBBEditor = $('#message').sceditor('instance');
	{$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>
Even when I have the editor on source mod, when I click Quick Edit it appears on full mode.
codebutquick is not being cached in show thread pages BTW.
(2014-09-27, 06:49 AM)Omar G. Wrote: [ -> ]Even when I have the editor on source mod, when I click Quick Edit it appears on full mode.

replace with code below...

<link rel="stylesheet" href="{$mybb->asset_url}/jscripts/sceditor/editor_themes/{$theme['editortheme']}" type="text/css" media="all" />
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/sceditor/jquery.sceditor.bbcode.min.js"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/bbcodes_sceditor.js"></script>
<script type="text/javascript">
if($('#clickable_smilies').length) {
    $('#clickable_smilies').closest('div').hide();
}
var partialmode = {$mybb->settings['partialmode']},
opt_editor = {
    plugins: "bbcode",
    height: 270,
    style: "{$mybb->asset_url}/jscripts/sceditor/jquery.sceditor.mybb.css",
    rtl: {$lang->settings['rtl']},
    locale: "mybblang",
    emoticonsEnabled: {$emoticons_enabled},
    emoticons: {
        // Emoticons to be included in the dropdown
        dropdown: {
            {$dropdownsmilies}
        },
        // Emoticons to be included in the more section
        more: {
            {$moresmilies}
        },
        // Emoticons that are not shown in the dropdown but will still be converted. Can be used for things like aliases
        hidden: {
            {$hiddensmilies}
        }
    },
    emoticonsCompat: true,
    toolbar: "{$basic1}{$align}{$font}{$size}{$color}{$removeformat}{$basic2}image,{$email}{$link}|video{$emoticon}|{$list}{$code}quote|maximize,source",
};
{$editor_language}

if({$mybb->settings['quickadveditor_qedit']}!=0) {
    ($.fn.on || $.fn.live).call($(document), 'focus', 'textarea[name*="value"]', function () {
        $(this).sceditor(opt_editor);
        setTimeout(function() {
            if ($('textarea[name*="value"]').sceditor('instance')) {
                $('textarea[name*="value"]').sceditor('instance').focus();
            }
            offset = $('textarea[name*="value"]').next().offset().top - 60;
            setTimeout(function() {
                $('html, body').animate({
                    scrollTop: offset
                }, 700);
            },200);
        },100);
        if('{$sourcemode}' != '') {
            $('textarea[name*="value"]').sceditor('instance').sourceMode();
        }
    });
}

$(document).ready(function() {
    $('#message').sceditor(opt_editor);
    MyBBEditor = $('#message').sceditor('instance');
    {$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>


(2014-09-28, 04:57 PM)Omar G. Wrote: [ -> ]codebutquick is not being cached in show thread pages BTW.

you're right

add somthing this in plugin

$plugins->add_hook('global_start', 'advedt_cache_codebutquick');
function advedt_cache_codebutquick()
{
    global $templatelist;

    if (isset($templatelist)) {
        $templatelist .= ',';
    }

    if (THIS_SCRIPT == 'showthread.php') {
        $templatelist .= 'codebutquick';
    }
}

Omar G. plz you could close this thread?
because has another one here http://community.mybb.com/thread-158367.html

5.1.0 released. Solved template cache issue. Thanks @Omar G.
As per requested, please follow up the release thread instead of seeking for help in here.
http://community.mybb.com/thread-158367.html
Pages: 1 2