Lurch Web User Interface

Module

LocalStorageDrive

This file creates functions for accessing the browser's local storage as if it were a collection of files. It also provides file open, save, and save as menu items that can be used not only for loading files from and saving files to the browser's local storage, but also uploading and downloading files or importing them from the web. It also provides a file menu item for deleting files from the browser's local storage.

It also installs autosave features into the editor. Every few seconds, if the editor's content is dirty, it is saved into browser local storage. If the user saves the content elsewhere, it is removed from browser local storage. If the user opens Lurch and it finds that content is in the local storage autosave, it lets the user choose whether to load it or discard it.

Classes

ChooseLocalFileItem

Members

staticconstant

saveAs

Save the contents of the given editor into the given file. However, if a file with that name already exists, pop up a dialog prompting the user to decide if they really want to overwrite the file, and proceed only if they accept.

Source

Methods

static

install(editor)

Install into a TinyMCE editor instance five new menu items intended for the File menu: New, Open, Save, Save as..., and Delete a saved document. Also install autosave features that store the current document whenever it is dirty and unsaved, and offer to reload it if you close the tab and then re-open.

Parameters

  • editor tinymce.Editor

    the TinyMCE editor instance into which the new menu item should be installed

Source

inner

silentFileSave(editor, filename)

Silently (i.e., without asking the user anything in a dialog box) save the given new content into the existing file with the given name in the user's LocalStorage. 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. It also clears the editor's dirty flag.

Parameters

  • editor tinymce.Editor

    the editor to use for any notifications

  • filename string

    the filename whose content should be updated

See

  • showSaveAsDialog()

Source