8 Commits

Author SHA1 Message Date
Wyatt Allen
1678d988ae Addresses a gr-diff-highlight edge case
It was possible to cause a JS error when creating a ranged comment that
started at the very end of the first line (selecting no content on that
line). The relevant null-guard needed an additional set of parens to
avoid evaluating the second OR operand with a bad argument in this case.

Addresses the null-guard boolean expressions in `_normalizeStart` and
`_normalizeEnd` and reduces the number of calls to  `_getLength` from
thrice to once per iteration. Adds a relevant unit test.

Change-Id: I98848f9f6089fd3240bda175765770c9f9c5ba30
2016-07-01 13:25:41 -07:00
Viktar Donich
e88b612e29 Handle tabs for range comments
Changes:
- wrapping in HL now adds cssClass instead of discarding previous ones.
- getLength accounts for tab tags correctly.
- generic splitNode, potentially should be moved into util.
- more tests.

Feature: Issue 3915
Change-Id: Id8a646a5de4fd702aa112678c039df9ff8dd8c0b
2016-06-28 15:31:14 -07:00
Viktar Donich
b74a83162f Range comments select-to-create
Creates action box, that creates range comment on mouse down and hotkey
over selected text in diff. Makes best effort in guessing correct start
and end points for the selection.

Known issues listed as TODO items in test and code.

Feature: Issue 3915
Change-Id: I0a3e41d062e559c8cdb4b847829429f65622eb72
2016-06-27 10:21:27 -07:00
Viktar Donich
ea19586d19 Show comment ranges on render and context expand
Feature: Issue 3910
Change-Id: I9590d03b70e845b4f5ebe2f951f080ba3c9dc8db
2016-06-23 09:55:06 -07:00
Viktar Donich
3d6f8d695b Comment events wiring for ranged comments
Listen and update diff on comment events:
- call appropriate methods to apply comment ranges on comment creation
- re-render diff on and thread comment discard
- apply highlight on comment mouse over
- remove highlight on comment mouse out
- tests for all above

Feature: Issue 3910
Change-Id: I501ddcd063407777355b9c887118fcae53dcb5f1
2016-06-23 09:54:48 -07:00
Viktar Donich
d9b1f53a6a Apply range comments and highlights
Utility methods for applying comment range highlights to diff, with
tests including some of the corner cases.

Feature: Issue 3910
Change-Id: Id7de2dd4ff027ce96479a2d596e9414a0cadd6bf
2016-06-23 09:49:54 -07:00
Logan Hanks
d2497fbd09 Clean up lint under polygerrit-ui
This change cleans up all lint errors reported by gjslint,
with the exception of third-party code in the gr-linked-text
element and everything under bower_components:

$ gjslint --custom_jsdoc_tags event --check_html \
    -e bower_components,gr-linked-text -r app
Skipping 577 file(s).
181 files checked, no errors found.

Change-Id: I080d58bdd33b2d4b8dd22a717f06eebd7bbfb63d
2016-06-15 14:27:30 -07:00
Viktar Donich
ab1b211d80 Ranged highlights: initial commit
- Initial commit: structure, 'enabled' property controls sample
mouseDown handler.
- Minimal integration: isRangeSelected
- Minimal test.

Change-Id: I963ac7b158d57a1c24ee302d99eb6af26b0aeeeb
2016-06-13 14:38:08 -07:00