Lurch Web User Interface

Module

GoogleDriveUI

This file creates simple TinyMCE dialog boxes and simple functions to access them, to make it easy to provide file open, save, and save-as functionality that can access the user's Google Drive.

Source

Methods

static

install(editor)

Install into a TinyMCE editor instance three new menu items: Open, Save, and Save as... These three menu items will be associated with calls to the appropriate dialog boxes and read/write utilities defined earlier in this file. A client can simply call this function on their editor instance, then add the appropriate actions (named opendocument, savedocument, and savedocumentas) to that editor's menus.

Parameters

  • editor tinymce.Editor

    the editor instance into which the new actions should be installed

Source

inner

showFileOpenDialog(editor)

Show a Google Drive file open dialog box, and if the user picks a file from it, load that file into the given TinyMCE editor. If an error occurs, pop up a notification in the editor stating that an error occurred opening the file.

Parameters

  • editor tinymce.Editor

    the TinyMCE editor instance into which the file will be loaded, if the user chooses one

See

Source

inner

showSaveAsDialog(editor)

Show a Google Drive folder selection dialog box, and if the user selects a folder, then show them a filename entry dialog box. If they type a filename and choose to save, the contents of the given editor are written into that file as a new file in the given Google Drive folder. Note that this always creates a new file (because Google Drive folders can contain multiple files with the same name).

Parameters

  • editor tinymce.Editor

    the TinyMCE editor instance whose content should be saved into the file the user chooses

See

Source

inner

silentFileSave(editor, fileId)

Silently (i.e., without asking the user anything in a dialog box) save the given new content into the existing Google Drive file with the given ID. If it succeeds, pop up a brief success notification. If it fails, show a failure notification containing the error and wait for the user to dismiss it.

Parameters

  • editor tinymce.Editor

    the editor to use for any notifications

  • fileId string

    the Google Drive file ID whose content should be updated

See

  • showSaveAsDialog()

Source