Skip to content
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

Copied content from Word Doc crashes Draftail/Wagtail #179

Closed
xfxf opened this issue Jan 9, 2019 · 2 comments · Fixed by #181
Closed

Copied content from Word Doc crashes Draftail/Wagtail #179

xfxf opened this issue Jan 9, 2019 · 2 comments · Fixed by #181
Assignees
Labels
bug Something isn't working
Milestone

Comments

@xfxf
Copy link

xfxf commented Jan 9, 2019

Copying and pasting the attached document (at least using Word for Mac version 16.15, but am fairly sure will do using Word for Windows too) into Draftail or Wagtail causes the editor to crash: "Oops. The editor just crashed." or "The editor just crashed. Content has been reset to the last saved version.".

This is reproducible in the latest version of Wagtail, as well as the editor at https://www.draftail.org/

I assume there is a wonky character or element here which Draftail/Draft.js isn't handling properly related to the anchored image (my expectation is Draftail/Wagtail should ignore the image, as it normally does), but copying the image only doesn't seem to make the editor crash, only when the text and image is copied in.

draftail-crash-elon-musk-article.docx

@xfxf xfxf changed the title Copied content fro, Word Doc crashes Draftail/Wagtail Copied content from Word Doc crashes Draftail/Wagtail Jan 9, 2019
@thibaudcolas thibaudcolas added the bug Something isn't working label Jan 10, 2019
@thibaudcolas thibaudcolas added this to the v1.1.0 milestone Jan 10, 2019
@thibaudcolas thibaudcolas self-assigned this Jan 10, 2019
@thibaudcolas
Copy link
Collaborator

👌 I have opened this at wagtail/wagtail#4985 as well so people following the Wagtail issue tracker are aware of the issue.

Copy-pasting my notes from Slack:

Thanks for reporting this @xfxf. It's caused by the image but I'm not entirely sure what's going wrong. At least it seems to be caused by Draftail, rather than Draft.js itself, so should be simple to fix once the issue is identified

The crash is due to Draftail trying to move the selection to the image block as if it was text after insertion. I'm not quite sure which of the filters (https://github.com/thibaudcolas/draftjs-filters/blob/008fe2c012d0157392feabf1572fe6232f5867e8/src/lib/filters/editor.js#L116-L136) fails to catch this. Or maybe they do catch it, but Draft.js doesn't update the selection to move to the block above.


@xfxf if you or anyone else wants to investigate this further, the first step is to create a failing test case with the "Draft.js output without filters" I pasted in thibaudcolas/draftjs-filters#27 as an input, and the same content without the atomic block as output. Then figure out why the block is kept by the filters.

@thibaudcolas
Copy link
Collaborator

@xfxf this should now be fixed in https://www.draftail.org/, if you have a moment to try and confirm that would help. Hopefully this will reach Wagtail as part of the v2.5 release.

thibaudcolas added a commit to thibaudcolas/wagtail that referenced this issue Mar 4, 2019
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.
thibaudcolas added a commit to thibaudcolas/wagtail that referenced this issue Mar 4, 2019
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.
thibaudcolas added a commit to thibaudcolas/wagtail that referenced this issue Mar 7, 2019
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.
thibaudcolas added a commit to thibaudcolas/wagtail that referenced this issue Mar 7, 2019
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.
thibaudcolas added a commit to thibaudcolas/wagtail that referenced this issue Mar 7, 2019
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.
thibaudcolas added a commit to thibaudcolas/wagtail that referenced this issue Mar 15, 2019
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.
thibaudcolas added a commit to thibaudcolas/wagtail that referenced this issue Mar 15, 2019
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.
thibaudcolas added a commit to thibaudcolas/wagtail that referenced this issue Mar 21, 2019
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.
thibaudcolas added a commit to wagtail/wagtail that referenced this issue Mar 21, 2019
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants