Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mobiledoc-dom-renderer

Package Overview
Dependencies
Maintainers
2
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mobiledoc-dom-renderer - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

29

dist/amd/mobiledoc-dom-renderer.js

@@ -88,7 +88,12 @@ define('mobiledoc-dom-renderer/dom-renderer', ['exports'], function (exports) {

var rendered = undefined;
switch (type) {
case 1:
var rendered = this.renderParagraphSection(section);
rendered = this.renderMarkupSection(section);
utils.appendChild(this.root, rendered);
break;
case 2:
rendered = this.renderImageSection(section);
utils.appendChild(this.root, rendered);
break;
default:

@@ -99,10 +104,22 @@ throw new Error('Unimplement renderer for type ' + type);

}, {
key: 'renderParagraphSection',
value: function renderParagraphSection(_ref3) {
var _ref32 = _slicedToArray(_ref3, 3);
key: 'renderImageSection',
value: function renderImageSection(_ref3) {
var _ref32 = _slicedToArray(_ref3, 2);
var type = _ref32[0];
var tagName = _ref32[1];
var markers = _ref32[2];
var src = _ref32[1];
var element = utils.createElement('img');
element.src = src;
return element;
}
}, {
key: 'renderMarkupSection',
value: function renderMarkupSection(_ref4) {
var _ref42 = _slicedToArray(_ref4, 3);
var type = _ref42[0];
var tagName = _ref42[1];
var markers = _ref42[2];
var element = utils.createElement(tagName);

@@ -109,0 +126,0 @@ var elements = [element];

@@ -283,7 +283,12 @@ ;(function() {

var rendered = undefined;
switch (type) {
case 1:
var rendered = this.renderParagraphSection(section);
rendered = this.renderMarkupSection(section);
utils.appendChild(this.root, rendered);
break;
case 2:
rendered = this.renderImageSection(section);
utils.appendChild(this.root, rendered);
break;
default:

@@ -294,10 +299,22 @@ throw new Error('Unimplement renderer for type ' + type);

}, {
key: 'renderParagraphSection',
value: function renderParagraphSection(_ref3) {
var _ref32 = _slicedToArray(_ref3, 3);
key: 'renderImageSection',
value: function renderImageSection(_ref3) {
var _ref32 = _slicedToArray(_ref3, 2);
var type = _ref32[0];
var tagName = _ref32[1];
var markers = _ref32[2];
var src = _ref32[1];
var element = utils.createElement('img');
element.src = src;
return element;
}
}, {
key: 'renderMarkupSection',
value: function renderMarkupSection(_ref4) {
var _ref42 = _slicedToArray(_ref4, 3);
var type = _ref42[0];
var tagName = _ref42[1];
var markers = _ref42[2];
var element = utils.createElement(tagName);

@@ -304,0 +321,0 @@ var elements = [element];

@@ -92,2 +92,14 @@ module('JSHint - tests/jshint');

});
test('renders a mobiledoc with image section', function (assert) {
var url = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=';
var mobiledoc = [[], // markers
[// sections
[2, url]]];
var rendered = renderer.render(mobiledoc);
assert.equal(rendered.childNodes.length, 1, 'renders 1 section');
var sectionEl = rendered.childNodes[0];
assert.equal(sectionEl.src, url);
});
});

@@ -51,7 +51,12 @@ /**

const [type] = section;
let rendered;
switch (type) {
case 1:
let rendered = this.renderParagraphSection(section);
rendered = this.renderMarkupSection(section);
utils.appendChild(this.root, rendered);
break;
case 2:
rendered = this.renderImageSection(section);
utils.appendChild(this.root, rendered);
break;
default:

@@ -62,3 +67,9 @@ throw new Error('Unimplement renderer for type ' + type);

renderParagraphSection([type, tagName, markers]) {
renderImageSection([type, src]) {
let element = utils.createElement('img');
element.src = src;
return element;
}
renderMarkupSection([type, tagName, markers]) {
let element = utils.createElement(tagName);

@@ -65,0 +76,0 @@ let elements = [element];

{
"name": "mobiledoc-dom-renderer",
"version": "0.1.3",
"version": "0.1.4",
"description": "Renders Mobiledoc input to DOM output",

@@ -5,0 +5,0 @@ "main": "dist/global/mobiledoc-dom-renderer.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc