Support handling fine-grained rich text values in the UI.

Review Request #6462 — Created Oct. 18, 2014 and submitted

Information

Review Board
release-2.0.x
34cfb32...

Reviewers

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 a data-rich-text= attribute.

There are some backwards-incompatible changes for extension writers.
Custom fields registered in JavaScript must now use the allowMarkdown
setting instead of editMarkdown. They are also expected to take a
fourth option (called fieldOptions) in formatter, which must be
passed as an option to formatText.

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.

Description From Last Updated

'escape' imported but unused

reviewbotreviewbot

Col: 80 E501 line too long (80 > 79 characters)

reviewbotreviewbot

Can you add a blank line in here?

daviddavid
reviewbot
  1. 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
    
    
  2. reviewboard/reviews/context.py (Diff revision 1)
     
     
    Show all issues
     'escape' imported but unused
    
  3. reviewboard/reviews/context.py (Diff revision 1)
     
     
    Show all issues
    Col: 80
     E501 line too long (80 > 79 characters)
    
  4. 
      
chipx86
reviewbot
  1. 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
    
    
  2. 
      
david
  1. 
      
  2. reviewboard/static/rb/js/utils/textUtils.js (Diff revision 2)
     
     
     
    Show all issues

    Can you add a blank line in here?

  3. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to markdown-redesign (dbd7918)