Tag <code> not triggered on different BBCode code name #871
Open
Description
It looks like another bug with the tag code :)
if we want to set for HTML tag <code>
two behavior it will not trigger format:
if it has a BBCode different from [code]
when we switch from WYSIWYG to Source mode.
Examle:
Override [code]
for triggering to a class
code = {
tags: {
// code: null,
code:
{
class: 'code-block',
},
},
isInline: false,
allowedChildren: ['#', '#newline'],
format: '[code]{0}[/code]',
html: '<code class="code-block">{0}</code>',
};
sceditor.formats.bbcode.set('code', code);
Add [codeinline]
codeInline = {
tags: {
code:
{
class: 'code-inline',
},
},
allowedChildren: ['#', '#newline'],
format: '[codeinline]{0}[/codeinline]', <--- this won't be triggered if we switch to source mode
html: '<code class="code-inline">{0}</code>'
};
sceditor.formats.bbcode.set('codeinline', codeInline);
If we do that with different BBcode, for example with [sub] it will work correctly.
Example with code and sub.
https://jsbin.com/yirolubile/1/edit?html,js,output