1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-01 04:50:27 +02:00

Migrate yarn to berry v3 (#4417)

* Migrate to yarn berry v3

* Fix yarn dependencies for linting

* Specifically invoke bash in yarn clean to make brace expansion work

* Upgrade cypress to 8.x to support yarn berry

* Try out yarn berry workaround for netlify

From https://answers.netlify.com/t/using-the-new-yarn-release-2-0-0-berry/8270

* Update .yarnrc.yml for syntax consistency

Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>

* use rimraf for clean command with escaped glob pattern

* Use workspace:* resolution for workspace packages and rewrite yarn.lock

* set workspace package versions explicit again

* update peer dependencies

* disable import/named for ts and tsx files

* Replace 'key' with 'key=true' wherever babel complains

* replace all instances of key to someKey in tests to satisfy eslint and babel

* remove unnecessary yarn packageExtension and remove cross-env dependency

* upgrade yarn to latest

* Upgrade next.js to 10.x to support yarn berry

* update .yarnrc to satisfy netlify

Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
This commit is contained in:
Bryan Haakman
2021-08-28 13:59:10 +02:00
committed by GitHub
parent c1433f56cf
commit 8eb1abac87
34 changed files with 16053 additions and 11560 deletions

View File

@@ -1,16 +1,12 @@
{ {
"root": true,
"extends": [ "extends": [
"plugin:import/typescript", "plugin:import/typescript",
"prettier", "prettier",
"prettier/@typescript-eslint", "prettier/@typescript-eslint",
"prettier/react" "prettier/react"
], ],
"plugins": [ "plugins": ["@typescript-eslint", "import", "react", "prettier"],
"@typescript-eslint",
"import",
"react",
"prettier"
],
"parser": "@typescript-eslint/parser", "parser": "@typescript-eslint/parser",
"parserOptions": { "parserOptions": {
"sourceType": "module", "sourceType": "module",
@@ -21,12 +17,7 @@
}, },
"ignorePatterns": ["**/next-env.d.ts"], "ignorePatterns": ["**/next-env.d.ts"],
"settings": { "settings": {
"import/extensions": [ "import/extensions": [".js", ".ts", ".jsx", ".tsx"],
".js",
".ts",
".jsx",
".tsx"
],
"react": { "react": {
"version": "detect" "version": "detect"
} }
@@ -45,10 +36,7 @@
"allowKeywords": true "allowKeywords": true
} }
], ],
"eqeqeq": [ "eqeqeq": ["error", "smart"],
"error",
"smart"
],
"import/default": "error", "import/default": "error",
"import/export": "error", "import/export": "error",
"import/first": "error", "import/first": "error",
@@ -106,10 +94,7 @@
"no-var": "error", "no-var": "error",
"no-void": "error", "no-void": "error",
"no-with": "error", "no-with": "error",
"object-shorthand": [ "object-shorthand": ["error", "always"],
"error",
"always"
],
"prefer-arrow-callback": "error", "prefer-arrow-callback": "error",
"prefer-const": [ "prefer-const": [
"error", "error",
@@ -123,10 +108,7 @@
"prefer-template": "error", "prefer-template": "error",
"prettier/prettier": "error", "prettier/prettier": "error",
"radix": "error", "radix": "error",
"react/jsx-boolean-value": [ "react/jsx-boolean-value": ["error", "never"],
"error",
"never"
],
"react/jsx-no-duplicate-props": "error", "react/jsx-no-duplicate-props": "error",
"react/jsx-no-target-blank": "error", "react/jsx-no-target-blank": "error",
"react/jsx-no-undef": "error", "react/jsx-no-undef": "error",
@@ -145,21 +127,13 @@
"error", "error",
"always", "always",
{ {
"exceptions": [ "exceptions": ["-"]
"-"
]
} }
], ],
"use-isnan": "error", "use-isnan": "error",
"valid-typeof": "error", "valid-typeof": "error",
"yield-star-spacing": [ "yield-star-spacing": ["error", "after"],
"error", "yoda": ["error", "never"]
"after"
],
"yoda": [
"error",
"never"
]
}, },
"overrides": [ "overrides": [
{ {
@@ -168,6 +142,12 @@
"import/no-extraneous-dependencies": "off", "import/no-extraneous-dependencies": "off",
"import/no-unresolved": "off" "import/no-unresolved": "off"
} }
},
{
"files": "**/*.{ts,tsx}",
"rules": {
"import/named": "off"
}
} }
] ]
} }

