Skip to content

BlockSuite API Documentation / @blocksuite/blocks / AffineReference

Class: AffineReference

Extends

  • AffineReference_base

Constructors

new AffineReference()

new AffineReference(): AffineReference

Returns

AffineReference

Inherited from

AffineReference_base.constructor

Defined in

node_modules/@lit/reactive-element/development/reactive-element.d.ts:504

Other

_disposables

protected _disposables: DisposableGroup

Inherited from

AffineReference_base._disposables

Defined in

packages/framework/block-std/dist/view/utils/with-disposable.d.ts:4


disposables

readonly disposables: DisposableGroup

Inherited from

AffineReference_base.disposables

Defined in

packages/framework/block-std/dist/view/utils/with-disposable.d.ts:5


disableShadowRoot

static disableShadowRoot: boolean

Inherited from

AffineReference_base.disableShadowRoot

Defined in

packages/framework/block-std/dist/view/element/shadowless-element.d.ts:4


styles

static styles: CSSResult

Overrides

AffineReference_base.styles

Defined in

packages/affine/components/dist/rich-text/inline/presets/nodes/reference-node/reference-node.d.ts:11


block

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

Returns

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

Defined in

packages/affine/components/dist/rich-text/inline/presets/nodes/reference-node/reference-node.d.ts:15


config

Defined in

packages/affine/components/dist/rich-text/inline/presets/nodes/reference-node/reference-node.d.ts:29


customContent

get customContent(): null | (reference) => TemplateResult<ResultType>

Returns

null | (reference) => TemplateResult<ResultType>

Defined in

packages/affine/components/dist/rich-text/inline/presets/nodes/reference-node/reference-node.d.ts:16


customIcon

get customIcon(): null | (reference) => TemplateResult<ResultType>

Returns

null | (reference) => TemplateResult<ResultType>

Defined in

packages/affine/components/dist/rich-text/inline/presets/nodes/reference-node/reference-node.d.ts:17


customTitle

get customTitle(): null | (reference) => string

Returns

null | (reference) => string

Defined in

packages/affine/components/dist/rich-text/inline/presets/nodes/reference-node/reference-node.d.ts:18


delta

Defined in

packages/affine/components/dist/rich-text/inline/presets/nodes/reference-node/reference-node.d.ts:30


doc

get doc(): Doc

Returns

Doc

Defined in

packages/affine/components/dist/rich-text/inline/presets/nodes/reference-node/reference-node.d.ts:19


inlineEditor

get inlineEditor(): undefined | InlineEditor<AffineTextAttributes>

Returns

undefined | InlineEditor<AffineTextAttributes>

Defined in

packages/affine/components/dist/rich-text/inline/presets/nodes/reference-node/reference-node.d.ts:20


referenceInfo

get referenceInfo(): object

Returns

object

pageId

pageId: string

params?

optional params: object

params.blockIds?

optional params.blockIds: string[]

params.elementIds?

optional params.elementIds: string[]

params.mode?

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

Defined in

packages/affine/components/dist/rich-text/inline/presets/nodes/reference-node/reference-node.d.ts:21


refMeta

Defined in

packages/affine/components/dist/rich-text/inline/presets/nodes/reference-node/reference-node.d.ts:31


selected

Defined in

packages/affine/components/dist/rich-text/inline/presets/nodes/reference-node/reference-node.d.ts:32


selfInlineRange

get selfInlineRange(): undefined | null | InlineRange

Returns

undefined | null | InlineRange

Defined in

packages/affine/components/dist/rich-text/inline/presets/nodes/reference-node/reference-node.d.ts:22


std

get std(): BlockStdScope

Returns

BlockStdScope

Defined in

packages/affine/components/dist/rich-text/inline/presets/nodes/reference-node/reference-node.d.ts:23


isLinkedNode()

isLinkedNode(): boolean

Returns

boolean

Defined in

packages/affine/components/dist/rich-text/inline/presets/nodes/reference-node/reference-node.d.ts:26

lifecycle

connectedCallback()

connectedCallback(): void

Invoked when the component is added to the document's DOM.

In connectedCallback() you should setup tasks that should only occur when the element is connected to the document. The most common of these is adding event listeners to nodes external to the element, like a keydown event handler added to the window.

ts
connectedCallback() {
  super.connectedCallback();
  addEventListener('keydown', this._handleKeydown);
}

Typically, anything done in connectedCallback() should be undone when the element is disconnected, in disconnectedCallback().

Returns

void

Overrides

AffineReference_base.connectedCallback

Defined in

packages/affine/components/dist/rich-text/inline/presets/nodes/reference-node/reference-node.d.ts:25

rendering

createRenderRoot()

createRenderRoot(): HTMLElement | DocumentFragment

Returns

HTMLElement | DocumentFragment

Inherited from

AffineReference_base.createRenderRoot

Defined in

packages/framework/block-std/dist/view/element/shadowless-element.d.ts:6


render()

render(): TemplateResult<1> | typeof nothing

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> | typeof nothing

Overrides

AffineReference_base.render

Defined in

packages/affine/components/dist/rich-text/inline/presets/nodes/reference-node/reference-node.d.ts:27

styles

finalizeStyles()

protected static finalizeStyles(styles?): CSSResultOrNative[]

Takes the styles the user supplied via the static styles property and returns the array of styles to apply to the element. Override this method to integrate into a style management system.

Styles are deduplicated preserving the last instance in the list. This is a performance optimization to avoid duplicated styles that can occur especially when composing via subclassing. The last item is kept to try to preserve the cascade order with the assumption that it's most important that last added styles override previous styles.

Parameters

styles?: CSSResultGroup

Returns

CSSResultOrNative[]

Nocollapse

Inherited from

AffineReference_base.finalizeStyles

Defined in

packages/framework/block-std/dist/view/element/shadowless-element.d.ts:5

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

AffineReference_base.willUpdate

Defined in

packages/affine/components/dist/rich-text/inline/presets/nodes/reference-node/reference-node.d.ts:28