Trilium Frontend API
    Preparing search index...

    Class Plugin

    The base class for CKEditor plugin classes.

    Hierarchy (View Summary)

    Implements

    Index
    • Parameters

      • editor: Editor

      Returns Plugin

    editor: Editor

    The editor instance.

    Note that most editors implement the module:core/editor/editor~Editor#ui property. However, editors with an external UI (i.e. Bootstrap-based) or a headless editor may not have this property or throw an error when accessing it.

    Because of above, to make plugins more universal, it is recommended to split features into:

    • The "editing" part that uses the module:core/editor/editor~Editor class without ui property.
    • The "UI" part that uses the module:core/editor/editor~Editor class and accesses ui property.
    isEnabled: boolean

    Flag indicating whether a plugin is enabled or disabled. A disabled plugin will not transform text.

    Plugin can be simply disabled like that:

    // Disable the plugin so that no toolbars are visible.
    editor.plugins.get( 'TextTransformation' ).isEnabled = false;

    You can also use #forceDisabled method.

    • get isContextPlugin(): false

      Returns false

    • get isOfficialPlugin(): boolean
      Internal

      Returns boolean

    • get isPremiumPlugin(): boolean
      Internal

      Returns boolean

    • Clears forced disable previously set through #forceDisabled. See #forceDisabled.

      Parameters

      • id: string

        Unique identifier, equal to the one passed in #forceDisabled call.

      Returns void

    • Destroys the plugin.

      Note: This method is optional. A plugin instance does not need to have it defined.

      Returns void

    • Disables the plugin.

      Plugin may be disabled by multiple features or algorithms (at once). When disabling a plugin, unique id should be passed (e.g. feature name). The same identifier should be used when #clearForceDisabled enabling back the plugin. The plugin becomes enabled only after all features #clearForceDisabled enabled it back.

      Disabling and enabling a plugin:

      plugin.isEnabled; // -> true
      plugin.forceDisabled( 'MyFeature' );
      plugin.isEnabled; // -> false
      plugin.clearForceDisabled( 'MyFeature' );
      plugin.isEnabled; // -> true

      Plugin disabled by multiple features:

      plugin.forceDisabled( 'MyFeature' );
      plugin.forceDisabled( 'OtherFeature' );
      plugin.clearForceDisabled( 'MyFeature' );
      plugin.isEnabled; // -> false
      plugin.clearForceDisabled( 'OtherFeature' );
      plugin.isEnabled; // -> true

      Multiple disabling with the same identifier is redundant:

      plugin.forceDisabled( 'MyFeature' );
      plugin.forceDisabled( 'MyFeature' );
      plugin.clearForceDisabled( 'MyFeature' );
      plugin.isEnabled; // -> true

      Note: some plugins or algorithms may have more complex logic when it comes to enabling or disabling certain plugins, so the plugin might be still disabled after #clearForceDisabled was used.

      Parameters

      • id: string

        Unique identifier for disabling. Use the same id when #clearForceDisabled enabling back the plugin.

      Returns void