-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes some edge cases on entity selection #168
Fixes some edge cases on entity selection #168
Conversation
Hey @Alotor 👋 Thank you for reporting this and attempting a fix. I think I ran into similar issues in the past, but was never quite able to reproduce them consistently. Could you say more about the scenarios in which you detected these? Detailed reproduction steps / screen recordings would be even more valuable. |
👌 thank you, that's exactly what I needed. I'll have a look at the code as soon as I can. |
ce6e97c
to
ace3c14
Compare
ace3c14
to
95aa9dc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @Alotor! Took me a while to get back to this, but now it will be part of the next release.
This includes: - [v1.0.0](https://github.com/springload/draftail/releases/tag/v1.0.0) (identical to v0.17.2) - [v1.1.0](https://github.com/springload/draftail/releases/tag/v1.1.0) (contains fix for wagtail#4985) - [v1.2.0](https://github.com/springload/draftail/releases/tag/v1.2.0) Here is the combined CHANGELOG for what's relevant to Wagtail: - wagtail#4985 – Prevent crash when filtering pasted content whose last block is to be removed (e.g. unsupported image) ([wagtail#179](springload/draftail#179)). - Stop unnecessarily calling `onSave` in the editor’s `onBlur` ([wagtail#173](springload/draftail#173)). - Prevent crash in `DraftUtils.getEntitySelection`, when the provided entity key isn't valid (undefined, missing) ([wagtail#168](springload/draftail#168)). - Fix entity removal and editing not doing anything when the selection is backwards (right to left) ([wagtail#168](springload/draftail#168)). - Prevent the editor from crashing when copy-paste filtering removes all of its content (thibaudcolas/draftjs-filters@652750f) - Add support for Markdown shortcuts for inline styles, e.g. `**` for bold, `_` for italic, etc ([wagtail#134](springload/draftail#134), [wagtail#187](springload/draftail#187)). View the full list of [keyboard shortcuts](https://www.draftail.org/docs/keyboard-shortcuts). - Add [`onFocus`](https://www.draftail.org/docs/api#managing-focus) and [`onBlur`](https://www.draftail.org/docs/api#managing-focus) props to use callbacks on those events. This can be useful for [form validation](https://www.draftail.org/docs/next/form-validation). [wagtail#170](springload/draftail#170), [wagtail#174](springload/draftail#174), thanks to [@TheSpicyMeatball](https://github.com/TheSpicyMeatball). - Add [`plugins`](https://www.draftail.org/docs/plugins) API to support extensions of the editor using the [draft-js-plugins](https://github.com/draft-js-plugins/draft-js-plugins) architecture ([wagtail#83](springload/draftail#83), [wagtail#171](springload/draftail#171)). - Add ability to disable or customise the editor toolbar with [`topToolbar`](https://www.draftail.org/docs/customising-toolbars). - Add ability to add a toolbar below the editor with [`bottomToolbar`](https://www.draftail.org/docs/customising-toolbars). - Add data reset parameter to `DraftUtils.resetBlockWithType()`. - Enable list continuation on Enter for custom `*-list-item` blocks. All that’s required is for the block type to end with `-list-item`. None of those API additions will be usable within Wagtail (at least without hacks) until corresponding rich text features APIs are built to allow their configuration. The last 2 additions would already be usable but they would only be useful when leveraging the other APIs.
This includes: - [v1.0.0](https://github.com/springload/draftail/releases/tag/v1.0.0) (identical to v0.17.2) - [v1.1.0](https://github.com/springload/draftail/releases/tag/v1.1.0) (contains fix for wagtail#4985) - [v1.2.0](https://github.com/springload/draftail/releases/tag/v1.2.0) Here is the combined CHANGELOG for what's relevant to Wagtail: Bug fixes ~~~~~~~~~ - wagtail#4985 – Prevent crash when filtering pasted content whose last block is to be removed (e.g. unsupported image) ([wagtail#179](springload/draftail#179)). - Stop unnecessarily calling `onSave` in the editor’s `onBlur` ([wagtail#173](springload/draftail#173)). - Prevent crash in `DraftUtils.getEntitySelection`, when the provided entity key isn't valid (undefined, missing) ([wagtail#168](springload/draftail#168)). - Fix entity removal and editing not doing anything when the selection is backwards (right to left) ([wagtail#168](springload/draftail#168)). - Prevent the editor from crashing when copy-paste filtering removes all of its content (thibaudcolas/draftjs-filters@652750f) New features ~~~~~~~~~~~~ - Add support for Markdown shortcuts for inline styles, e.g. `**` for bold, `_` for italic, etc ([wagtail#134](springload/draftail#134), [wagtail#187](springload/draftail#187)). View the full list of [keyboard shortcuts](https://www.draftail.org/docs/keyboard-shortcuts). New APIs ~~~~~~~~ - Add [`onFocus`](https://www.draftail.org/docs/api#managing-focus) and [`onBlur`](https://www.draftail.org/docs/api#managing-focus) props to use callbacks on those events. This can be useful for [form validation](https://www.draftail.org/docs/next/form-validation). [wagtail#170](springload/draftail#170), [wagtail#174](springload/draftail#174), thanks to [@TheSpicyMeatball](https://github.com/TheSpicyMeatball). - Add [`plugins`](https://www.draftail.org/docs/plugins) API to support extensions of the editor using the [draft-js-plugins](https://github.com/draft-js-plugins/draft-js-plugins) architecture ([wagtail#83](springload/draftail#83), [wagtail#171](springload/draftail#171)). - Add ability to disable or customise the editor toolbar with [`topToolbar`](https://www.draftail.org/docs/customising-toolbars). - Add ability to add a toolbar below the editor with [`bottomToolbar`](https://www.draftail.org/docs/customising-toolbars). - Add data reset parameter to `DraftUtils.resetBlockWithType()`. - Enable list continuation on Enter for custom `*-list-item` blocks. All that’s required is for the block type to end with `-list-item`. None of those API additions will be usable within Wagtail (at least without hacks) until corresponding rich text features APIs are built to allow their configuration. The last 2 additions would already be usable but they would only be useful when leveraging the other APIs.
This includes: - [v1.0.0](https://github.com/springload/draftail/releases/tag/v1.0.0) (identical to v0.17.2) - [v1.1.0](https://github.com/springload/draftail/releases/tag/v1.1.0) (contains fix for wagtail#4985) - [v1.2.0](https://github.com/springload/draftail/releases/tag/v1.2.0) Here is the combined CHANGELOG for what's relevant to Wagtail: Bug fixes ~~~~~~~~~ - wagtail#4985 – Prevent crash when filtering pasted content whose last block is to be removed (e.g. unsupported image) ([wagtail#179](springload/draftail#179)). - Stop unnecessarily calling `onSave` in the editor’s `onBlur` ([wagtail#173](springload/draftail#173)). - Prevent crash in `DraftUtils.getEntitySelection`, when the provided entity key isn't valid (undefined, missing) ([wagtail#168](springload/draftail#168)). - Fix entity removal and editing not doing anything when the selection is backwards (right to left) ([wagtail#168](springload/draftail#168)). - Prevent the editor from crashing when copy-paste filtering removes all of its content (thibaudcolas/draftjs-filters@652750f) New features ~~~~~~~~~~~~ - Add support for Markdown shortcuts for inline styles, e.g. `**` for bold, `_` for italic, etc ([wagtail#134](springload/draftail#134), [wagtail#187](springload/draftail#187)). View the full list of [keyboard shortcuts](https://www.draftail.org/docs/keyboard-shortcuts). New APIs ~~~~~~~~ - Add [`onFocus`](https://www.draftail.org/docs/api#managing-focus) and [`onBlur`](https://www.draftail.org/docs/api#managing-focus) props to use callbacks on those events. This can be useful for [form validation](https://www.draftail.org/docs/next/form-validation). [wagtail#170](springload/draftail#170), [wagtail#174](springload/draftail#174), thanks to [@TheSpicyMeatball](https://github.com/TheSpicyMeatball). - Add [`plugins`](https://www.draftail.org/docs/plugins) API to support extensions of the editor using the [draft-js-plugins](https://github.com/draft-js-plugins/draft-js-plugins) architecture ([wagtail#83](springload/draftail#83), [wagtail#171](springload/draftail#171)). - Add ability to disable or customise the editor toolbar with [`topToolbar`](https://www.draftail.org/docs/customising-toolbars). - Add ability to add a toolbar below the editor with [`bottomToolbar`](https://www.draftail.org/docs/customising-toolbars). - Add data reset parameter to `DraftUtils.resetBlockWithType()`. - Enable list continuation on Enter for custom `*-list-item` blocks. All that’s required is for the block type to end with `-list-item`. None of those API additions will be usable within Wagtail (at least without hacks) until corresponding rich text features APIs are built to allow their configuration. The last 2 additions would already be usable but they would only be useful when leveraging the other APIs.
This includes: - [v1.0.0](https://github.com/springload/draftail/releases/tag/v1.0.0) (identical to v0.17.2) - [v1.1.0](https://github.com/springload/draftail/releases/tag/v1.1.0) (contains fix for wagtail#4985) - [v1.2.0](https://github.com/springload/draftail/releases/tag/v1.2.0) - [v1.2.1](https://github.com/springload/draftail/releases/tag/v1.2.1) (fixes regression in v1.2.0) Here is the combined CHANGELOG for what's relevant to Wagtail: Bug fixes ~~~~~~~~~ - wagtail#4985 – Prevent crash when filtering pasted content whose last block is to be removed (e.g. unsupported image) ([wagtail#179](springload/draftail#179)). - Stop unnecessarily calling `onSave` in the editor’s `onBlur` ([wagtail#173](springload/draftail#173)). - Prevent crash in `DraftUtils.getEntitySelection`, when the provided entity key isn't valid (undefined, missing) ([wagtail#168](springload/draftail#168)). - Fix entity removal and editing not doing anything when the selection is backwards (right to left) ([wagtail#168](springload/draftail#168)). - Prevent the editor from crashing when copy-paste filtering removes all of its content (thibaudcolas/draftjs-filters@652750f) New features ~~~~~~~~~~~~ - Add support for Markdown shortcuts for inline styles, e.g. `**` for bold, `_` for italic, etc ([wagtail#134](springload/draftail#134), [wagtail#187](springload/draftail#187)). View the full list of [keyboard shortcuts](https://www.draftail.org/docs/keyboard-shortcuts). New APIs ~~~~~~~~ - Add [`onFocus`](https://www.draftail.org/docs/api#managing-focus) and [`onBlur`](https://www.draftail.org/docs/api#managing-focus) props to use callbacks on those events. This can be useful for [form validation](https://www.draftail.org/docs/next/form-validation). [wagtail#170](springload/draftail#170), [wagtail#174](springload/draftail#174), thanks to [@TheSpicyMeatball](https://github.com/TheSpicyMeatball). - Add [`plugins`](https://www.draftail.org/docs/plugins) API to support extensions of the editor using the [draft-js-plugins](https://github.com/draft-js-plugins/draft-js-plugins) architecture ([wagtail#83](springload/draftail#83), [wagtail#171](springload/draftail#171)). - Add ability to disable or customise the editor toolbar with [`topToolbar`](https://www.draftail.org/docs/customising-toolbars). - Add ability to add a toolbar below the editor with [`bottomToolbar`](https://www.draftail.org/docs/customising-toolbars). - Add data reset parameter to `DraftUtils.resetBlockWithType()`. - Enable list continuation on Enter for custom `*-list-item` blocks. All that’s required is for the block type to end with `-list-item`. None of those API additions will be usable within Wagtail (at least without hacks) until corresponding rich text features APIs are built to allow their configuration. The last 2 additions would already be usable but they would only be useful when leveraging the other APIs.
This includes: - [v1.0.0](https://github.com/springload/draftail/releases/tag/v1.0.0) (identical to v0.17.2) - [v1.1.0](https://github.com/springload/draftail/releases/tag/v1.1.0) (contains fix for wagtail#4985) - [v1.2.0](https://github.com/springload/draftail/releases/tag/v1.2.0) - [v1.2.1](https://github.com/springload/draftail/releases/tag/v1.2.1) (fixes regression in v1.2.0) Here is the combined CHANGELOG for what's relevant to Wagtail: Bug fixes ~~~~~~~~~ - wagtail#4985 – Prevent crash when filtering pasted content whose last block is to be removed (e.g. unsupported image) ([wagtail#179](springload/draftail#179)). - Stop unnecessarily calling `onSave` in the editor’s `onBlur` ([wagtail#173](springload/draftail#173)). - Prevent crash in `DraftUtils.getEntitySelection`, when the provided entity key isn't valid (undefined, missing) ([wagtail#168](springload/draftail#168)). - Fix entity removal and editing not doing anything when the selection is backwards (right to left) ([wagtail#168](springload/draftail#168)). - Prevent the editor from crashing when copy-paste filtering removes all of its content (thibaudcolas/draftjs-filters@652750f) New features ~~~~~~~~~~~~ - Add support for Markdown shortcuts for inline styles, e.g. `**` for bold, `_` for italic, etc ([wagtail#134](springload/draftail#134), [wagtail#187](springload/draftail#187)). View the full list of [keyboard shortcuts](https://www.draftail.org/docs/keyboard-shortcuts). New APIs ~~~~~~~~ - Add [`onFocus`](https://www.draftail.org/docs/api#managing-focus) and [`onBlur`](https://www.draftail.org/docs/api#managing-focus) props to use callbacks on those events. This can be useful for [form validation](https://www.draftail.org/docs/next/form-validation). [wagtail#170](springload/draftail#170), [wagtail#174](springload/draftail#174), thanks to [@TheSpicyMeatball](https://github.com/TheSpicyMeatball). - Add [`plugins`](https://www.draftail.org/docs/plugins) API to support extensions of the editor using the [draft-js-plugins](https://github.com/draft-js-plugins/draft-js-plugins) architecture ([wagtail#83](springload/draftail#83), [wagtail#171](springload/draftail#171)). - Add ability to disable or customise the editor toolbar with [`topToolbar`](https://www.draftail.org/docs/customising-toolbars). - Add ability to add a toolbar below the editor with [`bottomToolbar`](https://www.draftail.org/docs/customising-toolbars). - Add data reset parameter to `DraftUtils.resetBlockWithType()`. - Enable list continuation on Enter for custom `*-list-item` blocks. All that’s required is for the block type to end with `-list-item`. None of those API additions will be usable within Wagtail (at least without hacks) until corresponding rich text features APIs are built to allow their configuration. The last 2 additions would already be usable but they would only be useful when leveraging the other APIs.
This includes: - [v1.0.0](https://github.com/springload/draftail/releases/tag/v1.0.0) (identical to v0.17.2) - [v1.1.0](https://github.com/springload/draftail/releases/tag/v1.1.0) (contains fix for wagtail#4985) - [v1.2.0](https://github.com/springload/draftail/releases/tag/v1.2.0) - [v1.2.1](https://github.com/springload/draftail/releases/tag/v1.2.1) (fixes regression in v1.2.0) Here is the combined CHANGELOG for what's relevant to Wagtail: Bug fixes ~~~~~~~~~ - wagtail#4985 – Prevent crash when filtering pasted content whose last block is to be removed (e.g. unsupported image) ([wagtail#179](springload/draftail#179)). - Stop unnecessarily calling `onSave` in the editor’s `onBlur` ([wagtail#173](springload/draftail#173)). - Prevent crash in `DraftUtils.getEntitySelection`, when the provided entity key isn't valid (undefined, missing) ([wagtail#168](springload/draftail#168)). - Fix entity removal and editing not doing anything when the selection is backwards (right to left) ([wagtail#168](springload/draftail#168)). - Prevent the editor from crashing when copy-paste filtering removes all of its content (thibaudcolas/draftjs-filters@652750f) New features ~~~~~~~~~~~~ - Add support for Markdown shortcuts for inline styles, e.g. `**` for bold, `_` for italic, etc ([wagtail#134](springload/draftail#134), [wagtail#187](springload/draftail#187)). View the full list of [keyboard shortcuts](https://www.draftail.org/docs/keyboard-shortcuts). New APIs ~~~~~~~~ - Add [`onFocus`](https://www.draftail.org/docs/api#managing-focus) and [`onBlur`](https://www.draftail.org/docs/api#managing-focus) props to use callbacks on those events. This can be useful for [form validation](https://www.draftail.org/docs/next/form-validation). [wagtail#170](springload/draftail#170), [wagtail#174](springload/draftail#174), thanks to [@TheSpicyMeatball](https://github.com/TheSpicyMeatball). - Add [`plugins`](https://www.draftail.org/docs/plugins) API to support extensions of the editor using the [draft-js-plugins](https://github.com/draft-js-plugins/draft-js-plugins) architecture ([wagtail#83](springload/draftail#83), [wagtail#171](springload/draftail#171)). - Add ability to disable or customise the editor toolbar with [`topToolbar`](https://www.draftail.org/docs/customising-toolbars). - Add ability to add a toolbar below the editor with [`bottomToolbar`](https://www.draftail.org/docs/customising-toolbars). - Add data reset parameter to `DraftUtils.resetBlockWithType()`. - Enable list continuation on Enter for custom `*-list-item` blocks. All that’s required is for the block type to end with `-list-item`. None of those API additions will be usable within Wagtail (at least without hacks) until corresponding rich text features APIs are built to allow their configuration. The last 2 additions would already be usable but they would only be useful when leveraging the other APIs.
This includes: - [v1.0.0](https://github.com/springload/draftail/releases/tag/v1.0.0) (identical to v0.17.2) - [v1.1.0](https://github.com/springload/draftail/releases/tag/v1.1.0) (contains fix for wagtail#4985) - [v1.2.0](https://github.com/springload/draftail/releases/tag/v1.2.0) - [v1.2.1](https://github.com/springload/draftail/releases/tag/v1.2.1) (fixes regression in v1.2.0) Here is the combined CHANGELOG for what's relevant to Wagtail: Bug fixes ~~~~~~~~~ - wagtail#4985 – Prevent crash when filtering pasted content whose last block is to be removed (e.g. unsupported image) ([wagtail#179](springload/draftail#179)). - Stop unnecessarily calling `onSave` in the editor’s `onBlur` ([wagtail#173](springload/draftail#173)). - Prevent crash in `DraftUtils.getEntitySelection`, when the provided entity key isn't valid (undefined, missing) ([wagtail#168](springload/draftail#168)). - Fix entity removal and editing not doing anything when the selection is backwards (right to left) ([wagtail#168](springload/draftail#168)). - Prevent the editor from crashing when copy-paste filtering removes all of its content (thibaudcolas/draftjs-filters@652750f) New features ~~~~~~~~~~~~ - Add support for Markdown shortcuts for inline styles, e.g. `**` for bold, `_` for italic, etc ([wagtail#134](springload/draftail#134), [wagtail#187](springload/draftail#187)). View the full list of [keyboard shortcuts](https://www.draftail.org/docs/keyboard-shortcuts). New APIs ~~~~~~~~ - Add [`onFocus`](https://www.draftail.org/docs/api#managing-focus) and [`onBlur`](https://www.draftail.org/docs/api#managing-focus) props to use callbacks on those events. This can be useful for [form validation](https://www.draftail.org/docs/next/form-validation). [wagtail#170](springload/draftail#170), [wagtail#174](springload/draftail#174), thanks to [@TheSpicyMeatball](https://github.com/TheSpicyMeatball). - Add [`plugins`](https://www.draftail.org/docs/plugins) API to support extensions of the editor using the [draft-js-plugins](https://github.com/draft-js-plugins/draft-js-plugins) architecture ([wagtail#83](springload/draftail#83), [wagtail#171](springload/draftail#171)). - Add ability to disable or customise the editor toolbar with [`topToolbar`](https://www.draftail.org/docs/customising-toolbars). - Add ability to add a toolbar below the editor with [`bottomToolbar`](https://www.draftail.org/docs/customising-toolbars). - Add data reset parameter to `DraftUtils.resetBlockWithType()`. - Enable list continuation on Enter for custom `*-list-item` blocks. All that’s required is for the block type to end with `-list-item`. None of those API additions will be usable within Wagtail (at least without hacks) until corresponding rich text features APIs are built to allow their configuration. The last 2 additions would already be usable but they would only be useful when leveraging the other APIs.
This includes: - [v1.0.0](https://github.com/springload/draftail/releases/tag/v1.0.0) (identical to v0.17.2) - [v1.1.0](https://github.com/springload/draftail/releases/tag/v1.1.0) (contains fix for wagtail#4985) - [v1.2.0](https://github.com/springload/draftail/releases/tag/v1.2.0) - [v1.2.1](https://github.com/springload/draftail/releases/tag/v1.2.1) (fixes regression in v1.2.0) Here is the combined CHANGELOG for what's relevant to Wagtail: Bug fixes ~~~~~~~~~ - wagtail#4985 – Prevent crash when filtering pasted content whose last block is to be removed (e.g. unsupported image) ([wagtail#179](springload/draftail#179)). - Stop unnecessarily calling `onSave` in the editor’s `onBlur` ([wagtail#173](springload/draftail#173)). - Prevent crash in `DraftUtils.getEntitySelection`, when the provided entity key isn't valid (undefined, missing) ([wagtail#168](springload/draftail#168)). - Fix entity removal and editing not doing anything when the selection is backwards (right to left) ([wagtail#168](springload/draftail#168)). - Prevent the editor from crashing when copy-paste filtering removes all of its content (thibaudcolas/draftjs-filters@652750f) New features ~~~~~~~~~~~~ - Add support for Markdown shortcuts for inline styles, e.g. `**` for bold, `_` for italic, etc ([wagtail#134](springload/draftail#134), [wagtail#187](springload/draftail#187)). View the full list of [keyboard shortcuts](https://www.draftail.org/docs/keyboard-shortcuts). New APIs ~~~~~~~~ - Add [`onFocus`](https://www.draftail.org/docs/api#managing-focus) and [`onBlur`](https://www.draftail.org/docs/api#managing-focus) props to use callbacks on those events. This can be useful for [form validation](https://www.draftail.org/docs/next/form-validation). [wagtail#170](springload/draftail#170), [wagtail#174](springload/draftail#174), thanks to [@TheSpicyMeatball](https://github.com/TheSpicyMeatball). - Add [`plugins`](https://www.draftail.org/docs/plugins) API to support extensions of the editor using the [draft-js-plugins](https://github.com/draft-js-plugins/draft-js-plugins) architecture ([wagtail#83](springload/draftail#83), [wagtail#171](springload/draftail#171)). - Add ability to disable or customise the editor toolbar with [`topToolbar`](https://www.draftail.org/docs/customising-toolbars). - Add ability to add a toolbar below the editor with [`bottomToolbar`](https://www.draftail.org/docs/customising-toolbars). - Add data reset parameter to `DraftUtils.resetBlockWithType()`. - Enable list continuation on Enter for custom `*-list-item` blocks. All that’s required is for the block type to end with `-list-item`. None of those API additions will be usable within Wagtail (at least without hacks) until corresponding rich text features APIs are built to allow their configuration. The last 2 additions would already be usable but they would only be useful when leveraging the other APIs.
…5117) This includes: - [v1.0.0](https://github.com/springload/draftail/releases/tag/v1.0.0) (identical to v0.17.2) - [v1.1.0](https://github.com/springload/draftail/releases/tag/v1.1.0) (contains fix for #4985) - [v1.2.0](https://github.com/springload/draftail/releases/tag/v1.2.0) - [v1.2.1](https://github.com/springload/draftail/releases/tag/v1.2.1) (fixes regression in v1.2.0) Here is the combined CHANGELOG for what's relevant to Wagtail: Bug fixes ~~~~~~~~~ - #4985 – Prevent crash when filtering pasted content whose last block is to be removed (e.g. unsupported image) ([#179](springload/draftail#179)). - Stop unnecessarily calling `onSave` in the editor’s `onBlur` ([#173](springload/draftail#173)). - Prevent crash in `DraftUtils.getEntitySelection`, when the provided entity key isn't valid (undefined, missing) ([#168](springload/draftail#168)). - Fix entity removal and editing not doing anything when the selection is backwards (right to left) ([#168](springload/draftail#168)). - Prevent the editor from crashing when copy-paste filtering removes all of its content (thibaudcolas/draftjs-filters@652750f) New features ~~~~~~~~~~~~ - Add support for Markdown shortcuts for inline styles, e.g. `**` for bold, `_` for italic, etc ([#134](springload/draftail#134), [#187](springload/draftail#187)). View the full list of [keyboard shortcuts](https://www.draftail.org/docs/keyboard-shortcuts). New APIs ~~~~~~~~ - Add [`onFocus`](https://www.draftail.org/docs/api#managing-focus) and [`onBlur`](https://www.draftail.org/docs/api#managing-focus) props to use callbacks on those events. This can be useful for [form validation](https://www.draftail.org/docs/next/form-validation). [#170](springload/draftail#170), [#174](springload/draftail#174), thanks to [@TheSpicyMeatball](https://github.com/TheSpicyMeatball). - Add [`plugins`](https://www.draftail.org/docs/plugins) API to support extensions of the editor using the [draft-js-plugins](https://github.com/draft-js-plugins/draft-js-plugins) architecture ([#83](springload/draftail#83), [#171](springload/draftail#171)). - Add ability to disable or customise the editor toolbar with [`topToolbar`](https://www.draftail.org/docs/customising-toolbars). - Add ability to add a toolbar below the editor with [`bottomToolbar`](https://www.draftail.org/docs/customising-toolbars). - Add data reset parameter to `DraftUtils.resetBlockWithType()`. - Enable list continuation on Enter for custom `*-list-item` blocks. All that’s required is for the block type to end with `-list-item`. None of those API additions will be usable within Wagtail (at least without hacks) until corresponding rich text features APIs are built to allow their configuration. The last 2 additions would already be usable but they would only be useful when leveraging the other APIs.
Hi!
This PR fixes some cases that we've detected in a production application using Draftail.
As you can see some are "null safety" checking. But we've found another issue when the user selected backwards the cursor wasn't right. This caused that when editing some custom entities the user input didn't match the one that we got on the state.
This is my first PR for the project so I hope I didn't forgot anything 😄
Thanks!