Support handling fine-grained rich text values in the UI.
Review Request #6462 — Created Oct. 18, 2014 and submitted
Now that the models and API support fine-grained rich text values,
the UI needs to be updated to handle those.With this change, any plain-text fields will be auto-escaped for editing
in Markdown, and will then be saved as Markdown when the user saves the
field. This is the same behavior as before, but operates per-field,
instead of assuming all fields have the same rich text value.As part of this, the rich text states are now kept solely in the models.
There is no longer adata-rich-text=
attribute.There are some backwards-incompatible changes for extension writers.
Custom fields registered in JavaScript must now use theallowMarkdown
setting instead ofeditMarkdown
. They are also expected to take a
fourth option (calledfieldOptions
) informatter
, which must be
passed as an option toformatText
.This change does not yet provide compatibility for custom fields. That
will be covered in another change.
Tested editing every single editable field for all objects.
Tested with that field being in an initial state (new review requests,
new comments, new replies, etc.). Saved and saw that the rich_text field
was set.Tested with that field having rich_text=true. Saw that no escaping occurred.
Saved and saw that the rich_text field was set to true. Reloaded and saw that
the text was rendered as Markdown.Tested with that field having rich_text=false. Saw that escaping occurred.
Saved and saw that the rich_text field was set to true. Reloaded and saw that
the text was rendered as Markdown.Unit tests pass.
- Change Summary:
-
Fix Review Bot warnings.
- Commit:
-
57caa4ee5c22e8bc9f87ad1d0f15ce54e3f50b8c34cfb32d322a5533fa4dad41703fbcff7b555f78
- Diff:
-
Revision 2 (+130 -75)
-
Tool: Pyflakes Processed Files: reviewboard/reviews/fields.py reviewboard/reviews/templatetags/reviewtags.py reviewboard/reviews/context.py Ignored Files: reviewboard/static/rb/js/utils/textUtils.js reviewboard/templates/reviews/review_reply.html reviewboard/templates/reviews/boxes/review.html reviewboard/templates/reviews/reviewable_page_data.js reviewboard/static/rb/js/views/reviewRequestEditorView.js reviewboard/static/rb/js/views/reviewReplyEditorView.js reviewboard/templates/reviews/review_header.html reviewboard/static/rb/js/models/reviewReplyEditorModel.js reviewboard/templates/reviews/boxes/change.html reviewboard/static/rb/js/views/reviewDialogView.js reviewboard/static/rb/js/models/reviewRequestEditorModel.js reviewboard/static/rb/js/pages/views/reviewablePageView.js reviewboard/static/rb/js/views/tests/reviewRequestEditorViewTests.js Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/fields.py reviewboard/reviews/templatetags/reviewtags.py reviewboard/reviews/context.py Ignored Files: reviewboard/static/rb/js/utils/textUtils.js reviewboard/templates/reviews/review_reply.html reviewboard/templates/reviews/boxes/review.html reviewboard/templates/reviews/reviewable_page_data.js reviewboard/static/rb/js/views/reviewRequestEditorView.js reviewboard/static/rb/js/views/reviewReplyEditorView.js reviewboard/templates/reviews/review_header.html reviewboard/static/rb/js/models/reviewReplyEditorModel.js reviewboard/templates/reviews/boxes/change.html reviewboard/static/rb/js/views/reviewDialogView.js reviewboard/static/rb/js/models/reviewRequestEditorModel.js reviewboard/static/rb/js/pages/views/reviewablePageView.js reviewboard/static/rb/js/views/tests/reviewRequestEditorViewTests.js