Skip to content

Instantly share code, notes, and snippets.

@brunoais
Created April 24, 2015 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brunoais/86433b0cbd19abffa76d to your computer and use it in GitHub Desktop.
Save brunoais/86433b0cbd19abffa76d to your computer and use it in GitHub Desktop.
(function($, window, document, undefined) { // Avoid conflicts with other libraries
var xslt = xslt('{{xslt}}');
{% for bbcode in BBCODES}
$.sceditor.plugins.bbcode.bbcode.set('{{bbcode.name}}',
{
tags: {
{% for containerTag in bbcode.containerTags}
'{{containerTag}}': {
'data-tag-id': "{{bbcode.tagId}}"
}
{% endfor %}
},
// TODO: This needs improvement as it might simply not be true
isInline: {% for containerTag in bbcode.containerTags} editor.getElementDefaultDisplay('{{containerTag}}') !== 'block' && {% endfor %}true,
{% if bbcode.data.autoCloseOn}
excludeClosing: true,
{% endif %}
{% if (not bbcode.data.useContent is empty and
(bbcode.data.autoClose is empty or
(bbcode.data.ignoreBBCodeInside is empty and bbcode.data.ignoreTextInside is empty)
)
)
}
excludeClosing: true,
{% elseif not (bbcode.data.ignoreBBCodeInside is empty) %}
allowedChildren: ['#'],
{% elseif not (bbcode.data.allowedChildren is empty) %}
allowedChildren: ['
{%- if bbcode.data.ignoreTextInside -%}
{{- "#','"-}}
{%- endif -%}
{{- bbcode.data.allowedChildren|join("','") -}}
'],
{% endif %}
}
{% endfor %}
})(jQuery, window, document); // Avoid conflicts with other libraries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment