BlockSuite API Documentation / @blocksuite/blocks / CodeBlockComponent
Class: CodeBlockComponent
Extends
CaptionedBlockComponent
<CodeBlockModel
,CodeBlockService
>
Constructors
new CodeBlockComponent()
new CodeBlockComponent():
CodeBlockComponent
Returns
Inherited from
`CaptionedBlockComponent< CodeBlockModel, CodeBlockService
.constructor`
Defined in
packages/affine/components/dist/caption/captioned-block-component.d.ts:14
Other
_disposables
protected
_disposables:DisposableGroup
Inherited from
CaptionedBlockComponent._disposables
Defined in
packages/framework/global/dist/utils/with-disposable.d.ts:5
[blockComponentSymbol]
[blockComponentSymbol]:
boolean
Inherited from
CaptionedBlockComponent.[blockComponentSymbol]
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:14
clipboardController
clipboardController:
CodeClipboardController
Defined in
packages/blocks/src/code-block/code-block.ts:43
disposables
readonly
disposables:DisposableGroup
Inherited from
CaptionedBlockComponent.disposables
Defined in
packages/framework/global/dist/utils/with-disposable.d.ts:6
handleEvent()
handleEvent: (
name
,handler
,options
?) =>void
Parameters
name
"click"
| "doubleClick"
| "tripleClick"
| "pointerDown"
| "pointerMove"
| "pointerUp"
| "pointerOut"
| "dragStart"
| "dragMove"
| "dragEnd"
| "pinch"
| "pan"
| "keyDown"
| "keyUp"
| "selectionChange"
| "compositionStart"
| "compositionUpdate"
| "compositionEnd"
| "cut"
| "copy"
| "paste"
| "nativeDragStart"
| "nativeDragMove"
| "nativeDragEnd"
| "nativeDrop"
| "beforeInput"
| "blur"
| "focus"
| "contextMenu"
| "wheel"
handler
options?
flavour
boolean
global
boolean
Returns
void
Inherited from
CaptionedBlockComponent.handleEvent
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:15
highlightTokens$
highlightTokens$:
Signal
<ThemedToken
[][]>
Defined in
packages/blocks/src/code-block/code-block.ts:45
languageName$
languageName$:
Signal
<string
>
Defined in
packages/blocks/src/code-block/code-block.ts:47
virtualKeyboardPolicy
virtualKeyboardPolicy:
string
Inherited from
CaptionedBlockComponent.virtualKeyboardPolicy
Defined in
packages/framework/global/dist/types/virtual-keyboard.d.ts:20
connectedCount
static
connectedCount:WeakMap
<Constructor
,WeakMap
<Node
,number
>>
Inherited from
CaptionedBlockComponent.connectedCount
Defined in
packages/framework/block-std/dist/view/element/shadowless-element.d.ts:5
onDisconnectedMap
static
onDisconnectedMap:WeakMap
<Constructor
,null
| () =>void
>
Inherited from
CaptionedBlockComponent.onDisconnectedMap
Defined in
packages/framework/block-std/dist/view/element/shadowless-element.d.ts:6
styles
static
styles:CSSResult
=codeBlockStyles
Overrides
CaptionedBlockComponent.styles
Defined in
packages/blocks/src/code-block/code-block.ts:39
_renderers
Inherited from
CaptionedBlockComponent._renderers
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:53
blockContainerStyles
Overrides
CaptionedBlockComponent.blockContainerStyles
Defined in
packages/blocks/src/code-block/code-block.ts:429
blockId
Get Signature
get blockId():
string
Returns
string
Inherited from
CaptionedBlockComponent.blockId
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:19
captionEditor
Get Signature
get captionEditor():
undefined
|BlockCaptionEditor
<BlockModel
<BlockCaptionProps
,BlockCaptionProps
&object
>>
Returns
undefined
| BlockCaptionEditor
<BlockModel
<BlockCaptionProps
, BlockCaptionProps
& object
>>
Inherited from
CaptionedBlockComponent.captionEditor
Defined in
packages/affine/components/dist/caption/captioned-block-component.d.ts:11
childBlocks
Get Signature
get childBlocks():
BlockComponent
<BlockModel
<object
,object
>,BlockService
,string
>[]
Returns
BlockComponent
<BlockModel
<object
, object
>, BlockService
, string
>[]
Inherited from
CaptionedBlockComponent.childBlocks
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:20
doc
Inherited from
CaptionedBlockComponent.doc
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:55
flavour
Get Signature
get flavour():
string
Returns
string
Inherited from
CaptionedBlockComponent.flavour
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:21
host
Get Signature
get host():
EditorHost
Returns
Inherited from
CaptionedBlockComponent.host
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:22
inlineEditor
Get Signature
get inlineEditor():
undefined
|InlineEditor
<{bold
:null
|true
;code
:null
|true
;italic
:null
|true
;link
:null
|string
;strike
:null
|true
;underline
:null
|true
; }>
Returns
undefined
| InlineEditor
<{ bold
: null
| true
; code
: null
| true
; italic
: null
| true
; link
: null
| string
; strike
: null
| true
; underline
: null
| true
; }>
Defined in
packages/blocks/src/code-block/code-block.ts:57
inlineManager
Get Signature
get inlineManager():
InlineManager
Returns
Defined in
packages/blocks/src/code-block/code-block.ts:64
isVersionMismatch
Get Signature
get isVersionMismatch():
boolean
Returns
boolean
Inherited from
CaptionedBlockComponent.isVersionMismatch
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:23
model
Get Signature
get model():
Model
Returns
Model
Inherited from
CaptionedBlockComponent.model
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:24
notificationService
Get Signature
get notificationService():
null
|NotificationService
Returns
null
| NotificationService
Defined in
packages/blocks/src/code-block/code-block.ts:68
parentComponent
Get Signature
get parentComponent():
null
|BlockComponent
<BlockModel
<object
,SignaledProps
<object
>>,BlockService
,string
>
Returns
null
| BlockComponent
<BlockModel
<object
, SignaledProps
<object
>>, BlockService
, string
>
Inherited from
CaptionedBlockComponent.parentComponent
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:25
readonly
Get Signature
get readonly():
boolean
Returns
boolean
Defined in
packages/blocks/src/code-block/code-block.ts:72
renderChildren
Get Signature
get renderChildren(): (
model
,filter
?) =>TemplateResult
Returns
Function
Parameters
model
BlockModel
<object
, SignaledProps
<object
>>
filter?
(model
) => boolean
Returns
TemplateResult
Inherited from
CaptionedBlockComponent.renderChildren
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:26
rootComponent
Get Signature
get rootComponent():
null
|BlockComponent
<BlockModel
<object
,SignaledProps
<object
>>,BlockService
,string
>
Returns
null
| BlockComponent
<BlockModel
<object
, SignaledProps
<object
>>, BlockService
, string
>
Inherited from
CaptionedBlockComponent.rootComponent
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:27
selected
Get Signature
get selected():
null
|BaseSelection
Returns
null
| BaseSelection
Inherited from
CaptionedBlockComponent.selected
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:28
selectedStyle
Inherited from
CaptionedBlockComponent.selectedStyle
Defined in
packages/affine/components/dist/caption/captioned-block-component.d.ts:18
selection
Get Signature
get selection():
SelectionManager
Returns
Inherited from
CaptionedBlockComponent.selection
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:29
service
Get Signature
get service():
Service
Returns
Service
Inherited from
CaptionedBlockComponent.service
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:30
std
Inherited from
CaptionedBlockComponent.std
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:12
topContenteditableElement
Get Signature
get topContenteditableElement():
null
|BlockComponent
<BlockModel
<object
,SignaledProps
<object
>>,BlockService
,string
>
Returns
null
| BlockComponent
<BlockModel
<object
, SignaledProps
<object
>>, BlockService
, string
>
Overrides
CaptionedBlockComponent.topContenteditableElement
Defined in
packages/blocks/src/code-block/code-block.ts:76
useCaptionEditor
Overrides
CaptionedBlockComponent.useCaptionEditor
Defined in
packages/blocks/src/code-block/code-block.ts:433
useZeroWidth
Overrides
CaptionedBlockComponent.useZeroWidth
Defined in
packages/blocks/src/code-block/code-block.ts:435
viewType
Inherited from
CaptionedBlockComponent.viewType
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:56
widgetComponents
Get Signature
get widgetComponents():
Partial
<Record
<WidgetName
,WidgetComponent
<BlockModel
<object
,SignaledProps
<object
>>,BlockComponent
<BlockModel
<object
,SignaledProps
<object
>>,BlockService
,string
>,BlockService
>>>
Returns
Partial
<Record
<WidgetName
, WidgetComponent
<BlockModel
<object
, SignaledProps
<object
>>, BlockComponent
<BlockModel
<object
, SignaledProps
<object
>>, BlockService
, string
>, BlockService
>>>
Inherited from
CaptionedBlockComponent.widgetComponents
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:32
widgets
Inherited from
CaptionedBlockComponent.widgets
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:57
addRenderer()
addRenderer(
renderer
):void
Parameters
renderer
(content
) => unknown
Returns
void
Inherited from
CaptionedBlockComponent.addRenderer
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:35
bindHotKey()
bindHotKey(
keymap
,options
?): () =>void
Parameters
keymap
Record
<string
, UIEventHandler
>
options?
flavour
boolean
global
boolean
Returns
Function
Returns
void
Inherited from
CaptionedBlockComponent.bindHotKey
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:36
connectedCallback()
connectedCallback():
void
Returns
void
Overrides
CaptionedBlockComponent.connectedCallback
Defined in
packages/blocks/src/code-block/code-block.ts:137
copyCode()
copyCode():
void
Returns
void
Defined in
packages/blocks/src/code-block/code-block.ts:356
disconnectedCallback()
disconnectedCallback():
void
Returns
void
Overrides
CaptionedBlockComponent.disconnectedCallback
Defined in
packages/blocks/src/code-block/code-block.ts:370
getUpdateComplete()
getUpdateComplete():
Promise
<boolean
>
Returns
Promise
<boolean
>
Overrides
CaptionedBlockComponent.getUpdateComplete
Defined in
packages/blocks/src/code-block/code-block.ts:375
renderBlock()
renderBlock():
TemplateResult
<1
>
Returns
TemplateResult
<1
>
Overrides
CaptionedBlockComponent.renderBlock
Defined in
packages/blocks/src/code-block/code-block.ts:381
renderVersionMismatch()
renderVersionMismatch(
expectedVersion
,actualVersion
):TemplateResult
Render a warning message when the block version is mismatched.
Parameters
expectedVersion
number
If the schema is not found, the expected version is -1. Which means the block is not supported in the current editor.
actualVersion
number
The version of the block's crdt data.
Returns
TemplateResult
Inherited from
CaptionedBlockComponent.renderVersionMismatch
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:51
setWrap()
setWrap(
wrap
):void
Parameters
wrap
boolean
Returns
void
Defined in
packages/blocks/src/code-block/code-block.ts:422
rendering
createRenderRoot()
createRenderRoot():
this
Returns
this
Inherited from
CaptionedBlockComponent.createRenderRoot
Defined in
packages/framework/block-std/dist/view/element/shadowless-element.d.ts:11
render()
render():
unknown
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
unknown
Inherited from
CaptionedBlockComponent.render
Defined in
packages/framework/block-std/dist/view/element/block-component.d.ts:43
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
CaptionedBlockComponent.finalizeStyles
Defined in
packages/framework/block-std/dist/view/element/shadowless-element.d.ts:7