@@ -4,7 +4,8 @@ import {context, type PeritextSurfaceContextValue} from './context';
44import { CssClass } from '../constants' ;
55import { BlockView } from './BlockView' ;
66import { DomController } from '../dom/DomController' ;
7- import { renderers as defaultRenderers } from '../plugins/minimal' ;
7+ import { cursorPlugin } from '../plugins/cursor' ;
8+ import { defaultPlugin } from '../plugins/minimal' ;
89import type { Peritext } from '../../json-crdt-extensions/peritext/Peritext' ;
910import type { PeritextPlugin } from './types' ;
1011
@@ -33,13 +34,13 @@ put('.' + CssClass.Inline, {
3334 */
3435export interface PeritextViewProps {
3536 peritext : Peritext ;
36- renderers ?: PeritextPlugin [ ] ;
37+ plugins ?: PeritextPlugin [ ] ;
3738 onRender ?: ( ) => void ;
3839}
3940
4041/** @todo Is `React.memo` needed here? */
4142export const PeritextView : React . FC < PeritextViewProps > = React . memo ( ( props ) => {
42- const { peritext, renderers = [ defaultRenderers ] , onRender} = props ;
43+ const { peritext, plugins = [ cursorPlugin , defaultPlugin ] , onRender} = props ;
4344 const [ , setTick ] = React . useState ( 0 ) ;
4445 const [ dom , setDom ] = React . useState < DomController | undefined > ( undefined ) ;
4546
@@ -71,8 +72,8 @@ export const PeritextView: React.FC<PeritextViewProps> = React.memo((props) => {
7172 ) ;
7273
7374 const ctx : undefined | PeritextSurfaceContextValue = React . useMemo (
74- ( ) => ( dom ? { peritext, dom, renderers, rerender} : undefined ) ,
75- [ peritext , dom , renderers , rerender ] ,
75+ ( ) => ( dom ? { peritext, dom, renderers : plugins , rerender} : undefined ) ,
76+ [ peritext , dom , plugins , rerender ] ,
7677 ) ;
7778
7879 const block = peritext . blocks . root ;
@@ -88,7 +89,7 @@ export const PeritextView: React.FC<PeritextViewProps> = React.memo((props) => {
8889 </ div >
8990 ) ;
9091
91- for ( const map of renderers ) children = map . peritext ?.( props , children , ctx ) ?? children ;
92+ for ( const map of plugins ) children = map . peritext ?.( props , children , ctx ) ?? children ;
9293
9394 return children ;
9495} ) ;
0 commit comments