slate-react-placeholder
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -134,7 +134,2 @@ (function (global, factory) { | ||
var instanceId = instanceCounter++; | ||
var placeholderMark = { | ||
type: 'placeholder', | ||
data: { key: instanceId } | ||
}; | ||
var placeholder = options.placeholder, | ||
@@ -183,2 +178,4 @@ when = options.when, | ||
var decoration = { | ||
type: 'placeholder', | ||
data: { key: instanceId }, | ||
anchor: { key: firstNode.key, offset: 0, path: firstPath }, | ||
@@ -189,4 +186,3 @@ focus: { | ||
path: lastPath | ||
}, | ||
mark: placeholderMark | ||
} | ||
}; | ||
@@ -193,0 +189,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t(e.SlateReactPlaceholder={},e.React)}(this,function(e,t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var r=function(e,t){if(!e)throw new Error("Invariant failed")},n=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=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(n=(i=l.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{!n&&l.return&&l.return()}finally{if(a)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)},i=0;e.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},l=i++,c={type:"placeholder",data:{key:l}},u=e.placeholder,f=e.when,d=e.style,s=void 0===d?{}:d;return r("string"==typeof u,"You must pass `SlateReactPlaceholder` an `options.placeholder` string."),r("string"==typeof f||"function"==typeof f,"You must pass `SlateReactPlaceholder` an `options.when` query."),{decorateNode:function(e,t,r){if(!t.query(f,e))return r();var n=r(),i=e.texts(),l=a(i,1)[0],u=e.texts({direction:"backward"}),d=a(u,1)[0],s=a(l,2),y=s[0],p=s[1],h=a(d,2),v=h[0],m=h[1],w={anchor:{key:y.key,offset:0,path:p},focus:{key:v.key,offset:v.text.length,path:m},mark:c};return[].concat(o(n),[w])},renderMark:function(e,r,a){var o=e.children,i=e.mark;if("placeholder"===i.type&&i.data.get("key")===l){var c=n({pointerEvents:"none",display:"inline-block",width:"0",maxWidth:"100%",whiteSpace:"nowrap",opacity:"0.333"},s);return t.createElement("span",null,t.createElement("span",{contentEditable:!1,style:c},u),o)}return a()}}},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t(e.SlateReactPlaceholder={},e.React)}(this,function(e,t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var r=function(e,t){if(!e)throw new Error("Invariant failed")},n=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=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(n=(i=l.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{!n&&l.return&&l.return()}finally{if(a)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)},i=0;e.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},l=i++,c=e.placeholder,u=e.when,f=e.style,d=void 0===f?{}:f;return r("string"==typeof c,"You must pass `SlateReactPlaceholder` an `options.placeholder` string."),r("string"==typeof u||"function"==typeof u,"You must pass `SlateReactPlaceholder` an `options.when` query."),{decorateNode:function(e,t,r){if(!t.query(u,e))return r();var n=r(),i=e.texts(),c=a(i,1)[0],f=e.texts({direction:"backward"}),d=a(f,1)[0],s=a(c,2),y=s[0],p=s[1],h=a(d,2),v=h[0],w=h[1],m={type:"placeholder",data:{key:l},anchor:{key:y.key,offset:0,path:p},focus:{key:v.key,offset:v.text.length,path:w}};return[].concat(o(n),[m])},renderMark:function(e,r,a){var o=e.children,i=e.mark;if("placeholder"===i.type&&i.data.get("key")===l){var u=n({pointerEvents:"none",display:"inline-block",width:"0",maxWidth:"100%",whiteSpace:"nowrap",opacity:"0.333"},d);return t.createElement("span",null,t.createElement("span",{contentEditable:!1,style:u},c),o)}return a()}}},Object.defineProperty(e,"__esModule",{value:!0})}); |
@@ -128,7 +128,2 @@ import React from 'react'; | ||
var instanceId = instanceCounter++; | ||
var placeholderMark = { | ||
type: 'placeholder', | ||
data: { key: instanceId } | ||
}; | ||
var placeholder = options.placeholder, | ||
@@ -177,2 +172,4 @@ when = options.when, | ||
var decoration = { | ||
type: 'placeholder', | ||
data: { key: instanceId }, | ||
anchor: { key: firstNode.key, offset: 0, path: firstPath }, | ||
@@ -183,4 +180,3 @@ focus: { | ||
path: lastPath | ||
}, | ||
mark: placeholderMark | ||
} | ||
}; | ||
@@ -187,0 +183,0 @@ |
@@ -134,7 +134,2 @@ 'use strict'; | ||
var instanceId = instanceCounter++; | ||
var placeholderMark = { | ||
type: 'placeholder', | ||
data: { key: instanceId } | ||
}; | ||
var placeholder = options.placeholder, | ||
@@ -183,2 +178,4 @@ when = options.when, | ||
var decoration = { | ||
type: 'placeholder', | ||
data: { key: instanceId }, | ||
anchor: { key: firstNode.key, offset: 0, path: firstPath }, | ||
@@ -189,4 +186,3 @@ focus: { | ||
path: lastPath | ||
}, | ||
mark: placeholderMark | ||
} | ||
}; | ||
@@ -193,0 +189,0 @@ |
{ | ||
"name": "slate-react-placeholder", | ||
"description": "A Slate plugin to render a placeholder with React.", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"license": "MIT", | ||
@@ -22,3 +22,3 @@ "repository": "git://github.com/ianstormtaylor/slate.git", | ||
"mocha": "^2.5.3", | ||
"slate": "^0.47.1", | ||
"slate": "^0.47.2", | ||
"tiny-invariant": "^1.0.1" | ||
@@ -25,0 +25,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49457
816