dn-react-text-editor 0.1.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.
Files changed (48) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +222 -0
  3. package/dist/attach_file.d.mts +28 -0
  4. package/dist/attach_file.d.ts +28 -0
  5. package/dist/attach_file.js +169 -0
  6. package/dist/attach_file.mjs +144 -0
  7. package/dist/cn.d.mts +3 -0
  8. package/dist/cn.d.ts +3 -0
  9. package/dist/cn.js +32 -0
  10. package/dist/cn.mjs +7 -0
  11. package/dist/index.d.mts +9 -0
  12. package/dist/index.d.ts +9 -0
  13. package/dist/index.js +735 -0
  14. package/dist/index.mjs +698 -0
  15. package/dist/plugins/drag_and_drop.d.mts +12 -0
  16. package/dist/plugins/drag_and_drop.d.ts +12 -0
  17. package/dist/plugins/drag_and_drop.js +57 -0
  18. package/dist/plugins/drag_and_drop.mjs +32 -0
  19. package/dist/plugins/keymap.d.mts +6 -0
  20. package/dist/plugins/keymap.d.ts +6 -0
  21. package/dist/plugins/keymap.js +59 -0
  22. package/dist/plugins/keymap.mjs +34 -0
  23. package/dist/plugins/placehoder.d.mts +5 -0
  24. package/dist/plugins/placehoder.d.ts +5 -0
  25. package/dist/plugins/placehoder.js +114 -0
  26. package/dist/plugins/placehoder.mjs +89 -0
  27. package/dist/plugins/trailing_paragraph.d.mts +5 -0
  28. package/dist/plugins/trailing_paragraph.d.ts +5 -0
  29. package/dist/plugins/trailing_paragraph.js +46 -0
  30. package/dist/plugins/trailing_paragraph.mjs +21 -0
  31. package/dist/plugins/upload_placeholder.d.mts +7 -0
  32. package/dist/plugins/upload_placeholder.d.ts +7 -0
  33. package/dist/plugins/upload_placeholder.js +94 -0
  34. package/dist/plugins/upload_placeholder.mjs +68 -0
  35. package/dist/prosemirror/index.d.mts +7 -0
  36. package/dist/prosemirror/index.d.ts +7 -0
  37. package/dist/prosemirror/index.js +36 -0
  38. package/dist/prosemirror/index.mjs +8 -0
  39. package/dist/schema.d.mts +7 -0
  40. package/dist/schema.d.ts +7 -0
  41. package/dist/schema.js +286 -0
  42. package/dist/schema.mjs +261 -0
  43. package/dist/text_editor.d.mts +36 -0
  44. package/dist/text_editor.d.ts +36 -0
  45. package/dist/text_editor.js +729 -0
  46. package/dist/text_editor.mjs +696 -0
  47. package/package.json +56 -0
  48. package/tsup.config.ts +10 -0
