ritext 1.0.10 → 1.0.13

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/README.md CHANGED
@@ -11,7 +11,37 @@ Ritext is a modern WYSIWYG rich text editor built with Tailwind CSS, powered by
11
11
 
12
12
  <a href="https://www.buymeacoffee.com/siamahnaf" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
13
13
 
14
- # This is an testing phase will publish soon.
14
+ ### This is an testing phase will publish soon.
15
+
16
+ # Extension Roadmap
17
+ - [x] Starter Kit
18
+ - [x] Bold
19
+ - [x] Italic
20
+ - [x] Underline
21
+ - [x] Strike
22
+ - [ ] Subscript
23
+ - [ ] Superscript
24
+ - [ ] SubAndSuperScript
25
+ - [ ] Format Painter
26
+ - [ ] Clear Format
27
+ - [ ] Font Family
28
+ - [ ] Heading
29
+ - [ ] Fonts Size
30
+ - [ ] Undo
31
+ - [ ] Redo
32
+ - [ ] Emoji
33
+ - [ ] Color
34
+ - [ ] Highlight
35
+ - [ ] Bullet List
36
+ - [ ] Ordered List
37
+ - [ ] Alignment
38
+ - [ ] Indent
39
+ - [ ] Outdent
40
+ - [ ] Line Height
41
+ - [ ] Task List
42
+ - [ ] Image
43
+ - [ ] Link
44
+ - [ ] Blockquote
15
45
 
16
46
  # Stay in touch
17
47
 
package/dist/index.css CHANGED
@@ -226,6 +226,12 @@
226
226
  }
227
227
  }
228
228
  @layer utilities {
229
+ .flex {
230
+ display: flex;
231
+ }
232
+ .gap-x-1\.5 {
233
+ column-gap: calc(var(--spacing) * 1.5);
234
+ }
229
235
  .rounded-lg {
230
236
  border-radius: var(--radius-lg);
231
237
  }
@@ -268,6 +274,12 @@
268
274
  font-size: var(--text-sm);
269
275
  line-height: var(--tw-leading, var(--text-sm--line-height));
270
276
  }
277
+ .italic {
278
+ font-style: italic;
279
+ }
280
+ .underline {
281
+ text-decoration-line: underline;
282
+ }
271
283
  .shadow-lg {
272
284
  --tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
273
285
  box-shadow:
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode, CSSProperties } from 'react';
3
- import { Extensions, Mark } from '@tiptap/react';
3
+ import { Extensions, Editor as Editor$1, Mark } from '@tiptap/react';
4
4
  import { Placement } from '@floating-ui/react';
5
5
 
