@byline/richtext-lexical 4.11.2 → 4.13.0

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/config.d.ts CHANGED
@@ -15,7 +15,7 @@
15
15
  * `EditorField` / `Nodes` or the heavy *content* extension classes
16
16
  * (Table, InlineImage, Admonition, …), all of which statically pull React
17
17
  * plugins, nodes, and the Lexical core. Import from here at registration
18
- * sites (e.g. an admin/client config that you want to evaluate eagerly)
18
+ * sites (e.g. an admin/admin config that you want to evaluate eagerly)
19
19
  * so referencing the editor doesn't drag the editor module graph into the
20
20
  * importing bundle.
21
21
  *
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useCallback, useEffect, useRef, useState } from "react";
4
- import { getClientConfig } from "@byline/core";
4
+ import { getAdminConfig } from "@byline/core";
5
5
  import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
6
6
  import { $findMatchingParent, mergeRegister } from "@lexical/utils";
7
7
  import { $getSelection, $isLineBreakNode, $isRangeSelection, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_HIGH, COMMAND_PRIORITY_LOW, KEY_ESCAPE_COMMAND, SELECTION_CHANGE_COMMAND } from "lexical";
@@ -20,7 +20,7 @@ function FloatingLinkEditor({ editor, isLink, setIsLink, anchorElem }) {
20
20
  });
21
21
  const [linkModalData, setLinkModalData] = useState(void 0);
22
22
  const [modalOpen, setModalOpen] = useState(false);
