Minor document rendering fixes: dropdown for synchronous files, URI normalization for default renderers

Summary:
Depends on D19258. Ref T13105.

  - When the default renderer is an Ajax renderer, don't replace the URI. For example, when viewing a Jupyter notebook, the URI should remain `/F123`, not instantly change to `/view/123/jupyter/`.
  - Fix an issue where non-ajax renderers could fail to display the dropdown menu properly.

Test Plan:
  - Viewed a Jupyter notebook, stayed on the same URI.
  - Changed rendering, got different URIs.
  - Viewed a JSON file and toggled renderers via dropdown.

Reviewers: mydeveloperday

Reviewed By: mydeveloperday

Maniphest Tasks: T13105

Differential Revision: https://secure.phabricator.com/D19259
This commit is contained in:
epriestley
2018-03-26 07:17:59 -07:00
parent 38999e25ac
commit b7d3101e7c
2 changed files with 12 additions and 9 deletions

View File

@@ -73,7 +73,6 @@ JX.behavior('document-engine', function(config, statics) {
var handler = JX.bind(null, onrender, data, data.sequence);
data.viewKey = spec.viewKey;
JX.History.replace(spec.viewURI);
new JX.Request(spec.engineURI, handler)
.send();
@@ -91,6 +90,10 @@ JX.behavior('document-engine', function(config, statics) {
var load = JX.bind(null, onloading, data, spec);
data.loadTimer = setTimeout(load, 333);
// Replace the URI with the URI for the specific rendering the user
// has selected.
JX.History.replace(spec.viewURI);
}
}
@@ -128,7 +131,7 @@ JX.behavior('document-engine', function(config, statics) {
statics.initialized = true;
}
if (config.renderControlID) {
if (config && config.renderControlID) {
var control = JX.$(config.renderControlID);
var data = JX.Stratcom.getData(control);