Skip to content

Commit

Permalink
Update Slate dependencies
Browse files Browse the repository at this point in the history
Fixes decaporg#1432
Update Slate and Slate plugin dependencies to be up to date with current versions.
Change setBlock -> setBLocks according to deprecation warning in slate 0.33.0
Change node.kind -> node.object according to deprecation warning in Slate 0.32.0
Update Jest snapshot to pass the change from node.kind -> node.object
  • Loading branch information
Robert Karlsson committed Aug 3, 2018
1 parent 4d8e176 commit 579258e
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 14 deletions.
73 changes: 73 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,79 @@
],
"private": true,
"dependencies": {
<<<<<<< HEAD
"jest-emotion": "^9.2.6"
=======
"classnames": "^2.2.5",
"create-react-class": "^15.6.0",
"diacritics": "^1.3.0",
"fuzzy": "^0.1.1",
"gotrue-js": "^0.9.15",
"gray-matter": "^3.0.6",
"history": "^4.7.2",
"immutable": "^3.7.6",
"is-hotkey": "^0.1.1",
"js-base64": "^2.1.9",
"js-yaml": "^3.10.0",
"jwt-decode": "^2.1.0",
"localforage": "^1.4.2",
"lodash": "^4.13.1",
"mdast-util-definitions": "^1.2.2",
"mdast-util-to-string": "^1.0.4",
"moment": "^2.11.2",
"prop-types": "^15.5.10",
"react": "^16.0.0",
"react-aria-menubutton": "^5.1.0",
"react-autosuggest": "^9.3.2",
"react-datetime": "^2.11.0",
"react-dnd": "^2.5.4",
"react-dnd-html5-backend": "^2.5.4",
"react-dom": "^16.0.0",
"react-frame-component": "^2.0.0",
"react-hot-loader": "^4.0.0",
"react-immutable-proptypes": "^2.1.0",
"react-is": "16.3.1",
"react-modal": "^3.1.5",
"react-redux": "^4.4.0",
"react-router-dom": "^4.2.2",
"react-router-redux": "^5.0.0-alpha.8",
"react-scroll-sync": "^0.4.0",
"react-sortable-hoc": "^0.6.8",
"react-split-pane": "^0.1.66",
"react-textarea-autosize": "^5.2.0",
"react-toggled": "^1.1.2",
"react-topbar-progress-indicator": "^2.0.0",
"react-transition-group": "^2.2.1",
"react-waypoint": "^7.1.0",
"redux": "^3.3.1",
"redux-notifications": "^4.0.1",
"redux-optimist": "^0.0.2",
"redux-thunk": "^1.0.3",
"rehype-parse": "^3.1.0",
"rehype-remark": "^2.0.0",
"rehype-stringify": "^3.0.0",
"remark-parse": "^3.0.1",
"remark-rehype": "^2.0.0",
"remark-stringify": "^3.0.1",
"sanitize-filename": "^1.6.1",
"semaphore": "^1.0.5",
"slate": "^0.34.0",
"slate-edit-list": "^0.11.3",
"slate-edit-table": "^0.15.1",
"slate-plain-serializer": "^0.5.15",
"slate-react": "^0.12.9",
"slate-soft-break": "^0.6.1",
"toml-j0.4": "^1.1.1",
"tomlify-j0.4": "^3.0.0-alpha.0",
"unified": "^6.1.4",
"unist-builder": "^1.0.2",
"unist-util-visit-parents": "^1.1.1",
"url": "^0.11.0",
"uuid": "^3.1.0",
"what-input": "^5.0.3"
},
"optionalDependencies": {
"fsevents": "^1.0.14"
>>>>>>> Update Slate dependencies
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const VisualEditorContainer = styled.div`

const createEmptyRawDoc = () => {
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] };
};

Expand Down Expand Up @@ -83,7 +83,7 @@ export default class Editor extends React.Component {
// Handle everything except list buttons.
if (!['bulleted-list', 'numbered-list'].includes(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.
Expand Down Expand Up @@ -147,7 +147,7 @@ export default class Editor extends React.Component {
const { value } = this.state;
const nodes = [Text.create('')];
const block = {
kind: 'block',
object: 'block',
type: 'shortcode',
data: {
shortcode: pluginId,
Expand All @@ -160,7 +160,7 @@ export default class Editor extends React.Component {
let change = value.change();
const { focusBlock } = change.value;

if (focusBlock.text === '') {
if (focusBlock.text === '' && focusBlock.type === 'paragraph') {
change = change.setNodeByKey(focusBlock.key, block);
} else {
change = change.insertBlock(block);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const BackspaceCloseBlock = (options = {}) => ({
if (ignoreIn && ignoreIn.includes(type)) return;

if (startBlock.text === '') {
return change.setBlock(defaultBlock).focus();
return change.setBlocks(defaultBlock).focus();
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function validateNode(node) {
/**
* Validation of the document itself.
*/
if (node.kind === 'document') {
if (node.object === 'document') {
const doc = node;
/**
* If the editor is ever in an empty state, insert an empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function createBlock(type, nodes, props = {}) {
nodes = undefined;
}

const node = { kind: 'block', type, ...props };
const node = { object: 'block', type, ...props };
return addNodes(node, nodes);
}

Expand All @@ -83,7 +83,7 @@ function createBlock(type, nodes, props = {}) {
* Create a Slate Block node.
*/
function createInline(type, props = {}, nodes) {
const node = { kind: 'inline', type, ...props };
const node = { object: 'inline', type, ...props };
return addNodes(node, nodes);
}

Expand All @@ -92,7 +92,7 @@ function createInline(type, props = {}, nodes) {
* Create a Slate Raw text node.
*/
function createText(value, data) {
const node = { kind: 'text', data };
const node = { object: 'text', data };
const leaves = isArray(value) ? value : [{ text: value }];
return { ...node, leaves };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function transform(node) {
/**
* Run individual nodes through conversion factories.
*/
return ['text'].includes(node.kind)
return ['text'].includes(node.object)
? convertTextNode(node)
: convertNode(node, children, shortcodePlugins);
}
Expand Down Expand Up @@ -120,15 +120,15 @@ function combineTextAndInline(nodes) {
* children, so we remove the child node here.
*/
if (node.type === 'break') {
acc.push({ kind: 'inline', type: 'break' });
acc.push({ object: 'inline', type: 'break' });
return acc;
}

/**
* Convert remaining inline nodes to standalone text nodes with leaves.
*/
if (node.kind === 'inline') {
acc.push({ kind: 'text', leaves: [{ node, marks: data.marks }] });
if (node.object === 'inline') {
acc.push({ object: 'text', leaves: [{ node, marks: data.marks }] });
return acc;
}

Expand Down Expand Up @@ -238,7 +238,7 @@ function convertTextNode(node) {
return condensedNodes.nodes;
}

if (node.kind === 'inline') {
if (node.object === 'inline') {
return transform(node);
}

Expand Down

0 comments on commit 579258e

Please sign in to comment.