Skip to content

Commit 717fc26

Browse files
committed
Add default URL for plotlyServerURL
1 parent ba91b11 commit 717fc26

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

src/plot_api/plot_config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var configAttributes = {
3333

3434
plotlyServerURL: {
3535
valType: 'string',
36-
dflt: '',
36+
dflt: 'https://cloud.plotly.com/upload',
3737
description: [
3838
'Sets the URL for the `sendChartToCloud` modebar button.',
3939
'When clicked, the button will send the chart data to this URL.',

src/plots/plots.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ plots.sendDataToCloud = function(gd) {
209209
}
210210

211211
// Plotly Cloud origin, used to validate incoming messages and to target outgoing ones.
212+
// `baseUrl` (plotlyServerURL) is the upload page that handles login and signals
213+
// back when authentication succeeds.
212214
var cloudOrigin;
213215
try {
214216
cloudOrigin = new URL(baseUrl).origin;
@@ -217,9 +219,6 @@ plots.sendDataToCloud = function(gd) {
217219
return;
218220
}
219221

220-
// The page that handles login and signals back when authentication succeeds.
221-
var uploadUrl = baseUrl.replace(/\/+$/, '') + '/upload';
222-
223222
gd.emit('plotly_beforeexport');
224223

225224
// Build the request body: the chart JSON plus the plotly.js version used to
@@ -229,7 +228,7 @@ plots.sendDataToCloud = function(gd) {
229228

230229
// Open the Cloud login page in a new tab. We keep a reference so we can post
231230
// the chart back to it once Cloud reports that authentication succeeded.
232-
var cloudWindow = window.open(uploadUrl, '_blank');
231+
var cloudWindow = window.open(baseUrl, '_blank');
233232
if(!cloudWindow) {
234233
console.error('Unable to open Plotly Cloud (the popup may have been blocked)');
235234
gd.emit('plotly_afterexport');

test/plot-schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@
280280
},
281281
"plotlyServerURL": {
282282
"description": "Sets the URL for the `sendChartToCloud` modebar button. When clicked, the button will send the chart data to this URL.",
283-
"dflt": "",
283+
"dflt": "https://cloud.plotly.com/upload",
284284
"valType": "string"
285285
},
286286
"queueLength": {

0 commit comments

Comments
 (0)