diff --git a/packages/richtext-slate/src/field/RichText.tsx b/packages/richtext-slate/src/field/RichText.tsx
index 6d670680a..9ba2d07ea 100644
--- a/packages/richtext-slate/src/field/RichText.tsx
+++ b/packages/richtext-slate/src/field/RichText.tsx
@@ -19,12 +19,12 @@ import type { EnabledFeatures } from './types.d.ts'
import { defaultRichTextValue } from '../data/defaultValue.js'
import { richTextValidate } from '../data/validation.js'
-import listTypes from './elements/listTypes.js'
-import hotkeys from './hotkeys.js'
+import { listTypes } from './elements/listTypes.js'
+import { hotkeys } from './hotkeys.js'
import './index.scss'
-import toggleLeaf from './leaves/toggle.js'
-import withEnterBreakOut from './plugins/withEnterBreakOut.js'
-import withHTML from './plugins/withHTML.js'
+import { toggleLeaf } from './leaves/toggle.js'
+import { withEnterBreakOut } from './plugins/withEnterBreakOut.js'
+import { withHTML } from './plugins/withHTML.js'
import { ElementButtonProvider } from './providers/ElementButtonProvider.js'
import { ElementProvider } from './providers/ElementProvider.js'
import { LeafButtonProvider } from './providers/LeafButtonProvider.js'
@@ -40,7 +40,7 @@ declare module 'slate' {
}
}
-const RichText: React.FC<
+const RichTextField: React.FC<
FormFieldBase & {
elements: EnabledFeatures['elements']
leaves: EnabledFeatures['leaves']
@@ -432,4 +432,4 @@ const RichText: React.FC<
)
}
-export default withCondition(RichText)
+export const RichText = withCondition(RichTextField)
diff --git a/packages/richtext-slate/src/field/elements/Button.tsx b/packages/richtext-slate/src/field/elements/Button.tsx
index 41f101be8..e26dbdaf4 100644
--- a/packages/richtext-slate/src/field/elements/Button.tsx
+++ b/packages/richtext-slate/src/field/elements/Button.tsx
@@ -8,12 +8,12 @@ import { useSlate } from 'slate-react'
import type { ButtonProps } from './types.d.ts'
import '../buttons.scss'
-import isElementActive from './isActive.js'
-import toggleElement from './toggle.js'
+import { isElementActive } from './isActive.js'
+import { toggleElement } from './toggle.js'
export const baseClass = 'rich-text__button'
-const ElementButton: React.FC = (props) => {
+export const ElementButton: React.FC = (props) => {
const { type = 'type', children, className, el = 'button', format, onClick, tooltip } = props
const editor = useSlate()
@@ -49,5 +49,3 @@ const ElementButton: React.FC = (props) => {
)
}
-
-export default ElementButton
diff --git a/packages/richtext-slate/src/field/elements/ListButton.tsx b/packages/richtext-slate/src/field/elements/ListButton.tsx
index 8c36a38ab..8e33e3139 100644
--- a/packages/richtext-slate/src/field/elements/ListButton.tsx
+++ b/packages/richtext-slate/src/field/elements/ListButton.tsx
@@ -6,12 +6,12 @@ import { useSlate } from 'slate-react'
import type { ButtonProps } from './types.d.ts'
import '../buttons.scss'
-import isListActive from './isListActive.js'
-import toggleList from './toggleList.js'
+import { isListActive } from './isListActive.js'
+import { toggleList } from './toggleList.js'
export const baseClass = 'rich-text__button'
-const ListButton: React.FC = ({ children, className, format, onClick }) => {
+export const ListButton: React.FC = ({ children, className, format, onClick }) => {
const editor = useSlate()
const defaultOnClick = useCallback(
@@ -38,5 +38,3 @@ const ListButton: React.FC = ({ children, className, format, onClic
)
}
-
-export default ListButton
diff --git a/packages/richtext-slate/src/field/elements/blockquote/index.tsx b/packages/richtext-slate/src/field/elements/blockquote/index.tsx
index a82abd91b..38169e3a6 100644
--- a/packages/richtext-slate/src/field/elements/blockquote/index.tsx
+++ b/packages/richtext-slate/src/field/elements/blockquote/index.tsx
@@ -2,13 +2,13 @@ import React from 'react'
import type { RichTextCustomElement } from '../../../types.d.ts'
-import BlockquoteIcon from '../../icons/Blockquote/index.js'
-import ElementButton from '../Button.js'
+import { BlockquoteIcon } from '../../icons/Blockquote/index.js'
+import { ElementButton } from '../Button.js'
import { Blockquote } from './Blockquote.js'
const name = 'blockquote'
-const blockquote: RichTextCustomElement = {
+export const blockquote: RichTextCustomElement = {
name,
Button: () => (
@@ -17,5 +17,3 @@ const blockquote: RichTextCustomElement = {
),
Element: Blockquote,
}
-
-export default blockquote
diff --git a/packages/richtext-slate/src/field/elements/h1/index.tsx b/packages/richtext-slate/src/field/elements/h1/index.tsx
index 2b096ed48..6cbab1b1b 100644
--- a/packages/richtext-slate/src/field/elements/h1/index.tsx
+++ b/packages/richtext-slate/src/field/elements/h1/index.tsx
@@ -2,13 +2,13 @@ import React from 'react'
import type { RichTextCustomElement } from '../../../types.d.ts'
-import H1Icon from '../../icons/headings/H1/index.js'
-import ElementButton from '../Button.js'
+import { H1Icon } from '../../icons/headings/H1/index.js'
+import { ElementButton } from '../Button.js'
import { Heading1 } from './Heading1.js'
const name = 'h1'
-const h1: RichTextCustomElement = {
+export const h1: RichTextCustomElement = {
name,
Button: () => (
@@ -17,5 +17,3 @@ const h1: RichTextCustomElement = {
),
Element: Heading1,
}
-
-export default h1
diff --git a/packages/richtext-slate/src/field/elements/h2/index.tsx b/packages/richtext-slate/src/field/elements/h2/index.tsx
index ba9c6f51a..b857b78d8 100644
--- a/packages/richtext-slate/src/field/elements/h2/index.tsx
+++ b/packages/richtext-slate/src/field/elements/h2/index.tsx
@@ -2,13 +2,13 @@ import React from 'react'
import type { RichTextCustomElement } from '../../../types.d.ts'
-import H2Icon from '../../icons/headings/H2/index.js'
-import ElementButton from '../Button.js'
+import { H2Icon } from '../../icons/headings/H2/index.js'
+import { ElementButton } from '../Button.js'
import { Heading2 } from './Heading2.js'
const name = 'h2'
-const h2: RichTextCustomElement = {
+export const h2: RichTextCustomElement = {
name,
Button: () => (
@@ -17,5 +17,3 @@ const h2: RichTextCustomElement = {
),
Element: Heading2,
}
-
-export default h2
diff --git a/packages/richtext-slate/src/field/elements/h3/index.tsx b/packages/richtext-slate/src/field/elements/h3/index.tsx
index 5a7921525..eff8a0bcf 100644
--- a/packages/richtext-slate/src/field/elements/h3/index.tsx
+++ b/packages/richtext-slate/src/field/elements/h3/index.tsx
@@ -2,13 +2,13 @@ import React from 'react'
import type { RichTextCustomElement } from '../../../types.d.ts'
-import H3Icon from '../../icons/headings/H3/index.js'
-import ElementButton from '../Button.js'
+import { H3Icon } from '../../icons/headings/H3/index.js'
+import { ElementButton } from '../Button.js'
import { Heading3 } from './Heading3.js'
const name = 'h3'
-const h3: RichTextCustomElement = {
+export const h3: RichTextCustomElement = {
name,
Button: () => (
@@ -17,5 +17,3 @@ const h3: RichTextCustomElement = {
),
Element: Heading3,
}
-
-export default h3
diff --git a/packages/richtext-slate/src/field/elements/h4/index.tsx b/packages/richtext-slate/src/field/elements/h4/index.tsx
index d123da243..facbf3894 100644
--- a/packages/richtext-slate/src/field/elements/h4/index.tsx
+++ b/packages/richtext-slate/src/field/elements/h4/index.tsx
@@ -2,13 +2,13 @@ import React from 'react'
import type { RichTextCustomElement } from '../../../types.d.ts'
-import H4Icon from '../../icons/headings/H4/index.js'
-import ElementButton from '../Button.js'
+import { H4Icon } from '../../icons/headings/H4/index.js'
+import { ElementButton } from '../Button.js'
import { Heading4 } from './Heading4.js'
const name = 'h4'
-const h4: RichTextCustomElement = {
+export const h4: RichTextCustomElement = {
name,
Button: () => (
@@ -17,5 +17,3 @@ const h4: RichTextCustomElement = {
),
Element: Heading4,
}
-
-export default h4
diff --git a/packages/richtext-slate/src/field/elements/h5/index.tsx b/packages/richtext-slate/src/field/elements/h5/index.tsx
index e99bef351..0d07eb76d 100644
--- a/packages/richtext-slate/src/field/elements/h5/index.tsx
+++ b/packages/richtext-slate/src/field/elements/h5/index.tsx
@@ -2,13 +2,13 @@ import React from 'react'
import type { RichTextCustomElement } from '../../../types.d.ts'
-import H5Icon from '../../icons/headings/H5/index.js'
-import ElementButton from '../Button.js'
+import { H5Icon } from '../../icons/headings/H5/index.js'
+import { ElementButton } from '../Button.js'
import { Heading5 } from './Heading5.js'
const name = 'h5'
-const h5: RichTextCustomElement = {
+export const h5: RichTextCustomElement = {
name,
Button: () => (
@@ -17,5 +17,3 @@ const h5: RichTextCustomElement = {
),
Element: Heading5,
}
-
-export default h5
diff --git a/packages/richtext-slate/src/field/elements/h6/index.tsx b/packages/richtext-slate/src/field/elements/h6/index.tsx
index e8e625ad3..a3adf6203 100644
--- a/packages/richtext-slate/src/field/elements/h6/index.tsx
+++ b/packages/richtext-slate/src/field/elements/h6/index.tsx
@@ -2,13 +2,13 @@ import React from 'react'
import type { RichTextCustomElement } from '../../../types.d.ts'
-import H6Icon from '../../icons/headings/H6/index.js'
-import ElementButton from '../Button.js'
+import { H6Icon } from '../../icons/headings/H6/index.js'
+import { ElementButton } from '../Button.js'
import { Heading6 } from './Heading6.js'
const name = 'h6'
-const h6: RichTextCustomElement = {
+export const h6: RichTextCustomElement = {
name,
Button: () => (
@@ -17,5 +17,3 @@ const h6: RichTextCustomElement = {
),
Element: Heading6,
}
-
-export default h6
diff --git a/packages/richtext-slate/src/field/elements/indent/Button.tsx b/packages/richtext-slate/src/field/elements/indent/Button.tsx
index f9cca970a..5b4076146 100644
--- a/packages/richtext-slate/src/field/elements/indent/Button.tsx
+++ b/packages/richtext-slate/src/field/elements/indent/Button.tsx
@@ -7,13 +7,13 @@ import { ReactEditor, useSlate } from 'slate-react'
import type { ElementNode } from '../../../types.d.ts'
-import IndentLeft from '../../icons/IndentLeft/index.js'
-import IndentRight from '../../icons/IndentRight/index.js'
+import { IndentLeft } from '../../icons/IndentLeft/index.js'
+import { IndentRight } from '../../icons/IndentRight/index.js'
import { baseClass } from '../Button.js'
import { getCommonBlock } from '../getCommonBlock.js'
-import isElementActive from '../isActive.js'
+import { isElementActive } from '../isActive.js'
import { isBlockElement } from '../isBlockElement.js'
-import listTypes from '../listTypes.js'
+import { listTypes } from '../listTypes.js'
import { unwrapList } from '../unwrapList.js'
import { indentType } from './shared.js'
diff --git a/packages/richtext-slate/src/field/elements/indent/index.ts b/packages/richtext-slate/src/field/elements/indent/index.ts
index c4b99731b..11cf5fbf2 100644
--- a/packages/richtext-slate/src/field/elements/indent/index.ts
+++ b/packages/richtext-slate/src/field/elements/indent/index.ts
@@ -4,10 +4,8 @@ import { IndentButton } from './Button.js'
import { IndentElement } from './Element.js'
import { indentType } from './shared.js'
-const indent: RichTextCustomElement = {
+export const indent: RichTextCustomElement = {
name: indentType,
Button: IndentButton,
Element: IndentElement,
}
-
-export default indent
diff --git a/packages/richtext-slate/src/field/elements/index.tsx b/packages/richtext-slate/src/field/elements/index.tsx
index 56fea227b..c154d7036 100644
--- a/packages/richtext-slate/src/field/elements/index.tsx
+++ b/packages/richtext-slate/src/field/elements/index.tsx
@@ -1,22 +1,22 @@
import type { RichTextCustomElement } from '../../types.d.ts'
-import blockquote from './blockquote/index.js'
-import h1 from './h1/index.js'
-import h2 from './h2/index.js'
-import h3 from './h3/index.js'
-import h4 from './h4/index.js'
-import h5 from './h5/index.js'
-import h6 from './h6/index.js'
-import indent from './indent/index.js'
-import li from './li/index.js'
-import link from './link/index.js'
-import ol from './ol/index.js'
-import relationship from './relationship/index.js'
-import textAlign from './textAlign/index.js'
-import ul from './ul/index.js'
-import upload from './upload/index.js'
+import { blockquote } from './blockquote/index.js'
+import { h1 } from './h1/index.js'
+import { h2 } from './h2/index.js'
+import { h3 } from './h3/index.js'
+import { h4 } from './h4/index.js'
+import { h5 } from './h5/index.js'
+import { h6 } from './h6/index.js'
+import { indent } from './indent/index.js'
+import { li } from './li/index.js'
+import { link } from './link/index.js'
+import { ol } from './ol/index.js'
+import { relationship } from './relationship/index.js'
+import { textAlign } from './textAlign/index.js'
+import { ul } from './ul/index.js'
+import { upload } from './upload/index.js'
-const elements: Record = {
+export const elements: Record = {
blockquote,
h1,
h2,
@@ -33,5 +33,3 @@ const elements: Record = {
ul,
upload,
}
-
-export default elements
diff --git a/packages/richtext-slate/src/field/elements/isActive.tsx b/packages/richtext-slate/src/field/elements/isActive.tsx
index 7af2cfcba..a7580e241 100644
--- a/packages/richtext-slate/src/field/elements/isActive.tsx
+++ b/packages/richtext-slate/src/field/elements/isActive.tsx
@@ -1,6 +1,6 @@
import { Editor, Element } from 'slate'
-const isElementActive = (editor: Editor, format: string, blockType = 'type'): boolean => {
+export const isElementActive = (editor: Editor, format: string, blockType = 'type'): boolean => {
if (!editor.selection) return false
const [match] = Array.from(
@@ -12,5 +12,3 @@ const isElementActive = (editor: Editor, format: string, blockType = 'type'): bo
return !!match
}
-
-export default isElementActive
diff --git a/packages/richtext-slate/src/field/elements/isListActive.ts b/packages/richtext-slate/src/field/elements/isListActive.ts
index 36897e20b..869339dd5 100644
--- a/packages/richtext-slate/src/field/elements/isListActive.ts
+++ b/packages/richtext-slate/src/field/elements/isListActive.ts
@@ -2,7 +2,7 @@ import { Editor, Element } from 'slate'
import { getCommonBlock } from './getCommonBlock.js'
-const isListActive = (editor: Editor, format: string): boolean => {
+export const isListActive = (editor: Editor, format: string): boolean => {
if (!editor.selection) return false
const [topmostSelectedNode, topmostSelectedNodePath] = getCommonBlock(editor)
@@ -25,5 +25,3 @@ const isListActive = (editor: Editor, format: string): boolean => {
return !!match
}
-
-export default isListActive
diff --git a/packages/richtext-slate/src/field/elements/li/ListItem.tsx b/packages/richtext-slate/src/field/elements/li/ListItem.tsx
index 16d4e400a..260a14229 100644
--- a/packages/richtext-slate/src/field/elements/li/ListItem.tsx
+++ b/packages/richtext-slate/src/field/elements/li/ListItem.tsx
@@ -5,7 +5,7 @@ import type { Element } from 'slate'
import React, { isValidElement } from 'react'
import { useElement } from '../../providers/ElementProvider.js'
-import listTypes from '../listTypes.js'
+import { listTypes } from '../listTypes.js'
export const ListItemElement: React.FC = () => {
const { attributes, children, element } = useElement()
diff --git a/packages/richtext-slate/src/field/elements/li/index.tsx b/packages/richtext-slate/src/field/elements/li/index.tsx
index 6b65a7ea5..cd9e96fc5 100644
--- a/packages/richtext-slate/src/field/elements/li/index.tsx
+++ b/packages/richtext-slate/src/field/elements/li/index.tsx
@@ -2,9 +2,7 @@ import type { RichTextCustomElement } from '../../../types.d.ts'
import { ListItemElement } from './ListItem.js'
-const listItem: RichTextCustomElement = {
+export const li: RichTextCustomElement = {
name: 'li',
Element: ListItemElement,
}
-
-export default listItem
diff --git a/packages/richtext-slate/src/field/elements/link/Button/index.tsx b/packages/richtext-slate/src/field/elements/link/Button/index.tsx
index cc1ceeac3..da50424e6 100644
--- a/packages/richtext-slate/src/field/elements/link/Button/index.tsx
+++ b/packages/richtext-slate/src/field/elements/link/Button/index.tsx
@@ -16,10 +16,10 @@ import React, { Fragment, useState } from 'react'
import { Editor, Range, Transforms } from 'slate'
import { ReactEditor, useSlate } from 'slate-react'
-import LinkIcon from '../../../icons/Link/index.js'
+import { LinkIcon } from '../../../icons/Link/index.js'
import { useElementButton } from '../../../providers/ElementButtonProvider.js'
-import ElementButton from '../../Button.js'
-import isElementActive from '../../isActive.js'
+import { ElementButton } from '../../Button.js'
+import { isElementActive } from '../../isActive.js'
import { LinkDrawer } from '../LinkDrawer/index.js'
import { linkFieldsSchemaPath } from '../shared.js'
import { unwrapLink } from '../utilities.js'
diff --git a/packages/richtext-slate/src/field/elements/link/index.ts b/packages/richtext-slate/src/field/elements/link/index.ts
index 9fbb8f589..7f5ef30ce 100644
--- a/packages/richtext-slate/src/field/elements/link/index.ts
+++ b/packages/richtext-slate/src/field/elements/link/index.ts
@@ -4,11 +4,9 @@ import { LinkButton } from './Button/index.js'
import { LinkElement } from './Element/index.js'
import { WithLinks } from './WithLinks.js'
-const link: RichTextCustomElement = {
+export const link: RichTextCustomElement = {
name: 'link',
Button: LinkButton,
Element: LinkElement,
plugins: [WithLinks],
}
-
-export default link
diff --git a/packages/richtext-slate/src/field/elements/listTypes.tsx b/packages/richtext-slate/src/field/elements/listTypes.tsx
index 74119231a..d62f34900 100644
--- a/packages/richtext-slate/src/field/elements/listTypes.tsx
+++ b/packages/richtext-slate/src/field/elements/listTypes.tsx
@@ -1 +1 @@
-export default ['ol', 'ul']
+export const listTypes = ['ol', 'ul']
diff --git a/packages/richtext-slate/src/field/elements/ol/index.tsx b/packages/richtext-slate/src/field/elements/ol/index.tsx
index 907ff6031..724d515af 100644
--- a/packages/richtext-slate/src/field/elements/ol/index.tsx
+++ b/packages/richtext-slate/src/field/elements/ol/index.tsx
@@ -2,13 +2,13 @@ import React from 'react'
import type { RichTextCustomElement } from '../../../types.d.ts'
-import OLIcon from '../../icons/OrderedList/index.js'
-import ListButton from '../ListButton.js'
+import { OLIcon } from '../../icons/OrderedList/index.js'
+import { ListButton } from '../ListButton.js'
import { OrderedList } from './OrderedList.js'
const name = 'ol'
-const ol: RichTextCustomElement = {
+export const ol: RichTextCustomElement = {
name,
Button: () => (
@@ -17,5 +17,3 @@ const ol: RichTextCustomElement = {
),
Element: OrderedList,
}
-
-export default ol
diff --git a/packages/richtext-slate/src/field/elements/relationship/Button/index.tsx b/packages/richtext-slate/src/field/elements/relationship/Button/index.tsx
index 4c524ff7b..9592d5ade 100644
--- a/packages/richtext-slate/src/field/elements/relationship/Button/index.tsx
+++ b/packages/richtext-slate/src/field/elements/relationship/Button/index.tsx
@@ -4,8 +4,8 @@ import { useListDrawer, useTranslation } from '@payloadcms/ui'
import React, { Fragment, useCallback, useEffect, useState } from 'react'
import { ReactEditor, useSlate } from 'slate-react'
-import RelationshipIcon from '../../../icons/Relationship/index.js'
-import ElementButton from '../../Button.js'
+import { RelationshipIcon } from '../../../icons/Relationship/index.js'
+import { ElementButton } from '../../Button.js'
import { EnabledRelationshipsCondition } from '../../EnabledRelationshipsCondition.js'
import { injectVoidElement } from '../../injectVoid.js'
import './index.scss'
@@ -81,7 +81,7 @@ const RelationshipButton: React.FC = ({ enabledCollectionSlugs }) => {
)
}
-export default (props: Props): React.ReactNode => {
+export const Button = (props: Props): React.ReactNode => {
return (
diff --git a/packages/richtext-slate/src/field/elements/relationship/Element/index.tsx b/packages/richtext-slate/src/field/elements/relationship/Element/index.tsx
index 7a76d5a47..a7714a90c 100644
--- a/packages/richtext-slate/src/field/elements/relationship/Element/index.tsx
+++ b/packages/richtext-slate/src/field/elements/relationship/Element/index.tsx
@@ -32,7 +32,7 @@ type Props = FormFieldBase & {
richTextComponentMap: Map
}
-const Element: React.FC = () => {
+const RelationshipElement: React.FC = () => {
const {
attributes,
children,
@@ -191,10 +191,10 @@ const Element: React.FC = () => {
)
}
-export default (props: Props): React.ReactNode => {
+export const Element = (props: Props): React.ReactNode => {
return (
-
+
)
}
diff --git a/packages/richtext-slate/src/field/elements/relationship/index.ts b/packages/richtext-slate/src/field/elements/relationship/index.ts
index 7a2af2730..38863fd30 100644
--- a/packages/richtext-slate/src/field/elements/relationship/index.ts
+++ b/packages/richtext-slate/src/field/elements/relationship/index.ts
@@ -1,15 +1,13 @@
import type { RichTextCustomElement } from '../../../types.d.ts'
-import Button from './Button/index.js'
-import Element from './Element/index.js'
+import { Button } from './Button/index.js'
+import { Element } from './Element/index.js'
import { WithRelationship } from './plugin.js'
import { relationshipName } from './shared.js'
-const relationship: RichTextCustomElement = {
+export const relationship: RichTextCustomElement = {
name: relationshipName,
Button,
Element,
plugins: [WithRelationship],
}
-
-export default relationship
diff --git a/packages/richtext-slate/src/field/elements/textAlign/index.tsx b/packages/richtext-slate/src/field/elements/textAlign/index.tsx
index 12298638d..8203e6990 100644
--- a/packages/richtext-slate/src/field/elements/textAlign/index.tsx
+++ b/packages/richtext-slate/src/field/elements/textAlign/index.tsx
@@ -2,12 +2,12 @@ import React from 'react'
import type { RichTextCustomElement } from '../../../types.d.ts'
-import AlignCenterIcon from '../../icons/AlignCenter/index.js'
-import AlignLeftIcon from '../../icons/AlignLeft/index.js'
-import AlignRightIcon from '../../icons/AlignRight/index.js'
-import ElementButton from '../Button.js'
+import { AlignCenterIcon } from '../../icons/AlignCenter/index.js'
+import { AlignLeftIcon } from '../../icons/AlignLeft/index.js'
+import { AlignRightIcon } from '../../icons/AlignRight/index.js'
+import { ElementButton } from '../Button.js'
-const alignment: RichTextCustomElement = {
+export const textAlign: RichTextCustomElement = {
name: 'alignment',
Button: () => {
return (
@@ -26,5 +26,3 @@ const alignment: RichTextCustomElement = {
},
Element: () => null,
}
-
-export default alignment
diff --git a/packages/richtext-slate/src/field/elements/toggle.tsx b/packages/richtext-slate/src/field/elements/toggle.tsx
index e39c205d7..77eeaceec 100644
--- a/packages/richtext-slate/src/field/elements/toggle.tsx
+++ b/packages/richtext-slate/src/field/elements/toggle.tsx
@@ -2,10 +2,10 @@
import { Editor, Transforms } from 'slate'
import { ReactEditor } from 'slate-react'
-import isElementActive from './isActive.js'
+import { isElementActive } from './isActive.js'
import { isWithinListItem } from './isWithinListItem.js'
-const toggleElement = (editor: Editor, format: string, blockType = 'type'): void => {
+export const toggleElement = (editor: Editor, format: string, blockType = 'type'): void => {
const isActive = isElementActive(editor, format, blockType)
const formatByBlockType = {
@@ -35,5 +35,3 @@ const toggleElement = (editor: Editor, format: string, blockType = 'type'): void
ReactEditor.focus(editor)
}
-
-export default toggleElement
diff --git a/packages/richtext-slate/src/field/elements/toggleList.tsx b/packages/richtext-slate/src/field/elements/toggleList.tsx
index 4f11afb76..a56106e76 100644
--- a/packages/richtext-slate/src/field/elements/toggleList.tsx
+++ b/packages/richtext-slate/src/field/elements/toggleList.tsx
@@ -2,11 +2,11 @@ import { Editor, Element, Node, Text, Transforms } from 'slate'
import { ReactEditor } from 'slate-react'
import { getCommonBlock } from './getCommonBlock.js'
-import isListActive from './isListActive.js'
-import listTypes from './listTypes.js'
+import { isListActive } from './isListActive.js'
+import { listTypes } from './listTypes.js'
import { unwrapList } from './unwrapList.js'
-const toggleList = (editor: Editor, format: string): void => {
+export const toggleList = (editor: Editor, format: string): void => {
let currentListFormat: string
if (isListActive(editor, 'ol')) currentListFormat = 'ol'
@@ -96,5 +96,3 @@ const toggleList = (editor: Editor, format: string): void => {
ReactEditor.focus(editor)
}
-
-export default toggleList
diff --git a/packages/richtext-slate/src/field/elements/ul/index.tsx b/packages/richtext-slate/src/field/elements/ul/index.tsx
index d941099ae..2441043f8 100644
--- a/packages/richtext-slate/src/field/elements/ul/index.tsx
+++ b/packages/richtext-slate/src/field/elements/ul/index.tsx
@@ -2,13 +2,13 @@ import React from 'react'
import type { RichTextCustomElement } from '../../../types.d.ts'
-import ULIcon from '../../icons/UnorderedList/index.js'
-import ListButton from '../ListButton.js'
+import { ULIcon } from '../../icons/UnorderedList/index.js'
+import { ListButton } from '../ListButton.js'
import { UnorderedList } from './UnorderedList.js'
const name = 'ul'
-const ul: RichTextCustomElement = {
+export const ul: RichTextCustomElement = {
name,
Button: () => (
@@ -17,5 +17,3 @@ const ul: RichTextCustomElement = {
),
Element: UnorderedList,
}
-
-export default ul
diff --git a/packages/richtext-slate/src/field/elements/unwrapList.ts b/packages/richtext-slate/src/field/elements/unwrapList.ts
index ce1999f17..5d01b0f11 100644
--- a/packages/richtext-slate/src/field/elements/unwrapList.ts
+++ b/packages/richtext-slate/src/field/elements/unwrapList.ts
@@ -3,7 +3,7 @@ import type { Path } from 'slate'
import { Editor, Element, Transforms } from 'slate'
import { areAllChildrenElements } from './areAllChildrenElements.js'
-import listTypes from './listTypes.js'
+import { listTypes } from './listTypes.js'
export const unwrapList = (editor: Editor, atPath: Path): void => {
// Remove type for any nodes that have text children -
diff --git a/packages/richtext-slate/src/field/elements/upload/Button/index.tsx b/packages/richtext-slate/src/field/elements/upload/Button/index.tsx
index fa1b1a8dc..c132a711e 100644
--- a/packages/richtext-slate/src/field/elements/upload/Button/index.tsx
+++ b/packages/richtext-slate/src/field/elements/upload/Button/index.tsx
@@ -4,8 +4,8 @@ import { useListDrawer, useTranslation } from '@payloadcms/ui'
import React, { Fragment, useCallback } from 'react'
import { ReactEditor, useSlate } from 'slate-react'
-import UploadIcon from '../../../icons/Upload/index.js'
-import ElementButton from '../../Button.js'
+import { UploadIcon } from '../../../icons/Upload/index.js'
+import { ElementButton } from '../../Button.js'
import { EnabledRelationshipsCondition } from '../../EnabledRelationshipsCondition.js'
import { injectVoidElement } from '../../injectVoid.js'
import './index.scss'
@@ -74,7 +74,7 @@ const UploadButton: React.FC = ({ enabledCollectionSlugs }) => {
)
}
-export default (props: ButtonProps): React.ReactNode => {
+export const Button = (props: ButtonProps): React.ReactNode => {
return (
diff --git a/packages/richtext-slate/src/field/elements/upload/Element/index.tsx b/packages/richtext-slate/src/field/elements/upload/Element/index.tsx
index 15acc655b..43bf0271f 100644
--- a/packages/richtext-slate/src/field/elements/upload/Element/index.tsx
+++ b/packages/richtext-slate/src/field/elements/upload/Element/index.tsx
@@ -39,7 +39,7 @@ type Props = FormFieldBase & {
richTextComponentMap: Map
}
-const Element: React.FC = ({
+const UploadElement: React.FC = ({
enabledCollectionSlugs,
}) => {
const {
@@ -220,10 +220,10 @@ const Element: React.FC = ({
)
}
-export default (props: Props): React.ReactNode => {
+export const Element = (props: Props): React.ReactNode => {
return (
-
+
)
}
diff --git a/packages/richtext-slate/src/field/elements/upload/index.ts b/packages/richtext-slate/src/field/elements/upload/index.ts
index 40ab5d2d5..b39b9508a 100644
--- a/packages/richtext-slate/src/field/elements/upload/index.ts
+++ b/packages/richtext-slate/src/field/elements/upload/index.ts
@@ -1,15 +1,13 @@
import type { RichTextCustomElement } from '../../../types.d.ts'
-import Button from './Button/index.js'
-import Element from './Element/index.js'
+import { Button } from './Button/index.js'
+import { Element } from './Element/index.js'
import { WithUpload } from './plugin.js'
import { uploadName } from './shared.js'
-const upload: RichTextCustomElement = {
+export const upload: RichTextCustomElement = {
name: uploadName,
Button,
Element,
plugins: [WithUpload],
}
-
-export default upload
diff --git a/packages/richtext-slate/src/field/enablePlugins.tsx b/packages/richtext-slate/src/field/enablePlugins.tsx
deleted file mode 100644
index 4062de9c3..000000000
--- a/packages/richtext-slate/src/field/enablePlugins.tsx
+++ /dev/null
@@ -1,28 +0,0 @@
-import elementTypes from './elements/index.js'
-import leafTypes from './leaves/index.js'
-
-const addPluginReducer = (EditorWithPlugins, plugin) => {
- if (typeof plugin === 'function') return plugin(EditorWithPlugins)
- return EditorWithPlugins
-}
-
-const enablePlugins = (CreatedEditor, functions) =>
- functions.reduce((CreatedEditorWithPlugins, func) => {
- if (typeof func === 'object' && Array.isArray(func.plugins)) {
- return func.plugins.reduce(addPluginReducer, CreatedEditorWithPlugins)
- }
-
- if (typeof func === 'string') {
- if (elementTypes[func] && elementTypes[func].plugins) {
- return elementTypes[func].plugins.reduce(addPluginReducer, CreatedEditorWithPlugins)
- }
-
- if (leafTypes[func] && leafTypes[func].plugins) {
- return leafTypes[func].plugins.reduce(addPluginReducer, CreatedEditorWithPlugins)
- }
- }
-
- return CreatedEditorWithPlugins
- }, CreatedEditor)
-
-export default enablePlugins
diff --git a/packages/richtext-slate/src/field/hotkeys.tsx b/packages/richtext-slate/src/field/hotkeys.tsx
index b747e9c20..94b55c306 100644
--- a/packages/richtext-slate/src/field/hotkeys.tsx
+++ b/packages/richtext-slate/src/field/hotkeys.tsx
@@ -1,4 +1,4 @@
-export default {
+export const hotkeys = {
'mod+`': 'code',
'mod+b': 'bold',
'mod+i': 'italic',
diff --git a/packages/richtext-slate/src/field/icons/AlignCenter/index.tsx b/packages/richtext-slate/src/field/icons/AlignCenter/index.tsx
index 6e0c5e9b7..77011f7a2 100644
--- a/packages/richtext-slate/src/field/icons/AlignCenter/index.tsx
+++ b/packages/richtext-slate/src/field/icons/AlignCenter/index.tsx
@@ -1,9 +1,7 @@
import React from 'react'
-const AlignCenterIcon: React.FC = () => (
+export const AlignCenterIcon: React.FC = () => (
)
-
-export default AlignCenterIcon
diff --git a/packages/richtext-slate/src/field/icons/AlignLeft/index.tsx b/packages/richtext-slate/src/field/icons/AlignLeft/index.tsx
index 41ea34c42..99e571872 100644
--- a/packages/richtext-slate/src/field/icons/AlignLeft/index.tsx
+++ b/packages/richtext-slate/src/field/icons/AlignLeft/index.tsx
@@ -1,9 +1,7 @@
import React from 'react'
-const AlignLeftIcon: React.FC = () => (
+export const AlignLeftIcon: React.FC = () => (
)
-
-export default AlignLeftIcon
diff --git a/packages/richtext-slate/src/field/icons/AlignRight/index.tsx b/packages/richtext-slate/src/field/icons/AlignRight/index.tsx
index ff3ff2122..24d1c6b14 100644
--- a/packages/richtext-slate/src/field/icons/AlignRight/index.tsx
+++ b/packages/richtext-slate/src/field/icons/AlignRight/index.tsx
@@ -1,9 +1,7 @@
import React from 'react'
-const AlignRightIcon: React.FC = () => (
+export const AlignRightIcon: React.FC = () => (
)
-
-export default AlignRightIcon
diff --git a/packages/richtext-slate/src/field/icons/Blockquote/index.tsx b/packages/richtext-slate/src/field/icons/Blockquote/index.tsx
index acb642cef..7bb8cc0c2 100644
--- a/packages/richtext-slate/src/field/icons/Blockquote/index.tsx
+++ b/packages/richtext-slate/src/field/icons/Blockquote/index.tsx
@@ -1,6 +1,6 @@
import React from 'react'
-const BlockquoteIcon: React.FC = () => (
+export const BlockquoteIcon: React.FC = () => (
)
-
-export default BlockquoteIcon
diff --git a/packages/richtext-slate/src/field/icons/Bold/index.tsx b/packages/richtext-slate/src/field/icons/Bold/index.tsx
index 81b9e60e3..cbc455b5a 100644
--- a/packages/richtext-slate/src/field/icons/Bold/index.tsx
+++ b/packages/richtext-slate/src/field/icons/Bold/index.tsx
@@ -1,6 +1,6 @@
import React from 'react'
-const BoldIcon: React.FC = () => (
+export const BoldIcon: React.FC = () => (
)
-
-export default BoldIcon
diff --git a/packages/richtext-slate/src/field/icons/Code/index.tsx b/packages/richtext-slate/src/field/icons/Code/index.tsx
index 5bb88f5b5..d62aca865 100644
--- a/packages/richtext-slate/src/field/icons/Code/index.tsx
+++ b/packages/richtext-slate/src/field/icons/Code/index.tsx
@@ -1,6 +1,6 @@
import React from 'react'
-const CodeIcon: React.FC = () => (
+export const CodeIcon: React.FC = () => (
)
-
-export default CodeIcon
diff --git a/packages/richtext-slate/src/field/icons/IndentLeft/index.tsx b/packages/richtext-slate/src/field/icons/IndentLeft/index.tsx
index cd35afe7c..291eaa554 100644
--- a/packages/richtext-slate/src/field/icons/IndentLeft/index.tsx
+++ b/packages/richtext-slate/src/field/icons/IndentLeft/index.tsx
@@ -2,7 +2,7 @@ import React from 'react'
import './index.scss'
-const IndentLeft: React.FC = () => (
+export const IndentLeft: React.FC = () => (
)
-
-export default IndentLeft
diff --git a/packages/richtext-slate/src/field/icons/IndentRight/index.tsx b/packages/richtext-slate/src/field/icons/IndentRight/index.tsx
index 7e5dd9eca..da2621527 100644
--- a/packages/richtext-slate/src/field/icons/IndentRight/index.tsx
+++ b/packages/richtext-slate/src/field/icons/IndentRight/index.tsx
@@ -2,7 +2,7 @@ import React from 'react'
import './index.scss'
-const IndentRight: React.FC = () => (
+export const IndentRight: React.FC = () => (
)
-
-export default IndentRight
diff --git a/packages/richtext-slate/src/field/icons/Italic/index.tsx b/packages/richtext-slate/src/field/icons/Italic/index.tsx
index 61abaffc4..9220481ca 100644
--- a/packages/richtext-slate/src/field/icons/Italic/index.tsx
+++ b/packages/richtext-slate/src/field/icons/Italic/index.tsx
@@ -1,6 +1,6 @@
import React from 'react'
-const ItalicIcon: React.FC = () => (
+export const ItalicIcon: React.FC = () => (
)
-
-export default ItalicIcon
diff --git a/packages/richtext-slate/src/field/icons/Link/index.tsx b/packages/richtext-slate/src/field/icons/Link/index.tsx
index 95a0a3cc4..e90206e86 100644
--- a/packages/richtext-slate/src/field/icons/Link/index.tsx
+++ b/packages/richtext-slate/src/field/icons/Link/index.tsx
@@ -2,7 +2,7 @@ import React from 'react'
import './index.scss'
-const LinkIcon: React.FC = () => (
+export const LinkIcon: React.FC = () => (
)
-
-export default LinkIcon
diff --git a/packages/richtext-slate/src/field/icons/OrderedList/index.tsx b/packages/richtext-slate/src/field/icons/OrderedList/index.tsx
index 68837dea7..0ef09964b 100644
--- a/packages/richtext-slate/src/field/icons/OrderedList/index.tsx
+++ b/packages/richtext-slate/src/field/icons/OrderedList/index.tsx
@@ -1,6 +1,6 @@
import React from 'react'
-const OrderedListIcon: React.FC = () => (
+export const OLIcon: React.FC = () => (
)
-
-export default OrderedListIcon
diff --git a/packages/richtext-slate/src/field/icons/Relationship/index.tsx b/packages/richtext-slate/src/field/icons/Relationship/index.tsx
index 288fbc197..05f4c2ba4 100644
--- a/packages/richtext-slate/src/field/icons/Relationship/index.tsx
+++ b/packages/richtext-slate/src/field/icons/Relationship/index.tsx
@@ -2,7 +2,7 @@ import React from 'react'
import './index.scss'
-const Relationship: React.FC = () => (
+export const RelationshipIcon: React.FC = () => (
)
-
-export default Relationship
diff --git a/packages/richtext-slate/src/field/icons/Strikethrough/index.tsx b/packages/richtext-slate/src/field/icons/Strikethrough/index.tsx
index b013898dc..90f9247d7 100644
--- a/packages/richtext-slate/src/field/icons/Strikethrough/index.tsx
+++ b/packages/richtext-slate/src/field/icons/Strikethrough/index.tsx
@@ -1,6 +1,6 @@
import React from 'react'
-const StrikethroughIcon: React.FC = () => (
+export const StrikethroughIcon: React.FC = () => (
)
-
-export default StrikethroughIcon
diff --git a/packages/richtext-slate/src/field/icons/Underline/index.tsx b/packages/richtext-slate/src/field/icons/Underline/index.tsx
index d179f44c4..fe8e6c643 100644
--- a/packages/richtext-slate/src/field/icons/Underline/index.tsx
+++ b/packages/richtext-slate/src/field/icons/Underline/index.tsx
@@ -1,6 +1,6 @@
import React from 'react'
-const UnderlineIcon: React.FC = () => (
+export const UnderlineIcon: React.FC = () => (
)
-
-export default UnderlineIcon
diff --git a/packages/richtext-slate/src/field/icons/UnorderedList/index.tsx b/packages/richtext-slate/src/field/icons/UnorderedList/index.tsx
index f61f462a2..d85300682 100644
--- a/packages/richtext-slate/src/field/icons/UnorderedList/index.tsx
+++ b/packages/richtext-slate/src/field/icons/UnorderedList/index.tsx
@@ -1,6 +1,6 @@
import React from 'react'
-const UnorderedListIcon: React.FC = () => (
+export const ULIcon: React.FC = () => (
)
-
-export default UnorderedListIcon
diff --git a/packages/richtext-slate/src/field/icons/Upload/index.tsx b/packages/richtext-slate/src/field/icons/Upload/index.tsx
index 21b57d080..7771efc81 100644
--- a/packages/richtext-slate/src/field/icons/Upload/index.tsx
+++ b/packages/richtext-slate/src/field/icons/Upload/index.tsx
@@ -2,7 +2,7 @@ import React from 'react'
import './index.scss'
-const Upload: React.FC = () => (
+export const UploadIcon: React.FC = () => (
)
-
-export default Upload
diff --git a/packages/richtext-slate/src/field/icons/headings/H1/index.tsx b/packages/richtext-slate/src/field/icons/headings/H1/index.tsx
index 459414117..192a87b65 100644
--- a/packages/richtext-slate/src/field/icons/headings/H1/index.tsx
+++ b/packages/richtext-slate/src/field/icons/headings/H1/index.tsx
@@ -1,6 +1,6 @@
import React from 'react'
-const H1Icon: React.FC = () => (
+export const H1Icon: React.FC = () => (
)
-
-export default H1Icon
diff --git a/packages/richtext-slate/src/field/icons/headings/H2/index.tsx b/packages/richtext-slate/src/field/icons/headings/H2/index.tsx
index 562cc5059..42432b36f 100644
--- a/packages/richtext-slate/src/field/icons/headings/H2/index.tsx
+++ b/packages/richtext-slate/src/field/icons/headings/H2/index.tsx
@@ -1,6 +1,6 @@
import React from 'react'
-const H2Icon: React.FC = () => (
+export const H2Icon: React.FC = () => (
)
-
-export default H2Icon
diff --git a/packages/richtext-slate/src/field/icons/headings/H3/index.tsx b/packages/richtext-slate/src/field/icons/headings/H3/index.tsx
index 8ffd831ff..ab00666f1 100644
--- a/packages/richtext-slate/src/field/icons/headings/H3/index.tsx
+++ b/packages/richtext-slate/src/field/icons/headings/H3/index.tsx
@@ -1,6 +1,6 @@
import React from 'react'
-const H3Icon: React.FC = () => (
+export const H3Icon: React.FC = () => (
)
-
-export default H3Icon
diff --git a/packages/richtext-slate/src/field/icons/headings/H4/index.tsx b/packages/richtext-slate/src/field/icons/headings/H4/index.tsx
index 8749b7cab..3b08f2772 100644
--- a/packages/richtext-slate/src/field/icons/headings/H4/index.tsx
+++ b/packages/richtext-slate/src/field/icons/headings/H4/index.tsx
@@ -1,6 +1,6 @@
import React from 'react'
-const H4Icon: React.FC = () => (
+export const H4Icon: React.FC = () => (
)
-
-export default H4Icon
diff --git a/packages/richtext-slate/src/field/icons/headings/H5/index.tsx b/packages/richtext-slate/src/field/icons/headings/H5/index.tsx
index 933c992b6..aa12a6470 100644
--- a/packages/richtext-slate/src/field/icons/headings/H5/index.tsx
+++ b/packages/richtext-slate/src/field/icons/headings/H5/index.tsx
@@ -1,6 +1,6 @@
import React from 'react'
-const H5Icon: React.FC = () => (
+export const H5Icon: React.FC = () => (
)
-
-export default H5Icon
diff --git a/packages/richtext-slate/src/field/icons/headings/H6/index.tsx b/packages/richtext-slate/src/field/icons/headings/H6/index.tsx
index 790c34f37..113ebc031 100644
--- a/packages/richtext-slate/src/field/icons/headings/H6/index.tsx
+++ b/packages/richtext-slate/src/field/icons/headings/H6/index.tsx
@@ -1,6 +1,6 @@
import React from 'react'
-const H5Icon: React.FC = () => (
+export const H6Icon: React.FC = () => (
)
-
-export default H5Icon
diff --git a/packages/richtext-slate/src/field/icons/headings/index.tsx b/packages/richtext-slate/src/field/icons/headings/index.tsx
deleted file mode 100644
index bfb0c5329..000000000
--- a/packages/richtext-slate/src/field/icons/headings/index.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import H1 from './H1/index.js'
-import H2 from './H2/index.js'
-import H3 from './H3/index.js'
-import H4 from './H4/index.js'
-import H5 from './H5/index.js'
-import H6 from './H6/index.js'
-
-export default {
- H1,
- H2,
- H3,
- H4,
- H5,
- H6,
-}
diff --git a/packages/richtext-slate/src/field/index.tsx b/packages/richtext-slate/src/field/index.tsx
index 8e78524ce..01262202d 100644
--- a/packages/richtext-slate/src/field/index.tsx
+++ b/packages/richtext-slate/src/field/index.tsx
@@ -11,7 +11,11 @@ import type { EnabledFeatures } from './types.d.ts'
import { createFeatureMap } from './createFeatureMap.js'
-const RichTextEditor = lazy(() => import('./RichText.js'))
+const RichTextEditor = lazy(() =>
+ import('./RichText.js').then((module) => ({
+ default: module.RichText,
+ })),
+)
export const RichTextField: React.FC<
FormFieldBase & {
diff --git a/packages/richtext-slate/src/field/leaves/Button.tsx b/packages/richtext-slate/src/field/leaves/Button.tsx
index d3f936372..8c9320a0e 100644
--- a/packages/richtext-slate/src/field/leaves/Button.tsx
+++ b/packages/richtext-slate/src/field/leaves/Button.tsx
@@ -3,17 +3,17 @@ import React from 'react'
import { useSlate } from 'slate-react'
import '../buttons.scss'
-import isMarkActive from './isActive.js'
-import toggleLeaf from './toggle.js'
+import { isLeafActive } from './isActive.js'
+import { toggleLeaf } from './toggle.js'
const baseClass = 'rich-text__button'
-const LeafButton = ({ children, format }) => {
+export const LeafButton = ({ children, format }) => {
const editor = useSlate()
return (
)
}
-
-export default LeafButton
diff --git a/packages/richtext-slate/src/field/leaves/bold/index.tsx b/packages/richtext-slate/src/field/leaves/bold/index.tsx
index 68170658e..5717d210e 100644
--- a/packages/richtext-slate/src/field/leaves/bold/index.tsx
+++ b/packages/richtext-slate/src/field/leaves/bold/index.tsx
@@ -2,11 +2,11 @@ import React from 'react'
import type { RichTextCustomLeaf } from '../../../types.d.ts'
-import BoldIcon from '../../icons/Bold/index.js'
-import LeafButton from '../Button.js'
+import { BoldIcon } from '../../icons/Bold/index.js'
+import { LeafButton } from '../Button.js'
import { Bold } from './Bold/index.js'
-const bold: RichTextCustomLeaf = {
+export const bold: RichTextCustomLeaf = {
name: 'bold',
Button: () => (
diff --git a/packages/richtext-slate/src/field/leaves/code/index.tsx b/packages/richtext-slate/src/field/leaves/code/index.tsx
index 452f4ca85..bbd44a931 100644
--- a/packages/richtext-slate/src/field/leaves/code/index.tsx
+++ b/packages/richtext-slate/src/field/leaves/code/index.tsx
@@ -2,11 +2,11 @@ import React from 'react'
import type { RichTextCustomLeaf } from '../../../types.d.ts'
-import CodeIcon from '../../icons/Code/index.js'
-import LeafButton from '../Button.js'
+import { CodeIcon } from '../../icons/Code/index.js'
+import { LeafButton } from '../Button.js'
import { Code } from './Code/index.js'
-const code: RichTextCustomLeaf = {
+export const code: RichTextCustomLeaf = {
name: 'code',
Button: () => (
@@ -15,5 +15,3 @@ const code: RichTextCustomLeaf = {
),
Leaf: Code,
}
-
-export default code
diff --git a/packages/richtext-slate/src/field/leaves/index.tsx b/packages/richtext-slate/src/field/leaves/index.tsx
index c9383aaf8..0a0e082ba 100644
--- a/packages/richtext-slate/src/field/leaves/index.tsx
+++ b/packages/richtext-slate/src/field/leaves/index.tsx
@@ -1,17 +1,15 @@
import type { RichTextCustomLeaf } from '../../types.d.ts'
-import bold from './bold/index.js'
-import code from './code/index.js'
-import italic from './italic/index.js'
-import strikethrough from './strikethrough/index.js'
-import underline from './underline/index.js'
+import { bold } from './bold/index.js'
+import { code } from './code/index.js'
+import { italic } from './italic/index.js'
+import { strikethrough } from './strikethrough/index.js'
+import { underline } from './underline/index.js'
-const defaultLeaves: Record = {
+export const defaultLeaves: Record = {
bold,
code,
italic,
strikethrough,
underline,
}
-
-export default defaultLeaves
diff --git a/packages/richtext-slate/src/field/leaves/isActive.tsx b/packages/richtext-slate/src/field/leaves/isActive.tsx
index 9daf7a6d6..d2a36fcf6 100644
--- a/packages/richtext-slate/src/field/leaves/isActive.tsx
+++ b/packages/richtext-slate/src/field/leaves/isActive.tsx
@@ -1,8 +1,6 @@
import { Editor } from 'slate'
-const isLeafActive = (editor, format) => {
+export const isLeafActive = (editor, format) => {
const leaves = Editor.marks(editor)
return leaves ? leaves[format] === true : false
}
-
-export default isLeafActive
diff --git a/packages/richtext-slate/src/field/leaves/italic/index.tsx b/packages/richtext-slate/src/field/leaves/italic/index.tsx
index 0183c4cc9..35eeb40c5 100644
--- a/packages/richtext-slate/src/field/leaves/italic/index.tsx
+++ b/packages/richtext-slate/src/field/leaves/italic/index.tsx
@@ -2,11 +2,11 @@ import React from 'react'
import type { RichTextCustomLeaf } from '../../../types.d.ts'
-import ItalicIcon from '../../icons/Italic/index.js'
-import LeafButton from '../Button.js'
+import { ItalicIcon } from '../../icons/Italic/index.js'
+import { LeafButton } from '../Button.js'
import { Italic } from './Italic/index.js'
-const italic: RichTextCustomLeaf = {
+export const italic: RichTextCustomLeaf = {
name: 'italic',
Button: () => (
@@ -15,5 +15,3 @@ const italic: RichTextCustomLeaf = {
),
Leaf: Italic,
}
-
-export default italic
diff --git a/packages/richtext-slate/src/field/leaves/strikethrough/index.tsx b/packages/richtext-slate/src/field/leaves/strikethrough/index.tsx
index 292fc17ab..8459dc8c2 100644
--- a/packages/richtext-slate/src/field/leaves/strikethrough/index.tsx
+++ b/packages/richtext-slate/src/field/leaves/strikethrough/index.tsx
@@ -2,11 +2,11 @@ import React from 'react'
import type { RichTextCustomLeaf } from '../../../types.d.ts'
-import StrikethroughIcon from '../../icons/Strikethrough/index.js'
-import LeafButton from '../Button.js'
+import { StrikethroughIcon } from '../../icons/Strikethrough/index.js'
+import { LeafButton } from '../Button.js'
import { Strikethrough } from './Strikethrough/index.js'
-const strikethrough: RichTextCustomLeaf = {
+export const strikethrough: RichTextCustomLeaf = {
name: 'strikethrough',
Button: () => (
@@ -15,5 +15,3 @@ const strikethrough: RichTextCustomLeaf = {
),
Leaf: Strikethrough,
}
-
-export default strikethrough
diff --git a/packages/richtext-slate/src/field/leaves/toggle.tsx b/packages/richtext-slate/src/field/leaves/toggle.tsx
index 9b9180b44..d2bcb7ebd 100644
--- a/packages/richtext-slate/src/field/leaves/toggle.tsx
+++ b/packages/richtext-slate/src/field/leaves/toggle.tsx
@@ -1,8 +1,8 @@
import { Editor } from 'slate'
-import isLeafActive from './isActive.js'
+import { isLeafActive } from './isActive.js'
-const toggleLeaf = (editor, format) => {
+export const toggleLeaf = (editor, format) => {
const isActive = isLeafActive(editor, format)
if (isActive) {
@@ -11,5 +11,3 @@ const toggleLeaf = (editor, format) => {
Editor.addMark(editor, format, true)
}
}
-
-export default toggleLeaf
diff --git a/packages/richtext-slate/src/field/leaves/underline/index.tsx b/packages/richtext-slate/src/field/leaves/underline/index.tsx
index 235daa81a..308598638 100644
--- a/packages/richtext-slate/src/field/leaves/underline/index.tsx
+++ b/packages/richtext-slate/src/field/leaves/underline/index.tsx
@@ -2,11 +2,11 @@ import React from 'react'
import type { RichTextCustomLeaf } from '../../../types.d.ts'
-import UnderlineIcon from '../../icons/Underline/index.js'
-import LeafButton from '../Button.js'
+import { UnderlineIcon } from '../../icons/Underline/index.js'
+import { LeafButton } from '../Button.js'
import { Underline } from './Underline/index.js'
-const underline: RichTextCustomLeaf = {
+export const underline: RichTextCustomLeaf = {
name: 'underline',
Button: () => (
@@ -15,5 +15,3 @@ const underline: RichTextCustomLeaf = {
),
Leaf: Underline,
}
-
-export default underline
diff --git a/packages/richtext-slate/src/field/mergeCustomFunctions.tsx b/packages/richtext-slate/src/field/mergeCustomFunctions.tsx
deleted file mode 100644
index ff0d4cf20..000000000
--- a/packages/richtext-slate/src/field/mergeCustomFunctions.tsx
+++ /dev/null
@@ -1,25 +0,0 @@
-export default (enabledFunctions, builtInFunctions) => {
- const formattedEnabledFunctions = [...enabledFunctions]
-
- if (enabledFunctions.indexOf('ul') > -1 || enabledFunctions.indexOf('ol') > -1) {
- formattedEnabledFunctions.push('li')
- }
-
- return formattedEnabledFunctions.reduce((resultingFunctions, func) => {
- if (typeof func === 'object' && func.name) {
- return {
- ...resultingFunctions,
- [func.name]: func,
- }
- }
-
- if (typeof func === 'string' && builtInFunctions[func]) {
- return {
- ...resultingFunctions,
- [func]: builtInFunctions[func],
- }
- }
-
- return resultingFunctions
- }, {})
-}
diff --git a/packages/richtext-slate/src/field/plugins/withEnterBreakOut.ts b/packages/richtext-slate/src/field/plugins/withEnterBreakOut.ts
index 89a7f4fcf..6be469fc2 100644
--- a/packages/richtext-slate/src/field/plugins/withEnterBreakOut.ts
+++ b/packages/richtext-slate/src/field/plugins/withEnterBreakOut.ts
@@ -1,9 +1,7 @@
const enterBreakOutTypes = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'link']
-const withEnterBreakOut = (editor) => {
+export const withEnterBreakOut = (editor) => {
const newEditor = editor
newEditor.shouldBreakOutOnEnter = (element) => enterBreakOutTypes.includes(String(element.type))
return newEditor
}
-
-export default withEnterBreakOut
diff --git a/packages/richtext-slate/src/field/plugins/withHTML.tsx b/packages/richtext-slate/src/field/plugins/withHTML.tsx
index aa02cd4bf..301fa35fd 100644
--- a/packages/richtext-slate/src/field/plugins/withHTML.tsx
+++ b/packages/richtext-slate/src/field/plugins/withHTML.tsx
@@ -72,7 +72,7 @@ const deserialize = (el) => {
return children
}
-const withHTML = (incomingEditor) => {
+export const withHTML = (incomingEditor) => {
const { insertData } = incomingEditor
const editor = incomingEditor
@@ -94,5 +94,3 @@ const withHTML = (incomingEditor) => {
return editor
}
-
-export default withHTML
diff --git a/packages/richtext-slate/src/generateComponentMap.tsx b/packages/richtext-slate/src/generateComponentMap.tsx
index 398e74ccc..5415947e8 100644
--- a/packages/richtext-slate/src/generateComponentMap.tsx
+++ b/packages/richtext-slate/src/generateComponentMap.tsx
@@ -8,11 +8,11 @@ import React from 'react'
import type { AdapterArguments, RichTextCustomElement, RichTextCustomLeaf } from './types.d.ts'
-import elementTypes from './field/elements/index.js'
+import { elements as elementTypes } from './field/elements/index.js'
import { linkFieldsSchemaPath } from './field/elements/link/shared.js'
import { transformExtraFields } from './field/elements/link/utilities.js'
import { uploadFieldsSchemaPath } from './field/elements/upload/shared.js'
-import leafTypes from './field/leaves/index.js'
+import { defaultLeaves as leafTypes } from './field/leaves/index.js'
export const getGenerateComponentMap =
(args: AdapterArguments): RichTextAdapter['generateComponentMap'] =>
diff --git a/packages/richtext-slate/src/generateSchemaMap.ts b/packages/richtext-slate/src/generateSchemaMap.ts
index e2d5b7a0b..2e695e6d3 100644
--- a/packages/richtext-slate/src/generateSchemaMap.ts
+++ b/packages/richtext-slate/src/generateSchemaMap.ts
@@ -6,7 +6,7 @@ import { sanitizeFields } from 'payload/config'
import type { AdapterArguments, RichTextCustomElement } from './types.d.ts'
-import elementTypes from './field/elements/index.js'
+import { elements as elementTypes } from './field/elements/index.js'
import { linkFieldsSchemaPath } from './field/elements/link/shared.js'
import { transformExtraFields } from './field/elements/link/utilities.js'
import { uploadFieldsSchemaPath } from './field/elements/upload/shared.js'
diff --git a/packages/richtext-slate/src/index.tsx b/packages/richtext-slate/src/index.tsx
index b9c9881b3..dbde9662a 100644
--- a/packages/richtext-slate/src/index.tsx
+++ b/packages/richtext-slate/src/index.tsx
@@ -64,10 +64,10 @@ export function slateEditor(args: AdapterArguments): RichTextAdapter coll.slug === slug)
+ const globalConfig = config.globals.find((global) => global.slug === slug)
const {
admin: { dateFormat },
@@ -83,9 +84,9 @@ export const DocumentControls: React.FC<{
)}
- {(collectionConfig?.versions?.drafts || global?.versions?.drafts) && (
+ {(collectionConfig?.versions?.drafts || globalConfig?.versions?.drafts) && (
- {(global || (collectionConfig && isEditing)) && (
+ {(globalConfig || (collectionConfig && isEditing)) && (
{/* */}
@@ -147,33 +148,34 @@ export const DocumentControls: React.FC<{
- {/* {(collectionConfig?.admin?.preview || global?.admin?.preview) && (
+ {/* {(collectionConfig?.admin?.preview || globalConfig?.admin?.preview) && (
)} */}
{hasSavePermission && (
- {collectionConfig?.versions?.drafts || global?.versions?.drafts ? (
+ {collectionConfig?.versions?.drafts || globalConfig?.versions?.drafts ? (
{((collectionConfig?.versions?.drafts &&
!collectionConfig?.versions?.drafts?.autosave) ||
- (global?.versions?.drafts && !global?.versions?.drafts?.autosave)) && (
+ (globalConfig?.versions?.drafts &&
+ !globalConfig?.versions?.drafts?.autosave)) && (
)}
@@ -181,7 +183,7 @@ export const DocumentControls: React.FC<{
)}