8
.gitignore vendored
View File

@@ -15,3 +15,11 @@ cypress/videos
cypress/fixtures cypress/fixtures
cypress/plugins cypress/plugins
.DS_Store .DS_Store
# Recommendation from https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored (not using Zero-installs)
.yarn/*
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*

631
.yarn/releases/yarn-3.0.1.cjs vendored Executable file

File diff suppressed because one or more lines are too long

1
.yarnrc Normal file
View File

@@ -0,0 +1 @@
yarn-path ".yarn/releases/yarn-3.0.1.cjs"

12
.yarnrc.yml Normal file
View File

@@ -0,0 +1,12 @@
packageExtensions:
eslint-module-utils@*:
dependencies:
eslint-import-resolver-node: "*"
next@*:
dependencies:
eslint-import-resolver-node: "*"
react-error-boundary@*:
dependencies:
prop-types: "*"
yarnPath: .yarn/releases/yarn-3.0.1.cjs

View File

@@ -8,7 +8,7 @@
"build": "yarn build:rollup && yarn build:next", "build": "yarn build:rollup && yarn build:next",
"build:next": "cd ./site && next build && next export", "build:next": "cd ./site && next build && next export",
"build:rollup": "rollup --config ./config/rollup/rollup.config.js", "build:rollup": "rollup --config ./config/rollup/rollup.config.js",
"clean": "rimraf ./node_modules ./packages/*/{dist,lib,node_modules} ./site/{.next,out}", "clean": "rimraf './packages/*/{dist,lib,node_modules}' './site/{.next,out}'",
"fix": "yarn fix:prettier && yarn fix:eslint", "fix": "yarn fix:prettier && yarn fix:eslint",
"fix:eslint": "yarn lint:eslint --fix", "fix:eslint": "yarn lint:eslint --fix",
"fix:prettier": "yarn lint:prettier --write", "fix:prettier": "yarn lint:prettier --write",
@@ -17,7 +17,7 @@
"lint:prettier": "prettier --check \"**/*.{css,md,js,jsx,json,ts,tsx}\"", "lint:prettier": "prettier --check \"**/*.{css,md,js,jsx,json,ts,tsx}\"",
"lint:typescript": "tsc --build ./ --force", "lint:typescript": "tsc --build ./ --force",
"open": "open http://localhost:3000", "open": "open http://localhost:3000",
"prerelease": "cross-env NODE_ENV=production yarn build:rollup && yarn test && yarn lint", "prerelease": "NODE_ENV=production yarn build:rollup && yarn test && yarn lint",
"release:publish:latext": "lerna publish --force-publish", "release:publish:latext": "lerna publish --force-publish",
"release:publish:next": "lerna publish --dist-tag next --force-publish", "release:publish:next": "lerna publish --dist-tag next --force-publish",
"release:publish:experimental": "lerna publish --dist-tag experimental", "release:publish:experimental": "lerna publish --dist-tag experimental",
@@ -27,7 +27,7 @@
"internal:release:next": "yarn prerelease && yarn changeset publish --tag next", "internal:release:next": "yarn prerelease && yarn changeset publish --tag next",
"serve": "cd ./site && next", "serve": "cd ./site && next",
"start": "npm-run-all --parallel --print-label watch serve", "start": "npm-run-all --parallel --print-label watch serve",
"test": "mocha --require ./config/babel/register.cjs ./packages/*/test/**/*.{js,ts}", "test": "mocha --require ./config/babel/register.cjs './packages/*/test/**/*.{js,ts}'",
"test:custom": "mocha --require ./config/babel/register.cjs ./packages/slate/test/index.js", "test:custom": "mocha --require ./config/babel/register.cjs ./packages/slate/test/index.js",
"test:inspect": "yarn test --inspect-brk", "test:inspect": "yarn test --inspect-brk",
"test:integration": "run-p -r serve cypress:run", "test:integration": "run-p -r serve cypress:run",
@@ -62,7 +62,6 @@
"babel-eslint": "^10.0.3", "babel-eslint": "^10.0.3",
"babel-plugin-dev-expression": "^0.2.2", "babel-plugin-dev-expression": "^0.2.2",
"babel-plugin-module-resolver": "^3.1.1", "babel-plugin-module-resolver": "^3.1.1",
"cross-env": "6.0.3",
"cypress": "^8.3.0", "cypress": "^8.3.0",
"emotion": "^10.0.9", "emotion": "^10.0.9",
"eslint": "^6.7.1", "eslint": "^6.7.1",
@@ -100,10 +99,10 @@
"rollup-plugin-typescript2": "^0.27.2", "rollup-plugin-typescript2": "^0.27.2",
"shell-quote": "^1.7.2", "shell-quote": "^1.7.2",
"simple-git-hooks": ">=2.0.3", "simple-git-hooks": ">=2.0.3",
"slate": "*", "slate": "workspace:*",
"slate-history": "*", "slate-history": "workspace:*",
"slate-hyperscript": "*", "slate-hyperscript": "workspace:*",
"slate-react": "*", "slate-react": "workspace:*",
"source-map-loader": "^0.2.4", "source-map-loader": "^0.2.4",
"typescript": "3.9.7" "typescript": "3.9.7"
}, },
@@ -115,5 +114,6 @@
"prettier --write", "prettier --write",
"eslint --fix" "eslint --fix"
] ]
} },
"packageManager": "yarn@3.0.1"
} }

