The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Add Code snippet to the editor

2 posters

Go down

Add Code snippet to the editor Empty Add Code snippet to the editor

Post by Zzbaivong February 23rd 2016, 6:06 am

Inspired by the code snippet in help forumotion, I wrote this script, but using font bbcode instead of the table bbcode. This will allow more flexible use, for example, copied bbcode to other forums not available to this script.


Add Code snippet to the editor Inline10

How to set up?

Go to Admin Panel > Modules > JavaScript codes management and create a new script with the following settings:
Title: Code snippet
Placement: In all the pages
jQuery(function($) {

    'use strict';

    $('head').append($('<style>', {
        text: '.sceditor-button-inline-code div{background-image:url(!important}.post-entry font[face="monospace"]{color:green;background:#f4f4f4;padding:0 5px;display:inline-block;margin:0 3px;border-radius:2px}'

    if (!$.sceditor) return;

    $(function() {
        $('#text_editor_textarea').sceditor('instance').css('font[face="monospace"]{color:green;background:#f4f4f4;padding:2px 5px;display:inline-block;margin:-2px 3px;border-radius:2px}');

    function inlineCode(editor) {
        editor.insert('[font=monospace]', '[/font]');

    $.sceditor.command.set('inline-code', {
        exec: function() {
        txtExec: function() {
        tooltip: 'Code snippet'

    toolbar = toolbar.replace(/code/, 'code,inline-code');

Save the script. Done.

Last edited by Zzbaivong on May 16th 2016, 9:46 am; edited 1 time in total

Posts : 101
Reputation : 51
Language : JavaScript ^^

Back to top Go down

Add Code snippet to the editor Empty Re: Add Code snippet to the editor

Post by Abdalah_98 May 16th 2016, 8:35 am

Not worked to me ?


Male Posts : 32
Reputation : 1
Language : EN,AR
Location : Earth :D

Back to top Go down

Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum