Skip to content

BlockSuite API Documentation / @blocksuite/affine-inline-reference

@blocksuite/affine-inline-reference

Classes

AffineReference

Extends

Constructors

Other

_whenHover

_whenHover: object

dispose()

dispose: () => void

Returns

void

setFloating()

setFloating: (element?) => void

Parameters
element?

Element

Returns

void

setReference()

setReference: (element?) => void

Parameters
element?

Element

Returns

void

styles

static styles: CSSResult

Overrides

WithDisposable(ShadowlessElement).styles

_icon
Get Signature

get _icon(): TemplateResult

Returns

TemplateResult

_title
Get Signature

get _title(): string | undefined

Returns

string | undefined

block
Get Signature

get block(): BlockComponent<BlockModel<object>, BlockService, string> | null

Returns

BlockComponent<BlockModel<object>, BlockService, string> | null

config
customContent
Get Signature

get customContent(): (reference) => TemplateResult | undefined

Returns

(reference) => TemplateResult | undefined

delta
doc
Get Signature

get doc(): Store

Returns

Store

docTitle
Get Signature

get docTitle(): string

Returns

string

inlineEditor
Get Signature

get inlineEditor(): InlineEditor<AffineTextAttributes> | undefined

Returns

InlineEditor<AffineTextAttributes> | undefined

referenceInfo
Get Signature

get referenceInfo(): object

Returns

object

description?

optional description: string

pageId

pageId: string

params?

optional params: object

params.blockIds?

optional params.blockIds: string[]

params.commentId?

optional params.commentId: string

params.databaseId?

optional params.databaseId: string

params.databaseRowId?

optional params.databaseRowId: string

params.elementIds?

optional params.elementIds: string[]

params.mode?

optional params.mode: "edgeless" | "page"

params.xywh?

optional params.xywh: `[${number},${number},${number},${number}]`

title?

optional title: string

refMeta
selected
selfInlineRange
Get Signature

get selfInlineRange(): InlineRange | null | undefined

Returns

InlineRange | null | undefined

std
connectedCallback()

connectedCallback(): void

Returns

void

Overrides

WithDisposable(ShadowlessElement).connectedCallback

open()

readonly open(event?): void

Parameters
event?

Partial<DocLinkClickedEvent>

Returns

void

referenceToNode()

referenceToNode(): boolean

Returns

boolean

attributes

controllers

dev-mode

lifecycle

properties

rendering

render()

render(): typeof nothing | TemplateResult<1>

Invoked on each update to perform rendering tasks. This method may return any value renderable by lit-html's ChildPart - typically a TemplateResult. Setting properties inside this method will not trigger the element to update.

Returns

typeof nothing | TemplateResult<1>

Overrides

WithDisposable(ShadowlessElement).render

styles

updates

willUpdate()

willUpdate(_changedProperties): void

Invoked before update() to compute values needed during the update.

Implement willUpdate to compute property values that depend on other properties and are used in the rest of the update process.

ts
willUpdate(changedProperties) {
  // only need to check changed properties for an expensive computation.
  if (changedProperties.has('firstName') || changedProperties.has('lastName')) {
    this.sha = computeSHA(`${this.firstName} ${this.lastName}`);
  }
}

render() {
  return html`SHA: ${this.sha}`;
}
Parameters
_changedProperties

Map<PropertyKey, unknown>

Returns

void

Overrides

WithDisposable(ShadowlessElement).willUpdate


ReferenceNodeConfigProvider

Constructors

Constructor

new ReferenceNodeConfigProvider(std): ReferenceNodeConfigProvider

Parameters
std

BlockStdScope

Returns

ReferenceNodeConfigProvider

Properties

std

readonly std: BlockStdScope

Accessors

customContent
Get Signature

get customContent(): (reference) => TemplateResult | undefined

Returns

(reference) => TemplateResult | undefined

doc
Get Signature

get doc(): Store

Returns

Store

hidePopup
Get Signature

get hidePopup(): boolean

Returns

boolean

interactable
Get Signature

get interactable(): boolean

Returns

boolean

Methods

setCustomContent()

setCustomContent(content): void

Parameters
content

(reference) => TemplateResult | undefined

Returns

void

setHidePopup()

setHidePopup(hidePopup): void

Parameters
hidePopup

boolean

Returns

void

setInteractable()

setInteractable(interactable): void

Parameters
interactable

boolean

Returns

void


ReferencePopup

Extends

Constructors

Other

styles

static styles: CSSResult

Overrides

SignalWatcher( WithDisposable(ShadowlessElement) ).styles

