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.3.4 to 0.3.5

28

lib/modelFromElement.js

@@ -92,2 +92,3 @@ Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();

var NO_STYLE=new Set();

@@ -302,3 +303,3 @@ var NO_ENTITY=null;

var hasDepth=canHaveDepth(type);
var allowRender=!_Constants.SPECIAL_ELEMENTS.hasOwnProperty(tagName);
var allowRender=!this.canHaveChildren(tagName);
var block={

@@ -343,2 +344,3 @@ tagName:tagName,

if(newEntity){
entity=newEntity;

@@ -353,3 +355,3 @@ this.entityMap[entity.key]=entity;

}
if(_Constants.ATOMIC_ELEMENTS.hasOwnProperty(tagName)){
if(this.isAtomic(tagName)){

@@ -406,2 +408,24 @@ this.processText('\xA0');

return false;
}},{key:'isAtomic',value:function isAtomic(
tagName){
if(_Constants.ATOMIC_ELEMENTS.hasOwnProperty(tagName)){
return true;
}var
customAtomicElements=this.options.customAtomicElements;
if(customAtomicElements&&customAtomicElements[tagName]===true){
return true;
}
return false;
}},{key:'canHaveChildren',value:function canHaveChildren(
tagName){
if(_Constants.SPECIAL_ELEMENTS.hasOwnProperty(tagName)){
return true;
}
if(this.isAtomic(tagName)){
return true;
}
return false;
}}]);return BlockGenerator;}();

@@ -408,0 +432,0 @@

9

lib/transform.js

@@ -34,2 +34,3 @@ Object.defineProperty(exports,"__esModule",{value:true});exports.

normalizeEntity=normalizeEntity;exports.

@@ -61,7 +62,5 @@

fromHTML=fromHTML;var _getEntityNodes=require('./getEntityNodes');var _getEntityNodes2=_interopRequireDefault(_getEntityNodes);var _parseHTML=require('./parseHTML');var _parseHTML2=_interopRequireDefault(_parseHTML);var _modelFromElement2=require('./modelFromElement');var _modelFromElement3=_interopRequireDefault(_modelFromElement2);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var DEFAULT_OPTIONS={};var EMPTY_KEYS=[];function normalizeEntity(entity){var type=entity.type,data=entity.data;return{type:type,data:data};}function normalizeBlock(block){var text=block.text,type=block.type,depth=block.depth,inlineStyleRanges=block.inlineStyleRanges,entityRanges=block.entityRanges,data=block.data;var result={type:type,entityNodes:(0,_getEntityNodes2.default)(text,entityRanges,inlineStyleRanges)};if(depth!==0){result.depth=depth;}if(!isEmptyObject(data)){result.data=data;}return result;}function isEmptyObject(object){return Object.keys(object).length===0;}function fromHTML(html){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:DEFAULT_OPTIONS;
var element=(0,_parseHTML2.default)(html);var _modelFromElement=
(0,_modelFromElement3.default)(element,{
customTagToEntityMap:options.customTagToEntityMap,
customInlineElements:options.customInlineElements}),entityMap=_modelFromElement.entityMap,blocks=_modelFromElement.blocks;
var element=(0,_parseHTML2.default)(html);var
customTagToEntityMap=options.customTagToEntityMap,customInlineElements=options.customInlineElements,customAtomicElements=options.customAtomicElements;var _modelFromElement=
(0,_modelFromElement3.default)(element,{customTagToEntityMap:customTagToEntityMap,customInlineElements:customInlineElements,customAtomicElements:customAtomicElements}),entityMap=_modelFromElement.entityMap,blocks=_modelFromElement.blocks;
var normalizedEntityMap=void 0;

@@ -68,0 +67,0 @@ var entityMapKeys=entityMap?Object.keys(entityMap):EMPTY_KEYS;

{
"name": "html-to-content-model",
"version": "0.3.4",
"version": "0.3.5",
"description": "html-to-content-model",

@@ -5,0 +5,0 @@ "main": "lib/main.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