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

Characters stripped when pasted into tinymce #3480

Open
RomanTheCube opened this issue Feb 10, 2017 · 5 comments
Open

Characters stripped when pasted into tinymce #3480

RomanTheCube opened this issue Feb 10, 2017 · 5 comments

Comments

@RomanTheCube
Copy link

We have found a bug relating to bullet points and decimal point numbers when pasting content into the TinyMCE editor.

If a bullet point is created in MS Word, and the value of 0.25 is written, eg:

  • 0.25

Then you copy this, and paste into the TinyMCE editor, the editor strips the "0." from what is pasted.

For an example, see attached image :
image

When you paste this content, it should retain the full content without stripping any characters.

@kknopp
Copy link

kknopp commented Jan 17, 2018

It actually strips off any value prior to the .. So 1.25 becomes 25 and 100.200 becomes 200.

@kknopp
Copy link

kknopp commented Jan 17, 2018

I've seen the above in version 4.7.2, but cannot reproduce on the website front page. What plug-ins are active on the front page so that we can see if one of them fixes it?

@tvanantwerp
Copy link

I've just observed this behavior when using the TinyMCE Advanced plugin (v4.7.11) on a WordPress site (v4.9.13). No other WordPress plugins that should affect the editor are active.

@tvanantwerp
Copy link

I suspect this is where the error lies. There's no code to say, "Oh, we see that this was an unordered bulleted list, so we don't need to also see if this is a numeric bulleted list."

@metricjs
Copy link
Contributor

metricjs commented Oct 30, 2020

Marking as verified as we can replicate this in 5.5. And, from a quick glance, I think you're right @tvanantwerp. Thanks for tracking that down!

aautio added a commit to aautio/tinymce that referenced this issue Mar 14, 2021
Fixes tinymce#2810, Fixes tinymce#3017, Fixes tinymce#3480, Fixes tinymce#5474

This commit includes fixes to multiple subtle errors in MS Word list
cleanups. The bugs caused any characters ending with a dot to disappear
from the lists under certain circumstances:

Font/style -changes cause multiple text nodes to appear as siblings in
the AST.

Function filterStyles marked only the first node with _listIgnore and
thus missed the nodes with roman numerals. This was fixed.

The removeIgnoredNodes-function used node.remove() to delete nodes
from the AST. The method sets node.next to null and thus recursion
did not proceed further. Sibling text nodes with _listIgnore would
not be deleted. This was fixed by avoiding node.remove().

The trimListStart -function did not trim the beginning of the
paragraph. It trimmed all text nodes instead and removed the ones with
words ending with dot. This was fixed by mering the paragraph
text nodes before trimming the first text node.

Regex for cleaning up the beginning is now safe. It no longer removes
any letters (with \w). Instead it only looks for certain bullets. One
regex is enough to filter those as the text nodes have been merged
before matching.

Added a couple of test cases as a proof that the fixes work correctly.
aautio added a commit to aautio/tinymce that referenced this issue Mar 15, 2021
Fixes tinymce#2810, Fixes tinymce#3017, Fixes tinymce#3480, Fixes tinymce#5474

This commit includes fixes to multiple subtle errors in MS Word list
cleanups. The bugs caused any characters ending with a dot to disappear
from the lists under certain circumstances:

Font/style -changes cause multiple text nodes to appear as siblings in
the AST.

Function filterStyles marked only the first node with _listIgnore and
thus missed the nodes with roman numerals. This was fixed.

The removeIgnoredNodes-function used node.remove() to delete nodes
from the AST. The method sets node.next to null and thus recursion
did not proceed further. Sibling text nodes with _listIgnore would
not be deleted. This was fixed by avoiding node.remove().

The trimListStart -function did not trim the beginning of the
paragraph. It trimmed all text nodes instead and removed the ones with
words ending with dot. This was fixed by mering the paragraph
text nodes before trimming the first text node.

Regex for cleaning up the beginning is now safe. It no longer removes
any letters (with \w). Instead it only looks for certain bullets. One
regex is enough to filter those as the text nodes have been merged
before matching.

Added a couple of test cases as a proof that the fixes work correctly.
aautio added a commit to aautio/tinymce that referenced this issue Mar 31, 2021
Fixes tinymce#2810, Fixes tinymce#3017, Fixes tinymce#3480, Fixes tinymce#5474

This commit includes fixes to multiple subtle errors in MS Word list
cleanups. The bugs caused any characters ending with a dot to disappear
from the lists under certain circumstances:

Font/style -changes cause multiple text nodes to appear as siblings in
the AST.

Function filterStyles marked only the first node with _listIgnore and
thus missed the nodes with roman numerals. This was fixed.

The removeIgnoredNodes-function used node.remove() to delete nodes
from the AST. The method sets node.next to null and thus recursion
did not proceed further. Sibling text nodes with _listIgnore would
not be deleted. This was fixed by avoiding node.remove().

The trimListStart -function did not trim the beginning of the
paragraph. It trimmed all text nodes instead and removed the ones with
words ending with dot. This was fixed by mering the paragraph
text nodes before trimming the first text node.

Regex for cleaning up the beginning is now safe. It no longer removes
any letters (with \w). Instead it only looks for certain bullets. One
regex is enough to filter those as the text nodes have been merged
before matching.

Added a couple of test cases as a proof that the fixes work correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants