Ticket #134 (assigned defect)

Opened 4 years ago

Last modified 3 years ago

removeEmptyTags - removes content

Reported by: straka Owned by: jf.hovinne
Priority: minor Milestone: 2.0
Component: editor Version: trunk
Keywords: removeEmptyTags, text corruption Cc:

Description

We have some really not great RTF files, which we are importing using copy/paste to wymeditor.

There is non-breakable space after preposition, and because the RTF files are not very good (export from QuarkPress) it sometimes produces (it's visible for example in OpenOffice toolbar that the space is really in italics)

z<em>&nbsp;</em>test

and the whole non-breakable space is removed by removeEmptyTags resulting into:

ztest

(so the space is removed) resulting into broken text. If I understand it correctly the removeEmptyTags method should remove tags which are "around" white space and thus are not necessary. So imho it should be:

return xhtml.replace(new RegExp('<('+this.block_tags.join("|")+')>(<br \/>|&#160;|&nbsp;|
s)*<\/
1>' ,'g'),'$2');

istead of:

return xhtml.replace(new RegExp('<('+this.block_tags.join("|")+')>(<br \/>|&#160;|&nbsp;|
s)*<\/
1>' ,'g'),);

Change History

comment:1 Changed 4 years ago by jf.hovinne

  • Status changed from new to assigned

Your proposal doesn't seem to be an option since cases like:

<p>Some text</p>
<p>&nbsp;</p>

Will output:

<p>Some text</p>&nbsp;

Instead of:

<p>Some text</p>

I don't see any solution ATM, since your issue is quite specific (you could override the removeEmptyTags function, but it's not ideal).

FYI we'll improve the events architecture in the next version, so it'll be possible to hook custom code into e.g. the copy/paste logic.

comment:2 Changed 3 years ago by mr_lundis

  • Priority changed from major to minor
  • Milestone set to 0.6
Note: See TracTickets for help on using tickets.