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.6 to 0.1.8

38

dist/amd/mobiledoc-dom-renderer.js

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

*/
value: function render(mobiledoc) {
value: function render(_ref3) {
var _this = this;
var rootElement = arguments.length <= 1 || arguments[1] === undefined ? utils.createElement('div') : arguments[1];
var version = _ref3.version;
var sectionData = _ref3.sections;
var cards = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
var _mobiledoc = _slicedToArray(mobiledoc, 2);
var _sectionData = _slicedToArray(sectionData, 2);
var markerTypes = _mobiledoc[0];
var sections = _mobiledoc[1];
var markerTypes = _sectionData[0];
var sections = _sectionData[1];

@@ -111,7 +113,7 @@ this.root = rootElement;

key: 'renderImageSection',
value: function renderImageSection(_ref3) {
var _ref32 = _slicedToArray(_ref3, 2);
value: function renderImageSection(_ref4) {
var _ref42 = _slicedToArray(_ref4, 2);
var type = _ref32[0];
var src = _ref32[1];
var type = _ref42[0];
var src = _ref42[1];

@@ -124,8 +126,8 @@ var element = utils.createElement('img');

key: 'renderCardSection',
value: function renderCardSection(_ref4) {
var _ref42 = _slicedToArray(_ref4, 3);
value: function renderCardSection(_ref5) {
var _ref52 = _slicedToArray(_ref5, 3);
var type = _ref42[0];
var name = _ref42[1];
var payload = _ref42[2];
var type = _ref52[0];
var name = _ref52[1];
var payload = _ref52[2];

@@ -142,8 +144,8 @@ var card = this.cards[name];

key: 'renderMarkupSection',
value: function renderMarkupSection(_ref5) {
var _ref52 = _slicedToArray(_ref5, 3);
value: function renderMarkupSection(_ref6) {
var _ref62 = _slicedToArray(_ref6, 3);
var type = _ref52[0];
var tagName = _ref52[1];
var markers = _ref52[2];
var type = _ref62[0];
var tagName = _ref62[1];
var markers = _ref62[2];

@@ -150,0 +152,0 @@ var element = utils.createElement(tagName);

@@ -257,12 +257,14 @@ ;(function() {

*/
value: function render(mobiledoc) {
value: function render(_ref3) {
var _this = this;
var rootElement = arguments.length <= 1 || arguments[1] === undefined ? utils.createElement('div') : arguments[1];
var version = _ref3.version;
var sectionData = _ref3.sections;
var cards = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
var _mobiledoc = _slicedToArray(mobiledoc, 2);
var _sectionData = _slicedToArray(sectionData, 2);
var markerTypes = _mobiledoc[0];
var sections = _mobiledoc[1];
var markerTypes = _sectionData[0];
var sections = _sectionData[1];

@@ -306,7 +308,7 @@ this.root = rootElement;

key: 'renderImageSection',
value: function renderImageSection(_ref3) {
var _ref32 = _slicedToArray(_ref3, 2);
value: function renderImageSection(_ref4) {
var _ref42 = _slicedToArray(_ref4, 2);
var type = _ref32[0];
var src = _ref32[1];
var type = _ref42[0];
var src = _ref42[1];

@@ -319,8 +321,8 @@ var element = utils.createElement('img');

key: 'renderCardSection',
value: function renderCardSection(_ref4) {
var _ref42 = _slicedToArray(_ref4, 3);
value: function renderCardSection(_ref5) {
var _ref52 = _slicedToArray(_ref5, 3);
var type = _ref42[0];
var name = _ref42[1];
var payload = _ref42[2];
var type = _ref52[0];
var name = _ref52[1];
var payload = _ref52[2];

@@ -337,8 +339,8 @@ var card = this.cards[name];

key: 'renderMarkupSection',
value: function renderMarkupSection(_ref5) {
var _ref52 = _slicedToArray(_ref5, 3);
value: function renderMarkupSection(_ref6) {
var _ref62 = _slicedToArray(_ref6, 3);
var type = _ref52[0];
var tagName = _ref52[1];
var markers = _ref52[2];
var type = _ref62[0];
var tagName = _ref62[1];
var markers = _ref62[2];

@@ -345,0 +347,0 @@ var element = utils.createElement(tagName);

@@ -26,2 +26,4 @@ module('JSHint - tests/jshint');

var MOBILEDOC_VERSION = '0.1';
var renderer = undefined;

@@ -40,5 +42,8 @@ QUnit.module('Unit: Mobiledoc DOM Renderer', {

test('renders an empty mobiledoc', function (assert) {
var mobiledoc = [[], // markers
[] // sections
];
var mobiledoc = {
version: MOBILEDOC_VERSION,
sections: [[], // markers
[] // sections
]
};
var rendered = renderer.render(mobiledoc);

@@ -51,5 +56,8 @@

test('renders a mobiledoc without markers', function (assert) {
var mobiledoc = [[], // markers
[// sections
[1, 'P', [[[], 0, 'hello world']]]]];
var mobiledoc = {
version: MOBILEDOC_VERSION,
sections: [[], // markers
[// sections
[1, 'P', [[[], 0, 'hello world']]]]]
};
var rendered = renderer.render(mobiledoc);

@@ -62,5 +70,8 @@ assert.equal(rendered.childNodes.length, 1, 'renders 1 section');

test('renders a mobiledoc with simple (no attributes) marker', function (assert) {
var mobiledoc = [[// markers
['B']], [// sections
[1, 'P', [[[0], 1, 'hello world']]]]];
var mobiledoc = {
version: MOBILEDOC_VERSION,
sections: [[// markers
['B']], [// sections
[1, 'P', [[[0], 1, 'hello world']]]]]
};
var rendered = renderer.render(mobiledoc);

@@ -74,5 +85,8 @@ assert.equal(rendered.childNodes.length, 1, 'renders 1 section');

test('renders a mobiledoc with complex (has attributes) marker', function (assert) {
var mobiledoc = [[// markers
['A', ['href', 'http://google.com']]], [// sections
[1, 'P', [[[0], 1, 'hello world']]]]];
var mobiledoc = {
version: MOBILEDOC_VERSION,
sections: [[// markers
['A', ['href', 'http://google.com']]], [// sections
[1, 'P', [[[0], 1, 'hello world']]]]]
};
var rendered = renderer.render(mobiledoc);

@@ -86,9 +100,12 @@ assert.equal(rendered.childNodes.length, 1, 'renders 1 section');

test('renders a mobiledoc with multiple markups in a section', function (assert) {
var mobiledoc = [[// markers
['B'], ['I']], [// sections
[1, 'P', [[[0], 0, 'hello '], // b
[[1], 0, 'brave '], // b+i
[[], 1, 'new '], // close i
[[], 1, 'world'] // close b
]]]];
var mobiledoc = {
version: MOBILEDOC_VERSION,
sections: [[// markers
['B'], ['I']], [// sections
[1, 'P', [[[0], 0, 'hello '], // b
[[1], 0, 'brave '], // b+i
[[], 1, 'new '], // close i
[[], 1, 'world'] // close b
]]]]
};
var rendered = renderer.render(mobiledoc);

@@ -103,5 +120,8 @@ assert.equal(rendered.childNodes.length, 1, 'renders 1 section');

var url = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=';
var mobiledoc = [[], // markers
[// sections
[2, url]]];
var mobiledoc = {
versions: MOBILEDOC_VERSION,
sections: [[], // markers
[// sections
[2, url]]]
};
var rendered = renderer.render(mobiledoc);

@@ -129,5 +149,8 @@ assert.equal(rendered.childNodes.length, 1, 'renders 1 section');

};
var mobiledoc = [[], // markers
[// sections
[10, cardName, payload]]];
var mobiledoc = {
version: MOBILEDOC_VERSION,
sections: [[], // markers
[// sections
[10, cardName, payload]]]
};
var rendered = renderer.render(mobiledoc, document.createElement('div'), _defineProperty({}, cardName, TitleCard));

@@ -134,0 +157,0 @@ assert.equal(rendered.childNodes.length, 1, 'renders 1 section');

@@ -39,4 +39,4 @@ /**

*/
render(mobiledoc, rootElement=utils.createElement('div'), cards={}) {
const [markerTypes, sections] = mobiledoc;
render({version, sections: sectionData}, rootElement=utils.createElement('div'), cards={}) {
const [markerTypes, sections] = sectionData;
this.root = rootElement;

@@ -43,0 +43,0 @@ this.markerTypes = markerTypes;

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

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

@@ -1,2 +0,2 @@

# Mobiledoc DOM Renderer [![Build Status](https://travis-ci.org/bustlelabs/mobiledoc-dom-renderer.svg?branch=master)](https://travis-ci.org/bustlelabs/mobiledoc-dom-renderer)
## Mobiledoc DOM Renderer [![Build Status](https://travis-ci.org/bustlelabs/mobiledoc-dom-renderer.svg?branch=master)](https://travis-ci.org/bustlelabs/mobiledoc-dom-renderer)

@@ -8,3 +8,3 @@ This is a runtime renderer for the `mobiledoc` format.

## Usage
### Usage

@@ -34,4 +34,11 @@ ```

## Tests
### Tests
* `npm test`
### Releasing
* `npm version patch` or `minor` or `major`
* `npm run build`
* `git push bustle --tags`
* `npm publish`
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