ritext 1.0.14 → 1.0.18
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 +27 -28
- package/dist/chunk-2YUUKIIT.mjs +149 -0
- package/dist/chunk-7QOFJIQ3.mjs +90 -0
- package/dist/chunk-D47XME55.mjs +49 -0
- package/dist/chunk-FWCSY2DS.mjs +37 -0
- package/dist/chunk-GSHINFPO.mjs +53 -0
- package/dist/chunk-LMOTHRGQ.mjs +37 -0
- package/dist/chunk-MBF77NHS.mjs +37 -0
- package/dist/chunk-VYDH6BZE.mjs +17 -0
- package/dist/extension/bold.d.mts +8 -0
- package/dist/extension/bold.d.ts +8 -0
- package/dist/extension/bold.js +260 -0
- package/dist/extension/bold.mjs +70 -0
- package/dist/extension/clearformat.d.mts +8 -0
- package/dist/extension/clearformat.d.ts +8 -0
- package/dist/extension/clearformat.js +239 -0
- package/dist/extension/clearformat.mjs +69 -0
- package/dist/extension/font-family.d.mts +23 -0
- package/dist/extension/font-family.d.ts +23 -0
- package/dist/extension/font-family.js +388 -0
- package/dist/extension/font-family.mjs +113 -0
- package/dist/extension/font-size.d.mts +23 -0
- package/dist/extension/font-size.d.ts +23 -0
- package/dist/extension/font-size.js +386 -0
- package/dist/extension/font-size.mjs +111 -0
- package/dist/extension/heading.d.mts +23 -0
- package/dist/extension/heading.d.ts +23 -0
- package/dist/extension/heading.js +593 -0
- package/dist/extension/heading.mjs +312 -0
- package/dist/extension/history.d.mts +8 -0
- package/dist/extension/history.d.ts +8 -0
- package/dist/extension/history.js +296 -0
- package/dist/extension/history.mjs +126 -0
- package/dist/extension/italic.d.mts +8 -0
- package/dist/extension/italic.d.ts +8 -0
- package/dist/extension/italic.js +264 -0
- package/dist/extension/italic.mjs +74 -0
- package/dist/extension/strike.d.mts +8 -0
- package/dist/extension/strike.d.ts +8 -0
- package/dist/extension/strike.js +264 -0
- package/dist/extension/strike.mjs +74 -0
- package/dist/extension/subandsuperscript.d.mts +21 -0
- package/dist/extension/subandsuperscript.d.ts +21 -0
- package/dist/extension/subandsuperscript.js +452 -0
- package/dist/extension/subandsuperscript.mjs +121 -0
- package/dist/extension/subscript.d.mts +8 -0
- package/dist/extension/subscript.d.ts +8 -0
- package/dist/extension/subscript.js +264 -0
- package/dist/extension/subscript.mjs +46 -0
- package/dist/extension/superscript.d.mts +8 -0
- package/dist/extension/superscript.d.ts +8 -0
- package/dist/extension/superscript.js +264 -0
- package/dist/extension/superscript.mjs +46 -0
- package/dist/extension/underline.d.mts +8 -0
- package/dist/extension/underline.d.ts +8 -0
- package/dist/extension/underline.js +263 -0
- package/dist/extension/underline.mjs +73 -0
- package/dist/index.css +471 -5
- package/dist/index.d.mts +6 -32
- package/dist/index.d.ts +6 -32
- package/dist/index.js +26 -538
- package/dist/index.mjs +31 -549
- package/dist/tiptap-ext.type-DrneAC5G.d.mts +39 -0
- package/dist/tiptap-ext.type-DrneAC5G.d.ts +39 -0
- package/package.json +52 -26
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ButtonWithoutActive_default
|
|
3
|
+
} from "../chunk-D47XME55.mjs";
|
|
4
|
+
import "../chunk-7QOFJIQ3.mjs";
|
|
5
|
+
import {
|
|
6
|
+
__objRest,
|
|
7
|
+
__spreadProps,
|
|
8
|
+
__spreadValues
|
|
9
|
+
} from "../chunk-FWCSY2DS.mjs";
|
|
10
|
+
|
|
11
|
+
// src/extension/History.tsx
|
|
12
|
+
import { Fragment } from "react";
|
|
13
|
+
import { UndoRedo } from "@tiptap/extensions";
|
|
14
|
+
import { useEditorState } from "@tiptap/react";
|
|
15
|
+
|
|
16
|
+
// src/lib/icon/HistoryIcon.tsx
|
|
17
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
var Redo2 = (_a) => {
|
|
19
|
+
var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
|
|
20
|
+
return /* @__PURE__ */ jsxs(
|
|
21
|
+
"svg",
|
|
22
|
+
__spreadProps(__spreadValues({
|
|
23
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
24
|
+
viewBox: "0 0 24 24",
|
|
25
|
+
fill: "none",
|
|
26
|
+
stroke: "currentColor",
|
|
27
|
+
strokeWidth: 2,
|
|
28
|
+
strokeLinecap: "round",
|
|
29
|
+
strokeLinejoin: "round",
|
|
30
|
+
width: size,
|
|
31
|
+
height: size,
|
|
32
|
+
className
|
|
33
|
+
}, props), {
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsx("path", { d: "m15 14 5-5-5-5" }),
|
|
36
|
+
/* @__PURE__ */ jsx("path", { d: "M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13" })
|
|
37
|
+
]
|
|
38
|
+
})
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
var Undo2 = (_a) => {
|
|
42
|
+
var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
|
|
43
|
+
return /* @__PURE__ */ jsxs(
|
|
44
|
+
"svg",
|
|
45
|
+
__spreadProps(__spreadValues({
|
|
46
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
47
|
+
viewBox: "0 0 24 24",
|
|
48
|
+
fill: "none",
|
|
49
|
+
stroke: "currentColor",
|
|
50
|
+
strokeWidth: "2",
|
|
51
|
+
strokeLinecap: "round",
|
|
52
|
+
strokeLinejoin: "round",
|
|
53
|
+
width: size,
|
|
54
|
+
height: size,
|
|
55
|
+
className
|
|
56
|
+
}, props), {
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ jsx("path", { d: "M9 14 4 9l5-5" }),
|
|
59
|
+
/* @__PURE__ */ jsx("path", { d: "M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11" })
|
|
60
|
+
]
|
|
61
|
+
})
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// src/extension/History.tsx
|
|
66
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
67
|
+
function HistoryButtons({
|
|
68
|
+
editor,
|
|
69
|
+
options,
|
|
70
|
+
buttonClassName
|
|
71
|
+
}) {
|
|
72
|
+
const { canUndo, canRedo } = useEditorState({
|
|
73
|
+
editor,
|
|
74
|
+
selector: (ctx) => ({
|
|
75
|
+
canUndo: ctx.editor.can().chain().focus().undo().run(),
|
|
76
|
+
canRedo: ctx.editor.can().chain().focus().redo().run()
|
|
77
|
+
})
|
|
78
|
+
});
|
|
79
|
+
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
80
|
+
/* @__PURE__ */ jsx2(
|
|
81
|
+
ButtonWithoutActive_default,
|
|
82
|
+
{
|
|
83
|
+
className: options.className,
|
|
84
|
+
icon: options.icon,
|
|
85
|
+
style: options.style,
|
|
86
|
+
tooltip: options.tooltip,
|
|
87
|
+
tooltipClassName: options.tooltipClassName,
|
|
88
|
+
tooltipPlacement: options.tooltipPlacement,
|
|
89
|
+
_internalIcon: /* @__PURE__ */ jsx2(Undo2, {}),
|
|
90
|
+
_onToggle: () => editor.chain().focus().undo().run(),
|
|
91
|
+
_interShortcut: "\u2318 + Z",
|
|
92
|
+
_tooltipContent: "Undo",
|
|
93
|
+
_disabled: !canUndo,
|
|
94
|
+
_buttonClassName: buttonClassName
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
/* @__PURE__ */ jsx2(
|
|
98
|
+
ButtonWithoutActive_default,
|
|
99
|
+
{
|
|
100
|
+
className: options.className,
|
|
101
|
+
icon: options.icon,
|
|
102
|
+
style: options.style,
|
|
103
|
+
tooltip: options.tooltip,
|
|
104
|
+
tooltipClassName: options.tooltipClassName,
|
|
105
|
+
tooltipPlacement: options.tooltipPlacement,
|
|
106
|
+
_internalIcon: /* @__PURE__ */ jsx2(Redo2, {}),
|
|
107
|
+
_onToggle: () => editor.chain().focus().redo().run(),
|
|
108
|
+
_interShortcut: "\u21E7 + \u2318 + Z",
|
|
109
|
+
_tooltipContent: "Redo",
|
|
110
|
+
_disabled: !canRedo,
|
|
111
|
+
_buttonClassName: buttonClassName
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
] });
|
|
115
|
+
}
|
|
116
|
+
var History = UndoRedo.extend({
|
|
117
|
+
addOptions() {
|
|
118
|
+
var _a;
|
|
119
|
+
return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
|
|
120
|
+
component: ({ editor, options, buttonClassName }) => /* @__PURE__ */ jsx2(HistoryButtons, { editor, options, buttonClassName })
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
export {
|
|
125
|
+
History
|
|
126
|
+
};
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defProps = Object.defineProperties;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
var __export = (target, all) => {
|
|
38
|
+
for (var name in all)
|
|
39
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
40
|
+
};
|
|
41
|
+
var __copyProps = (to, from, except, desc) => {
|
|
42
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
43
|
+
for (let key of __getOwnPropNames(from))
|
|
44
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
45
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
46
|
+
}
|
|
47
|
+
return to;
|
|
48
|
+
};
|
|
49
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
51
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
52
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
53
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
54
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
55
|
+
mod
|
|
56
|
+
));
|
|
57
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
58
|
+
|
|
59
|
+
// src/extension/Italic.tsx
|
|
60
|
+
var Italic_exports = {};
|
|
61
|
+
__export(Italic_exports, {
|
|
62
|
+
Italic: () => Italic
|
|
63
|
+
});
|
|
64
|
+
module.exports = __toCommonJS(Italic_exports);
|
|
65
|
+
var import_extension_italic = __toESM(require("@tiptap/extension-italic"));
|
|
66
|
+
|
|
67
|
+
// src/lib/icon/ItalicIcon.tsx
|
|
68
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
69
|
+
var ItalicIcon = (_a) => {
|
|
70
|
+
var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
|
|
71
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
72
|
+
"svg",
|
|
73
|
+
__spreadProps(__spreadValues({
|
|
74
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
75
|
+
viewBox: "0 0 24 24",
|
|
76
|
+
fill: "none",
|
|
77
|
+
stroke: "currentColor",
|
|
78
|
+
strokeWidth: 2,
|
|
79
|
+
strokeLinecap: "round",
|
|
80
|
+
strokeLinejoin: "round",
|
|
81
|
+
width: size,
|
|
82
|
+
height: size,
|
|
83
|
+
className
|
|
84
|
+
}, props), {
|
|
85
|
+
children: [
|
|
86
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "19", x2: "10", y1: "4", y2: "4" }),
|
|
87
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "14", x2: "5", y1: "20", y2: "20" }),
|
|
88
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "15", x2: "9", y1: "4", y2: "20" })
|
|
89
|
+
]
|
|
90
|
+
})
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
var ItalicIcon_default = ItalicIcon;
|
|
94
|
+
|
|
95
|
+
// src/lib/components/ButtonComponent.tsx
|
|
96
|
+
var import_tailwind_merge2 = require("tailwind-merge");
|
|
97
|
+
|
|
98
|
+
// src/lib/components/_com/Tooltip.tsx
|
|
99
|
+
var import_react = require("react");
|
|
100
|
+
var import_react2 = require("@floating-ui/react");
|
|
101
|
+
var import_react3 = require("motion/react");
|
|
102
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
103
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
104
|
+
var Tooltip = ({ placement = "top", children, content, className }) => {
|
|
105
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
106
|
+
const { x, y, refs, strategy, context, placement: resolvedPlacement } = (0, import_react2.useFloating)({
|
|
107
|
+
open,
|
|
108
|
+
onOpenChange: setOpen,
|
|
109
|
+
placement,
|
|
110
|
+
middleware: [(0, import_react2.offset)(8), (0, import_react2.flip)(), (0, import_react2.shift)({ padding: 8 })],
|
|
111
|
+
whileElementsMounted: import_react2.autoUpdate
|
|
112
|
+
});
|
|
113
|
+
const hover = (0, import_react2.useHover)(context);
|
|
114
|
+
const dismiss = (0, import_react2.useDismiss)(context);
|
|
115
|
+
const { getReferenceProps, getFloatingProps } = (0, import_react2.useInteractions)([hover, dismiss]);
|
|
116
|
+
const id = (0, import_react.useId)();
|
|
117
|
+
function mergeRefs(...refsToMerge) {
|
|
118
|
+
return (node) => {
|
|
119
|
+
for (const r of refsToMerge) {
|
|
120
|
+
if (!r) continue;
|
|
121
|
+
if (typeof r === "function") r(node);
|
|
122
|
+
else r.current = node;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
const side = resolvedPlacement.split("-")[0];
|
|
127
|
+
const enterOffset = 6;
|
|
128
|
+
const getInitial = () => {
|
|
129
|
+
switch (side) {
|
|
130
|
+
case "top":
|
|
131
|
+
return { opacity: 0, y: enterOffset };
|
|
132
|
+
case "bottom":
|
|
133
|
+
return { opacity: 0, y: -enterOffset };
|
|
134
|
+
case "left":
|
|
135
|
+
return { opacity: 0, x: enterOffset };
|
|
136
|
+
case "right":
|
|
137
|
+
return { opacity: 0, x: -enterOffset };
|
|
138
|
+
default:
|
|
139
|
+
return { opacity: 0 };
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
const getExit = () => __spreadProps(__spreadValues({}, getInitial()), { opacity: 0 });
|
|
143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react.Fragment, { children: [
|
|
144
|
+
(0, import_react.isValidElement)(children) ? (0, import_react.cloneElement)(children, __spreadProps(__spreadValues({}, getReferenceProps({
|
|
145
|
+
onFocus: () => setOpen(true),
|
|
146
|
+
onBlur: () => setOpen(false),
|
|
147
|
+
"aria-describedby": open ? id : void 0
|
|
148
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
149
|
+
})), {
|
|
150
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
151
|
+
ref: mergeRefs(children.props.ref, refs.setReference)
|
|
152
|
+
})) : children,
|
|
153
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react2.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react3.AnimatePresence, { children: open && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
154
|
+
import_react3.motion.div,
|
|
155
|
+
__spreadProps(__spreadValues({
|
|
156
|
+
ref: refs.setFloating
|
|
157
|
+
}, getFloatingProps({
|
|
158
|
+
role: "tooltip",
|
|
159
|
+
id,
|
|
160
|
+
style: {
|
|
161
|
+
position: strategy,
|
|
162
|
+
top: y != null ? y : 0,
|
|
163
|
+
left: x != null ? x : 0,
|
|
164
|
+
pointerEvents: "none"
|
|
165
|
+
}
|
|
166
|
+
})), {
|
|
167
|
+
initial: getInitial(),
|
|
168
|
+
animate: { opacity: 1, x: 0, y: 0, scale: 1 },
|
|
169
|
+
exit: getExit(),
|
|
170
|
+
transition: { type: "spring", stiffness: 420, damping: 30, mass: 0.6 },
|
|
171
|
+
className: (0, import_tailwind_merge.twMerge)("bg-white border border-solid border-gray-200/50 py-1 px-3 rounded-lg text-sm shadow-lg shadow-gray-50 text-center", className),
|
|
172
|
+
children: content
|
|
173
|
+
}),
|
|
174
|
+
"tooltip"
|
|
175
|
+
) }) })
|
|
176
|
+
] });
|
|
177
|
+
};
|
|
178
|
+
var Tooltip_default = Tooltip;
|
|
179
|
+
|
|
180
|
+
// src/lib/context/editor.context.tsx
|
|
181
|
+
var import_react4 = require("react");
|
|
182
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
183
|
+
var EditorContext = (0, import_react4.createContext)({ editor: null });
|
|
184
|
+
var useEditor = () => {
|
|
185
|
+
const ctx = (0, import_react4.useContext)(EditorContext);
|
|
186
|
+
if (!ctx) throw new Error("<Toolbar/> & <Content/> component must be used inside <Editor>...</Editor/>");
|
|
187
|
+
return ctx;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
// src/lib/components/ButtonComponent.tsx
|
|
191
|
+
var import_react5 = require("@tiptap/react");
|
|
192
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
193
|
+
var ButtonComponent = ({ className, activeClassName, icon, style, tooltip = true, tooltipClassName, tooltipPlacement, _extName, _internalIcon, _tooltipContent, _onToggle, _interShortcut, _buttonClassName }) => {
|
|
194
|
+
const { editor } = useEditor();
|
|
195
|
+
const editorState = (0, import_react5.useEditorState)({
|
|
196
|
+
editor,
|
|
197
|
+
selector: ({ editor: editor2 }) => ({ isActive: (editor2 == null ? void 0 : editor2.isActive(_extName)) || false })
|
|
198
|
+
});
|
|
199
|
+
const tooltipContent = /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { children: [
|
|
200
|
+
typeof tooltip === "string" ? tooltip : _tooltipContent,
|
|
201
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("br", {}),
|
|
202
|
+
_interShortcut
|
|
203
|
+
] });
|
|
204
|
+
const btn = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
205
|
+
"button",
|
|
206
|
+
{
|
|
207
|
+
onClick: _onToggle,
|
|
208
|
+
className: (0, import_tailwind_merge2.twMerge)(
|
|
209
|
+
"py-1.5 px-2.5 rounded-md",
|
|
210
|
+
_buttonClassName,
|
|
211
|
+
(editorState == null ? void 0 : editorState.isActive) ? "bg-gray-200/60" : "hover:bg-gray-100",
|
|
212
|
+
className,
|
|
213
|
+
(editorState == null ? void 0 : editorState.isActive) ? activeClassName : "hover:bg-gray-100"
|
|
214
|
+
),
|
|
215
|
+
style,
|
|
216
|
+
children: icon != null ? icon : _internalIcon
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
if (tooltip === false) return btn;
|
|
220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
221
|
+
Tooltip_default,
|
|
222
|
+
{
|
|
223
|
+
content: tooltipContent,
|
|
224
|
+
className: tooltipClassName,
|
|
225
|
+
placement: tooltipPlacement,
|
|
226
|
+
children: btn
|
|
227
|
+
}
|
|
228
|
+
);
|
|
229
|
+
};
|
|
230
|
+
var ButtonComponent_default = ButtonComponent;
|
|
231
|
+
|
|
232
|
+
// src/extension/Italic.tsx
|
|
233
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
234
|
+
var Italic = import_extension_italic.default.extend({
|
|
235
|
+
addOptions() {
|
|
236
|
+
var _a;
|
|
237
|
+
return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
|
|
238
|
+
component: ({ options, editor, buttonClassName }) => {
|
|
239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
240
|
+
ButtonComponent_default,
|
|
241
|
+
{
|
|
242
|
+
className: options.className,
|
|
243
|
+
icon: options.icon,
|
|
244
|
+
style: options.style,
|
|
245
|
+
activeClassName: options.activeClassName,
|
|
246
|
+
tooltip: options.tooltip,
|
|
247
|
+
tooltipClassName: options.tooltipClassName,
|
|
248
|
+
tooltipPlacement: options.tooltipPlacement,
|
|
249
|
+
_internalIcon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ItalicIcon_default, {}),
|
|
250
|
+
_extName: "italic",
|
|
251
|
+
_onToggle: () => editor.chain().focus().toggleItalic().run(),
|
|
252
|
+
_interShortcut: "\u2318 + I",
|
|
253
|
+
_tooltipContent: "Italic",
|
|
254
|
+
_buttonClassName: buttonClassName
|
|
255
|
+
}
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
262
|
+
0 && (module.exports = {
|
|
263
|
+
Italic
|
|
264
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ButtonComponent_default
|
|
3
|
+
} from "../chunk-GSHINFPO.mjs";
|
|
4
|
+
import "../chunk-7QOFJIQ3.mjs";
|
|
5
|
+
import "../chunk-VYDH6BZE.mjs";
|
|
6
|
+
import {
|
|
7
|
+
__objRest,
|
|
8
|
+
__spreadProps,
|
|
9
|
+
__spreadValues
|
|
10
|
+
} from "../chunk-FWCSY2DS.mjs";
|
|
11
|
+
|
|
12
|
+
// src/extension/Italic.tsx
|
|
13
|
+
import TiptapItalic from "@tiptap/extension-italic";
|
|
14
|
+
|
|
15
|
+
// src/lib/icon/ItalicIcon.tsx
|
|
16
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
var ItalicIcon = (_a) => {
|
|
18
|
+
var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
|
|
19
|
+
return /* @__PURE__ */ jsxs(
|
|
20
|
+
"svg",
|
|
21
|
+
__spreadProps(__spreadValues({
|
|
22
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
23
|
+
viewBox: "0 0 24 24",
|
|
24
|
+
fill: "none",
|
|
25
|
+
stroke: "currentColor",
|
|
26
|
+
strokeWidth: 2,
|
|
27
|
+
strokeLinecap: "round",
|
|
28
|
+
strokeLinejoin: "round",
|
|
29
|
+
width: size,
|
|
30
|
+
height: size,
|
|
31
|
+
className
|
|
32
|
+
}, props), {
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ jsx("line", { x1: "19", x2: "10", y1: "4", y2: "4" }),
|
|
35
|
+
/* @__PURE__ */ jsx("line", { x1: "14", x2: "5", y1: "20", y2: "20" }),
|
|
36
|
+
/* @__PURE__ */ jsx("line", { x1: "15", x2: "9", y1: "4", y2: "20" })
|
|
37
|
+
]
|
|
38
|
+
})
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
var ItalicIcon_default = ItalicIcon;
|
|
42
|
+
|
|
43
|
+
// src/extension/Italic.tsx
|
|
44
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
45
|
+
var Italic = TiptapItalic.extend({
|
|
46
|
+
addOptions() {
|
|
47
|
+
var _a;
|
|
48
|
+
return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
|
|
49
|
+
component: ({ options, editor, buttonClassName }) => {
|
|
50
|
+
return /* @__PURE__ */ jsx2(
|
|
51
|
+
ButtonComponent_default,
|
|
52
|
+
{
|
|
53
|
+
className: options.className,
|
|
54
|
+
icon: options.icon,
|
|
55
|
+
style: options.style,
|
|
56
|
+
activeClassName: options.activeClassName,
|
|
57
|
+
tooltip: options.tooltip,
|
|
58
|
+
tooltipClassName: options.tooltipClassName,
|
|
59
|
+
tooltipPlacement: options.tooltipPlacement,
|
|
60
|
+
_internalIcon: /* @__PURE__ */ jsx2(ItalicIcon_default, {}),
|
|
61
|
+
_extName: "italic",
|
|
62
|
+
_onToggle: () => editor.chain().focus().toggleItalic().run(),
|
|
63
|
+
_interShortcut: "\u2318 + I",
|
|
64
|
+
_tooltipContent: "Italic",
|
|
65
|
+
_buttonClassName: buttonClassName
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
export {
|
|
73
|
+
Italic
|
|
74
|
+
};
|