mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-28 17:52:43 +01:00
Make inline "ContentState" a client object, and track "hasSuggestion" on it
Summary: Ref T13559. In an effort to ultimately fix the "quote + cancel" bug, begin formalizing content states on the client. This creates a "ContentState" client object and moves the authoritative storage for the "hasSuggestion" property to it. Test Plan: Created inlines, etc. See followups. Maniphest Tasks: T13559 Differential Revision: https://secure.phabricator.com/D21645
This commit is contained in:
parent
87c6c270b4
commit
b964731b6a
4 changed files with 48 additions and 9 deletions
|
@ -13,7 +13,7 @@ return array(
|
|||
'core.pkg.js' => 'ab3502fe',
|
||||
'dark-console.pkg.js' => '187792c2',
|
||||
'differential.pkg.css' => 'ffb69e3d',
|
||||
'differential.pkg.js' => 'd1150814',
|
||||
'differential.pkg.js' => '5e0c7197',
|
||||
'diffusion.pkg.css' => '42c75c37',
|
||||
'diffusion.pkg.js' => '78c9885d',
|
||||
'maniphest.pkg.css' => '35995d6d',
|
||||
|
@ -385,7 +385,8 @@ return array(
|
|||
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => '0116d3e8',
|
||||
'rsrc/js/application/diff/DiffChangeset.js' => 'd7d3ba75',
|
||||
'rsrc/js/application/diff/DiffChangesetList.js' => 'cc2c5de5',
|
||||
'rsrc/js/application/diff/DiffInline.js' => '511a1315',
|
||||
'rsrc/js/application/diff/DiffInline.js' => '09e0c6e5',
|
||||
'rsrc/js/application/diff/DiffInlineContentState.js' => 'cb9e5396',
|
||||
'rsrc/js/application/diff/DiffPathView.js' => '8207abf9',
|
||||
'rsrc/js/application/diff/DiffTreeView.js' => '5d83623b',
|
||||
'rsrc/js/application/differential/behavior-diff-radios.js' => '925fe8cd',
|
||||
|
@ -787,7 +788,8 @@ return array(
|
|||
'phabricator-dashboard-css' => '5a205b9d',
|
||||
'phabricator-diff-changeset' => 'd7d3ba75',
|
||||
'phabricator-diff-changeset-list' => 'cc2c5de5',
|
||||
'phabricator-diff-inline' => '511a1315',
|
||||
'phabricator-diff-inline' => '09e0c6e5',
|
||||
'phabricator-diff-inline-content-state' => 'cb9e5396',
|
||||
'phabricator-diff-path-view' => '8207abf9',
|
||||
'phabricator-diff-tree-view' => '5d83623b',
|
||||
'phabricator-drag-and-drop-file-upload' => '4370900d',
|
||||
|
@ -998,6 +1000,10 @@ return array(
|
|||
'herald-rule-editor',
|
||||
'javelin-behavior',
|
||||
),
|
||||
'09e0c6e5' => array(
|
||||
'javelin-dom',
|
||||
'phabricator-diff-inline-content-state',
|
||||
),
|
||||
'0ad8d31f' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-stratcom',
|
||||
|
@ -1399,9 +1405,6 @@ return array(
|
|||
'javelin-stratcom',
|
||||
'javelin-dom',
|
||||
),
|
||||
'511a1315' => array(
|
||||
'javelin-dom',
|
||||
),
|
||||
'5202e831' => array(
|
||||
'javelin-install',
|
||||
'javelin-dom',
|
||||
|
@ -2086,6 +2089,9 @@ return array(
|
|||
'javelin-workflow',
|
||||
'javelin-json',
|
||||
),
|
||||
'cb9e5396' => array(
|
||||
'javelin-dom',
|
||||
),
|
||||
'cc2c5de5' => array(
|
||||
'javelin-install',
|
||||
'phuix-button-view',
|
||||
|
@ -2441,6 +2447,7 @@ return array(
|
|||
'javelin-behavior-phabricator-object-selector',
|
||||
'javelin-behavior-repository-crossreference',
|
||||
'javelin-behavior-aphront-more',
|
||||
'phabricator-diff-inline-content-state',
|
||||
'phabricator-diff-inline',
|
||||
'phabricator-diff-changeset',
|
||||
'phabricator-diff-changeset-list',
|
||||
|
|
|
@ -212,6 +212,7 @@ return array(
|
|||
|
||||
'javelin-behavior-aphront-more',
|
||||
|
||||
'phabricator-diff-inline-content-state',
|
||||
'phabricator-diff-inline',
|
||||
'phabricator-diff-changeset',
|
||||
'phabricator-diff-changeset-list',
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
/**
|
||||
* @provides phabricator-diff-inline
|
||||
* @requires javelin-dom
|
||||
* phabricator-diff-inline-content-state
|
||||
* @javelin
|
||||
*/
|
||||
|
||||
JX.install('DiffInline', {
|
||||
|
||||
construct : function() {
|
||||
this._activeContentState = new JX.DiffInlineContentState();
|
||||
},
|
||||
|
||||
members: {
|
||||
|
@ -53,6 +55,8 @@ JX.install('DiffInline', {
|
|||
_isSelected: false,
|
||||
_canSuggestEdit: false,
|
||||
|
||||
_activeContentState: null,
|
||||
|
||||
bindToRow: function(row) {
|
||||
this._row = row;
|
||||
|
||||
|
@ -785,8 +789,13 @@ JX.install('DiffInline', {
|
|||
this.triggerDraft();
|
||||
},
|
||||
|
||||
_getActiveContentState: function() {
|
||||
return this._activeContentState;
|
||||
},
|
||||
|
||||
setHasSuggestion: function(has_suggestion) {
|
||||
this._hasSuggestion = has_suggestion;
|
||||
var state = this._getActiveContentState();
|
||||
state.setHasSuggestion(has_suggestion);
|
||||
|
||||
var button = this._getSuggestionButton();
|
||||
var pht = this.getChangeset().getChangesetList().getTranslations();
|
||||
|
@ -806,7 +815,7 @@ JX.install('DiffInline', {
|
|||
},
|
||||
|
||||
getHasSuggestion: function() {
|
||||
return this._hasSuggestion;
|
||||
return this._getActiveContentState().getHasSuggestion();
|
||||
},
|
||||
|
||||
save: function() {
|
||||
|
@ -920,7 +929,7 @@ JX.install('DiffInline', {
|
|||
state.suggestionText = node.value;
|
||||
}
|
||||
|
||||
state.hasSuggestion = this.getHasSuggestion();
|
||||
state.hasSuggestion = this._getActiveContentState().getHasSuggestion();
|
||||
|
||||
return state;
|
||||
},
|
||||
|
|
22
webroot/rsrc/js/application/diff/DiffInlineContentState.js
Normal file
22
webroot/rsrc/js/application/diff/DiffInlineContentState.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* @provides phabricator-diff-inline-content-state
|
||||
* @requires javelin-dom
|
||||
* @javelin
|
||||
*/
|
||||
|
||||
JX.install('DiffInlineContentState', {
|
||||
|
||||
construct : function() {
|
||||
|
||||
},
|
||||
|
||||
properties: {
|
||||
text: null,
|
||||
suggestionText: null,
|
||||
hasSuggestion: false
|
||||
},
|
||||
|
||||
members: {
|
||||
}
|
||||
|
||||
});
|
Loading…
Reference in a new issue