Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14915825
D17916.id43097.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
8 KB
Referenced Files
None
Subscribers
None
D17916.id43097.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -12,8 +12,8 @@
'core.pkg.css' => 'ee5f28cd',
'core.pkg.js' => '8c5f913d',
'darkconsole.pkg.js' => '1f9a31bc',
- 'differential.pkg.css' => '7b1c772c',
- 'differential.pkg.js' => 'f1b636fb',
+ 'differential.pkg.css' => '4ff77743',
+ 'differential.pkg.js' => '85543704',
'diffusion.pkg.css' => 'b93d9b8c',
'diffusion.pkg.js' => '84c8f8fd',
'favicon.ico' => '30672e08',
@@ -66,7 +66,7 @@
'rsrc/css/application/differential/add-comment.css' => 'c47f8c40',
'rsrc/css/application/differential/changeset-view.css' => '69a3c268',
'rsrc/css/application/differential/core.css' => '5b7b8ff4',
- 'rsrc/css/application/differential/phui-inline-comment.css' => 'e0a2b52e',
+ 'rsrc/css/application/differential/phui-inline-comment.css' => 'ffd1a542',
'rsrc/css/application/differential/revision-comment.css' => '14b8565a',
'rsrc/css/application/differential/revision-history.css' => '0e8eb855',
'rsrc/css/application/differential/revision-list.css' => 'f3c47d33',
@@ -392,7 +392,7 @@
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63',
'rsrc/js/application/diff/DiffChangeset.js' => 'c5742feb',
'rsrc/js/application/diff/DiffChangesetList.js' => 'f1101e6e',
- 'rsrc/js/application/diff/DiffInline.js' => 'bdf6b568',
+ 'rsrc/js/application/diff/DiffInline.js' => 'a81c29d4',
'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832',
'rsrc/js/application/differential/behavior-comment-preview.js' => 'b064af76',
'rsrc/js/application/differential/behavior-diff-radios.js' => 'e1ff79b1',
@@ -781,7 +781,7 @@
'phabricator-dashboard-css' => 'fe5b1869',
'phabricator-diff-changeset' => 'c5742feb',
'phabricator-diff-changeset-list' => 'f1101e6e',
- 'phabricator-diff-inline' => 'bdf6b568',
+ 'phabricator-diff-inline' => 'a81c29d4',
'phabricator-drag-and-drop-file-upload' => '58dea2fa',
'phabricator-draggable-list' => 'bea6e7f4',
'phabricator-fatal-config-template-css' => '8f18fa41',
@@ -864,7 +864,7 @@
'phui-image-mask-css' => 'a8498f9c',
'phui-info-panel-css' => '27ea50a1',
'phui-info-view-css' => '6e217679',
- 'phui-inline-comment-view-css' => 'e0a2b52e',
+ 'phui-inline-comment-view-css' => 'ffd1a542',
'phui-invisible-character-view-css' => '6993d9f0',
'phui-lightbox-css' => '0a035e40',
'phui-list-view-css' => '12eb8ce6',
@@ -1718,6 +1718,9 @@
'javelin-stratcom',
'javelin-dom',
),
+ 'a81c29d4' => array(
+ 'javelin-dom',
+ ),
'a8beebea' => array(
'phui-oi-list-view-css',
),
@@ -1872,9 +1875,6 @@
'javelin-util',
'javelin-request',
),
- 'bdf6b568' => array(
- 'javelin-dom',
- ),
'bea6e7f4' => array(
'javelin-install',
'javelin-dom',
diff --git a/webroot/rsrc/css/application/differential/phui-inline-comment.css b/webroot/rsrc/css/application/differential/phui-inline-comment.css
--- a/webroot/rsrc/css/application/differential/phui-inline-comment.css
+++ b/webroot/rsrc/css/application/differential/phui-inline-comment.css
@@ -318,11 +318,10 @@
.differential-inline-undo {
padding: 8px;
- margin: 8px 12px;
+ margin: 4px 12px;
text-align: center;
background: {$sh-yellowbackground};
border: 1px solid {$sh-yellowborder};
- margin: 4px 0;
color: {$darkgreytext};
font: {$basefont};
font-size: {$normalfontsize};
@@ -396,7 +395,6 @@
background: {$lightgreybackground};
padding: 2px 16px;
color: {$lightgreytext};
- font-size: {$smallerfontsize};
display: none;
font: {$basefont};
white-space: nowrap;
diff --git a/webroot/rsrc/js/application/diff/DiffInline.js b/webroot/rsrc/js/application/diff/DiffInline.js
--- a/webroot/rsrc/js/application/diff/DiffInline.js
+++ b/webroot/rsrc/js/application/diff/DiffInline.js
@@ -25,6 +25,7 @@
_isNewFile: null,
_undoRow: null,
_replyToCommentPHID: null,
+ _originalText: null,
_isDeleted: false,
_isInvisible: false,
@@ -57,6 +58,7 @@
this._number = data.number;
this._length = data.length;
+ this._originalText = data.original;
this._isNewFile =
(this.getDisplaySide() == 'right') ||
(data.left != data.right);
@@ -165,6 +167,8 @@
this._phid = null;
this._hidden = false;
+ this._originalText = null;
+
return row;
},
@@ -231,10 +235,10 @@
this._didUpdate();
},
- create: function() {
+ create: function(text) {
var uri = this._getInlineURI();
var handler = JX.bind(this, this._oncreateresponse);
- var data = this._newRequestData('new');
+ var data = this._newRequestData('new', text);
this.setLoading(true);
@@ -248,10 +252,10 @@
return changeset.newInlineReply(this);
},
- edit: function() {
+ edit: function(text) {
var uri = this._getInlineURI();
var handler = JX.bind(this, this._oneditresponse);
- var data = this._newRequestData('edit');
+ var data = this._newRequestData('edit', text || null);
this.setLoading(true);
@@ -336,7 +340,7 @@
return this;
},
- _newRequestData: function(operation) {
+ _newRequestData: function(operation, text) {
return {
op: operation,
id: this._id,
@@ -347,6 +351,7 @@
is_new: this.isNewFile(),
changesetID: this.getChangesetID(),
replyToCommentPHID: this.getReplyToCommentPHID() || '',
+ text: text || ''
};
},
@@ -366,7 +371,7 @@
},
_ondeleteresponse: function() {
- this._drawUndoRows();
+ this._drawUndeleteRows();
this.setLoading(false);
this.setDeleted(true);
@@ -374,7 +379,15 @@
this._didUpdate();
},
- _drawUndoRows: function() {
+ _drawUndeleteRows: function() {
+ return this._drawUndoRows('undelete', this._row);
+ },
+
+ _drawUneditRows: function(text) {
+ return this._drawUndoRows('unedit', null, text);
+ },
+
+ _drawUndoRows: function(mode, cursor, text) {
var templates = this.getChangeset().getUndoTemplates();
var template;
@@ -385,14 +398,14 @@
}
template = JX.$H(template).getNode();
- this._undoRow = this._drawRows(template, this._row, 'undo');
+ this._undoRow = this._drawRows(template, cursor, mode, text);
},
_drawEditRows: function(rows) {
return this._drawRows(rows, null, 'edit');
},
- _drawRows: function(rows, cursor, type) {
+ _drawRows: function(rows, cursor, type, text) {
var first_row = JX.DOM.scry(rows, 'tr')[0];
var first_meta;
var row = first_row;
@@ -410,6 +423,7 @@
var row_meta = {
node: row,
type: type,
+ text: text || null,
listeners: []
};
@@ -476,16 +490,26 @@
this._removeRow(row);
- var uri = this._getInlineURI();
- var data = this._newRequestData('undelete');
- var handler = JX.bind(this, this._onundelete);
+ if (row.type == 'undelete') {
+ var uri = this._getInlineURI();
+ var data = this._newRequestData('undelete');
+ var handler = JX.bind(this, this._onundelete);
- this.setDeleted(false);
- this.setLoading(true);
+ this.setDeleted(false);
+ this.setLoading(true);
- new JX.Request(uri, handler)
- .setData(data)
- .send();
+ new JX.Request(uri, handler)
+ .setData(data)
+ .send();
+ }
+
+ if (row.type == 'unedit') {
+ if (this.getID()) {
+ this.edit(row.text);
+ } else {
+ this.create(row.text);
+ }
+ }
},
_onundelete: function() {
@@ -496,13 +520,30 @@
_oncancel: function(row, e) {
e.kill();
- // TODO: Capture edited text and offer "undo".
+ var text = this._readText(row.node);
+ if (text && text.length && (text != this._originalText)) {
+ this._drawUneditRows(text);
+ }
this._removeRow(row);
this.setInvisible(false);
},
+ _readText: function(row) {
+ var textarea;
+ try {
+ textarea = JX.DOM.find(
+ row,
+ 'textarea',
+ 'differential-inline-comment-edit-textarea');
+ } catch (ex) {
+ return null;
+ }
+
+ return textarea.value;
+ },
+
_onsubmitresponse: function(row, response) {
this._removeRow(row);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Feb 13, 9:44 PM (18 h, 16 s)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7125498
Default Alt Text
D17916.id43097.diff (8 KB)
Attached To
Mode
D17916: Allow cancelled inlines, edits, and replies to be undone to get the text back again
Attached
Detach File
Event Timeline
Log In to Comment