Differential D12033 Diff 29183 webroot/rsrc/js/application/differential/behavior-edit-inline-comments.js
Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/differential/behavior-edit-inline-comments.js
| Show First 20 Lines • Show All 320 Lines • ▼ Show 20 Lines | if (JX.Stratcom.hasSigil(node, 'differential-inline-comment-preview')) { | ||||
| node = nodes[ii]; | node = nodes[ii]; | ||||
| data = node_data; | data = node_data; | ||||
| found = true; | found = true; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| if (!found) { | if (!found) { | ||||
| switch (op) { | |||||
| case 'delete': | |||||
| new JX.DifferentialInlineCommentEditor(config.uri) | new JX.DifferentialInlineCommentEditor(config.uri) | ||||
| .deleteByID(data.id); | .deleteByID(data.id); | ||||
| return; | return; | ||||
| } | } | ||||
| } | |||||
| if (op == 'delete') { | |||||
| op = 'refdelete'; | op = 'refdelete'; | ||||
| } | } | ||||
| } | |||||
| if (op == 'done') { | |||||
| var checkbox = JX.DOM.find(node, 'input', 'differential-inline-done'); | |||||
| new JX.DifferentialInlineCommentEditor(config.uri) | |||||
| .toggleCheckbox(data.id, checkbox); | |||||
| return; | |||||
| } | |||||
| var original = data.original; | var original = data.original; | ||||
| var reply_phid = null; | var reply_phid = null; | ||||
| if (op == 'reply') { | if (op == 'reply') { | ||||
| // If the user hit "reply", the original text is empty (a new reply), not | // If the user hit "reply", the original text is empty (a new reply), not | ||||
| // the text of the comment they're replying to. | // the text of the comment they're replying to. | ||||
| original = ''; | original = ''; | ||||
| reply_phid = data.phid; | reply_phid = data.phid; | ||||
| Show All 19 Lines | editor = new JX.DifferentialInlineCommentEditor(config.uri) | ||||
| .setTable(row.parentNode) | .setTable(row.parentNode) | ||||
| .setReplyToCommentPHID(reply_phid) | .setReplyToCommentPHID(reply_phid) | ||||
| .setRenderer(view.getRenderer()) | .setRenderer(view.getRenderer()) | ||||
| .start(); | .start(); | ||||
| set_link_state(true); | set_link_state(true); | ||||
| }; | }; | ||||
| for (var op in {'edit' : 1, 'delete' : 1, 'reply' : 1}) { | for (var op in {'edit': 1, 'delete': 1, 'reply': 1, 'done': 1}) { | ||||
| JX.Stratcom.listen( | JX.Stratcom.listen( | ||||
| 'click', | 'click', | ||||
| ['differential-inline-comment', 'differential-inline-' + op], | ['differential-inline-comment', 'differential-inline-' + op], | ||||
| JX.bind(null, action_handler, op)); | JX.bind(null, action_handler, op)); | ||||
| } | } | ||||
| JX.Stratcom.listen( | JX.Stratcom.listen( | ||||
| 'differential-inline-action', | 'differential-inline-action', | ||||
| null, | null, | ||||
| function(e) { | function(e) { | ||||
| var data = e.getData(); | var data = e.getData(); | ||||
| handle_inline_action(data.node, data.op); | handle_inline_action(data.node, data.op); | ||||
| }); | }); | ||||
| }); | }); | ||||