Link

Link insertion and editing.

Access:

app.link
app.getModule('link')
app.invoke('link.method', …)

open#

Opens create or edit link dropdown based on selection.

Parameters:

  • params (object) — command or form parameters
  • button (HTMLElement | string) — toolbar or UI button element
  • el (HTMLElement | string) — DOM element
app.link.open({}, { button });

openCreate#

Opens link creation form dropdown.

Parameters:

  • params (object) — command or form parameters
  • button (HTMLElement | string) — toolbar or UI button element
  • el (HTMLElement | string) — DOM element
  • trigger (HTMLElement | string) — element or button that opened the dropdown
app.link.openCreate({}, { button });

openEdit#

Opens link edit form for selected anchor.

Parameters:

  • params (object) — command or form parameters
  • button (HTMLElement | string) — toolbar or UI button element
  • el (HTMLElement | string) — DOM element
  • trigger (HTMLElement | string) — element or button that opened the dropdown
app.link.openEdit({}, { button });

get#

Returns link elements in current selection.

Returns: HTMLElement[]

app.link.get();

create#

Creates inline or image link from form params.

Parameters:

  • params (object) — command or form parameters
  • form (any) — form module instance from dropdown
app.link.create({ url: 'https://...', text: 'Go' });

save#

Updates selected link or image link from form params.

Parameters:

  • params (object) — command or form parameters
  • form (any) — form module instance from dropdown
app.link.save({ url, text, target: true });

update#

Batch-updates all selected links with partial data.

Parameters:

  • data (object) — payload data

Returns: boolean

app.link.update({ url: 'https://...' });

visit#

Opens link URL in a new browser tab.

Parameters:

  • params (object) — command or form parameters
  • button (HTMLElement | string) — toolbar or UI button element
  • el (HTMLElement | string) — DOM element
app.link.visit({ url: 'https://...' });

Removes links from selection or unwraps image link.

Parameters:

  • params (object) — command or form parameters
  • button (HTMLElement | string) — toolbar or UI button element
app.link.unlink();

observe#

Context menu observer adding unlink/visit UI for links.

Parameters:

  • btn (HTMLElement | string) — toolbar or dropdown button element
  • type (string) — block or entity type name

Returns: object

app.link.observe(btn, 'context');