@lexion-rte/react 0.1.3 → 0.1.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @lexion-rte/react
2
2
 
3
+ ## 0.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 1d74f2e: Introduce the open-core package split for Lexion.
8
+
9
+ Community editing features now ship in `@lexion-rte/starter-kit`, while commercial-only capabilities move behind private package boundaries. Public documentation and package metadata now describe the dual-license/open-core model consistently.
10
+
11
+ Migration note:
12
+
13
+ - replace imports from `@lexion-rte/extensions` with `@lexion-rte/starter-kit` for starter-kit commands and extensions
14
+ - use the new package/docs structure for community versus commercial features going forward
15
+
16
+ - Updated dependencies [1d74f2e]
17
+ - @lexion-rte/starter-kit@0.2.0
18
+ - @lexion-rte/core@0.1.5
19
+
20
+ ## 0.1.4
21
+
22
+ ### Patch Changes
23
+
24
+ - Add a shared Lexion framework overview and logo at the top of each package README.
25
+ - Updated dependencies
26
+ - @lexion-rte/core@0.1.4
27
+ - @lexion-rte/extensions@0.1.4
28
+
3
29
  ## 0.1.3
4
30
 
5
31
  ### Patch Changes
package/README.md CHANGED
@@ -1,3 +1,9 @@
1
+ ![Lexion Logo](../../assets/images/logo.png)
2
+
3
+ This package is part of the Lexion framework-agnostic rich text editor.
4
+
5
+ Lexion is a framework-agnostic, headless rich text editor platform built on ProseMirror, designed to provide a shared core, reusable extensions, and framework-specific adapters.
6
+
1
7
  # @lexion-rte/react
2
8
 
3
9
  React adapter for Lexion.
