Add themes support
Usage:
const editor = new RibbitEditor({
themes: [
{ name: 'dark', features: { sourceMode: false } },
{ name: 'minimal', tags: minimalTags },
],
currentTheme: 'dark',
});
The built-in theme is 'ribbit-default' and is always available.
Additional themes from the themes array are registered on top.
This commit is contained in:
@@ -13,10 +13,10 @@ global.HTMLElement = dom.window.HTMLElement;
|
||||
global.Node = dom.window.Node;
|
||||
|
||||
// Load the compiled bundle (attaches globals to window)
|
||||
const bundle = fs.readFileSync(path.join(__dirname, '..', 'dist', 'ribbit.js'), 'utf8');
|
||||
const bundle = fs.readFileSync(path.join(__dirname, '..', 'dist', 'ribbit', 'ribbit.js'), 'utf8');
|
||||
dom.window.eval(bundle);
|
||||
|
||||
const hopdown = dom.window.hopdown;
|
||||
const hopdown = new dom.window.HopDown();
|
||||
const H = hopdown.toHTML.bind(hopdown);
|
||||
const M = hopdown.toMarkdown.bind(hopdown);
|
||||
function rt(md) { return M(H(md)); }
|
||||
|
||||
Reference in New Issue
Block a user