Skip to content
This repository has been archived by the owner on Feb 21, 2019. It is now read-only.

Commit

Permalink
Slate 32 compatibility (#35)
Browse files Browse the repository at this point in the history
Replace .kind by .object
  • Loading branch information
tommoor authored and Soreine committed Mar 3, 2018
1 parent dcec764 commit b7c9599
Show file tree
Hide file tree
Showing 62 changed files with 297 additions and 287 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -27,14 +27,14 @@ This plugin uses the following structure for code blocks:

``` yaml
nodes:
- kind: block
- object: block
type: code_block
nodes:
- kind: block
- object: block
type: code_line
nodes:
- text: "A code block is made of..."
- kind: block
- object: block
type: code_line
nodes:
- text: "...several code lines"
Expand Down
6 changes: 3 additions & 3 deletions lib/validation/validateNode.js
Expand Up @@ -62,7 +62,7 @@ function noOrphanLine(opts: Options) {
// Match all blocks that are not code blocks
match(node) {
return (
(node.kind === 'block' || node.kind === 'document') &&
(node.object === 'block' || node.object === 'document') &&
node.type !== opts.containerType
);
},
Expand Down Expand Up @@ -107,7 +107,7 @@ function onlyLine(opts: Options) {
const toRemove = List();

nodes.forEach(child => {
if (child.kind === 'text') {
if (child.object === 'text') {
const lines = deserializeCode(opts, child.text).nodes;
toAdd = toAdd.concat(lines);
toRemove.push(child);
Expand Down Expand Up @@ -149,7 +149,7 @@ function onlyText(opts: Options) {
validate(node) {
const { nodes } = node;

const toRemove = nodes.filterNot(n => n.kind === 'text');
const toRemove = nodes.filterNot(n => n.object === 'text');
if (!toRemove.isEmpty()) {
// Remove them, and the rest
// will be done in the next validation call.
Expand Down
8 changes: 4 additions & 4 deletions package.json
Expand Up @@ -13,8 +13,8 @@
},
"peerDependencies": {
"immutable": "^3.8.1",
"slate": "^0.29.0",
"slate-react": "^0.10.0"
"slate": "^0.32.0",
"slate-react": "^0.11.0"
},
"devDependencies": {
"babel-cli": "^6.26.0",
Expand All @@ -38,9 +38,9 @@
"react": "^15.3.0",
"react-dom": "^15.3.0",
"read-metadata": "^1.0.0",
"slate": "^0.31.0",
"slate": "^0.32.0",
"slate-hyperscript": "^0.4.6",
"slate-react": "^0.10.0"
"slate-react": "^0.11.4"
},
"scripts": {
"prepublish": "babel ./lib --out-dir ./dist",
Expand Down
4 changes: 2 additions & 2 deletions tests/backspace-empty-code/expected.yaml
@@ -1,9 +1,9 @@

document:
nodes:
- kind: block
- object: block
type: paragraph
nodes:
- kind: text
- object: text
leaves:
- text: ""
6 changes: 3 additions & 3 deletions tests/backspace-empty-code/input.yaml
@@ -1,12 +1,12 @@
document:
nodes:
- kind: block
- object: block
type: code_block
nodes:
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
key: 'start'
leaves:
- text: ""
Expand Down
6 changes: 3 additions & 3 deletions tests/backspace-start/expected.yaml
@@ -1,11 +1,11 @@
document:
nodes:
- kind: block
- object: block
type: code_block
nodes:
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
leaves:
- text: "Line 1"
6 changes: 3 additions & 3 deletions tests/backspace-start/input.yaml
@@ -1,12 +1,12 @@
document:
nodes:
- kind: block
- object: block
type: code_block
nodes:
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
key: 'start'
leaves:
- text: " Line 1"
Expand Down
10 changes: 5 additions & 5 deletions tests/enter-end-offset/expected.yaml
@@ -1,17 +1,17 @@
document:
nodes:
- kind: block
- object: block
type: code_block
nodes:
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
leaves:
- text: "Some code"
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
leaves:
- text: ""
6 changes: 3 additions & 3 deletions tests/enter-end-offset/input.yaml
@@ -1,13 +1,13 @@

document:
nodes:
- kind: block
- object: block
type: code_block
nodes:
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
key: 'cursor'
leaves:
- text: "Some code"
Expand Down
10 changes: 5 additions & 5 deletions tests/enter-mid-offset/expected.yaml
@@ -1,17 +1,17 @@
document:
nodes:
- kind: block
- object: block
type: code_block
nodes:
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
leaves:
- text: "Some"
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
leaves:
- text: " code"
6 changes: 3 additions & 3 deletions tests/enter-mid-offset/input.yaml
@@ -1,12 +1,12 @@
document:
nodes:
- kind: block
- object: block
type: code_block
nodes:
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
key: 'start'
leaves:
- text: "Some code"
Expand Down
10 changes: 5 additions & 5 deletions tests/enter-start-offset/expected.yaml
@@ -1,17 +1,17 @@
document:
nodes:
- kind: block
- object: block
type: code_block
nodes:
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
leaves:
- text: ""
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
leaves:
- text: "Some code"
6 changes: 3 additions & 3 deletions tests/enter-start-offset/input.yaml
@@ -1,12 +1,12 @@
document:
nodes:
- kind: block
- object: block
type: code_block
nodes:
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
key: 'start'
leaves:
- text: "Some code"
Expand Down
14 changes: 7 additions & 7 deletions tests/enter-with-indent/expected.yaml
@@ -1,23 +1,23 @@
document:
nodes:
- kind: block
- object: block
type: code_block
nodes:
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
leaves:
- text: "Line 1"
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
leaves:
- text: " Li"
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
leaves:
- text: " ne 2"
10 changes: 5 additions & 5 deletions tests/enter-with-indent/input.yaml
@@ -1,18 +1,18 @@
document:
nodes:
- kind: block
- object: block
type: code_block
nodes:
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
leaves:
- text: "Line 1"
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
key: 'start'
leaves:
- text: " Line 2"
Expand Down
6 changes: 3 additions & 3 deletions tests/isincodeblock-true/expected.yaml
@@ -1,11 +1,11 @@
document:
nodes:
- kind: block
- object: block
type: code_block
nodes:
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
leaves:
- text: "Hello world"
6 changes: 3 additions & 3 deletions tests/isincodeblock-true/input.yaml
@@ -1,12 +1,12 @@
document:
nodes:
- kind: block
- object: block
type: code_block
nodes:
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
key: 'start'
leaves:
- text: "Hello world"
Expand Down
20 changes: 10 additions & 10 deletions tests/on-exit-block/expected.yaml
@@ -1,32 +1,32 @@
document:
nodes:
- kind: block
- object: block
type: code_block
nodes:
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
leaves:
- text: "Li"
- kind: block
- object: block
type: paragraph
nodes:
- kind: text
- object: text
leaves:
- text: ""
- kind: block
- object: block
type: code_block
nodes:
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
leaves:
- text: "ne 1"
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
leaves:
- text: " Line 2"
10 changes: 5 additions & 5 deletions tests/on-exit-block/input.yaml
@@ -1,19 +1,19 @@
document:
nodes:
- kind: block
- object: block
type: code_block
nodes:
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
key: 'start'
leaves:
- text: "Line 1"
- kind: block
- object: block
type: code_line
nodes:
- kind: text
- object: text
leaves:
- text: " Line 2"
selection:
Expand Down

0 comments on commit b7c9599

Please sign in to comment.