html-to-content-model
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -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", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
31559
3
12
882
1
+ Addedstream@0.0.2
+ Addedemitter-component@1.1.2(transitive)
+ Addedstream@0.0.2(transitive)
- Removeddraft-js@^0.9.1
- Removeddraft-js-import-html@^0.3.1
- Removedasap@2.0.6(transitive)
- Removedcore-js@1.2.7(transitive)
- Removedcreate-react-class@15.7.0(transitive)
- Removeddraft-js@0.9.1(transitive)
- Removeddraft-js-import-element@0.4.3(transitive)
- Removeddraft-js-import-html@0.3.2(transitive)
- Removeddraft-js-utils@0.1.7(transitive)
- Removedencoding@0.1.13(transitive)
- Removedfbjs@0.8.18(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedimmutable@3.7.6(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisomorphic-fetch@2.2.1(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removednode-fetch@1.7.3(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedpromise@7.3.1(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedreact@15.7.0(transitive)
- Removedreact-dom@15.7.0(transitive)
- Removedreact-is@16.13.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsetimmediate@1.0.5(transitive)
- Removedua-parser-js@0.7.40(transitive)
- Removedwhatwg-fetch@3.6.20(transitive)
Updatedsynthetic-dom@^0.2.1