Annotations

ai:annotations:bind#

Emitted by the AI core when an applied issue includes annotation alternatives (for example better-wording suggestions). The Annotation plugin listens to this event by default and calls bindFromList on the inserted content.

Type: signal.

Payload:

  • root — root element of the inserted block
  • entries — array of alternative word lists per annotated span
  • kind — annotation block type (for example wording)
  • ignore — whether ignore actions are enabled
  • issue — source AI issue object
  • blocks — inserted block instances

Example:

app.on('ai:annotations:bind', ({ root, entries, kind, ignore }) => {
    console.log('ai:annotations:bind', kind, entries.length, ignore);
});

annotation:callout#

Emitted when an annotation callout is shown.

Type: hook (handler may return { callout } to customize the callout config).

Payload:

  • ref — annotation ref id
  • block — block instance
  • kind — annotation type (for example wording)
  • data — annotation store entry
  • anchor — DOM element for the annotated span
  • callout — default callout config (title, items, actions, …)

Example:

app.on('annotation:callout', ({ ref, kind, callout }) => {
    return {
        callout: {
            ...callout,
            title: kind === 'wording' ? 'Choose wording' : callout.title
        }
    };
});

annotations:apply#

Emitted when the user applies a wording alternative from the callout or via annotation.applyChoice.

Type: signal.

Payload:

  • ref — annotation ref id
  • kind — annotation block type
  • text — replacement text applied to the document
  • original — original span text before apply
  • data — store snapshot before the annotation was removed

Example:

app.on('annotations:apply', ({ ref, kind, text, original }) => {
    console.log('annotations:apply', ref, kind, original, '→', text);
});

annotations:ignore#

Emitted when the user ignores a single annotation (keeps the original wording).

Type: signal.

Payload:

  • ref — annotation ref id
  • kind — annotation block type
  • text — text left in the document (same as original)
  • original — original span text
  • data — store snapshot before the annotation was removed

Example:

app.on('annotations:ignore', ({ ref, kind }) => {
    console.log('annotations:ignore', ref, kind);
});

annotations:ignore-all#

Emitted when the user chooses Ignore all in the callout. Individual annotations:ignore events are not fired for each span — only this summary event.

Type: signal.

Payload:

  • kind — annotation block type (for example wording)
  • count — number of resolved spans

Example:

app.on('annotations:ignore-all', ({ kind, count }) => {
    console.log('annotations:ignore-all', kind, count);
});

annotations:clear#

Emitted when all annotations are cleared.

Type: signal.

Payload: none.

Example:

app.on('annotations:clear', () => {
    console.log('annotations:clear');
});

annotations:remove#

Emitted when an annotation is removed from the store.

Type: signal.

Payload:

  • id — annotation ref id

Example:

app.on('annotations:remove', ({ id }) => {
    console.log('annotations:remove', id);
});

annotations:set#

Emitted when an annotation entry is stored.

Type: signal.

Payload:

  • id — annotation ref id
  • data — stored annotation object

Example:

app.on('annotations:set', ({ id, data }) => {
    console.log('annotations:set', id, data);
});