Socket
Socket
Sign inDemoInstall

@sanity/block-content-to-html

Package Overview
Dependencies
Maintainers
7
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/block-content-to-html - npm Package Compare versions

Comparing version 0.2.0-next to 0.3.0

8

package.json
{
"name": "@sanity/block-content-to-html",
"description": "Customizable HTML parser for block editor output",
"version": "0.2.0-next",
"version": "0.3.0",
"main": "lib/index.js",
"umd": "umd/index.min.js",
"scripts": {
"browserify": "BROWSERIFY_ENV=build DEBUG='' browserify -t envify -g uglifyify lib/index.js -o umd/index.js --standalone=BlockContentToHtml",
"browserify": "NODE_ENV=production BROWSERIFY_ENV=build DEBUG='' browserify -t envify -g uglifyify lib/index.js -o umd/index.js --standalone=BlockContentAdapter",
"build": "npm run clean && npm run compile && npm run browserify && npm run minify && npm run size",

@@ -14,3 +14,3 @@ "size": "node -r babel-register src/scripts/print-bundle-size",

"compile": "babel --source-maps --copy-files -d lib/ src/",
"coverage": "nyc --reporter=html --reporter=lcov --reporter=text npm test",
"coverage": "DEBUG=sanity NODE_ENV=test nyc --reporter=html --reporter=lcov --reporter=text npm test",
"minify": "uglifyjs -c -m -- umd/index.js > umd/index.min.js",

@@ -26,3 +26,3 @@ "postpublish": "npm run clean",

"dependencies": {
"@sanity/block-content-to-tree": "^0.2.0-next",
"@sanity/block-content-to-tree": "^0.3.0",
"in-publish": "^2.0.0"

@@ -29,0 +29,0 @@ },

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

(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.BlockContentToHtml = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.BlockContentAdapter = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"use strict";function _classCallCheck(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function parseSingle(e,n){if(n[e.type])return n[e.type](e);throw new Error("Don't know how to handle type '"+e.type+"'")}var _extends=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},_createClass=function(){function e(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(n,t,r){return t&&e(n.prototype,t),r&&e(n,r),n}}(),BlockContentToTree=require("@sanity/block-content-to-tree"),builtInHandlers=require("./type-handlers"),_escapeHtml=require("./escapeHtml"),blockContentToTree=new BlockContentToTree,BlockContentToHtml=function(){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};_classCallCheck(this,e);var t=n.customTypeHandlers||{};this.typeHandlers=_extends({},builtInHandlers(n.blockTypeHandlers||{}),t)}return _createClass(e,null,[{key:"escapeHtml",value:function(e){return _escapeHtml(e)}}]),_createClass(e,[{key:"convert",value:function(e){var n=this,t=blockContentToTree.convert(e);return Array.isArray(t)?t.map(function(e){return parseSingle(e,n.typeHandlers)}).join("\n"):parseSingle(t,this.typeHandlers)}}]),e}();module.exports=BlockContentToHtml;

@@ -26,3 +26,3 @@

},{"./BlockContentToTree":5}],9:[function(require,module,exports){
"use strict";function migrate(e,r){if("block"===e._type)return migrateBlock(e,r);if(Array.isArray(e))return e.map(function(e){return migrateBlock(e,r)});throw new Error("Unrecognized block structure passed to migrate()")}function migrateBlock(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e.spans)return e;var t=[],n=e.spans.map(function(e){return Object.keys(e).reduce(function(n,s){if(knownSpanKeys.includes(s))return n[s]=e[s],n;var a=generateKey(e[s],r);return n.marks=[a].concat(e.marks),t.push(objectAssign({},e[s],{_type:s,_key:a})),n},{})}),s=objectAssign({},e,{children:n,markDefs:t});return delete s.spans,s}var objectAssign=require("object-assign"),generateKey=require("./generateKey"),knownSpanKeys=["_type","text","marks"];module.exports=migrate;
"use strict";function migrate(e,r){if("block"===e._type)return migrateBlock(e,r);if(Array.isArray(e))return e.map(function(e){return migrateBlock(e,r)});throw new Error("Unrecognized block structure passed to migrate()")}function migrateBlock(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e.spans)return e;var t=[],n=e.spans.map(function(e){return Object.keys(e).reduce(function(n,s){if("marks"===s)return n;if(knownSpanKeys.includes(s))return n[s]=e[s],n;if(!(Object.keys(e[s]).length>0))return n;var a=generateKey(e[s],r);return n.marks=[a].concat(e.marks),t.push(objectAssign({},e[s],{_type:s,_key:a})),n},{marks:e.marks||[]})}),s=objectAssign({},e,{children:n,markDefs:t});return delete s.spans,s}var objectAssign=require("object-assign"),generateKey=require("./generateKey"),knownSpanKeys=["_type","_key","text"];module.exports=migrate;

