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 .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 name of the class; i.e. "GoDropbox"
Get the clientId for the app using the cloud storage service. This is usually given by the cloud storage provider's dev console or similar. Set with a parameter during construction.
Get or set the currently open DiagramFile. By default, currentDiagramFile is set when a file is loaded from storage, saved to storage (if saved to a different path from the currentDiagramFile.path), or deleted from storage (if the deleted file is the currently open one). The default value is a DiagramFile with null id, name, and path values.
Get / set the defaultModel data for the app used by an instance of GoCloudStorage. defaultModel is used when creating new diagrams. See create.
Get the Dropbox client instance associated with this instance of GoDropBox (via clientId). Set during authorize.
Get / set iconsRelativeDirectory, the directory path relative to the page in which this instance of GoCloudStorage exists, in which the storage service brand icons can be found. The default value is "../goCloudStorageIcons/".
Get or set isAutoSaving property. If true, the managedDiagrams will be saved to storage after every
Transaction (only if currentDiagramFile holds a non-null path value).
Additionally, if isAutoSaving is true, users will be prompted to save newly created diagrams when created with create.
The default value for isAutoSaving is true
.
Get / set the GoJS Diagrams associated with this instance of GoCloudStorage. Set with a parameter during construction.
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.
Get the name of the cloud storage service being used; i.e. "Dropbox"
Get the UI element associated with this instance of GoCloudStorage. This is a custom filepicker window for GoDropBox and GoLocalStorage. It is a save prompt for GoOneDrive and GoGoogleDrive (both these classes use third party UI for storage navigation, provided by Microsoft and Google, respectively). The UI element is created during construction.
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
Set each of managedDiagrams' .model to defaultModel (if defaultModel is null, each model will be set to a new GraphLinksModel by default). If isAutoSaving is true and no path parameter is supplied, users will be immediately prompted to save their new diagrams to cloud storage.
If a valid filepath is supplied, save each of managedDiagrams' model data to this path. No UI of any sort appears. What is meant by "valid filepath" varies from subclass to subclass. Rules for valid filepaths by subclass:
example.diagram
/{path-to-file}/{filename}
; i.e. /Public/example.diagram
/drive/root:/{path-to-file}/{filename}
; i.e. /drive/root:/Documents/example.diagram
Returns a Promise that resolves with a DiagramFile representing the newly created file.
Get the Dropbox file reference object at a given path. Properties of particular note include:
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 fields 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.
Display the custom GoDropBox filepicker ui. Note: This is no longer used for loadWithUI actions. These actions are handled with the official Dropbox Chooser API.
Clarify what action is being done after file selection. Acceptable values:
The path in DropBox to look to for files and folders. The empty string directs to a Dropbox user's root
directory. Path syntax is /{path}/{to}/{folder}/
; i.e. /Public/
.
Number of files to show in UI, in addition to a static property that can only be modified by changing source code. This prevents long wait times while the UI loads if there are a large number of diagram files stored in Dropbox.
Returns a Promise which resolves (in save, load, or remove, after action is handled with a DiagramFile representing the saved/loaded/deleted file
Class for saving / loading GoJS Diagram 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.