@payloadcms/richtext-slate 3.0.0-beta.59 → 3.0.0-beta.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/field/elements/link/Button/index.d.ts.map +1 -1
- package/dist/field/elements/link/Button/index.js +2 -1
- package/dist/field/elements/link/Button/index.js.map +1 -1
- package/dist/field/elements/link/Element/index.js +2 -2
- package/dist/field/elements/link/Element/index.js.map +1 -1
- package/dist/scss/colors.scss +76 -76
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/elements/link/Button/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/elements/link/Button/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAA6B,MAAM,OAAO,CAAA;AAkDjD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EA8D9B,CAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useConfig, useDrawerSlug, useFieldProps, useModal, useTranslation } from '@payloadcms/ui';
|
|
4
|
-
import { getFormState
|
|
4
|
+
import { getFormState } from '@payloadcms/ui/shared';
|
|
5
|
+
import { reduceFieldsToValues } from 'payload/shared';
|
|
5
6
|
import React, { Fragment, useState } from 'react';
|
|
6
7
|
import { Editor, Range, Transforms } from 'slate';
|
|
7
8
|
import { ReactEditor, useSlate } from 'slate-react';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/elements/link/Button/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FormState } from 'payload'\n\nimport { useConfig, useDrawerSlug, useFieldProps, useModal, useTranslation } from '@payloadcms/ui'\nimport { getFormState
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/elements/link/Button/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FormState } from 'payload'\n\nimport { useConfig, useDrawerSlug, useFieldProps, useModal, useTranslation } from '@payloadcms/ui'\nimport { getFormState } from '@payloadcms/ui/shared'\nimport { reduceFieldsToValues } from 'payload/shared'\nimport React, { Fragment, useState } from 'react'\nimport { Editor, Range, Transforms } from 'slate'\nimport { ReactEditor, useSlate } from 'slate-react'\n\nimport { LinkIcon } from '../../../icons/Link/index.js'\nimport { useElementButton } from '../../../providers/ElementButtonProvider.js'\nimport { ElementButton } from '../../Button.js'\nimport { isElementActive } from '../../isActive.js'\nimport { LinkDrawer } from '../LinkDrawer/index.js'\nimport { linkFieldsSchemaPath } from '../shared.js'\nimport { unwrapLink } from '../utilities.js'\n\n/**\n * This function is called when a new link is created - not when an existing link is edited.\n */\nconst insertLink = (editor, fields) => {\n const isCollapsed = editor.selection && Range.isCollapsed(editor.selection)\n const data = reduceFieldsToValues(fields, true)\n\n const newLink = {\n type: 'link',\n children: [],\n doc: data.doc,\n fields: data.fields, // Any custom user-added fields are part of data.fields\n linkType: data.linkType,\n newTab: data.newTab,\n url: data.url,\n }\n\n if (isCollapsed || !editor.selection) {\n // If selection anchor and focus are the same,\n // Just inject a new node with children already set\n Transforms.insertNodes(editor, {\n ...newLink,\n children: [{ text: String(data.text) }],\n })\n } else if (editor.selection) {\n // Otherwise we need to wrap the selected node in a link,\n // Delete its old text,\n // Move the selection one position forward into the link,\n // And insert the text back into the new link\n Transforms.wrapNodes(editor, newLink, { split: true })\n Transforms.delete(editor, { at: editor.selection.focus.path, unit: 'word' })\n Transforms.move(editor, { distance: 1, unit: 'offset' })\n Transforms.insertText(editor, String(data.text), { at: editor.selection.focus.path })\n }\n\n ReactEditor.focus(editor)\n}\n\nexport const LinkButton: React.FC = () => {\n const { fieldProps } = useElementButton()\n const [initialState, setInitialState] = useState<FormState>({})\n\n const { t } = useTranslation()\n const editor = useSlate()\n const config = useConfig()\n\n const { closeModal, openModal } = useModal()\n const drawerSlug = useDrawerSlug('rich-text-link')\n const { schemaPath } = useFieldProps()\n\n const { richTextComponentMap } = fieldProps\n\n const fieldMap = richTextComponentMap.get(linkFieldsSchemaPath)\n\n return (\n <Fragment>\n <ElementButton\n className=\"link\"\n format=\"link\"\n onClick={async () => {\n if (isElementActive(editor, 'link')) {\n unwrapLink(editor)\n } else {\n openModal(drawerSlug)\n const isCollapsed = editor.selection && Range.isCollapsed(editor.selection)\n if (!isCollapsed) {\n const data = {\n text: editor.selection ? Editor.string(editor, editor.selection) : '',\n }\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n data,\n operation: 'update',\n schemaPath: `${schemaPath}.${linkFieldsSchemaPath}`,\n },\n serverURL: config.serverURL,\n })\n setInitialState(state)\n }\n }\n }}\n tooltip={t('fields:addLink')}\n >\n <LinkIcon />\n </ElementButton>\n <LinkDrawer\n drawerSlug={drawerSlug}\n fieldMap={Array.isArray(fieldMap) ? fieldMap : []}\n handleClose={() => {\n closeModal(drawerSlug)\n }}\n handleModalSubmit={(fields) => {\n insertLink(editor, fields)\n closeModal(drawerSlug)\n }}\n initialState={initialState}\n />\n </Fragment>\n )\n}\n"],"names":["useConfig","useDrawerSlug","useFieldProps","useModal","useTranslation","getFormState","reduceFieldsToValues","React","Fragment","useState","Editor","Range","Transforms","ReactEditor","useSlate","LinkIcon","useElementButton","ElementButton","isElementActive","LinkDrawer","linkFieldsSchemaPath","unwrapLink","insertLink","editor","fields","isCollapsed","selection","data","newLink","type","children","doc","linkType","newTab","url","insertNodes","text","String","wrapNodes","split","delete","at","focus","path","unit","move","distance","insertText","LinkButton","fieldProps","initialState","setInitialState","t","config","closeModal","openModal","drawerSlug","schemaPath","richTextComponentMap","fieldMap","get","className","format","onClick","string","state","apiRoute","routes","api","body","operation","serverURL","tooltip","Array","isArray","handleClose","handleModalSubmit"],"mappings":"AAAA;;AAIA,SAASA,SAAS,EAAEC,aAAa,EAAEC,aAAa,EAAEC,QAAQ,EAAEC,cAAc,QAAQ,i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CAAC,EAAEA,WAAW,CAAC,EAAErC,qBAAqB,CAAC;gCACrD;gCACAmD,WAAWlB,OAAOkB,SAAS;4BAC7B;4BACApB,gBAAgBc;wBAClB;oBACF;gBACF;gBACAO,SAASpB,EAAE;0BAEX,cAAA,KAACrC;;0BAEH,KAACI;gBACCqC,YAAYA;gBACZG,UAAUc,MAAMC,OAAO,CAACf,YAAYA,WAAW,EAAE;gBACjDgB,aAAa;oBACXrB,WAAWE;gBACb;gBACAoB,mBAAmB,CAACpD;oBAClBF,WAAWC,QAAQC;oBACnB8B,WAAWE;gBACb;gBACAN,cAAcA;;;;AAItB,EAAC"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { getTranslation } from '@payloadcms/translations';
|
|
4
4
|
import { Button, Popup, Translation, useAuth, useConfig, useDocumentInfo, useDrawerSlug, useLocale, useModal, useTranslation } from '@payloadcms/ui';
|
|
5
|
-
import { getFormState
|
|
6
|
-
import { deepCopyObject } from 'payload/shared';
|
|
5
|
+
import { getFormState } from '@payloadcms/ui/shared';
|
|
6
|
+
import { deepCopyObject, reduceFieldsToValues } from 'payload/shared';
|
|
7
7
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
8
8
|
import { Editor, Node, Transforms } from 'slate';
|
|
9
9
|
import { ReactEditor, useSlate } from 'slate-react';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/elements/link/Element/index.tsx"],"sourcesContent":["'use client'\nimport type { FormState } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Popup,\n Translation,\n useAuth,\n useConfig,\n useDocumentInfo,\n useDrawerSlug,\n useLocale,\n useModal,\n useTranslation,\n} from '@payloadcms/ui'\nimport { getFormState, reduceFieldsToValues } from '@payloadcms/ui/shared'\nimport { deepCopyObject } from 'payload/shared'\nimport React, { useCallback, useEffect, useState } from 'react'\nimport { Editor, Node, Transforms } from 'slate'\nimport { ReactEditor, useSlate } from 'slate-react'\n\nimport type { LinkElementType } from '../types.js'\n\nimport { useElement } from '../../../providers/ElementProvider.js'\nimport { LinkDrawer } from '../LinkDrawer/index.js'\nimport { linkFieldsSchemaPath } from '../shared.js'\nimport { unwrapLink } from '../utilities.js'\nimport './index.scss'\n\nconst baseClass = 'rich-text-link'\n\n/**\n * This function is called when an existing link is edited.\n * When a link is first created, another function is called: {@link ../Button/index.tsx#insertLink}\n */\nconst insertChange = (editor, fields) => {\n const data = reduceFieldsToValues(fields, true)\n\n const [, parentPath] = Editor.above(editor)\n\n const newNode: Record<string, unknown> = {\n doc: data.doc,\n linkType: data.linkType,\n newTab: data.newTab,\n url: data.url,\n }\n\n if (data.fields) newNode.fields = data.fields\n\n Transforms.setNodes(editor, newNode, { at: parentPath })\n\n Transforms.delete(editor, { at: editor.selection.focus.path, unit: 'block' })\n Transforms.move(editor, { distance: 1, unit: 'offset' })\n Transforms.insertText(editor, String(data.text), { at: editor.selection.focus.path })\n\n ReactEditor.focus(editor)\n}\n\nexport const LinkElement = () => {\n const { attributes, children, editorRef, element, fieldProps, schemaPath } =\n useElement<LinkElementType>()\n\n const fieldMapPath = `${schemaPath}.${linkFieldsSchemaPath}`\n\n const { richTextComponentMap } = fieldProps\n const fieldMap = richTextComponentMap.get(linkFieldsSchemaPath)\n\n const editor = useSlate()\n const config = useConfig()\n const { user } = useAuth()\n const { code: locale } = useLocale()\n const { i18n, t } = useTranslation()\n const { closeModal, openModal, toggleModal } = useModal()\n const [renderModal, setRenderModal] = useState(false)\n const [renderPopup, setRenderPopup] = useState(false)\n const [initialState, setInitialState] = useState<FormState>({})\n const { id, collectionSlug } = useDocumentInfo()\n\n const drawerSlug = useDrawerSlug('rich-text-link')\n\n const handleTogglePopup = useCallback((render) => {\n if (!render) {\n setRenderPopup(render)\n }\n }, [])\n\n useEffect(() => {\n const awaitInitialState = async () => {\n const data = {\n doc: element.doc,\n fields: deepCopyObject(element.fields),\n linkType: element.linkType,\n newTab: element.newTab,\n text: Node.string(element),\n url: element.url,\n }\n\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n data,\n operation: 'update',\n schemaPath: fieldMapPath,\n },\n serverURL: config.serverURL,\n })\n\n setInitialState(state)\n }\n\n if (renderModal) {\n void awaitInitialState()\n }\n }, [renderModal, element, user, locale, t, collectionSlug, config, id, fieldMapPath])\n\n return (\n <span className={baseClass} {...attributes}>\n <span contentEditable={false} style={{ userSelect: 'none' }}>\n {renderModal && (\n <LinkDrawer\n drawerSlug={drawerSlug}\n fieldMap={Array.isArray(fieldMap) ? fieldMap : []}\n handleClose={() => {\n toggleModal(drawerSlug)\n setRenderModal(false)\n }}\n handleModalSubmit={(fields) => {\n insertChange(editor, fields)\n closeModal(drawerSlug)\n setRenderModal(false)\n }}\n initialState={initialState}\n />\n )}\n <Popup\n boundingRef={editorRef}\n buttonType=\"none\"\n forceOpen={renderPopup}\n horizontalAlign=\"left\"\n onToggleOpen={handleTogglePopup}\n render={() => (\n <div className={`${baseClass}__popup`}>\n {element.linkType === 'internal' && element.doc?.relationTo && element.doc?.value && (\n <Translation\n elements={{\n '0': ({ children }) => (\n <a\n className={`${baseClass}__link-label`}\n href={`${config.routes.admin}/collections/${element.doc.relationTo}/${element.doc.value}`}\n rel=\"noreferrer\"\n target=\"_blank\"\n title={`${config.routes.admin}/collections/${element.doc.relationTo}/${element.doc.value}`}\n >\n {children}\n </a>\n ),\n }}\n i18nKey=\"fields:linkedTo\"\n t={t}\n variables={{\n label: getTranslation(\n config.collections.find(({ slug }) => slug === element.doc.relationTo)?.labels\n ?.singular,\n i18n,\n ),\n }}\n />\n )}\n {(element.linkType === 'custom' || !element.linkType) && (\n <a\n className={`${baseClass}__link-label`}\n href={element.url}\n rel=\"noreferrer\"\n target=\"_blank\"\n title={element.url}\n >\n {element.url}\n </a>\n )}\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__link-edit`}\n icon=\"edit\"\n onClick={(e) => {\n e.preventDefault()\n setRenderPopup(false)\n openModal(drawerSlug)\n setRenderModal(true)\n }}\n round\n tooltip={t('general:edit')}\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__link-close`}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n unwrapLink(editor)\n }}\n round\n tooltip={t('general:remove')}\n />\n </div>\n )}\n size=\"fit-content\"\n verticalAlign=\"bottom\"\n />\n </span>\n <span\n className={[`${baseClass}__popup-toggler`].filter(Boolean).join(' ')}\n onClick={() => setRenderPopup(true)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') setRenderPopup(true)\n }}\n role=\"button\"\n tabIndex={0}\n >\n {children}\n </span>\n </span>\n )\n}\n"],"names":["getTranslation","Button","Popup","Translation","useAuth","useConfig","useDocumentInfo","useDrawerSlug","useLocale","useModal","useTranslation","getFormState","reduceFieldsToValues","deepCopyObject","React","useCallback","useEffect","useState","Editor","Node","Transforms","ReactEditor","useSlate","useElement","LinkDrawer","linkFieldsSchemaPath","unwrapLink","baseClass","insertChange","editor","fields","data","parentPath","above","newNode","doc","linkType","newTab","url","setNodes","at","delete","selection","focus","path","unit","move","distance","insertText","String","text","LinkElement","attributes","children","editorRef","element","fieldProps","schemaPath","fieldMapPath","richTextComponentMap","fieldMap","get","config","user","code","locale","i18n","t","closeModal","openModal","toggleModal","renderModal","setRenderModal","renderPopup","setRenderPopup","initialState","setInitialState","id","collectionSlug","drawerSlug","handleTogglePopup","render","awaitInitialState","string","state","apiRoute","routes","api","body","operation","serverURL","span","className","contentEditable","style","userSelect","Array","isArray","handleClose","handleModalSubmit","boundingRef","buttonType","forceOpen","horizontalAlign","onToggleOpen","div","relationTo","value","elements","a","href","admin","rel","target","title","i18nKey","variables","label","collections","find","slug","labels","singular","buttonStyle","icon","onClick","e","preventDefault","round","tooltip","size","verticalAlign","filter","Boolean","join","onKeyDown","key","role","tabIndex"],"mappings":"AAAA;;AAGA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,S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C,SAASC,IAAI,CAAC;gBAChET,SAAS,IAAMnD,eAAe;gBAC9B6D,WAAW,CAACT;oBACV,IAAIA,EAAEU,GAAG,KAAK,SAAS9D,eAAe;gBACxC;gBACA+D,MAAK;gBACLC,UAAU;0BAETrF;;;;AAIT,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/elements/link/Element/index.tsx"],"sourcesContent":["'use client'\nimport type { FormState } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Popup,\n Translation,\n useAuth,\n useConfig,\n useDocumentInfo,\n useDrawerSlug,\n useLocale,\n useModal,\n useTranslation,\n} from '@payloadcms/ui'\nimport { getFormState } from '@payloadcms/ui/shared'\nimport { deepCopyObject, reduceFieldsToValues } from 'payload/shared'\nimport React, { useCallback, useEffect, useState } from 'react'\nimport { Editor, Node, Transforms } from 'slate'\nimport { ReactEditor, useSlate } from 'slate-react'\n\nimport type { LinkElementType } from '../types.js'\n\nimport { useElement } from '../../../providers/ElementProvider.js'\nimport { LinkDrawer } from '../LinkDrawer/index.js'\nimport { linkFieldsSchemaPath } from '../shared.js'\nimport { unwrapLink } from '../utilities.js'\nimport './index.scss'\n\nconst baseClass = 'rich-text-link'\n\n/**\n * This function is called when an existing link is edited.\n * When a link is first created, another function is called: {@link ../Button/index.tsx#insertLink}\n */\nconst insertChange = (editor, fields) => {\n const data = reduceFieldsToValues(fields, true)\n\n const [, parentPath] = Editor.above(editor)\n\n const newNode: Record<string, unknown> = {\n doc: data.doc,\n linkType: data.linkType,\n newTab: data.newTab,\n url: data.url,\n }\n\n if (data.fields) newNode.fields = data.fields\n\n Transforms.setNodes(editor, newNode, { at: parentPath })\n\n Transforms.delete(editor, { at: editor.selection.focus.path, unit: 'block' })\n Transforms.move(editor, { distance: 1, unit: 'offset' })\n Transforms.insertText(editor, String(data.text), { at: editor.selection.focus.path })\n\n ReactEditor.focus(editor)\n}\n\nexport const LinkElement = () => {\n const { attributes, children, editorRef, element, fieldProps, schemaPath } =\n useElement<LinkElementType>()\n\n const fieldMapPath = `${schemaPath}.${linkFieldsSchemaPath}`\n\n const { richTextComponentMap } = fieldProps\n const fieldMap = richTextComponentMap.get(linkFieldsSchemaPath)\n\n const editor = useSlate()\n const config = useConfig()\n const { user } = useAuth()\n const { code: locale } = useLocale()\n const { i18n, t } = useTranslation()\n const { closeModal, openModal, toggleModal } = useModal()\n const [renderModal, setRenderModal] = useState(false)\n const [renderPopup, setRenderPopup] = useState(false)\n const [initialState, setInitialState] = useState<FormState>({})\n const { id, collectionSlug } = useDocumentInfo()\n\n const drawerSlug = useDrawerSlug('rich-text-link')\n\n const handleTogglePopup = useCallback((render) => {\n if (!render) {\n setRenderPopup(render)\n }\n }, [])\n\n useEffect(() => {\n const awaitInitialState = async () => {\n const data = {\n doc: element.doc,\n fields: deepCopyObject(element.fields),\n linkType: element.linkType,\n newTab: element.newTab,\n text: Node.string(element),\n url: element.url,\n }\n\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n data,\n operation: 'update',\n schemaPath: fieldMapPath,\n },\n serverURL: config.serverURL,\n })\n\n setInitialState(state)\n }\n\n if (renderModal) {\n void awaitInitialState()\n }\n }, [renderModal, element, user, locale, t, collectionSlug, config, id, fieldMapPath])\n\n return (\n <span className={baseClass} {...attributes}>\n <span contentEditable={false} style={{ userSelect: 'none' }}>\n {renderModal && (\n <LinkDrawer\n drawerSlug={drawerSlug}\n fieldMap={Array.isArray(fieldMap) ? fieldMap : []}\n handleClose={() => {\n toggleModal(drawerSlug)\n setRenderModal(false)\n }}\n handleModalSubmit={(fields) => {\n insertChange(editor, fields)\n closeModal(drawerSlug)\n setRenderModal(false)\n }}\n initialState={initialState}\n />\n )}\n <Popup\n boundingRef={editorRef}\n buttonType=\"none\"\n forceOpen={renderPopup}\n horizontalAlign=\"left\"\n onToggleOpen={handleTogglePopup}\n render={() => (\n <div className={`${baseClass}__popup`}>\n {element.linkType === 'internal' && element.doc?.relationTo && element.doc?.value && (\n <Translation\n elements={{\n '0': ({ children }) => (\n <a\n className={`${baseClass}__link-label`}\n href={`${config.routes.admin}/collections/${element.doc.relationTo}/${element.doc.value}`}\n rel=\"noreferrer\"\n target=\"_blank\"\n title={`${config.routes.admin}/collections/${element.doc.relationTo}/${element.doc.value}`}\n >\n {children}\n </a>\n ),\n }}\n i18nKey=\"fields:linkedTo\"\n t={t}\n variables={{\n label: getTranslation(\n config.collections.find(({ slug }) => slug === element.doc.relationTo)?.labels\n ?.singular,\n i18n,\n ),\n }}\n />\n )}\n {(element.linkType === 'custom' || !element.linkType) && (\n <a\n className={`${baseClass}__link-label`}\n href={element.url}\n rel=\"noreferrer\"\n target=\"_blank\"\n title={element.url}\n >\n {element.url}\n </a>\n )}\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__link-edit`}\n icon=\"edit\"\n onClick={(e) => {\n e.preventDefault()\n setRenderPopup(false)\n openModal(drawerSlug)\n setRenderModal(true)\n }}\n round\n tooltip={t('general:edit')}\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__link-close`}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n unwrapLink(editor)\n }}\n round\n tooltip={t('general:remove')}\n />\n </div>\n )}\n size=\"fit-content\"\n verticalAlign=\"bottom\"\n />\n </span>\n <span\n className={[`${baseClass}__popup-toggler`].filter(Boolean).join(' ')}\n onClick={() => setRenderPopup(true)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') setRenderPopup(true)\n }}\n role=\"button\"\n tabIndex={0}\n >\n {children}\n </span>\n </span>\n )\n}\n"],"names":["getTranslation","Button","Popup","Translation","useAuth","useConfig","useDocumentInfo","useDrawerSlug","useLocale","useModal","useTranslation","getFormState","deepCopyObject","reduceFieldsToValues","React","useCallback","useEffect","useState","Editor","Node","Transforms","ReactEditor","useSlate","useElement","LinkDrawer","linkFieldsSchemaPath","unwrapLink","baseClass","insertChange","editor","fields","data","parentPath","above","newNode","doc","linkType","newTab","url","setNodes","at","delete","selection","focus","path","unit","move","distance","insertText","String","text","LinkElement","attributes","children","editorRef","element","fieldProps","schemaPath","fieldMapPath","richTextComponentMap","fieldMap","get","config","user","code","locale","i18n","t","closeModal","openModal","toggleModal","renderModal","setRenderModal","renderPopup","setRenderPopup","initialState","setInitialState","id","collectionSlug","drawerSlug","handleTogglePopup","render","awaitInitialState","string","state","apiRoute","routes","api","body","operation","serverURL","span","className","contentEditable","style","userSelect","Array","isArray","handleClose","handleModalSubmit","boundingRef","buttonType","forceOpen","horizontalAlign","onToggleOpen","div","relationTo","value","elements","a","href","admin","rel","target","title","i18nKey","variables","label","collections","find","slug","labels","singular","buttonStyle","icon","onClick","e","preventDefault","round","tooltip","size","verticalAlign","filter","Boolean","join","onKeyDown","key","role","tabIndex"],"mappings":"AAAA;;AAGA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,SACEC,MAAM,EACNC,KAAK,EACLC,WAAW,EACXC,OAAO,EACPC,SAAS,EACTC,eAAe,EACfC,aAAa,EACbC,SAAS,EACTC,QAAQ,EACRC,cAAc,QACT,iBAAgB;AACvB,SAASC,YAAY,QAAQ,wBAAuB;AACpD,SAASC,cAAc,EAAEC,oBAAoB,QAAQ,iBAAgB;AACrE,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAC/D,SAASC,MAAM,EAAEC,IAAI,EAAEC,UAAU,QAAQ,QAAO;AAChD,SAASC,WAAW,EAAEC,QAAQ,QAAQ,cAAa;AAInD,SAASC,UAAU,QAAQ,wCAAuC;AAClE,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,oBAAoB,QAAQ,eAAc;AACnD,SAASC,UAAU,QAAQ,kBAAiB;AAC5C,OAAO,eAAc;AAErB,MAAMC,YAAY;AAElB;;;CAGC,GACD,MAAMC,eAAe,CAACC,QAAQC;IAC5B,MAAMC,OAAOlB,qBAAqBiB,QAAQ;IAE1C,MAAM,GAAGE,WAAW,GAAGd,OAAOe,KAAK,CAACJ;IAEpC,MA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aAAY;wCACZ/B,WAAW,CAAC,EAAEjE,UAAU,WAAW,CAAC;wCACpCiG,MAAK;wCACLC,SAAS,CAACC;4CACRA,EAAEC,cAAc;4CAChBrD,eAAe;4CACfL,UAAUU;4CACVP,eAAe;wCACjB;wCACAwD,KAAK;wCACLC,SAAS9D,EAAE;;kDAEb,KAAClE;wCACC0H,aAAY;wCACZ/B,WAAW,CAAC,EAAEjE,UAAU,YAAY,CAAC;wCACrCiG,MAAK;wCACLC,SAAS,CAACC;4CACRA,EAAEC,cAAc;4CAChBrG,WAAWG;wCACb;wCACAmG,KAAK;wCACLC,SAAS9D,EAAE;;;;wBAIjB+D,MAAK;wBACLC,eAAc;;;;0BAGlB,KAACxC;gBACCC,WAAW;oBAAC,CAAC,EAAEjE,UAAU,eAAe,CAAC;iBAAC,CAACyG,MAAM,CAACC,SAASC,IAAI,CAAC;gBAChET,SAAS,IAAMnD,eAAe;gBAC9B6D,WAAW,CAACT;oBACV,IAAIA,EAAEU,GAAG,KAAK,SAAS9D,eAAe;gBACxC;gBACA+D,MAAK;gBACLC,UAAU;0BAETrF;;;;AAIT,EAAC"}
|
package/dist/scss/colors.scss
CHANGED
|
@@ -21,85 +21,85 @@
|
|
|
21
21
|
--color-base-950: rgb(7, 7, 7);
|
|
22
22
|
--color-base-1000: rgb(0, 0, 0);
|
|
23
23
|
|
|
24
|
-
--color-success-50: rgb(
|
|
25
|
-
--color-success-100: rgb(
|
|
26
|
-
--color-success-150: rgb(
|
|
27
|
-
--color-success-200: rgb(
|
|
28
|
-
--color-success-250: rgb(
|
|
29
|
-
--color-success-300: rgb(
|
|
30
|
-
--color-success-350: rgb(
|
|
31
|
-
--color-success-400: rgb(
|
|
32
|
-
--color-success-450: rgb(
|
|
33
|
-
--color-success-500: rgb(
|
|
34
|
-
--color-success-550: rgb(
|
|
35
|
-
--color-success-600: rgb(
|
|
36
|
-
--color-success-650: rgb(
|
|
37
|
-
--color-success-700: rgb(
|
|
38
|
-
--color-success-750: rgb(
|
|
39
|
-
--color-success-800: rgb(
|
|
40
|
-
--color-success-850: rgb(
|
|
41
|
-
--color-success-900: rgb(
|
|
42
|
-
--color-success-950: rgb(
|
|
24
|
+
--color-success-50: rgb(237, 245, 249);
|
|
25
|
+
--color-success-100: rgb(218, 237, 248);
|
|
26
|
+
--color-success-150: rgb(188, 225, 248);
|
|
27
|
+
--color-success-200: rgb(156, 216, 253);
|
|
28
|
+
--color-success-250: rgb(125, 204, 248);
|
|
29
|
+
--color-success-300: rgb(97, 190, 241);
|
|
30
|
+
--color-success-350: rgb(65, 178, 236);
|
|
31
|
+
--color-success-400: rgb(36, 164, 223);
|
|
32
|
+
--color-success-450: rgb(18, 148, 204);
|
|
33
|
+
--color-success-500: rgb(21, 135, 186);
|
|
34
|
+
--color-success-550: rgb(12, 121, 168);
|
|
35
|
+
--color-success-600: rgb(11, 110, 153);
|
|
36
|
+
--color-success-650: rgb(11, 97, 135);
|
|
37
|
+
--color-success-700: rgb(17, 88, 121);
|
|
38
|
+
--color-success-750: rgb(17, 76, 105);
|
|
39
|
+
--color-success-800: rgb(18, 66, 90);
|
|
40
|
+
--color-success-850: rgb(18, 56, 76);
|
|
41
|
+
--color-success-900: rgb(19, 44, 58);
|
|
42
|
+
--color-success-950: rgb(22, 33, 39);
|
|
43
43
|
|
|
44
|
-
--color-
|
|
45
|
-
--color-
|
|
46
|
-
--color-
|
|
47
|
-
--color-
|
|
48
|
-
--color-
|
|
49
|
-
--color-
|
|
50
|
-
--color-
|
|
51
|
-
--color-
|
|
52
|
-
--color-
|
|
53
|
-
--color-
|
|
54
|
-
--color-
|
|
55
|
-
--color-
|
|
56
|
-
--color-
|
|
57
|
-
--color-
|
|
58
|
-
--color-
|
|
59
|
-
--color-
|
|
60
|
-
--color-
|
|
61
|
-
--color-
|
|
62
|
-
--color-
|
|
44
|
+
--color-error-50: rgb(250, 241, 240);
|
|
45
|
+
--color-error-100: rgb(252, 229, 227);
|
|
46
|
+
--color-error-150: rgb(247, 208, 204);
|
|
47
|
+
--color-error-200: rgb(254, 193, 188);
|
|
48
|
+
--color-error-250: rgb(253, 177, 170);
|
|
49
|
+
--color-error-300: rgb(253, 154, 146);
|
|
50
|
+
--color-error-350: rgb(253, 131, 123);
|
|
51
|
+
--color-error-400: rgb(246, 109, 103);
|
|
52
|
+
--color-error-450: rgb(234, 90, 86);
|
|
53
|
+
--color-error-500: rgb(218, 75, 72);
|
|
54
|
+
--color-error-550: rgb(200, 62, 61);
|
|
55
|
+
--color-error-600: rgb(182, 54, 54);
|
|
56
|
+
--color-error-650: rgb(161, 47, 47);
|
|
57
|
+
--color-error-700: rgb(144, 44, 43);
|
|
58
|
+
--color-error-750: rgb(123, 41, 39);
|
|
59
|
+
--color-error-800: rgb(105, 39, 37);
|
|
60
|
+
--color-error-850: rgb(86, 36, 33);
|
|
61
|
+
--color-error-900: rgb(64, 32, 29);
|
|
62
|
+
--color-error-950: rgb(44, 26, 24);
|
|
63
63
|
|
|
64
|
-
--color-
|
|
65
|
-
--color-
|
|
66
|
-
--color-
|
|
67
|
-
--color-
|
|
68
|
-
--color-
|
|
69
|
-
--color-
|
|
70
|
-
--color-
|
|
71
|
-
--color-
|
|
72
|
-
--color-
|
|
73
|
-
--color-
|
|
74
|
-
--color-
|
|
75
|
-
--color-
|
|
76
|
-
--color-
|
|
77
|
-
--color-
|
|
78
|
-
--color-
|
|
79
|
-
--color-
|
|
80
|
-
--color-
|
|
81
|
-
--color-
|
|
82
|
-
--color-
|
|
64
|
+
--color-warning-50: rgb(249, 242, 237);
|
|
65
|
+
--color-warning-100: rgb(248, 232, 219);
|
|
66
|
+
--color-warning-150: rgb(243, 212, 186);
|
|
67
|
+
--color-warning-200: rgb(243, 200, 162);
|
|
68
|
+
--color-warning-250: rgb(240, 185, 136);
|
|
69
|
+
--color-warning-300: rgb(238, 166, 98);
|
|
70
|
+
--color-warning-350: rgb(234, 148, 58);
|
|
71
|
+
--color-warning-400: rgb(223, 132, 17);
|
|
72
|
+
--color-warning-450: rgb(204, 120, 15);
|
|
73
|
+
--color-warning-500: rgb(185, 108, 13);
|
|
74
|
+
--color-warning-550: rgb(167, 97, 10);
|
|
75
|
+
--color-warning-600: rgb(150, 87, 11);
|
|
76
|
+
--color-warning-650: rgb(134, 78, 11);
|
|
77
|
+
--color-warning-700: rgb(120, 70, 13);
|
|
78
|
+
--color-warning-750: rgb(105, 61, 13);
|
|
79
|
+
--color-warning-800: rgb(90, 55, 19);
|
|
80
|
+
--color-warning-850: rgb(73, 47, 21);
|
|
81
|
+
--color-warning-900: rgb(56, 38, 20);
|
|
82
|
+
--color-warning-950: rgb(38, 29, 21);
|
|
83
83
|
|
|
84
|
-
--color-blue-50: rgb(
|
|
85
|
-
--color-blue-100: rgb(
|
|
86
|
-
--color-blue-150: rgb(
|
|
87
|
-
--color-blue-200: rgb(
|
|
88
|
-
--color-blue-250: rgb(
|
|
89
|
-
--color-blue-300: rgb(
|
|
90
|
-
--color-blue-350: rgb(
|
|
91
|
-
--color-blue-400: rgb(
|
|
92
|
-
--color-blue-450: rgb(
|
|
93
|
-
--color-blue-500: rgb(
|
|
94
|
-
--color-blue-550: rgb(
|
|
95
|
-
--color-blue-600: rgb(
|
|
96
|
-
--color-blue-650: rgb(
|
|
97
|
-
--color-blue-700: rgb(
|
|
98
|
-
--color-blue-750: rgb(
|
|
99
|
-
--color-blue-800: rgb(
|
|
100
|
-
--color-blue-850: rgb(
|
|
101
|
-
--color-blue-900: rgb(
|
|
102
|
-
--color-blue-950: rgb(
|
|
84
|
+
--color-blue-50: rgb(237, 245, 249);
|
|
85
|
+
--color-blue-100: rgb(218, 237, 248);
|
|
86
|
+
--color-blue-150: rgb(188, 225, 248);
|
|
87
|
+
--color-blue-200: rgb(156, 216, 253);
|
|
88
|
+
--color-blue-250: rgb(125, 204, 248);
|
|
89
|
+
--color-blue-300: rgb(97, 190, 241);
|
|
90
|
+
--color-blue-350: rgb(65, 178, 236);
|
|
91
|
+
--color-blue-400: rgb(36, 164, 223);
|
|
92
|
+
--color-blue-450: rgb(18, 148, 204);
|
|
93
|
+
--color-blue-500: rgb(21, 135, 186);
|
|
94
|
+
--color-blue-550: rgb(12, 121, 168);
|
|
95
|
+
--color-blue-600: rgb(11, 110, 153);
|
|
96
|
+
--color-blue-650: rgb(11, 97, 135);
|
|
97
|
+
--color-blue-700: rgb(17, 88, 121);
|
|
98
|
+
--color-blue-750: rgb(17, 76, 105);
|
|
99
|
+
--color-blue-800: rgb(18, 66, 90);
|
|
100
|
+
--color-blue-850: rgb(18, 56, 76);
|
|
101
|
+
--color-blue-900: rgb(19, 44, 58);
|
|
102
|
+
--color-blue-950: rgb(22, 33, 39);
|
|
103
103
|
|
|
104
104
|
--theme-border-color: var(--theme-elevation-150);
|
|
105
105
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/richtext-slate",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.60",
|
|
4
4
|
"description": "The officially supported Slate richtext adapter for Payload",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
"@types/node": "20.12.5",
|
|
36
36
|
"@types/react": "npm:types-react@19.0.0-beta.2",
|
|
37
37
|
"@types/react-dom": "npm:types-react-dom@19.0.0-beta.2",
|
|
38
|
-
"
|
|
39
|
-
"@payloadcms/
|
|
40
|
-
"
|
|
38
|
+
"@payloadcms/ui": "3.0.0-beta.60",
|
|
39
|
+
"@payloadcms/eslint-config": "3.0.0-beta.59",
|
|
40
|
+
"payload": "3.0.0-beta.60"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"react": "^19.0.0 || ^19.0.0-rc-f994737d14-20240522",
|
|
44
|
-
"@payloadcms/
|
|
45
|
-
"
|
|
46
|
-
"
|
|
44
|
+
"@payloadcms/ui": "3.0.0-beta.60",
|
|
45
|
+
"payload": "3.0.0-beta.60",
|
|
46
|
+
"@payloadcms/translations": "3.0.0-beta.60"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
|
49
49
|
"node": "^18.20.2 || >=20.9.0"
|