Current location - Recipe Complete Network - Complete breakfast recipes - A simple way to compare rich text
A simple way to compare rich text

Summary

For some more troublesome problems that are not technically proficient in the main line business, professional open source plug-ins can be considered to assist in solving them

Background

The platform needs to strengthen the control of the performance content released by the organizer to avoid unfriendly information being presented to users

The existing system can check standardized changes such as changes in the performance lineup, adjustments to the performance time, etc., but the performance introduction is through Rich text is displayed. For a long time, the system did not support detecting changes in rich text (edited through UEditor in the background). Early implementation ideas tended to independently identify the changed parts, but there were many scenarios (the position of a certain text was changed, the font was bolded) Highlighting, new content between two parts, etc.) were not easy to implement and were shelved. Then use the third-party plug-in HtmlDiff to achieve the goal conveniently

Compare content

Combined with the rich text changes that the operation is actually concerned about, the system needs to support:

Text change detection : This can be achieved with the help of plug-ins

Image change detection: Convert to image address for text comparison

iFrame (embedded video, music, etc.) change detection: Treat source code as text comparison< /p>

Changes in style, layout, etc. are not detected and are subject to human judgment

When the host finally submits the performance editing form, any inconsistency between the rich text content and the original text content will be deemed to have been changed.

In this way, the management backend will compare the original text and the new text through the plug-in

Comparison effect

The new text and the original text will be displayed normally, and the pictures and iFrames will be specially processed into text and marked with differences

p>