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

Fixes content getting deleted when saving an RTE before it's fully loaded #3023

Merged
merged 1 commit into from Sep 25, 2018

Conversation

UEDevs
Copy link

@UEDevs UEDevs commented Sep 24, 2018

It's possible to save content while the rich text editors (RTE) are still loading. This wouldn't be a problem but the RTEController currently checks if the editor object exists and then sets the model value to null if it doesn't! This fix simply leaves the model value alone if the editor is still null or undefined.

The easiest way to reproduce the current issue is as follows:

  1. Create a document type with a required RTE field.
  2. Create a content item from that document type.
  3. Add some content to the RTE field and save the content item.
  4. Reload the page and try to save the content item while the RTE is still loading (don't actually edit anything).
  5. Keep reloading and saving until the content in the RTE field gets removed and you get the warning saying that the "Value cannot be empty".

It can be quite hard to trigger the problem each time but hitting save while the "loading..." text is there but there's no editor or textarea should do it.

This issue was logged on the old issue tracker as U4-11302 but doesn't seem to have been copied over to GitHub.

@abjerner
Copy link
Contributor

@UEDevs thanks for taking the time two create a PR for this 👍

I will give your changes a spin and report back what I find. But with a quick look at the change, it shouldn't be a problem getting this merged ;)

Anders, Community Pull Request team

@abjerner abjerner self-requested a review September 24, 2018 12:22
@nul800sebastiaan
Copy link
Member

Hi there @UEDevs - and congrats on your first PR to Umbraco CMS! 👍

I will merge this one in as it makes it a little better, but unfortunately it is not a full fix. I can still reproduce the actual problem by opening the dev tools and simulating a slow 3G connection. As soon as you see the RTE loading as a textarea (with plain HTML and without the RTE toolbar etc.) and you his the Save & Publish button the HTML disappears and it saves an empty value.

It was, however, no longer possible to get this result on a fast connection where I was able to replicate it twice before. So this helps! 😄

If you happen to have a profile on Our Umbraco then send me a link to your public profile, I would like to give you a contributor badge. 🏅

@nul800sebastiaan nul800sebastiaan merged commit c44a22d into umbraco:dev-v7 Sep 25, 2018
@UEDevs
Copy link
Author

UEDevs commented Sep 26, 2018

Hi @nul800sebastiaan,

Thanks for merging our request! Annoying that there are still problems with this but your investigations have at least narrowed it down a bit. We'll see if we can spend some more time investigating a full fix.

I've set us up a profile on Our Umbraco: https://our.umbraco.com/member/275444

Jim, Urban Element

@UEDevs UEDevs deleted the temp-U4-11302 branch September 26, 2018 09:30
@nul800sebastiaan
Copy link
Member

It would be awesome if you could find an even better fix Jim! 💯

Congrats on your contributor badge! https://our.umbraco.com/member/275444 🏅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants