dn-react-router-toolkit 0.2.3 → 0.2.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.
Files changed (57) hide show
  1. package/dist/auth/client/provider.d.mts +2 -4
  2. package/dist/auth/client/provider.d.ts +2 -4
  3. package/dist/auth/client/provider.js +3 -4
  4. package/dist/auth/client/provider.mjs +3 -4
  5. package/dist/auth/jwt_manager.js +1 -1
  6. package/dist/auth/jwt_manager.mjs +1 -1
  7. package/dist/file/cdn.d.mts +3 -2
  8. package/dist/file/cdn.d.ts +3 -2
  9. package/dist/file/client/drop_file_input.js +36 -10
  10. package/dist/file/client/drop_file_input.mjs +36 -10
  11. package/dist/file/client/file_uploader.js +36 -10
  12. package/dist/file/client/file_uploader.mjs +36 -10
  13. package/dist/file/client/metadata.d.mts +5 -1
  14. package/dist/file/client/metadata.d.ts +5 -1
  15. package/dist/file/client/metadata.js +36 -10
  16. package/dist/file/client/metadata.mjs +36 -10
  17. package/dist/index.d.mts +1 -0
  18. package/dist/index.d.ts +1 -0
  19. package/dist/index.js +7 -0
  20. package/dist/index.mjs +6 -0
  21. package/dist/sleep.d.mts +3 -0
  22. package/dist/sleep.d.ts +3 -0
  23. package/dist/sleep.js +32 -0
  24. package/dist/sleep.mjs +7 -0
  25. package/dist/text_editor/attach_media.d.mts +16 -0
  26. package/dist/text_editor/attach_media.d.ts +16 -0
  27. package/dist/text_editor/attach_media.js +237 -0
  28. package/dist/text_editor/attach_media.mjs +210 -0
  29. package/dist/text_editor/plugins/drag_and_drop.d.mts +13 -0
  30. package/dist/text_editor/plugins/drag_and_drop.d.ts +13 -0
  31. package/dist/text_editor/plugins/drag_and_drop.js +59 -0
  32. package/dist/text_editor/plugins/drag_and_drop.mjs +34 -0
  33. package/dist/text_editor/plugins/keymap.d.mts +5 -0
  34. package/dist/text_editor/plugins/keymap.d.ts +5 -0
  35. package/dist/text_editor/plugins/keymap.js +40 -0
  36. package/dist/text_editor/plugins/keymap.mjs +15 -0
  37. package/dist/text_editor/plugins/placehoder.d.mts +5 -0
  38. package/dist/text_editor/plugins/placehoder.d.ts +5 -0
  39. package/dist/text_editor/plugins/placehoder.js +112 -0
  40. package/dist/text_editor/plugins/placehoder.mjs +87 -0
  41. package/dist/text_editor/plugins/trailing_paragraph.d.mts +5 -0
  42. package/dist/text_editor/plugins/trailing_paragraph.d.ts +5 -0
  43. package/dist/text_editor/plugins/trailing_paragraph.js +46 -0
  44. package/dist/text_editor/plugins/trailing_paragraph.mjs +21 -0
  45. package/dist/text_editor/plugins/upload_placeholder.d.mts +7 -0
  46. package/dist/text_editor/plugins/upload_placeholder.d.ts +7 -0
  47. package/dist/text_editor/plugins/upload_placeholder.js +94 -0
  48. package/dist/text_editor/plugins/upload_placeholder.mjs +68 -0
  49. package/dist/text_editor/schema.d.mts +9 -0
  50. package/dist/text_editor/schema.d.ts +9 -0
  51. package/dist/text_editor/schema.js +354 -0
  52. package/dist/text_editor/schema.mjs +319 -0
  53. package/dist/text_editor/text_editor.d.mts +44 -0
  54. package/dist/text_editor/text_editor.d.ts +44 -0
  55. package/dist/text_editor/text_editor.js +830 -0
  56. package/dist/text_editor/text_editor.mjs +802 -0
  57. package/package.json +14 -2
