Lurch web app user interface

Module

Validation

This module provides an install() function for use in the editor's setup routine, to add this module's validation functionality to the editor. The install routine does all the work of this module; there are no module-level variables. Each call to install() creates a new background Web Worker that will do validation, installs a new set of event handlers for it, etc. See install() for details.

This module creates a Web Worker to use for doing validation outside of the UI thread. It loads into that worker the code in the validation worker module, and then provides related tools to clients.

First, you can send a document to the worker for validation by calling the run() function.

Both this module and the validation worker module make use of the Message class for communication, and any client who listens to the events from this module will receive instances of that class as well.

Source

Methods

static

install(editor)

This function should be called in the editor's setup routine. It installs two menu items into the editor:

  • one for running validation on the editor's current contents, and showing the results in the editor by placing suffixes on each atom that could be validated
  • one for removing all such validation suffixes from the editor's current contents

In order to support the functionality of those two menu items, the install() function also constructs a web worker that will do the validation in the background, and that web worker loads the tools in the validation worker module. This function also installs event handlers on the worker and on this window so that Message instances sent from the worker or from this window during parsing can be handled and used to create validation feedback in the editor.

Parameters

  • editor tinymce.Editor

    the editor in which to install the features described above

Source