Merge "Add support for going to linNum in inline editor"
* submodules:
* Update plugins/codemirror-editor from branch 'master'
to d2c4dba2ac2282e620e7ca2a63f8cbf803699c6b
- Add support to scroll to line
Bug: Issue 12364
Change-Id: I0e58a78eb93acfcb6e4bee639a66710a6341660f
This commit is contained in:
Submodule plugins/codemirror-editor updated: 9508693bd0...d2c4dba2ac
@@ -132,8 +132,8 @@
|
|||||||
// eslint-disable-next-line max-len
|
// eslint-disable-next-line max-len
|
||||||
DIFF: /^\/c\/(.+)\/\+\/(\d+)(\/((-?\d+|edit)(\.\.(\d+|edit))?(\/(.+))))\/?$/,
|
DIFF: /^\/c\/(.+)\/\+\/(\d+)(\/((-?\d+|edit)(\.\.(\d+|edit))?(\/(.+))))\/?$/,
|
||||||
|
|
||||||
// Matches /c/<project>/+/<changeNum>/[<patchNum|edit>]/<path>,edit
|
// Matches /c/<project>/+/<changeNum>/[<patchNum|edit>]/<path>,edit[#lineNum]
|
||||||
DIFF_EDIT: /^\/c\/(.+)\/\+\/(\d+)\/(\d+|edit)\/(.+),edit$/,
|
DIFF_EDIT: /^\/c\/(.+)\/\+\/(\d+)\/(\d+|edit)\/(.+),edit(\#\d+)?$/,
|
||||||
|
|
||||||
// Matches non-project-relative
|
// Matches non-project-relative
|
||||||
// /c/<changeNum>/[<basePatchNum>..]<patchNum>/<path>.
|
// /c/<changeNum>/[<basePatchNum>..]<patchNum>/<path>.
|
||||||
@@ -1394,6 +1394,7 @@
|
|||||||
changeNum: ctx.params[1],
|
changeNum: ctx.params[1],
|
||||||
patchNum: ctx.params[2],
|
patchNum: ctx.params[2],
|
||||||
path: ctx.params[3],
|
path: ctx.params[3],
|
||||||
|
lineNum: ctx.hash,
|
||||||
view: Gerrit.Nav.View.EDIT,
|
view: Gerrit.Nav.View.EDIT,
|
||||||
});
|
});
|
||||||
this.$.reporting.setRepoName(project);
|
this.$.reporting.setRepoName(project);
|
||||||
|
|||||||
@@ -1541,6 +1541,37 @@ limitations under the License.
|
|||||||
view: Gerrit.Nav.View.EDIT,
|
view: Gerrit.Nav.View.EDIT,
|
||||||
path: 'foo/bar/baz',
|
path: 'foo/bar/baz',
|
||||||
patchNum: 3,
|
patchNum: 3,
|
||||||
|
lineNum: undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
element._handleDiffEditRoute(ctx);
|
||||||
|
assert.isFalse(redirectStub.called);
|
||||||
|
assert.isTrue(normalizeRangeSpy.calledOnce);
|
||||||
|
assert.deepEqual(normalizeRangeSpy.lastCall.args[0], appParams);
|
||||||
|
assert.isFalse(normalizeRangeSpy.lastCall.returnValue);
|
||||||
|
assert.deepEqual(setParamsStub.lastCall.args[0], appParams);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('_handleDiffEditRoute with lineNum', () => {
|
||||||
|
const normalizeRangeSpy =
|
||||||
|
sandbox.spy(element, '_normalizePatchRangeParams');
|
||||||
|
sandbox.stub(element.$.restAPI, 'setInProjectLookup');
|
||||||
|
const ctx = {
|
||||||
|
params: [
|
||||||
|
'foo/bar', // 0 Project
|
||||||
|
1234, // 1 Change number
|
||||||
|
3, // 2 Patch num
|
||||||
|
'foo/bar/baz', // 3 File path
|
||||||
|
],
|
||||||
|
hash: 4,
|
||||||
|
};
|
||||||
|
const appParams = {
|
||||||
|
project: 'foo/bar',
|
||||||
|
changeNum: 1234,
|
||||||
|
view: Gerrit.Nav.View.EDIT,
|
||||||
|
path: 'foo/bar/baz',
|
||||||
|
patchNum: 3,
|
||||||
|
lineNum: 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
element._handleDiffEditRoute(ctx);
|
element._handleDiffEditRoute(ctx);
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ limitations under the License.
|
|||||||
<gr-endpoint-param name="fileContent" value="[[_newContent]]"></gr-endpoint-param>
|
<gr-endpoint-param name="fileContent" value="[[_newContent]]"></gr-endpoint-param>
|
||||||
<gr-endpoint-param name="prefs" value="[[_prefs]]"></gr-endpoint-param>
|
<gr-endpoint-param name="prefs" value="[[_prefs]]"></gr-endpoint-param>
|
||||||
<gr-endpoint-param name="fileType" value="[[_type]]"></gr-endpoint-param>
|
<gr-endpoint-param name="fileType" value="[[_type]]"></gr-endpoint-param>
|
||||||
|
<gr-endpoint-param name="lineNum" value="[[_lineNum]]"></gr-endpoint-param>
|
||||||
<gr-default-editor id="file" file-content="[[_newContent]]"></gr-default-editor>
|
<gr-default-editor id="file" file-content="[[_newContent]]"></gr-default-editor>
|
||||||
</gr-endpoint-decorator>
|
</gr-endpoint-decorator>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -84,6 +84,7 @@
|
|||||||
computed: '_computeSaveDisabled(_content, _newContent, _saving)',
|
computed: '_computeSaveDisabled(_content, _newContent, _saving)',
|
||||||
},
|
},
|
||||||
_prefs: Object,
|
_prefs: Object,
|
||||||
|
_lineNum: Number,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,6 +127,7 @@
|
|||||||
this._changeNum = value.changeNum;
|
this._changeNum = value.changeNum;
|
||||||
this._path = value.path;
|
this._path = value.path;
|
||||||
this._patchNum = value.patchNum || this.EDIT_NAME;
|
this._patchNum = value.patchNum || this.EDIT_NAME;
|
||||||
|
this._lineNum = value.lineNum;
|
||||||
|
|
||||||
// NOTE: This may be called before attachment (e.g. while parentElement is
|
// NOTE: This may be called before attachment (e.g. while parentElement is
|
||||||
// null). Fire title-change in an async so that, if attachment to the DOM
|
// null). Fire title-change in an async so that, if attachment to the DOM
|
||||||
|
|||||||
Reference in New Issue
Block a user