dn-react-text-editor 0.3.7 → 0.3.9
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/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -7
- package/dist/index.mjs +7 -8
- package/dist/input.d.mts +3 -3
- package/dist/input.d.ts +3 -3
- package/dist/input.js +4 -6
- package/dist/input.mjs +4 -6
- package/dist/plugins/upload_placeholder.d.mts +1 -1
- package/dist/plugins/upload_placeholder.d.ts +1 -1
- package/dist/text_editor.d.mts +3 -1
- package/dist/text_editor.d.ts +3 -1
- package/dist/text_editor.js +5 -7
- package/dist/text_editor.mjs +7 -8
- package/package.json +56 -56
package/dist/index.d.mts
CHANGED
|
@@ -5,6 +5,7 @@ export { createInnerHTML, createTextEditorView } from './html.mjs';
|
|
|
5
5
|
export { ConfigTextEditorOptions, TextEditorController, TextEditorControllerProps, configTextEditorController } from './text_editor_controller.mjs';
|
|
6
6
|
import 'react/jsx-runtime';
|
|
7
7
|
import 'react';
|
|
8
|
+
import './input.mjs';
|
|
8
9
|
import 'orderedmap';
|
|
9
10
|
import 'prosemirror-model';
|
|
10
11
|
import 'prosemirror-view';
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { createInnerHTML, createTextEditorView } from './html.js';
|
|
|
5
5
|
export { ConfigTextEditorOptions, TextEditorController, TextEditorControllerProps, configTextEditorController } from './text_editor_controller.js';
|
|
6
6
|
import 'react/jsx-runtime';
|
|
7
7
|
import 'react';
|
|
8
|
+
import './input.js';
|
|
8
9
|
import 'orderedmap';
|
|
9
10
|
import 'prosemirror-model';
|
|
10
11
|
import 'prosemirror-view';
|
package/dist/index.js
CHANGED
|
@@ -55,11 +55,10 @@ function TextEditorInput({ controller, onChange, ...props }) {
|
|
|
55
55
|
(0, import_rxjs.filter)((tr) => tr.docChanged),
|
|
56
56
|
(0, import_rxjs.debounceTime)(controller.props.updateDelay || 0)
|
|
57
57
|
).subscribe(() => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
58
|
+
const input = inputRef.current;
|
|
59
|
+
if (!input) return;
|
|
60
|
+
input.value = controller.value;
|
|
61
|
+
onChange?.(controller.value);
|
|
63
62
|
});
|
|
64
63
|
return () => {
|
|
65
64
|
sub.unsubscribe();
|
|
@@ -71,7 +70,6 @@ function TextEditorInput({ controller, onChange, ...props }) {
|
|
|
71
70
|
...props,
|
|
72
71
|
ref: inputRef,
|
|
73
72
|
type: "hidden",
|
|
74
|
-
onInput: onChange,
|
|
75
73
|
defaultValue: controller.props.defaultValue
|
|
76
74
|
}
|
|
77
75
|
);
|
|
@@ -1131,7 +1129,7 @@ function TextEditor({
|
|
|
1131
1129
|
[]
|
|
1132
1130
|
);
|
|
1133
1131
|
(0, import_react2.useImperativeHandle)(ref, () => controller, [controller]);
|
|
1134
|
-
(0,
|
|
1132
|
+
(0, import_react2.useLayoutEffect)(() => {
|
|
1135
1133
|
const container = containerRef.current;
|
|
1136
1134
|
if (!container) {
|
|
1137
1135
|
return;
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// src/text_editor.tsx
|
|
2
2
|
import {
|
|
3
3
|
useImperativeHandle,
|
|
4
|
+
useLayoutEffect,
|
|
4
5
|
useMemo
|
|
5
6
|
} from "react";
|
|
6
|
-
import {
|
|
7
|
+
import { useRef as useRef2 } from "react";
|
|
7
8
|
|
|
8
9
|
// src/input.tsx
|
|
9
10
|
import {
|
|
@@ -19,11 +20,10 @@ function TextEditorInput({ controller, onChange, ...props }) {
|
|
|
19
20
|
filter((tr) => tr.docChanged),
|
|
20
21
|
debounceTime(controller.props.updateDelay || 0)
|
|
21
22
|
).subscribe(() => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
23
|
+
const input = inputRef.current;
|
|
24
|
+
if (!input) return;
|
|
25
|
+
input.value = controller.value;
|
|
26
|
+
onChange?.(controller.value);
|
|
27
27
|
});
|
|
28
28
|
return () => {
|
|
29
29
|
sub.unsubscribe();
|
|
@@ -35,7 +35,6 @@ function TextEditorInput({ controller, onChange, ...props }) {
|
|
|
35
35
|
...props,
|
|
36
36
|
ref: inputRef,
|
|
37
37
|
type: "hidden",
|
|
38
|
-
onInput: onChange,
|
|
39
38
|
defaultValue: controller.props.defaultValue
|
|
40
39
|
}
|
|
41
40
|
);
|
|
@@ -1097,7 +1096,7 @@ function TextEditor({
|
|
|
1097
1096
|
[]
|
|
1098
1097
|
);
|
|
1099
1098
|
useImperativeHandle(ref, () => controller, [controller]);
|
|
1100
|
-
|
|
1099
|
+
useLayoutEffect(() => {
|
|
1101
1100
|
const container = containerRef.current;
|
|
1102
1101
|
if (!container) {
|
|
1103
1102
|
return;
|
package/dist/input.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { DetailedHTMLProps, HTMLAttributes
|
|
2
|
+
import { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
3
3
|
import { TextEditorController } from './text_editor_controller.mjs';
|
|
4
4
|
import 'prosemirror-model';
|
|
5
5
|
import 'prosemirror-state';
|
|
@@ -9,10 +9,10 @@ import './schema.mjs';
|
|
|
9
9
|
import 'orderedmap';
|
|
10
10
|
import 'rxjs';
|
|
11
11
|
|
|
12
|
-
type Props = Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
12
|
+
type Props = Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref" | "onChange"> & {
|
|
13
13
|
controller: TextEditorController;
|
|
14
14
|
name?: string;
|
|
15
|
-
onChange?: (
|
|
15
|
+
onChange?: (value: string) => void;
|
|
16
16
|
};
|
|
17
17
|
declare function TextEditorInput({ controller, onChange, ...props }: Props): react_jsx_runtime.JSX.Element;
|
|
18
18
|
|
package/dist/input.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { DetailedHTMLProps, HTMLAttributes
|
|
2
|
+
import { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
3
3
|
import { TextEditorController } from './text_editor_controller.js';
|
|
4
4
|
import 'prosemirror-model';
|
|
5
5
|
import 'prosemirror-state';
|
|
@@ -9,10 +9,10 @@ import './schema.js';
|
|
|
9
9
|
import 'orderedmap';
|
|
10
10
|
import 'rxjs';
|
|
11
11
|
|
|
12
|
-
type Props = Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
12
|
+
type Props = Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref" | "onChange"> & {
|
|
13
13
|
controller: TextEditorController;
|
|
14
14
|
name?: string;
|
|
15
|
-
onChange?: (
|
|
15
|
+
onChange?: (value: string) => void;
|
|
16
16
|
};
|
|
17
17
|
declare function TextEditorInput({ controller, onChange, ...props }: Props): react_jsx_runtime.JSX.Element;
|
|
18
18
|
|
package/dist/input.js
CHANGED
|
@@ -33,11 +33,10 @@ function TextEditorInput({ controller, onChange, ...props }) {
|
|
|
33
33
|
(0, import_rxjs.filter)((tr) => tr.docChanged),
|
|
34
34
|
(0, import_rxjs.debounceTime)(controller.props.updateDelay || 0)
|
|
35
35
|
).subscribe(() => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
36
|
+
const input = inputRef.current;
|
|
37
|
+
if (!input) return;
|
|
38
|
+
input.value = controller.value;
|
|
39
|
+
onChange?.(controller.value);
|
|
41
40
|
});
|
|
42
41
|
return () => {
|
|
43
42
|
sub.unsubscribe();
|
|
@@ -49,7 +48,6 @@ function TextEditorInput({ controller, onChange, ...props }) {
|
|
|
49
48
|
...props,
|
|
50
49
|
ref: inputRef,
|
|
51
50
|
type: "hidden",
|
|
52
|
-
onInput: onChange,
|
|
53
51
|
defaultValue: controller.props.defaultValue
|
|
54
52
|
}
|
|
55
53
|
);
|
package/dist/input.mjs
CHANGED
|
@@ -12,11 +12,10 @@ function TextEditorInput({ controller, onChange, ...props }) {
|
|
|
12
12
|
filter((tr) => tr.docChanged),
|
|
13
13
|
debounceTime(controller.props.updateDelay || 0)
|
|
14
14
|
).subscribe(() => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
15
|
+
const input = inputRef.current;
|
|
16
|
+
if (!input) return;
|
|
17
|
+
input.value = controller.value;
|
|
18
|
+
onChange?.(controller.value);
|
|
20
19
|
});
|
|
21
20
|
return () => {
|
|
22
21
|
sub.unsubscribe();
|
|
@@ -28,7 +27,6 @@ function TextEditorInput({ controller, onChange, ...props }) {
|
|
|
28
27
|
...props,
|
|
29
28
|
ref: inputRef,
|
|
30
29
|
type: "hidden",
|
|
31
|
-
onInput: onChange,
|
|
32
30
|
defaultValue: controller.props.defaultValue
|
|
33
31
|
}
|
|
34
32
|
);
|
package/dist/text_editor.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { DetailedHTMLProps, InputHTMLAttributes, Ref } from 'react';
|
|
3
|
+
import { TextEditorInput } from './input.mjs';
|
|
3
4
|
import { TextEditorController, TextEditorControllerProps } from './text_editor_controller.mjs';
|
|
4
5
|
import 'prosemirror-model';
|
|
5
6
|
import 'prosemirror-state';
|
|
@@ -10,9 +11,10 @@ import 'orderedmap';
|
|
|
10
11
|
import 'rxjs';
|
|
11
12
|
|
|
12
13
|
type HTMLElementProps = DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
13
|
-
type TextEditorProps = Omit<HTMLElementProps, "ref"> & {
|
|
14
|
+
type TextEditorProps = Omit<HTMLElementProps, "ref" | "onChange"> & {
|
|
14
15
|
name?: string;
|
|
15
16
|
ref?: Ref<TextEditorController>;
|
|
17
|
+
onChange?: Parameters<typeof TextEditorInput>[0]["onChange"];
|
|
16
18
|
} & TextEditorControllerProps;
|
|
17
19
|
declare function TextEditor({ ref, name, className, autoFocus, onChange, mode, state, editor, defaultValue, updateDelay, placeholder, attachFile, style, ...props }?: TextEditorProps): react_jsx_runtime.JSX.Element;
|
|
18
20
|
|
package/dist/text_editor.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { DetailedHTMLProps, InputHTMLAttributes, Ref } from 'react';
|
|
3
|
+
import { TextEditorInput } from './input.js';
|
|
3
4
|
import { TextEditorController, TextEditorControllerProps } from './text_editor_controller.js';
|
|
4
5
|
import 'prosemirror-model';
|
|
5
6
|
import 'prosemirror-state';
|
|
@@ -10,9 +11,10 @@ import 'orderedmap';
|
|
|
10
11
|
import 'rxjs';
|
|
11
12
|
|
|
12
13
|
type HTMLElementProps = DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
13
|
-
type TextEditorProps = Omit<HTMLElementProps, "ref"> & {
|
|
14
|
+
type TextEditorProps = Omit<HTMLElementProps, "ref" | "onChange"> & {
|
|
14
15
|
name?: string;
|
|
15
16
|
ref?: Ref<TextEditorController>;
|
|
17
|
+
onChange?: Parameters<typeof TextEditorInput>[0]["onChange"];
|
|
16
18
|
} & TextEditorControllerProps;
|
|
17
19
|
declare function TextEditor({ ref, name, className, autoFocus, onChange, mode, state, editor, defaultValue, updateDelay, placeholder, attachFile, style, ...props }?: TextEditorProps): react_jsx_runtime.JSX.Element;
|
|
18
20
|
|
package/dist/text_editor.js
CHANGED
|
@@ -47,11 +47,10 @@ function TextEditorInput({ controller, onChange, ...props }) {
|
|
|
47
47
|
(0, import_rxjs.filter)((tr) => tr.docChanged),
|
|
48
48
|
(0, import_rxjs.debounceTime)(controller.props.updateDelay || 0)
|
|
49
49
|
).subscribe(() => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
50
|
+
const input = inputRef.current;
|
|
51
|
+
if (!input) return;
|
|
52
|
+
input.value = controller.value;
|
|
53
|
+
onChange?.(controller.value);
|
|
55
54
|
});
|
|
56
55
|
return () => {
|
|
57
56
|
sub.unsubscribe();
|
|
@@ -63,7 +62,6 @@ function TextEditorInput({ controller, onChange, ...props }) {
|
|
|
63
62
|
...props,
|
|
64
63
|
ref: inputRef,
|
|
65
64
|
type: "hidden",
|
|
66
|
-
onInput: onChange,
|
|
67
65
|
defaultValue: controller.props.defaultValue
|
|
68
66
|
}
|
|
69
67
|
);
|
|
@@ -1115,7 +1113,7 @@ function TextEditor({
|
|
|
1115
1113
|
[]
|
|
1116
1114
|
);
|
|
1117
1115
|
(0, import_react2.useImperativeHandle)(ref, () => controller, [controller]);
|
|
1118
|
-
(0,
|
|
1116
|
+
(0, import_react2.useLayoutEffect)(() => {
|
|
1119
1117
|
const container = containerRef.current;
|
|
1120
1118
|
if (!container) {
|
|
1121
1119
|
return;
|
package/dist/text_editor.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// src/text_editor.tsx
|
|
2
2
|
import {
|
|
3
3
|
useImperativeHandle,
|
|
4
|
+
useLayoutEffect,
|
|
4
5
|
useMemo
|
|
5
6
|
} from "react";
|
|
6
|
-
import {
|
|
7
|
+
import { useRef as useRef2 } from "react";
|
|
7
8
|
|
|
8
9
|
// src/input.tsx
|
|
9
10
|
import {
|
|
@@ -19,11 +20,10 @@ function TextEditorInput({ controller, onChange, ...props }) {
|
|
|
19
20
|
filter((tr) => tr.docChanged),
|
|
20
21
|
debounceTime(controller.props.updateDelay || 0)
|
|
21
22
|
).subscribe(() => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
23
|
+
const input = inputRef.current;
|
|
24
|
+
if (!input) return;
|
|
25
|
+
input.value = controller.value;
|
|
26
|
+
onChange?.(controller.value);
|
|
27
27
|
});
|
|
28
28
|
return () => {
|
|
29
29
|
sub.unsubscribe();
|
|
@@ -35,7 +35,6 @@ function TextEditorInput({ controller, onChange, ...props }) {
|
|
|
35
35
|
...props,
|
|
36
36
|
ref: inputRef,
|
|
37
37
|
type: "hidden",
|
|
38
|
-
onInput: onChange,
|
|
39
38
|
defaultValue: controller.props.defaultValue
|
|
40
39
|
}
|
|
41
40
|
);
|
|
@@ -1089,7 +1088,7 @@ function TextEditor({
|
|
|
1089
1088
|
[]
|
|
1090
1089
|
);
|
|
1091
1090
|
useImperativeHandle(ref, () => controller, [controller]);
|
|
1092
|
-
|
|
1091
|
+
useLayoutEffect(() => {
|
|
1093
1092
|
const container = containerRef.current;
|
|
1094
1093
|
if (!container) {
|
|
1095
1094
|
return;
|
package/package.json
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
"name": "dn-react-text-editor",
|
|
3
|
+
"version": "0.3.9",
|
|
4
|
+
"types": "./dist/index.d.ts",
|
|
5
|
+
"main": "./dist/index.mjs",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./prosemirror": {
|
|
15
|
+
"types": "./dist/prosemirror/index.d.ts",
|
|
16
|
+
"import": "./dist/prosemirror/index.mjs",
|
|
17
|
+
"require": "./dist/prosemirror/index.js"
|
|
18
|
+
}
|
|
13
19
|
},
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "NODE_OPTIONS='--max-old-space-size=16384' tsup",
|
|
22
|
+
"dev": "tsup --watch"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/dndnsoft/dn-react-text-editor.git"
|
|
27
|
+
},
|
|
28
|
+
"author": "",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/dndnsoft/dn-react-text-editor/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/dndnsoft/dn-react-text-editor#readme",
|
|
34
|
+
"description": "",
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/node": "^24.10.1",
|
|
37
|
+
"@types/react": "^19",
|
|
38
|
+
"@types/react-dom": "^19",
|
|
39
|
+
"tsup": "^8.5.1",
|
|
40
|
+
"typescript": "^5.7.3"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"react": "^19",
|
|
44
|
+
"react-dom": "^19"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"highlight.js": "^11.11.1",
|
|
48
|
+
"html-entities": "^2.6.0",
|
|
49
|
+
"prosemirror-commands": "^1.7.1",
|
|
50
|
+
"prosemirror-highlightjs": "^0.9.1",
|
|
51
|
+
"prosemirror-history": "^1.5.0",
|
|
52
|
+
"prosemirror-keymap": "^1.2.3",
|
|
53
|
+
"prosemirror-model": "^1.25.4",
|
|
54
|
+
"prosemirror-schema-list": "^1.5.1",
|
|
55
|
+
"prosemirror-state": "^1.4.4",
|
|
56
|
+
"prosemirror-view": "^1.41.3",
|
|
57
|
+
"rxjs": "^7.8.2"
|
|
18
58
|
}
|
|
19
|
-
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "NODE_OPTIONS='--max-old-space-size=16384' tsup",
|
|
22
|
-
"dev": "tsup --watch"
|
|
23
|
-
},
|
|
24
|
-
"repository": {
|
|
25
|
-
"type": "git",
|
|
26
|
-
"url": "git+https://github.com/dndnsoft/dn-react-text-editor.git"
|
|
27
|
-
},
|
|
28
|
-
"author": "",
|
|
29
|
-
"license": "MIT",
|
|
30
|
-
"bugs": {
|
|
31
|
-
"url": "https://github.com/dndnsoft/dn-react-text-editor/issues"
|
|
32
|
-
},
|
|
33
|
-
"homepage": "https://github.com/dndnsoft/dn-react-text-editor#readme",
|
|
34
|
-
"description": "",
|
|
35
|
-
"devDependencies": {
|
|
36
|
-
"@types/node": "^24.10.1",
|
|
37
|
-
"@types/react": "^19",
|
|
38
|
-
"@types/react-dom": "^19",
|
|
39
|
-
"tsup": "^8.5.1",
|
|
40
|
-
"typescript": "^5.7.3"
|
|
41
|
-
},
|
|
42
|
-
"peerDependencies": {
|
|
43
|
-
"react": "^19",
|
|
44
|
-
"react-dom": "^19"
|
|
45
|
-
},
|
|
46
|
-
"dependencies": {
|
|
47
|
-
"highlight.js": "^11.11.1",
|
|
48
|
-
"html-entities": "^2.6.0",
|
|
49
|
-
"prosemirror-commands": "^1.7.1",
|
|
50
|
-
"prosemirror-highlightjs": "^0.9.1",
|
|
51
|
-
"prosemirror-history": "^1.5.0",
|
|
52
|
-
"prosemirror-keymap": "^1.2.3",
|
|
53
|
-
"prosemirror-model": "^1.25.4",
|
|
54
|
-
"prosemirror-schema-list": "^1.5.1",
|
|
55
|
-
"prosemirror-state": "^1.4.4",
|
|
56
|
-
"prosemirror-view": "^1.41.3",
|
|
57
|
-
"rxjs": "^7.8.2"
|
|
58
|
-
}
|
|
59
|
-
}
|
|
59
|
+
}
|