Resurrect the old alpha Koenig editor (#9277)
requires https://github.com/TryGhost/Ghost-Admin/pull/916 - add "enableDeveloperExperiments" config flag - allow any HTML payload through in the HTML mobiledoc card - same approach as taken in the markdown card, running the markup through SimpleDOM isn't necessary and is prone to breaking because of it's limited parsing and error handling abilities To use Koenig modify your `config.development.json` file and add the following flag to the top-level object: ``` "enableDeveloperExperiments": true ``` If you restart the dev server you will then see a new section on the Labs screen with a Koenig Editor checkbox to enable/disable the editor. ⚠️ The editor is in a _very_ broken state, it's there for developer testing and on-going development. _Do not_ try to use this on any production data!
This commit is contained in:
parent
357ea3dffd
commit
69d5fac61e
@ -30,7 +30,8 @@ function getBaseConfig() {
|
||||
blogUrl: urlService.utils.urlFor('home', true),
|
||||
blogTitle: settingsCache.get('title'),
|
||||
routeKeywords: config.get('routeKeywords'),
|
||||
clientExtensions: config.get('clientExtensions')
|
||||
clientExtensions: config.get('clientExtensions'),
|
||||
enableDeveloperExperiments: config.get('enableDeveloperExperiments')
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,15 @@
|
||||
var SimpleDom = require('simple-dom'),
|
||||
tokenizer = require('simple-html-tokenizer').tokenize,
|
||||
parser;
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
name: 'card-html',
|
||||
type: 'dom',
|
||||
render(opts) {
|
||||
parser = new SimpleDom.HTMLParser(tokenizer, opts.env.dom, SimpleDom.voidMap);
|
||||
return parser.parse('<div class="kg-card-html">' + opts.payload.html + '</div>');
|
||||
let html = `<div class="kg-card-html">${opts.payload.html}</div>`;
|
||||
|
||||
// use the SimpleDOM document to create a raw HTML section.
|
||||
// avoids parsing/rendering of potentially broken or unsupported HTML
|
||||
let element = opts.env.dom.createRawHTMLSection(html);
|
||||
|
||||
return element;
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user