mobiledoc-dom-renderer
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -39,6 +39,7 @@ /** | ||
*/ | ||
render(mobiledoc, rootElement=utils.createElement('div')) { | ||
render(mobiledoc, rootElement=utils.createElement('div'), cards={}) { | ||
const [markerTypes, sections] = mobiledoc; | ||
this.root = rootElement; | ||
this.markerTypes = markerTypes; | ||
this.cards = cards; | ||
@@ -62,2 +63,6 @@ sections.forEach((section) => this.renderSection(section)); | ||
break; | ||
case 10: | ||
rendered = this.renderCardSection(section); | ||
utils.appendChild(this.root, rendered); | ||
break; | ||
default: | ||
@@ -74,2 +79,12 @@ throw new Error('Unimplement renderer for type ' + type); | ||
renderCardSection([type, name, payload]) { | ||
let card = this.cards[name]; | ||
if (!card) { | ||
throw new Error(`Cannot render unknown card named ${name}`); | ||
} | ||
let element = utils.createElement('div'); | ||
card.display.setup(element, {}, {name}, payload); | ||
return element; | ||
} | ||
renderMarkupSection([type, tagName, markers]) { | ||
@@ -76,0 +91,0 @@ let element = utils.createElement(tagName); |
{ | ||
"name": "mobiledoc-dom-renderer", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "Renders Mobiledoc input to DOM output", | ||
@@ -5,0 +5,0 @@ "main": "dist/global/mobiledoc-dom-renderer.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
152245
4348