abortController
docTitle
inlineEditor
inlineRange
inputElement
overlayMask
popoverContainer
referenceInfo
saveButton
std
title$
connectedCallback()

connectedCallback(): void

Returns

void

Overrides

SignalWatcher( WithDisposable(ShadowlessElement) ).connectedCallback

attributes

controllers

dev-mode

lifecycle

properties

rendering

render()

render(): TemplateResult<1>

Invoked on each update to perform rendering tasks. This method may return any value renderable by lit-html's ChildPart - typically a TemplateResult. Setting properties inside this method will not trigger the element to update.

Returns

TemplateResult<1>

Overrides

SignalWatcher( WithDisposable(ShadowlessElement) ).render

styles

updates

firstUpdated()

firstUpdated(): void

Invoked when the element is first updated. Implement to perform one time work on the element after update.

ts
firstUpdated() {
  this.renderRoot.getElementById('my-text-area').focus();
}

Setting properties inside this method will trigger the element to update again after this update cycle completes.

Returns

void

Overrides

SignalWatcher( WithDisposable(ShadowlessElement) ).firstUpdated

updated()

updated(): void

Invoked whenever the element is updated. Implement to perform post-updating tasks via DOM APIs, for example, focusing an element.

Setting properties inside this method will trigger the element to update again after this update cycle completes.

Returns

void

Overrides

SignalWatcher( WithDisposable(ShadowlessElement) ).updated

Interfaces

ReferenceNodeConfig

Properties

customContent()?

optional customContent: (reference) => TemplateResult

Parameters
reference

AffineReference

Returns

TemplateResult

hidePopup?

optional hidePopup: boolean

interactable?

optional interactable: boolean

Type Aliases

DocLinkClickedEvent

DocLinkClickedEvent = ReferenceInfo & object

Type Declaration

event?

optional event: MouseEvent

host

host: EditorHost

openMode?

optional openMode: OpenDocMode


RefNodeSlots

RefNodeSlots = object

Properties

docLinkClicked

docLinkClicked: Subject<DocLinkClickedEvent>

Variables

referenceDeltaMarkdownAdapterMatch

const referenceDeltaMarkdownAdapterMatch: ExtensionType & object

Type Declaration

identifier

identifier: ServiceIdentifier<InlineDeltaToPlainTextAdapterMatcher>


referenceDeltaToHtmlAdapterMatcher

const referenceDeltaToHtmlAdapterMatcher: ExtensionType & object

Type Declaration

identifier

identifier: ServiceIdentifier<InlineDeltaToHtmlAdapterMatcher>


referenceDeltaToMarkdownAdapterMatcher

const referenceDeltaToMarkdownAdapterMatcher: ExtensionType & object

Type Declaration

identifier

identifier: ServiceIdentifier<InlineDeltaToMarkdownAdapterMatcher>


ReferenceInlineSpecExtension

const ReferenceInlineSpecExtension: ExtensionType & object

Type Declaration

identifier

identifier: ServiceIdentifier<InlineSpecs<AffineTextAttributes>>


ReferenceNodeConfigExtension

const ReferenceNodeConfigExtension: ConfigFactory<ReferenceNodeConfig>


referenceNodeToolbar

const referenceNodeToolbar: ExtensionType


RefNodeSlotsExtension

const RefNodeSlotsExtension: ExtensionType


RefNodeSlotsProvider

const RefNodeSlotsProvider: ServiceIdentifier<RefNodeSlots> & <U>(variant) => ServiceIdentifier<U>

Functions

insertLinkedNode()

insertLinkedNode(__namedParameters): void

Parameters

__namedParameters
docId

string

inlineEditor

AffineInlineEditor

Returns

void


toggleReferencePopup()

toggleReferencePopup(std, docTitle, referenceInfo, inlineEditor, inlineRange, abortController): ReferencePopup

Parameters

std

BlockStdScope

docTitle

string

referenceInfo
description?

string

pageId

string

params?

{ blockIds?: string[]; commentId?: string; databaseId?: string; databaseRowId?: string; elementIds?: string[]; mode?: "edgeless" | "page"; xywh?: `[${number},${number},${number},${number}]`; }

params.blockIds?

string[]

params.commentId?

string

params.databaseId?

string

params.databaseRowId?

string

params.elementIds?

string[]

params.mode?

"edgeless" | "page"

params.xywh?

`[${number},${number},${number},${number}]`

title?

string

inlineEditor

InlineEditor<AffineTextAttributes>

inlineRange

InlineRange

abortController

AbortController

Returns

ReferencePopup