BlockSuite API Documentation / @blocksuite/blocks / FramePreview
Class: FramePreview
Extends
ShadowlessElement
<this
> &DisposableClass
<this
>
Constructors
new FramePreview()
new FramePreview():
FramePreview
Returns
Inherited from
WithDisposable(ShadowlessElement).constructor
Defined in
node_modules/.pnpm/@[email protected]/node_modules/@lit/reactive-element/development/reactive-element.d.ts:504
Other
_disposables
protected
_disposables:DisposableGroup
Inherited from
WithDisposable(ShadowlessElement)._disposables
Defined in
packages/framework/block-std/dist/view/utils/with-disposable.d.ts:4
disposables
readonly
disposables:DisposableGroup
Inherited from
WithDisposable(ShadowlessElement).disposables
Defined in
packages/framework/block-std/dist/view/utils/with-disposable.d.ts:5
disableShadowRoot
static
disableShadowRoot:boolean
Inherited from
WithDisposable(ShadowlessElement).disableShadowRoot
Defined in
packages/framework/block-std/dist/view/element/shadowless-element.d.ts:4
styles
static
styles:CSSResult
Overrides
WithDisposable(ShadowlessElement).styles
Defined in
packages/blocks/src/root-block/edgeless/components/frame/frame-preview.ts:64
doc
Defined in
packages/blocks/src/root-block/edgeless/components/frame/frame-preview.ts:218
edgeless
Defined in
packages/blocks/src/root-block/edgeless/components/frame/frame-preview.ts:221
fillScreen
Defined in
packages/blocks/src/root-block/edgeless/components/frame/frame-preview.ts:224
frame
Defined in
packages/blocks/src/root-block/edgeless/components/frame/frame-preview.ts:227
host
Defined in
packages/blocks/src/root-block/edgeless/components/frame/frame-preview.ts:230
previewEditor
Defined in
packages/blocks/src/root-block/edgeless/components/frame/frame-preview.ts:233
surfaceHeight
Defined in
packages/blocks/src/root-block/edgeless/components/frame/frame-preview.ts:236
surfaceWidth
Defined in
packages/blocks/src/root-block/edgeless/components/frame/frame-preview.ts:239
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.
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
WithDisposable(ShadowlessElement).connectedCallback
Defined in
packages/blocks/src/root-block/edgeless/components/frame/frame-preview.ts:186
disconnectedCallback()
disconnectedCallback():
void
Invoked when the component is removed from the document's DOM.
This callback is the main signal to the element that it may no longer be used. disconnectedCallback()
should ensure that nothing is holding a reference to the element (such as event listeners added to nodes external to the element), so that it is free to be garbage collected.
disconnectedCallback() {
super.disconnectedCallback();
window.removeEventListener('keydown', this._handleKeydown);
}
An element may be re-connected after being disconnected.
Returns
void
Overrides
WithDisposable(ShadowlessElement).disconnectedCallback
Defined in
packages/blocks/src/root-block/edgeless/components/frame/frame-preview.ts:192
rendering
createRenderRoot()
createRenderRoot():
HTMLElement
|DocumentFragment
Returns
HTMLElement
| DocumentFragment
Inherited from
WithDisposable(ShadowlessElement).createRenderRoot
Defined in
packages/framework/block-std/dist/view/element/shadowless-element.d.ts:6
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
WithDisposable(ShadowlessElement).render
Defined in
packages/blocks/src/root-block/edgeless/components/frame/frame-preview.ts:202
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
WithDisposable(ShadowlessElement).finalizeStyles
Defined in
packages/framework/block-std/dist/view/element/shadowless-element.d.ts:5
updates
firstUpdated()
firstUpdated():
void
Invoked when the element is first updated. Implement to perform one time work on the element after update.
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
WithDisposable(ShadowlessElement).firstUpdated
Defined in
packages/blocks/src/root-block/edgeless/components/frame/frame-preview.ts:197
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.
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
Defined in
packages/blocks/src/root-block/edgeless/components/frame/frame-preview.ts:211