From 756bf4bcd682dae02620a70620974099c2fe2a27 Mon Sep 17 00:00:00 2001 From: Robert Karlsson Date: Mon, 18 Jun 2018 17:00:55 +0200 Subject: [PATCH] Update Slate dependencies Fixes #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 --- package-lock.json | 561 +++--------------- package.json | 12 +- .../__snapshots__/parser.spec.js.snap | 392 ++++++------ .../MarkdownControl/VisualEditor/index.js | 4 +- .../MarkdownControl/VisualEditor/plugins.js | 2 +- .../VisualEditor/validators.js | 2 +- .../Markdown/serializers/remarkSlate.js | 6 +- .../Markdown/serializers/slateRemark.js | 10 +- 8 files changed, 296 insertions(+), 693 deletions(-) diff --git a/package-lock.json b/package-lock.json index eb65596e8c01..6d215c47389b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "netlify-cms", - "version": "1.8.0", + "version": "2.0.0-dev", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -529,12 +529,6 @@ "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", "dev": true }, - "array-find": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-find/-/array-find-1.0.0.tgz", - "integrity": "sha1-bI4obRHtdoMn+OYuzuhzU8o+eLg=", - "dev": true - }, "array-find-index": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", @@ -583,16 +577,6 @@ "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", "dev": true }, - "array.prototype.find": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/array.prototype.find/-/array.prototype.find-2.0.4.tgz", - "integrity": "sha1-VWpcU2LAhkgyPdrrnenRS8GGTJA=", - "dev": true, - "requires": { - "define-properties": "1.1.2", - "es-abstract": "1.11.0" - } - }, "arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", @@ -834,18 +818,6 @@ "source-map": "0.5.7" } }, - "babel-eslint": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-7.2.3.tgz", - "integrity": "sha1-sv4tgBJkcPXBlELcdXJTqJdxCCc=", - "dev": true, - "requires": { - "babel-code-frame": "6.26.0", - "babel-traverse": "6.26.0", - "babel-types": "6.26.0", - "babylon": "6.18.0" - } - }, "babel-generator": { "version": "6.26.1", "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz", @@ -2194,15 +2166,6 @@ "parse-asn1": "5.1.1" } }, - "browserify-zlib": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.1.4.tgz", - "integrity": "sha1-uzX4pRn2AOD6a4SFJByXnQFB+y0=", - "dev": true, - "requires": { - "pako": "0.2.9" - } - }, "browserslist": { "version": "3.2.8", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-3.2.8.tgz", @@ -3213,12 +3176,6 @@ "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", "dev": true }, - "contains-path": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", - "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", - "dev": true - }, "content-disposition": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", @@ -4151,12 +4108,6 @@ "es5-ext": "0.10.42" } }, - "damerau-levenshtein": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.4.tgz", - "integrity": "sha1-AxkcQyy27qFou3fzpV/9zLiXhRQ=", - "dev": true - }, "dargs": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/dargs/-/dargs-5.1.0.tgz", @@ -4205,6 +4156,7 @@ "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, "requires": { "ms": "2.0.0" } @@ -5052,17 +5004,6 @@ "once": "1.4.0" } }, - "enhanced-resolve": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-0.9.1.tgz", - "integrity": "sha1-TW5omzcl+GCQknzMhs2fFjW4ni4=", - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "memory-fs": "0.2.0", - "tapable": "0.1.10" - } - }, "entities": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz", @@ -5506,35 +5447,6 @@ } } }, - "eslint-config-airbnb": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-airbnb/-/eslint-config-airbnb-12.0.0.tgz", - "integrity": "sha1-qygrdWol8D0ErCZMJNZzoIqAMnA=", - "dev": true, - "requires": { - "eslint-config-airbnb-base": "8.0.0" - } - }, - "eslint-config-airbnb-base": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-8.0.0.tgz", - "integrity": "sha1-xelYpGmrivdq/waLQ9eE5a/nTKc=", - "dev": true - }, - "eslint-config-netlify": { - "version": "github:netlify/eslint-config-netlify#42e46d0b50b380da88db299c3fbe33b55621b87d", - "dev": true, - "requires": { - "babel-eslint": "7.2.3", - "eslint": "3.19.0", - "eslint-config-airbnb": "12.0.0", - "eslint-import-resolver-webpack": "0.6.0", - "eslint-plugin-class-property": "1.1.0", - "eslint-plugin-import": "1.16.0", - "eslint-plugin-jsx-a11y": "2.2.3", - "eslint-plugin-react": "6.10.3" - } - }, "eslint-import-resolver-babel-module": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/eslint-import-resolver-babel-module/-/eslint-import-resolver-babel-module-4.0.0.tgz", @@ -5545,166 +5457,6 @@ "resolve": "1.7.1" } }, - "eslint-import-resolver-node": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.2.3.tgz", - "integrity": "sha1-Wt2BBujJKNssuiMrzZ76hG49oWw=", - "dev": true, - "requires": { - "debug": "2.6.9", - "object-assign": "4.1.1", - "resolve": "1.7.1" - } - }, - "eslint-import-resolver-webpack": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-webpack/-/eslint-import-resolver-webpack-0.6.0.tgz", - "integrity": "sha1-z6SMcntjPrUj4p7wGXULIQbQ9gk=", - "dev": true, - "requires": { - "array-find": "1.0.0", - "debug": "2.6.9", - "enhanced-resolve": "0.9.1", - "find-root": "0.1.2", - "interpret": "1.1.0", - "is-absolute": "0.2.6", - "lodash.get": "3.7.0", - "node-libs-browser": "1.1.1", - "object-assign": "4.1.1", - "resolve": "1.7.1", - "semver": "5.5.0" - } - }, - "eslint-plugin-class-property": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-class-property/-/eslint-plugin-class-property-1.1.0.tgz", - "integrity": "sha512-JHczwQvWPTs+JjP+6dkaGfweklMdEda7dv2hyw0d1+5luWW4lEADW/v7Os+0dl0ZoYwU0RDCdEZIH9o5ig1GJg==", - "dev": true, - "requires": { - "eslint": "3.19.0" - } - }, - "eslint-plugin-import": { - "version": "1.16.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-1.16.0.tgz", - "integrity": "sha1-svoH68xTUE0PKkR3WC7Iv/GHG58=", - "dev": true, - "requires": { - "builtin-modules": "1.1.1", - "contains-path": "0.1.0", - "debug": "2.6.9", - "doctrine": "1.3.0", - "es6-map": "0.1.5", - "es6-set": "0.1.5", - "eslint-import-resolver-node": "0.2.3", - "has": "1.0.1", - "lodash.cond": "4.5.2", - "lodash.endswith": "4.2.1", - "lodash.find": "4.6.0", - "lodash.findindex": "4.6.0", - "minimatch": "3.0.4", - "object-assign": "4.1.1", - "pkg-dir": "1.0.0", - "pkg-up": "1.0.0" - }, - "dependencies": { - "doctrine": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.3.0.tgz", - "integrity": "sha1-E+dWgrVVGEJCdvfBc3g0Vu+RPSY=", - "dev": true, - "requires": { - "esutils": "2.0.2", - "isarray": "1.0.0" - } - }, - "find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", - "dev": true, - "requires": { - "path-exists": "2.1.0", - "pinkie-promise": "2.0.1" - } - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", - "dev": true, - "requires": { - "pinkie-promise": "2.0.1" - } - }, - "pkg-dir": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-1.0.0.tgz", - "integrity": "sha1-ektQio1bstYp1EcFb/TpyTFM89Q=", - "dev": true, - "requires": { - "find-up": "1.1.2" - } - }, - "pkg-up": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-1.0.0.tgz", - "integrity": "sha1-Pgj7RhUlxEIWJKM7n35tCvWwWiY=", - "dev": true, - "requires": { - "find-up": "1.1.2" - } - } - } - }, - "eslint-plugin-jsx-a11y": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-2.2.3.tgz", - "integrity": "sha1-TjXLcbin23AqxBXIBuuOjZ6mxl0=", - "dev": true, - "requires": { - "damerau-levenshtein": "1.0.4", - "jsx-ast-utils": "1.4.1", - "object-assign": "4.1.1" - } - }, - "eslint-plugin-react": { - "version": "6.10.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-6.10.3.tgz", - "integrity": "sha1-xUNb6wZ3ThLH2y9qut3L+QDNP3g=", - "dev": true, - "requires": { - "array.prototype.find": "2.0.4", - "doctrine": "1.5.0", - "has": "1.0.1", - "jsx-ast-utils": "1.4.1", - "object.assign": "4.1.0" - }, - "dependencies": { - "doctrine": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", - "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", - "dev": true, - "requires": { - "esutils": "2.0.2", - "isarray": "1.0.0" - } - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - } - } - }, "eslint-scope": { "version": "3.7.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", @@ -6537,12 +6289,6 @@ "pkg-dir": "2.0.0" } }, - "find-root": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/find-root/-/find-root-0.1.2.tgz", - "integrity": "sha1-mNImfP8ZFsyvJ0OzoO6oHXnX3NE=", - "dev": true - }, "find-up": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", @@ -8345,12 +8091,6 @@ "sshpk": "1.14.1" } }, - "https-browserify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-0.0.1.tgz", - "integrity": "sha1-P5E2XKvmC3ftDruiS0VOPgnZWoI=", - "dev": true - }, "hyphenate-style-name": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.2.tgz", @@ -8605,24 +8345,6 @@ "integrity": "sha1-LKmwM2UREYVUEvFr5dd8YqRYp2Y=", "dev": true }, - "is-absolute": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-0.2.6.tgz", - "integrity": "sha1-IN5p89uULvLYe5wto28XIjWxtes=", - "dev": true, - "requires": { - "is-relative": "0.2.1", - "is-windows": "0.2.0" - }, - "dependencies": { - "is-windows": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-0.2.0.tgz", - "integrity": "sha1-3hqm1j6indJIc3tp8f+LgALSEIw=", - "dev": true - } - } - }, "is-absolute-url": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-2.1.0.tgz", @@ -9043,15 +8765,6 @@ "integrity": "sha1-/S2INUXEa6xaYz57mgnof6LLUGk=", "dev": true }, - "is-relative": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-0.2.1.tgz", - "integrity": "sha1-0n9MfVFtF1+2ENuEu+7yPDvJeqU=", - "dev": true, - "requires": { - "is-unc-path": "0.1.2" - } - }, "is-resolvable": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz", @@ -9117,15 +8830,6 @@ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true }, - "is-unc-path": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-0.1.2.tgz", - "integrity": "sha1-arBTpyVzwQJQ/0FqOBTDUXivObk=", - "dev": true, - "requires": { - "unc-path-regex": "0.1.2" - } - }, "is-utf8": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", @@ -9990,12 +9694,6 @@ "verror": "1.10.0" } }, - "jsx-ast-utils": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz", - "integrity": "sha1-OGchPo3Xm/Ho8jAMDPwe+xgsDfE=", - "dev": true - }, "jwt-decode": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-2.2.0.tgz", @@ -10460,27 +10158,12 @@ "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.10.tgz", "integrity": "sha512-iesFYPmxYYGTcmQK0sL8bX3TGHyM6b2qREaB4kamHfQyfPJP0xgoGxp19nsH16nsfquLdiyKyX3mQkfiSGV8Rg==" }, - "lodash._baseget": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/lodash._baseget/-/lodash._baseget-3.7.2.tgz", - "integrity": "sha1-G2rh1frPPCVTI1ChPBGXy4u2dPQ=", - "dev": true - }, "lodash._reinterpolate": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", "dev": true }, - "lodash._topath": { - "version": "3.8.1", - "resolved": "https://registry.npmjs.org/lodash._topath/-/lodash._topath-3.8.1.tgz", - "integrity": "sha1-PsXiYGAU9MuX91X+aRTt2L/ADqw=", - "dev": true, - "requires": { - "lodash.isarray": "3.0.4" - } - }, "lodash.camelcase": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", @@ -10493,52 +10176,12 @@ "integrity": "sha1-ZuXOH3btJ7QwPYxlEujRIW6BBrw=", "dev": true }, - "lodash.cond": { - "version": "4.5.2", - "resolved": "https://registry.npmjs.org/lodash.cond/-/lodash.cond-4.5.2.tgz", - "integrity": "sha1-9HGh2khr5g9quVXRcRVSPdHSVdU=", - "dev": true - }, - "lodash.endswith": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/lodash.endswith/-/lodash.endswith-4.2.1.tgz", - "integrity": "sha1-/tWawXOO0+I27dcGTsRWRIs3vAk=", - "dev": true - }, - "lodash.find": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.find/-/lodash.find-4.6.0.tgz", - "integrity": "sha1-ywcE1Hq3F4n/oN6Ll92Sb7iLE7E=", - "dev": true - }, - "lodash.findindex": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.findindex/-/lodash.findindex-4.6.0.tgz", - "integrity": "sha1-oyRd7mH7m24GJLU1ElYku2nBEQY=", - "dev": true - }, "lodash.flattendeep": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", "dev": true }, - "lodash.get": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-3.7.0.tgz", - "integrity": "sha1-POaK4skWg7KBzFOUEoMDy/deaR8=", - "dev": true, - "requires": { - "lodash._baseget": "3.7.2", - "lodash._topath": "3.8.1" - } - }, - "lodash.isarray": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", - "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", - "dev": true - }, "lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", @@ -10975,12 +10618,6 @@ } } }, - "memory-fs": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.2.0.tgz", - "integrity": "sha1-8rslNovBIeORwlIN6Slpyu4KApA=", - "dev": true - }, "meow": { "version": "3.7.0", "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", @@ -11436,51 +11073,6 @@ "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=", "dev": true }, - "node-libs-browser": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-1.1.1.tgz", - "integrity": "sha1-KjgkOr7dff/NB6l8mspWaJdab+o=", - "dev": true, - "requires": { - "assert": "1.4.1", - "browserify-zlib": "0.1.4", - "buffer": "4.9.1", - "console-browserify": "1.1.0", - "constants-browserify": "1.0.0", - "crypto-browserify": "3.12.0", - "domain-browser": "1.2.0", - "events": "1.1.1", - "https-browserify": "0.0.1", - "os-browserify": "0.2.1", - "path-browserify": "0.0.0", - "process": "0.11.10", - "punycode": "1.3.2", - "querystring-es3": "0.2.1", - "readable-stream": "2.3.6", - "stream-browserify": "2.0.1", - "stream-http": "2.8.2", - "string_decoder": "0.10.31", - "timers-browserify": "1.4.2", - "tty-browserify": "0.0.0", - "url": "0.11.0", - "util": "0.10.3", - "vm-browserify": "0.0.4" - }, - "dependencies": { - "process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", - "dev": true - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", - "dev": true - } - } - }, "node-notifier": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.2.1.tgz", @@ -12187,12 +11779,6 @@ "url-parse": "1.4.0" } }, - "os-browserify": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.2.1.tgz", - "integrity": "sha1-Y/xMzuXS13Y9Jrv4YBB45sLgBE8=", - "dev": true - }, "os-homedir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", @@ -12317,12 +11903,6 @@ "semver": "5.5.0" } }, - "pako": { - "version": "0.2.9", - "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", - "integrity": "sha1-8/dSL073gjSNqBYbrZ7P1Rv4OnU=", - "dev": true - }, "parallel-transform": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/parallel-transform/-/parallel-transform-1.1.0.tgz", @@ -16674,80 +16254,132 @@ "dev": true }, "slate": { - "version": "0.30.7", - "resolved": "https://registry.npmjs.org/slate/-/slate-0.30.7.tgz", - "integrity": "sha512-pETHjdOXB4IVukjw56eKjFACwio6V1SBu3lK+kb3Jvg0qc9Uy1bikG2Nd7STpE29v8x1HbQ56Ys+g6Ois9yQMA==", + "version": "0.34.0", + "resolved": "https://registry.npmjs.org/slate/-/slate-0.34.0.tgz", + "integrity": "sha1-ln0kRg8srzLkCSUdBC4l94lCDWs=", "requires": { - "debug": "2.6.9", + "debug": "3.1.0", "direction": "0.1.5", "esrever": "0.2.0", "is-empty": "1.2.0", "is-plain-object": "2.0.4", "lodash": "4.17.10", "slate-dev-logger": "0.1.39", + "slate-schema-violations": "0.1.13", "type-of": "2.0.1" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + } } }, "slate-base64-serializer": { - "version": "0.2.31", - "resolved": "https://registry.npmjs.org/slate-base64-serializer/-/slate-base64-serializer-0.2.31.tgz", - "integrity": "sha1-gC7/6Ie0KdQHLbs3O/V1W4PT9PE=", + "version": "0.2.34", + "resolved": "https://registry.npmjs.org/slate-base64-serializer/-/slate-base64-serializer-0.2.34.tgz", + "integrity": "sha1-ijEGcr8vGwDdRpvF5SR8ILsezUA=", "requires": { "isomorphic-base64": "1.0.2" } }, + "slate-dev-environment": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/slate-dev-environment/-/slate-dev-environment-0.1.2.tgz", + "integrity": "sha1-dDqL1/Qn3CckJbBDminoPKVSFog=", + "requires": { + "is-in-browser": "1.1.3" + } + }, "slate-dev-logger": { "version": "0.1.39", "resolved": "https://registry.npmjs.org/slate-dev-logger/-/slate-dev-logger-0.1.39.tgz", "integrity": "sha1-dEppuFA0JEcT5t5RSDr1cTw0WvQ=" }, "slate-edit-list": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/slate-edit-list/-/slate-edit-list-0.10.3.tgz", - "integrity": "sha1-EPC3jAvJ/SniLSdNT1WbseANiTA=" + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/slate-edit-list/-/slate-edit-list-0.11.3.tgz", + "integrity": "sha512-nqaiYYppezMmbsh+JN6vqZl2EexiUTJWwCzJVas8cv+WeRtRmuysn94LKF2VdLIxLmNAe/ZfliIkW9uC/NdO6w==" }, "slate-edit-table": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/slate-edit-table/-/slate-edit-table-0.12.0.tgz", - "integrity": "sha1-kWPme4Alw8CdYDfrdsteZStl3Uc=" + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/slate-edit-table/-/slate-edit-table-0.15.1.tgz", + "integrity": "sha1-OEUJ5C+fAF3XRf5o5VrsFOswqFA=" + }, + "slate-hotkeys": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/slate-hotkeys/-/slate-hotkeys-0.1.2.tgz", + "integrity": "sha1-LjWgikLqqhE7ZNQ41TfnelgsjUo=", + "requires": { + "is-hotkey": "0.1.2", + "slate-dev-environment": "0.1.2" + } }, "slate-plain-serializer": { - "version": "0.4.16", - "resolved": "https://registry.npmjs.org/slate-plain-serializer/-/slate-plain-serializer-0.4.16.tgz", - "integrity": "sha512-eiXUaes5jhZ/T4RCXKcO8nJ6cOc//Mg9eE/xJeaeq6afM/mEq4nd4EGHnPvWy2Ue8jgePDXK1OTg41aTmuy6vQ==", + "version": "0.5.15", + "resolved": "https://registry.npmjs.org/slate-plain-serializer/-/slate-plain-serializer-0.5.15.tgz", + "integrity": "sha1-oaMGri85WukL8PYYeZ2Iak8M5Jk=", "requires": { "slate-dev-logger": "0.1.39" } }, "slate-prop-types": { - "version": "0.4.29", - "resolved": "https://registry.npmjs.org/slate-prop-types/-/slate-prop-types-0.4.29.tgz", - "integrity": "sha1-RWTC2XiWgpbzfXprnt+KCi5RWTw=", + "version": "0.4.32", + "resolved": "https://registry.npmjs.org/slate-prop-types/-/slate-prop-types-0.4.32.tgz", + "integrity": "sha1-PTmm20thpBbqVK9lEvX/pVQgldI=", "requires": { "slate-dev-logger": "0.1.39" } }, "slate-react": { - "version": "0.10.11", - "resolved": "https://registry.npmjs.org/slate-react/-/slate-react-0.10.11.tgz", - "integrity": "sha512-rwcysp/WkSuoNds2paHV+adqpPS3iZ2nY4X+uxDh8wCXkgCY3fYmLpvOcOmVS0FJHIfF3PR8PZ6UWoSHRI9tAA==", + "version": "0.12.9", + "resolved": "https://registry.npmjs.org/slate-react/-/slate-react-0.12.9.tgz", + "integrity": "sha1-bLbx+obIaPVrXc4GQUZSBUWIQ1E=", "requires": { - "debug": "2.6.9", + "debug": "3.1.0", "get-window": "1.1.2", - "is-hotkey": "0.1.2", - "is-in-browser": "1.1.3", "is-window": "1.0.2", "keycode": "2.2.0", + "lodash": "4.17.10", "prop-types": "15.6.1", "react-immutable-proptypes": "2.1.0", "react-portal": "3.2.0", "selection-is-backward": "1.0.0", - "slate-base64-serializer": "0.2.31", + "slate-base64-serializer": "0.2.34", + "slate-dev-environment": "0.1.2", "slate-dev-logger": "0.1.39", - "slate-plain-serializer": "0.4.16", - "slate-prop-types": "0.4.29" + "slate-hotkeys": "0.1.2", + "slate-plain-serializer": "0.5.15", + "slate-prop-types": "0.4.32" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "slate-plain-serializer": { + "version": "0.5.15", + "resolved": "https://registry.npmjs.org/slate-plain-serializer/-/slate-plain-serializer-0.5.15.tgz", + "integrity": "sha1-oaMGri85WukL8PYYeZ2Iak8M5Jk=", + "requires": { + "slate-dev-logger": "0.1.39" + } + } } }, + "slate-schema-violations": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/slate-schema-violations/-/slate-schema-violations-0.1.13.tgz", + "integrity": "sha1-C2Ez/44cAjdxQknvbWrfe5eQiYU=" + }, "slate-soft-break": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/slate-soft-break/-/slate-soft-break-0.6.1.tgz", @@ -18313,12 +17945,6 @@ } } }, - "tapable": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-0.1.10.tgz", - "integrity": "sha1-KcNXB8K3DlDQdIK10gLo7URtr9Q=", - "dev": true - }, "teeny-tap": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/teeny-tap/-/teeny-tap-0.2.0.tgz", @@ -18721,23 +18347,6 @@ "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", "dev": true }, - "timers-browserify": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-1.4.2.tgz", - "integrity": "sha1-ycWLV1voQHN1y14kYtrO50NZ9B0=", - "dev": true, - "requires": { - "process": "0.11.10" - }, - "dependencies": { - "process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", - "dev": true - } - } - }, "timsort": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz", @@ -19106,12 +18715,6 @@ } } }, - "unc-path-regex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", - "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", - "dev": true - }, "underscore": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.4.4.tgz", diff --git a/package.json b/package.json index a3ecddeae737..c692fe5cd6c6 100644 --- a/package.json +++ b/package.json @@ -178,12 +178,12 @@ "remark-stringify": "^3.0.1", "sanitize-filename": "^1.6.1", "semaphore": "^1.0.5", - "slate": "^0.30.0", - "slate-edit-list": "^0.10.1", - "slate-edit-table": "^0.12.0", - "slate-plain-serializer": "^0.4.0", - "slate-react": "0.10.11", - "slate-soft-break": "^0.6.0", + "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", diff --git a/src/components/EditorWidgets/Markdown/MarkdownControl/VisualEditor/__tests__/__snapshots__/parser.spec.js.snap b/src/components/EditorWidgets/Markdown/MarkdownControl/VisualEditor/__tests__/__snapshots__/parser.spec.js.snap index baedbaa222e4..a7b66cc086e3 100644 --- a/src/components/EditorWidgets/Markdown/MarkdownControl/VisualEditor/__tests__/__snapshots__/parser.spec.js.snap +++ b/src/components/EditorWidgets/Markdown/MarkdownControl/VisualEditor/__tests__/__snapshots__/parser.spec.js.snap @@ -2,369 +2,366 @@ exports[`Compile markdown to Slate Raw AST should compile a markdown ordered list 1`] = ` Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "H1", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-one", }, Object { "data": Object { "start": 1, }, - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "yo", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "list-item", }, Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "bro", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "list-item", }, Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "fro", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "list-item", }, ], + "object": "block", "type": "numbered-list", }, ], + "object": "block", "type": "root", } `; exports[`Compile markdown to Slate Raw AST should compile bulleted lists 1`] = ` Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "H1", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-one", }, Object { "data": Object { "start": null, }, - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "yo", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "list-item", }, Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "bro", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "list-item", }, Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "fro", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "list-item", }, ], + "object": "block", "type": "bulleted-list", }, ], + "object": "block", "type": "root", } `; exports[`Compile markdown to Slate Raw AST should compile code blocks 1`] = ` Object { - "kind": "block", "nodes": Array [ Object { "data": Object { "lang": "javascript", }, - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "var a = 1;", }, ], + "object": "text", }, ], + "object": "block", "type": "code", }, ], + "object": "block", "type": "root", } `; exports[`Compile markdown to Slate Raw AST should compile horizontal rules 1`] = ` Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "H1", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-one", }, Object { "isVoid": true, - "kind": "block", + "object": "block", "type": "thematic-break", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "blue moon", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "root", } `; exports[`Compile markdown to Slate Raw AST should compile horizontal rules 2`] = ` Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "H1", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-one", }, Object { "isVoid": true, - "kind": "block", + "object": "block", "type": "thematic-break", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "blue moon", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "root", } `; exports[`Compile markdown to Slate Raw AST should compile images 1`] = ` Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "![super](duper.jpg)", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "root", } `; exports[`Compile markdown to Slate Raw AST should compile inline code 1`] = ` Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Word", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-one", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "This is some sweet ", }, ], + "object": "text", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "marks": Array [ @@ -375,64 +372,64 @@ Object { "text": "inline code", }, ], + "object": "text", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": " yo!", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "root", } `; exports[`Compile markdown to Slate Raw AST should compile kitchen sink example 1`] = ` Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "An exhibit of Markdown", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-one", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "This note demonstrates some of what Markdown is capable of doing.", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "marks": Array [ @@ -444,31 +441,31 @@ Object { automatically save itself.", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Basic formatting", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-two", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Paragraphs can be written like so. A paragraph is the basic block of Markdown. @@ -476,25 +473,25 @@ A paragraph is what text will turn into when there is no reason it should become anything else.", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Paragraphs must be separated by a blank line. Basic formatting of ", }, ], + "object": "text", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "marks": Array [ @@ -505,20 +502,20 @@ become anything else.", "text": "italics", }, ], + "object": "text", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": " and ", }, ], + "object": "text", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "marks": Array [ @@ -529,19 +526,19 @@ become anything else.", "text": "bold", }, ], + "object": "text", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": " is supported. This ", }, ], + "object": "text", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "marks": Array [ @@ -571,85 +568,85 @@ become anything else.", "text": " like", }, ], + "object": "text", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": " so.", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Lists", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-two", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Ordered list", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-three", }, Object { "data": Object { "start": 1, }, - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Item 1 2. A second item 3. Number 3 4. Ⅳ", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "list-item", }, ], + "object": "block", "type": "numbered-list", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "marks": Array [ @@ -660,94 +657,94 @@ become anything else.", "text": "Note: the fourth item uses the Unicode character for Roman numeral four.", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Unordered list", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-three", }, Object { "data": Object { "start": null, }, - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "An item Another item Yet another item And there's more...", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "list-item", }, ], + "object": "block", "type": "bulleted-list", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Paragraph modifiers", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-two", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Code block", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-three", }, Object { "data": Object { "lang": null, }, - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Code blocks are very useful for developers and other people who look at @@ -755,25 +752,25 @@ code or other things that are written in plain text. As you can see, it uses a fixed-width font.", }, ], + "object": "text", }, ], + "object": "block", "type": "code", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "You can also make ", }, ], + "object": "text", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "marks": Array [ @@ -784,77 +781,77 @@ uses a fixed-width font.", "text": "inline code", }, ], + "object": "text", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": " to add code into other things.", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Quote", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-three", }, Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Here is a quote. What this is should be self explanatory. Quotes are automatically indented when they are used.", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "quote", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Headings", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-two", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "There are six levels of headings. They correspond with the six levels of HTML @@ -862,25 +859,25 @@ headings. You've probably noticed them already in the page. Each level down uses one more hash character.", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Headings ", }, ], + "object": "text", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "marks": Array [ @@ -891,19 +888,19 @@ uses one more hash character.", "text": "can", }, ], + "object": "text", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": " also contain ", }, ], + "object": "text", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "marks": Array [ @@ -914,25 +911,25 @@ uses one more hash character.", "text": "formatting", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-three", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "They can even contain ", }, ], + "object": "text", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "marks": Array [ @@ -943,32 +940,32 @@ uses one more hash character.", "text": "inline code", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-three", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Of course, demonstrating what headings look like messes up the structure of the page.", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "I don't recommend using more than three or four levels of headings here, @@ -977,85 +974,83 @@ heading isn't too big, and you want each size up to look noticeably larger and more important, there there are only so many sizes that you can use.", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "URLs", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-two", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "URLs can be made in a handful of ways:", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, Object { "data": Object { "start": null, }, - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "A named link to MarkItDown. The easiest way to do these is to select what you", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "list-item", }, Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "want to make a link and hit ", }, ], + "object": "text", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "marks": Array [ @@ -1066,206 +1061,208 @@ more important, there there are only so many sizes that you can use.", "text": "Ctrl+L", }, ], + "object": "text", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": ". Another named link to", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "list-item", }, Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": Object { "title": null, "url": "http://www.markitdown.net/", }, - "kind": "inline", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "MarkItDown", }, ], + "object": "text", }, ], + "object": "inline", "type": "link", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": " Sometimes you just want a URL like", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "list-item", }, Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": Object { "title": null, "url": "http://www.markitdown.net/", }, - "kind": "inline", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "http://www.markitdown.net/", }, ], + "object": "text", }, ], + "object": "inline", "type": "link", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": ".", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "list-item", }, ], + "object": "block", "type": "bulleted-list", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Horizontal rule", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-two", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "A horizontal rule is a line that goes across the middle of the page.", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, Object { "isVoid": true, - "kind": "block", + "object": "block", "type": "thematic-break", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "It's sometimes handy for breaking things up.", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Images", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-two", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Markdown can also contain images. I'll need to add something here sometime.", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Finally", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-two", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "There's actually a lot more to Markdown than this. See the official @@ -1274,170 +1271,170 @@ not using the official implementation, and this might work subtly differently in some of the little things.", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "root", } `; exports[`Compile markdown to Slate Raw AST should compile links 1`] = ` Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Word", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-one", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "How far is it to ", }, ], + "object": "text", }, Object { "data": Object { "title": null, "url": "https://google.com", }, - "kind": "inline", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Google", }, ], + "object": "text", }, ], + "object": "inline", "type": "link", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": " land?", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "root", } `; exports[`Compile markdown to Slate Raw AST should compile multiple header levels 1`] = ` Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "H1", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-one", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "H2", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-two", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "H3", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-three", }, ], + "object": "block", "type": "root", } `; exports[`Compile markdown to Slate Raw AST should compile nested inline markup 1`] = ` Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "Word", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-one", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "This is ", }, ], + "object": "text", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "marks": Array [ @@ -1467,25 +1464,25 @@ Object { "text": " content", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "perhaps ", }, ], + "object": "text", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "marks": Array [ @@ -1496,147 +1493,150 @@ Object { "text": "scalding", }, ], + "object": "text", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": " even", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "root", } `; exports[`Compile markdown to Slate Raw AST should compile plugins 1`] = ` Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "![test](test.png)", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "{{< test >}}", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "root", } `; exports[`Compile markdown to Slate Raw AST should compile simple markdown 1`] = ` Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "H1", }, ], + "object": "text", }, ], + "object": "block", "type": "heading-one", }, Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "sweet body", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "root", } `; exports[`Compile markdown to Slate Raw AST should compile soft breaks (double space) 1`] = ` Object { - "kind": "block", "nodes": Array [ Object { - "kind": "block", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "blue moon", }, ], + "object": "text", }, Object { - "kind": "inline", "nodes": Array [ Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": " ", }, ], + "object": "text", }, ], + "object": "inline", "type": "break", }, Object { "data": undefined, - "kind": "text", "leaves": Array [ Object { "text": "footballs", }, ], + "object": "text", }, ], + "object": "block", "type": "paragraph", }, ], + "object": "block", "type": "root", } `; diff --git a/src/components/EditorWidgets/Markdown/MarkdownControl/VisualEditor/index.js b/src/components/EditorWidgets/Markdown/MarkdownControl/VisualEditor/index.js index 4a96e3349e77..5155842b16ae 100644 --- a/src/components/EditorWidgets/Markdown/MarkdownControl/VisualEditor/index.js +++ b/src/components/EditorWidgets/Markdown/MarkdownControl/VisualEditor/index.js @@ -15,7 +15,7 @@ import onKeyDown from './keys'; 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] }; }; @@ -78,7 +78,7 @@ export default class Editor extends 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. diff --git a/src/components/EditorWidgets/Markdown/MarkdownControl/VisualEditor/plugins.js b/src/components/EditorWidgets/Markdown/MarkdownControl/VisualEditor/plugins.js index 12843af058cd..e3eb04980bf3 100644 --- a/src/components/EditorWidgets/Markdown/MarkdownControl/VisualEditor/plugins.js +++ b/src/components/EditorWidgets/Markdown/MarkdownControl/VisualEditor/plugins.js @@ -66,7 +66,7 @@ const BackspaceCloseBlock = (options = {}) => ({ if (ignoreIn && ignoreIn.includes(type)) return; if (startBlock.text === '') { - return change.setBlock(defaultBlock).focus(); + return change.setBlocks(defaultBlock).focus(); } } }); diff --git a/src/components/EditorWidgets/Markdown/MarkdownControl/VisualEditor/validators.js b/src/components/EditorWidgets/Markdown/MarkdownControl/VisualEditor/validators.js index d3c4e8d96623..9a260a554adc 100644 --- a/src/components/EditorWidgets/Markdown/MarkdownControl/VisualEditor/validators.js +++ b/src/components/EditorWidgets/Markdown/MarkdownControl/VisualEditor/validators.js @@ -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 diff --git a/src/components/EditorWidgets/Markdown/serializers/remarkSlate.js b/src/components/EditorWidgets/Markdown/serializers/remarkSlate.js index 4e0c2ddfce48..aa11128a9766 100644 --- a/src/components/EditorWidgets/Markdown/serializers/remarkSlate.js +++ b/src/components/EditorWidgets/Markdown/serializers/remarkSlate.js @@ -75,7 +75,7 @@ function createBlock(type, nodes, props = {}) { nodes = undefined; } - const node = { kind: 'block', type, ...props }; + const node = { object: 'block', type, ...props }; return addNodes(node, nodes); } @@ -84,7 +84,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); } @@ -93,7 +93,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 }; } diff --git a/src/components/EditorWidgets/Markdown/serializers/slateRemark.js b/src/components/EditorWidgets/Markdown/serializers/slateRemark.js index d836b7cde4b9..2169eb7c6d46 100644 --- a/src/components/EditorWidgets/Markdown/serializers/slateRemark.js +++ b/src/components/EditorWidgets/Markdown/serializers/slateRemark.js @@ -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); } @@ -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; } @@ -238,7 +238,7 @@ function convertTextNode(node) { return condensedNodes.nodes; } - if (node.kind === 'inline') { + if (node.object === 'inline') { return transform(node); }