1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-01 13:18:29 +01:00

21 Commits

Author SHA1 Message Date
Ian Storm Taylor
36ed4397d8
Remove deprecations (#2113)
#### Is this adding or improving a _feature_ or fixing a _bug_?

Debt.

#### What's the new behavior?

This removes almost all existing deprecations from previous API changes, to save on filesize and reduce complexity in the codebase going forward.

It also changes from using the `slate-dev-logger` to using the Facebook-inspired `slate-dev-warning` which can be compiled out of production builds with [`babel-plugin-dev-expression`](https://github.com/4Catalyzer/babel-plugin-dev-expression) to save even further on file size.

The only deprecations it keeps are in the `fromJSON` methods for data model changes like `.kind` and `.leaves` which may still may not have been migrated in databases, since this is a bigger pain point.

#### Have you checked that...?

* [x] The new code matches the existing patterns and styles.
* [x] The tests pass with `yarn test`.
* [x] The linter passes with `yarn lint`. (Fix errors with `yarn prettier`.)
* [x] The relevant examples still work. (Run examples with `yarn watch`.)

#### Does this fix any issues or need any specific reviewers?

Fixes: #1922 
Fixes: #2105
Fixes: #646 
Fixes: #2109
Fixes: #2107 
Fixes: #2018
2018-08-22 18:22:40 -07:00
danielsarin
4d31983a94 IE11 html serializer parser fix (#2087)
#### Is this adding or improving a _feature_ or fixing a _bug_?

This should fix `Unable to get property 'childNodes' of undefined or null reference` error in IE11 when using slate-html-serializer and deserializing an empty string (#1757, #1756).

#### What's the new behavior?

The `defaultParseHtml` now returns an empty body element if the parsed body is null. 

I tested this in the latest Chrome, Firefox and Safari, and they all seemed to work similarly. If the html param was an empty string, `parseFromString` returned a document element, which had a body property which was an empty body element. In IE11 though the body property was null, which caused the undefined or null reference later.

#### Have you checked that...?

* [x] The new code matches the existing patterns and styles.
* [x] The tests pass with `yarn test`.
* [x] The linter passes with `yarn lint`. (Fix errors with `yarn prettier`.)
* [x] The relevant examples still work. (Run examples with `yarn watch`.)
2018-08-16 15:05:08 -07:00
Jinxuan Zhu
e4ff1972d7 Ensure multi-line expressions are padded by eslint (#1924)
* Fix eslint rule and upgrade eslint

* Fix for switch case

* Linting files
2018-06-21 19:27:10 -07:00
Nikolay Kazakov
7684fff545 Fix issue when a nested in mark node a "void" inline node is the cause of error in applyMark method (#1831) 2018-05-10 19:05:55 -07:00
Justin Weiss
dce7e2c439 Allow null return values, which will skip serializing that node (#1699)
Sometimes, I have nodes that only make sense temporarily, so it
doesn't make sense to serialize them. Following the pattern in React,
explicitly returning `null` from a serialzation rule should result in
that node (and its children) not making it into the serialized document.
2018-03-22 14:54:35 -07:00
nschlehe
8689c671f6 Add key prop to <br /> elements in html-serializer (#1704) 2018-03-21 13:15:29 -07:00
Renaud Chaput
3339d088e1 Add Prettier with ESLint integration (#1589)
* Add Prettier, with basic config and ESLint integration

* Apply Prettier to all files using `yarn lint --fix`

* Tell Prettier to ignore an empty text in a test output.

* Run Prettier on JS files not handled by ESLint, and lint them too
2018-02-06 15:12:00 -08:00
Zach Schneider
228b97ff29 Switch to using Rollup for bundling (#1568)
* Implement first working rollup config for main slate pkg

* Convert slate-base64-serializer to rollup

* Convert slate-dev-logger to rollup

* Convert slate-html-serializer to rollup

* Convert slate-hyperscript to rollup

* Convert slate-plain-serializer to rollup

* Convert slate-prop-types to rollup

* Convert (mostly) slate-react to rollup

* Convert slate-simulator to rollup

* Misc cleanup and configuration tweaks/fixes

* Convert slate-schema-violations to rollup

* Successful rollup build for top-level examples

* Add plugin to replace process.env.NODE_ENV

* Only rebuild modules and dev examples in watch mode

* Enable sourcemaps for development builds

* Force debug to use browser version, remove builtins plugin

* Remove is-image from example
It relies on node `path` and wouldn't work well in-browser anyway

* Use browser version of react-dom/server

* Move stray require to import

* Configure examples to watch child package output

* Fix tests

* Remove unneeded preferBuiltins from resolve config

* Use more precise files array to ensure sourcemaps aren't included

* Use lodash instead of lodash.throttle
It's pulled in anyway since slate-react needs slate, so using the
minipackage actually causes code duplication

* Improve naming/fix UMD builds, update UMD doc

* Add rollup configs to linting, add a missing dep to package.json

* Use longform rollup CLI flags

* Add rollup-plugin-auto-external to reduce external module configuration

* Combine rollup config into a unioned helper

* Centralize to a single rollup configuration

* Update dist structure and package field naming for PR feedback

* Add comments and address PR feedback on rollup config

* i.e. -> e.g.

* Add some spacing to the configuration to improve readability

* Add a bit more spacing

* Remove umd from example Slate unpkg link
2018-02-02 15:46:36 -08:00
Ian Storm Taylor
5444a300b8
rename kind to object for clarity (#1501)
* rename `kind` to `object` for clarity

* add deprecation warning for direct access

* add deprecation warning for node creation
2018-01-04 15:26:53 -08:00
Yoel
a6c56a2c56 slate-html-serializer: consistent element.value lookups (#1503)
* consistent element.value lookups

* fix JSDOC / lint

* remove getValue util in favor of element.nodeValue lookup
2018-01-04 15:08:25 -08:00
Ian Storm Taylor
f6d3c8e32c
Remove deprecations (#1317)
* remove deprecations from slate core

* remove deprecations from slate-html-serializer

* remove deprecations from slate-hyperscript

* remove deprecations from slate-plain-serializer

* remove deprecations from slate-prop-types

* remove deprecations from slate-simulator

* remove deprecations from slate-react

* fix linter, fix tests
2017-10-27 14:42:06 -07:00
Ian Storm Taylor
adb2678732
Rename "state" to "value" everywhere (#1313)
* rename state to value in slate core, as deprecation

* rename all references to state to value in slate core

* migrate slate-base64-serializer

* migrate slate-html-serializer

* migrate slate-hyperscript

* migrate slate-plain-serializer

* migrate slate-prop-types

* migrate slate-simulator

* fix change.setState compat

* deprecate references to state in slate-react

* remove all references to state in slate-react

* remove `value` and `schema` from props to all components

* fix default renderPlaceholder

* fix tests

* update examples

* update walkthroughs

* update guides

* update reference
2017-10-27 13:39:06 -07:00
Ian Storm Taylor
ed593c732b remove some polyfills (#1288)
* remove some polyfills

* use for-of for iteration when possible
2017-10-25 17:55:18 -07:00
Ian Storm Taylor
6c42f6c9c3 Rename Range to Leaf, and Selection to Range (#1231)
* rename Range to Leaf

* rename Selection to Range

* add findDOMRange, findNode, findRange helpers

* refactor to remove findDropPoint util

* revert findDOMNode to throwing errors

* export new helpers, fix linter

* update docs

* update examples
2017-10-14 15:36:27 -07:00
David O'Trakoun
13025d79a6 Some fixes (#1225)
Ensure el has a tagName (e.g. textnode will not have a tagName) - found in slack channel

Strict equality checks for strings
2017-10-13 10:07:12 -07:00
David O'Trakoun
9587bc4a50 Sanitize tagName check (#1212)
`In XML (and XML-based languages such as XHTML), tagName preserves case. On HTML elements in DOM trees flagged as HTML documents, tagName returns the element name in the uppercase form.`
2017-10-09 22:00:42 -07:00
Ian Storm Taylor
6d04cae274 fix html-serializer for jsdom use 2017-09-28 23:04:34 -07:00
Ian Storm Taylor
f16a902d35 ocd 2017-09-21 14:47:50 -07:00
Ryan Grove
6f889454d0 Fix error when pasted HTML includes a doctype (#1160)
* Fix error when pasted HTML includes a doctype

When pasted HTML includes a doctype definition, `parsed.childNodes[0]`
is the doctype node, not the `<html>` node, so it's not safe to assume
that `parsed.childNodes[0].childNodes[1]` is the `<body>` node.

Using `parsed.body` ensures that we always get the `<body>` node no
matter where it is in the document.

* Update index.js
2017-09-21 14:41:08 -07:00
Ian Storm Taylor
c95b1fb002 rename slate-logger to slate-dev-logger 2017-09-11 18:27:27 -07:00
Ian Storm Taylor
ace9f47930 change slate to be a monorepo using lerna (#1106)
* init lerna, move files into ./packages

* move test files into ./packages

* more moving around

* fill out package.json files

* fixing imports

* more fixing of imports, and horribleness

* convert examples, fix linting errors

* add documentation

* update docs

* get tests passing

* update travis.yml

* update travis.yml

* update travis.yml

* update test script

* update travis.yml

* update scripts

* try simplifying travis.yml

* ocd stuff

* remove slate-core-test-helpers package

* add package readmes

* update reference docs structure

* refactor slate-simulator into its own package

* add docs for new packages

* update docs

* separate benchmarks into packages, and refactor them
2017-09-11 18:11:45 -07:00