-
-
Notifications
You must be signed in to change notification settings - Fork 755
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a06713
commit 4f31bcb
Showing
13 changed files
with
110 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/core/src/lib/static/components/DefaultStaticElement.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react'; | ||
|
||
import type { RenderElementProps } from 'slate-react/dist/components/editable'; | ||
|
||
export function DefaultStaticElement({ | ||
attributes, | ||
children, | ||
}: RenderElementProps) { | ||
return <div {...attributes}>{children}</div>; | ||
} |
7 changes: 7 additions & 0 deletions
7
packages/core/src/lib/static/components/DefaultStaticLeaf.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import React from 'react'; | ||
|
||
import type { RenderLeafProps } from 'slate-react/dist/components/editable'; | ||
|
||
export function DefaultStaticLeaf({ attributes, children }: RenderLeafProps) { | ||
return <span {...attributes}>{children}</span>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* @file Automatically generated by barrelsby. | ||
*/ | ||
|
||
export * from './DefaultStaticElement'; | ||
export * from './DefaultStaticLeaf'; | ||
export * from './PlateStatic'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import type { TElement, TText } from '@udecode/slate'; | ||
|
||
export interface TRenderStaticElementProps<T extends TElement = TElement> { | ||
attributes: { | ||
'data-slate-node': 'element'; | ||
ref: any; | ||
'data-slate-inline'?: true; | ||
'data-slate-void'?: true; | ||
dir?: 'rtl'; | ||
}; | ||
children: any; | ||
element: T; | ||
} | ||
|
||
export type RenderStaticElement<T extends TElement = TElement> = ( | ||
props: TRenderStaticElementProps<T> | ||
) => React.ReactElement | undefined; | ||
|
||
export interface StaticElementProps<T extends TElement = TElement> { | ||
attributes?: Record<string, any>; | ||
children?: React.ReactNode; | ||
element?: T; | ||
} | ||
|
||
export interface TRenderStaticLeafProps<N extends TText = TText> { | ||
attributes: { | ||
'data-slate-leaf': true; | ||
}; | ||
children: any; | ||
leaf: N; | ||
text: N; | ||
} | ||
|
||
export type RenderStaticLeaf<N extends TText = TText> = ( | ||
props: TRenderStaticLeafProps<N> | ||
) => React.ReactElement | undefined; | ||
|
||
export interface StaticLeafProps<N extends TText = TText> { | ||
as?: React.ElementType; | ||
attributes?: Record<string, any>; | ||
children?: React.ReactNode; | ||
leaf?: N; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react'; | ||
|
||
export function createStaticString({ text }: { text: string }) { | ||
return React.createElement( | ||
'span', | ||
{ 'data-slate-string': true }, | ||
text === '' ? '\uFEFF' : text | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** | ||
* @file Automatically generated by barrelsby. | ||
*/ | ||
|
||
export * from './createStaticString'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters