Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/diff/DiffChangesetList.js
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | construct: function() { | ||||
var onreply = JX.bind(this, this._ifawake, this._onaction, 'reply'); | var onreply = JX.bind(this, this._ifawake, this._onaction, 'reply'); | ||||
JX.Stratcom.listen( | JX.Stratcom.listen( | ||||
'click', | 'click', | ||||
['differential-inline-comment', 'differential-inline-reply'], | ['differential-inline-comment', 'differential-inline-reply'], | ||||
onreply); | onreply); | ||||
var onresize = JX.bind(this, this._ifawake, this._onresize); | var onresize = JX.bind(this, this._ifawake, this._onresize); | ||||
JX.Stratcom.listen('resize', null, onresize); | JX.Stratcom.listen('resize', null, onresize); | ||||
var onselect = JX.bind(this, this._ifawake, this._onselect); | |||||
JX.Stratcom.listen( | |||||
'mousedown', | |||||
['differential-inline-comment', 'differential-inline-header'], | |||||
onselect); | |||||
}, | }, | ||||
properties: { | properties: { | ||||
translations: null, | translations: null, | ||||
inlineURI: null | inlineURI: null | ||||
}, | }, | ||||
members: { | members: { | ||||
▲ Show 20 Lines • Show All 599 Lines • ▼ Show 20 Lines | _onhidereveal: function(e, is_hide) { | ||||
inline.setHidden(is_hide); | inline.setHidden(is_hide); | ||||
}, | }, | ||||
_onresize: function() { | _onresize: function() { | ||||
this._redrawFocus(); | this._redrawFocus(); | ||||
}, | }, | ||||
_onselect: function(e) { | |||||
// If the user clicked some element inside the header, like an action | |||||
// icon, ignore the event. They have to click the header element itself. | |||||
if (e.getTarget() !== e.getNode('differential-inline-header')) { | |||||
return; | |||||
} | |||||
var inline = this._getInlineForEvent(e); | |||||
if (!inline) { | |||||
return; | |||||
} | |||||
// The user definitely clicked an inline, so we're going to handle the | |||||
// event. | |||||
e.kill(); | |||||
var selection = this._getSelectionState(); | |||||
var item; | |||||
// If the comment the user clicked is currently selected, deselect it. | |||||
// This makes it easy to undo things if you clicked by mistake. | |||||
if (selection.cursor !== null) { | |||||
item = selection.items[selection.cursor]; | |||||
if (item.target === inline) { | |||||
this._setSelectionState(null); | |||||
return; | |||||
} | |||||
} | |||||
// Otherwise, select the item that the user clicked. This makes it | |||||
// easier to resume keyboard operations after using the mouse to do | |||||
// something else. | |||||
var items = selection.items; | |||||
for (var ii = 0; ii < items.length; ii++) { | |||||
item = items[ii]; | |||||
if (item.target === inline) { | |||||
this._setSelectionState(item); | |||||
} | |||||
} | |||||
}, | |||||
_onaction: function(action, e) { | _onaction: function(action, e) { | ||||
e.kill(); | e.kill(); | ||||
var inline = this._getInlineForEvent(e); | var inline = this._getInlineForEvent(e); | ||||
var is_ref = false; | var is_ref = false; | ||||
// If we don't have a natural inline object, the user may have clicked | // If we don't have a natural inline object, the user may have clicked | ||||
// an action (like "Delete") inside a preview element at the bottom of | // an action (like "Delete") inside a preview element at the bottom of | ||||
▲ Show 20 Lines • Show All 121 Lines • Show Last 20 Lines |