chore: update Slate dependencies (#1451)

This commit is contained in:
Robert Karlsson 2018-08-23 22:54:55 +02:00 committed by Shawn Erquhart
parent cd8eddf8f6
commit a1677b0e24
8 changed files with 271 additions and 252 deletions

View File

@ -30,12 +30,12 @@
"remark-parse": "^3.0.1", "remark-parse": "^3.0.1",
"remark-rehype": "^2.0.0", "remark-rehype": "^2.0.0",
"remark-stringify": "^3.0.1", "remark-stringify": "^3.0.1",
"slate": "^0.30.0", "slate": "^0.34.0",
"slate-edit-list": "^0.10.1", "slate-edit-list": "^0.11.3",
"slate-edit-table": "^0.12.0", "slate-edit-table": "^0.15.1",
"slate-plain-serializer": "^0.4.0", "slate-plain-serializer": "^0.5.15",
"slate-react": "0.10.11", "slate-react": "0.12.9",
"slate-soft-break": "^0.6.0", "slate-soft-break": "^0.6.1",
"unified": "^6.1.4", "unified": "^6.1.4",
"unist-builder": "^1.0.2", "unist-builder": "^1.0.2",
"unist-util-visit-parents": "^1.1.1" "unist-util-visit-parents": "^1.1.1"

View File

@ -21,7 +21,7 @@ const VisualEditorContainer = styled.div`
const createEmptyRawDoc = () => { const createEmptyRawDoc = () => {
const emptyText = Text.create(''); const emptyText = Text.create('');
const emptyBlock = Block.create({ kind: 'block', type: 'paragraph', nodes: [emptyText] }); const emptyBlock = Block.create({ object: 'block', type: 'paragraph', nodes: [emptyText] });
return { nodes: [emptyBlock] }; return { nodes: [emptyBlock] };
}; };
@ -86,7 +86,7 @@ export default class Editor extends React.Component {
// Handle everything except list buttons. // Handle everything except list buttons.
if (!['bulleted-list', 'numbered-list'].includes(type)) { if (!['bulleted-list', 'numbered-list'].includes(type)) {
const isActive = this.selectionHasBlock(type); const isActive = this.selectionHasBlock(type);
change = change.setBlock(isActive ? 'paragraph' : type); change = change.setBlocks(isActive ? 'paragraph' : type);
} }
// Handle the extra wrapping required for list buttons. // Handle the extra wrapping required for list buttons.
@ -144,7 +144,7 @@ export default class Editor extends React.Component {
const { value } = this.state; const { value } = this.state;
const nodes = [Text.create('')]; const nodes = [Text.create('')];
const block = { const block = {
kind: 'block', object: 'block',
type: 'shortcode', type: 'shortcode',
data: { data: {
shortcode: pluginId, shortcode: pluginId,
@ -157,7 +157,7 @@ export default class Editor extends React.Component {
let change = value.change(); let change = value.change();
const { focusBlock } = change.value; const { focusBlock } = change.value;
if (focusBlock.text === '') { if (focusBlock.text === '' && focusBlock.type === 'paragraph') {
change = change.setNodeByKey(focusBlock.key, block); change = change.setNodeByKey(focusBlock.key, block);
} else { } else {
change = change.insertBlock(block); change = change.insertBlock(block);

View File

@ -70,7 +70,7 @@ const BackspaceCloseBlock = (options = {}) => ({
if (ignoreIn && ignoreIn.includes(type)) return; if (ignoreIn && ignoreIn.includes(type)) return;
if (startBlock.text === '') { if (startBlock.text === '') {
return change.setBlock(defaultBlock).focus(); return change.setBlocks(defaultBlock).focus();
} }
}, },
}); });

View File

@ -8,7 +8,7 @@ export function validateNode(node) {
/** /**
* Validation of the document itself. * Validation of the document itself.
*/ */
if (node.kind === 'document') { if (node.object === 'document') {
const doc = node; const doc = node;
/** /**
* If the editor is ever in an empty state, insert an empty * If the editor is ever in an empty state, insert an empty

View File

@ -71,7 +71,7 @@ function createBlock(type, nodes, props = {}) {
nodes = undefined; nodes = undefined;
} }
const node = { kind: 'block', type, ...props }; const node = { object: 'block', type, ...props };
return addNodes(node, nodes); return addNodes(node, nodes);
} }
@ -79,7 +79,7 @@ function createBlock(type, nodes, props = {}) {
* Create a Slate Block node. * Create a Slate Block node.
*/ */
function createInline(type, props = {}, nodes) { function createInline(type, props = {}, nodes) {
const node = { kind: 'inline', type, ...props }; const node = { object: 'inline', type, ...props };
return addNodes(node, nodes); return addNodes(node, nodes);
} }
@ -87,7 +87,7 @@ function createInline(type, props = {}, nodes) {
* Create a Slate Raw text node. * Create a Slate Raw text node.
*/ */
function createText(value, data) { function createText(value, data) {
const node = { kind: 'text', data }; const node = { object: 'text', data };
const leaves = isArray(value) ? value : [{ text: value }]; const leaves = isArray(value) ? value : [{ text: value }];
return { ...node, leaves }; return { ...node, leaves };
} }

View File

@ -76,7 +76,7 @@ function transform(node) {
/** /**
* Run individual nodes through conversion factories. * Run individual nodes through conversion factories.
*/ */
return ['text'].includes(node.kind) return ['text'].includes(node.object)
? convertTextNode(node) ? convertTextNode(node)
: convertNode(node, children, shortcodePlugins); : convertNode(node, children, shortcodePlugins);
} }
@ -117,15 +117,15 @@ function combineTextAndInline(nodes) {
* children, so we remove the child node here. * children, so we remove the child node here.
*/ */
if (node.type === 'break') { if (node.type === 'break') {
acc.push({ kind: 'inline', type: 'break' }); acc.push({ object: 'inline', type: 'break' });
return acc; return acc;
} }
/** /**
* Convert remaining inline nodes to standalone text nodes with leaves. * Convert remaining inline nodes to standalone text nodes with leaves.
*/ */
if (node.kind === 'inline') { if (node.object === 'inline') {
acc.push({ kind: 'text', leaves: [{ node, marks: data.marks }] }); acc.push({ object: 'text', leaves: [{ node, marks: data.marks }] });
return acc; return acc;
} }
@ -175,7 +175,7 @@ function processCodeMark(markTypes) {
* For example, this Slate text node: * For example, this Slate text node:
* *
* { * {
* kind: 'text', * object: 'text',
* leaves: [ * leaves: [
* { * {
* text: 'test', * text: 'test',
@ -221,7 +221,7 @@ function convertTextNode(node) {
return condensedNodes.nodes; return condensedNodes.nodes;
} }
if (node.kind === 'inline') { if (node.object === 'inline') {
return transform(node); return transform(node);
} }

View File

@ -2893,7 +2893,7 @@ deasync@^0.1.12:
bindings "~1.2.1" bindings "~1.2.1"
nan "^2.0.7" nan "^2.0.7"
debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.2, debug@^2.3.3, debug@^2.6.6, debug@^2.6.8, debug@^2.6.9: debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.6, debug@^2.6.8, debug@^2.6.9:
version "2.6.9" version "2.6.9"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
dependencies: dependencies:
@ -6041,7 +6041,7 @@ lodash.templatesettings@^4.0.0:
dependencies: dependencies:
lodash._reinterpolate "~3.0.0" lodash._reinterpolate "~3.0.0"
lodash@4.17.10, lodash@^4.11.2, lodash@^4.12.0, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0: lodash@4.17.10, lodash@^4.1.1, lodash@^4.11.2, lodash@^4.12.0, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0:
version "4.17.10" version "4.17.10"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
@ -8605,70 +8605,89 @@ slash@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55"
slate-base64-serializer@^0.2.8: slate-base64-serializer@^0.2.34:
version "0.2.45" version "0.2.47"
resolved "https://registry.yarnpkg.com/slate-base64-serializer/-/slate-base64-serializer-0.2.45.tgz#a4c5f5e59b3681cb1caac2641c6891a542b599b4" resolved "https://registry.yarnpkg.com/slate-base64-serializer/-/slate-base64-serializer-0.2.47.tgz#f7dbc62246d8eb0eef4f6a93a9f387575ab89554"
dependencies: dependencies:
isomorphic-base64 "^1.0.2" isomorphic-base64 "^1.0.2"
slate-dev-logger@^0.1.32, slate-dev-logger@^0.1.33, slate-dev-logger@^0.1.36, slate-dev-logger@^0.1.42: slate-dev-environment@^0.1.2, slate-dev-environment@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/slate-dev-environment/-/slate-dev-environment-0.1.4.tgz#d5dd0d9a5b80b364a23bb7985202ce4e5bd3e8d3"
dependencies:
is-in-browser "^1.1.3"
slate-dev-logger@^0.1.39, slate-dev-logger@^0.1.42:
version "0.1.42" version "0.1.42"
resolved "https://registry.yarnpkg.com/slate-dev-logger/-/slate-dev-logger-0.1.42.tgz#922c4693469e6d60deaa10adfd22b627c9632fbf" resolved "https://registry.yarnpkg.com/slate-dev-logger/-/slate-dev-logger-0.1.42.tgz#922c4693469e6d60deaa10adfd22b627c9632fbf"
slate-edit-list@^0.10.1: slate-edit-list@^0.11.3:
version "0.10.3" version "0.11.3"
resolved "https://registry.yarnpkg.com/slate-edit-list/-/slate-edit-list-0.10.3.tgz#10f0b78c0bc9fd29e22d274d4f559bb1e00d8930" resolved "https://registry.yarnpkg.com/slate-edit-list/-/slate-edit-list-0.11.3.tgz#d27ff2ff93a83bef49131a6a44b87a9558c9d44c"
slate-edit-table@^0.12.0: slate-edit-table@^0.15.1:
version "0.12.0" version "0.15.2"
resolved "https://registry.yarnpkg.com/slate-edit-table/-/slate-edit-table-0.12.0.tgz#9163e67b8025c3c09d6037eb76cb5e652b65dd47" resolved "https://registry.yarnpkg.com/slate-edit-table/-/slate-edit-table-0.15.2.tgz#f26b67451b507f936106151f55a0bffbdbca0213"
slate-plain-serializer@^0.4.0, slate-plain-serializer@^0.4.6: slate-hotkeys@^0.1.2:
version "0.4.16" version "0.1.4"
resolved "https://registry.yarnpkg.com/slate-plain-serializer/-/slate-plain-serializer-0.4.16.tgz#eff277b58943e130905114c7da431ab307cb4c1e" resolved "https://registry.yarnpkg.com/slate-hotkeys/-/slate-hotkeys-0.1.4.tgz#5b10b2a178affc60827f9284d4c0a5d7e5041ffe"
dependencies: dependencies:
slate-dev-logger "^0.1.36" is-hotkey "^0.1.1"
slate-dev-environment "^0.1.4"
slate-prop-types@^0.4.6: slate-plain-serializer@^0.5.15:
version "0.4.43" version "0.5.28"
resolved "https://registry.yarnpkg.com/slate-prop-types/-/slate-prop-types-0.4.43.tgz#d23e75d598d9121edbbd5e665d0dcbedded45fee" resolved "https://registry.yarnpkg.com/slate-plain-serializer/-/slate-plain-serializer-0.5.28.tgz#4c872a5044333229804c9140fc1a66792fdd2e99"
dependencies: dependencies:
slate-dev-logger "^0.1.42" slate-dev-logger "^0.1.42"
slate-react@0.10.11: slate-prop-types@^0.4.32:
version "0.10.11" version "0.4.45"
resolved "https://registry.yarnpkg.com/slate-react/-/slate-react-0.10.11.tgz#5fbfbf0da2dd726df468d788d2bd81dd578a15a3" resolved "https://registry.yarnpkg.com/slate-prop-types/-/slate-prop-types-0.4.45.tgz#7110f3fbb7a4356182144d6f0579fd36694bae30"
dependencies: dependencies:
debug "^2.3.2" slate-dev-logger "^0.1.42"
slate-react@0.12.9:
version "0.12.9"
resolved "https://registry.yarnpkg.com/slate-react/-/slate-react-0.12.9.tgz#6cb6f1fa86c868f56b5dce064146520545884351"
dependencies:
debug "^3.1.0"
get-window "^1.1.1" get-window "^1.1.1"
is-hotkey "^0.1.1"
is-in-browser "^1.1.3"
is-window "^1.0.2" is-window "^1.0.2"
keycode "^2.1.2" keycode "^2.1.2"
lodash "^4.1.1"
prop-types "^15.5.8" prop-types "^15.5.8"
react-immutable-proptypes "^2.1.0" react-immutable-proptypes "^2.1.0"
react-portal "^3.1.0" react-portal "^3.1.0"
selection-is-backward "^1.0.0" selection-is-backward "^1.0.0"
slate-base64-serializer "^0.2.8" slate-base64-serializer "^0.2.34"
slate-dev-logger "^0.1.32" slate-dev-environment "^0.1.2"
slate-plain-serializer "^0.4.6" slate-dev-logger "^0.1.39"
slate-prop-types "^0.4.6" slate-hotkeys "^0.1.2"
slate-plain-serializer "^0.5.15"
slate-prop-types "^0.4.32"
slate-soft-break@^0.6.0: slate-schema-violations@^0.1.20:
version "0.1.26"
resolved "https://registry.yarnpkg.com/slate-schema-violations/-/slate-schema-violations-0.1.26.tgz#6613f98a62ed1516a6d517f6df4881850a15d987"
slate-soft-break@^0.6.1:
version "0.6.1" version "0.6.1"
resolved "https://registry.yarnpkg.com/slate-soft-break/-/slate-soft-break-0.6.1.tgz#b5e9ccf3cb876168c10266428274e2523b0d3dd9" resolved "https://registry.yarnpkg.com/slate-soft-break/-/slate-soft-break-0.6.1.tgz#b5e9ccf3cb876168c10266428274e2523b0d3dd9"
slate@^0.30.0: slate@^0.34.0:
version "0.30.7" version "0.34.7"
resolved "https://registry.yarnpkg.com/slate/-/slate-0.30.7.tgz#98b5e4d8529775eaf2e7e3a2306db8cc49034772" resolved "https://registry.yarnpkg.com/slate/-/slate-0.34.7.tgz#5908e1d0fc092a2212488beca65671f01e0eb80a"
dependencies: dependencies:
debug "^2.3.2" debug "^3.1.0"
direction "^0.1.5" direction "^0.1.5"
esrever "^0.2.0" esrever "^0.2.0"
is-empty "^1.0.0" is-empty "^1.0.0"
is-plain-object "^2.0.4" is-plain-object "^2.0.4"
lodash "^4.17.4" lodash "^4.17.4"
slate-dev-logger "^0.1.33" slate-dev-logger "^0.1.39"
slate-schema-violations "^0.1.20"
type-of "^2.0.1" type-of "^2.0.1"
slice-ansi@0.0.4: slice-ansi@0.0.4: