dn-react-text-editor 0.3.6 → 0.3.7
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/html.d.mts +3 -2
- package/dist/html.d.ts +3 -2
- package/dist/html.js +2 -2
- package/dist/html.mjs +2 -2
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +19 -14
- package/dist/index.mjs +23 -17
- package/dist/input.d.mts +4 -3
- package/dist/input.d.ts +4 -3
- package/dist/input.js +4 -13
- package/dist/input.mjs +6 -4
- package/dist/text_editor.d.mts +3 -2
- package/dist/text_editor.d.ts +3 -2
- package/dist/text_editor.js +17 -12
- package/dist/text_editor.mjs +21 -15
- package/package.json +1 -1
package/dist/html.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
2
3
|
|
|
3
4
|
declare function createInnerHTML(raw: string): string;
|
|
4
5
|
declare function createTextEditorView(options?: {
|
|
5
6
|
className?: string;
|
|
6
|
-
}): ({ className, dangerouslySetInnerHTML, ...props }: DetailedHTMLProps<
|
|
7
|
+
}): ({ className, dangerouslySetInnerHTML, ...props }: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>) => react_jsx_runtime.JSX.Element;
|
|
7
8
|
|
|
8
9
|
export { createInnerHTML, createTextEditorView };
|
package/dist/html.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
2
3
|
|
|
3
4
|
declare function createInnerHTML(raw: string): string;
|
|
4
5
|
declare function createTextEditorView(options?: {
|
|
5
6
|
className?: string;
|
|
6
|
-
}): ({ className, dangerouslySetInnerHTML, ...props }: DetailedHTMLProps<
|
|
7
|
+
}): ({ className, dangerouslySetInnerHTML, ...props }: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>) => react_jsx_runtime.JSX.Element;
|
|
7
8
|
|
|
8
9
|
export { createInnerHTML, createTextEditorView };
|
package/dist/html.js
CHANGED
|
@@ -88,7 +88,7 @@ function cn(...classes) {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
// src/html.tsx
|
|
91
|
-
var
|
|
91
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
92
92
|
function createInnerHTML(raw) {
|
|
93
93
|
return raw.replace(/<\/p>/g, "<br></p>").replace(/(<p><br><\/p>)+$/g, "").replace(
|
|
94
94
|
/<code class="language-(\w+)">([\s\S]*?)<\/code>/g,
|
|
@@ -116,7 +116,7 @@ function createTextEditorView(options = {}) {
|
|
|
116
116
|
dangerouslySetInnerHTML,
|
|
117
117
|
...props
|
|
118
118
|
}) {
|
|
119
|
-
return /* @__PURE__ */
|
|
119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
120
120
|
"div",
|
|
121
121
|
{
|
|
122
122
|
...props,
|
package/dist/html.mjs
CHANGED
|
@@ -51,7 +51,7 @@ function cn(...classes) {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
// src/html.tsx
|
|
54
|
-
import
|
|
54
|
+
import { jsx } from "react/jsx-runtime";
|
|
55
55
|
function createInnerHTML(raw) {
|
|
56
56
|
return raw.replace(/<\/p>/g, "<br></p>").replace(/(<p><br><\/p>)+$/g, "").replace(
|
|
57
57
|
/<code class="language-(\w+)">([\s\S]*?)<\/code>/g,
|
|
@@ -79,7 +79,7 @@ function createTextEditorView(options = {}) {
|
|
|
79
79
|
dangerouslySetInnerHTML,
|
|
80
80
|
...props
|
|
81
81
|
}) {
|
|
82
|
-
return /* @__PURE__ */
|
|
82
|
+
return /* @__PURE__ */ jsx(
|
|
83
83
|
"div",
|
|
84
84
|
{
|
|
85
85
|
...props,
|
package/dist/index.d.mts
CHANGED
|
@@ -3,6 +3,7 @@ export { createSchema } from './schema.mjs';
|
|
|
3
3
|
export { AttachFile, AttachFileOptions, GenerateMetadata, UploadFile, createAttachFile } from './attach_file.mjs';
|
|
4
4
|
export { createInnerHTML, createTextEditorView } from './html.mjs';
|
|
5
5
|
export { ConfigTextEditorOptions, TextEditorController, TextEditorControllerProps, configTextEditorController } from './text_editor_controller.mjs';
|
|
6
|
+
import 'react/jsx-runtime';
|
|
6
7
|
import 'react';
|
|
7
8
|
import 'orderedmap';
|
|
8
9
|
import 'prosemirror-model';
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { createSchema } from './schema.js';
|
|
|
3
3
|
export { AttachFile, AttachFileOptions, GenerateMetadata, UploadFile, createAttachFile } from './attach_file.js';
|
|
4
4
|
export { createInnerHTML, createTextEditorView } from './html.js';
|
|
5
5
|
export { ConfigTextEditorOptions, TextEditorController, TextEditorControllerProps, configTextEditorController } from './text_editor_controller.js';
|
|
6
|
+
import 'react/jsx-runtime';
|
|
6
7
|
import 'react';
|
|
7
8
|
import 'orderedmap';
|
|
8
9
|
import 'prosemirror-model';
|
package/dist/index.js
CHANGED
|
@@ -41,14 +41,15 @@ __export(index_exports, {
|
|
|
41
41
|
module.exports = __toCommonJS(index_exports);
|
|
42
42
|
|
|
43
43
|
// src/text_editor.tsx
|
|
44
|
-
var import_react2 =
|
|
44
|
+
var import_react2 = require("react");
|
|
45
45
|
var import_react3 = require("react");
|
|
46
46
|
|
|
47
47
|
// src/input.tsx
|
|
48
|
-
var import_react =
|
|
48
|
+
var import_react = require("react");
|
|
49
49
|
var import_rxjs = require("rxjs");
|
|
50
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
50
51
|
function TextEditorInput({ controller, onChange, ...props }) {
|
|
51
|
-
const inputRef = import_react.
|
|
52
|
+
const inputRef = (0, import_react.useRef)(null);
|
|
52
53
|
(0, import_react.useEffect)(() => {
|
|
53
54
|
const sub = controller.subject.pipe(
|
|
54
55
|
(0, import_rxjs.filter)((tr) => tr.docChanged),
|
|
@@ -64,7 +65,7 @@ function TextEditorInput({ controller, onChange, ...props }) {
|
|
|
64
65
|
sub.unsubscribe();
|
|
65
66
|
};
|
|
66
67
|
}, []);
|
|
67
|
-
return /* @__PURE__ */
|
|
68
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
68
69
|
"input",
|
|
69
70
|
{
|
|
70
71
|
...props,
|
|
@@ -1097,6 +1098,7 @@ var configTextEditorController = (options = {}) => {
|
|
|
1097
1098
|
};
|
|
1098
1099
|
|
|
1099
1100
|
// src/text_editor.tsx
|
|
1101
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
1100
1102
|
function TextEditor({
|
|
1101
1103
|
ref,
|
|
1102
1104
|
name,
|
|
@@ -1139,19 +1141,22 @@ function TextEditor({
|
|
|
1139
1141
|
controller.dispose();
|
|
1140
1142
|
};
|
|
1141
1143
|
}, [controller]);
|
|
1142
|
-
return /* @__PURE__ */
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
1145
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ...props, ref: containerRef, className }),
|
|
1146
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1147
|
+
TextEditorInput,
|
|
1148
|
+
{
|
|
1149
|
+
name,
|
|
1150
|
+
controller,
|
|
1151
|
+
onChange
|
|
1152
|
+
}
|
|
1153
|
+
)
|
|
1154
|
+
] });
|
|
1150
1155
|
}
|
|
1151
1156
|
|
|
1152
1157
|
// src/html.tsx
|
|
1153
1158
|
var import_html_entities = require("html-entities");
|
|
1154
|
-
var
|
|
1159
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1155
1160
|
function createInnerHTML(raw) {
|
|
1156
1161
|
return raw.replace(/<\/p>/g, "<br></p>").replace(/(<p><br><\/p>)+$/g, "").replace(
|
|
1157
1162
|
/<code class="language-(\w+)">([\s\S]*?)<\/code>/g,
|
|
@@ -1179,7 +1184,7 @@ function createTextEditorView(options = {}) {
|
|
|
1179
1184
|
dangerouslySetInnerHTML,
|
|
1180
1185
|
...props
|
|
1181
1186
|
}) {
|
|
1182
|
-
return /* @__PURE__ */
|
|
1187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1183
1188
|
"div",
|
|
1184
1189
|
{
|
|
1185
1190
|
...props,
|
package/dist/index.mjs
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
// src/text_editor.tsx
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
3
|
useImperativeHandle,
|
|
4
4
|
useMemo
|
|
5
5
|
} from "react";
|
|
6
|
-
import { useEffect as useEffect2, useRef } from "react";
|
|
6
|
+
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
7
7
|
|
|
8
8
|
// src/input.tsx
|
|
9
|
-
import
|
|
10
|
-
useEffect
|
|
9
|
+
import {
|
|
10
|
+
useEffect,
|
|
11
|
+
useRef
|
|
11
12
|
} from "react";
|
|
12
13
|
import { debounceTime, filter } from "rxjs";
|
|
14
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
15
|
function TextEditorInput({ controller, onChange, ...props }) {
|
|
14
|
-
const inputRef =
|
|
16
|
+
const inputRef = useRef(null);
|
|
15
17
|
useEffect(() => {
|
|
16
18
|
const sub = controller.subject.pipe(
|
|
17
19
|
filter((tr) => tr.docChanged),
|
|
@@ -27,7 +29,7 @@ function TextEditorInput({ controller, onChange, ...props }) {
|
|
|
27
29
|
sub.unsubscribe();
|
|
28
30
|
};
|
|
29
31
|
}, []);
|
|
30
|
-
return /* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
31
33
|
"input",
|
|
32
34
|
{
|
|
33
35
|
...props,
|
|
@@ -1062,6 +1064,7 @@ var configTextEditorController = (options = {}) => {
|
|
|
1062
1064
|
};
|
|
1063
1065
|
|
|
1064
1066
|
// src/text_editor.tsx
|
|
1067
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
1065
1068
|
function TextEditor({
|
|
1066
1069
|
ref,
|
|
1067
1070
|
name,
|
|
@@ -1078,7 +1081,7 @@ function TextEditor({
|
|
|
1078
1081
|
style,
|
|
1079
1082
|
...props
|
|
1080
1083
|
} = {}) {
|
|
1081
|
-
const containerRef =
|
|
1084
|
+
const containerRef = useRef2(null);
|
|
1082
1085
|
const controller = useMemo(
|
|
1083
1086
|
() => new TextEditorController({
|
|
1084
1087
|
mode,
|
|
@@ -1104,19 +1107,22 @@ function TextEditor({
|
|
|
1104
1107
|
controller.dispose();
|
|
1105
1108
|
};
|
|
1106
1109
|
}, [controller]);
|
|
1107
|
-
return /* @__PURE__ */
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1110
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1111
|
+
/* @__PURE__ */ jsx2("div", { ...props, ref: containerRef, className }),
|
|
1112
|
+
/* @__PURE__ */ jsx2(
|
|
1113
|
+
TextEditorInput,
|
|
1114
|
+
{
|
|
1115
|
+
name,
|
|
1116
|
+
controller,
|
|
1117
|
+
onChange
|
|
1118
|
+
}
|
|
1119
|
+
)
|
|
1120
|
+
] });
|
|
1115
1121
|
}
|
|
1116
1122
|
|
|
1117
1123
|
// src/html.tsx
|
|
1118
1124
|
import { decode } from "html-entities";
|
|
1119
|
-
import
|
|
1125
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
1120
1126
|
function createInnerHTML(raw) {
|
|
1121
1127
|
return raw.replace(/<\/p>/g, "<br></p>").replace(/(<p><br><\/p>)+$/g, "").replace(
|
|
1122
1128
|
/<code class="language-(\w+)">([\s\S]*?)<\/code>/g,
|
|
@@ -1144,7 +1150,7 @@ function createTextEditorView(options = {}) {
|
|
|
1144
1150
|
dangerouslySetInnerHTML,
|
|
1145
1151
|
...props
|
|
1146
1152
|
}) {
|
|
1147
|
-
return /* @__PURE__ */
|
|
1153
|
+
return /* @__PURE__ */ jsx3(
|
|
1148
1154
|
"div",
|
|
1149
1155
|
{
|
|
1150
1156
|
...props,
|
package/dist/input.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { DetailedHTMLProps, HTMLAttributes, ChangeEvent } from 'react';
|
|
2
3
|
import { TextEditorController } from './text_editor_controller.mjs';
|
|
3
4
|
import 'prosemirror-model';
|
|
4
5
|
import 'prosemirror-state';
|
|
@@ -11,8 +12,8 @@ import 'rxjs';
|
|
|
11
12
|
type Props = Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
12
13
|
controller: TextEditorController;
|
|
13
14
|
name?: string;
|
|
14
|
-
onChange?: (e:
|
|
15
|
+
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
15
16
|
};
|
|
16
|
-
declare function TextEditorInput({ controller, onChange, ...props }: Props):
|
|
17
|
+
declare function TextEditorInput({ controller, onChange, ...props }: Props): react_jsx_runtime.JSX.Element;
|
|
17
18
|
|
|
18
19
|
export { TextEditorInput };
|
package/dist/input.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { DetailedHTMLProps, HTMLAttributes, ChangeEvent } from 'react';
|
|
2
3
|
import { TextEditorController } from './text_editor_controller.js';
|
|
3
4
|
import 'prosemirror-model';
|
|
4
5
|
import 'prosemirror-state';
|
|
@@ -11,8 +12,8 @@ import 'rxjs';
|
|
|
11
12
|
type Props = Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
12
13
|
controller: TextEditorController;
|
|
13
14
|
name?: string;
|
|
14
|
-
onChange?: (e:
|
|
15
|
+
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
15
16
|
};
|
|
16
|
-
declare function TextEditorInput({ controller, onChange, ...props }: Props):
|
|
17
|
+
declare function TextEditorInput({ controller, onChange, ...props }: Props): react_jsx_runtime.JSX.Element;
|
|
17
18
|
|
|
18
19
|
export { TextEditorInput };
|
package/dist/input.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/input.tsx
|
|
@@ -33,10 +23,11 @@ __export(input_exports, {
|
|
|
33
23
|
TextEditorInput: () => TextEditorInput
|
|
34
24
|
});
|
|
35
25
|
module.exports = __toCommonJS(input_exports);
|
|
36
|
-
var import_react =
|
|
26
|
+
var import_react = require("react");
|
|
37
27
|
var import_rxjs = require("rxjs");
|
|
28
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
29
|
function TextEditorInput({ controller, onChange, ...props }) {
|
|
39
|
-
const inputRef = import_react.
|
|
30
|
+
const inputRef = (0, import_react.useRef)(null);
|
|
40
31
|
(0, import_react.useEffect)(() => {
|
|
41
32
|
const sub = controller.subject.pipe(
|
|
42
33
|
(0, import_rxjs.filter)((tr) => tr.docChanged),
|
|
@@ -52,7 +43,7 @@ function TextEditorInput({ controller, onChange, ...props }) {
|
|
|
52
43
|
sub.unsubscribe();
|
|
53
44
|
};
|
|
54
45
|
}, []);
|
|
55
|
-
return /* @__PURE__ */
|
|
46
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
56
47
|
"input",
|
|
57
48
|
{
|
|
58
49
|
...props,
|
package/dist/input.mjs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// src/input.tsx
|
|
2
|
-
import
|
|
3
|
-
useEffect
|
|
2
|
+
import {
|
|
3
|
+
useEffect,
|
|
4
|
+
useRef
|
|
4
5
|
} from "react";
|
|
5
6
|
import { debounceTime, filter } from "rxjs";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
8
|
function TextEditorInput({ controller, onChange, ...props }) {
|
|
7
|
-
const inputRef =
|
|
9
|
+
const inputRef = useRef(null);
|
|
8
10
|
useEffect(() => {
|
|
9
11
|
const sub = controller.subject.pipe(
|
|
10
12
|
filter((tr) => tr.docChanged),
|
|
@@ -20,7 +22,7 @@ function TextEditorInput({ controller, onChange, ...props }) {
|
|
|
20
22
|
sub.unsubscribe();
|
|
21
23
|
};
|
|
22
24
|
}, []);
|
|
23
|
-
return /* @__PURE__ */
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
24
26
|
"input",
|
|
25
27
|
{
|
|
26
28
|
...props,
|
package/dist/text_editor.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { DetailedHTMLProps, InputHTMLAttributes, Ref } from 'react';
|
|
2
3
|
import { TextEditorController, TextEditorControllerProps } from './text_editor_controller.mjs';
|
|
3
4
|
import 'prosemirror-model';
|
|
4
5
|
import 'prosemirror-state';
|
|
@@ -13,6 +14,6 @@ type TextEditorProps = Omit<HTMLElementProps, "ref"> & {
|
|
|
13
14
|
name?: string;
|
|
14
15
|
ref?: Ref<TextEditorController>;
|
|
15
16
|
} & TextEditorControllerProps;
|
|
16
|
-
declare function TextEditor({ ref, name, className, autoFocus, onChange, mode, state, editor, defaultValue, updateDelay, placeholder, attachFile, style, ...props }?: TextEditorProps):
|
|
17
|
+
declare function TextEditor({ ref, name, className, autoFocus, onChange, mode, state, editor, defaultValue, updateDelay, placeholder, attachFile, style, ...props }?: TextEditorProps): react_jsx_runtime.JSX.Element;
|
|
17
18
|
|
|
18
19
|
export { TextEditor, type TextEditorProps };
|
package/dist/text_editor.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { DetailedHTMLProps, InputHTMLAttributes, Ref } from 'react';
|
|
2
3
|
import { TextEditorController, TextEditorControllerProps } from './text_editor_controller.js';
|
|
3
4
|
import 'prosemirror-model';
|
|
4
5
|
import 'prosemirror-state';
|
|
@@ -13,6 +14,6 @@ type TextEditorProps = Omit<HTMLElementProps, "ref"> & {
|
|
|
13
14
|
name?: string;
|
|
14
15
|
ref?: Ref<TextEditorController>;
|
|
15
16
|
} & TextEditorControllerProps;
|
|
16
|
-
declare function TextEditor({ ref, name, className, autoFocus, onChange, mode, state, editor, defaultValue, updateDelay, placeholder, attachFile, style, ...props }?: TextEditorProps):
|
|
17
|
+
declare function TextEditor({ ref, name, className, autoFocus, onChange, mode, state, editor, defaultValue, updateDelay, placeholder, attachFile, style, ...props }?: TextEditorProps): react_jsx_runtime.JSX.Element;
|
|
17
18
|
|
|
18
19
|
export { TextEditor, type TextEditorProps };
|
package/dist/text_editor.js
CHANGED
|
@@ -33,14 +33,15 @@ __export(text_editor_exports, {
|
|
|
33
33
|
TextEditor: () => TextEditor
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(text_editor_exports);
|
|
36
|
-
var import_react2 =
|
|
36
|
+
var import_react2 = require("react");
|
|
37
37
|
var import_react3 = require("react");
|
|
38
38
|
|
|
39
39
|
// src/input.tsx
|
|
40
|
-
var import_react =
|
|
40
|
+
var import_react = require("react");
|
|
41
41
|
var import_rxjs = require("rxjs");
|
|
42
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
43
|
function TextEditorInput({ controller, onChange, ...props }) {
|
|
43
|
-
const inputRef = import_react.
|
|
44
|
+
const inputRef = (0, import_react.useRef)(null);
|
|
44
45
|
(0, import_react.useEffect)(() => {
|
|
45
46
|
const sub = controller.subject.pipe(
|
|
46
47
|
(0, import_rxjs.filter)((tr) => tr.docChanged),
|
|
@@ -56,7 +57,7 @@ function TextEditorInput({ controller, onChange, ...props }) {
|
|
|
56
57
|
sub.unsubscribe();
|
|
57
58
|
};
|
|
58
59
|
}, []);
|
|
59
|
-
return /* @__PURE__ */
|
|
60
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
61
|
"input",
|
|
61
62
|
{
|
|
62
63
|
...props,
|
|
@@ -1081,6 +1082,7 @@ var TextEditorController = class {
|
|
|
1081
1082
|
};
|
|
1082
1083
|
|
|
1083
1084
|
// src/text_editor.tsx
|
|
1085
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
1084
1086
|
function TextEditor({
|
|
1085
1087
|
ref,
|
|
1086
1088
|
name,
|
|
@@ -1123,14 +1125,17 @@ function TextEditor({
|
|
|
1123
1125
|
controller.dispose();
|
|
1124
1126
|
};
|
|
1125
1127
|
}, [controller]);
|
|
1126
|
-
return /* @__PURE__ */
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
1129
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ...props, ref: containerRef, className }),
|
|
1130
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1131
|
+
TextEditorInput,
|
|
1132
|
+
{
|
|
1133
|
+
name,
|
|
1134
|
+
controller,
|
|
1135
|
+
onChange
|
|
1136
|
+
}
|
|
1137
|
+
)
|
|
1138
|
+
] });
|
|
1134
1139
|
}
|
|
1135
1140
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1136
1141
|
0 && (module.exports = {
|
package/dist/text_editor.mjs
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
// src/text_editor.tsx
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
3
|
useImperativeHandle,
|
|
4
4
|
useMemo
|
|
5
5
|
} from "react";
|
|
6
|
-
import { useEffect as useEffect2, useRef } from "react";
|
|
6
|
+
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
7
7
|
|
|
8
8
|
// src/input.tsx
|
|
9
|
-
import
|
|
10
|
-
useEffect
|
|
9
|
+
import {
|
|
10
|
+
useEffect,
|
|
11
|
+
useRef
|
|
11
12
|
} from "react";
|
|
12
13
|
import { debounceTime, filter } from "rxjs";
|
|
14
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
15
|
function TextEditorInput({ controller, onChange, ...props }) {
|
|
14
|
-
const inputRef =
|
|
16
|
+
const inputRef = useRef(null);
|
|
15
17
|
useEffect(() => {
|
|
16
18
|
const sub = controller.subject.pipe(
|
|
17
19
|
filter((tr) => tr.docChanged),
|
|
@@ -27,7 +29,7 @@ function TextEditorInput({ controller, onChange, ...props }) {
|
|
|
27
29
|
sub.unsubscribe();
|
|
28
30
|
};
|
|
29
31
|
}, []);
|
|
30
|
-
return /* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
31
33
|
"input",
|
|
32
34
|
{
|
|
33
35
|
...props,
|
|
@@ -1054,6 +1056,7 @@ var TextEditorController = class {
|
|
|
1054
1056
|
};
|
|
1055
1057
|
|
|
1056
1058
|
// src/text_editor.tsx
|
|
1059
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
1057
1060
|
function TextEditor({
|
|
1058
1061
|
ref,
|
|
1059
1062
|
name,
|
|
@@ -1070,7 +1073,7 @@ function TextEditor({
|
|
|
1070
1073
|
style,
|
|
1071
1074
|
...props
|
|
1072
1075
|
} = {}) {
|
|
1073
|
-
const containerRef =
|
|
1076
|
+
const containerRef = useRef2(null);
|
|
1074
1077
|
const controller = useMemo(
|
|
1075
1078
|
() => new TextEditorController({
|
|
1076
1079
|
mode,
|
|
@@ -1096,14 +1099,17 @@ function TextEditor({
|
|
|
1096
1099
|
controller.dispose();
|
|
1097
1100
|
};
|
|
1098
1101
|
}, [controller]);
|
|
1099
|
-
return /* @__PURE__ */
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1102
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1103
|
+
/* @__PURE__ */ jsx2("div", { ...props, ref: containerRef, className }),
|
|
1104
|
+
/* @__PURE__ */ jsx2(
|
|
1105
|
+
TextEditorInput,
|
|
1106
|
+
{
|
|
1107
|
+
name,
|
|
1108
|
+
controller,
|
|
1109
|
+
onChange
|
|
1110
|
+
}
|
|
1111
|
+
)
|
|
1112
|
+
] });
|
|
1107
1113
|
}
|
|
1108
1114
|
export {
|
|
1109
1115
|
TextEditor
|