Cms: Matrix rich text field with embedded image forces 'do you want to leave' alerts

Created on 9 Nov 2017  路  9Comments  路  Source: craftcms/cms

Description

This one is very weird, but very repeatable -- with current Win Chrome browser -- and not Canary or Firefox. I've been seeing it constantly the last week or two, and took the time to track exactly what seems to instigate it. It's quite possibly a Redactor bug, but may have other connections.

Steps to reproduce

  1. I'm running Chrome Version 62.0.3202.89 (Official Build) (64-bit) where this happens
  2. Create an Entry with a Matrix field that has a Rich Text element.
  3. Edit this, and put in a little text. Save. You can leave the page as normal, with no warning.
  4. Edit again, drop down a line in the field, and insert an image from Craft assets. Save -- ctrl-S is fine.
  5. Click the Section breadcrumb to leave the Entry. You get an unexpected 'Do you want to leave this Site? Changes you made may not be saved.' dialog. That's the problem.
  6. You won't be able to avoid this until removing the embedded Image, and I think always saving _twice_. More pretty constent weirdness.
  7. I have seemed once in a while to avoid the problem by disabling the rich text, perhaps, but that may have been just the save twice business. I think I had already removed the picture, so that would fit, and now I can't seem to replicate this aspect.
  8. No data is ever lost if you just Leave from the dialog, even on a complex Entry -- of course provided it's the false one, since you did save.

Additional info

PHP version 7.1.7-1+ubuntu16.04.1+deb.sury.org+1
Database driver & version MySQL 5.7.19-0ubuntu0.16.04.1
Image driver & version GD 7.1.7-1+ubuntu16.04.1+deb.sury.org+1
Craft edition & version Craft Pro 3.0.0-beta.33
Yii version 2.0.13
Twig version 2.3.2
Guzzle version 6.2.1
Imagine version 0.7-dev
Plugins; yes but not any running in the Entry editor

bug minor

All 9 comments

Don't even think you need an image... I could reproduce as soon as a <br> tag was introduced in Redactor. Chrome 62.0.3202.89 on Win.

Wonderful...:trollface:

Good to hear I wasn't just visited by local gremlins, anyway.

Such fun, Brad -- cheers

p.s. agree it's minor -- we could even hope Chrome kids would fix it, if probably forlorn that...

Hi everyone!

We have similar problems but also in Firefox and Safari. And it's not related to images at all.

We have rich text fields and as soon we enter an entry page and try to leave it again, the prompt appears. The field's content just needs a simple line break.

If you remove $view->registerJs('new Craft.RichTextInput('.Json::encode($settings).');'); in fields/RichText.php the problem doesn't appear -> JS seems to convert tags in the textarea of the rich text field, which is a form change and causes the prompt.

Can't say if the JS is broken or PHP renders the value in an unexpected way.

Hope it can be fixed soon 馃憤

Some more informations:
The rendered markup will be converted via JS from

&lt;p&gt;xx&nbsp;&lt;a href="http://www.google.de"&gt;test&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;

to

<p>xx&nbsp;<a href="http://www.google.de">test</a><br></p>

=> Especially converting <br /> to <br> seems to be a problem

Able to reproduce this in Firefox. Redactor must just be initializing fast enough in Chrome that it's done tweaking HTML before Craft captures the initial form data. Will fix.

cheers, Brandon :)

@angrybrad @brandonkelly I'm seeing this issue a lot lately in our sites. Seems to happen with Redactor when there are a number of fields on a page. Can share a login with you through [email protected] on a couple of our staging environments? (all pretty recent Craft installs 3.3.x)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

angrybrad picture angrybrad  路  3Comments

angrybrad picture angrybrad  路  3Comments

mattstein picture mattstein  路  3Comments

angrybrad picture angrybrad  路  3Comments

darylknight picture darylknight  路  3Comments