tinymce icon indicating copy to clipboard operation
tinymce copied to clipboard

A <p>&nbsp;</p> is added after each line that contains a matched protect (regex) value

Open JeroenKurvink opened this issue 3 years ago • 5 comments

What is the current behavior? Describe the bug A protect was added to ignore the in tinymce. The protect works but after each line it adds a

when switching to source code view again.

protect: [/.(<![\s\S]?-->)/g]

<!-- comment -->
<!-- comment2 -->
<!-- comment3 -->

becomes

<!-- comment -->
<p>&nbsp;</p>
<!-- comment2 -->
<p>&nbsp;</p>
<!-- comment3 -->

Please provide the steps to reproduce and if possible a minimal demo of the problem via fiddle.tiny.cloud or similar.

https://fiddle.tiny.cloud/NThaab

  1. add the following in the source code view
<!-- comment -->
<!-- comment2 -->
<!-- comment3 -->
  1. close the source code view
  2. open the source code view

What is the expected behavior?

<!-- comment -->
<!-- comment2 -->
<!-- comment3 -->

stays

<!-- comment -->
<!-- comment2 -->
<!-- comment3 -->

Which versions of TinyMCE, and which browser / OS are affected by this issue? Did this work in previous versions of TinyMCE?

Im using 5.10.2 and tested this in chrome Version 97.0.4692.71 (Official Build) (64-bit). I don't know if this worked in previous versions

JeroenKurvink avatar Jan 17 '22 14:01 JeroenKurvink

Same thing happening for me on 5.10.3.

Yuzmi avatar Feb 10 '22 15:02 Yuzmi

Hello @JeroenKurvink

Thank you for the report. This appears to be a bug. There is a workaround however if you use /.*<!([\s\S]*?)-->\n?/g in the protect field then you will get the behavior you want.

hamza0867 avatar May 06 '22 07:05 hamza0867

This issue is stale because it has been open 365 days with no activity. Please comment if you wish to keep this issue open or it will be closed in 30 days.

tiny-stale-bot avatar May 14 '24 01:05 tiny-stale-bot

This is still happening. The protect is unrelated/doesn't work, the paragraph tags are still being inserted between comments in TinyMCE 7.x.

The only way to avoid it is to have the comments on the same line.

Petercopter avatar Jun 12 '24 18:06 Petercopter

This issue is stale because it has been open 365 days with no activity. Please comment if you wish to keep this issue open or it will be closed in 30 days.

tiny-stale-bot avatar Jun 13 '25 00:06 tiny-stale-bot

This issue was closed because it has been stalled for 30 days with no activity.

tiny-stale-bot avatar Jul 14 '25 00:07 tiny-stale-bot