@@ -29,0 +29,0 @@ },{"./generateKey":7,"object-assign":12}],10:[function(require,module,exports){

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

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).BlockContentToHtml=e()}}(function(){return function e(t,r,n){function i(c,a){if(!r[c]){if(!t[c]){var s="function"==typeof require&&require;if(!a&&s)return s(c,!0);if(o)return o(c,!0);var u=new Error("Cannot find module '"+c+"'");throw u.code="MODULE_NOT_FOUND",u}var l=r[c]={exports:{}};t[c][0].call(l.exports,function(e){var r=t[c][1][e];return i(r||e)},l,l.exports,e,t,r,n)}return r[c].exports}for(var o="function"==typeof require&&require,c=0;c<n.length;c++)i(n[c]);return i}({1:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(t[e.type])return t[e.type](e);throw new Error("Don't know how to handle type '"+e.type+"'")}var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=e("@sanity/block-content-to-tree"),s=e("./type-handlers"),u=e("./escapeHtml"),l=new a,f=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n(this,e);var r=t.customTypeHandlers||{};this.typeHandlers=o({},s(t.blockTypeHandlers||{}),r)}return c(e,null,[{key:"escapeHtml",value:function(e){return u(e)}}]),c(e,[{key:"convert",value:function(e){var t=this,r=l.convert(e);return Array.isArray(r)?r.map(function(e){return i(e,t.typeHandlers)}).join("\n"):i(r,this.typeHandlers)}}]),e}();t.exports=f},{"./escapeHtml":2,"./type-handlers":4,"@sanity/block-content-to-tree":8}],2:[function(e,t,r){"use strict";t.exports=function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/\//g,"&#x2F;")}},{}],3:[function(e,t,r){"use strict";t.exports=e("./BlockContentToHtml")},{"./BlockContentToHtml":1}],4:[function(e,t,r){"use strict";function n(e,t){if("string"==typeof e)return e;var r="";return e.forEach(function(e){if("string"==typeof e)r+=a(e);else{var n=t[e.type]||t.text;r+=n(e)}}),r}function i(e,t,r){var n="";return e.forEach(function(e){if("string"==typeof e)n+=a(e);else{var i=r[e.type]||r.textBlock;e.children=i(e),n+=t.listItem(e)}}),n}function o(e,t){return t&&void 0!==t[e]?t[e]:e}var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=e("./escapeHtml");t.exports=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=c({normal:function(e){return"<p>"+e.children+"</p>"}},e.textBlock||{}),r=c({number:function(e){return"<ol>"+e.children+"</ol>"},bullet:function(e){return"<ul>"+e.children+"</ul>"},listItem:function(e){return"<li>"+e.children+"</li>"}},e.listBlock||{}),a={block:function(e){return t[e.style]?(e.children=n(e.children,a),t[e.style](e)):"<"+e.style+">"+n(e.children,a)+"</"+e.style+">"},list:function(e){return r[e.itemStyle]?(e.children=i(e.items,r,a),r[e.itemStyle](e)):"<ul>"+i(e.items,r,a)+"</ul>"},span:function(t){var r="",i="",c=t.mark&&o(t.mark,e.marks);return"string"==typeof c&&(r+=c?"<"+c+">":"",i=c?"</"+c+">":""),t.children=n(t.children,a),e.span?""+r+e.span(t)+i:(c&&"link"===c._type&&(r+='<a href="'+c.href+'">',i="</a>"+i),""+r+n(t.children,a)+i)}};return a}},{"./escapeHtml":2}],5:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){return t.list(e)}function o(e,t){var r=e._type,n=t[r];if(!n){var i=a({},e);return delete i._type,{type:r,attributes:i}}return n(e)}var c=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=e("object-assign"),s=e("./migrate"),u=e("./type-handlers"),l=e("./type-checkers").isList,f=function(){function e(t){n(this,e),this.typeHandlers=u,this.options=a({staticKeys:!0},t)}return c(e,[{key:"convert",value:function(e){var t=this;if(!(Array.isArray(e)||e&&e._type))throw new Error("Input must be an Array or an Object (with a ._type) - got "+e);var r=s(e,this.options);if(Array.isArray(r)){var n=[],c=[];return r.forEach(function(e,r,a){if(l(e)){if(c.push(e),(a[r+1]||{}).listItem!==e.listItem){var s=Array.from(c);c=[],n.push(i(s,t.typeHandlers))}}else n.push(o(e,t.typeHandlers))}),n}return o(r,this.typeHandlers)}}]),e}();t.exports=f},{"./migrate":9,"./type-checkers":10,"./type-handlers":11,"object-assign":12}],6:[function(e,t,r){"use strict";var n=e("object-assign");t.exports=function(e,t){var r={children:[]},i=[r];return e.forEach(function(e){var r=n({},e);delete r.text,delete r.marks,delete r._type;var o=e.marks.sort(),c=1;if(i.length>1)for(c;c<i.length;c++){var a=i[c].markKey;if(!o.includes(a))break;var s=o.indexOf(a);o.splice(s,1)}var u=(i=i.slice(0,c)).slice(-1)[0];o.forEach(function(e){var r={type:"span",children:[],mark:t.markDefs.find(function(t){return t._key===e})||e,markKey:e};u.children.push(r),i.push(r),u=r}),Object.keys(r).length?u.children.push({type:"span",attributes:r,children:[e.text]}):u.children.push(e.text)}),r.children}},{"object-assign":12}],7:[function(e,t,r){"use strict";function n(e){return o(JSON.stringify(e)).toString(36).replace(/[^A-Za-z0-9]/g,"")}function i(e,t){return Math.random().toString(36).slice(2,t+2)}function o(e){var t=0,r=e.length;if(0===r)return t;for(var n=0;n<r;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return t}t.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.length||8;return t.staticKeys?n(e):i(0,r)}},{}],8:[function(e,t,r){"use strict";t.exports=e("./BlockContentToTree")},{"./BlockContentToTree":5}],9:[function(e,t,r){"use strict";function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e.spans)return e;var r=[],n=e.spans.map(function(e){return Object.keys(e).reduce(function(n,a){if(c.includes(a))return n[a]=e[a],n;var s=o(e[a],t);return n.marks=[s].concat(e.marks),r.push(i({},e[a],{_type:a,_key:s})),n},{})}),a=i({},e,{children:n,markDefs:r});return delete a.spans,a}var i=e("object-assign"),o=e("./generateKey"),c=["_type","text","marks"];t.exports=function(e,t){if("block"===e._type)return n(e,t);if(Array.isArray(e))return e.map(function(e){return n(e,t)});throw new Error("Unrecognized block structure passed to migrate()")}},{"./generateKey":7,"object-assign":12}],10:[function(e,t,r){"use strict";function n(e){var t=e._type,r=e.listItem;return"block"===t&&!!r}function i(e){return"block"===e._type&&!n(e)}t.exports={isList:n,isText:i,getInternalBlockType:function(e){return i(e)?"text":n(e)?"list":"custom"}}},{}],11:[function(e,t,r){"use strict";var n=e("./ContentNester");t.exports={block:function(e){var t={type:"block",style:e.style,children:n(e.children,e)};return e.extra&&(t.extra=e.extra),t},list:function(e){return{type:"list",itemStyle:e[0].listItem,items:e.map(function(e){var t={type:"block",style:e.style,children:n(e.children,e)};return e.extra&&(t.extra=e.extra),t})}}}},{"./ContentNester":6}],12:[function(e,t,r){"use strict";function n(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var i=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,a,s=n(e),u=1;u<arguments.length;u++){r=Object(arguments[u]);for(var l in r)o.call(r,l)&&(s[l]=r[l]);if(i){a=i(r);for(var f=0;f<a.length;f++)c.call(r,a[f])&&(s[a[f]]=r[a[f]])}}return s}},{}]},{},[3])(3)});
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).BlockContentAdapter=e()}}(function(){return function e(t,r,n){function i(c,a){if(!r[c]){if(!t[c]){var s="function"==typeof require&&require;if(!a&&s)return s(c,!0);if(o)return o(c,!0);var u=new Error("Cannot find module '"+c+"'");throw u.code="MODULE_NOT_FOUND",u}var l=r[c]={exports:{}};t[c][0].call(l.exports,function(e){var r=t[c][1][e];return i(r||e)},l,l.exports,e,t,r,n)}return r[c].exports}for(var o="function"==typeof require&&require,c=0;c<n.length;c++)i(n[c]);return i}({1:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(t[e.type])return t[e.type](e);throw new Error("Don't know how to handle type '"+e.type+"'")}var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=e("@sanity/block-content-to-tree"),s=e("./type-handlers"),u=e("./escapeHtml"),l=new a,f=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n(this,e);var r=t.customTypeHandlers||{};this.typeHandlers=o({},s(t.blockTypeHandlers||{}),r)}return c(e,null,[{key:"escapeHtml",value:function(e){return u(e)}}]),c(e,[{key:"convert",value:function(e){var t=this,r=l.convert(e);return Array.isArray(r)?r.map(function(e){return i(e,t.typeHandlers)}).join("\n"):i(r,this.typeHandlers)}}]),e}();t.exports=f},{"./escapeHtml":2,"./type-handlers":4,"@sanity/block-content-to-tree":8}],2:[function(e,t,r){"use strict";t.exports=function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/\//g,"&#x2F;")}},{}],3:[function(e,t,r){"use strict";t.exports=e("./BlockContentToHtml")},{"./BlockContentToHtml":1}],4:[function(e,t,r){"use strict";function n(e,t){if("string"==typeof e)return e;var r="";return e.forEach(function(e){if("string"==typeof e)r+=a(e);else{var n=t[e.type]||t.text;r+=n(e)}}),r}function i(e,t,r){var n="";return e.forEach(function(e){if("string"==typeof e)n+=a(e);else{var i=r[e.type]||r.textBlock;e.children=i(e),n+=t.listItem(e)}}),n}function o(e,t){return t&&void 0!==t[e]?t[e]:e}var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=e("./escapeHtml");t.exports=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=c({normal:function(e){return"<p>"+e.children+"</p>"}},e.textBlock||{}),r=c({number:function(e){return"<ol>"+e.children+"</ol>"},bullet:function(e){return"<ul>"+e.children+"</ul>"},listItem:function(e){return"<li>"+e.children+"</li>"}},e.listBlock||{}),a={block:function(e){return t[e.style]?(e.children=n(e.children,a),t[e.style](e)):"<"+e.style+">"+n(e.children,a)+"</"+e.style+">"},list:function(e){return r[e.itemStyle]?(e.children=i(e.items,r,a),r[e.itemStyle](e)):"<ul>"+i(e.items,r,a)+"</ul>"},span:function(t){var r="",i="",c=t.mark&&o(t.mark,e.marks);return"string"==typeof c&&(r+=c?"<"+c+">":"",i=c?"</"+c+">":""),t.children=n(t.children,a),e.span?""+r+e.span(t)+i:(c&&"link"===c._type&&(r+='<a href="'+c.href+'">',i="</a>"+i),""+r+n(t.children,a)+i)}};return a}},{"./escapeHtml":2}],5:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){return t.list(e)}function o(e,t){var r=e._type,n=t[r];if(!n){var i=a({},e);return delete i._type,{type:r,attributes:i}}return n(e)}var c=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=e("object-assign"),s=e("./migrate"),u=e("./type-handlers"),l=e("./type-checkers").isList,f=function(){function e(t){n(this,e),this.typeHandlers=u,this.options=a({staticKeys:!0},t)}return c(e,[{key:"convert",value:function(e){var t=this;if(!(Array.isArray(e)||e&&e._type))throw new Error("Input must be an Array or an Object (with a ._type) - got "+e);var r=s(e,this.options);if(Array.isArray(r)){var n=[],c=[];return r.forEach(function(e,r,a){if(l(e)){if(c.push(e),(a[r+1]||{}).listItem!==e.listItem){var s=Array.from(c);c=[],n.push(i(s,t.typeHandlers))}}else n.push(o(e,t.typeHandlers))}),n}return o(r,this.typeHandlers)}}]),e}();t.exports=f},{"./migrate":9,"./type-checkers":10,"./type-handlers":11,"object-assign":12}],6:[function(e,t,r){"use strict";var n=e("object-assign");t.exports=function(e,t){var r={children:[]},i=[r];return e.forEach(function(e){var r=n({},e);delete r.text,delete r.marks,delete r._type;var o=e.marks.sort(),c=1;if(i.length>1)for(c;c<i.length;c++){var a=i[c].markKey;if(!o.includes(a))break;var s=o.indexOf(a);o.splice(s,1)}var u=(i=i.slice(0,c)).slice(-1)[0];o.forEach(function(e){var r={type:"span",children:[],mark:t.markDefs.find(function(t){return t._key===e})||e,markKey:e};u.children.push(r),i.push(r),u=r}),Object.keys(r).length?u.children.push({type:"span",attributes:r,children:[e.text]}):u.children.push(e.text)}),r.children}},{"object-assign":12}],7:[function(e,t,r){"use strict";function n(e){return o(JSON.stringify(e)).toString(36).replace(/[^A-Za-z0-9]/g,"")}function i(e,t){return Math.random().toString(36).slice(2,t+2)}function o(e){var t=0,r=e.length;if(0===r)return t;for(var n=0;n<r;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return t}t.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.length||8;return t.staticKeys?n(e):i(0,r)}},{}],8:[function(e,t,r){"use strict";t.exports=e("./BlockContentToTree")},{"./BlockContentToTree":5}],9:[function(e,t,r){"use strict";function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e.spans)return e;var r=[],n=e.spans.map(function(e){return Object.keys(e).reduce(function(n,a){if("marks"===a)return n;if(c.includes(a))return n[a]=e[a],n;if(!(Object.keys(e[a]).length>0))return n;var s=o(e[a],t);return n.marks=[s].concat(e.marks),r.push(i({},e[a],{_type:a,_key:s})),n},{marks:e.marks||[]})}),a=i({},e,{children:n,markDefs:r});return delete a.spans,a}var i=e("object-assign"),o=e("./generateKey"),c=["_type","_key","text"];t.exports=function(e,t){if("block"===e._type)return n(e,t);if(Array.isArray(e))return e.map(function(e){return n(e,t)});throw new Error("Unrecognized block structure passed to migrate()")}},{"./generateKey":7,"object-assign":12}],10:[function(e,t,r){"use strict";function n(e){var t=e._type,r=e.listItem;return"block"===t&&!!r}function i(e){return"block"===e._type&&!n(e)}t.exports={isList:n,isText:i,getInternalBlockType:function(e){return i(e)?"text":n(e)?"list":"custom"}}},{}],11:[function(e,t,r){"use strict";var n=e("./ContentNester");t.exports={block:function(e){var t={type:"block",style:e.style,children:n(e.children,e)};return e.extra&&(t.extra=e.extra),t},list:function(e){return{type:"list",itemStyle:e[0].listItem,items:e.map(function(e){var t={type:"block",style:e.style,children:n(e.children,e)};return e.extra&&(t.extra=e.extra),t})}}}},{"./ContentNester":6}],12:[function(e,t,r){"use strict";function n(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var i=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,a,s=n(e),u=1;u<arguments.length;u++){r=Object(arguments[u]);for(var l in r)o.call(r,l)&&(s[l]=r[l]);if(i){a=i(r);for(var f=0;f<a.length;f++)c.call(r,a[f])&&(s[a[f]]=r[a[f]])}}return s}},{}]},{},[3])(3)});

Sorry, the diff of this file is not supported yet

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