@@ -0,0 +1,7 @@
1
+ export * from 'prosemirror-view';
2
+ export * from 'prosemirror-state';
3
+ export * from 'prosemirror-model';
4
+ export * from 'prosemirror-keymap';
5
+ export * from 'prosemirror-schema-list';
6
+ export * from 'prosemirror-commands';
7
+ export * from 'prosemirror-history';
@@ -0,0 +1,7 @@
1
+ export * from 'prosemirror-view';
2
+ export * from 'prosemirror-state';
3
+ export * from 'prosemirror-model';
4
+ export * from 'prosemirror-keymap';
5
+ export * from 'prosemirror-schema-list';
6
+ export * from 'prosemirror-commands';
7
+ export * from 'prosemirror-history';
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+
17
+ // src/prosemirror/index.ts
18
+ var prosemirror_exports = {};
19
+ module.exports = __toCommonJS(prosemirror_exports);
20
+ __reExport(prosemirror_exports, require("prosemirror-view"), module.exports);
21
+ __reExport(prosemirror_exports, require("prosemirror-state"), module.exports);
22
+ __reExport(prosemirror_exports, require("prosemirror-model"), module.exports);
23
+ __reExport(prosemirror_exports, require("prosemirror-keymap"), module.exports);
24
+ __reExport(prosemirror_exports, require("prosemirror-schema-list"), module.exports);
25
+ __reExport(prosemirror_exports, require("prosemirror-commands"), module.exports);
26
+ __reExport(prosemirror_exports, require("prosemirror-history"), module.exports);
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ ...require("prosemirror-view"),
30
+ ...require("prosemirror-state"),
31
+ ...require("prosemirror-model"),
32
+ ...require("prosemirror-keymap"),
33
+ ...require("prosemirror-schema-list"),
34
+ ...require("prosemirror-commands"),
35
+ ...require("prosemirror-history")
36
+ });
@@ -0,0 +1,8 @@
1
+ // src/prosemirror/index.ts
2
+ export * from "prosemirror-view";
3
+ export * from "prosemirror-state";
4
+ export * from "prosemirror-model";
5
+ export * from "prosemirror-keymap";
6
+ export * from "prosemirror-schema-list";
7
+ export * from "prosemirror-commands";
8
+ export * from "prosemirror-history";
@@ -0,0 +1,7 @@
1
+ import * as orderedmap from 'orderedmap';
2
+ import * as prosemirror_model from 'prosemirror-model';
3
+ import { Schema } from 'prosemirror-model';
4
+
5
+ declare function createSchema(): Schema<keyof orderedmap.default<prosemirror_model.NodeSpec>, keyof orderedmap.default<prosemirror_model.MarkSpec>>;
6
+
7
+ export { createSchema };
@@ -0,0 +1,7 @@
1
+ import * as orderedmap from 'orderedmap';
2
+ import * as prosemirror_model from 'prosemirror-model';
3
+ import { Schema } from 'prosemirror-model';
4
+
5
+ declare function createSchema(): Schema<keyof orderedmap.default<prosemirror_model.NodeSpec>, keyof orderedmap.default<prosemirror_model.MarkSpec>>;
6
+
7
+ export { createSchema };
package/dist/schema.js ADDED
@@ -0,0 +1,286 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/schema.tsx
21
+ var schema_exports = {};
22
+ __export(schema_exports, {
23
+ createSchema: () => createSchema
24
+ });
25
+ module.exports = __toCommonJS(schema_exports);
26
+ var import_prosemirror_model = require("prosemirror-model");
27
+ var import_prosemirror_schema_list = require("prosemirror-schema-list");
28
+ function createSchema() {
29
+ const customSchema = new import_prosemirror_model.Schema({
30
+ nodes: {
31
+ doc: { content: "block+" },
32
+ paragraph: {
33
+ attrs: { align: { default: null } },
34
+ content: "inline*",
35
+ group: "block",
36
+ parseDOM: [
37
+ {
38
+ tag: "p",
39
+ getAttrs(dom) {
40
+ return {
41
+ align: dom.style.textAlign || null
42
+ };
43
+ }
44
+ }
45
+ ],
46
+ toDOM(node) {
47
+ return [
48
+ "p",
49
+ {
50
+ style: node.attrs.align ? `text-align: ${node.attrs.align}` : null
51
+ },
52
+ 0
53
+ ];
54
+ }
55
+ },
56
+ text: {
57
+ group: "inline"
58
+ },
59
+ hard_break: {
60
+ inline: true,
61
+ group: "inline",
62
+ selectable: false,
63
+ parseDOM: [{ tag: "br" }],
64
+ toDOM() {
65
+ return ["br"];
66
+ }
67
+ },
68
+ heading: {
69
+ attrs: { level: { default: 1 }, align: { default: null } },
70
+ content: "inline*",
71
+ group: "block",
72
+ defining: true,
73
+ parseDOM: [
74
+ {
75
+ tag: "h1",
76
+ getAttrs(node) {
77
+ return {
78
+ level: 1,
79
+ algin: node.style.textAlign || null
80
+ };
81
+ }
82
+ },
83
+ {
84
+ tag: "h2",
85
+ getAttrs(node) {
86
+ return {
87
+ level: 2,
88
+ algin: node.style.textAlign || null
89
+ };
90
+ }
91
+ },
92
+ {
93
+ tag: "h3",
94
+ getAttrs(node) {
95
+ return {
96
+ level: 3,
97
+ algin: node.style.textAlign || null
98
+ };
99
+ }
100
+ },
101
+ {
102
+ tag: "h4",
103
+ getAttrs(node) {
104
+ return {
105
+ level: 4,
106
+ algin: node.style.textAlign || null
107
+ };
108
+ }
109
+ },
110
+ {
111
+ tag: "h5",
112
+ getAttrs(node) {
113
+ return {
114
+ level: 5,
115
+ algin: node.style.textAlign || null
116
+ };
117
+ }
118
+ },
119
+ {
120
+ tag: "h6",
121
+ getAttrs(node) {
122
+ return {
123
+ level: 6,
124
+ algin: node.style.textAlign || null
125
+ };
126
+ }
127
+ }
128
+ ],
129
+ toDOM(node) {
130
+ return [
131
+ "h" + node.attrs.level,
132
+ {
133
+ id: node.textContent.toLowerCase().replace(/\s+/g, "-"),
134
+ style: node.attrs.align ? `text-align: ${node.attrs.align};` : null
135
+ },
136
+ 0
137
+ ];
138
+ }
139
+ },
140
+ horizontal_rule: {
141
+ group: "block",
142
+ parseDOM: [{ tag: "hr" }],
143
+ toDOM() {
144
+ return ["hr"];
145
+ }
146
+ },
147
+ image: {
148
+ attrs: {
149
+ src: { validate: "string" },
150
+ alt: { default: null, validate: "string|null" },
151
+ title: {
152
+ default: null,
153
+ validate: "string|null"
154
+ },
155
+ width: {
156
+ default: null,
157
+ validate: "number|null"
158
+ },
159
+ height: {
160
+ default: null,
161
+ validate: "number|null"
162
+ }
163
+ },
164
+ inline: false,
165
+ group: "block",
166
+ draggable: true,
167
+ parseDOM: [
168
+ {
169
+ tag: "img",
170
+ getAttrs(dom) {
171
+ return {
172
+ src: dom.getAttribute("src"),
173
+ alt: dom.getAttribute("alt"),
174
+ width: dom.getAttribute("width"),
175
+ height: dom.getAttribute("height")
176
+ };
177
+ }
178
+ }
179
+ ],
180
+ toDOM(node) {
181
+ const { src, alt, srcSet, sizes, width, height } = node.attrs;
182
+ return [
183
+ "img",
184
+ {
185
+ src,
186
+ alt,
187
+ srcSet,
188
+ sizes,
189
+ width,
190
+ height
191
+ }
192
+ ];
193
+ }
194
+ }
195
+ },
196
+ marks: {
197
+ link: {
198
+ attrs: {
199
+ href: { default: "" },
200
+ title: { default: null }
201
+ },
202
+ inclusive: false,
203
+ parseDOM: [
204
+ {
205
+ tag: "a[href]",
206
+ getAttrs(dom) {
207
+ return {
208
+ href: dom.getAttribute("href"),
209
+ title: dom.getAttribute("title")
210
+ };
211
+ }
212
+ }
213
+ ],
214
+ toDOM(node) {
215
+ const { href, title } = node.attrs;
216
+ const target = "_blank";
217
+ const rel = "noopener noreferrer";
218
+ return [
219
+ "a",
220
+ { href, title: title || href, target, rel },
221
+ 0
222
+ ];
223
+ }
224
+ },
225
+ bold: {
226
+ parseDOM: [
227
+ { tag: "strong" },
228
+ {
229
+ tag: "b",
230
+ getAttrs: (node) => node.style.fontWeight != "normal" && null
231
+ },
232
+ {
233
+ style: "font-weight=400",
234
+ clearMark: (m) => m.type.name == "strong"
235
+ },
236
+ {
237
+ style: "font-weight",
238
+ getAttrs: (value) => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null
239
+ }
240
+ ],
241
+ toDOM() {
242
+ return ["strong", 0];
243
+ }
244
+ },
245
+ italic: {
246
+ parseDOM: [
247
+ { tag: "em" },
248
+ { tag: "i" },
249
+ { style: "font-style=italic" },
250
+ {
251
+ style: "font-style=normal",
252
+ clearMark: (m) => m.type.name == "em"
253
+ }
254
+ ],
255
+ toDOM() {
256
+ return ["em", 0];
257
+ }
258
+ },
259
+ underline: {
260
+ parseDOM: [
261
+ { tag: "u" },
262
+ {
263
+ style: "text-decoration",
264
+ getAttrs: (value) => value === "underline" && null
265
+ }
266
+ ],
267
+ toDOM() {
268
+ return ["u", 0];
269
+ }
270
+ }
271
+ }
272
+ });
273
+ const prosemirrorSchema = new import_prosemirror_model.Schema({
274
+ nodes: (0, import_prosemirror_schema_list.addListNodes)(
275
+ customSchema.spec.nodes,
276
+ "paragraph block*",
277
+ "block"
278
+ ),
279
+ marks: customSchema.spec.marks
280
+ });
281
+ return prosemirrorSchema;
282
+ }
283
+ // Annotate the CommonJS export names for ESM import in node:
284
+ 0 && (module.exports = {
285
+ createSchema
286
+ });
@@ -0,0 +1,261 @@
1
+ // src/schema.tsx
2
+ import { Schema } from "prosemirror-model";
3
+ import { addListNodes } from "prosemirror-schema-list";
4
+ function createSchema() {
5
+ const customSchema = new Schema({
6
+ nodes: {
7
+ doc: { content: "block+" },
8
+ paragraph: {
9
+ attrs: { align: { default: null } },
10
+ content: "inline*",
11
+ group: "block",
12
+ parseDOM: [
13
+ {
14
+ tag: "p",
15
+ getAttrs(dom) {
16
+ return {
17
+ align: dom.style.textAlign || null
18
+ };
19
+ }
20
+ }
21
+ ],
22
+ toDOM(node) {
23
+ return [
24
+ "p",
25
+ {
26
+ style: node.attrs.align ? `text-align: ${node.attrs.align}` : null
27
+ },
28
+ 0
29
+ ];
30
+ }
31
+ },
32
+ text: {
33
+ group: "inline"
34
+ },
35
+ hard_break: {
36
+ inline: true,
37
+ group: "inline",
38
+ selectable: false,
39
+ parseDOM: [{ tag: "br" }],
40
+ toDOM() {
41
+ return ["br"];
42
+ }
43
+ },
44
+ heading: {
45
+ attrs: { level: { default: 1 }, align: { default: null } },
46
+ content: "inline*",
47
+ group: "block",
48
+ defining: true,
49
+ parseDOM: [
50
+ {
51
+ tag: "h1",
52
+ getAttrs(node) {
53
+ return {
54
+ level: 1,
55
+ algin: node.style.textAlign || null
56
+ };
57
+ }
58
+ },
59
+ {
60
+ tag: "h2",
61
+ getAttrs(node) {
62
+ return {
63
+ level: 2,
64
+ algin: node.style.textAlign || null
65
+ };
66
+ }
67
+ },
68
+ {
69
+ tag: "h3",
70
+ getAttrs(node) {
71
+ return {
72
+ level: 3,
73
+ algin: node.style.textAlign || null
74
+ };
75
+ }
76
+ },
77
+ {
78
+ tag: "h4",
79
+ getAttrs(node) {
80
+ return {
81
+ level: 4,
82
+ algin: node.style.textAlign || null
83
+ };
84
+ }
85
+ },
86
+ {
87
+ tag: "h5",
88
+ getAttrs(node) {
89
+ return {
90
+ level: 5,
91
+ algin: node.style.textAlign || null
92
+ };
93
+ }
94
+ },
95
+ {
96
+ tag: "h6",
97
+ getAttrs(node) {
98
+ return {
99
+ level: 6,
100
+ algin: node.style.textAlign || null
101
+ };
102
+ }
103
+ }
104
+ ],
105
+ toDOM(node) {
106
+ return [
107
+ "h" + node.attrs.level,
108
+ {
109
+ id: node.textContent.toLowerCase().replace(/\s+/g, "-"),
110
+ style: node.attrs.align ? `text-align: ${node.attrs.align};` : null
111
+ },
112
+ 0
113
+ ];
114
+ }
115
+ },
116
+ horizontal_rule: {
117
+ group: "block",
118
+ parseDOM: [{ tag: "hr" }],
119
+ toDOM() {
120
+ return ["hr"];
121
+ }
122
+ },
123
+ image: {
124
+ attrs: {
125
+ src: { validate: "string" },
126
+ alt: { default: null, validate: "string|null" },
127
+ title: {
128
+ default: null,
129
+ validate: "string|null"
130
+ },
131
+ width: {
132
+ default: null,
133
+ validate: "number|null"
134
+ },
135
+ height: {
136
+ default: null,
137
+ validate: "number|null"
138
+ }
139
+ },
140
+ inline: false,
141
+ group: "block",
142
+ draggable: true,
143
+ parseDOM: [
144
+ {
145
+ tag: "img",
146
+ getAttrs(dom) {
147
+ return {
148
+ src: dom.getAttribute("src"),
149
+ alt: dom.getAttribute("alt"),
150
+ width: dom.getAttribute("width"),
151
+ height: dom.getAttribute("height")
152
+ };
153
+ }
154
+ }
155
+ ],
156
+ toDOM(node) {
157
+ const { src, alt, srcSet, sizes, width, height } = node.attrs;
158
+ return [
159
+ "img",
160
+ {
161
+ src,
162
+ alt,
163
+ srcSet,
164
+ sizes,
165
+ width,
166
+ height
167
+ }
168
+ ];
169
+ }
170
+ }
171
+ },
172
+ marks: {
173
+ link: {
174
+ attrs: {
175
+ href: { default: "" },
176
+ title: { default: null }
177
+ },
178
+ inclusive: false,
179
+ parseDOM: [
180
+ {
181
+ tag: "a[href]",
182
+ getAttrs(dom) {
183
+ return {
184
+ href: dom.getAttribute("href"),
185
+ title: dom.getAttribute("title")
186
+ };
187
+ }
188
+ }
189
+ ],
190
+ toDOM(node) {
191
+ const { href, title } = node.attrs;
192
+ const target = "_blank";
193
+ const rel = "noopener noreferrer";
194
+ return [
195
+ "a",
196
+ { href, title: title || href, target, rel },
197
+ 0
198
+ ];
199
+ }
200
+ },
201
+ bold: {
202
+ parseDOM: [
203
+ { tag: "strong" },
204
+ {
205
+ tag: "b",
206
+ getAttrs: (node) => node.style.fontWeight != "normal" && null
207
+ },
208
+ {
209
+ style: "font-weight=400",
210
+ clearMark: (m) => m.type.name == "strong"
211
+ },
212
+ {
213
+ style: "font-weight",
214
+ getAttrs: (value) => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null
215
+ }
216
+ ],
217
+ toDOM() {
218
+ return ["strong", 0];
219
+ }
220
+ },
221
+ italic: {
222
+ parseDOM: [
223
+ { tag: "em" },
224
+ { tag: "i" },
225
+ { style: "font-style=italic" },
226
+ {
227
+ style: "font-style=normal",
228
+ clearMark: (m) => m.type.name == "em"
229
+ }
230
+ ],
231
+ toDOM() {
232
+ return ["em", 0];
233
+ }
234
+ },
235
+ underline: {
236
+ parseDOM: [
237
+ { tag: "u" },
238
+ {
239
+ style: "text-decoration",
240
+ getAttrs: (value) => value === "underline" && null
241
+ }
242
+ ],
243
+ toDOM() {
244
+ return ["u", 0];
245
+ }
246
+ }
247
+ }
248
+ });
249
+ const prosemirrorSchema = new Schema({
250
+ nodes: addListNodes(
251
+ customSchema.spec.nodes,
252
+ "paragraph block*",
253
+ "block"
254
+ ),
255
+ marks: customSchema.spec.marks
256
+ });
257
+ return prosemirrorSchema;
258
+ }
259
+ export {
260
+ createSchema
261
+ };
@@ -0,0 +1,36 @@
1
+ import { createAttachFile, AttachFile } from './attach_file.mjs';
2
+ import * as orderedmap from 'orderedmap';
3
+ import * as prosemirror_model from 'prosemirror-model';
4
+ import React, { DetailedHTMLProps, InputHTMLAttributes, Ref } from 'react';
5
+ import { Transaction, EditorStateConfig } from 'prosemirror-state';
6
+ import { EditorView, DirectEditorProps } from 'prosemirror-view';
7
+ import { Subject } from 'rxjs';
8
+ import './schema.mjs';
9
+
10
+ type TextEditorController = {
11
+ view: EditorView;
12
+ subject: Subject<Transaction>;
13
+ set value(value: string);
14
+ get value(): string;
15
+ clear: () => void;
16
+ };
17
+ type TextEditorProps = Omit<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
18
+ ref?: Ref<TextEditorController>;
19
+ state?: Partial<EditorStateConfig>;
20
+ editor?: Partial<DirectEditorProps>;
21
+ mode?: "html" | "text";
22
+ updateDelay?: number;
23
+ container?: string;
24
+ };
25
+ declare function createTextEditor(options?: {
26
+ attachFile?: {
27
+ generateMetadata: Parameters<typeof createAttachFile>[0]["generateMetadata"];
28
+ uploadFile: Parameters<typeof createAttachFile>[0]["uploadFile"];
29
+ };
30
+ }): {
31
+ schema: prosemirror_model.Schema<keyof orderedmap.default<prosemirror_model.NodeSpec>, keyof orderedmap.default<prosemirror_model.MarkSpec>>;
32
+ attachFile: AttachFile;
33
+ Component: ({ ref, state, editor, mode, container, autoFocus, name, placeholder, className, defaultValue, onClick, onChange, updateDelay, ...props }?: TextEditorProps) => React.JSX.Element;
34
+ };
35
+
36
+ export { type TextEditorController, type TextEditorProps, createTextEditor };
@@ -0,0 +1,36 @@
1
+ import { createAttachFile, AttachFile } from './attach_file.js';
2
+ import * as orderedmap from 'orderedmap';
3
+ import * as prosemirror_model from 'prosemirror-model';
4
+ import React, { DetailedHTMLProps, InputHTMLAttributes, Ref } from 'react';
5
+ import { Transaction, EditorStateConfig } from 'prosemirror-state';
6
+ import { EditorView, DirectEditorProps } from 'prosemirror-view';
7
+ import { Subject } from 'rxjs';
8
+ import './schema.js';
9
+
10
+ type TextEditorController = {
11
+ view: EditorView;
12
+ subject: Subject<Transaction>;
13
+ set value(value: string);
14
+ get value(): string;
15
+ clear: () => void;
16
+ };
17
+ type TextEditorProps = Omit<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
18
+ ref?: Ref<TextEditorController>;
19
+ state?: Partial<EditorStateConfig>;
20
+ editor?: Partial<DirectEditorProps>;
21
+ mode?: "html" | "text";
22
+ updateDelay?: number;
23
+ container?: string;
24
+ };
25
+ declare function createTextEditor(options?: {
26
+ attachFile?: {
27
+ generateMetadata: Parameters<typeof createAttachFile>[0]["generateMetadata"];
28
+ uploadFile: Parameters<typeof createAttachFile>[0]["uploadFile"];
29
+ };
30
+ }): {
31
+ schema: prosemirror_model.Schema<keyof orderedmap.default<prosemirror_model.NodeSpec>, keyof orderedmap.default<prosemirror_model.MarkSpec>>;
32
+ attachFile: AttachFile;
33
+ Component: ({ ref, state, editor, mode, container, autoFocus, name, placeholder, className, defaultValue, onClick, onChange, updateDelay, ...props }?: TextEditorProps) => React.JSX.Element;
34
+ };
35
+
36
+ export { type TextEditorController, type TextEditorProps, createTextEditor };