FEATURE: consistent bbcode inline and block rulers

This commit is contained in:
Sam
2017-06-23 11:36:45 -04:00
parent 234694b50f
commit 05e5a740a6
3 changed files with 76 additions and 20 deletions

View File

@ -26,11 +26,11 @@ function createHelper(featureName, opts, optionCallbacks, pluginCallbacks, getOp
// hack to allow moving of getOptions
helper.getOptions = () => getOptions.f();
helper.registerOptions = function(callback){
helper.registerOptions = (callback) => {
optionCallbacks.push([featureName, callback]);
};
helper.registerPlugin = function(callback){
helper.registerPlugin = (callback) => {
pluginCallbacks.push([featureName, callback]);
};
@ -57,6 +57,10 @@ function setupBlockBBCode(md) {
md.block.bbcode_ruler = new Ruler();
}
function setupInlineBBCode(md) {
md.inline.bbcode_ruler = new Ruler();
}
export function setup(opts, siteSettings, state) {
if (opts.setup) {
return;
@ -117,6 +121,7 @@ export function setup(opts, siteSettings, state) {
});
setupBlockBBCode(opts.engine);
setupInlineBBCode(opts.engine);
pluginCallbacks.forEach(([feature, callback])=>{
if (opts.discourse.features[feature]) {