Review main Merged

51258[TASK] Extract broken links marker syntax for RTE

Benni Mack CR +2 V +2 Normal +92 −10 updated 01/11/17, 14:18

Commit message

The RTE parser has the following functionality:
- When transforming content from DB to RTE, and <link 13> tag references
a page that does not exist anymore, it adds an attribute rteerror="Page 13
does not exist" and style="background-color: yellow; border:2px red solid;
color: black;" to the then rendered <a> tag.

- When coming back from the RTE to the DB, the <a> tags that do not
contain a "rteerror" attribute but a style attribute are wrapped in
a <span> tag before transforming back to a <link> tag, since the
custom <link> tag cannot contain any other property than href,
class, target and title.
- If both "rteerror" and "style" attributes are still set, they get
removed again.

This approach has several downsides:
- Due to the limitation of the <link> tag an additional <span>
tag gets added to the database (!) which adds hard-coded
styling. The only way to remove this is to disallow "style"
attributes in "span" tags, or to manually remove the span
tags from the database.
- The transformation is not 1:1 the same / are not in sync.
So, if the editor changes the page ID of the broken link
from "13" to any other existing page, the span tag with the
yellow background is still added and kept.
- If the target page 13 gets added back via the recycler, the
span tag needs to be removed from the RTE content again
manually (in source code mode of the RTE)

Instead, the functionality to display broken links is now
handled differently:
- A new transformation "detectbrokenlinks" is added to the RTE
parser which checks all <a> tags with the new link service
class (thus, checks for all ! links not just <link> tags)
- The added attributes which are added to the <a> tag
is removed again (regardless if the link was fixed or not) when
saving the data again in the RTE thus leaving no ugly hard-coded
tags when rendering the content in the frontend, making sure that
content is clean in the database.
- The frontend is now only throwing a TS log message for the admin
panel (as before), and this should be the way to handle broken links
in the future.

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 1

Files 1