Trilium Frontend API
    Preparing search index...

    Class EditingController

    A controller for the editing pipeline. The editing pipeline controls the ~EditingController#model model rendering, including selection handling. It also creates the ~EditingController#view view which builds a browser-independent virtualization over the DOM elements. The editing controller also attaches default converters.

    Hierarchy (View Summary)

    Index
    • Creates an editing controller instance.

      Parameters

      Returns EditingController

    downcastDispatcher: DowncastDispatcher

    Downcast dispatcher that converts changes from the model to the #view editing view.

    mapper: Mapper

    A mapper that describes the model-view binding.

    model: Model

    Editor model.

    Editing view controller.

    • Removes all event listeners attached to the EditingController. Destroys all objects created by EditingController that need to be destroyed.

      Returns void

    • Calling this method will downcast a model item on demand (by requesting a refresh in the module:engine/model/differ~Differ).

      You can use it if you want the view representation of a specific item updated as a response to external modifications. For instance, when the view structure depends not only on the associated model data but also on some external state.

      Note: If you want to reconvert a model marker, use #reconvertMarker instead.

      Parameters

      Returns void

    • Calling this method will refresh the marker by triggering the downcast conversion for it.

      Reconverting the marker is useful when you want to change its module:engine/view/element~ViewElement view element without changing any marker data. For instance:

      let isCommentActive = false;

      model.conversion.markerToHighlight( {
      model: 'comment',
      view: data => {
      const classes = [ 'comment-marker' ];

      if ( isCommentActive ) {
      classes.push( 'comment-marker--active' );
      }

      return { classes };
      }
      } );

      // ...

      // Change the property that indicates if marker is displayed as active or not.
      isCommentActive = true;

      // Reconverting will downcast and synchronize the marker with the new isCommentActive state value.
      editor.editing.reconvertMarker( 'comment' );

      Note: If you want to reconvert a model item, use #reconvertItem instead.

      Parameters

      • markerOrName: string | Marker

        Name of a marker to update, or a marker instance.

      Returns void