View File

@@ -17,11 +17,14 @@
"is-plain-object": "^3.0.0" "is-plain-object": "^3.0.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/runtime": "^7.7.4",
"lodash": "^4.17.21",
"slate": "^0.65.3", "slate": "^0.65.3",
"slate-hyperscript": "^0.62.0" "slate-hyperscript": "^0.62.0",
"source-map-loader": "^0.2.4"
}, },
"peerDependencies": { "peerDependencies": {
"slate": ">=0.55.0" "slate": ">=0.65.3"
}, },
"umdGlobals": { "umdGlobals": {
"slate": "Slate" "slate": "Slate"

View File

@@ -17,10 +17,12 @@
"is-plain-object": "^3.0.0" "is-plain-object": "^3.0.0"
}, },
"devDependencies": { "devDependencies": {
"slate": "^0.65.3" "@babel/runtime": "^7.7.4",
"slate": "^0.65.3",
"source-map-loader": "^0.2.4"
}, },
"peerDependencies": { "peerDependencies": {
"slate": ">=0.55.0" "slate": ">=0.65.3"
}, },
"umdGlobals": { "umdGlobals": {
"slate": "Slate" "slate": "Slate"

View File

@@ -24,15 +24,21 @@
"tiny-invariant": "1.0.6" "tiny-invariant": "1.0.6"
}, },
"devDependencies": { "devDependencies": {
"@babel/runtime": "^7.7.4",
"@types/react": "^16.9.13",
"@types/react-dom": "^16.9.4",
"jsdom": "^16.6.0", "jsdom": "^16.6.0",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"react-test-renderer": ">=16.8.0", "react-test-renderer": ">=16.8.0",
"slate": "^0.65.3", "slate": "^0.65.3",
"slate-hyperscript": "^0.62.0" "slate-hyperscript": "^0.62.0",
"source-map-loader": "^0.2.4"
}, },
"peerDependencies": { "peerDependencies": {
"react": ">=16.8.0", "react": ">=16.8.0",
"react-dom": ">=16.8.0", "react-dom": ">=16.8.0",
"slate": ">=0.55.0" "slate": ">=0.65.3"
}, },
"umdGlobals": { "umdGlobals": {
"react": "React", "react": "React",

View File

@@ -19,7 +19,10 @@
"tiny-warning": "^1.0.3" "tiny-warning": "^1.0.3"
}, },
"devDependencies": { "devDependencies": {
"lodash": "^4.17.21" "@babel/runtime": "^7.7.4",
"lodash": "^4.17.21",
"slate-hyperscript": "^0.62.0",
"source-map-loader": "^0.2.4"
}, },
"keywords": [ "keywords": [
"canvas", "canvas",

View File

@@ -5,7 +5,7 @@ import { Transforms, Editor } from 'slate'
export const input = ( export const input = (
<editor> <editor>
<element> <element>
<text key /> <text someKey />
</element> </element>
</editor> </editor>
) )
@@ -15,8 +15,8 @@ export const operations = [
{ {
type: 'set_node', type: 'set_node',
path: [0, 0], path: [0, 0],
properties: { key: true }, properties: { someKey: true },
newProperties: { key: null }, newProperties: { someKey: null },
}, },
] ]

View File

@@ -5,7 +5,7 @@ import { Transforms, Editor } from 'slate'
export const input = ( export const input = (
<editor> <editor>
<element> <element>
<text key /> <text someKey />
</element> </element>
</editor> </editor>
) )
@@ -14,7 +14,7 @@ export const operations = [
{ {
type: 'set_node', type: 'set_node',
path: [0, 0], path: [0, 0],
properties: { key: true }, properties: { someKey: true },
newProperties: {}, newProperties: {},
}, },
] ]

