2
0
Files
bot/apps/builder/libs/plate.tsx
Baptiste Arnaud ee338f62dc build: add pnpm
2022-08-10 18:49:06 +02:00

41 lines
905 B
TypeScript

import {
createBoldPlugin,
createItalicPlugin,
createUnderlinePlugin,
} from '@udecode/plate-basic-marks'
import { createPlugins } from '@udecode/plate-core'
import { createLinkPlugin, ELEMENT_LINK } from '@udecode/plate-link'
import { PlateFloatingLink } from '@udecode/plate-ui-link'
export const editorStyle: React.CSSProperties = {
flex: 1,
padding: '1rem',
backgroundColor: 'white',
borderRadius: '0.25rem',
}
export const platePlugins = createPlugins(
[
createBoldPlugin(),
createItalicPlugin(),
createUnderlinePlugin(),
createLinkPlugin({
renderAfterEditable: PlateFloatingLink,
}),
],
{
components: {
[ELEMENT_LINK]: (props) => (
<a
href={props.element.url}
target="_blank"
rel="noreferrer"
className={props.className}
>
{props.children}
</a>
),
},
}
)