23
- const adminRoute = getClientConfig().routes.admin;
23
+ const adminRoute = getAdminConfig().routes.admin;
24
24
  const $updateLinkEditor = useCallback(()=>{
25
25
  const selection = $getSelection();
26
26
  if ($isRangeSelection(selection)) {
@@ -2,7 +2,7 @@
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useMemo, useState } from "react";
4
4
  import { RelationPicker } from "@byline/admin/react";
5
- import { getClientConfig, getCollectionDefinition } from "@byline/core";
5
+ import { getAdminConfig, getCollectionDefinition } from "@byline/core";
6
6
  import { Button, Checkbox, CloseIcon, IconButton, Input, Label, Modal, RadioGroup, RadioGroupItem, Select } from "@byline/ui/react";
7
7
  import { useModalFormState } from "../../shared/useModalFormState.js";
8
8
  import { validateUrl } from "../../utils/url.js";
@@ -41,7 +41,7 @@ function fromLinkData(data, linkable) {
41
41
  };
42
42
  }
43
43
  const LinkModal = ({ isOpen = false, onSubmit, onClose, data: dataFromProps })=>{
44
- const linkable = useMemo(()=>getClientConfig().collections.filter((c)=>true === c.linksInEditor), []);
44
+ const linkable = useMemo(()=>getAdminConfig().collections.filter((c)=>true === c.linksInEditor), []);
45
45
  const [pickerOpen, setPickerOpen] = useState(false);
46
46
  const [urlError, setUrlError] = useState(null);
47
47
  const [state, setState] = useModalFormState(isOpen, ()=>fromLinkData(dataFromProps, linkable), ()=>setUrlError(null));
@@ -1,11 +1,11 @@
1
- import { getClientConfig } from "@byline/core";
1
+ import { getAdminConfig } from "@byline/core";
2
2
  import { addClassNamesToElement, isHTMLAnchorElement } from "@lexical/utils";
3
3
  import { $applyNodeReplacement, $createTextNode, $getSelection, $isElementNode, $isRangeSelection, ElementNode, createCommand } from "lexical";
4
4
  import { sanitizeUrl } from "../../utils/url.js";
5
5
  function adminHref(attrs) {
6
6
  if (null == attrs || 'internal' !== attrs.linkType) return '#';
7
7
  const internal = attrs;
8
- const { admin } = getClientConfig().routes;
8
+ const { admin } = getAdminConfig().routes;
9
9
  return `${admin}/collections/${internal.targetCollectionPath}/${internal.targetDocumentId}`;
10
10
  }
11
11
  class LinkNode extends ElementNode {
@@ -46,7 +46,7 @@ type ConfigureFn = (config: LexicalEditorConfigureInput) => LexicalEditorConfigu
46
46
  * ```ts
47
47
  * import { lexicalEditor, TableExtension } from '@byline/richtext-lexical'
48
48
  *
49
- * defineClientConfig({
49
+ * defineAdminConfig({
50
50
  * fields: {
51
51
  * richText: {
52
52
  * editor: lexicalEditor((c) => {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "type": "module",
5
5
  "license": "MPL-2.0",
6
- "version": "4.11.2",
6
+ "version": "4.13.0",
7
7
  "engines": {
8
8
  "node": ">=20.9.0"
9
9
  },
@@ -71,21 +71,21 @@
71
71
  "@lexical/utils": "0.49.0",
72
72
  "clsx": "^2.1.1",
73
73
  "lexical": "0.49.0",
74
- "react-error-boundary": "^6.1.2",
75
- "@byline/admin": "4.11.2",
76
- "@byline/client": "4.11.2",
77
- "@byline/core": "4.11.2",
78
- "@byline/ui": "4.11.2"
74
+ "react-error-boundary": "^6.1.3",
75
+ "@byline/ui": "4.13.0",
76
+ "@byline/core": "4.13.0",
77
+ "@byline/admin": "4.13.0",
78
+ "@byline/client": "4.13.0"
79
79
  },
80
80
  "peerDependencies": {
81
81
  "react": "^19.0.0",
82
82
  "react-dom": "^19.0.0"
83
83
  },
84
84
  "devDependencies": {
85
- "@biomejs/biome": "2.5.6",
85
+ "@biomejs/biome": "2.5.9",
86
86
  "@rsbuild/plugin-react": "^2.1.0",
87
87
  "@rslib/core": "^0.23.2",
88
- "@types/node": "^26.1.2",
88
+ "@types/node": "^26.2.0",
89
89
  "@types/react": "19.2.18",
90
90
  "@types/react-dom": "19.2.4",
91
91
  "@vitejs/plugin-react": "^6.0.5",
@@ -96,8 +96,8 @@
96
96
  "rimraf": "^6.1.3",
97
97
  "typescript": "^7.0.2",
98
98
  "typescript-plugin-css-modules": "^5.2.0",
99
- "vite": "^8.2.0",
100
- "vitest": "^4.1.10"
99
+ "vite": "^8.2.1",
100
+ "vitest": "^4.1.11"
101
101
  },
102
102
  "publishConfig": {
103
103
  "access": "public",
package/src/config.ts CHANGED
@@ -16,7 +16,7 @@
16
16
  * `EditorField` / `Nodes` or the heavy *content* extension classes
17
17
  * (Table, InlineImage, Admonition, …), all of which statically pull React
18
18
  * plugins, nodes, and the Lexical core. Import from here at registration
19
- * sites (e.g. an admin/client config that you want to evaluate eagerly)
19
+ * sites (e.g. an admin/admin config that you want to evaluate eagerly)
20
20
  * so referencing the editor doesn't drag the editor module graph into the
21
21
  * importing bundle.
22
22
  *
@@ -13,7 +13,7 @@
13
13
  import type * as React from 'react'
14
14
  import { type Dispatch, useCallback, useEffect, useRef, useState } from 'react'
15
15
 
16
- import { getClientConfig } from '@byline/core'
16
+ import { getAdminConfig } from '@byline/core'
17
17
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'
18
18
  import { $findMatchingParent, mergeRegister } from '@lexical/utils'
19
19
  import {
@@ -70,7 +70,7 @@ function FloatingLinkEditor({
70
70
  })
71
71
  const [linkModalData, setLinkModalData] = useState<LinkData | undefined>(undefined)
72
72
  const [modalOpen, setModalOpen] = useState(false)
73
- const adminRoute = getClientConfig().routes.admin
73
+ const adminRoute = getAdminConfig().routes.admin
74
74
 
75
75
  const $updateLinkEditor = useCallback(() => {
76
76
  const selection = $getSelection()
@@ -13,7 +13,7 @@ import { useMemo, useState } from 'react'
13
13
 
14
14
  import { RelationPicker } from '@byline/admin/react'
15
15
  import type { CollectionDefinition } from '@byline/core'
16
- import { getClientConfig, getCollectionDefinition } from '@byline/core'
16
+ import { getAdminConfig, getCollectionDefinition } from '@byline/core'
17
17
  import {
18
18
  Button,
19
19
  Checkbox,
@@ -102,7 +102,7 @@ export const LinkModal: React.FC<LinkModalProps> = ({
102
102
  data: dataFromProps,
103
103
  }) => {
104
104
  const linkable = useMemo<CollectionDefinition[]>(
105
- () => getClientConfig().collections.filter((c) => c.linksInEditor === true),
105
+ () => getAdminConfig().collections.filter((c) => c.linksInEditor === true),
106
106
  []
107
107
  )
108
108
 
@@ -6,7 +6,7 @@
6
6
  *
7
7
  */
8
8
 
9
- import { getClientConfig } from '@byline/core'
9
+ import { getAdminConfig } from '@byline/core'
10
10
  import { addClassNamesToElement, isHTMLAnchorElement } from '@lexical/utils'
11
11
  import {
12
12
  $applyNodeReplacement,
@@ -33,7 +33,7 @@ import type { InternalLinkAttributes, LinkAttributes, SerializedLinkNode } from
33
33
  function adminHref(attrs: LinkAttributes | null | undefined): string {
34
34
  if (attrs == null || attrs.linkType !== 'internal') return '#'
35
35
  const internal = attrs as InternalLinkAttributes
36
- const { admin } = getClientConfig().routes
36
+ const { admin } = getAdminConfig().routes
37
37
  return `${admin}/collections/${internal.targetCollectionPath}/${internal.targetDocumentId}`
38
38
  }
39
39
 
@@ -97,7 +97,7 @@ function loadEditorBundle(): Promise<EditorBundle> {
97
97
  * ```ts
98
98
  * import { lexicalEditor, TableExtension } from '@byline/richtext-lexical'
99
99
  *
100
- * defineClientConfig({
100
+ * defineAdminConfig({
101
101
  * fields: {
102
102
  * richText: {
103
103
  * editor: lexicalEditor((c) => {
@@ -1,17 +0,0 @@
1
- import cx from 'classnames'
2
- import { jsx as _jsx } from 'react/jsx-runtime'
3
- import './danger-icon.css'
4
- export function DangerIcon({ className, ...rest }) {
5
- return _jsx('div', {
6
- className: cx('danger-icon', className),
7
- ...rest,
8
- children: _jsx('svg', {
9
- focusable: 'false',
10
- 'aria-hidden': 'true',
11
- viewBox: '0 0 24 24',
12
- children: _jsx('path', {
13
- d: 'M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z',
14
- }),
15
- }),
16
- })
17
- }
@@ -1,4 +0,0 @@
1
- export * from './danger-icon'
2
- export * from './note-icon'
3
- export * from './tip-icon'
4
- export * from './warning-icon'
@@ -1,17 +0,0 @@
1
- import cx from 'classnames'
2
- import { jsx as _jsx } from 'react/jsx-runtime'
3
- import './note-icon.css'
4
- export function NoteIcon({ className, ...rest }) {
5
- return _jsx('div', {
6
- className: cx('note-icon', className),
7
- ...rest,
8
- children: _jsx('svg', {
9
- focusable: 'false',
10
- 'aria-hidden': 'true',
11
- viewBox: '0 0 24 24',
12
- children: _jsx('path', {
13
- d: 'M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z',
14
- }),
15
- }),
16
- })
17
- }
@@ -1,17 +0,0 @@
1
- import cx from 'classnames'
2
- import { jsx as _jsx } from 'react/jsx-runtime'
3
- import './tip-icon.css'
4
- export function TipIcon({ className, ...rest }) {
5
- return _jsx('div', {
6
- className: cx('tip-icon', className),
7
- ...rest,
8
- children: _jsx('svg', {
9
- focusable: 'false',
10
- 'aria-hidden': 'true',
11
- viewBox: '0 0 24 24',
12
- children: _jsx('path', {
13
- d: 'M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z',
14
- }),
15
- }),
16
- })
17
- }
@@ -1,17 +0,0 @@
1
- import cx from 'classnames'
2
- import { jsx as _jsx } from 'react/jsx-runtime'
3
- import './warning-icon.css'
4
- export function WarningIcon({ className, ...rest }) {
5
- return _jsx('div', {
6
- className: cx('warning-icon', className),
7
- ...rest,
8
- children: _jsx('svg', {
9
- focusable: 'false',
10
- 'aria-hidden': 'true',
11
- viewBox: '0 0 24 24',
12
- children: _jsx('path', {
13
- d: 'M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z',
14
- }),
15
- }),
16
- })
17
- }