@@ -46,10 +46,10 @@ export class BlockRenderer
46
46
accessor view ! : DataViewTableManager | DataViewKanbanManager ;
47
47
@property ( { attribute : false } )
48
48
accessor rowId ! : string ;
49
- host ?: EditorHost ;
50
-
49
+ @ property ( { attribute : false } )
50
+ accessor host ! : EditorHost ;
51
51
get model ( ) {
52
- return this . host ?. doc . getBlockById ( this . rowId ) ;
52
+ return this . host ?. doc . getBlock ( this . rowId ) ?. model ;
53
53
}
54
54
55
55
get topContenteditableElement ( ) {
@@ -60,7 +60,6 @@ export class BlockRenderer
60
60
61
61
public override connectedCallback ( ) {
62
62
super . connectedCallback ( ) ;
63
- this . host = this . closest ( 'editor-host' ) ?? undefined ;
64
63
this . _disposables . addFromEvent (
65
64
this . topContenteditableElement ?? this ,
66
65
'keydown' ,
@@ -95,11 +94,31 @@ export class BlockRenderer
95
94
</ div > ` ;
96
95
}
97
96
97
+ get service ( ) {
98
+ return this . host . std . spec . getService ( 'affine:database' ) ;
99
+ }
100
+ get inlineManager ( ) {
101
+ return this . service . inlineManager ;
102
+ }
103
+ get attributesSchema ( ) {
104
+ return this . inlineManager . getSchema ( ) ;
105
+ }
106
+ get attributeRenderer ( ) {
107
+ return this . inlineManager . getRenderer ( ) ;
108
+ }
98
109
protected override render ( ) : unknown {
99
110
const model = this . model ;
100
111
if ( ! model ) {
101
112
return ;
102
113
}
103
- return html ` ${ this . host ?. renderModel ( model ) } ${ this . renderIcon ( ) } ` ;
114
+ return html `< rich-text
115
+ .yText =${ model . text }
116
+ .attributesSchema =${ this . attributesSchema }
117
+ .attributeRenderer=${ this . attributeRenderer }
118
+ .embedChecker=${ this . inlineManager . embedChecker }
119
+ .markdownShortcutHandler=${ this . inlineManager . markdownShortcutHandler }
120
+ class="inline-editor"
121
+ > </ rich-text
122
+ > ${ this . renderIcon ( ) } ` ;
104
123
}
105
124
}
0 commit comments