@@ -67,7 +73,7 @@ export function ControlledEditor({ initial }: { initial: JSONDocument }) {
67
73
  ```tsx
68
74
  import { useMemo } from "react";
69
75
  import { LexionEditor } from "@lexion-rte/core";
70
- import { starterKitExtension } from "@lexion-rte/extensions";
76
+ import { starterKitExtension } from "@lexion-rte/starter-kit";
71
77
  import { LexionEditorView } from "@lexion-rte/react";
72
78
 
73
79
  export function SharedEditor() {
@@ -1 +1 @@
1
- {"version":3,"file":"LexionEditorView.d.ts","sourceRoot":"","sources":["../src/LexionEditorView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGnE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IACxE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;CAChC;AAgBD,eAAO,MAAM,gBAAgB,GAAI,gFAS9B,qBAAqB,4CAiHvB,CAAC"}
1
+ {"version":3,"file":"LexionEditorView.d.ts","sourceRoot":"","sources":["../src/LexionEditorView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EACL,YAAY,EAEZ,KAAK,YAAY,EAElB,MAAM,kBAAkB,CAAC;AAG1B,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IACxE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;CAChC;AAYD,eAAO,MAAM,gBAAgB,GAAI,gFAS9B,qBAAqB,4CA2JvB,CAAC"}
@@ -1,20 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useMemo, useRef } from "react";
2
+ import { useEffect, useMemo, useRef, useState } from "react";
3
3
  import { EditorView } from "prosemirror-view";
4
- import { LexionEditor } from "@lexion-rte/core";
5
- import { starterKitExtension } from "@lexion-rte/extensions";
4
+ import { LexionEditor, lexionStatusBarAppearance } from "@lexion-rte/core";
5
+ import { starterKitExtension } from "@lexion-rte/starter-kit";
6
6
  const serializeJSON = (document) => JSON.stringify(document);
7
- const FOOTER_TEXT = "Open Source Limited Version";
8
- const FOOTER_STYLE = {
9
- padding: "8px 12px",
10
- borderTop: "1px solid #d7d7d7",
11
- background: "#f7f7f7",
12
- color: "#4a4a4a",
13
- fontSize: "12px",
14
- lineHeight: 1.3,
15
- textAlign: "center",
16
- fontFamily: "ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial"
17
- };
7
+ const STATUS_BAR_STYLE = lexionStatusBarAppearance.style;
8
+ const STATUS_BAR_START_STYLE = lexionStatusBarAppearance.groupStyles.start;
9
+ const STATUS_BAR_END_STYLE = lexionStatusBarAppearance.groupStyles.end;
10
+ const splitStatusBarItems = (items) => ({
11
+ start: items.filter((item) => (item.align ?? "start") === "start"),
12
+ end: items.filter((item) => (item.align ?? "start") === "end")
13
+ });
18
14
  export const LexionEditorView = ({ editor, value, defaultValue, onChange, onReady, readOnly = false, className, style }) => {
19
15
  const containerRef = useRef(null);
20
16
  const viewRef = useRef(null);
@@ -36,6 +32,8 @@ export const LexionEditorView = ({ editor, value, defaultValue, onChange, onRead
36
32
  }, []);
37
33
  const activeEditor = editor ?? internalEditor;
38
34
  const isControlled = value !== undefined;
35
+ const [statusBarItems, setStatusBarItems] = useState(() => activeEditor.getStatusBarItems());
36
+ const statusBar = splitStatusBarItems(statusBarItems);
39
37
  latestOnChange.current = onChange;
40
38
  latestOnReady.current = onReady;
41
39
  latestReadOnly.current = readOnly;
@@ -53,12 +51,14 @@ export const LexionEditorView = ({ editor, value, defaultValue, onChange, onRead
53
51
  dispatchTransaction: (transaction) => {
54
52
  activeEditor.dispatchTransaction(transaction);
55
53
  view.updateState(activeEditor.state);
54
+ setStatusBarItems(activeEditor.getStatusBarItems());
56
55
  const nextValue = activeEditor.getJSON();
57
56
  lastAppliedValueRef.current = serializeJSON(nextValue);
58
57
  latestOnChange.current?.(nextValue, activeEditor);
59
58
  }
60
59
  });
61
60
  viewRef.current = view;
61
+ setStatusBarItems(activeEditor.getStatusBarItems());
62
62
  latestOnReady.current?.(activeEditor);
63
63
  return () => {
64
64
  view.destroy();
@@ -85,6 +85,7 @@ export const LexionEditorView = ({ editor, value, defaultValue, onChange, onRead
85
85
  activeEditor.setJSON(value);
86
86
  lastAppliedValueRef.current = nextValue;
87
87
  viewRef.current?.updateState(activeEditor.state);
88
+ setStatusBarItems(activeEditor.getStatusBarItems());
88
89
  }, [activeEditor, isControlled, value]);
89
90
  useEffect(() => () => {
90
91
  if (!editor) {
@@ -95,6 +96,10 @@ export const LexionEditorView = ({ editor, value, defaultValue, onChange, onRead
95
96
  ...(style ?? {}),
96
97
  display: "flex",
97
98
  flexDirection: "column"
98
- }, children: [_jsx("div", { ref: containerRef }), _jsx("div", { className: "lexion-editor-footer", style: FOOTER_STYLE, children: FOOTER_TEXT })] }));
99
+ }, children: [_jsx("div", { ref: containerRef }), _jsxs("div", { className: lexionStatusBarAppearance.className, style: STATUS_BAR_STYLE, children: [_jsx("div", { className: `${lexionStatusBarAppearance.groupClassName} ${lexionStatusBarAppearance.groupClassName}--start`, style: STATUS_BAR_START_STYLE, children: statusBar.start.map((item) => (_jsx("div", { className: item.className
100
+ ? `${lexionStatusBarAppearance.itemClassName} ${item.className}`
101
+ : lexionStatusBarAppearance.itemClassName, style: item.style, children: item.text }, item.key))) }), _jsx("div", { className: `${lexionStatusBarAppearance.groupClassName} ${lexionStatusBarAppearance.groupClassName}--end`, style: STATUS_BAR_END_STYLE, children: statusBar.end.map((item) => (_jsx("div", { className: item.className
102
+ ? `${lexionStatusBarAppearance.itemClassName} ${item.className}`
103
+ : lexionStatusBarAppearance.itemClassName, style: item.style, children: item.text }, item.key))) })] })] }));
99
104
  };
100
105
  //# sourceMappingURL=LexionEditorView.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LexionEditorView.js","sourceRoot":"","sources":["../src/LexionEditorView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAqB,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAa7D,MAAM,aAAa,GAAG,CAAC,QAAsB,EAAU,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;AACnF,MAAM,WAAW,GAAG,6BAA6B,CAAC;AAElD,MAAM,YAAY,GAAkB;IAClC,OAAO,EAAE,UAAU;IACnB,SAAS,EAAE,mBAAmB;IAC9B,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,SAAS;IAChB,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,GAAG;IACf,SAAS,EAAE,QAAQ;IACnB,UAAU,EAAE,6EAA6E;CAC1F,CAAC;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ACE,EACN,cACE,SAAS,EAAE,GAAG,yBAAyB,CAAC,cAAc,IAAI,yBAAyB,CAAC,cAAc,OAAO,EACzG,KAAK,EAAE,oBAAoB,YAE1B,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAC3B,cAEE,SAAS,EACP,IAAI,CAAC,SAAS;gCACZ,CAAC,CAAC,GAAG,yBAAyB,CAAC,aAAa,IAAI,IAAI,CAAC,SAAS,EAAE;gCAChE,CAAC,CAAC,yBAAyB,CAAC,aAAa,EAE7C,KAAK,EAAE,IAAI,CAAC,KAAkC,YAE7C,IAAI,CAAC,IAAI,IARL,IAAI,CAAC,GAAG,CAST,CACP,CAAC,GACE,IACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lexion-rte/react",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "React adapter for the Lexion editor platform.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -12,7 +12,7 @@
12
12
  "import": "./dist/index.js"
13
13
  }
14
14
  },
15
- "license": "GPL-3.0-only",
15
+ "license": "GPL-3.0-or-later",
16
16
  "repository": {
17
17
  "type": "git",
18
18
  "url": "https://github.com/dariusve/lexion.git",
@@ -35,8 +35,8 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "prosemirror-view": "^1.37.2",
38
- "@lexion-rte/core": "0.1.3",
39
- "@lexion-rte/extensions": "0.1.3"
38
+ "@lexion-rte/core": "0.1.5",
39
+ "@lexion-rte/starter-kit": "0.2.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": "^18.2.0 || ^19.0.0",
@@ -1,8 +1,13 @@
1
- import { useEffect, useMemo, useRef } from "react";
1
+ import { useEffect, useMemo, useRef, useState } from "react";
2
2
  import type { CSSProperties } from "react";
3
3
  import { EditorView } from "prosemirror-view";
4
- import { LexionEditor, type JSONDocument } from "@lexion-rte/core";
5
- import { starterKitExtension } from "@lexion-rte/extensions";
4
+ import {
5
+ LexionEditor,
6
+ lexionStatusBarAppearance,
7
+ type JSONDocument,
8
+ type LexionStatusBarItem
9
+ } from "@lexion-rte/core";
10
+ import { starterKitExtension } from "@lexion-rte/starter-kit";
6
11
 
7
12
  export interface LexionEditorViewProps {
8
13
  readonly editor?: LexionEditor;
@@ -16,18 +21,14 @@ export interface LexionEditorViewProps {
16
21
  }
17
22
 
18
23
  const serializeJSON = (document: JSONDocument): string => JSON.stringify(document);
19
- const FOOTER_TEXT = "Open Source Limited Version";
20
-
21
- const FOOTER_STYLE: CSSProperties = {
22
- padding: "8px 12px",
23
- borderTop: "1px solid #d7d7d7",
24
- background: "#f7f7f7",
25
- color: "#4a4a4a",
26
- fontSize: "12px",
27
- lineHeight: 1.3,
28
- textAlign: "center",
29
- fontFamily: "ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial"
30
- };
24
+ const STATUS_BAR_STYLE = lexionStatusBarAppearance.style as CSSProperties;
25
+ const STATUS_BAR_START_STYLE = lexionStatusBarAppearance.groupStyles.start as CSSProperties;
26
+ const STATUS_BAR_END_STYLE = lexionStatusBarAppearance.groupStyles.end as CSSProperties;
27
+
28
+ const splitStatusBarItems = (items: readonly LexionStatusBarItem[]) => ({
29
+ start: items.filter((item) => (item.align ?? "start") === "start"),
30
+ end: items.filter((item) => (item.align ?? "start") === "end")
31
+ });
31
32
 
32
33
  export const LexionEditorView = ({
33
34
  editor,
@@ -65,6 +66,10 @@ export const LexionEditorView = ({
65
66
 
66
67
  const activeEditor = editor ?? internalEditor;
67
68
  const isControlled = value !== undefined;
69
+ const [statusBarItems, setStatusBarItems] = useState<readonly LexionStatusBarItem[]>(
70
+ () => activeEditor.getStatusBarItems()
71
+ );
72
+ const statusBar = splitStatusBarItems(statusBarItems);
68
73
 
69
74
  latestOnChange.current = onChange;
70
75
  latestOnReady.current = onReady;
@@ -86,6 +91,7 @@ export const LexionEditorView = ({
86
91
  dispatchTransaction: (transaction) => {
87
92
  activeEditor.dispatchTransaction(transaction);
88
93
  view.updateState(activeEditor.state);
94
+ setStatusBarItems(activeEditor.getStatusBarItems());
89
95
 
90
96
  const nextValue = activeEditor.getJSON();
91
97
  lastAppliedValueRef.current = serializeJSON(nextValue);
@@ -94,6 +100,7 @@ export const LexionEditorView = ({
94
100
  });
95
101
 
96
102
  viewRef.current = view;
103
+ setStatusBarItems(activeEditor.getStatusBarItems());
97
104
  latestOnReady.current?.(activeEditor);
98
105
 
99
106
  return () => {
@@ -125,6 +132,7 @@ export const LexionEditorView = ({
125
132
  activeEditor.setJSON(value);
126
133
  lastAppliedValueRef.current = nextValue;
127
134
  viewRef.current?.updateState(activeEditor.state);
135
+ setStatusBarItems(activeEditor.getStatusBarItems());
128
136
  }, [activeEditor, isControlled, value]);
129
137
 
130
138
  useEffect(
@@ -146,8 +154,43 @@ export const LexionEditorView = ({
146
154
  }}
147
155
  >
148
156
  <div ref={containerRef} />
149
- <div className="lexion-editor-footer" style={FOOTER_STYLE}>
150
- {FOOTER_TEXT}
157
+ <div className={lexionStatusBarAppearance.className} style={STATUS_BAR_STYLE}>
158
+ <div
159
+ className={`${lexionStatusBarAppearance.groupClassName} ${lexionStatusBarAppearance.groupClassName}--start`}
160
+ style={STATUS_BAR_START_STYLE}
161
+ >
162
+ {statusBar.start.map((item) => (
163
+ <div
164
+ key={item.key}
165
+ className={
166
+ item.className
167
+ ? `${lexionStatusBarAppearance.itemClassName} ${item.className}`
168
+ : lexionStatusBarAppearance.itemClassName
169
+ }
170
+ style={item.style as CSSProperties | undefined}
171
+ >
172
+ {item.text}
173
+ </div>
174
+ ))}
175
+ </div>
176
+ <div
177
+ className={`${lexionStatusBarAppearance.groupClassName} ${lexionStatusBarAppearance.groupClassName}--end`}
178
+ style={STATUS_BAR_END_STYLE}
179
+ >
180
+ {statusBar.end.map((item) => (
181
+ <div
182
+ key={item.key}
183
+ className={
184
+ item.className
185
+ ? `${lexionStatusBarAppearance.itemClassName} ${item.className}`
186
+ : lexionStatusBarAppearance.itemClassName
187
+ }
188
+ style={item.style as CSSProperties | undefined}
189
+ >
190
+ {item.text}
191
+ </div>
192
+ ))}
193
+ </div>
151
194
  </div>
152
195
  </div>
153
196
  );