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

html-to-content-model

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-to-content-model - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

lib/Constants.js

22

lib/transform.js

@@ -10,6 +10,2 @@ 'use strict';

var _draftJs = require('draft-js');
var _draftJsImportHtml = require('draft-js-import-html');
var _getEntityNodes = require('./getEntityNodes');

@@ -23,5 +19,10 @@

var _modelFromElement2 = require('./modelFromElement');
var _modelFromElement3 = _interopRequireDefault(_modelFromElement2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var DEFAULT_OPTIONS = {};
var EMPTY_KEYS = [];

@@ -63,9 +64,10 @@ function normalizeEntity(entity) {

// eslint-disable-line no-unused-vars
var element = (0, _parseHTML2.default)(html);
var _convertToRaw = (0, _draftJs.convertToRaw)((0, _draftJsImportHtml.stateFromHTML)(html, { parser: _parseHTML2.default })),
entityMap = _convertToRaw.entityMap,
blocks = _convertToRaw.blocks;
var _modelFromElement = (0, _modelFromElement3.default)(element),
entityMap = _modelFromElement.entityMap,
blocks = _modelFromElement.blocks;
var normalizedEntityMap = void 0;
var entityMapKeys = Object.keys(entityMap);
var entityMapKeys = entityMap ? Object.keys(entityMap) : EMPTY_KEYS;
if (entityMapKeys.length !== 0) {

@@ -81,3 +83,5 @@ normalizedEntityMap = {};

normalizedEntityMap[_key] = normalizeEntity(entityMap[_key]);
// This is to make Flow happy.
var numericKey = Number(_key);
normalizedEntityMap[_key] = normalizeEntity(entityMap[numericKey]);
}

@@ -84,0 +88,0 @@ } catch (err) {

{
"name": "html-to-content-model",
"version": "0.1.1",
"version": "0.2.0",
"description": "html-to-content-model",

@@ -15,6 +15,5 @@ "main": "lib/main.js",

"dependencies": {
"draft-js": "^0.9.1",
"draft-js-import-html": "^0.3.1",
"parse5": "^2.2.3",
"synthetic-dom": "^0.2.0"
"stream": "0.0.2",
"synthetic-dom": "^0.2.1"
},

@@ -36,6 +35,2 @@ "devDependencies": {

},
"peerDependencies": {
"react": "^0.14.0 || ^15.0.0",
"react-dom": "^0.14.0 || ^15.0.0"
},
"keywords": [],

@@ -42,0 +37,0 @@ "author": "devteam@kodefox.com",

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