1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-03-06 05:49:47 +01:00

276 Commits

Author SHA1 Message Date
Ryan Yurkanin
af84cf2511 adding forced-layout-example (#954) 2017-07-31 18:19:45 -07:00
Zach Schneider
f8b103d75e Reckon with inconsistencies between parse5 and native DOMParser (#952) 2017-07-31 18:18:30 -07:00
Zach Schneider
4bbf7487ea Replace cheerio with parse5 (#934)
* 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.
2017-07-20 09:46:02 -07:00
mjadobson
31c75590ae Fix Edge Drag & Drop Issues (#923)
* 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
2017-07-12 08:43:38 -07:00
Samy Pessé
74bf684ec9 Add property "isEmpty" (#863)
* Add property isEmpty to State

* Update hovering menu example

* Document isEmpty

* Improve perf of isEmpty with @Soreine 's suggestion

* Fix return of isEmpty
2017-07-11 13:34:02 -07:00
Samy Pessé
0746582cc4 Fix dragging text in the editor (#884)
* Fix dragging text in the editor

* Only use transfer type "node" when dragging a void node

* Move onDropNode to core plugin
2017-07-11 13:28:45 -07:00
mjadobson
e81f4e24e9 Fix image drop in example (#919)
* Fix image drop in example

Dropped images were being inserted at previous selection rather than drop target.

* Fix linting errors
2017-07-11 13:14:39 -07:00
Conor Cussell
a3a7949fc4 Add example of using plugin.render to /examples/plugins (#890) 2017-06-21 17:32:32 -04:00
Alex Zajac
da1210da0f Local examples url update (#822)
* 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
2017-05-20 10:58:10 -07:00
Dae-Ho Kim
873f1b1124 Fix json (#798)
Remove comma
2017-05-06 09:19:27 -07:00
Ian Storm Taylor
526d162002 fix large document example imports 2017-05-04 17:14:09 -07:00
Ian Storm Taylor
13a99a9b73 refactor examples, upgrade dependencies 2017-05-04 16:48:42 -07:00
Ian Storm Taylor
94e0e6254a Copy void (#788)
* 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
2017-05-04 14:42:47 -07:00
Ian Storm Taylor
78fefa1115 update table example to make scope clearer 2017-05-01 11:18:35 -07:00
Craig Michael Thompson
f39c4327fe feat: Add ES6 polyfill to examples page (#729)
* feat: Add ES6 polyfill to examples page

* Fixes issue with IE11 simply not displaying anything on load due to missing `Symbol` shim

* Move script to the bottom before build.prod.js file
2017-04-19 09:03:02 -07:00
Ian Storm Taylor
50593f9335 speed up decorator examples 2017-04-06 11:21:41 -07:00
Ian Storm Taylor
059ee96db8 a handful of performance improvements (#705)
* update large example

* pass block down to <Text> for performance, closes #700

* add get-ranges benchmark

* optimize getRanges(), closes #699

* add serialization benchmarks

* optimize Raw.deserializeRanges() by computing marks once, closes #701

* change .merge calls to .set for performance

* change updateDescendant() to use getAncestors() for memoization

* change getPath() to use getAncestors() for memoization

* switch getTexts() and friends to use arrays while iterating

* rename split-block benchmark

* update benchmark compare script
2017-04-02 14:57:36 -07:00
Ian Storm Taylor
2743348d65 add markdown example, fix selection handling with decorators 2017-03-30 14:12:56 -04:00
Ian Storm Taylor
b0adb9252c cleanup 2017-03-30 12:44:55 -04:00
Ian Storm Taylor
ef81dc856a fix check-lists example 2017-03-30 12:30:33 -04:00
AlbertHilb
f1b147860b Rewrite CheckListItem component. Only the area we really want to be editable (#696)
must lie inside contenteditable elements.
2017-03-30 10:35:01 -04:00
Ian Storm Taylor
6198708086 change selection updating logic to happen at the top-level, closes #662 2017-03-30 00:41:06 -04:00
Ian Storm Taylor
392fd75722 fix getPoint to work around in-editable content 2017-03-29 13:01:16 -04:00
Ian Storm Taylor
30c2b206fb add check list example 2017-03-28 12:55:48 -04:00
Ian Storm Taylor
1511d9f203 fix caching logic for onDocumentChange and onSelectionChange, fixes #614 #553 #538 2017-02-28 15:25:55 -08:00
Ian Storm Taylor
d7962240e1 fix scrolling to selection 2017-02-28 14:51:51 -08:00
Ian Storm Taylor
6a92f9384d add autoFocus support 2017-02-28 09:10:59 -08:00
Ian Storm Taylor
64b1e542b8 refactor the Selection model, deprecating old methods (#631)
* refactor Selection, deprecating old methods

* fix a few more things

* introduce an alternative for moveToOffsets

* add edge methods for move{start/end}OffsetTo

* fix selection return value

* fix deprecation warnings

* refactor transforms to make auto-generating easier

* refactor and deprecate selection transforms

* remove deprecation warnings from tests

* fix deprecation warnings in examples
2017-02-27 12:55:13 -08:00
Ian Storm Taylor
8f92ec6a6d fix linting 2017-02-25 12:55:31 -08:00
Per-Kristian Nordnes
c456c9dbe1 Image example: fix delete bug. Fixes #625 (#628)
As void-nodes now can be deleted, use a schema rule to normalize the document, and insert a paragraph when empty. Delete old "onDocumentChange" handler.
2017-02-25 12:50:52 -08:00
Ian Storm Taylor
c3578d12ad tighten linting rules 2017-02-25 10:13:21 -08:00
Kenneth Truong
8214641e75 Fix case in spellCheck (#592) 2017-02-13 16:30:48 -08:00
Anuj
44cef94b04 Fixing Readme and API docs (#579)
* Fix typo

just a minor typo in the docs!

* Fix typo in API docs

* Update focus-blur example readme to reflect the correct example

* Remove extra newline

* Correct Readme on the plugins example as well

* Correct readme for RTL example

* Fix own typo.

* Adding a Readme for the tables example
2017-02-03 08:21:32 -08:00
Sunny Hirai
189af27ec7 Updated examples to add GitHub and Docs link + some styling. (#531) 2016-12-25 21:18:39 -08:00
Sunny Hirai
dbef33a58f Reloading the page now also reloads the CSS. (#532) 2016-12-25 21:18:16 -08:00
Sunny Hirai
d56c0d8d95 Improve examples so that code changes propagate to browser (#527)
* Updated examples/dev.html so that the script would reload on a page refresh

* Made watch:examples verbose so we know when watchify has finished its work.
2016-12-16 18:19:48 -08:00
Ian Storm Taylor
0c12e95b21 fix dom selection normalizing for void nodes 2016-12-02 17:01:08 -08:00
Ian Storm Taylor
9d512580b7 add support for isShift on paste 2016-12-01 17:32:07 -08:00
Ian Storm Taylor
0dd3dee160 more emoji 2016-11-28 17:28:01 -08:00
Ian Storm Taylor
d99f9b6d78 update large document example 2016-11-23 09:05:15 -08:00
Ian Storm Taylor
d281140619 remove isRendering flag lock, closes #383 2016-11-18 13:33:12 -08:00
Ian Storm Taylor
6f67ac70c9 fix linting 2016-11-17 18:10:30 -08:00
Ian Storm Taylor
508d2b15b7 fix deprecate node access without key 2016-11-17 12:34:10 -08:00
Soreine
ade3c324bd Merge branch 'master' into schema-normalize 2016-11-17 10:27:47 +01:00
Ian Storm Taylor
3aff3cbf91 add focus-blur example 2016-11-16 17:25:27 -08:00
Soreine
944adc27fe Remove needless transform = transform.method() 2016-11-10 15:18:52 +01:00
Soreine
a319499f7c Enforce 2-spaces indentation 2016-11-10 11:04:49 +01:00
Samy Pessé
8bc8e45087 Add example for a large document 2016-11-03 10:39:40 +01:00
Soreine
ce0a5579e7 Remove a most of unused vars 2016-10-25 13:12:10 +02:00
Nicolas Gaborit
f87e4dc72b Remove old snapshot parameter for Transform.apply (#361) 2016-10-04 12:19:31 -07:00