* Include Array.prototype.includes polyfill
In https://github.com/ianstormtaylor/slate/commit/070a700
the `default` feature set was added
and the `Array.prototype.includes` feature removed
from the polyfill.io request.
I think it's great to include the `default` feature set,
but, `Array.prototype.includes` is not included in the `default` set,
so we have to explicitly request it.
IE 11 needs an `Array.prototype.includes` polyfill
in order for the examples to work.
* Update dev.html
* Update index.html
Slate uses `Array.prototype.includes`
in at least one place:
https://github.com/ianstormtaylor/slate/blob/b558872/packages/slate/src/schemas/core.js#L62
So, request an `Array.prototype.includes` polyfill
from polyfill.io
if the user's browser needs it,
which is the case with IE 11.
Also requests minified JavaScript,
since this code is used
for the slatejs.org website,
and there's no need to serve
non-minified code there.
* remove data from event handler signatures
* standardize known transfer types
* add setEventTransfer to docs
* update examples, fix drag/drop
* fix tests and draggable attribute setting
* Pasting external HTML does not work with Slate example. (#1129)
*Due to the upgrade of slate, adjust the way of el.attrs.find to el.href.
* Update index.js
* Reshape void component structure.
Get rid of offscreen spacer.
* Polish Embeds example `Video` component.
* Fix oversight.
* Force spacer width to be 0.
* Update tests
* Make sure nodes update when their selection change
(cherry picked from commit 3e8744409ea94554faafa1e72415cdfb54b4bc78)
* Update examples of showing selected blocks nodes
* refactor to extract applyOperation util
* change handlers to receive transform instead of state
* change onChange to receive a transform, update rich-text example
* fix stack iterationg, convert check-list example
* convert code-highlighting, embeds, emojis examples
* change operations to use full paths, not indexes
* switch split and join to be recursive
* fix linter
* fix onChange calls
* make all operations invertable, add src/operations/* logic
* rename "join" to "merge"
* remove .length property of nodes
* fix node.getFragmentAtRange logic
* convert remaining examples, fix existing changes
* fix .apply() calls and tests
* change setSave and setIsNative transforms
* fix insert_text operations to include marks always
* cleanup and fixes
* fix node inheritance
* fix core onCut handler
* skip constructor in node inheritance
* cleanup
* change updateDescendant to updateNode
* add and update docs
* eliminate need for .apply(), change history to mutable
* add missing file
* add deprecation support to Transform objects
* rename "transform" to "change"
* update benchmark
* add deprecation util to logger
* update transform isNative attr
* fix remaining warn use
* simplify history checkpointing logic
* fix tests
* revert history to being immutable
* fix history
* fix normalize
* fix syntax error from merge
* WIP getting raw marks arrays from the current range
* Always handle marksRaw as Array, fixes tests/lint
* Clean up
* Fixes collapsed selection raw marks, simpler _every_ condition, harmonize toolbar buttons in rich-text example
* raw -> perCharacter
* Add tests for toggleMark collapsed selection
* Add .DS_Store to .gitignore
* Added test for toggleMark add in partially marked selection, with and without other marks
* Added docs for state.marksPerCharacter
* replace marksPerCharacter with activeMarks
* Update the other examples
* Clarify getActiveMarksAtRange
* AddMark/RemoveMark to use getActiveMarksByRange
* User activeMarks for toggle§MarkAtRange transform
* Replace cheerio with parse5
* Convert to dependency injection for HTML parser
* Add options.domParser to HTML serializer
* Fallback to native DOMParser if present and no option provided
* Error if no DOM parser is available (option or native)
* Update tests to pass parse5 as config option
* Update test so it passes.
Cheerio interprets `<p><hr /></p>` as one `p` node with a child `hr`
node, but both parse5 and native DOMParser interpret it as 3 nodes: a
blank `p` node, `hr` node, and second blank `p` node. Update test
expectation to match new API.
* Remove cheerio-esque compatibility conversion.
* Use `application/xml` in native DOMParser
Using `text/html` causes it to wrap the fragment in html, body, etc
* Change error message to single line.
Was inserting an undesired newline char
* Add documentation for new `domParser` option to html serializer
Also boyscout missing documentation for `defaultBlockType` option
* Rename `domParser` option to `parseHtml`
Rename the option to make it clearer what it does, since it accepts a
function and not a `DOMParser` analogue object.
* Fix Edge doctype warning
* Remove getData() calls in onDragOver
Access to data within ondragover is prohibited
* Handle Edge errors accessing `dataTransfer.dropEffect`
* Work around Edge not supporting custom data in drag events
If unable to use `setData()` with custom type, then uses JSON obj to store data in 'text/plain'
* Fix more Edge errors
Edge sometimes throws 'NotSupportedError' whena accessing `items` property on `dataTransfer`
* Fix linting errors
* Fix formatting
* Add property isEmpty to State
* Update hovering menu example
* Document isEmpty
* Improve perf of isEmpty with @Soreine 's suggestion
* Fix return of isEmpty
* Update url when testing locally
When attempting to mess around locally I could never get anything to update. Sure enough I was looking in the wrong place and had missed the `/dev.html` on the end of my url.
Here's to hoping no one else struggles with this again.
* Update Readme.md
* Fix getFragmentAtRange to not return early when selection is in void node or collapsed
* Detecting when cut or copy is made in a void node, and not returning early
* Checking if text exists before using it for cut/copy
* Moving inVoidNode check to onCutOrCopy
as per @ianstormtaylor note.
* If/else for dom operations when copying text vs void node
* Adding fragment span to the contents
* more work on copy-pasting void nodes