6
6
  interface Props$2 {
@@ -12,15 +12,16 @@ declare const Editor: ({ children, extensions, className }: Props$2) => react_js
12
12
 
13
13
  interface Props$1 {
14
14
  className?: string;
15
+ buttonClassName?: string;
15
16
  }
16
- declare const Toolbar: ({ className }: Props$1) => react_jsx_runtime.JSX.Element | null;
17
+ declare const Toolbar: ({ className, buttonClassName }: Props$1) => react_jsx_runtime.JSX.Element | null;
17
18
 
18
19
  interface Props {
19
20
  className?: string;
20
21
  }
21
22
  declare const Content: ({ className }: Props) => react_jsx_runtime.JSX.Element;
22
23
 
23
- type BoldOptions = {
24
+ type ExtButtonOptions = {
24
25
  className?: string;
25
26
  activeClassName?: string;
26
27
  icon?: ReactNode;
@@ -29,9 +30,22 @@ type BoldOptions = {
29
30
  tooltipClassName?: string;
30
31
  tooltipPlacement?: Placement;
31
32
  button: (args: {
32
- options: BoldOptions;
33
+ options: ExtButtonOptions;
34
+ editor: Editor$1;
35
+ buttonClassName: string;
33
36
  }) => ReactNode;
34
37
  };
35
- declare const Bold: Mark<BoldOptions, any>;
36
38
 
37
- export { Bold, Content, Editor, Toolbar };
39
+ declare const Bold: Mark<ExtButtonOptions, any>;
40
+
41
+ declare const Italic: Mark<ExtButtonOptions, any>;
42
+
43
+ declare const Underline: Mark<ExtButtonOptions, any>;
44
+
45
+ declare const Strike: Mark<ExtButtonOptions, any>;
46
+
47
+ declare const Subscript: Mark<ExtButtonOptions, any>;
48
+
49
+ declare const Superscript: Mark<ExtButtonOptions, any>;
50
+
51
+ export { Bold, Content, Editor, Italic, Strike, Subscript, Superscript, Toolbar, Underline };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode, CSSProperties } from 'react';
3
- import { Extensions, Mark } from '@tiptap/react';
3
+ import { Extensions, Editor as Editor$1, Mark } from '@tiptap/react';
4
4
  import { Placement } from '@floating-ui/react';
5
5
 
6
6
  interface Props$2 {
@@ -12,15 +12,16 @@ declare const Editor: ({ children, extensions, className }: Props$2) => react_js
12
12
 
13
13
  interface Props$1 {
14
14
  className?: string;
15
+ buttonClassName?: string;
15
16
  }
16
- declare const Toolbar: ({ className }: Props$1) => react_jsx_runtime.JSX.Element | null;
17
+ declare const Toolbar: ({ className, buttonClassName }: Props$1) => react_jsx_runtime.JSX.Element | null;
17
18
 
18
19
  interface Props {
19
20
  className?: string;
20
21
  }
21
22
  declare const Content: ({ className }: Props) => react_jsx_runtime.JSX.Element;
22
23
 
23
- type BoldOptions = {
24
+ type ExtButtonOptions = {
24
25
  className?: string;
25
26
  activeClassName?: string;
26
27
  icon?: ReactNode;
@@ -29,9 +30,22 @@ type BoldOptions = {
29
30
  tooltipClassName?: string;
30
31
  tooltipPlacement?: Placement;
31
32
  button: (args: {
32
- options: BoldOptions;
33
+ options: ExtButtonOptions;
34
+ editor: Editor$1;
35
+ buttonClassName: string;
33
36
  }) => ReactNode;
34
37
  };
35
- declare const Bold: Mark<BoldOptions, any>;
36
38
 
37
- export { Bold, Content, Editor, Toolbar };
39
+ declare const Bold: Mark<ExtButtonOptions, any>;
40
+
41
+ declare const Italic: Mark<ExtButtonOptions, any>;
42
+
43
+ declare const Underline: Mark<ExtButtonOptions, any>;
44
+
45
+ declare const Strike: Mark<ExtButtonOptions, any>;
46
+
47
+ declare const Subscript: Mark<ExtButtonOptions, any>;
48
+
49
+ declare const Superscript: Mark<ExtButtonOptions, any>;
50
+
51
+ export { Bold, Content, Editor, Italic, Strike, Subscript, Superscript, Toolbar, Underline };
package/dist/index.js CHANGED
@@ -62,7 +62,12 @@ __export(index_exports, {
62
62
  Bold: () => Bold,
63
63
  Content: () => Content_default,
64
64
  Editor: () => Editor_default,
65
- Toolbar: () => Toolbar_default
65
+ Italic: () => Italic,
66
+ Strike: () => Strike,
67
+ Subscript: () => Subscript,
68
+ Superscript: () => Superscript,
69
+ Toolbar: () => Toolbar_default,
70
+ Underline: () => Underline
66
71
  });
67
72
  module.exports = __toCommonJS(index_exports);
68
73
 
@@ -102,17 +107,17 @@ var Editor_default = Editor;
102
107
  var React = __toESM(require("react"));
103
108
  var import_tailwind_merge = require("tailwind-merge");
104
109
  var import_jsx_runtime3 = require("react/jsx-runtime");
105
- var Toolbar = ({ className }) => {
110
+ var Toolbar = ({ className, buttonClassName }) => {
106
111
  const { editor } = useEditor();
107
112
  if (!editor) return null;
108
113
  const entries = editor.extensionManager.extensions.map((ext) => {
109
114
  var _a, _b, _c;
110
115
  const anyExt = ext;
111
116
  const renderButton = ((_a = anyExt.options) == null ? void 0 : _a.button) || ((_c = (_b = anyExt.options) == null ? void 0 : _b.ui) == null ? void 0 : _c.button);
112
- return renderButton ? { name: anyExt.name, renderButton, options: anyExt.options } : null;
117
+ return renderButton ? { name: anyExt.name, renderButton, options: anyExt.options, buttonClassName: anyExt.buttonClassName } : null;
113
118
  }).filter(Boolean);
114
119
  if (!entries.length) return null;
115
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: (0, import_tailwind_merge.twMerge)("", className), children: entries.map(({ name, renderButton, options }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(React.Fragment, { children: renderButton({ editor, options }) }, name)) });
120
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: (0, import_tailwind_merge.twMerge)("flex gap-x-1.5", className), children: entries.map(({ name, renderButton, options }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(React.Fragment, { children: renderButton({ editor, options, buttonClassName: buttonClassName || "" }) }, name)) });
116
121
  };
117
122
  var Toolbar_default = Toolbar;
118
123
 
@@ -129,19 +134,10 @@ var Content_default = Content;
129
134
  // src/lib/extensions/Bold.tsx
130
135
  var import_extension_bold = __toESM(require("@tiptap/extension-bold"));
131
136
 
132
- // src/lib/components/BoldComponent.tsx
133
- var import_tailwind_merge4 = require("tailwind-merge");
134
-
135
137
  // src/lib/icon/BoldIcon.tsx
136
138
  var import_jsx_runtime5 = require("react/jsx-runtime");
137
139
  var BoldIcon = (_a) => {
138
- var _b = _a, {
139
- size = 17,
140
- className
141
- } = _b, props = __objRest(_b, [
142
- "size",
143
- "className"
144
- ]);
140
+ var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
145
141
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
146
142
  "svg",
147
143
  __spreadProps(__spreadValues({
@@ -162,6 +158,9 @@ var BoldIcon = (_a) => {
162
158
  };
163
159
  var BoldIcon_default = BoldIcon;
164
160
 
161
+ // src/lib/components/ButtonComponent.tsx
162
+ var import_tailwind_merge4 = require("tailwind-merge");
163
+
165
164
  // src/lib/components/_com/Tooltip.tsx
166
165
  var import_react5 = require("react");
167
166
  var import_react6 = require("@floating-ui/react");
@@ -242,32 +241,33 @@ var Tooltip = ({ placement = "top", children, content, className }) => {
242
241
  };
243
242
  var Tooltip_default = Tooltip;
244
243
 
245
- // src/lib/components/BoldComponent.tsx
244
+ // src/lib/components/ButtonComponent.tsx
246
245
  var import_react8 = require("@tiptap/react");
247
246
  var import_jsx_runtime7 = require("react/jsx-runtime");
248
- var BoldComponent = ({ className, activeClassName, icon, style, tooltip = true, tooltipClassName, tooltipPlacement }) => {
247
+ var ButtonComponent = ({ className, activeClassName, icon, style, tooltip = true, tooltipClassName, tooltipPlacement, _extName, _internalIcon, _tooltipContent, _onToggle, _interShortcut, _buttonClassName }) => {
249
248
  const { editor } = useEditor();
250
249
  const editorState = (0, import_react8.useEditorState)({
251
250
  editor,
252
- selector: ({ editor: editor2 }) => ({ isActive: (editor2 == null ? void 0 : editor2.isActive("bold")) || false })
251
+ selector: ({ editor: editor2 }) => ({ isActive: (editor2 == null ? void 0 : editor2.isActive(_extName)) || false })
253
252
  });
254
253
  const tooltipContent = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { children: [
255
- typeof tooltip === "string" ? tooltip : "Bold",
254
+ typeof tooltip === "string" ? tooltip : _tooltipContent,
256
255
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("br", {}),
257
- "\u2318 + B"
256
+ _interShortcut
258
257
  ] });
259
258
  const btn = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
260
259
  "button",
261
260
  {
262
- onClick: () => editor == null ? void 0 : editor.chain().focus().toggleBold().run(),
261
+ onClick: _onToggle,
263
262
  className: (0, import_tailwind_merge4.twMerge)(
264
263
  "p-1.5 rounded-md",
264
+ _buttonClassName,
265
265
  (editorState == null ? void 0 : editorState.isActive) ? "bg-gray-200" : "hover:bg-gray-100",
266
266
  className,
267
267
  (editorState == null ? void 0 : editorState.isActive) ? activeClassName : "hover:bg-gray-100"
268
268
  ),
269
269
  style,
270
- children: icon != null ? icon : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(BoldIcon_default, {})
270
+ children: icon != null ? icon : _internalIcon
271
271
  }
272
272
  );
273
273
  if (tooltip === false) return btn;
@@ -281,7 +281,7 @@ var BoldComponent = ({ className, activeClassName, icon, style, tooltip = true,
281
281
  }
282
282
  );
283
283
  };
284
- var BoldComponent_default = BoldComponent;
284
+ var ButtonComponent_default = ButtonComponent;
285
285
 
286
286
  // src/lib/extensions/Bold.tsx
287
287
  var import_jsx_runtime8 = require("react/jsx-runtime");
@@ -289,9 +289,313 @@ var Bold = import_extension_bold.default.extend({
289
289
  addOptions() {
290
290
  var _a;
291
291
  return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
292
- button: ({ options }) => {
292
+ button: ({ editor, options, buttonClassName }) => {
293
293
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
294
- BoldComponent_default,
294
+ ButtonComponent_default,
295
+ {
296
+ className: options.className,
297
+ icon: options.icon,
298
+ style: options.style,
299
+ activeClassName: options.activeClassName,
300
+ tooltip: options.tooltip,
301
+ tooltipClassName: options.tooltipClassName,
302
+ tooltipPlacement: options.tooltipPlacement,
303
+ _internalIcon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BoldIcon_default, {}),
304
+ _extName: "bold",
305
+ _onToggle: () => editor.chain().focus().toggleBold().run(),
306
+ _interShortcut: "\u2318 + B",
307
+ _tooltipContent: "Bold",
308
+ _buttonClassName: buttonClassName
309
+ }
310
+ );
311
+ }
312
+ });
313
+ }
314
+ });
315
+
316
+ // src/lib/extensions/Italic.tsx
317
+ var import_extension_italic = __toESM(require("@tiptap/extension-italic"));
318
+
319
+ // src/lib/icon/ItalicIcon.tsx
320
+ var import_jsx_runtime9 = require("react/jsx-runtime");
321
+ var ItalicIcon = (_a) => {
322
+ var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
323
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
324
+ "svg",
325
+ __spreadProps(__spreadValues({
326
+ xmlns: "http://www.w3.org/2000/svg",
327
+ viewBox: "0 0 24 24",
328
+ fill: "none",
329
+ stroke: "currentColor",
330
+ strokeWidth: 2,
331
+ strokeLinecap: "round",
332
+ strokeLinejoin: "round",
333
+ width: size,
334
+ height: size,
335
+ className
336
+ }, props), {
337
+ children: [
338
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("line", { x1: "19", x2: "10", y1: "4", y2: "4" }),
339
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("line", { x1: "14", x2: "5", y1: "20", y2: "20" }),
340
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("line", { x1: "15", x2: "9", y1: "4", y2: "20" })
341
+ ]
342
+ })
343
+ );
344
+ };
345
+ var ItalicIcon_default = ItalicIcon;
346
+
347
+ // src/lib/extensions/Italic.tsx
348
+ var import_jsx_runtime10 = require("react/jsx-runtime");
349
+ var Italic = import_extension_italic.default.extend({
350
+ addOptions() {
351
+ var _a;
352
+ return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
353
+ button: ({ options, editor, buttonClassName }) => {
354
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
355
+ ButtonComponent_default,
356
+ {
357
+ className: options.className,
358
+ icon: options.icon,
359
+ style: options.style,
360
+ activeClassName: options.activeClassName,
361
+ tooltip: options.tooltip,
362
+ tooltipClassName: options.tooltipClassName,
363
+ tooltipPlacement: options.tooltipPlacement,
364
+ _internalIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ItalicIcon_default, {}),
365
+ _extName: "italic",
366
+ _onToggle: () => editor.chain().focus().toggleItalic().run(),
367
+ _interShortcut: "\u2318 + I",
368
+ _tooltipContent: "Italic",
369
+ _buttonClassName: buttonClassName
370
+ }
371
+ );
372
+ }
373
+ });
374
+ }
375
+ });
376
+
377
+ // src/lib/extensions/Underline.tsx
378
+ var import_extension_underline = __toESM(require("@tiptap/extension-underline"));
379
+
380
+ // src/lib/icon/UnderIcon.tsx
381
+ var import_jsx_runtime11 = require("react/jsx-runtime");
382
+ var UnderIcon = (_a) => {
383
+ var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
384
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
385
+ "svg",
386
+ __spreadProps(__spreadValues({
387
+ xmlns: "http://www.w3.org/2000/svg",
388
+ viewBox: "0 0 24 24",
389
+ fill: "none",
390
+ stroke: "currentColor",
391
+ strokeWidth: 2,
392
+ strokeLinecap: "round",
393
+ strokeLinejoin: "round",
394
+ width: size,
395
+ height: size,
396
+ className
397
+ }, props), {
398
+ children: [
399
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }),
400
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "4", x2: "20", y1: "20", y2: "20" })
401
+ ]
402
+ })
403
+ );
404
+ };
405
+ var UnderIcon_default = UnderIcon;
406
+
407
+ // src/lib/extensions/Underline.tsx
408
+ var import_jsx_runtime12 = require("react/jsx-runtime");
409
+ var Underline = import_extension_underline.default.extend({
410
+ addOptions() {
411
+ var _a;
412
+ return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
413
+ button: ({ options, editor, buttonClassName }) => {
414
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
415
+ ButtonComponent_default,
416
+ {
417
+ className: options.className,
418
+ icon: options.icon,
419
+ style: options.style,
420
+ activeClassName: options.activeClassName,
421
+ tooltip: options.tooltip,
422
+ tooltipClassName: options.tooltipClassName,
423
+ tooltipPlacement: options.tooltipPlacement,
424
+ _internalIcon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(UnderIcon_default, {}),
425
+ _extName: "underline",
426
+ _onToggle: () => editor.chain().focus().toggleUnderline().run(),
427
+ _interShortcut: "\u2318 + U",
428
+ _tooltipContent: "Underline",
429
+ _buttonClassName: buttonClassName
430
+ }
431
+ );
432
+ }
433
+ });
434
+ }
435
+ });
436
+
437
+ // src/lib/extensions/Strike.tsx
438
+ var import_extension_strike = __toESM(require("@tiptap/extension-strike"));
439
+
440
+ // src/lib/icon/StrikeIcon.tsx
441
+ var import_jsx_runtime13 = require("react/jsx-runtime");
442
+ var StrikeIcon = (_a) => {
443
+ var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
444
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
445
+ "svg",
446
+ __spreadProps(__spreadValues({
447
+ xmlns: "http://www.w3.org/2000/svg",
448
+ viewBox: "0 0 24 24",
449
+ fill: "none",
450
+ stroke: "currentColor",
451
+ strokeWidth: 2,
452
+ strokeLinecap: "round",
453
+ strokeLinejoin: "round",
454
+ width: size,
455
+ height: size,
456
+ className
457
+ }, props), {
458
+ children: [
459
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M16 4H9a3 3 0 0 0-2.83 4" }),
460
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M14 12a4 4 0 0 1 0 8H6" }),
461
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("line", { x1: "4", x2: "20", y1: "12", y2: "12" })
462
+ ]
463
+ })
464
+ );
465
+ };
466
+ var StrikeIcon_default = StrikeIcon;
467
+
468
+ // src/lib/extensions/Strike.tsx
469
+ var import_jsx_runtime14 = require("react/jsx-runtime");
470
+ var Strike = import_extension_strike.default.extend({
471
+ addOptions() {
472
+ var _a;
473
+ return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
474
+ button: ({ options, editor, buttonClassName }) => {
475
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
476
+ ButtonComponent_default,
477
+ {
478
+ className: options.className,
479
+ icon: options.icon,
480
+ style: options.style,
481
+ activeClassName: options.activeClassName,
482
+ tooltip: options.tooltip,
483
+ tooltipClassName: options.tooltipClassName,
484
+ tooltipPlacement: options.tooltipPlacement,
485
+ _internalIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(StrikeIcon_default, {}),
486
+ _extName: "strike",
487
+ _onToggle: () => editor.chain().focus().toggleStrike().run(),
488
+ _interShortcut: "\u2318 \u21E7 S",
489
+ _tooltipContent: "Strike",
490
+ _buttonClassName: buttonClassName
491
+ }
492
+ );
493
+ }
494
+ });
495
+ }
496
+ });
497
+
498
+ // src/lib/extensions/Subscript.tsx
499
+ var import_extension_subscript = __toESM(require("@tiptap/extension-subscript"));
500
+
501
+ // src/lib/icon/SubIcon.tsx
502
+ var import_jsx_runtime15 = require("react/jsx-runtime");
503
+ var SubIcon = (_a) => {
504
+ var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
505
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
506
+ "svg",
507
+ __spreadProps(__spreadValues({
508
+ xmlns: "http://www.w3.org/2000/svg",
509
+ viewBox: "0 0 24 24",
510
+ fill: "none",
511
+ stroke: "currentColor",
512
+ strokeWidth: 2,
513
+ strokeLinecap: "round",
514
+ strokeLinejoin: "round",
515
+ width: size,
516
+ height: size,
517
+ className
518
+ }, props), {
519
+ children: [
520
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "m4 5 8 8" }),
521
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "m12 5-8 8" }),
522
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07" })
523
+ ]
524
+ })
525
+ );
526
+ };
527
+ var SubIcon_default = SubIcon;
528
+
529
+ // src/lib/extensions/Subscript.tsx
530
+ var import_jsx_runtime16 = require("react/jsx-runtime");
531
+ var Subscript = import_extension_subscript.default.extend({
532
+ addOptions() {
533
+ var _a;
534
+ return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
535
+ button: ({ options, editor, buttonClassName }) => {
536
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
537
+ ButtonComponent_default,
538
+ {
539
+ className: options.className,
540
+ icon: options.icon,
541
+ style: options.style,
542
+ activeClassName: options.activeClassName,
543
+ tooltip: options.tooltip,
544
+ tooltipClassName: options.tooltipClassName,
545
+ tooltipPlacement: options.tooltipPlacement,
546
+ _internalIcon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SubIcon_default, {}),
547
+ _extName: "subscript",
548
+ _onToggle: () => editor.chain().focus().toggleSubscript().run(),
549
+ _interShortcut: "\u2318 + ,",
550
+ _tooltipContent: "Subscript",
551
+ _buttonClassName: buttonClassName
552
+ }
553
+ );
554
+ }
555
+ });
556
+ }
557
+ });
558
+
559
+ // src/lib/extensions/Superscript.tsx
560
+ var import_extension_superscript = __toESM(require("@tiptap/extension-superscript"));
561
+
562
+ // src/lib/icon/SupIcon.tsx
563
+ var import_jsx_runtime17 = require("react/jsx-runtime");
564
+ var SupIcon = (_a) => {
565
+ var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
566
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
567
+ "svg",
568
+ __spreadProps(__spreadValues({
569
+ xmlns: "http://www.w3.org/2000/svg",
570
+ viewBox: "0 0 24 24",
571
+ fill: "none",
572
+ stroke: "currentColor",
573
+ strokeWidth: 2,
574
+ strokeLinecap: "round",
575
+ strokeLinejoin: "round",
576
+ width: size,
577
+ height: size,
578
+ className
579
+ }, props), {
580
+ children: [
581
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "m4 19 8-8" }),
582
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "m12 19-8-8" }),
583
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06" })
584
+ ]
585
+ })
586
+ );
587
+ };
588
+ var SupIcon_default = SupIcon;
589
+
590
+ // src/lib/extensions/Superscript.tsx
591
+ var import_jsx_runtime18 = require("react/jsx-runtime");
592
+ var Superscript = import_extension_superscript.default.extend({
593
+ addOptions() {
594
+ var _a;
595
+ return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
596
+ button: ({ options, editor, buttonClassName }) => {
597
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
598
+ ButtonComponent_default,
295
599
  {
296
600
  className: options.className,
297
601
  icon: options.icon,
@@ -299,7 +603,13 @@ var Bold = import_extension_bold.default.extend({
299
603
  activeClassName: options.activeClassName,
300
604
  tooltip: options.tooltip,
301
605
  tooltipClassName: options.tooltipClassName,
302
- tooltipPlacement: options.tooltipPlacement
606
+ tooltipPlacement: options.tooltipPlacement,
607
+ _internalIcon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SupIcon_default, {}),
608
+ _extName: "superscript",
609
+ _onToggle: () => editor.chain().focus().toggleSuperscript().run(),
610
+ _interShortcut: "\u2318 + ,",
611
+ _tooltipContent: "Superscript",
612
+ _buttonClassName: buttonClassName
303
613
  }
304
614
  );
305
615
  }
@@ -311,5 +621,10 @@ var Bold = import_extension_bold.default.extend({
311
621
  Bold,
312
622
  Content,
313
623
  Editor,
314
- Toolbar
624
+ Italic,
625
+ Strike,
626
+ Subscript,
627
+ Superscript,
628
+ Toolbar,
629
+ Underline
315
630
  });
package/dist/index.mjs CHANGED
@@ -66,17 +66,17 @@ var Editor_default = Editor;
66
66
  import * as React from "react";
67
67
  import { twMerge } from "tailwind-merge";
68
68
  import { jsx as jsx3 } from "react/jsx-runtime";
69
- var Toolbar = ({ className }) => {
69
+ var Toolbar = ({ className, buttonClassName }) => {
70
70
  const { editor } = useEditor();
71
71
  if (!editor) return null;
72
72
  const entries = editor.extensionManager.extensions.map((ext) => {
73
73
  var _a, _b, _c;
74
74
  const anyExt = ext;
75
75
  const renderButton = ((_a = anyExt.options) == null ? void 0 : _a.button) || ((_c = (_b = anyExt.options) == null ? void 0 : _b.ui) == null ? void 0 : _c.button);
76
- return renderButton ? { name: anyExt.name, renderButton, options: anyExt.options } : null;
76
+ return renderButton ? { name: anyExt.name, renderButton, options: anyExt.options, buttonClassName: anyExt.buttonClassName } : null;
77
77
  }).filter(Boolean);
78
78
  if (!entries.length) return null;
79
- return /* @__PURE__ */ jsx3("div", { className: twMerge("", className), children: entries.map(({ name, renderButton, options }) => /* @__PURE__ */ jsx3(React.Fragment, { children: renderButton({ editor, options }) }, name)) });
79
+ return /* @__PURE__ */ jsx3("div", { className: twMerge("flex gap-x-1.5", className), children: entries.map(({ name, renderButton, options }) => /* @__PURE__ */ jsx3(React.Fragment, { children: renderButton({ editor, options, buttonClassName: buttonClassName || "" }) }, name)) });
80
80
  };
81
81
  var Toolbar_default = Toolbar;
82
82
 
@@ -93,19 +93,10 @@ var Content_default = Content;
93
93
  // src/lib/extensions/Bold.tsx
94
94
  import TiptapBold from "@tiptap/extension-bold";
95
95
 
96
- // src/lib/components/BoldComponent.tsx
97
- import { twMerge as twMerge4 } from "tailwind-merge";
98
-
99
96
  // src/lib/icon/BoldIcon.tsx
100
97
  import { jsx as jsx5 } from "react/jsx-runtime";
101
98
  var BoldIcon = (_a) => {
102
- var _b = _a, {
103
- size = 17,
104
- className
105
- } = _b, props = __objRest(_b, [
106
- "size",
107
- "className"
108
- ]);
99
+ var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
109
100
  return /* @__PURE__ */ jsx5(
110
101
  "svg",
111
102
  __spreadProps(__spreadValues({
@@ -126,6 +117,9 @@ var BoldIcon = (_a) => {
126
117
  };
127
118
  var BoldIcon_default = BoldIcon;
128
119
 
120
+ // src/lib/components/ButtonComponent.tsx
121
+ import { twMerge as twMerge4 } from "tailwind-merge";
122
+
129
123
  // src/lib/components/_com/Tooltip.tsx
130
124
  import { useState, Fragment as Fragment2, cloneElement, isValidElement, useId } from "react";
131
125
  import { useFloating, offset, flip, shift, autoUpdate, useInteractions, useHover, useDismiss, FloatingPortal } from "@floating-ui/react";
@@ -206,32 +200,33 @@ var Tooltip = ({ placement = "top", children, content, className }) => {
206
200
  };
207
201
  var Tooltip_default = Tooltip;
208
202
 
209
- // src/lib/components/BoldComponent.tsx
203
+ // src/lib/components/ButtonComponent.tsx
210
204
  import { useEditorState } from "@tiptap/react";
211
205
  import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
212
- var BoldComponent = ({ className, activeClassName, icon, style, tooltip = true, tooltipClassName, tooltipPlacement }) => {
206
+ var ButtonComponent = ({ className, activeClassName, icon, style, tooltip = true, tooltipClassName, tooltipPlacement, _extName, _internalIcon, _tooltipContent, _onToggle, _interShortcut, _buttonClassName }) => {
213
207
  const { editor } = useEditor();
214
208
  const editorState = useEditorState({
215
209
  editor,
216
- selector: ({ editor: editor2 }) => ({ isActive: (editor2 == null ? void 0 : editor2.isActive("bold")) || false })
210
+ selector: ({ editor: editor2 }) => ({ isActive: (editor2 == null ? void 0 : editor2.isActive(_extName)) || false })
217
211
  });
218
212
  const tooltipContent = /* @__PURE__ */ jsxs2("p", { children: [
219
- typeof tooltip === "string" ? tooltip : "Bold",
213
+ typeof tooltip === "string" ? tooltip : _tooltipContent,
220
214
  /* @__PURE__ */ jsx7("br", {}),
221
- "\u2318 + B"
215
+ _interShortcut
222
216
  ] });
223
217
  const btn = /* @__PURE__ */ jsx7(
224
218
  "button",
225
219
  {
226
- onClick: () => editor == null ? void 0 : editor.chain().focus().toggleBold().run(),
220
+ onClick: _onToggle,
227
221
  className: twMerge4(
228
222
  "p-1.5 rounded-md",
223
+ _buttonClassName,
229
224
  (editorState == null ? void 0 : editorState.isActive) ? "bg-gray-200" : "hover:bg-gray-100",
230
225
  className,
231
226
  (editorState == null ? void 0 : editorState.isActive) ? activeClassName : "hover:bg-gray-100"
232
227
  ),
233
228
  style,
234
- children: icon != null ? icon : /* @__PURE__ */ jsx7(BoldIcon_default, {})
229
+ children: icon != null ? icon : _internalIcon
235
230
  }
236
231
  );
237
232
  if (tooltip === false) return btn;
@@ -245,7 +240,7 @@ var BoldComponent = ({ className, activeClassName, icon, style, tooltip = true,
245
240
  }
246
241
  );
247
242
  };
248
- var BoldComponent_default = BoldComponent;
243
+ var ButtonComponent_default = ButtonComponent;
249
244
 
250
245
  // src/lib/extensions/Bold.tsx
251
246
  import { jsx as jsx8 } from "react/jsx-runtime";
@@ -253,9 +248,313 @@ var Bold = TiptapBold.extend({
253
248
  addOptions() {
254
249
  var _a;
255
250
  return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
256
- button: ({ options }) => {
251
+ button: ({ editor, options, buttonClassName }) => {
257
252
  return /* @__PURE__ */ jsx8(
258
- BoldComponent_default,
253
+ ButtonComponent_default,
254
+ {
255
+ className: options.className,
256
+ icon: options.icon,
257
+ style: options.style,
258
+ activeClassName: options.activeClassName,
259
+ tooltip: options.tooltip,
260
+ tooltipClassName: options.tooltipClassName,
261
+ tooltipPlacement: options.tooltipPlacement,
262
+ _internalIcon: /* @__PURE__ */ jsx8(BoldIcon_default, {}),
263
+ _extName: "bold",
264
+ _onToggle: () => editor.chain().focus().toggleBold().run(),
265
+ _interShortcut: "\u2318 + B",
266
+ _tooltipContent: "Bold",
267
+ _buttonClassName: buttonClassName
268
+ }
269
+ );
270
+ }
271
+ });
272
+ }
273
+ });
274
+
275
+ // src/lib/extensions/Italic.tsx
276
+ import TiptapItalic from "@tiptap/extension-italic";
277
+
278
+ // src/lib/icon/ItalicIcon.tsx
279
+ import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
280
+ var ItalicIcon = (_a) => {
281
+ var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
282
+ return /* @__PURE__ */ jsxs3(
283
+ "svg",
284
+ __spreadProps(__spreadValues({
285
+ xmlns: "http://www.w3.org/2000/svg",
286
+ viewBox: "0 0 24 24",
287
+ fill: "none",
288
+ stroke: "currentColor",
289
+ strokeWidth: 2,
290
+ strokeLinecap: "round",
291
+ strokeLinejoin: "round",
292
+ width: size,
293
+ height: size,
294
+ className
295
+ }, props), {
296
+ children: [
297
+ /* @__PURE__ */ jsx9("line", { x1: "19", x2: "10", y1: "4", y2: "4" }),
298
+ /* @__PURE__ */ jsx9("line", { x1: "14", x2: "5", y1: "20", y2: "20" }),
299
+ /* @__PURE__ */ jsx9("line", { x1: "15", x2: "9", y1: "4", y2: "20" })
300
+ ]
301
+ })
302
+ );
303
+ };
304
+ var ItalicIcon_default = ItalicIcon;
305
+
306
+ // src/lib/extensions/Italic.tsx
307
+ import { jsx as jsx10 } from "react/jsx-runtime";
308
+ var Italic = TiptapItalic.extend({
309
+ addOptions() {
310
+ var _a;
311
+ return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
312
+ button: ({ options, editor, buttonClassName }) => {
313
+ return /* @__PURE__ */ jsx10(
314
+ ButtonComponent_default,
315
+ {
316
+ className: options.className,
317
+ icon: options.icon,
318
+ style: options.style,
319
+ activeClassName: options.activeClassName,
320
+ tooltip: options.tooltip,
321
+ tooltipClassName: options.tooltipClassName,
322
+ tooltipPlacement: options.tooltipPlacement,
323
+ _internalIcon: /* @__PURE__ */ jsx10(ItalicIcon_default, {}),
324
+ _extName: "italic",
325
+ _onToggle: () => editor.chain().focus().toggleItalic().run(),
326
+ _interShortcut: "\u2318 + I",
327
+ _tooltipContent: "Italic",
328
+ _buttonClassName: buttonClassName
329
+ }
330
+ );
331
+ }
332
+ });
333
+ }
334
+ });
335
+
336
+ // src/lib/extensions/Underline.tsx
337
+ import TiptapUnder from "@tiptap/extension-underline";
338
+
339
+ // src/lib/icon/UnderIcon.tsx
340
+ import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
341
+ var UnderIcon = (_a) => {
342
+ var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
343
+ return /* @__PURE__ */ jsxs4(
344
+ "svg",
345
+ __spreadProps(__spreadValues({
346
+ xmlns: "http://www.w3.org/2000/svg",
347
+ viewBox: "0 0 24 24",
348
+ fill: "none",
349
+ stroke: "currentColor",
350
+ strokeWidth: 2,
351
+ strokeLinecap: "round",
352
+ strokeLinejoin: "round",
353
+ width: size,
354
+ height: size,
355
+ className
356
+ }, props), {
357
+ children: [
358
+ /* @__PURE__ */ jsx11("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }),
359
+ /* @__PURE__ */ jsx11("line", { x1: "4", x2: "20", y1: "20", y2: "20" })
360
+ ]
361
+ })
362
+ );
363
+ };
364
+ var UnderIcon_default = UnderIcon;
365
+
366
+ // src/lib/extensions/Underline.tsx
367
+ import { jsx as jsx12 } from "react/jsx-runtime";
368
+ var Underline = TiptapUnder.extend({
369
+ addOptions() {
370
+ var _a;
371
+ return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
372
+ button: ({ options, editor, buttonClassName }) => {
373
+ return /* @__PURE__ */ jsx12(
374
+ ButtonComponent_default,
375
+ {
376
+ className: options.className,
377
+ icon: options.icon,
378
+ style: options.style,
379
+ activeClassName: options.activeClassName,
380
+ tooltip: options.tooltip,
381
+ tooltipClassName: options.tooltipClassName,
382
+ tooltipPlacement: options.tooltipPlacement,
383
+ _internalIcon: /* @__PURE__ */ jsx12(UnderIcon_default, {}),
384
+ _extName: "underline",
385
+ _onToggle: () => editor.chain().focus().toggleUnderline().run(),
386
+ _interShortcut: "\u2318 + U",
387
+ _tooltipContent: "Underline",
388
+ _buttonClassName: buttonClassName
389
+ }
390
+ );
391
+ }
392
+ });
393
+ }
394
+ });
395
+
396
+ // src/lib/extensions/Strike.tsx
397
+ import TiptapStrike from "@tiptap/extension-strike";
398
+
399
+ // src/lib/icon/StrikeIcon.tsx
400
+ import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
401
+ var StrikeIcon = (_a) => {
402
+ var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
403
+ return /* @__PURE__ */ jsxs5(
404
+ "svg",
405
+ __spreadProps(__spreadValues({
406
+ xmlns: "http://www.w3.org/2000/svg",
407
+ viewBox: "0 0 24 24",
408
+ fill: "none",
409
+ stroke: "currentColor",
410
+ strokeWidth: 2,
411
+ strokeLinecap: "round",
412
+ strokeLinejoin: "round",
413
+ width: size,
414
+ height: size,
415
+ className
416
+ }, props), {
417
+ children: [
418
+ /* @__PURE__ */ jsx13("path", { d: "M16 4H9a3 3 0 0 0-2.83 4" }),
419
+ /* @__PURE__ */ jsx13("path", { d: "M14 12a4 4 0 0 1 0 8H6" }),
420
+ /* @__PURE__ */ jsx13("line", { x1: "4", x2: "20", y1: "12", y2: "12" })
421
+ ]
422
+ })
423
+ );
424
+ };
425
+ var StrikeIcon_default = StrikeIcon;
426
+
427
+ // src/lib/extensions/Strike.tsx
428
+ import { jsx as jsx14 } from "react/jsx-runtime";
429
+ var Strike = TiptapStrike.extend({
430
+ addOptions() {
431
+ var _a;
432
+ return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
433
+ button: ({ options, editor, buttonClassName }) => {
434
+ return /* @__PURE__ */ jsx14(
435
+ ButtonComponent_default,
436
+ {
437
+ className: options.className,
438
+ icon: options.icon,
439
+ style: options.style,
440
+ activeClassName: options.activeClassName,
441
+ tooltip: options.tooltip,
442
+ tooltipClassName: options.tooltipClassName,
443
+ tooltipPlacement: options.tooltipPlacement,
444
+ _internalIcon: /* @__PURE__ */ jsx14(StrikeIcon_default, {}),
445
+ _extName: "strike",
446
+ _onToggle: () => editor.chain().focus().toggleStrike().run(),
447
+ _interShortcut: "\u2318 \u21E7 S",
448
+ _tooltipContent: "Strike",
449
+ _buttonClassName: buttonClassName
450
+ }
451
+ );
452
+ }
453
+ });
454
+ }
455
+ });
456
+
457
+ // src/lib/extensions/Subscript.tsx
458
+ import TiptapSubscript from "@tiptap/extension-subscript";
459
+
460
+ // src/lib/icon/SubIcon.tsx
461
+ import { jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
462
+ var SubIcon = (_a) => {
463
+ var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
464
+ return /* @__PURE__ */ jsxs6(
465
+ "svg",
466
+ __spreadProps(__spreadValues({
467
+ xmlns: "http://www.w3.org/2000/svg",
468
+ viewBox: "0 0 24 24",
469
+ fill: "none",
470
+ stroke: "currentColor",
471
+ strokeWidth: 2,
472
+ strokeLinecap: "round",
473
+ strokeLinejoin: "round",
474
+ width: size,
475
+ height: size,
476
+ className
477
+ }, props), {
478
+ children: [
479
+ /* @__PURE__ */ jsx15("path", { d: "m4 5 8 8" }),
480
+ /* @__PURE__ */ jsx15("path", { d: "m12 5-8 8" }),
481
+ /* @__PURE__ */ jsx15("path", { d: "M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07" })
482
+ ]
483
+ })
484
+ );
485
+ };
486
+ var SubIcon_default = SubIcon;
487
+
488
+ // src/lib/extensions/Subscript.tsx
489
+ import { jsx as jsx16 } from "react/jsx-runtime";
490
+ var Subscript = TiptapSubscript.extend({
491
+ addOptions() {
492
+ var _a;
493
+ return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
494
+ button: ({ options, editor, buttonClassName }) => {
495
+ return /* @__PURE__ */ jsx16(
496
+ ButtonComponent_default,
497
+ {
498
+ className: options.className,
499
+ icon: options.icon,
500
+ style: options.style,
501
+ activeClassName: options.activeClassName,
502
+ tooltip: options.tooltip,
503
+ tooltipClassName: options.tooltipClassName,
504
+ tooltipPlacement: options.tooltipPlacement,
505
+ _internalIcon: /* @__PURE__ */ jsx16(SubIcon_default, {}),
506
+ _extName: "subscript",
507
+ _onToggle: () => editor.chain().focus().toggleSubscript().run(),
508
+ _interShortcut: "\u2318 + ,",
509
+ _tooltipContent: "Subscript",
510
+ _buttonClassName: buttonClassName
511
+ }
512
+ );
513
+ }
514
+ });
515
+ }
516
+ });
517
+
518
+ // src/lib/extensions/Superscript.tsx
519
+ import TiptapSuperscript from "@tiptap/extension-superscript";
520
+
521
+ // src/lib/icon/SupIcon.tsx
522
+ import { jsx as jsx17, jsxs as jsxs7 } from "react/jsx-runtime";
523
+ var SupIcon = (_a) => {
524
+ var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
525
+ return /* @__PURE__ */ jsxs7(
526
+ "svg",
527
+ __spreadProps(__spreadValues({
528
+ xmlns: "http://www.w3.org/2000/svg",
529
+ viewBox: "0 0 24 24",
530
+ fill: "none",
531
+ stroke: "currentColor",
532
+ strokeWidth: 2,
533
+ strokeLinecap: "round",
534
+ strokeLinejoin: "round",
535
+ width: size,
536
+ height: size,
537
+ className
538
+ }, props), {
539
+ children: [
540
+ /* @__PURE__ */ jsx17("path", { d: "m4 19 8-8" }),
541
+ /* @__PURE__ */ jsx17("path", { d: "m12 19-8-8" }),
542
+ /* @__PURE__ */ jsx17("path", { d: "M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06" })
543
+ ]
544
+ })
545
+ );
546
+ };
547
+ var SupIcon_default = SupIcon;
548
+
549
+ // src/lib/extensions/Superscript.tsx
550
+ import { jsx as jsx18 } from "react/jsx-runtime";
551
+ var Superscript = TiptapSuperscript.extend({
552
+ addOptions() {
553
+ var _a;
554
+ return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
555
+ button: ({ options, editor, buttonClassName }) => {
556
+ return /* @__PURE__ */ jsx18(
557
+ ButtonComponent_default,
259
558
  {
260
559
  className: options.className,
261
560
  icon: options.icon,
@@ -263,7 +562,13 @@ var Bold = TiptapBold.extend({
263
562
  activeClassName: options.activeClassName,
264
563
  tooltip: options.tooltip,
265
564
  tooltipClassName: options.tooltipClassName,
266
- tooltipPlacement: options.tooltipPlacement
565
+ tooltipPlacement: options.tooltipPlacement,
566
+ _internalIcon: /* @__PURE__ */ jsx18(SupIcon_default, {}),
567
+ _extName: "superscript",
568
+ _onToggle: () => editor.chain().focus().toggleSuperscript().run(),
569
+ _interShortcut: "\u2318 + ,",
570
+ _tooltipContent: "Superscript",
571
+ _buttonClassName: buttonClassName
267
572
  }
268
573
  );
269
574
  }
@@ -274,5 +579,10 @@ export {
274
579
  Bold,
275
580
  Content_default as Content,
276
581
  Editor_default as Editor,
277
- Toolbar_default as Toolbar
582
+ Italic,
583
+ Strike,
584
+ Subscript,
585
+ Superscript,
586
+ Toolbar_default as Toolbar,
587
+ Underline
278
588
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ritext",
3
- "version": "1.0.10",
3
+ "version": "1.0.13",
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",
@@ -54,19 +54,23 @@
54
54
  "react-dom": "^19.2.0",
55
55
  "tailwindcss": "^4.1.16",
56
56
  "tsup": "^8.5.0",
57
- "turbo": "^2.5.8",
57
+ "turbo": "^2.6.0",
58
58
  "typescript": "^5.9.3"
59
59
  },
60
60
  "dependencies": {
61
61
  "@floating-ui/react": "^0.27.16",
62
- "@tiptap/extension-bold": "^3.7.2",
63
- "@tiptap/extension-document": "^3.7.2",
64
- "@tiptap/extension-italic": "^3.7.2",
65
- "@tiptap/extension-paragraph": "^3.7.2",
66
- "@tiptap/extension-text": "^3.7.2",
67
- "@tiptap/pm": "^3.7.2",
68
- "@tiptap/react": "^3.7.2",
69
- "@tiptap/starter-kit": "^3.7.2",
62
+ "@tiptap/extension-bold": "^3.10.1",
63
+ "@tiptap/extension-document": "^3.10.1",
64
+ "@tiptap/extension-italic": "^3.10.1",
65
+ "@tiptap/extension-paragraph": "^3.10.1",
66
+ "@tiptap/extension-strike": "^3.10.1",
67
+ "@tiptap/extension-subscript": "^3.10.1",
68
+ "@tiptap/extension-superscript": "^3.10.1",
69
+ "@tiptap/extension-text": "^3.10.1",
70
+ "@tiptap/extension-underline": "^3.10.1",
71
+ "@tiptap/pm": "^3.10.1",
72
+ "@tiptap/react": "^3.10.1",
73
+ "@tiptap/starter-kit": "^3.10.1",
70
74
  "motion": "^12.23.24",
71
75
  "tailwind-merge": "^3.3.1"
72
76
  },