@tumaet/prompt-ui-components 0.0.5 → 0.0.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/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/index.css +1036 -96
- package/dist/types/components/index.d.ts +0 -1
- package/package.json +4 -3
- package/src/index.css +1 -24
- package/dist/components/minimal-tiptap/components/bubble-menu/link-bubble-menu.js +0 -65
- package/dist/components/minimal-tiptap/components/bubble-menu/link-bubble-menu.js.map +0 -1
- package/dist/components/minimal-tiptap/components/image/image-edit-block.js +0 -38
- package/dist/components/minimal-tiptap/components/image/image-edit-block.js.map +0 -1
- package/dist/components/minimal-tiptap/components/image/image-edit-dialog.js +0 -12
- package/dist/components/minimal-tiptap/components/image/image-edit-dialog.js.map +0 -1
- package/dist/components/minimal-tiptap/components/link/link-edit-block.js +0 -34
- package/dist/components/minimal-tiptap/components/link/link-edit-block.js.map +0 -1
- package/dist/components/minimal-tiptap/components/link/link-edit-popover.js +0 -38
- package/dist/components/minimal-tiptap/components/link/link-edit-popover.js.map +0 -1
- package/dist/components/minimal-tiptap/components/link/link-popover-block.js +0 -28
- package/dist/components/minimal-tiptap/components/link/link-popover-block.js.map +0 -1
- package/dist/components/minimal-tiptap/components/measured-container.js +0 -16
- package/dist/components/minimal-tiptap/components/measured-container.js.map +0 -1
- package/dist/components/minimal-tiptap/components/section/five.js +0 -39
- package/dist/components/minimal-tiptap/components/section/five.js.map +0 -1
- package/dist/components/minimal-tiptap/components/section/four.js +0 -29
- package/dist/components/minimal-tiptap/components/section/four.js.map +0 -1
- package/dist/components/minimal-tiptap/components/section/mailingPlaceholders.js +0 -23
- package/dist/components/minimal-tiptap/components/section/mailingPlaceholders.js.map +0 -1
- package/dist/components/minimal-tiptap/components/section/one.js +0 -77
- package/dist/components/minimal-tiptap/components/section/one.js.map +0 -1
- package/dist/components/minimal-tiptap/components/section/three.js +0 -79
- package/dist/components/minimal-tiptap/components/section/three.js.map +0 -1
- package/dist/components/minimal-tiptap/components/section/two.js +0 -65
- package/dist/components/minimal-tiptap/components/section/two.js.map +0 -1
- package/dist/components/minimal-tiptap/components/shortcut-key.js +0 -11
- package/dist/components/minimal-tiptap/components/shortcut-key.js.map +0 -1
- package/dist/components/minimal-tiptap/components/spinner.js +0 -9
- package/dist/components/minimal-tiptap/components/spinner.js.map +0 -1
- package/dist/components/minimal-tiptap/components/toolbar-button.js +0 -15
- package/dist/components/minimal-tiptap/components/toolbar-button.js.map +0 -1
- package/dist/components/minimal-tiptap/components/toolbar-section.js +0 -27
- package/dist/components/minimal-tiptap/components/toolbar-section.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/code-block-lowlight/code-block-lowlight.js +0 -16
- package/dist/components/minimal-tiptap/extensions/code-block-lowlight/code-block-lowlight.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/code-block-lowlight/index.js +0 -2
- package/dist/components/minimal-tiptap/extensions/code-block-lowlight/index.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/color/color.js +0 -20
- package/dist/components/minimal-tiptap/extensions/color/color.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/color/index.js +0 -2
- package/dist/components/minimal-tiptap/extensions/color/index.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/file-handler/index.js +0 -74
- package/dist/components/minimal-tiptap/extensions/file-handler/index.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/horizontal-rule/horizontal-rule.js +0 -16
- package/dist/components/minimal-tiptap/extensions/horizontal-rule/horizontal-rule.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/horizontal-rule/index.js +0 -2
- package/dist/components/minimal-tiptap/extensions/horizontal-rule/index.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/image/components/image-actions.js +0 -39
- package/dist/components/minimal-tiptap/extensions/image/components/image-actions.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/image/components/image-overlay.js +0 -9
- package/dist/components/minimal-tiptap/extensions/image/components/image-overlay.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/image/components/image-view-block.js +0 -167
- package/dist/components/minimal-tiptap/extensions/image/components/image-view-block.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/image/components/resize-handle.js +0 -11
- package/dist/components/minimal-tiptap/extensions/image/components/resize-handle.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/image/hooks/use-drag-resize.js +0 -88
- package/dist/components/minimal-tiptap/extensions/image/hooks/use-drag-resize.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/image/hooks/use-image-actions.js +0 -32
- package/dist/components/minimal-tiptap/extensions/image/hooks/use-image-actions.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/image/image.js +0 -225
- package/dist/components/minimal-tiptap/extensions/image/image.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/image/index.js +0 -2
- package/dist/components/minimal-tiptap/extensions/image/index.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/index.js +0 -10
- package/dist/components/minimal-tiptap/extensions/index.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/link/index.js +0 -2
- package/dist/components/minimal-tiptap/extensions/link/index.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/link/link.js +0 -74
- package/dist/components/minimal-tiptap/extensions/link/link.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/reset-marks-on-enter/index.js +0 -2
- package/dist/components/minimal-tiptap/extensions/reset-marks-on-enter/index.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/reset-marks-on-enter/reset-marks-on-enter.js +0 -20
- package/dist/components/minimal-tiptap/extensions/reset-marks-on-enter/reset-marks-on-enter.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/selection/index.js +0 -2
- package/dist/components/minimal-tiptap/extensions/selection/index.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/selection/selection.js +0 -31
- package/dist/components/minimal-tiptap/extensions/selection/selection.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/unset-all-marks/index.js +0 -2
- package/dist/components/minimal-tiptap/extensions/unset-all-marks/index.js.map +0 -1
- package/dist/components/minimal-tiptap/extensions/unset-all-marks/unset-all-marks.js +0 -9
- package/dist/components/minimal-tiptap/extensions/unset-all-marks/unset-all-marks.js.map +0 -1
- package/dist/components/minimal-tiptap/form-description-tiptap.js +0 -26
- package/dist/components/minimal-tiptap/form-description-tiptap.js.map +0 -1
- package/dist/components/minimal-tiptap/hooks/use-container-size.js +0 -44
- package/dist/components/minimal-tiptap/hooks/use-container-size.js.map +0 -1
- package/dist/components/minimal-tiptap/hooks/use-minimal-tiptap.js +0 -160
- package/dist/components/minimal-tiptap/hooks/use-minimal-tiptap.js.map +0 -1
- package/dist/components/minimal-tiptap/hooks/use-theme.js +0 -19
- package/dist/components/minimal-tiptap/hooks/use-theme.js.map +0 -1
- package/dist/components/minimal-tiptap/hooks/use-throttle.js +0 -24
- package/dist/components/minimal-tiptap/hooks/use-throttle.js.map +0 -1
- package/dist/components/minimal-tiptap/index.js +0 -2
- package/dist/components/minimal-tiptap/index.js.map +0 -1
- package/dist/components/minimal-tiptap/mailing-tiptap.js +0 -30
- package/dist/components/minimal-tiptap/mailing-tiptap.js.map +0 -1
- package/dist/components/minimal-tiptap/minimal-tiptap.js +0 -29
- package/dist/components/minimal-tiptap/minimal-tiptap.js.map +0 -1
- package/dist/components/minimal-tiptap/types.js +0 -2
- package/dist/components/minimal-tiptap/types.js.map +0 -1
- package/dist/components/minimal-tiptap/utils.js +0 -156
- package/dist/components/minimal-tiptap/utils.js.map +0 -1
- package/dist/types/components/minimal-tiptap/components/bubble-menu/link-bubble-menu.d.ts +0 -7
- package/dist/types/components/minimal-tiptap/components/image/image-edit-block.d.ts +0 -8
- package/dist/types/components/minimal-tiptap/components/image/image-edit-dialog.d.ts +0 -8
- package/dist/types/components/minimal-tiptap/components/link/link-edit-block.d.ts +0 -9
- package/dist/types/components/minimal-tiptap/components/link/link-edit-popover.d.ts +0 -8
- package/dist/types/components/minimal-tiptap/components/link/link-popover-block.d.ts +0 -8
- package/dist/types/components/minimal-tiptap/components/measured-container.d.ts +0 -2
- package/dist/types/components/minimal-tiptap/components/section/five.d.ts +0 -12
- package/dist/types/components/minimal-tiptap/components/section/four.d.ts +0 -12
- package/dist/types/components/minimal-tiptap/components/section/mailingPlaceholders.d.ts +0 -10
- package/dist/types/components/minimal-tiptap/components/section/one.d.ts +0 -11
- package/dist/types/components/minimal-tiptap/components/section/three.d.ts +0 -9
- package/dist/types/components/minimal-tiptap/components/section/two.d.ts +0 -12
- package/dist/types/components/minimal-tiptap/components/shortcut-key.d.ts +0 -5
- package/dist/types/components/minimal-tiptap/components/spinner.d.ts +0 -5
- package/dist/types/components/minimal-tiptap/components/toolbar-button.d.ts +0 -10
- package/dist/types/components/minimal-tiptap/components/toolbar-section.d.ts +0 -16
- package/dist/types/components/minimal-tiptap/extensions/code-block-lowlight/code-block-lowlight.d.ts +0 -2
- package/dist/types/components/minimal-tiptap/extensions/code-block-lowlight/index.d.ts +0 -1
- package/dist/types/components/minimal-tiptap/extensions/color/color.d.ts +0 -1
- package/dist/types/components/minimal-tiptap/extensions/color/index.d.ts +0 -1
- package/dist/types/components/minimal-tiptap/extensions/file-handler/index.d.ts +0 -12
- package/dist/types/components/minimal-tiptap/extensions/horizontal-rule/horizontal-rule.d.ts +0 -2
- package/dist/types/components/minimal-tiptap/extensions/horizontal-rule/index.d.ts +0 -1
- package/dist/types/components/minimal-tiptap/extensions/image/components/image-actions.d.ts +0 -17
- package/dist/types/components/minimal-tiptap/extensions/image/components/image-overlay.d.ts +0 -2
- package/dist/types/components/minimal-tiptap/extensions/image/components/image-view-block.d.ts +0 -3
- package/dist/types/components/minimal-tiptap/extensions/image/components/resize-handle.d.ts +0 -6
- package/dist/types/components/minimal-tiptap/extensions/image/hooks/use-drag-resize.d.ts +0 -24
- package/dist/types/components/minimal-tiptap/extensions/image/hooks/use-image-actions.d.ts +0 -24
- package/dist/types/components/minimal-tiptap/extensions/image/image.d.ts +0 -52
- package/dist/types/components/minimal-tiptap/extensions/image/index.d.ts +0 -1
- package/dist/types/components/minimal-tiptap/extensions/index.d.ts +0 -9
- package/dist/types/components/minimal-tiptap/extensions/link/index.d.ts +0 -1
- package/dist/types/components/minimal-tiptap/extensions/link/link.d.ts +0 -2
- package/dist/types/components/minimal-tiptap/extensions/reset-marks-on-enter/index.d.ts +0 -1
- package/dist/types/components/minimal-tiptap/extensions/reset-marks-on-enter/reset-marks-on-enter.d.ts +0 -2
- package/dist/types/components/minimal-tiptap/extensions/selection/index.d.ts +0 -1
- package/dist/types/components/minimal-tiptap/extensions/selection/selection.d.ts +0 -3
- package/dist/types/components/minimal-tiptap/extensions/unset-all-marks/index.d.ts +0 -1
- package/dist/types/components/minimal-tiptap/extensions/unset-all-marks/unset-all-marks.d.ts +0 -2
- package/dist/types/components/minimal-tiptap/form-description-tiptap.d.ts +0 -4
- package/dist/types/components/minimal-tiptap/hooks/use-container-size.d.ts +0 -1
- package/dist/types/components/minimal-tiptap/hooks/use-minimal-tiptap.d.ts +0 -13
- package/dist/types/components/minimal-tiptap/hooks/use-theme.d.ts +0 -2
- package/dist/types/components/minimal-tiptap/hooks/use-throttle.d.ts +0 -1
- package/dist/types/components/minimal-tiptap/index.d.ts +0 -1
- package/dist/types/components/minimal-tiptap/mailing-tiptap.d.ts +0 -13
- package/dist/types/components/minimal-tiptap/minimal-tiptap.d.ts +0 -12
- package/dist/types/components/minimal-tiptap/types.d.ts +0 -25
- package/dist/types/components/minimal-tiptap/utils.d.ts +0 -38
- package/tailwind/postcss.config.js +0 -7
- package/tailwind/tailwind.config.js +0 -69
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { mergeAttributes } from '@tiptap/react';
|
|
2
|
-
import TiptapLink from '@tiptap/extension-link';
|
|
3
|
-
import { getMarkRange } from '@tiptap/react';
|
|
4
|
-
import { Plugin, TextSelection } from '@tiptap/pm/state';
|
|
5
|
-
export const Link = TiptapLink.extend({
|
|
6
|
-
/*
|
|
7
|
-
* Determines whether typing next to a link automatically becomes part of the link.
|
|
8
|
-
* In this case, we dont want any characters to be included as part of the link.
|
|
9
|
-
*/
|
|
10
|
-
inclusive: false,
|
|
11
|
-
/*
|
|
12
|
-
* Match all <a> elements that have an href attribute, except for:
|
|
13
|
-
* - <a> elements with a data-type attribute set to button
|
|
14
|
-
* - <a> elements with an href attribute that contains 'javascript:'
|
|
15
|
-
*/
|
|
16
|
-
parseHTML() {
|
|
17
|
-
return [{ tag: 'a[href]:not([data-type="button"]):not([href *= "javascript:" i])' }];
|
|
18
|
-
},
|
|
19
|
-
renderHTML({ HTMLAttributes }) {
|
|
20
|
-
return ['a', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
21
|
-
},
|
|
22
|
-
addOptions() {
|
|
23
|
-
return {
|
|
24
|
-
...this.parent?.(),
|
|
25
|
-
openOnClick: false,
|
|
26
|
-
HTMLAttributes: {
|
|
27
|
-
class: 'link',
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
},
|
|
31
|
-
addProseMirrorPlugins() {
|
|
32
|
-
const { editor } = this;
|
|
33
|
-
return [
|
|
34
|
-
...(this.parent?.() || []),
|
|
35
|
-
new Plugin({
|
|
36
|
-
props: {
|
|
37
|
-
handleKeyDown: (_, event) => {
|
|
38
|
-
const { selection } = editor.state;
|
|
39
|
-
/*
|
|
40
|
-
* Handles the 'Escape' key press when there's a selection within the link.
|
|
41
|
-
* This will move the cursor to the end of the link.
|
|
42
|
-
*/
|
|
43
|
-
if (event.key === 'Escape' && selection.empty !== true) {
|
|
44
|
-
editor.commands.focus(selection.to, { scrollIntoView: false });
|
|
45
|
-
}
|
|
46
|
-
return false;
|
|
47
|
-
},
|
|
48
|
-
handleClick(view, pos) {
|
|
49
|
-
/*
|
|
50
|
-
* Marks the entire link when the user clicks on it.
|
|
51
|
-
*/
|
|
52
|
-
const { schema, doc, tr } = view.state;
|
|
53
|
-
const range = getMarkRange(doc.resolve(pos), schema.marks.link);
|
|
54
|
-
if (!range) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const { from, to } = range;
|
|
58
|
-
const start = Math.min(from, to);
|
|
59
|
-
const end = Math.max(from, to);
|
|
60
|
-
if (pos < start || pos > end) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
const $start = doc.resolve(start);
|
|
64
|
-
const $end = doc.resolve(end);
|
|
65
|
-
const transaction = tr.setSelection(new TextSelection($start, $end));
|
|
66
|
-
view.dispatch(transaction);
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
}),
|
|
70
|
-
];
|
|
71
|
-
},
|
|
72
|
-
});
|
|
73
|
-
export default Link;
|
|
74
|
-
//# sourceMappingURL=link.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"link.js","sourceRoot":"","sources":["../../../../../src/components/minimal-tiptap/extensions/link/link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,UAAU,MAAM,wBAAwB,CAAA;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAExD,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC;IACpC;;;OAGG;IACH,SAAS,EAAE,KAAK;IAEhB;;;;OAIG;IACH,SAAS;QACP,OAAO,CAAC,EAAE,GAAG,EAAE,kEAAkE,EAAE,CAAC,CAAA;IACtF,CAAC;IAED,UAAU,CAAC,EAAE,cAAc,EAAE;QAC3B,OAAO,CAAC,GAAG,EAAE,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;IAC/E,CAAC;IAED,UAAU;QACR,OAAO;YACL,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE;YAClB,WAAW,EAAE,KAAK;YAClB,cAAc,EA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4BAC7B,OAAM;wBACR,CAAC;wBAED,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;wBACjC,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;wBAC7B,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;wBAEpE,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAA;oBAC5B,CAAC;iBACF;aACF,CAAC;SACH,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAEF,eAAe,IAAI,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/minimal-tiptap/extensions/reset-marks-on-enter/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
|
package/dist/components/minimal-tiptap/extensions/reset-marks-on-enter/reset-marks-on-enter.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/react';
|
|
2
|
-
export const ResetMarksOnEnter = Extension.create({
|
|
3
|
-
name: 'resetMarksOnEnter',
|
|
4
|
-
addKeyboardShortcuts() {
|
|
5
|
-
return {
|
|
6
|
-
Enter: ({ editor }) => {
|
|
7
|
-
if (editor.isActive('bold') ||
|
|
8
|
-
editor.isActive('italic') ||
|
|
9
|
-
editor.isActive('strike') ||
|
|
10
|
-
editor.isActive('underline') ||
|
|
11
|
-
editor.isActive('code')) {
|
|
12
|
-
editor.commands.splitBlock({ keepMarks: false });
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
return false;
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
//# sourceMappingURL=reset-marks-on-enter.js.map
|
package/dist/components/minimal-tiptap/extensions/reset-marks-on-enter/reset-marks-on-enter.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reset-marks-on-enter.js","sourceRoot":"","sources":["../../../../../src/components/minimal-tiptap/extensions/reset-marks-on-enter/reset-marks-on-enter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEzC,MAAM,CAAC,MAAM,iBAAiB,GAAG,SAAS,CAAC,MAAM,CAAC;IAChD,IAAI,EAAE,mBAAmB;IAEzB,oBAAoB;QAClB,OAAO;YACL,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;gBACpB,IACE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;oBACvB,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;oBACzB,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;oBACzB,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC;oBAC5B,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EACvB,CAAC;oBACD,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAA;oBAEhD,OAAO,IAAI,CAAA;gBACb,CAAC;gBAED,OAAO,KAAK,CAAA;YACd,CAAC;SACF,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/minimal-tiptap/extensions/selection/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/react';
|
|
2
|
-
import { Plugin, PluginKey } from '@tiptap/pm/state';
|
|
3
|
-
import { Decoration, DecorationSet } from '@tiptap/pm/view';
|
|
4
|
-
export const Selection = Extension.create({
|
|
5
|
-
name: 'selection',
|
|
6
|
-
addProseMirrorPlugins() {
|
|
7
|
-
const { editor } = this;
|
|
8
|
-
return [
|
|
9
|
-
new Plugin({
|
|
10
|
-
key: new PluginKey('selection'),
|
|
11
|
-
props: {
|
|
12
|
-
decorations(state) {
|
|
13
|
-
if (state.selection.empty) {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
if (editor.isFocused === true) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
return DecorationSet.create(state.doc, [
|
|
20
|
-
Decoration.inline(state.selection.from, state.selection.to, {
|
|
21
|
-
class: 'selection',
|
|
22
|
-
}),
|
|
23
|
-
]);
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
}),
|
|
27
|
-
];
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
export default Selection;
|
|
31
|
-
//# sourceMappingURL=selection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"selection.js","sourceRoot":"","sources":["../../../../../src/components/minimal-tiptap/extensions/selection/selection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE3D,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,WAAW;IAEjB,qBAAqB;QACnB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;QAEvB,OAAO;YACL,IAAI,MAAM,CAAC;gBACT,GAAG,EAAE,IAAI,SAAS,CAAC,WAAW,CAAC;gBAC/B,KAAK,EAAE;oBACL,WAAW,CAAC,KAAK;wBACf,IAAI,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;4BAC1B,OAAO,IAAI,CAAA;wBACb,CAAC;wBAED,IAAI,MAAM,CAAC,SAAS,KAAK,IAAI,EAAE,CAAC;4BAC9B,OAAO,IAAI,CAAA;wBACb,CAAC;wBAED,OAAO,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE;4BACrC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE;gCAC1D,KAAK,EAAE,WAAW;6BACnB,CAAC;yBACH,CAAC,CAAA;oBACJ,CAAC;iBACF;aACF,CAAC;SACH,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAEF,eAAe,SAAS,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/minimal-tiptap/extensions/unset-all-marks/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unset-all-marks.js","sourceRoot":"","sources":["../../../../../src/components/minimal-tiptap/extensions/unset-all-marks/unset-all-marks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEzC,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC,MAAM,CAAC;IAC5C,oBAAoB;QAClB,OAAO;YACL,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,EAAE;SACrD,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import './styles/index.css';
|
|
4
|
-
import { EditorContent } from '@tiptap/react';
|
|
5
|
-
import { Separator } from '../../components/ui/separator';
|
|
6
|
-
import { cn } from '../../lib/utils';
|
|
7
|
-
import { SectionTwo } from './components/section/two';
|
|
8
|
-
import { SectionFour } from './components/section/four';
|
|
9
|
-
import { LinkBubbleMenu } from './components/bubble-menu/link-bubble-menu';
|
|
10
|
-
import { useMinimalTiptapEditor } from './hooks/use-minimal-tiptap';
|
|
11
|
-
import { MeasuredContainer } from './components/measured-container';
|
|
12
|
-
import { LinkEditPopover } from './components/link/link-edit-popover';
|
|
13
|
-
const DescriptionEditorToolbar = ({ editor }) => (_jsx("div", { className: 'shrink-0 overflow-x-auto border-b border-border p-2', children: _jsxs("div", { className: 'flex w-max items-center gap-px', children: [_jsx(SectionTwo, { editor: editor, activeActions: ['bold', 'italic', 'underline', 'strikethrough', 'code', 'clearFormatting'], mainActionCount: 3 }), _jsx(Separator, { orientation: 'vertical', className: 'mx-2 h-7' }), _jsx(SectionFour, { editor: editor, activeActions: ['orderedList', 'bulletList'], mainActionCount: 0 }), _jsx(Separator, { orientation: 'vertical', className: 'mx-2 h-7' }), _jsx(LinkEditPopover, { editor: editor })] }) }));
|
|
14
|
-
export const DescriptionMinimalTiptapEditor = React.forwardRef(({ value, onChange, className, editorContentClassName, ...props }, ref) => {
|
|
15
|
-
const editor = useMinimalTiptapEditor({
|
|
16
|
-
value,
|
|
17
|
-
onUpdate: onChange,
|
|
18
|
-
...props,
|
|
19
|
-
});
|
|
20
|
-
if (!editor) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
return (_jsxs(MeasuredContainer, { as: 'div', name: 'editor', ref: ref, className: cn('flex h-auto min-h-70 w-full flex-col rounded-md border border-input shadow-sm focus-within:border-primary', className), children: [_jsx(DescriptionEditorToolbar, { editor: editor }), _jsx(EditorContent, { editor: editor, className: cn('minimal-tiptap-editor', editorContentClassName) }), _jsx(LinkBubbleMenu, { editor: editor })] }));
|
|
24
|
-
});
|
|
25
|
-
DescriptionMinimalTiptapEditor.displayName = 'DescriptionMinimalTiptapEditor';
|
|
26
|
-
//# sourceMappingURL=form-description-tiptap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"form-description-tiptap.js","sourceRoot":"","sources":["../../../src/components/minimal-tiptap/form-description-tiptap.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,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AE,QAAQ,EAAE,SAAS,EAAE,sBAAsB,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IACxE,MAAM,MAAM,GAAG,sBAAsB,CAAC;QACpC,KAAK;QACL,QAAQ,EAAE,QAAQ;QAClB,GAAG,KAAK;KACT,CAAC,CAAA;IAEF,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,CACL,MAAC,iBAAiB,IAChB,EAAE,EAAC,KAAK,EACR,IAAI,EAAC,QAAQ,EACb,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,2GAA2G,EAC3G,SAAS,CACV,aAED,KAAC,wBAAwB,IAAC,MAAM,EAAE,MAAM,GAAI,EAC5C,KAAC,aAAa,IACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,EAAE,CAAC,uBAAuB,EAAE,sBAAsB,CAAC,GAC9D,EACF,KAAC,cAAc,IAAC,MAAM,EAAE,MAAM,GAAI,IAChB,CACrB,CAAA;AACH,CAAC,CACF,CAAA;AAED,8BAA8B,CAAC,WAAW,GAAG,gCAAgC,CAAA"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect, useCallback } from 'react';
|
|
2
|
-
const DEFAULT_RECT = {
|
|
3
|
-
top: 0,
|
|
4
|
-
left: 0,
|
|
5
|
-
bottom: 0,
|
|
6
|
-
right: 0,
|
|
7
|
-
x: 0,
|
|
8
|
-
y: 0,
|
|
9
|
-
width: 0,
|
|
10
|
-
height: 0,
|
|
11
|
-
toJSON: () => '{}',
|
|
12
|
-
};
|
|
13
|
-
export function useContainerSize(element) {
|
|
14
|
-
const [size, setSize] = useState(() => element?.getBoundingClientRect() ?? DEFAULT_RECT);
|
|
15
|
-
const handleResize = useCallback(() => {
|
|
16
|
-
if (!element)
|
|
17
|
-
return;
|
|
18
|
-
const newRect = element.getBoundingClientRect();
|
|
19
|
-
setSize((prevRect) => {
|
|
20
|
-
if (Math.round(prevRect.width) === Math.round(newRect.width) &&
|
|
21
|
-
Math.round(prevRect.height) === Math.round(newRect.height) &&
|
|
22
|
-
Math.round(prevRect.x) === Math.round(newRect.x) &&
|
|
23
|
-
Math.round(prevRect.y) === Math.round(newRect.y)) {
|
|
24
|
-
return prevRect;
|
|
25
|
-
}
|
|
26
|
-
return newRect;
|
|
27
|
-
});
|
|
28
|
-
}, [element]);
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
if (!element)
|
|
31
|
-
return;
|
|
32
|
-
const resizeObserver = new ResizeObserver(handleResize);
|
|
33
|
-
resizeObserver.observe(element);
|
|
34
|
-
window.addEventListener('click', handleResize);
|
|
35
|
-
window.addEventListener('resize', handleResize);
|
|
36
|
-
return () => {
|
|
37
|
-
resizeObserver.disconnect();
|
|
38
|
-
window.removeEventListener('click', handleResize);
|
|
39
|
-
window.removeEventListener('resize', handleResize);
|
|
40
|
-
};
|
|
41
|
-
}, [element, handleResize]);
|
|
42
|
-
return size;
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=use-container-size.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-container-size.js","sourceRoot":"","sources":["../../../../src/components/minimal-tiptap/hooks/use-container-size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAExD,MAAM,YAAY,GAAY;IAC5B,GAAG,EAAE,CAAC;IACN,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI;CACnB,CAAA;AAED,MAAM,UAAU,gBAAgB,CAAC,OAA2B;IAC1D,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAU,G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AAmB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;YACjD,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;QACpD,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAA;IAE3B,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-shadow */
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { StarterKit } from '@tiptap/starter-kit';
|
|
4
|
-
import { useEditor } from '@tiptap/react';
|
|
5
|
-
import { Typography } from '@tiptap/extension-typography';
|
|
6
|
-
import { Placeholder } from '@tiptap/extension-placeholder';
|
|
7
|
-
import { Underline } from '@tiptap/extension-underline';
|
|
8
|
-
import { TextStyle } from '@tiptap/extension-text-style';
|
|
9
|
-
import { Link, Image, HorizontalRule, CodeBlockLowlight, Selection, Color, UnsetAllMarks, ResetMarksOnEnter, FileHandler, } from '../extensions';
|
|
10
|
-
import { cn } from '../../../lib/utils';
|
|
11
|
-
import { fileToBase64, getOutput, randomId } from '../utils';
|
|
12
|
-
import { useThrottle } from '../hooks/use-throttle';
|
|
13
|
-
import { toast } from 'sonner';
|
|
14
|
-
const createExtensions = (placeholder) => [
|
|
15
|
-
StarterKit.configure({
|
|
16
|
-
horizontalRule: false,
|
|
17
|
-
codeBlock: false,
|
|
18
|
-
paragraph: { HTMLAttributes: { class: 'text-node' } },
|
|
19
|
-
heading: { HTMLAttributes: { class: 'heading-node' } },
|
|
20
|
-
blockquote: { HTMLAttributes: { class: 'block-node' } },
|
|
21
|
-
bulletList: { HTMLAttributes: { class: 'list-node' } },
|
|
22
|
-
orderedList: { HTMLAttributes: { class: 'list-node' } },
|
|
23
|
-
code: { HTMLAttributes: { class: 'inline', spellcheck: 'false' } },
|
|
24
|
-
dropcursor: { width: 2, class: 'ProseMirror-dropcursor border' },
|
|
25
|
-
}),
|
|
26
|
-
Link,
|
|
27
|
-
Underline,
|
|
28
|
-
Image.configure({
|
|
29
|
-
allowedMimeTypes: ['image/*'],
|
|
30
|
-
maxFileSize: 5 * 1024 * 1024,
|
|
31
|
-
allowBase64: true,
|
|
32
|
-
uploadFn: async (file) => {
|
|
33
|
-
// NOTE: This is a fake upload function. Replace this with your own upload logic.
|
|
34
|
-
// This function should return the uploaded image URL.
|
|
35
|
-
// wait 3s to simulate upload
|
|
36
|
-
await new Promise((resolve) => setTimeout(resolve, 3000));
|
|
37
|
-
const src = await fileToBase64(file);
|
|
38
|
-
// either return { id: string | number, src: string } or just src
|
|
39
|
-
// return src;
|
|
40
|
-
return { id: randomId(), src };
|
|
41
|
-
},
|
|
42
|
-
onToggle(editor, files, pos) {
|
|
43
|
-
editor.commands.insertContentAt(pos, files.map((image) => {
|
|
44
|
-
const blobUrl = URL.createObjectURL(image);
|
|
45
|
-
const id = randomId();
|
|
46
|
-
return {
|
|
47
|
-
type: 'image',
|
|
48
|
-
attrs: {
|
|
49
|
-
id,
|
|
50
|
-
src: blobUrl,
|
|
51
|
-
alt: image.name,
|
|
52
|
-
title: image.name,
|
|
53
|
-
fileName: image.name,
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
}));
|
|
57
|
-
},
|
|
58
|
-
onImageRemoved({ id, src }) {
|
|
59
|
-
console.log('Image removed', { id, src });
|
|
60
|
-
},
|
|
61
|
-
onValidationError(errors) {
|
|
62
|
-
errors.forEach((error) => {
|
|
63
|
-
toast.error('Image validation error', {
|
|
64
|
-
position: 'bottom-right',
|
|
65
|
-
description: error.reason,
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
},
|
|
69
|
-
onActionSuccess({ action }) {
|
|
70
|
-
const mapping = {
|
|
71
|
-
copyImage: 'Copy Image',
|
|
72
|
-
copyLink: 'Copy Link',
|
|
73
|
-
download: 'Download',
|
|
74
|
-
};
|
|
75
|
-
toast.success(mapping[action], {
|
|
76
|
-
position: 'bottom-right',
|
|
77
|
-
description: 'Image action success',
|
|
78
|
-
});
|
|
79
|
-
},
|
|
80
|
-
onActionError(error, { action }) {
|
|
81
|
-
const mapping = {
|
|
82
|
-
copyImage: 'Copy Image',
|
|
83
|
-
copyLink: 'Copy Link',
|
|
84
|
-
download: 'Download',
|
|
85
|
-
};
|
|
86
|
-
toast.error(`Failed to ${mapping[action]}`, {
|
|
87
|
-
position: 'bottom-right',
|
|
88
|
-
description: error.message,
|
|
89
|
-
});
|
|
90
|
-
},
|
|
91
|
-
}),
|
|
92
|
-
FileHandler.configure({
|
|
93
|
-
allowBase64: true,
|
|
94
|
-
allowedMimeTypes: ['image/*'],
|
|
95
|
-
maxFileSize: 5 * 1024 * 1024,
|
|
96
|
-
onDrop: (editor, files, pos) => {
|
|
97
|
-
files.forEach(async (file) => {
|
|
98
|
-
const src = await fileToBase64(file);
|
|
99
|
-
editor.commands.insertContentAt(pos, {
|
|
100
|
-
type: 'image',
|
|
101
|
-
attrs: { src },
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
},
|
|
105
|
-
onPaste: (editor, files) => {
|
|
106
|
-
files.forEach(async (file) => {
|
|
107
|
-
const src = await fileToBase64(file);
|
|
108
|
-
editor.commands.insertContent({
|
|
109
|
-
type: 'image',
|
|
110
|
-
attrs: { src },
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
},
|
|
114
|
-
onValidationError: (errors) => {
|
|
115
|
-
errors.forEach((error) => {
|
|
116
|
-
toast.error('Image validation error', {
|
|
117
|
-
position: 'bottom-right',
|
|
118
|
-
description: error.reason,
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
},
|
|
122
|
-
}),
|
|
123
|
-
Color,
|
|
124
|
-
TextStyle,
|
|
125
|
-
Selection,
|
|
126
|
-
Typography,
|
|
127
|
-
UnsetAllMarks,
|
|
128
|
-
HorizontalRule,
|
|
129
|
-
ResetMarksOnEnter,
|
|
130
|
-
CodeBlockLowlight,
|
|
131
|
-
Placeholder.configure({ placeholder: () => placeholder }),
|
|
132
|
-
];
|
|
133
|
-
export const useMinimalTiptapEditor = ({ value, output = 'html', placeholder = '', editorClassName, throttleDelay = 0, onUpdate, onBlur, ...props }) => {
|
|
134
|
-
const throttledSetValue = useThrottle((value) => onUpdate?.(value), throttleDelay);
|
|
135
|
-
const handleUpdate = React.useCallback((editor) => throttledSetValue(getOutput(editor, output)), [output, throttledSetValue]);
|
|
136
|
-
const handleCreate = React.useCallback((editor) => {
|
|
137
|
-
if (value && editor.isEmpty) {
|
|
138
|
-
editor.commands.setContent(value);
|
|
139
|
-
}
|
|
140
|
-
}, [value]);
|
|
141
|
-
const handleBlur = React.useCallback((editor) => onBlur?.(getOutput(editor, output)), [output, onBlur]);
|
|
142
|
-
const editor = useEditor({
|
|
143
|
-
extensions: createExtensions(placeholder),
|
|
144
|
-
editorProps: {
|
|
145
|
-
attributes: {
|
|
146
|
-
autocomplete: 'off',
|
|
147
|
-
autocorrect: 'off',
|
|
148
|
-
autocapitalize: 'off',
|
|
149
|
-
class: cn('focus:outline-none', editorClassName),
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
onUpdate: ({ editor }) => handleUpdate(editor),
|
|
153
|
-
onCreate: ({ editor }) => handleCreate(editor),
|
|
154
|
-
onBlur: ({ editor }) => handleBlur(editor),
|
|
155
|
-
...props,
|
|
156
|
-
});
|
|
157
|
-
return editor;
|
|
158
|
-
};
|
|
159
|
-
export default useMinimalTiptapEditor;
|
|
160
|
-
//# sourceMappingURL=use-minimal-tiptap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-minimal-tiptap.js","sourceRoot":"","sources":["../../../../src/components/minimal-tiptap/hooks/use-minimal-tiptap.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,C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AC,CAAA;AAED,eAAe,sBAAsB,CAAA"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export const useTheme = () => {
|
|
3
|
-
const [isDarkMode, setIsDarkMode] = React.useState(false);
|
|
4
|
-
React.useEffect(() => {
|
|
5
|
-
const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
|
6
|
-
setIsDarkMode(darkModeMediaQuery.matches);
|
|
7
|
-
const handleChange = (e) => {
|
|
8
|
-
const newDarkMode = e.matches;
|
|
9
|
-
setIsDarkMode(newDarkMode);
|
|
10
|
-
};
|
|
11
|
-
darkModeMediaQuery.addEventListener('change', handleChange);
|
|
12
|
-
return () => {
|
|
13
|
-
darkModeMediaQuery.removeEventListener('change', handleChange);
|
|
14
|
-
};
|
|
15
|
-
}, []);
|
|
16
|
-
return isDarkMode;
|
|
17
|
-
};
|
|
18
|
-
export default useTheme;
|
|
19
|
-
//# sourceMappingURL=use-theme.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-theme.js","sourceRoot":"","sources":["../../../../src/components/minimal-tiptap/hooks/use-theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAEzD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,kBAAkB,GAAG,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAA;QAC5E,aAAa,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAA;QAEzC,MAAM,YAAY,GAAG,CAAC,CAAsB,EAAE,EAAE;YAC9C,MAAM,WAAW,GAAG,CAAC,CAAC,OAAO,CAAA;YAC7B,aAAa,CAAC,WAAW,CAAC,CAAA;QAC5B,CAAC,CAAA;QAED,kBAAkB,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;QAE3D,OAAO,GAAG,EAAE;YACV,kBAAkB,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;QAChE,CAAC,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,UAAU,CAAA;AACnB,CAAC,CAAA;AAED,eAAe,QAAQ,CAAA"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useRef, useCallback } from 'react';
|
|
2
|
-
export function useThrottle(callback, delay) {
|
|
3
|
-
const lastRan = useRef(Date.now());
|
|
4
|
-
const timeoutRef = useRef(null);
|
|
5
|
-
return useCallback((...args) => {
|
|
6
|
-
const handler = () => {
|
|
7
|
-
if (Date.now() - lastRan.current >= delay) {
|
|
8
|
-
callback(...args);
|
|
9
|
-
lastRan.current = Date.now();
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
if (timeoutRef.current) {
|
|
13
|
-
clearTimeout(timeoutRef.current);
|
|
14
|
-
}
|
|
15
|
-
timeoutRef.current = setTimeout(() => {
|
|
16
|
-
callback(...args);
|
|
17
|
-
lastRan.current = Date.now();
|
|
18
|
-
}, delay - (Date.now() - lastRan.current));
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
handler();
|
|
22
|
-
}, [callback, delay]);
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=use-throttle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-throttle.js","sourceRoot":"","sources":["../../../../src/components/minimal-tiptap/hooks/use-throttle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAE3C,MAAM,UAAU,WAAW,CACzB,QAAW,EACX,KAAa;IAEb,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;IAClC,MAAM,UAAU,GAAG,MAAM,CAAuC,IAAI,CAAC,CAAA;IAErE,OAAO,WAAW,CAChB,CAAC,GAAG,IAAmB,EAAE,EAAE;QACzB,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,OAAO,IAAI,KAAK,EAAE,CAAC;gBAC1C,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAA;gBACjB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;YAC9B,CAAC;iBAAM,CAAC;gBACN,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;oBACvB,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;gBAClC,CAAC;gBACD,UAAU,CAAC,OAAO,GAAG,UAAU,CAC7B,GAAG,EAAE;oBACH,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAA;oBACjB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;gBAC9B,CAAC,EACD,KAAK,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CACvC,CAAA;YACH,CAAC;QACH,CAAC,CAAA;QAED,OAAO,EAAE,CAAA;IACX,CAAC,EACD,CAAC,QAAQ,EAAE,KAAK,CAAC,CAClB,CAAA;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/minimal-tiptap/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import './styles/index.css';
|
|
4
|
-
import { EditorContent } from '@tiptap/react';
|
|
5
|
-
import { Separator } from '../../components/ui/separator';
|
|
6
|
-
import { cn } from '../../lib/utils';
|
|
7
|
-
import { SectionOne } from './components/section/one';
|
|
8
|
-
import { SectionTwo } from './components/section/two';
|
|
9
|
-
import { SectionThree } from './components/section/three';
|
|
10
|
-
import { SectionFour } from './components/section/four';
|
|
11
|
-
import { SectionFive } from './components/section/five';
|
|
12
|
-
import { LinkBubbleMenu } from './components/bubble-menu/link-bubble-menu';
|
|
13
|
-
import { useMinimalTiptapEditor } from './hooks/use-minimal-tiptap';
|
|
14
|
-
import { MeasuredContainer } from './components/measured-container';
|
|
15
|
-
import SectionMailingPlaceholders from './components/section/mailingPlaceholders';
|
|
16
|
-
const MailingToolbar = ({ editor, placeholders }) => (_jsx("div", { className: 'shrink-0 overflow-x-auto border-b border-border p-2', children: _jsxs("div", { className: 'flex w-max items-center gap-px', children: [_jsx(SectionOne, { editor: editor, activeLevels: [1, 2, 3, 4, 5, 6] }), _jsx(Separator, { orientation: 'vertical', className: 'mx-2 h-7' }), _jsx(SectionTwo, { editor: editor, activeActions: ['bold', 'italic', 'underline', 'strikethrough', 'code', 'clearFormatting'], mainActionCount: 3 }), _jsx(Separator, { orientation: 'vertical', className: 'mx-2 h-7' }), _jsx(SectionThree, { editor: editor }), _jsx(Separator, { orientation: 'vertical', className: 'mx-2 h-7' }), _jsx(SectionFour, { editor: editor, activeActions: ['orderedList', 'bulletList'], mainActionCount: 0 }), _jsx(Separator, { orientation: 'vertical', className: 'mx-2 h-7' }), _jsx(SectionFive, { editor: editor, activeActions: ['codeBlock', 'blockquote', 'horizontalRule'], mainActionCount: 0 }), _jsx(Separator, { orientation: 'vertical', className: 'mx-2 h-7' }), _jsx(SectionMailingPlaceholders, { editor: editor, placeholders: placeholders })] }) }));
|
|
17
|
-
export const MailingTiptapEditor = React.forwardRef(({ value, onChange, className, editorContentClassName, placeholders, ...props }, ref) => {
|
|
18
|
-
const editor = useMinimalTiptapEditor({
|
|
19
|
-
value,
|
|
20
|
-
onUpdate: onChange,
|
|
21
|
-
...props,
|
|
22
|
-
});
|
|
23
|
-
if (!editor) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
return (_jsxs(MeasuredContainer, { as: 'div', name: 'editor', ref: ref, className: cn('flex h-auto min-h-72 w-full flex-col rounded-md border border-input shadow-sm focus-within:border-primary', className), children: [_jsx(MailingToolbar, { editor: editor, placeholders: placeholders }), _jsx(EditorContent, { editor: editor, className: cn('minimal-tiptap-editor', editorContentClassName) }), _jsx(LinkBubbleMenu, { editor: editor })] }));
|
|
27
|
-
});
|
|
28
|
-
MailingTiptapEditor.displayName = 'MailingTiptapEditor';
|
|
29
|
-
export default MailingTiptapEditor;
|
|
30
|
-
//# sourceMappingURL=mailing-tiptap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mailing-tiptap.js","sourceRoot":"","sources":["../../../src/components/minimal-tiptap/mailing-tiptap.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,oBAAoB,CAAA;AAI3B,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAA;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,0BAA0B,MAAM,0CAA0C,CAAA;AAUjF,MAAM,cAAc,GAAG,CAAC,EAAE,MAAM,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C,UAAU,CACjD,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,sBAAsB,EAAE,YAAY,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IACtF,MAAM,MAAM,GAAG,sBAAsB,CAAC;QACpC,KAAK;QACL,QAAQ,EAAE,QAAQ;QAClB,GAAG,KAAK;KACT,CAAC,CAAA;IAEF,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,CACL,MAAC,iBAAiB,IAChB,EAAE,EAAC,KAAK,EACR,IAAI,EAAC,QAAQ,EACb,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,2GAA2G,EAC3G,SAAS,CACV,aAED,KAAC,cAAc,IAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAI,EAC9D,KAAC,aAAa,IACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,EAAE,CAAC,uBAAuB,EAAE,sBAAsB,CAAC,GAC9D,EACF,KAAC,cAAc,IAAC,MAAM,EAAE,MAAM,GAAI,IAChB,CACrB,CAAA;AACH,CAAC,CACF,CAAA;AAED,mBAAmB,CAAC,WAAW,GAAG,qBAAqB,CAAA;AAEvD,eAAe,mBAAmB,CAAA"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import './styles/index.css';
|
|
4
|
-
import { EditorContent } from '@tiptap/react';
|
|
5
|
-
import { Separator } from '../../components/ui/separator';
|
|
6
|
-
import { cn } from '../../lib/utils';
|
|
7
|
-
import { SectionOne } from './components/section/one';
|
|
8
|
-
import { SectionTwo } from './components/section/two';
|
|
9
|
-
import { SectionThree } from './components/section/three';
|
|
10
|
-
import { SectionFour } from './components/section/four';
|
|
11
|
-
import { SectionFive } from './components/section/five';
|
|
12
|
-
import { LinkBubbleMenu } from './components/bubble-menu/link-bubble-menu';
|
|
13
|
-
import { useMinimalTiptapEditor } from './hooks/use-minimal-tiptap';
|
|
14
|
-
import { MeasuredContainer } from './components/measured-container';
|
|
15
|
-
const Toolbar = ({ editor }) => (_jsx("div", { className: 'shrink-0 overflow-x-auto border-b border-border p-2', children: _jsxs("div", { className: 'flex w-max items-center gap-px', children: [_jsx(SectionOne, { editor: editor, activeLevels: [1, 2, 3, 4, 5, 6] }), _jsx(Separator, { orientation: 'vertical', className: 'mx-2 h-7' }), _jsx(SectionTwo, { editor: editor, activeActions: ['bold', 'italic', 'underline', 'strikethrough', 'code', 'clearFormatting'], mainActionCount: 3 }), _jsx(Separator, { orientation: 'vertical', className: 'mx-2 h-7' }), _jsx(SectionThree, { editor: editor }), _jsx(Separator, { orientation: 'vertical', className: 'mx-2 h-7' }), _jsx(SectionFour, { editor: editor, activeActions: ['orderedList', 'bulletList'], mainActionCount: 0 }), _jsx(Separator, { orientation: 'vertical', className: 'mx-2 h-7' }), _jsx(SectionFive, { editor: editor, activeActions: ['codeBlock', 'blockquote', 'horizontalRule'], mainActionCount: 0 })] }) }));
|
|
16
|
-
export const MinimalTiptapEditor = React.forwardRef(({ value, onChange, className, editorContentClassName, ...props }, ref) => {
|
|
17
|
-
const editor = useMinimalTiptapEditor({
|
|
18
|
-
value,
|
|
19
|
-
onUpdate: onChange,
|
|
20
|
-
...props,
|
|
21
|
-
});
|
|
22
|
-
if (!editor) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
return (_jsxs(MeasuredContainer, { as: 'div', name: 'editor', ref: ref, className: cn('flex h-auto min-h-32 w-full flex-col rounded-md border border-input shadow-sm focus-within:border-primary', className), children: [_jsx(Toolbar, { editor: editor }), _jsx(EditorContent, { editor: editor, className: cn('minimal-tiptap-editor', editorContentClassName) }), _jsx(LinkBubbleMenu, { editor: editor })] }));
|
|
26
|
-
});
|
|
27
|
-
MinimalTiptapEditor.displayName = 'MinimalTiptapEditor';
|
|
28
|
-
export default MinimalTiptapEditor;
|
|
29
|
-
//# sourceMappingURL=minimal-tiptap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"minimal-tiptap.js","sourceRoot":"","sources":["../../../src/components/minimal-tiptap/minimal-tiptap.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,oBAAoB,CAAA;AAI3B,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAA;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AASnE,MAAM,OAAO,GAAG,CAAC,EAAE,MAAM,EAAsB,EAAE,EAAE,CAAC,CAClD,cAAK,SAAS,EAAC,qDAAqD,YAClE,eAAK,SAAS,EAAC,gCAAgC,aAC7C,KAAC,UAAU,IAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAI,EAEhE,KAAC,SAAS,IAAC,WAAW,EAAC,UAAU,EAAC,SAAS,EAAC,UAAU,GAAG,EAEzD,KAAC,UAAU,IACT,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,CAA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