ritext 1.0.25 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +12 -23
- package/dist/index.mjs +1 -12
- package/package.json +26 -27
package/dist/index.js
CHANGED
|
@@ -67,12 +67,11 @@ module.exports = __toCommonJS(src_exports);
|
|
|
67
67
|
var import_dist = require("@siamf/react-color-pick/dist/index.css");
|
|
68
68
|
|
|
69
69
|
// src/lib/Editor.tsx
|
|
70
|
-
var
|
|
71
|
-
var
|
|
70
|
+
var import_react6 = require("react");
|
|
71
|
+
var import_react7 = require("@tiptap/react");
|
|
72
72
|
|
|
73
73
|
// src/lib/internal_com/RiDragHandler.tsx
|
|
74
74
|
var import_extension_drag_handle_react = __toESM(require("@tiptap/extension-drag-handle-react"));
|
|
75
|
-
var import_react4 = require("@tiptap/react");
|
|
76
75
|
var import_state = require("@tiptap/pm/state");
|
|
77
76
|
|
|
78
77
|
// src/lib/icons/index.tsx
|
|
@@ -212,16 +211,7 @@ var Tooltip_default = Tooltip;
|
|
|
212
211
|
|
|
213
212
|
// src/lib/internal_com/RiDragHandler.tsx
|
|
214
213
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
215
|
-
var isDocEmpty = (editor) => {
|
|
216
|
-
var _a;
|
|
217
|
-
const doc = editor.state.doc;
|
|
218
|
-
return doc.childCount === 1 && ((_a = doc.firstChild) == null ? void 0 : _a.isTextblock) === true && doc.firstChild.content.size === 0;
|
|
219
|
-
};
|
|
220
214
|
var RiDragHandler = ({ editor }) => {
|
|
221
|
-
const empty = (0, import_react4.useEditorState)({
|
|
222
|
-
editor,
|
|
223
|
-
selector: ({ editor: editor2 }) => isDocEmpty(editor2)
|
|
224
|
-
});
|
|
225
215
|
const insertSlash = () => {
|
|
226
216
|
editor.chain().focus().command(({ tr, state }) => {
|
|
227
217
|
const { $from } = state.selection;
|
|
@@ -243,8 +233,7 @@ var RiDragHandler = ({ editor }) => {
|
|
|
243
233
|
return true;
|
|
244
234
|
}).run();
|
|
245
235
|
};
|
|
246
|
-
|
|
247
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_extension_drag_handle_react.default, { editor, nested: empty, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex gap-x-1.5 mt-1.5 -translate-x-1.5", children: [
|
|
236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_extension_drag_handle_react.default, { editor, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex gap-x-1.5 mt-1.5 -translate-x-1.5", children: [
|
|
248
237
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Tooltip_default, { content: "Insert Content", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
249
238
|
"button",
|
|
250
239
|
{
|
|
@@ -269,7 +258,7 @@ var RiDragHandler = ({ editor }) => {
|
|
|
269
258
|
var RiDragHandler_default = RiDragHandler;
|
|
270
259
|
|
|
271
260
|
// src/lib/internal_com/BubbleMenu.tsx
|
|
272
|
-
var
|
|
261
|
+
var import_react4 = require("react");
|
|
273
262
|
var import_menus = require("@tiptap/react/menus");
|
|
274
263
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
275
264
|
var BubbleMenu = ({ editor }) => {
|
|
@@ -302,7 +291,7 @@ var BubbleMenu = ({ editor }) => {
|
|
|
302
291
|
return a.name.localeCompare(b.name);
|
|
303
292
|
});
|
|
304
293
|
if (!entries.length) return null;
|
|
305
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_menus.BubbleMenu, { editor, options: { placement: "top", offset: 10, flip: true }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "bg-white flex gap-x-1 py-2 px-2 rounded-md border border-gray-200", children: entries.map(({ name, renderButton, options }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
294
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_menus.BubbleMenu, { editor, options: { placement: "top", offset: 10, flip: true }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "bg-white flex gap-x-1 py-2 px-2 rounded-md border border-gray-200", children: entries.map(({ name, renderButton, options }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react4.Fragment, { children: renderButton({
|
|
306
295
|
editor,
|
|
307
296
|
options,
|
|
308
297
|
buttonClassName: "",
|
|
@@ -313,11 +302,11 @@ var BubbleMenu = ({ editor }) => {
|
|
|
313
302
|
var BubbleMenu_default = BubbleMenu;
|
|
314
303
|
|
|
315
304
|
// src/lib/context/editor.context.tsx
|
|
316
|
-
var
|
|
305
|
+
var import_react5 = require("react");
|
|
317
306
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
318
|
-
var EditorContext = (0,
|
|
307
|
+
var EditorContext = (0, import_react5.createContext)({ editor: null });
|
|
319
308
|
var useEditor = () => {
|
|
320
|
-
const ctx = (0,
|
|
309
|
+
const ctx = (0, import_react5.useContext)(EditorContext);
|
|
321
310
|
if (!ctx) throw new Error("<Toolbar/> & <Content/> component must be used inside <Editor>...</Editor/>");
|
|
322
311
|
return ctx;
|
|
323
312
|
};
|
|
@@ -328,11 +317,11 @@ var EditorProvider = ({ children, value }) => {
|
|
|
328
317
|
// src/lib/Editor.tsx
|
|
329
318
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
330
319
|
var Editor = ({ children, extensions = [], className, dragHandler = true, showBubbleMenu = true }) => {
|
|
331
|
-
const editor = (0,
|
|
320
|
+
const editor = (0, import_react7.useEditor)({
|
|
332
321
|
extensions: [...extensions],
|
|
333
322
|
immediatelyRender: false
|
|
334
323
|
});
|
|
335
|
-
const value = (0,
|
|
324
|
+
const value = (0, import_react6.useMemo)(() => ({ editor }), [editor]);
|
|
336
325
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(EditorProvider, { value: __spreadProps(__spreadValues({}, value), { dragHandler }), children: [
|
|
337
326
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className, children }),
|
|
338
327
|
value.editor && dragHandler && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(RiDragHandler_default, { editor: value.editor }),
|
|
@@ -384,12 +373,12 @@ var Toolbar = ({ className, buttonClassName, dropdownContainerClassName, dropdow
|
|
|
384
373
|
var Toolbar_default = Toolbar;
|
|
385
374
|
|
|
386
375
|
// src/lib/Content.tsx
|
|
387
|
-
var
|
|
376
|
+
var import_react8 = require("@tiptap/react");
|
|
388
377
|
var import_tailwind_merge3 = require("tailwind-merge");
|
|
389
378
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
390
379
|
var Content = ({ className }) => {
|
|
391
380
|
const { editor, dragHandler } = useEditor();
|
|
392
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react8.EditorContent, { editor, className: (0, import_tailwind_merge3.twMerge)(`focus:outline-none [&_.tiptap]:focus:outline-none [&_.tiptap]:min-h-50 ${dragHandler ? "[&_.tiptap]:p-[10px_20px_10px_50px]" : "[&_.tiptap]:p-[10px_20px]"}`, className) });
|
|
393
382
|
};
|
|
394
383
|
var Content_default = Content;
|
|
395
384
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.mjs
CHANGED
|
@@ -21,19 +21,9 @@ import { useEditor as useEditor2 } from "@tiptap/react";
|
|
|
21
21
|
|
|
22
22
|
// src/lib/internal_com/RiDragHandler.tsx
|
|
23
23
|
import DragHandle from "@tiptap/extension-drag-handle-react";
|
|
24
|
-
import { useEditorState } from "@tiptap/react";
|
|
25
24
|
import { TextSelection } from "@tiptap/pm/state";
|
|
26
25
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
27
|
-
var isDocEmpty = (editor) => {
|
|
28
|
-
var _a;
|
|
29
|
-
const doc = editor.state.doc;
|
|
30
|
-
return doc.childCount === 1 && ((_a = doc.firstChild) == null ? void 0 : _a.isTextblock) === true && doc.firstChild.content.size === 0;
|
|
31
|
-
};
|
|
32
26
|
var RiDragHandler = ({ editor }) => {
|
|
33
|
-
const empty = useEditorState({
|
|
34
|
-
editor,
|
|
35
|
-
selector: ({ editor: editor2 }) => isDocEmpty(editor2)
|
|
36
|
-
});
|
|
37
27
|
const insertSlash = () => {
|
|
38
28
|
editor.chain().focus().command(({ tr, state }) => {
|
|
39
29
|
const { $from } = state.selection;
|
|
@@ -55,8 +45,7 @@ var RiDragHandler = ({ editor }) => {
|
|
|
55
45
|
return true;
|
|
56
46
|
}).run();
|
|
57
47
|
};
|
|
58
|
-
|
|
59
|
-
return /* @__PURE__ */ jsx(DragHandle, { editor, nested: empty, children: /* @__PURE__ */ jsxs("div", { className: "flex gap-x-1.5 mt-1.5 -translate-x-1.5", children: [
|
|
48
|
+
return /* @__PURE__ */ jsx(DragHandle, { editor, children: /* @__PURE__ */ jsxs("div", { className: "flex gap-x-1.5 mt-1.5 -translate-x-1.5", children: [
|
|
60
49
|
/* @__PURE__ */ jsx(Tooltip_default, { content: "Insert Content", children: /* @__PURE__ */ jsx(
|
|
61
50
|
"button",
|
|
62
51
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ritext",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.27",
|
|
4
4
|
"description": "Ritext is a modern WYSIWYG rich text editor built with Tailwind CSS, powered by Tiptap. It offers a customizable UI and functional layer that lets you design your own editor controls and toolbars with clean, composable React components—no heavy UI, no extra dependencies beyond Tiptap.",
|
|
5
5
|
"homepage": "https://ritext.vercel.app/",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -87,33 +87,32 @@
|
|
|
87
87
|
"dependencies": {
|
|
88
88
|
"@floating-ui/react": "^0.27.17",
|
|
89
89
|
"@siamf/react-color-pick": "^1.5.4",
|
|
90
|
-
"@tiptap/extension-blockquote": "^3.
|
|
91
|
-
"@tiptap/extension-bold": "^3.
|
|
92
|
-
"@tiptap/extension-document": "^3.
|
|
93
|
-
"@tiptap/extension-drag-handle": "
|
|
94
|
-
"@tiptap/extension-drag-handle-react": "
|
|
95
|
-
"@tiptap/extension-emoji": "^3.
|
|
96
|
-
"@tiptap/extension-heading": "^3.
|
|
97
|
-
"@tiptap/extension-horizontal-rule": "^3.
|
|
98
|
-
"@tiptap/extension-image": "^3.
|
|
99
|
-
"@tiptap/extension-italic": "^3.
|
|
100
|
-
"@tiptap/extension-link": "^3.
|
|
101
|
-
"@tiptap/extension-list": "^3.
|
|
102
|
-
"@tiptap/extension-paragraph": "^3.
|
|
103
|
-
"@tiptap/extension-strike": "^3.
|
|
104
|
-
"@tiptap/extension-subscript": "^3.
|
|
105
|
-
"@tiptap/extension-superscript": "^3.
|
|
106
|
-
"@tiptap/extension-table": "^3.
|
|
107
|
-
"@tiptap/extension-text": "^3.
|
|
108
|
-
"@tiptap/extension-text-align": "^3.
|
|
109
|
-
"@tiptap/extension-text-style": "^3.
|
|
110
|
-
"@tiptap/extension-underline": "^3.
|
|
111
|
-
"@tiptap/extensions": "^3.
|
|
112
|
-
"@tiptap/pm": "^3.
|
|
113
|
-
"@tiptap/react": "^3.
|
|
114
|
-
"@tiptap/starter-kit": "^3.
|
|
90
|
+
"@tiptap/extension-blockquote": "^3.14.0",
|
|
91
|
+
"@tiptap/extension-bold": "^3.14.0",
|
|
92
|
+
"@tiptap/extension-document": "^3.14.0",
|
|
93
|
+
"@tiptap/extension-drag-handle": "3.14.0",
|
|
94
|
+
"@tiptap/extension-drag-handle-react": "3.14.0",
|
|
95
|
+
"@tiptap/extension-emoji": "^3.14.0",
|
|
96
|
+
"@tiptap/extension-heading": "^3.14.0",
|
|
97
|
+
"@tiptap/extension-horizontal-rule": "^3.14.0",
|
|
98
|
+
"@tiptap/extension-image": "^3.14.0",
|
|
99
|
+
"@tiptap/extension-italic": "^3.14.0",
|
|
100
|
+
"@tiptap/extension-link": "^3.14.0",
|
|
101
|
+
"@tiptap/extension-list": "^3.14.0",
|
|
102
|
+
"@tiptap/extension-paragraph": "^3.14.0",
|
|
103
|
+
"@tiptap/extension-strike": "^3.14.0",
|
|
104
|
+
"@tiptap/extension-subscript": "^3.14.0",
|
|
105
|
+
"@tiptap/extension-superscript": "^3.14.0",
|
|
106
|
+
"@tiptap/extension-table": "^3.14.0",
|
|
107
|
+
"@tiptap/extension-text": "^3.14.0",
|
|
108
|
+
"@tiptap/extension-text-align": "^3.14.0",
|
|
109
|
+
"@tiptap/extension-text-style": "^3.14.0",
|
|
110
|
+
"@tiptap/extension-underline": "^3.14.0",
|
|
111
|
+
"@tiptap/extensions": "^3.14.0",
|
|
112
|
+
"@tiptap/pm": "^3.14.0",
|
|
113
|
+
"@tiptap/react": "^3.14.0",
|
|
114
|
+
"@tiptap/starter-kit": "^3.14.0",
|
|
115
115
|
"motion": "^12.29.2",
|
|
116
|
-
"prosemirror-view": "1.41.5",
|
|
117
116
|
"react-easy-crop": "^5.5.6",
|
|
118
117
|
"tailwind-merge": "^3.4.0"
|
|
119
118
|
},
|