View File

@@ -5,7 +5,7 @@ import { Transforms, Editor } from 'slate'
export const input = ( export const input = (
<editor> <editor>
<element> <element>
<text key /> <text someKey />
</element> </element>
</editor> </editor>
) )
@@ -15,8 +15,8 @@ export const operations = [
{ {
type: 'set_node', type: 'set_node',
path: [0, 0], path: [0, 0],
properties: { key: true }, properties: { someKey: true },
newProperties: { key: undefined }, newProperties: { someKey: undefined },
}, },
] ]

View File

@@ -4,7 +4,7 @@ import { Editor, Transforms, Operation } from 'slate'
import { jsx } from '../../..' import { jsx } from '../../..'
export const run = (editor: Editor) => { export const run = (editor: Editor) => {
Transforms.setNodes(editor, { key: true }, { at: [0] }) Transforms.setNodes(editor, { someKey: true }, { at: [0] })
const [op] = editor.operations const [op] = editor.operations
const roundTrip: Operation = JSON.parse(JSON.stringify(op)) const roundTrip: Operation = JSON.parse(JSON.stringify(op))
assert.deepStrictEqual(op, roundTrip) assert.deepStrictEqual(op, roundTrip)
@@ -18,7 +18,7 @@ export const input = (
) )
export const output = ( export const output = (
<editor> <editor>
<block key> <block someKey>
<text /> <text />
</block> </block>
</editor> </editor>

View File

@@ -5,7 +5,7 @@ import { jsx } from '../../..'
export const run = editor => { export const run = editor => {
Transforms.setNodes( Transforms.setNodes(
editor, editor,
{ key: true }, { someKey: true },
{ match: n => Editor.isBlock(editor, n) } { match: n => Editor.isBlock(editor, n) }
) )
} }
@@ -23,11 +23,11 @@ export const input = (
) )
export const output = ( export const output = (
<editor> <editor>
<block key> <block someKey>
<anchor /> <anchor />
word word
</block> </block>
<block key> <block someKey>
a<focus /> a<focus />
nother nother
</block> </block>

View File

@@ -5,7 +5,7 @@ import { jsx } from '../../..'
export const run = editor => { export const run = editor => {
Transforms.setNodes( Transforms.setNodes(
editor, editor,
{ key: true }, { someKey: true },
{ match: n => Editor.isBlock(editor, n) } { match: n => Editor.isBlock(editor, n) }
) )
} }
@@ -23,7 +23,7 @@ export const input = (
) )
export const output = ( export const output = (
<editor> <editor>
<block key> <block someKey>
<anchor /> <anchor />
word word
</block> </block>

View File

@@ -5,7 +5,7 @@ import { jsx } from '../../..'
export const run = editor => { export const run = editor => {
Transforms.setNodes( Transforms.setNodes(
editor, editor,
{ key: true }, { someKey: true },
{ match: n => Editor.isBlock(editor, n) } { match: n => Editor.isBlock(editor, n) }
) )
} }
@@ -22,7 +22,7 @@ export const input = (
export const output = ( export const output = (
<editor> <editor>
<block> <block>
<block key> <block someKey>
<cursor /> <cursor />
word word
</block> </block>

View File

@@ -5,7 +5,7 @@ import { jsx } from '../../..'
export const run = editor => { export const run = editor => {
Transforms.setNodes( Transforms.setNodes(
editor, editor,
{ key: true }, { someKey: true },
{ match: n => Editor.isBlock(editor, n) } { match: n => Editor.isBlock(editor, n) }
) )
} }
@@ -19,7 +19,7 @@ export const input = (
) )
export const output = ( export const output = (
<editor> <editor>
<block void key> <block void someKey>
<cursor /> <cursor />
word word
</block> </block>

View File

@@ -5,7 +5,7 @@ import { jsx } from '../../..'
export const run = editor => { export const run = editor => {
Transforms.setNodes( Transforms.setNodes(
editor, editor,
{ key: true }, { someKey: true },
{ match: n => Editor.isBlock(editor, n) } { match: n => Editor.isBlock(editor, n) }
) )
} }
@@ -19,7 +19,7 @@ export const input = (
) )
export const output = ( export const output = (
<editor> <editor>
<block key> <block someKey>
<cursor /> <cursor />
word word
</block> </block>

View File

@@ -5,7 +5,7 @@ import { jsx } from '../../..'
export const run = editor => { export const run = editor => {
Transforms.setNodes( Transforms.setNodes(
editor, editor,
{ key: true }, { someKey: true },
{ match: n => Editor.isInline(editor, n) } { match: n => Editor.isInline(editor, n) }
) )
} }
@@ -33,7 +33,7 @@ export const output = (
<editor> <editor>
<block> <block>
<text /> <text />
<inline key> <inline someKey>
<anchor /> <anchor />
word word
</inline> </inline>
@@ -41,7 +41,7 @@ export const output = (
</block> </block>
<block> <block>
<text /> <text />
<inline key> <inline someKey>
another another
<focus /> <focus />
</inline> </inline>

View File

@@ -5,7 +5,7 @@ import { jsx } from '../../..'
export const run = editor => { export const run = editor => {
Transforms.setNodes( Transforms.setNodes(
editor, editor,
{ key: true }, { someKey: true },
{ match: n => Editor.isInline(editor, n) } { match: n => Editor.isInline(editor, n) }
) )
} }
@@ -33,7 +33,7 @@ export const output = (
<editor> <editor>
<block> <block>
<text /> <text />
<inline key> <inline someKey>
<anchor /> <anchor />
word word
</inline> </inline>

View File

@@ -5,7 +5,7 @@ import { jsx } from '../../..'
export const run = editor => { export const run = editor => {
Transforms.setNodes( Transforms.setNodes(
editor, editor,
{ key: true }, { someKey: true },
{ match: n => Editor.isInline(editor, n) } { match: n => Editor.isInline(editor, n) }
) )
} }
@@ -25,7 +25,7 @@ export const output = (
<editor> <editor>
<block> <block>
<text /> <text />
<inline key> <inline someKey>
<anchor /> <anchor />
word word
</inline> </inline>

View File

@@ -5,7 +5,7 @@ import { jsx } from '../../..'
export const run = editor => { export const run = editor => {
Transforms.setNodes( Transforms.setNodes(
editor, editor,
{ key: true }, { someKey: true },
{ match: n => Editor.isInline(editor, n) } { match: n => Editor.isInline(editor, n) }
) )
} }
@@ -31,7 +31,7 @@ export const output = (
<text /> <text />
<inline> <inline>
<text /> <text />
<inline key> <inline someKey>
<cursor /> <cursor />
word word
</inline> </inline>

View File

@@ -5,7 +5,7 @@ import { jsx } from '../../..'
export const run = editor => { export const run = editor => {
Transforms.setNodes( Transforms.setNodes(
editor, editor,
{ key: true }, { someKey: true },
{ match: n => Editor.isInline(editor, n) } { match: n => Editor.isInline(editor, n) }
) )
} }
@@ -25,7 +25,7 @@ export const output = (
<editor> <editor>
<block> <block>
<text /> <text />
<inline void key> <inline void someKey>
<cursor /> <cursor />
word word
</inline> </inline>

View File

@@ -5,7 +5,7 @@ import { jsx } from '../../..'
export const run = editor => { export const run = editor => {
Transforms.setNodes( Transforms.setNodes(
editor, editor,
{ key: true }, { someKey: true },
{ match: n => Editor.isInline(editor, n) } { match: n => Editor.isInline(editor, n) }
) )
} }
@@ -25,7 +25,7 @@ export const output = (
<editor> <editor>
<block> <block>
<text /> <text />
<inline key> <inline someKey>
<cursor /> <cursor />
word word
</inline> </inline>

View File

@@ -5,14 +5,14 @@ import { jsx } from '../../..'
export const run = editor => { export const run = editor => {
Transforms.setNodes( Transforms.setNodes(
editor, editor,
{ key: null }, { someKey: null },
{ match: Text.isText, split: true } { match: Text.isText, split: true }
) )
} }
export const input = ( export const input = (
<editor> <editor>
<block> <block>
<text key> <text someKey>
w<anchor /> w<anchor />
or or
<focus />d <focus />d
@@ -23,13 +23,13 @@ export const input = (
export const output = ( export const output = (
<editor> <editor>
<block> <block>
<text key>w</text> <text someKey>w</text>
<text> <text>
<anchor /> <anchor />
or or
<focus /> <focus />
</text> </text>
<text key>d</text> <text someKey>d</text>
</block> </block>
</editor> </editor>
) )

View File

@@ -5,7 +5,7 @@ import { jsx } from '../../..'
export const run = editor => { export const run = editor => {
Transforms.setNodes( Transforms.setNodes(
editor, editor,
{ key: true }, { someKey: true },
{ match: Text.isText, split: true } { match: Text.isText, split: true }
) )
} }
@@ -22,7 +22,7 @@ export const output = (
<editor> <editor>
<block> <block>
<text>w</text> <text>w</text>
<text key> <text someKey>
<anchor /> <anchor />
or or
<focus /> <focus />

View File

@@ -3,7 +3,7 @@ import { Transforms, Text } from 'slate'
import { jsx } from '../../..' import { jsx } from '../../..'
export const run = editor => { export const run = editor => {
Transforms.setNodes(editor, { key: true }, { match: Text.isText }) Transforms.setNodes(editor, { someKey: true }, { match: Text.isText })
} }
export const input = ( export const input = (
<editor> <editor>
@@ -20,13 +20,13 @@ export const input = (
export const output = ( export const output = (
<editor> <editor>
<block> <block>
<text key> <text someKey>
<anchor /> <anchor />
word word
</text> </text>
</block> </block>
<block> <block>
<text key> <text someKey>
a<focus /> a<focus />
nother nother
</text> </text>

View File

@@ -5,7 +5,7 @@ import { jsx } from '../../..'
export const run = editor => { export const run = editor => {
Transforms.setNodes( Transforms.setNodes(
editor, editor,
{ key: true }, { someKey: true },
{ match: Text.isText, split: true } { match: Text.isText, split: true }
) )
} }
@@ -16,7 +16,7 @@ export const input = (
One One
<anchor /> <anchor />
</text> </text>
<text key>Two</text> <text someKey>Two</text>
<text> <text>
<focus /> <focus />
Three Three
@@ -31,7 +31,7 @@ export const output = (
One One
<anchor /> <anchor />
</text> </text>
<text key> <text someKey>
Two Two
<focus /> <focus />
</text> </text>

View File

@@ -3,7 +3,7 @@ import { Transforms, Text } from 'slate'
import { jsx } from '../../..' import { jsx } from '../../..'
export const run = editor => { export const run = editor => {
Transforms.setNodes(editor, { key: true }, { match: Text.isText }) Transforms.setNodes(editor, { someKey: true }, { match: Text.isText })
} }
export const input = ( export const input = (
<editor> <editor>
@@ -16,7 +16,7 @@ export const input = (
export const output = ( export const output = (
<editor> <editor>
<block> <block>
<text key> <text someKey>
<cursor /> <cursor />
word word
</text> </text>

View File

@@ -8,12 +8,12 @@ export const input = (
</editor> </editor>
) )
export const run = editor => { export const run = editor => {
Transforms.setNodes(editor, { key: true }, { at: [0, 0], voids: true }) Transforms.setNodes(editor, { someKey: true }, { at: [0, 0], voids: true })
} }
export const output = ( export const output = (
<editor> <editor>
<block void> <block void>
<text key>word</text> <text someKey>word</text>
</block> </block>
</editor> </editor>
) )

View File

@@ -4,7 +4,7 @@ import { Transforms, Text, Editor } from 'slate'
import { jsx } from '../..' import { jsx } from '../..'
export const run = (editor: Editor) => { export const run = (editor: Editor) => {
Transforms.unsetNodes(editor, 'key', { at: [0] }) Transforms.unsetNodes(editor, 'someKey', { at: [0] })
// unsetNodes uses null to remove properties, but that should not // unsetNodes uses null to remove properties, but that should not
// flow through to the operation // flow through to the operation
@@ -14,7 +14,7 @@ export const run = (editor: Editor) => {
assert.deepStrictEqual(setNode, { assert.deepStrictEqual(setNode, {
type: 'set_node', type: 'set_node',
path: [0], path: [0],
properties: { key: true }, properties: { someKey: true },
newProperties: {}, newProperties: {},
}) })
} else { } else {
@@ -25,7 +25,7 @@ export const run = (editor: Editor) => {
} }
export const input = ( export const input = (
<editor> <editor>
<block key>word</block> <block someKey>word</block>
</editor> </editor>
) )
export const output = ( export const output = (

View File

@@ -3,12 +3,12 @@ import { Transforms, Text } from 'slate'
import { jsx } from '../..' import { jsx } from '../..'
export const run = editor => { export const run = editor => {
Transforms.unsetNodes(editor, 'key', { match: Text.isText }) Transforms.unsetNodes(editor, 'someKey', { match: Text.isText })
} }
export const input = ( export const input = (
<editor> <editor>
<block> <block>
<text key> <text someKey>
<cursor /> <cursor />
word word
</text> </text>

26755
yarn.lock

File diff suppressed because it is too large Load Diff