@@ -0,0 +1,237 @@
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/text_editor/attach_media.tsx
21
+ var attach_media_exports = {};
22
+ __export(attach_media_exports, {
23
+ createAttachMedia: () => createAttachMedia
24
+ });
25
+ module.exports = __toCommonJS(attach_media_exports);
26
+
27
+ // src/text_editor/plugins/upload_placeholder.tsx
28
+ var import_prosemirror_state = require("prosemirror-state");
29
+ var import_prosemirror_view = require("prosemirror-view");
30
+ var uploadPlaceholderPlugin = new import_prosemirror_state.Plugin({
31
+ state: {
32
+ init() {
33
+ return import_prosemirror_view.DecorationSet.empty;
34
+ },
35
+ apply(tr, set) {
36
+ set = set.map(tr.mapping, tr.doc);
37
+ const action = tr.getMeta(this);
38
+ if (action && action.add) {
39
+ const { type, width, height } = action.add;
40
+ const widget = document.createElement("div");
41
+ widget.className = "upload-placeholder";
42
+ widget.style.width = `100%`;
43
+ if (type.startsWith("image/") || type.startsWith("video/")) {
44
+ widget.style.aspectRatio = `${width} / ${height}`;
45
+ widget.style.maxWidth = `${width}px`;
46
+ } else {
47
+ widget.style.height = "80px";
48
+ }
49
+ const progress = document.createElement("div");
50
+ progress.className = "upload-progress";
51
+ widget.appendChild(progress);
52
+ const deco = import_prosemirror_view.Decoration.widget(action.add.pos, widget, {
53
+ id: action.add.id
54
+ });
55
+ set = set.add(tr.doc, [deco]);
56
+ } else if (action && action.progress) {
57
+ const found = set.find(
58
+ void 0,
59
+ void 0,
60
+ (spec) => spec.id === action.progress.id
61
+ );
62
+ if (found.length) {
63
+ const widget = found[0].type.toDOM;
64
+ const progress = widget.querySelector(".upload-progress");
65
+ if (progress) {
66
+ progress.innerHTML = `${Math.round(action.progress.progress)}%`;
67
+ }
68
+ }
69
+ } else if (action && action.remove) {
70
+ set = set.remove(
71
+ set.find(void 0, void 0, (spec) => spec.id === action.remove.id)
72
+ );
73
+ }
74
+ return set;
75
+ }
76
+ },
77
+ props: {
78
+ decorations(state) {
79
+ return this.getState(state);
80
+ }
81
+ }
82
+ });
83
+ var findPlaceholder = (state, id) => {
84
+ const decos = uploadPlaceholderPlugin.getState(state);
85
+ if (!decos) {
86
+ return null;
87
+ }
88
+ const found = decos.find(void 0, void 0, (spec) => spec.id === id);
89
+ return found.length ? found[0].from : null;
90
+ };
91
+
92
+ // src/file/client/metadata.ts
93
+ function generateMetadata(blob, {
94
+ uploadBlob
95
+ } = {}) {
96
+ return new Promise((resolve) => {
97
+ if (blob.type.startsWith("image/")) {
98
+ const img = new Image();
99
+ img.src = URL.createObjectURL(blob);
100
+ img.onload = () => {
101
+ resolve({
102
+ width: img.width,
103
+ height: img.height
104
+ });
105
+ };
106
+ img.onerror = () => resolve({});
107
+ return;
108
+ }
109
+ if (blob.type.startsWith("video/")) {
110
+ const video = document.createElement("video");
111
+ video.onloadeddata = () => {
112
+ const canvas = document.createElement("canvas");
113
+ canvas.width = video.videoWidth;
114
+ canvas.height = video.videoHeight;
115
+ const context = canvas.getContext("2d");
116
+ if (!context || !uploadBlob) {
117
+ return resolve({
118
+ width: video.videoWidth,
119
+ height: video.videoHeight
120
+ });
121
+ }
122
+ video.addEventListener("seeked", () => {
123
+ context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
124
+ canvas.toBlob((blob2) => {
125
+ if (!blob2) {
126
+ return resolve({
127
+ width: video.videoWidth,
128
+ height: video.videoHeight
129
+ });
130
+ }
131
+ uploadBlob(blob2, "poster").then(({ url }) => {
132
+ resolve({
133
+ width: video.videoWidth,
134
+ height: video.videoHeight,
135
+ poster: url
136
+ });
137
+ });
138
+ }, "image/jpeg");
139
+ });
140
+ video.currentTime = 0;
141
+ };
142
+ video.onerror = () => resolve({});
143
+ video.src = URL.createObjectURL(blob);
144
+ return;
145
+ }
146
+ resolve({});
147
+ });
148
+ }
149
+
150
+ // src/file/cdn.ts
151
+ var createCDN = (origin) => {
152
+ return (key, { width } = {}) => {
153
+ return key ? `${origin}/${key}${width ? `?w=${width}` : ""}` : void 0;
154
+ };
155
+ };
156
+
157
+ // src/text_editor/attach_media.tsx
158
+ function createAttachMedia({
159
+ schema,
160
+ cdnOrigin,
161
+ fileUploader
162
+ }) {
163
+ const cdn = createCDN(cdnOrigin);
164
+ const attachEachMedia = async (view, file, pos) => {
165
+ const metadata = await generateMetadata(file, {
166
+ uploadBlob: (blob, type) => fileUploader.uploadBlob(blob, type).then(({ key }) => ({
167
+ url: cdn(key)
168
+ }))
169
+ });
170
+ const id = {};
171
+ view.focus();
172
+ const tr = view.state.tr;
173
+ if (!tr.selection.empty) {
174
+ tr.deleteSelection();
175
+ }
176
+ tr.setMeta(uploadPlaceholderPlugin, {
177
+ add: {
178
+ id,
179
+ pos: pos ?? tr.selection.from,
180
+ type: file.type,
181
+ ...metadata
182
+ }
183
+ });
184
+ view.dispatch(tr);
185
+ const $pos = findPlaceholder(view.state, id);
186
+ if (!$pos) {
187
+ return;
188
+ }
189
+ try {
190
+ const { name, key } = await fileUploader.uploadFile(file);
191
+ const src = cdn(key);
192
+ const tr2 = view.state.tr.setMeta(uploadPlaceholderPlugin, {
193
+ remove: { id }
194
+ });
195
+ const media = (() => {
196
+ if (file.type.startsWith("image/")) {
197
+ return schema.nodes.image.create({
198
+ src,
199
+ alt: name,
200
+ width: metadata.width,
201
+ height: metadata.height
202
+ });
203
+ }
204
+ if (file.type.startsWith("video/")) {
205
+ return schema.nodes.video.create({
206
+ src,
207
+ width: metadata.width,
208
+ height: metadata.height,
209
+ poster: metadata.poster
210
+ });
211
+ }
212
+ })();
213
+ if (!media) {
214
+ return;
215
+ }
216
+ view.dispatch(tr2.replaceWith($pos, $pos, media));
217
+ return media;
218
+ } catch (e) {
219
+ view.dispatch(tr.setMeta(uploadPlaceholderPlugin, { remove: { id } }));
220
+ }
221
+ };
222
+ return async (view, medias, pos) => {
223
+ const result = [];
224
+ for (let i = 0; i < medias.length; i++) {
225
+ const file = medias[i];
226
+ const item = await attachEachMedia(view, file, pos);
227
+ if (item) {
228
+ result.push(item);
229
+ }
230
+ }
231
+ return result;
232
+ };
233
+ }
234
+ // Annotate the CommonJS export names for ESM import in node:
235
+ 0 && (module.exports = {
236
+ createAttachMedia
237
+ });
@@ -0,0 +1,210 @@
1
+ // src/text_editor/plugins/upload_placeholder.tsx
2
+ import { Plugin } from "prosemirror-state";
3
+ import { Decoration, DecorationSet } from "prosemirror-view";
4
+ var uploadPlaceholderPlugin = new Plugin({
5
+ state: {
6
+ init() {
7
+ return DecorationSet.empty;
8
+ },
9
+ apply(tr, set) {
10
+ set = set.map(tr.mapping, tr.doc);
11
+ const action = tr.getMeta(this);
12
+ if (action && action.add) {
13
+ const { type, width, height } = action.add;
14
+ const widget = document.createElement("div");
15
+ widget.className = "upload-placeholder";
16
+ widget.style.width = `100%`;
17
+ if (type.startsWith("image/") || type.startsWith("video/")) {
18
+ widget.style.aspectRatio = `${width} / ${height}`;
19
+ widget.style.maxWidth = `${width}px`;
20
+ } else {
21
+ widget.style.height = "80px";
22
+ }
23
+ const progress = document.createElement("div");
24
+ progress.className = "upload-progress";
25
+ widget.appendChild(progress);
26
+ const deco = Decoration.widget(action.add.pos, widget, {
27
+ id: action.add.id
28
+ });
29
+ set = set.add(tr.doc, [deco]);
30
+ } else if (action && action.progress) {
31
+ const found = set.find(
32
+ void 0,
33
+ void 0,
34
+ (spec) => spec.id === action.progress.id
35
+ );
36
+ if (found.length) {
37
+ const widget = found[0].type.toDOM;
38
+ const progress = widget.querySelector(".upload-progress");
39
+ if (progress) {
40
+ progress.innerHTML = `${Math.round(action.progress.progress)}%`;
41
+ }
42
+ }
43
+ } else if (action && action.remove) {
44
+ set = set.remove(
45
+ set.find(void 0, void 0, (spec) => spec.id === action.remove.id)
46
+ );
47
+ }
48
+ return set;
49
+ }
50
+ },
51
+ props: {
52
+ decorations(state) {
53
+ return this.getState(state);
54
+ }
55
+ }
56
+ });
57
+ var findPlaceholder = (state, id) => {
58
+ const decos = uploadPlaceholderPlugin.getState(state);
59
+ if (!decos) {
60
+ return null;
61
+ }
62
+ const found = decos.find(void 0, void 0, (spec) => spec.id === id);
63
+ return found.length ? found[0].from : null;
64
+ };
65
+
66
+ // src/file/client/metadata.ts
67
+ function generateMetadata(blob, {
68
+ uploadBlob
69
+ } = {}) {
70
+ return new Promise((resolve) => {
71
+ if (blob.type.startsWith("image/")) {
72
+ const img = new Image();
73
+ img.src = URL.createObjectURL(blob);
74
+ img.onload = () => {
75
+ resolve({
76
+ width: img.width,
77
+ height: img.height
78
+ });
79
+ };
80
+ img.onerror = () => resolve({});
81
+ return;
82
+ }
83
+ if (blob.type.startsWith("video/")) {
84
+ const video = document.createElement("video");
85
+ video.onloadeddata = () => {
86
+ const canvas = document.createElement("canvas");
87
+ canvas.width = video.videoWidth;
88
+ canvas.height = video.videoHeight;
89
+ const context = canvas.getContext("2d");
90
+ if (!context || !uploadBlob) {
91
+ return resolve({
92
+ width: video.videoWidth,
93
+ height: video.videoHeight
94
+ });
95
+ }
96
+ video.addEventListener("seeked", () => {
97
+ context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
98
+ canvas.toBlob((blob2) => {
99
+ if (!blob2) {
100
+ return resolve({
101
+ width: video.videoWidth,
102
+ height: video.videoHeight
103
+ });
104
+ }
105
+ uploadBlob(blob2, "poster").then(({ url }) => {
106
+ resolve({
107
+ width: video.videoWidth,
108
+ height: video.videoHeight,
109
+ poster: url
110
+ });
111
+ });
112
+ }, "image/jpeg");
113
+ });
114
+ video.currentTime = 0;
115
+ };
116
+ video.onerror = () => resolve({});
117
+ video.src = URL.createObjectURL(blob);
118
+ return;
119
+ }
120
+ resolve({});
121
+ });
122
+ }
123
+
124
+ // src/file/cdn.ts
125
+ var createCDN = (origin) => {
126
+ return (key, { width } = {}) => {
127
+ return key ? `${origin}/${key}${width ? `?w=${width}` : ""}` : void 0;
128
+ };
129
+ };
130
+
131
+ // src/text_editor/attach_media.tsx
132
+ function createAttachMedia({
133
+ schema,
134
+ cdnOrigin,
135
+ fileUploader
136
+ }) {
137
+ const cdn = createCDN(cdnOrigin);
138
+ const attachEachMedia = async (view, file, pos) => {
139
+ const metadata = await generateMetadata(file, {
140
+ uploadBlob: (blob, type) => fileUploader.uploadBlob(blob, type).then(({ key }) => ({
141
+ url: cdn(key)
142
+ }))
143
+ });
144
+ const id = {};
145
+ view.focus();
146
+ const tr = view.state.tr;
147
+ if (!tr.selection.empty) {
148
+ tr.deleteSelection();
149
+ }
150
+ tr.setMeta(uploadPlaceholderPlugin, {
151
+ add: {
152
+ id,
153
+ pos: pos ?? tr.selection.from,
154
+ type: file.type,
155
+ ...metadata
156
+ }
157
+ });
158
+ view.dispatch(tr);
159
+ const $pos = findPlaceholder(view.state, id);
160
+ if (!$pos) {
161
+ return;
162
+ }
163
+ try {
164
+ const { name, key } = await fileUploader.uploadFile(file);
165
+ const src = cdn(key);
166
+ const tr2 = view.state.tr.setMeta(uploadPlaceholderPlugin, {
167
+ remove: { id }
168
+ });
169
+ const media = (() => {
170
+ if (file.type.startsWith("image/")) {
171
+ return schema.nodes.image.create({
172
+ src,
173
+ alt: name,
174
+ width: metadata.width,
175
+ height: metadata.height
176
+ });
177
+ }
178
+ if (file.type.startsWith("video/")) {
179
+ return schema.nodes.video.create({
180
+ src,
181
+ width: metadata.width,
182
+ height: metadata.height,
183
+ poster: metadata.poster
184
+ });
185
+ }
186
+ })();
187
+ if (!media) {
188
+ return;
189
+ }
190
+ view.dispatch(tr2.replaceWith($pos, $pos, media));
191
+ return media;
192
+ } catch (e) {
193
+ view.dispatch(tr.setMeta(uploadPlaceholderPlugin, { remove: { id } }));
194
+ }
195
+ };
196
+ return async (view, medias, pos) => {
197
+ const result = [];
198
+ for (let i = 0; i < medias.length; i++) {
199
+ const file = medias[i];
200
+ const item = await attachEachMedia(view, file, pos);
201
+ if (item) {
202
+ result.push(item);
203
+ }
204
+ }
205
+ return result;
206
+ };
207
+ }
208
+ export {
209
+ createAttachMedia
210
+ };
@@ -0,0 +1,13 @@
1
+ import { Plugin } from 'prosemirror-state';
2
+ import { createAttachMedia } from '../attach_media.mjs';
3
+ import 'prosemirror-view';
4
+ import 'prosemirror-model';
5
+ import '../../file/client/file_uploader.mjs';
6
+ import '../schema.mjs';
7
+ import 'orderedmap';
8
+
9
+ declare function dragAndDropPlugin({ attachMedia, }: {
10
+ attachMedia: ReturnType<typeof createAttachMedia>;
11
+ }): Plugin<any>;
12
+
13
+ export { dragAndDropPlugin };
@@ -0,0 +1,13 @@
1
+ import { Plugin } from 'prosemirror-state';
2
+ import { createAttachMedia } from '../attach_media.js';
3
+ import 'prosemirror-view';
4
+ import 'prosemirror-model';
5
+ import '../../file/client/file_uploader.js';
6
+ import '../schema.js';
7
+ import 'orderedmap';
8
+
9
+ declare function dragAndDropPlugin({ attachMedia, }: {
10
+ attachMedia: ReturnType<typeof createAttachMedia>;
11
+ }): Plugin<any>;
12
+
13
+ export { dragAndDropPlugin };
@@ -0,0 +1,59 @@
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/text_editor/plugins/drag_and_drop.tsx
21
+ var drag_and_drop_exports = {};
22
+ __export(drag_and_drop_exports, {
23
+ dragAndDropPlugin: () => dragAndDropPlugin
24
+ });
25
+ module.exports = __toCommonJS(drag_and_drop_exports);
26
+ var import_prosemirror_state = require("prosemirror-state");
27
+ function dragAndDropPlugin({
28
+ attachMedia
29
+ }) {
30
+ return new import_prosemirror_state.Plugin({
31
+ props: {
32
+ handleDOMEvents: {
33
+ drop(view, event) {
34
+ const files = event.dataTransfer?.files;
35
+ if (!files || files.length === 0) {
36
+ return;
37
+ }
38
+ event.preventDefault();
39
+ const pos = view.state.selection.$from.pos || view.posAtCoords({
40
+ left: event.clientX,
41
+ top: event.clientY
42
+ })?.pos || null;
43
+ if (pos === null) {
44
+ return;
45
+ }
46
+ const medias = Array.from(files).filter(
47
+ (file) => file.type.startsWith("image/") || file.type.startsWith("video/")
48
+ );
49
+ attachMedia(view, medias);
50
+ return true;
51
+ }
52
+ }
53
+ }
54
+ });
55
+ }
56
+ // Annotate the CommonJS export names for ESM import in node:
57
+ 0 && (module.exports = {
58
+ dragAndDropPlugin
59
+ });
@@ -0,0 +1,34 @@
1
+ // src/text_editor/plugins/drag_and_drop.tsx
2
+ import { Plugin } from "prosemirror-state";
3
+ function dragAndDropPlugin({
4
+ attachMedia
5
+ }) {
6
+ return new Plugin({
7
+ props: {
8
+ handleDOMEvents: {
9
+ drop(view, event) {
10
+ const files = event.dataTransfer?.files;
11
+ if (!files || files.length === 0) {
12
+ return;
13
+ }
14
+ event.preventDefault();
15
+ const pos = view.state.selection.$from.pos || view.posAtCoords({
16
+ left: event.clientX,
17
+ top: event.clientY
18
+ })?.pos || null;
19
+ if (pos === null) {
20
+ return;
21
+ }
22
+ const medias = Array.from(files).filter(
23
+ (file) => file.type.startsWith("image/") || file.type.startsWith("video/")
24
+ );
25
+ attachMedia(view, medias);
26
+ return true;
27
+ }
28
+ }
29
+ }
30
+ });
31
+ }
32
+ export {
33
+ dragAndDropPlugin
34
+ };
@@ -0,0 +1,5 @@
1
+ import { Command } from 'prosemirror-state';
2
+
3
+ declare function buildKeymap(): Record<string, Command>;
4
+
5
+ export { buildKeymap };
@@ -0,0 +1,5 @@
1
+ import { Command } from 'prosemirror-state';
2
+
3
+ declare function buildKeymap(): Record<string, Command>;
4
+
5
+ export { buildKeymap };
@@ -0,0 +1,40 @@
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/text_editor/plugins/keymap.tsx
21
+ var keymap_exports = {};
22
+ __export(keymap_exports, {
23
+ buildKeymap: () => buildKeymap
24
+ });
25
+ module.exports = __toCommonJS(keymap_exports);
26
+ var import_prosemirror_history = require("prosemirror-history");
27
+ function buildKeymap() {
28
+ const keys = {};
29
+ function bind(key, cmd) {
30
+ keys[key] = cmd;
31
+ }
32
+ bind("Mod-z", import_prosemirror_history.undo);
33
+ bind("Shift-Mod-z", import_prosemirror_history.redo);
34
+ bind("Mod-y", import_prosemirror_history.redo);
35
+ return keys;
36
+ }
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ buildKeymap
40
+ });
@@ -0,0 +1,15 @@
1
+ // src/text_editor/plugins/keymap.tsx
2
+ import { undo, redo } from "prosemirror-history";
3
+ function buildKeymap() {
4
+ const keys = {};
5
+ function bind(key, cmd) {
6
+ keys[key] = cmd;
7
+ }
8
+ bind("Mod-z", undo);
9
+ bind("Shift-Mod-z", redo);
10
+ bind("Mod-y", redo);
11
+ return keys;
12
+ }
13
+ export {
14
+ buildKeymap
15
+ };
@@ -0,0 +1,5 @@
1
+ import { Plugin } from 'prosemirror-state';
2
+
3
+ declare function placeholderPlugin(text: string): Plugin<any>;
4
+
5
+ export { placeholderPlugin };
@@ -0,0 +1,5 @@
1
+ import { Plugin } from 'prosemirror-state';
2
+
3
+ declare function placeholderPlugin(text: string): Plugin<any>;
4
+
5
+ export { placeholderPlugin };