MyBB Community Forums

Full Version: Some change in codebuttons template
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

possible change this codebottons template:

<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">
var partialmode = {$mybb->settings['partialmode']};
{$editor_language}
$(function() {
	$("#{$bind}").sceditor({
		plugins: "bbcode",
		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}
			}
		},
		emoticonsCompat: true,
        toolbar: "{$basic1}{$align}{$font}{$size}{$color}{$removeformat}{$basic2}image,{$email}{$link}|video{$emoticon}|{$list}{$code}quote|maximize,source",
	});

	MyBBEditor = $("#{$bind}").sceditor("instance");
	{$sourcemode}
});
</script>

to this:

<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">
var partialmode = {$mybb->settings['partialmode']},
opt_editor = {
        plugins: "bbcode",
        style: "{$mybb->asset_url}/jscripts/sceditor/jquery.sceditor.mybb.css?v=3.0",
        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}
            }
        },
        emoticonsCompat: true,
        toolbar: "{$basic1}{$align}{$font}{$size}{$color}{$removeformat}{$basic2}image,imgur,{$ema​il}{$link}|video{$emoticon}|{$list}{$code}quote|maximize,source",
};
{$editor_language}
$(function() {
	$("#{$bind}").sceditor(opt_editor);

	MyBBEditor = $("#{$bind}").sceditor("instance");
	{$sourcemode}
});
</script>

Reason for this is that it facilitates the addition of sceditor in quick edit...
with var "opt_editor" is more easy to add if anyone want to add sceditor in QuickEdit...

($.fn.on || $.fn.live).call($(document), 'focus', 'textarea[name*="value"]', function () {
    $(this).sceditor(opt_editor);

    MyBBEditor = $('textarea[name*="value"]').sceditor("instance");
    {$sourcemode}
});

Thanks
So administrators can do this without editing the core files? If so, sorry but I quite don't understand the point.
Good point - I think we should consider to add sceeditor bar into quick edit and quick reply. This should have own settings and should be disabled by default. Every other board have this feature in core... we can add setting into "Configuration -> Posting". Nothing difficult.

Many users wanna this feature, and it is not difficult to add
(2014-07-14, 06:11 AM)Omar G. Wrote: [ -> ]So administrators can do this without editing the core files? If so, sorry but I quite don't understand the point.

with change above is more easy create plugin or tutorial to add sceditor in quick edit..

with chage:

($.fn.on || $.fn.live).call($(document), 'focus', 'textarea[name*="value"]', function () {
    $(this).sceditor(opt_editor);

    MyBBEditor = $('textarea[name*="value"]').sceditor("instance");
    {$sourcemode}
});

without change:

($.fn.on || $.fn.live).call($(document), 'focus', 'textarea[name*="value"]', function () {
    $(this).sceditor({
        plugins: "bbcode",
        style: "{$mybb->asset_url}/jscripts/sceditor/jquery.sceditor.mybb.css?v=3.0",
        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}
            }
        },
        emoticonsCompat: true,
        toolbar: "{$basic1}{$align}{$font}{$size}{$color}{$removeformat}{$basic2}image,imgur,{$ema​il}{$link}|video{$emoticon}|{$list}{$code}quote|maximize,source",
};);

    MyBBEditor = $('textarea[name*="value"]').sceditor("instance");
    {$sourcemode}
});

(2014-07-14, 08:11 AM)Eldenroot Wrote: [ -> ]Good point - I think we should consider to add sceeditor bar into quick edit and quick reply. This should have own settings and should be disabled by default. Every other board have this feature in core... we can add setting into "Configuration -> Posting". Nothing difficult.

Many users wanna this feature, and it is not difficult to add

plz, not change subject.
I already said that mybb team reject to add sceditor in quick reply and quick edit
http://community.mybb.com/thread-154757.html

this is only small change in the template to facilitate the creation of tutorial or plugin.
As long as it works fine, I don't see anything against changing the code layout to a more efficient version. I think you can create a PR for front-end codebuttons and also back-end ACP (so it's consistent in both places).
Thank @Destroy666
I will make PR tomorrow...