This is part of GoCloudStorage and not part of the main GoJS library. Storage can be found in the GoJS kit under the projects
folder. See the Storage intro page for more information.
An array of GoJS Diagrams whose model(s) will be saved to / loaded from Dropbox. Can also be a single Diagram.
The client ID of the application in use (given in Dropbox Developer's Console)
String representation of the default model data for new diagrams. If this is null, default new diagrams will be empty. Usually a value given by calling Model.toJson on a GoJS Diagram's Model.
The directory path relative to the page in which this instance of GoDropBox exists, in which the storage service brand icons can be found. The default value is "../goCloudStorageIcons/".
Get the Dropbox client instance associated with this instance of GoDropBox (via clientId). Set during authorize.
Get / set currently open Dropnpx path in custom filepicker ui. Default value is the empty string, which corresponds to the currently signed in user's Drobox account's root path. Set when a user clicks on a folder in the custom ui menu by invoking anchor onclick values. These onclick values are set when the Dropbox directory at the current menuPath is displayed with showUI.
Check if there is a signed in Dropbox user who has authorized the application linked to this instance of GoDropBox (via clientId). If not, prompt user to sign in / authenticate their Dropbox account.
Whether to get a new acess token (triggers a page redirect) (true) or try to find / use the one in the browser window URI (no redirect) (false)
Returns a Promise that resolves with a boolean stating whether authorization was succesful (true) or failed (false)
Check whether a file exists in user's Dropbox at a given path.
A valid Dropbox filepath. Path syntax is /{path-to-file}/{filename}
; i.e. /Public/example.diagram
.
Alternatively, this may be a valid Dropbox file ID.
Returns a Promise that resolves with a boolean stating whether a file exists in user's Dropbox at a given path
Get the Dropbox file reference object at a given path. Properties of particular note include:
Note: The first three elements in the above list are requisite for creating valid DiagramFiles.
A valid Dropbox filepath. Path syntax is /{path-to-file}/{filename}
; i.e. /Public/example.diagram
.
Alternatively, this may be a valid Dropbox file ID.
Returns a Promise that resolves with a Dropbox file reference object at a given path
Get information about the currently logged in Dropbox user. Some properties of particular note include:
Returns a Promise that resolves with information about the currently logged in Dropbox user
If action (Save, Delete, Load) is cancelled, resolve the Promise returned in showUI with a 'Canceled' notification.
Load the contents of a saved diagram from Dropbox.
A valid Dropbox filepath to load diagram model data from. Path syntax is /{path-to-file}/{filename}
;
i.e. /Public/example.diagram
.
Alternatively, this may be a valid Dropbox file ID.
Returns a Promise that resolves with a DiagramFile representing the loaded file
Load the contents of a saved diagram from Dropbox using the custom filepicker ui.
Returns a Promise that resolves with a DiagramFile representing the loaded file.
Delete a given diagram file from Dropbox.
A valid Dropbox filepath to delete diagram model data from. Path syntax is
/{path-to-file}/{filename}
; i.e. /Public/example.diagram
.
Alternatively, this may be a valid Dropbox file ID.
Returns a Promise that resolves with a DiagramFile representing the deleted file.
Delete a chosen diagram file from Dropbox using the custom filepicker ui.
Returns a Promise that resolves with a DiagramFile representing the deleted file.
Save managedDiagrams' model data to Dropbox. If path is supplied save to that path. If no path is supplied but currentDiagramFile has non-null, valid properties, update saved diagram file content at the path in Dropbox corresponding to currentDiagramFile.path with current managedDiagrams' model data. If no path is supplied and currentDiagramFile is null or has null properties, this calls saveWithUI.
A valid Dropbox filepath to save current diagram model to. Path syntax is /{path-to-file}/{filename}
;
i.e. /Public/example.diagram
.
Alternatively, this may be a valid Dropbox file ID.
Returns a Promise that resolves with a DiagramFile representing the saved file.
Save the current managedDiagrams model data to Dropbox with the filepicker ui. Returns a Promise that resolves with a DiagramFile representing the saved file.
Optional: The name to save data to Dropbox under. If this is not provided, you will be prompted for a filename
Show the ui element associated with this instance of GoCloudStorage.
Returns a Promise that resolves (in save, load, or remove with an DiagramFile representing the saved/loaded/deleted file
Sign out the currently signed in Dropbox user Note: Since this redirects the app page, unsaved diagram model data will be lost after calling this
Class for saving / loading GoJS Models to / from Dropbox. As with all GoCloudStorage subclasses (with the exception of GoLocalStorage, any page using GoDropBox must be served on a web server.
Note: Any page using GoDropBox must include a script tag with a reference to the Dropbox JS SDK.