@cyberyozh/text-editor 0.3.2 → 0.5.0
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/editor.css +35 -43
- package/dist/editor.css.map +1 -1
- package/dist/editor.d.mts +20 -2
- package/dist/editor.d.ts +20 -2
- package/dist/editor.js +397 -327
- package/dist/editor.js.map +1 -1
- package/dist/editor.mjs +320 -246
- package/dist/editor.mjs.map +1 -1
- package/dist/render.d.mts +9 -1
- package/dist/render.d.ts +9 -1
- package/dist/render.js +40 -10
- package/dist/render.js.map +1 -1
- package/dist/render.mjs +45 -11
- package/dist/render.mjs.map +1 -1
- package/dist/styles/index.css +35 -43
- package/package.json +1 -1
- package/src/editor/components/dialog-error/dialog-error.css +35 -0
- package/src/editor/components/dialog-error/dialog-error.tsx +65 -0
- package/src/editor/components/dialog-error/index.ts +1 -0
- package/src/editor/components/index.ts +1 -0
- package/src/editor/dialogs/add-link-dialog/add-link-dialog.css +0 -9
- package/src/editor/dialogs/add-link-dialog/add-link-dialog.tsx +2 -2
- package/src/editor/dialogs/add-video-dialog/add-video-dialog.css +0 -9
- package/src/editor/dialogs/add-video-dialog/add-video-dialog.tsx +2 -2
- package/src/editor/dialogs/image-dialog/image-dialog.css +1 -29
- package/src/editor/dialogs/image-dialog/image-dialog.tsx +7 -13
- package/src/editor/editor.tsx +8 -0
- package/src/editor/index.ts +1 -0
- package/src/extensions/base/link.test.ts +60 -0
- package/src/extensions/base/link.ts +61 -9
- package/src/extensions/editor/get-editor-extensions.ts +3 -1
- package/src/styles/components.css +1 -0
- package/src/translations/en.json +4 -4
- package/src/translations/ru.json +4 -4
- package/src/types/common.ts +3 -0
- package/src/types/index.ts +1 -0
- package/src/utils/get-shared-extensions.ts +20 -4
- package/src/utils/html-to-tiptap-content.ts +13 -4
- package/src/utils/index.ts +1 -0
- package/src/utils/is-combined-error.ts +9 -0
package/dist/editor.js
CHANGED
|
@@ -36,10 +36,10 @@ __export(editor_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(editor_exports);
|
|
37
37
|
|
|
38
38
|
// src/editor/editor.tsx
|
|
39
|
-
var
|
|
39
|
+
var import_react38 = require("react");
|
|
40
40
|
var import_state7 = require("@tiptap/pm/state");
|
|
41
41
|
var import_model3 = require("@tiptap/pm/model");
|
|
42
|
-
var
|
|
42
|
+
var import_react39 = require("@tiptap/react");
|
|
43
43
|
var import_menus = require("@tiptap/react/menus");
|
|
44
44
|
var import_github_dark = require("highlight.js/styles/github-dark.css");
|
|
45
45
|
var import_katex_min = require("katex/dist/katex.min.css");
|
|
@@ -1483,6 +1483,11 @@ function pluralize(count, forms) {
|
|
|
1483
1483
|
return forms[2];
|
|
1484
1484
|
}
|
|
1485
1485
|
|
|
1486
|
+
// src/utils/is-combined-error.ts
|
|
1487
|
+
function isCombinedError(error) {
|
|
1488
|
+
return error instanceof Error && Array.isArray(error?.cause) && error.cause.length > 0 && error.cause.every((e) => e instanceof Error);
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1486
1491
|
// src/editor/controls/character-count.tsx
|
|
1487
1492
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
1488
1493
|
var CharacterCount = ({ editor }) => {
|
|
@@ -1809,7 +1814,7 @@ var TableMenu = ({ editor }) => {
|
|
|
1809
1814
|
};
|
|
1810
1815
|
|
|
1811
1816
|
// src/editor/dialogs/image-dialog/image-dialog.tsx
|
|
1812
|
-
var
|
|
1817
|
+
var import_react14 = require("react");
|
|
1813
1818
|
|
|
1814
1819
|
// src/editor/components/button/button.tsx
|
|
1815
1820
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
@@ -1898,6 +1903,43 @@ var CommonModal = ({ open, handleClose, children }) => {
|
|
|
1898
1903
|
);
|
|
1899
1904
|
};
|
|
1900
1905
|
|
|
1906
|
+
// src/editor/components/dialog-error/dialog-error.tsx
|
|
1907
|
+
var import_react13 = require("react");
|
|
1908
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
1909
|
+
var DialogError = ({ error, onClose, className }) => {
|
|
1910
|
+
const translations2 = useTiptapTranslations();
|
|
1911
|
+
const renderedMessage = (0, import_react13.useMemo)(() => {
|
|
1912
|
+
if (typeof error === "string") {
|
|
1913
|
+
return error || translations2.common.unknownError;
|
|
1914
|
+
}
|
|
1915
|
+
if (isCombinedError(error)) {
|
|
1916
|
+
const safeErrors = error.cause.filter((e) => Boolean(e.message));
|
|
1917
|
+
const errorsToDisplay = safeErrors.length === error.cause.length ? safeErrors : [new Error(translations2.common.unknownError), ...safeErrors];
|
|
1918
|
+
if (errorsToDisplay.length === 1) {
|
|
1919
|
+
return errorsToDisplay[0].message;
|
|
1920
|
+
}
|
|
1921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("ul", { className: "dialog-error-list", children: errorsToDisplay.map((cause, index) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("li", { children: cause.message }, `${index}_${cause.message}`)) });
|
|
1922
|
+
}
|
|
1923
|
+
if (error instanceof Error) {
|
|
1924
|
+
return error.message || translations2.common.unknownError;
|
|
1925
|
+
}
|
|
1926
|
+
return translations2.common.unknownError;
|
|
1927
|
+
}, [error, translations2]);
|
|
1928
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: `dialog-error ${className || ""}`, children: [
|
|
1929
|
+
renderedMessage,
|
|
1930
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
1931
|
+
"button",
|
|
1932
|
+
{
|
|
1933
|
+
type: "button",
|
|
1934
|
+
className: "dialog-error-clear-button",
|
|
1935
|
+
onClick: onClose,
|
|
1936
|
+
"aria-label": translations2.common.clearError,
|
|
1937
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(X_default, {})
|
|
1938
|
+
}
|
|
1939
|
+
)
|
|
1940
|
+
] });
|
|
1941
|
+
};
|
|
1942
|
+
|
|
1901
1943
|
// src/utils/image-src-resolver.ts
|
|
1902
1944
|
function resolveImageSrc(attrs, options) {
|
|
1903
1945
|
const { fileId, src } = attrs;
|
|
@@ -1921,7 +1963,7 @@ function resolveImageSrc(attrs, options) {
|
|
|
1921
1963
|
}
|
|
1922
1964
|
|
|
1923
1965
|
// src/editor/dialogs/image-dialog/image-dialog.tsx
|
|
1924
|
-
var
|
|
1966
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
1925
1967
|
var ImageDialog = ({
|
|
1926
1968
|
open,
|
|
1927
1969
|
onClose,
|
|
@@ -1934,9 +1976,9 @@ var ImageDialog = ({
|
|
|
1934
1976
|
mode = "add"
|
|
1935
1977
|
}) => {
|
|
1936
1978
|
const translations2 = useTiptapTranslations();
|
|
1937
|
-
const [isUploading, setIsUploading] = (0,
|
|
1938
|
-
const [dragActive, setDragActive] = (0,
|
|
1939
|
-
const inputRef = (0,
|
|
1979
|
+
const [isUploading, setIsUploading] = (0, import_react14.useState)(false);
|
|
1980
|
+
const [dragActive, setDragActive] = (0, import_react14.useState)(false);
|
|
1981
|
+
const inputRef = (0, import_react14.useRef)(null);
|
|
1940
1982
|
const resolvedInitialUrl = initialAttrs ? resolveImageSrc({ fileId: initialAttrs.fileId, src: initialAttrs.src }, { getImageById }) : "";
|
|
1941
1983
|
const getConstrainedDimensions = () => {
|
|
1942
1984
|
if (!initialAttrs?.width || !initialAttrs?.height) {
|
|
@@ -1963,7 +2005,7 @@ var ImageDialog = ({
|
|
|
1963
2005
|
};
|
|
1964
2006
|
};
|
|
1965
2007
|
const constrainedDimensions = getConstrainedDimensions();
|
|
1966
|
-
const [formState, setFormState] = (0,
|
|
2008
|
+
const [formState, setFormState] = (0, import_react14.useState)({
|
|
1967
2009
|
file: null,
|
|
1968
2010
|
title: initialAttrs?.title || "",
|
|
1969
2011
|
alt: initialAttrs?.alt || "",
|
|
@@ -1972,7 +2014,7 @@ var ImageDialog = ({
|
|
|
1972
2014
|
width: constrainedDimensions.width,
|
|
1973
2015
|
height: constrainedDimensions.height
|
|
1974
2016
|
});
|
|
1975
|
-
const [fileUploadError, setFileUploadError] = (0,
|
|
2017
|
+
const [fileUploadError, setFileUploadError] = (0, import_react14.useState)(null);
|
|
1976
2018
|
const handleSelectFile = (file) => {
|
|
1977
2019
|
setFileUploadError(null);
|
|
1978
2020
|
if (!file) return;
|
|
@@ -2018,7 +2060,7 @@ var ImageDialog = ({
|
|
|
2018
2060
|
}));
|
|
2019
2061
|
};
|
|
2020
2062
|
};
|
|
2021
|
-
(0,
|
|
2063
|
+
(0, import_react14.useEffect)(() => {
|
|
2022
2064
|
if (defaultFile) {
|
|
2023
2065
|
handleSelectFile(defaultFile);
|
|
2024
2066
|
}
|
|
@@ -2079,7 +2121,7 @@ var ImageDialog = ({
|
|
|
2079
2121
|
});
|
|
2080
2122
|
handleClose();
|
|
2081
2123
|
} catch (error) {
|
|
2082
|
-
setFileUploadError(error instanceof Error ? error : new Error(translations2.
|
|
2124
|
+
setFileUploadError(error instanceof Error ? error : new Error(translations2.common.unknownError));
|
|
2083
2125
|
} finally {
|
|
2084
2126
|
setIsUploading(false);
|
|
2085
2127
|
}
|
|
@@ -2107,27 +2149,27 @@ var ImageDialog = ({
|
|
|
2107
2149
|
const dialogTitle = isAddMode ? translations2.imageDialog.addTitle : translations2.imageDialog.editTitle;
|
|
2108
2150
|
const saveButtonText = isAddMode ? translations2.imageDialog.add : translations2.imageDialog.save;
|
|
2109
2151
|
const dragPlaceholder = dragActive ? translations2.imageUpload.dragActive : translations2.imageUpload.dragInactive;
|
|
2110
|
-
return /* @__PURE__ */ (0,
|
|
2152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
2111
2153
|
CommonModal,
|
|
2112
2154
|
{
|
|
2113
2155
|
open,
|
|
2114
2156
|
handleClose,
|
|
2115
2157
|
children: [
|
|
2116
|
-
/* @__PURE__ */ (0,
|
|
2117
|
-
/* @__PURE__ */ (0,
|
|
2118
|
-
/* @__PURE__ */ (0,
|
|
2119
|
-
hasImage ? /* @__PURE__ */ (0,
|
|
2120
|
-
isAddMode && /* @__PURE__ */ (0,
|
|
2158
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "image-dialog-title", children: dialogTitle }),
|
|
2159
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("hr", { className: "image-dialog-divider" }),
|
|
2160
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "image-dialog-form-container", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "image-dialog-form", children: [
|
|
2161
|
+
hasImage ? /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "image-dialog-preview-wrapper", children: [
|
|
2162
|
+
isAddMode && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
2121
2163
|
"button",
|
|
2122
2164
|
{
|
|
2123
2165
|
type: "button",
|
|
2124
2166
|
className: "image-dialog-delete-button",
|
|
2125
2167
|
onClick: clearImageFormFields,
|
|
2126
2168
|
"aria-label": translations2.media.deleteImage,
|
|
2127
|
-
children: /* @__PURE__ */ (0,
|
|
2169
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(X_default, {})
|
|
2128
2170
|
}
|
|
2129
2171
|
),
|
|
2130
|
-
/* @__PURE__ */ (0,
|
|
2172
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
2131
2173
|
"img",
|
|
2132
2174
|
{
|
|
2133
2175
|
src: formState.fileUrl,
|
|
@@ -2137,7 +2179,7 @@ var ImageDialog = ({
|
|
|
2137
2179
|
className: "image-dialog-preview"
|
|
2138
2180
|
}
|
|
2139
2181
|
)
|
|
2140
|
-
] }) : isAddMode && /* @__PURE__ */ (0,
|
|
2182
|
+
] }) : isAddMode && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
2141
2183
|
"div",
|
|
2142
2184
|
{
|
|
2143
2185
|
className: `image-dialog-drag-area ${dragActive ? "image-dialog-drag-area-active" : ""}`,
|
|
@@ -2147,7 +2189,7 @@ var ImageDialog = ({
|
|
|
2147
2189
|
onDragLeave: handleDragLeave,
|
|
2148
2190
|
onDrop: handleDrop,
|
|
2149
2191
|
children: [
|
|
2150
|
-
/* @__PURE__ */ (0,
|
|
2192
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
2151
2193
|
"input",
|
|
2152
2194
|
{
|
|
2153
2195
|
type: "file",
|
|
@@ -2158,12 +2200,12 @@ var ImageDialog = ({
|
|
|
2158
2200
|
accept: "image/*"
|
|
2159
2201
|
}
|
|
2160
2202
|
),
|
|
2161
|
-
/* @__PURE__ */ (0,
|
|
2203
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { style: { textAlign: "center" }, children: dragPlaceholder })
|
|
2162
2204
|
]
|
|
2163
2205
|
}
|
|
2164
2206
|
),
|
|
2165
|
-
hasImage && /* @__PURE__ */ (0,
|
|
2166
|
-
/* @__PURE__ */ (0,
|
|
2207
|
+
hasImage && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
|
|
2208
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
2167
2209
|
Input,
|
|
2168
2210
|
{
|
|
2169
2211
|
label: translations2.media.imageTitle,
|
|
@@ -2171,7 +2213,7 @@ var ImageDialog = ({
|
|
|
2171
2213
|
onChange: (e) => setFormState((prev) => ({ ...prev, title: e.target.value }))
|
|
2172
2214
|
}
|
|
2173
2215
|
),
|
|
2174
|
-
/* @__PURE__ */ (0,
|
|
2216
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
2175
2217
|
Input,
|
|
2176
2218
|
{
|
|
2177
2219
|
label: translations2.media.imageAlt,
|
|
@@ -2179,7 +2221,7 @@ var ImageDialog = ({
|
|
|
2179
2221
|
onChange: (e) => setFormState((prev) => ({ ...prev, alt: e.target.value }))
|
|
2180
2222
|
}
|
|
2181
2223
|
),
|
|
2182
|
-
/* @__PURE__ */ (0,
|
|
2224
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
2183
2225
|
Input,
|
|
2184
2226
|
{
|
|
2185
2227
|
label: translations2.imageDialog.captionLabel,
|
|
@@ -2190,21 +2232,16 @@ var ImageDialog = ({
|
|
|
2190
2232
|
)
|
|
2191
2233
|
] })
|
|
2192
2234
|
] }) }),
|
|
2193
|
-
fileUploadError && /* @__PURE__ */ (0,
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
}
|
|
2204
|
-
)
|
|
2205
|
-
] }),
|
|
2206
|
-
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "image-dialog-actions", children: [
|
|
2207
|
-
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
2235
|
+
fileUploadError && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
2236
|
+
DialogError,
|
|
2237
|
+
{
|
|
2238
|
+
error: fileUploadError,
|
|
2239
|
+
onClose: () => setFileUploadError(null),
|
|
2240
|
+
className: "image-dialog-error-spacing"
|
|
2241
|
+
}
|
|
2242
|
+
),
|
|
2243
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "image-dialog-actions", children: [
|
|
2244
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
2208
2245
|
Button,
|
|
2209
2246
|
{
|
|
2210
2247
|
type: "button",
|
|
@@ -2214,7 +2251,7 @@ var ImageDialog = ({
|
|
|
2214
2251
|
children: translations2.common.cancel
|
|
2215
2252
|
}
|
|
2216
2253
|
),
|
|
2217
|
-
/* @__PURE__ */ (0,
|
|
2254
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
2218
2255
|
Button,
|
|
2219
2256
|
{
|
|
2220
2257
|
isLoading: isUploading,
|
|
@@ -2231,8 +2268,8 @@ var ImageDialog = ({
|
|
|
2231
2268
|
};
|
|
2232
2269
|
|
|
2233
2270
|
// src/editor/dialogs/add-katex-dialog/add-katex-dialog.tsx
|
|
2234
|
-
var
|
|
2235
|
-
var
|
|
2271
|
+
var import_react15 = require("react");
|
|
2272
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
2236
2273
|
var AddKatexDialog = ({
|
|
2237
2274
|
open,
|
|
2238
2275
|
onClose,
|
|
@@ -2240,9 +2277,9 @@ var AddKatexDialog = ({
|
|
|
2240
2277
|
initialContent = ""
|
|
2241
2278
|
}) => {
|
|
2242
2279
|
const translations2 = useTiptapTranslations();
|
|
2243
|
-
const [content, setContent] = (0,
|
|
2244
|
-
const contentInputRef = (0,
|
|
2245
|
-
(0,
|
|
2280
|
+
const [content, setContent] = (0, import_react15.useState)(initialContent);
|
|
2281
|
+
const contentInputRef = (0, import_react15.useRef)(null);
|
|
2282
|
+
(0, import_react15.useEffect)(() => {
|
|
2246
2283
|
if (open) {
|
|
2247
2284
|
setContent(initialContent);
|
|
2248
2285
|
setTimeout(() => {
|
|
@@ -2267,19 +2304,19 @@ var AddKatexDialog = ({
|
|
|
2267
2304
|
handleSubmit();
|
|
2268
2305
|
}
|
|
2269
2306
|
};
|
|
2270
|
-
return /* @__PURE__ */ (0,
|
|
2307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
2271
2308
|
CommonModal,
|
|
2272
2309
|
{
|
|
2273
2310
|
open,
|
|
2274
2311
|
handleClose,
|
|
2275
2312
|
children: [
|
|
2276
|
-
/* @__PURE__ */ (0,
|
|
2277
|
-
/* @__PURE__ */ (0,
|
|
2278
|
-
/* @__PURE__ */ (0,
|
|
2279
|
-
/* @__PURE__ */ (0,
|
|
2313
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("p", { className: "katex-dialog-title", children: initialContent ? translations2.katex.editTitle : translations2.katex.addTitle }),
|
|
2314
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("hr", { className: "katex-dialog-divider" }),
|
|
2315
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "katex-dialog-content", children: [
|
|
2316
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("p", { className: "katex-dialog-description", children: [
|
|
2280
2317
|
translations2.katex.description,
|
|
2281
2318
|
" ",
|
|
2282
|
-
/* @__PURE__ */ (0,
|
|
2319
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
2283
2320
|
"a",
|
|
2284
2321
|
{
|
|
2285
2322
|
href: "https://katex.org/docs/supported.html",
|
|
@@ -2291,8 +2328,8 @@ var AddKatexDialog = ({
|
|
|
2291
2328
|
" ",
|
|
2292
2329
|
translations2.katex.documentationLinkSuffix
|
|
2293
2330
|
] }),
|
|
2294
|
-
/* @__PURE__ */ (0,
|
|
2295
|
-
/* @__PURE__ */ (0,
|
|
2331
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "katex-dialog-form-group", children: [
|
|
2332
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
2296
2333
|
"label",
|
|
2297
2334
|
{
|
|
2298
2335
|
htmlFor: "katex-content",
|
|
@@ -2300,7 +2337,7 @@ var AddKatexDialog = ({
|
|
|
2300
2337
|
children: translations2.katex.label
|
|
2301
2338
|
}
|
|
2302
2339
|
),
|
|
2303
|
-
/* @__PURE__ */ (0,
|
|
2340
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
2304
2341
|
"textarea",
|
|
2305
2342
|
{
|
|
2306
2343
|
ref: contentInputRef,
|
|
@@ -2315,8 +2352,8 @@ var AddKatexDialog = ({
|
|
|
2315
2352
|
)
|
|
2316
2353
|
] })
|
|
2317
2354
|
] }),
|
|
2318
|
-
/* @__PURE__ */ (0,
|
|
2319
|
-
/* @__PURE__ */ (0,
|
|
2355
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "katex-dialog-actions", children: [
|
|
2356
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
2320
2357
|
"button",
|
|
2321
2358
|
{
|
|
2322
2359
|
className: "katex-dialog-button-cancel",
|
|
@@ -2325,7 +2362,7 @@ var AddKatexDialog = ({
|
|
|
2325
2362
|
children: translations2.common.cancel
|
|
2326
2363
|
}
|
|
2327
2364
|
),
|
|
2328
|
-
/* @__PURE__ */ (0,
|
|
2365
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
2329
2366
|
"button",
|
|
2330
2367
|
{
|
|
2331
2368
|
className: "katex-dialog-button-submit",
|
|
@@ -2341,8 +2378,8 @@ var AddKatexDialog = ({
|
|
|
2341
2378
|
};
|
|
2342
2379
|
|
|
2343
2380
|
// src/editor/dialogs/add-link-dialog/add-link-dialog.tsx
|
|
2344
|
-
var
|
|
2345
|
-
var
|
|
2381
|
+
var import_react16 = require("react");
|
|
2382
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
2346
2383
|
var AddLinkDialog = ({
|
|
2347
2384
|
open,
|
|
2348
2385
|
onClose,
|
|
@@ -2352,12 +2389,12 @@ var AddLinkDialog = ({
|
|
|
2352
2389
|
const translations2 = useTiptapTranslations();
|
|
2353
2390
|
const initialLinkTarget = linkDialogContext ? linkDialogContext.target === "_blank" : true;
|
|
2354
2391
|
const initialLinkRel = linkDialogContext ? !!linkDialogContext.rel?.includes("noopener") : true;
|
|
2355
|
-
const [title, setTitle] = (0,
|
|
2356
|
-
const [url, setUrl] = (0,
|
|
2357
|
-
const [openInNewTab, setOpenInNewTab] = (0,
|
|
2358
|
-
const [addNoopener, setAddNoopener] = (0,
|
|
2359
|
-
const [error, setError] = (0,
|
|
2360
|
-
const titleInputRef = (0,
|
|
2392
|
+
const [title, setTitle] = (0, import_react16.useState)(linkDialogContext?.title);
|
|
2393
|
+
const [url, setUrl] = (0, import_react16.useState)(linkDialogContext?.href);
|
|
2394
|
+
const [openInNewTab, setOpenInNewTab] = (0, import_react16.useState)(initialLinkTarget);
|
|
2395
|
+
const [addNoopener, setAddNoopener] = (0, import_react16.useState)(initialLinkRel);
|
|
2396
|
+
const [error, setError] = (0, import_react16.useState)("");
|
|
2397
|
+
const titleInputRef = (0, import_react16.useRef)(null);
|
|
2361
2398
|
const clearDialogState = () => {
|
|
2362
2399
|
setTitle(linkDialogContext?.title);
|
|
2363
2400
|
setUrl(linkDialogContext?.href);
|
|
@@ -2365,7 +2402,7 @@ var AddLinkDialog = ({
|
|
|
2365
2402
|
setAddNoopener(initialLinkRel);
|
|
2366
2403
|
setError("");
|
|
2367
2404
|
};
|
|
2368
|
-
(0,
|
|
2405
|
+
(0, import_react16.useEffect)(() => {
|
|
2369
2406
|
if (open) {
|
|
2370
2407
|
clearDialogState();
|
|
2371
2408
|
setTimeout(() => {
|
|
@@ -2422,17 +2459,17 @@ var AddLinkDialog = ({
|
|
|
2422
2459
|
handleSubmit();
|
|
2423
2460
|
}
|
|
2424
2461
|
};
|
|
2425
|
-
return /* @__PURE__ */ (0,
|
|
2462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
2426
2463
|
CommonModal,
|
|
2427
2464
|
{
|
|
2428
2465
|
open,
|
|
2429
2466
|
handleClose,
|
|
2430
2467
|
children: [
|
|
2431
|
-
/* @__PURE__ */ (0,
|
|
2432
|
-
/* @__PURE__ */ (0,
|
|
2433
|
-
/* @__PURE__ */ (0,
|
|
2434
|
-
/* @__PURE__ */ (0,
|
|
2435
|
-
/* @__PURE__ */ (0,
|
|
2468
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("p", { className: "link-dialog-title", children: linkDialogContext?.href ? translations2.link.editLink : translations2.link.addLink }),
|
|
2469
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("hr", { className: "link-dialog-divider" }),
|
|
2470
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "link-dialog-content", children: [
|
|
2471
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "link-dialog-form-group", children: [
|
|
2472
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
2436
2473
|
"label",
|
|
2437
2474
|
{
|
|
2438
2475
|
htmlFor: "link-title",
|
|
@@ -2440,7 +2477,7 @@ var AddLinkDialog = ({
|
|
|
2440
2477
|
children: translations2.link.title
|
|
2441
2478
|
}
|
|
2442
2479
|
),
|
|
2443
|
-
/* @__PURE__ */ (0,
|
|
2480
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
2444
2481
|
"input",
|
|
2445
2482
|
{
|
|
2446
2483
|
ref: titleInputRef,
|
|
@@ -2454,8 +2491,8 @@ var AddLinkDialog = ({
|
|
|
2454
2491
|
}
|
|
2455
2492
|
)
|
|
2456
2493
|
] }),
|
|
2457
|
-
/* @__PURE__ */ (0,
|
|
2458
|
-
/* @__PURE__ */ (0,
|
|
2494
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "link-dialog-form-group", children: [
|
|
2495
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
2459
2496
|
"label",
|
|
2460
2497
|
{
|
|
2461
2498
|
htmlFor: "link-url",
|
|
@@ -2463,7 +2500,7 @@ var AddLinkDialog = ({
|
|
|
2463
2500
|
children: translations2.link.url
|
|
2464
2501
|
}
|
|
2465
2502
|
),
|
|
2466
|
-
/* @__PURE__ */ (0,
|
|
2503
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
2467
2504
|
"input",
|
|
2468
2505
|
{
|
|
2469
2506
|
id: "link-url",
|
|
@@ -2476,9 +2513,9 @@ var AddLinkDialog = ({
|
|
|
2476
2513
|
}
|
|
2477
2514
|
)
|
|
2478
2515
|
] }),
|
|
2479
|
-
/* @__PURE__ */ (0,
|
|
2480
|
-
/* @__PURE__ */ (0,
|
|
2481
|
-
/* @__PURE__ */ (0,
|
|
2516
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "link-dialog-form-group", children: [
|
|
2517
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("label", { className: "link-dialog-checkbox-label", children: [
|
|
2518
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
2482
2519
|
"input",
|
|
2483
2520
|
{
|
|
2484
2521
|
type: "checkbox",
|
|
@@ -2486,13 +2523,13 @@ var AddLinkDialog = ({
|
|
|
2486
2523
|
onChange: (e) => setOpenInNewTab(e.target.checked)
|
|
2487
2524
|
}
|
|
2488
2525
|
),
|
|
2489
|
-
/* @__PURE__ */ (0,
|
|
2526
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { children: translations2.link.openInNewTab })
|
|
2490
2527
|
] }),
|
|
2491
|
-
/* @__PURE__ */ (0,
|
|
2528
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("p", { className: "link-dialog-help-text", children: translations2.link.openInNewTabHelp })
|
|
2492
2529
|
] }),
|
|
2493
|
-
/* @__PURE__ */ (0,
|
|
2494
|
-
/* @__PURE__ */ (0,
|
|
2495
|
-
/* @__PURE__ */ (0,
|
|
2530
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "link-dialog-form-group", children: [
|
|
2531
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("label", { className: "link-dialog-checkbox-label", children: [
|
|
2532
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
2496
2533
|
"input",
|
|
2497
2534
|
{
|
|
2498
2535
|
type: "checkbox",
|
|
@@ -2500,14 +2537,14 @@ var AddLinkDialog = ({
|
|
|
2500
2537
|
onChange: (e) => setAddNoopener(e.target.checked)
|
|
2501
2538
|
}
|
|
2502
2539
|
),
|
|
2503
|
-
/* @__PURE__ */ (0,
|
|
2540
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { children: translations2.link.addNofollow })
|
|
2504
2541
|
] }),
|
|
2505
|
-
/* @__PURE__ */ (0,
|
|
2542
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("p", { className: "link-dialog-help-text", children: translations2.link.addNofollowHelp })
|
|
2506
2543
|
] }),
|
|
2507
|
-
error && /* @__PURE__ */ (0,
|
|
2544
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(DialogError, { error })
|
|
2508
2545
|
] }),
|
|
2509
|
-
/* @__PURE__ */ (0,
|
|
2510
|
-
/* @__PURE__ */ (0,
|
|
2546
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "link-dialog-actions", children: [
|
|
2547
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
2511
2548
|
"button",
|
|
2512
2549
|
{
|
|
2513
2550
|
className: "link-dialog-button-cancel",
|
|
@@ -2516,7 +2553,7 @@ var AddLinkDialog = ({
|
|
|
2516
2553
|
children: translations2.common.cancel
|
|
2517
2554
|
}
|
|
2518
2555
|
),
|
|
2519
|
-
/* @__PURE__ */ (0,
|
|
2556
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
2520
2557
|
"button",
|
|
2521
2558
|
{
|
|
2522
2559
|
className: "link-dialog-button-submit",
|
|
@@ -2532,7 +2569,7 @@ var AddLinkDialog = ({
|
|
|
2532
2569
|
};
|
|
2533
2570
|
|
|
2534
2571
|
// src/editor/dialogs/add-video-dialog/add-video-dialog.tsx
|
|
2535
|
-
var
|
|
2572
|
+
var import_react17 = require("react");
|
|
2536
2573
|
|
|
2537
2574
|
// src/utils/detect-video-hosting.ts
|
|
2538
2575
|
var VIDEO_PATTERNS = {
|
|
@@ -2606,7 +2643,7 @@ var detectVideoHosting = (src) => {
|
|
|
2606
2643
|
};
|
|
2607
2644
|
|
|
2608
2645
|
// src/editor/dialogs/add-video-dialog/add-video-dialog.tsx
|
|
2609
|
-
var
|
|
2646
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
2610
2647
|
var SUPPORTED_PLATFORMS = {
|
|
2611
2648
|
["youtube" /* Youtube */]: "YouTube",
|
|
2612
2649
|
["vimeo" /* Vimeo */]: "Vimeo",
|
|
@@ -2615,11 +2652,11 @@ var SUPPORTED_PLATFORMS = {
|
|
|
2615
2652
|
};
|
|
2616
2653
|
var AddVideoDialog = ({ open, onClose, onVideoAdd }) => {
|
|
2617
2654
|
const translations2 = useTiptapTranslations();
|
|
2618
|
-
const [url, setUrl] = (0,
|
|
2619
|
-
const [error, setError] = (0,
|
|
2620
|
-
const [isValidating, setIsValidating] = (0,
|
|
2621
|
-
const urlInputRef = (0,
|
|
2622
|
-
(0,
|
|
2655
|
+
const [url, setUrl] = (0, import_react17.useState)("");
|
|
2656
|
+
const [error, setError] = (0, import_react17.useState)("");
|
|
2657
|
+
const [isValidating, setIsValidating] = (0, import_react17.useState)(false);
|
|
2658
|
+
const urlInputRef = (0, import_react17.useRef)(null);
|
|
2659
|
+
(0, import_react17.useEffect)(() => {
|
|
2623
2660
|
if (open) {
|
|
2624
2661
|
setUrl("");
|
|
2625
2662
|
setError("");
|
|
@@ -2673,17 +2710,17 @@ var AddVideoDialog = ({ open, onClose, onVideoAdd }) => {
|
|
|
2673
2710
|
handleSubmit();
|
|
2674
2711
|
}
|
|
2675
2712
|
};
|
|
2676
|
-
return /* @__PURE__ */ (0,
|
|
2713
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
2677
2714
|
CommonModal,
|
|
2678
2715
|
{
|
|
2679
2716
|
open,
|
|
2680
2717
|
handleClose,
|
|
2681
2718
|
children: [
|
|
2682
|
-
/* @__PURE__ */ (0,
|
|
2683
|
-
/* @__PURE__ */ (0,
|
|
2684
|
-
/* @__PURE__ */ (0,
|
|
2685
|
-
/* @__PURE__ */ (0,
|
|
2686
|
-
/* @__PURE__ */ (0,
|
|
2719
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("p", { className: "video-dialog-title", children: translations2.videoUpload.title }),
|
|
2720
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("hr", { className: "video-dialog-divider" }),
|
|
2721
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "video-dialog-content", children: [
|
|
2722
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "video-dialog-form-group", children: [
|
|
2723
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
2687
2724
|
"label",
|
|
2688
2725
|
{
|
|
2689
2726
|
htmlFor: "video-url",
|
|
@@ -2691,7 +2728,7 @@ var AddVideoDialog = ({ open, onClose, onVideoAdd }) => {
|
|
|
2691
2728
|
children: translations2.videoUpload.urlLabel
|
|
2692
2729
|
}
|
|
2693
2730
|
),
|
|
2694
|
-
/* @__PURE__ */ (0,
|
|
2731
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
2695
2732
|
"input",
|
|
2696
2733
|
{
|
|
2697
2734
|
ref: urlInputRef,
|
|
@@ -2707,14 +2744,14 @@ var AddVideoDialog = ({ open, onClose, onVideoAdd }) => {
|
|
|
2707
2744
|
}
|
|
2708
2745
|
)
|
|
2709
2746
|
] }),
|
|
2710
|
-
/* @__PURE__ */ (0,
|
|
2711
|
-
/* @__PURE__ */ (0,
|
|
2712
|
-
/* @__PURE__ */ (0,
|
|
2747
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "video-dialog-help-text", children: [
|
|
2748
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("p", { className: "video-dialog-help-title", children: translations2.videoUpload.supportedPlatforms }),
|
|
2749
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("ul", { className: "video-dialog-platform-list", children: Object.entries(SUPPORTED_PLATFORMS).map(([key, name]) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("li", { children: name }, key)) })
|
|
2713
2750
|
] }),
|
|
2714
|
-
error && /* @__PURE__ */ (0,
|
|
2751
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DialogError, { error })
|
|
2715
2752
|
] }),
|
|
2716
|
-
/* @__PURE__ */ (0,
|
|
2717
|
-
/* @__PURE__ */ (0,
|
|
2753
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "video-dialog-actions", children: [
|
|
2754
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
2718
2755
|
"button",
|
|
2719
2756
|
{
|
|
2720
2757
|
className: "video-dialog-button-cancel",
|
|
@@ -2724,7 +2761,7 @@ var AddVideoDialog = ({ open, onClose, onVideoAdd }) => {
|
|
|
2724
2761
|
children: translations2.videoUpload.cancel
|
|
2725
2762
|
}
|
|
2726
2763
|
),
|
|
2727
|
-
/* @__PURE__ */ (0,
|
|
2764
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
2728
2765
|
"button",
|
|
2729
2766
|
{
|
|
2730
2767
|
className: "video-dialog-button-submit",
|
|
@@ -2745,7 +2782,7 @@ var import_extension_mathematics = require("@tiptap/extension-mathematics");
|
|
|
2745
2782
|
var import_extension_table = require("@tiptap/extension-table");
|
|
2746
2783
|
|
|
2747
2784
|
// src/extensions/editor/callout.ts
|
|
2748
|
-
var
|
|
2785
|
+
var import_react29 = require("@tiptap/react");
|
|
2749
2786
|
|
|
2750
2787
|
// src/utils/handle-exit-node.ts
|
|
2751
2788
|
var import_state = require("@tiptap/pm/state");
|
|
@@ -4297,8 +4334,29 @@ var isSameDomain = (url) => {
|
|
|
4297
4334
|
return false;
|
|
4298
4335
|
}
|
|
4299
4336
|
};
|
|
4337
|
+
var isTrustedDomain = (url, trustedDomains) => {
|
|
4338
|
+
try {
|
|
4339
|
+
const { hostname } = new URL(url);
|
|
4340
|
+
if (typeof window !== "undefined" && hostname === window.location.hostname) {
|
|
4341
|
+
return true;
|
|
4342
|
+
}
|
|
4343
|
+
return trustedDomains.some((trusted) => {
|
|
4344
|
+
const domain2 = trusted.toLowerCase();
|
|
4345
|
+
return hostname === domain2 || hostname.endsWith(`.${domain2}`);
|
|
4346
|
+
});
|
|
4347
|
+
} catch {
|
|
4348
|
+
return false;
|
|
4349
|
+
}
|
|
4350
|
+
};
|
|
4300
4351
|
var LinkExtension = import_extension_link.default.extend({
|
|
4352
|
+
addOptions() {
|
|
4353
|
+
return {
|
|
4354
|
+
...this.parent?.() ?? {},
|
|
4355
|
+
trustedDomains: []
|
|
4356
|
+
};
|
|
4357
|
+
},
|
|
4301
4358
|
addAttributes() {
|
|
4359
|
+
const { trustedDomains } = this.options;
|
|
4302
4360
|
return {
|
|
4303
4361
|
...this.parent?.(),
|
|
4304
4362
|
target: {
|
|
@@ -4312,7 +4370,7 @@ var LinkExtension = import_extension_link.default.extend({
|
|
|
4312
4370
|
default: null,
|
|
4313
4371
|
parseHTML: (element) => {
|
|
4314
4372
|
const href = element.getAttribute("href") ?? "";
|
|
4315
|
-
return
|
|
4373
|
+
return isTrustedDomain(href, trustedDomains) ? null : "noopener noreferrer nofollow";
|
|
4316
4374
|
}
|
|
4317
4375
|
}
|
|
4318
4376
|
};
|
|
@@ -4330,15 +4388,20 @@ var LinkExtension = import_extension_link.default.extend({
|
|
|
4330
4388
|
protocols,
|
|
4331
4389
|
defaultProtocol
|
|
4332
4390
|
})
|
|
4333
|
-
).filter(
|
|
4391
|
+
).filter(
|
|
4392
|
+
(link) => this.options.shouldAutoLink?.(link.value) !== false
|
|
4393
|
+
).map((link) => ({
|
|
4394
|
+
text: link.value,
|
|
4395
|
+
data: { href: link.href },
|
|
4396
|
+
index: link.start
|
|
4397
|
+
})),
|
|
4334
4398
|
type: this.type,
|
|
4335
4399
|
getAttributes: (match) => {
|
|
4336
4400
|
const href = match.data?.href ?? "";
|
|
4337
|
-
const sameDomain = isSameDomain(href);
|
|
4338
4401
|
return {
|
|
4339
4402
|
href,
|
|
4340
|
-
target:
|
|
4341
|
-
rel:
|
|
4403
|
+
target: isSameDomain(href) ? "_self" : "_blank",
|
|
4404
|
+
rel: isTrustedDomain(href, this.options.trustedDomains) ? null : "noopener noreferrer nofollow"
|
|
4342
4405
|
};
|
|
4343
4406
|
}
|
|
4344
4407
|
})
|
|
@@ -4353,7 +4416,11 @@ var LinkExtension = import_extension_link.default.extend({
|
|
|
4353
4416
|
if (!view.editable) return false;
|
|
4354
4417
|
const range = (0, import_core4.getMarkRange)(view.state.doc.resolve(pos), this.type);
|
|
4355
4418
|
if (!range) return false;
|
|
4356
|
-
const selection = import_state3.TextSelection.create(
|
|
4419
|
+
const selection = import_state3.TextSelection.create(
|
|
4420
|
+
view.state.doc,
|
|
4421
|
+
range.from,
|
|
4422
|
+
range.to
|
|
4423
|
+
);
|
|
4357
4424
|
view.dispatch(view.state.tr.setSelection(selection));
|
|
4358
4425
|
return true;
|
|
4359
4426
|
}
|
|
@@ -5106,28 +5173,28 @@ var BaseLegacyFigure = import_extension_image2.default.extend({
|
|
|
5106
5173
|
});
|
|
5107
5174
|
|
|
5108
5175
|
// src/extensions/views/node-views/callout.tsx
|
|
5109
|
-
var
|
|
5110
|
-
var
|
|
5176
|
+
var import_react20 = require("@tiptap/react");
|
|
5177
|
+
var import_react21 = require("react");
|
|
5111
5178
|
|
|
5112
5179
|
// src/icons/color/TiptapCalloutError.tsx
|
|
5113
|
-
var
|
|
5114
|
-
var SvgTiptapCalloutError = (props) => /* @__PURE__ */ (0,
|
|
5115
|
-
/* @__PURE__ */ (0,
|
|
5116
|
-
/* @__PURE__ */ (0,
|
|
5180
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
5181
|
+
var SvgTiptapCalloutError = (props) => /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", ...props, children: [
|
|
5182
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("g", { clipPath: "url(#tiptap-callout-error_svg__a)", children: [
|
|
5183
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5117
5184
|
"path",
|
|
5118
5185
|
{
|
|
5119
5186
|
fill: "#E03757",
|
|
5120
5187
|
d: "M10 0C4.477 0 0 4.477 0 10s4.477 10 10 10 10-4.477 10-10S15.523 0 10 0"
|
|
5121
5188
|
}
|
|
5122
5189
|
),
|
|
5123
|
-
/* @__PURE__ */ (0,
|
|
5190
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5124
5191
|
"path",
|
|
5125
5192
|
{
|
|
5126
5193
|
fill: "#F04760",
|
|
5127
5194
|
d: "M4.692 15.603c6.011 0 10.885-4.874 10.885-10.885a10.9 10.9 0 0 0-.525-3.35A9.95 9.95 0 0 0 10 0C4.477 0 0 4.477 0 10a9.95 9.95 0 0 0 1.394 5.094c1.066.338 2.179.51 3.298.509"
|
|
5128
5195
|
}
|
|
5129
5196
|
),
|
|
5130
|
-
/* @__PURE__ */ (0,
|
|
5197
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5131
5198
|
"path",
|
|
5132
5199
|
{
|
|
5133
5200
|
fill: "#fff",
|
|
@@ -5135,28 +5202,28 @@ var SvgTiptapCalloutError = (props) => /* @__PURE__ */ (0, import_jsx_runtime71.
|
|
|
5135
5202
|
}
|
|
5136
5203
|
)
|
|
5137
5204
|
] }),
|
|
5138
|
-
/* @__PURE__ */ (0,
|
|
5205
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("clipPath", { id: "tiptap-callout-error_svg__a", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("path", { fill: "#fff", d: "M0 0h20v20H0z" }) }) })
|
|
5139
5206
|
] });
|
|
5140
5207
|
var TiptapCalloutError_default = SvgTiptapCalloutError;
|
|
5141
5208
|
|
|
5142
5209
|
// src/icons/color/TiptapCalloutInfo.tsx
|
|
5143
|
-
var
|
|
5144
|
-
var SvgTiptapCalloutInfo = (props) => /* @__PURE__ */ (0,
|
|
5145
|
-
/* @__PURE__ */ (0,
|
|
5210
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
5211
|
+
var SvgTiptapCalloutInfo = (props) => /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", ...props, children: [
|
|
5212
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
5146
5213
|
"path",
|
|
5147
5214
|
{
|
|
5148
5215
|
fill: "#FE9738",
|
|
5149
5216
|
d: "m11.654 11.196 3.51-2.75.549-4.789-4.06-2.234-1.647 2.264a2.79 2.79 0 0 1 1.531 2.28 2.8 2.8 0 0 1-1.85 2.84 3.96 3.96 0 0 0-2.624 3.728v.72c0 .937.76 1.697 1.696 1.697h2.482zm-4.895-3.32H4.277c-.937 0-1.697-.76-1.697-1.697q0-.432.06-.86C3.084 2.135 5.954-.196 9.172.015h2.482L9.888 1.797m1.353 14.796H8.759c-.937 0-1.696.76-1.696 1.696v.014c0 .938.76 1.697 1.696 1.697h2.18"
|
|
5150
5217
|
}
|
|
5151
5218
|
),
|
|
5152
|
-
/* @__PURE__ */ (0,
|
|
5219
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
5153
5220
|
"path",
|
|
5154
5221
|
{
|
|
5155
5222
|
fill: "#FFD15B",
|
|
5156
5223
|
d: "M11.241 14.951c-.937 0-1.697-.76-1.697-1.697v-.72a3.955 3.955 0 0 1 2.625-3.727 2.8 2.8 0 0 0 1.85-2.84A2.79 2.79 0 0 0 11.432 3.4a2.8 2.8 0 0 0-2.976 2.78 1.697 1.697 0 0 1-3.394 0q0-.434.06-.86C5.566 2.133 8.435-.198 11.654.014c3.055.2 5.527 2.653 5.75 5.706a6.2 6.2 0 0 1-4.104 6.286.56.56 0 0 0-.362.529v.72c0 .936-.76 1.696-1.697 1.696m0 5.05c-.937 0-1.697-.76-1.697-1.698v-.014a1.697 1.697 0 0 1 3.394 0v.014c0 .937-.76 1.697-1.697 1.697"
|
|
5157
5224
|
}
|
|
5158
5225
|
),
|
|
5159
|
-
/* @__PURE__ */ (0,
|
|
5226
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
5160
5227
|
"path",
|
|
5161
5228
|
{
|
|
5162
5229
|
fill: "#FFC344",
|
|
@@ -5167,66 +5234,66 @@ var SvgTiptapCalloutInfo = (props) => /* @__PURE__ */ (0, import_jsx_runtime72.j
|
|
|
5167
5234
|
var TiptapCalloutInfo_default = SvgTiptapCalloutInfo;
|
|
5168
5235
|
|
|
5169
5236
|
// src/icons/color/TiptapCalloutSuccess.tsx
|
|
5170
|
-
var
|
|
5171
|
-
var SvgTiptapCalloutSuccess = (props) => /* @__PURE__ */ (0,
|
|
5172
|
-
/* @__PURE__ */ (0,
|
|
5173
|
-
/* @__PURE__ */ (0,
|
|
5237
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
5238
|
+
var SvgTiptapCalloutSuccess = (props) => /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", ...props, children: [
|
|
5239
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("g", { clipPath: "url(#tiptap-callout-success_svg__a)", children: [
|
|
5240
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
5174
5241
|
"path",
|
|
5175
5242
|
{
|
|
5176
5243
|
fill: "#35495E",
|
|
5177
5244
|
d: "M1.972 18.004.06 7.138a2.4 2.4 0 0 1-.035-.317 2.47 2.47 0 0 1 2.073-2.493l3.693-.652-.1 14.328z"
|
|
5178
5245
|
}
|
|
5179
5246
|
),
|
|
5180
|
-
/* @__PURE__ */ (0,
|
|
5247
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
5181
5248
|
"path",
|
|
5182
5249
|
{
|
|
5183
5250
|
fill: "#2C3E50",
|
|
5184
5251
|
d: "M16.186 17.528a.69.69 0 0 1-.548.517l-10.87 1.917a2.42 2.42 0 0 1-2.83-2.276 2.46 2.46 0 0 1 1.934-2.462l3.045.855h-.003l-2.742.487a1.037 1.037 0 0 0-.786 1.396 1.066 1.066 0 0 0 1.186.635l8.307-1.466z"
|
|
5185
5252
|
}
|
|
5186
5253
|
),
|
|
5187
|
-
/* @__PURE__ */ (0,
|
|
5254
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
5188
5255
|
"path",
|
|
5189
5256
|
{
|
|
5190
5257
|
fill: "#F9EAB0",
|
|
5191
5258
|
d: "m6.914 16.08-2.742.486a1.035 1.035 0 0 0-.786 1.396 1.066 1.066 0 0 0 1.186.635l8.307-1.466z"
|
|
5192
5259
|
}
|
|
5193
5260
|
),
|
|
5194
|
-
/* @__PURE__ */ (0,
|
|
5261
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
5195
5262
|
"path",
|
|
5196
5263
|
{
|
|
5197
5264
|
fill: "#E64C3C",
|
|
5198
5265
|
d: "M4.423 11.438 6.339.571a.695.695 0 0 1 .799-.559l10.785 1.902a2.47 2.47 0 0 1 2.074 2.495 3 3 0 0 1-.034.316l-1.917 10.867z"
|
|
5199
5266
|
}
|
|
5200
5267
|
),
|
|
5201
|
-
/* @__PURE__ */ (0,
|
|
5268
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
5202
5269
|
"path",
|
|
5203
5270
|
{
|
|
5204
5271
|
fill: "#3F5C6C",
|
|
5205
5272
|
d: "M15.668 3.612a.4.4 0 0 1-.06-.005l-7.81-1.378a.345.345 0 0 1 .12-.677l7.81 1.375a.345.345 0 0 1-.06.685M14.01 5.069a.3.3 0 0 1-.06-.005l-5.094-.897a.345.345 0 0 1 .12-.68l5.094.897a.345.345 0 0 1-.06.685"
|
|
5206
5273
|
}
|
|
5207
5274
|
),
|
|
5208
|
-
/* @__PURE__ */ (0,
|
|
5275
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
5209
5276
|
"path",
|
|
5210
5277
|
{
|
|
5211
5278
|
fill: "#ECF0F1",
|
|
5212
5279
|
d: "m14.727 6.608-7.131-1.26a.345.345 0 0 0-.4.28l-.6 3.395a.345.345 0 0 0 .28.4l7.13 1.26a.345.345 0 0 0 .4-.28l.6-3.396a.345.345 0 0 0-.28-.4"
|
|
5213
5280
|
}
|
|
5214
5281
|
),
|
|
5215
|
-
/* @__PURE__ */ (0,
|
|
5282
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
5216
5283
|
"path",
|
|
5217
5284
|
{
|
|
5218
5285
|
fill: "#C03A2B",
|
|
5219
5286
|
d: "M19.997 4.407a2 2 0 0 1-.035.317L18.045 15.59l-2.659-.81 1.542-8.738.365-2.063.373-2.11.258.045a2.47 2.47 0 0 1 2.073 2.493"
|
|
5220
5287
|
}
|
|
5221
5288
|
),
|
|
5222
|
-
/* @__PURE__ */ (0,
|
|
5289
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
5223
5290
|
"path",
|
|
5224
5291
|
{
|
|
5225
5292
|
fill: "#802F34",
|
|
5226
5293
|
d: "M16.007 12.78 5.22 10.88a.69.69 0 0 0-.238 1.358l10.865 1.914a1.038 1.038 0 0 1 .783 1.4 1.06 1.06 0 0 1-1.183.63L4.624 14.277a.69.69 0 0 0-.241 1.359l10.869 1.913a2.416 2.416 0 0 0 2.83-2.272 2.474 2.474 0 0 0-2.075-2.496"
|
|
5227
5294
|
}
|
|
5228
5295
|
),
|
|
5229
|
-
/* @__PURE__ */ (0,
|
|
5296
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
5230
5297
|
"path",
|
|
5231
5298
|
{
|
|
5232
5299
|
fill: "#F9EAB0",
|
|
@@ -5234,14 +5301,14 @@ var SvgTiptapCalloutSuccess = (props) => /* @__PURE__ */ (0, import_jsx_runtime7
|
|
|
5234
5301
|
}
|
|
5235
5302
|
)
|
|
5236
5303
|
] }),
|
|
5237
|
-
/* @__PURE__ */ (0,
|
|
5304
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("clipPath", { id: "tiptap-callout-success_svg__a", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("path", { fill: "#fff", d: "M0 0h20v20H0z" }) }) })
|
|
5238
5305
|
] });
|
|
5239
5306
|
var TiptapCalloutSuccess_default = SvgTiptapCalloutSuccess;
|
|
5240
5307
|
|
|
5241
5308
|
// src/icons/color/TiptapCalloutWarning.tsx
|
|
5242
|
-
var
|
|
5243
|
-
var SvgTiptapCalloutWarning = (props) => /* @__PURE__ */ (0,
|
|
5244
|
-
/* @__PURE__ */ (0,
|
|
5309
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
5310
|
+
var SvgTiptapCalloutWarning = (props) => /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", ...props, children: [
|
|
5311
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
5245
5312
|
"path",
|
|
5246
5313
|
{
|
|
5247
5314
|
fill: "#FFF59D",
|
|
@@ -5249,29 +5316,29 @@ var SvgTiptapCalloutWarning = (props) => /* @__PURE__ */ (0, import_jsx_runtime7
|
|
|
5249
5316
|
d: "M1.667 9.167a8.333 8.333 0 1 0 16.666 0 8.333 8.333 0 0 0-16.666 0"
|
|
5250
5317
|
}
|
|
5251
5318
|
),
|
|
5252
|
-
/* @__PURE__ */ (0,
|
|
5319
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
5253
5320
|
"path",
|
|
5254
5321
|
{
|
|
5255
5322
|
fill: "#FBC02D",
|
|
5256
5323
|
d: "M15.417 9.167c0-3.209-2.75-5.75-6.042-5.375-2.5.291-4.5 2.291-4.75 4.791a5.27 5.27 0 0 0 1.917 4.709c.583.5.958 1.208.958 2v.125h5v-.042c0-.75.333-1.5.917-2 1.208-1 2-2.5 2-4.208"
|
|
5257
5324
|
}
|
|
5258
5325
|
),
|
|
5259
|
-
/* @__PURE__ */ (0,
|
|
5326
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
5260
5327
|
"path",
|
|
5261
5328
|
{
|
|
5262
5329
|
fill: "#FFF59D",
|
|
5263
5330
|
d: "m12.75 8.417-1.25-.834a.45.45 0 0 0-.458 0L10 8.25l-1-.667a.45.45 0 0 0-.458 0l-1.25.834c-.084.083-.167.166-.167.291s0 .25.083.334L8.792 11v4.417h.833v-4.584c0-.083-.042-.166-.083-.25L8.167 8.875l.625-.417 1 .667a.45.45 0 0 0 .458 0l1-.667.625.417-1.375 1.708a.6.6 0 0 0-.083.25v4.584h.833V11l1.583-1.958a.32.32 0 0 0 .084-.334c-.042-.125-.084-.25-.167-.291"
|
|
5264
5331
|
}
|
|
5265
5332
|
),
|
|
5266
|
-
/* @__PURE__ */ (0,
|
|
5267
|
-
/* @__PURE__ */ (0,
|
|
5333
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("path", { fill: "#5C6BC0", d: "M8.75 18.334a1.25 1.25 0 1 0 2.5 0 1.25 1.25 0 0 0-2.5 0" }),
|
|
5334
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
5268
5335
|
"path",
|
|
5269
5336
|
{
|
|
5270
5337
|
fill: "#9FA8DA",
|
|
5271
5338
|
d: "M10.833 18.75H9.167C8.25 18.75 7.5 18 7.5 17.083V15h5v2.083c0 .917-.75 1.667-1.667 1.667"
|
|
5272
5339
|
}
|
|
5273
5340
|
),
|
|
5274
|
-
/* @__PURE__ */ (0,
|
|
5341
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
5275
5342
|
"path",
|
|
5276
5343
|
{
|
|
5277
5344
|
fill: "#5C6BC0",
|
|
@@ -5424,12 +5491,12 @@ var calloutCustomEmojis = [
|
|
|
5424
5491
|
];
|
|
5425
5492
|
|
|
5426
5493
|
// src/extensions/views/components/callout.tsx
|
|
5427
|
-
var
|
|
5494
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
5428
5495
|
var calloutIcons = {
|
|
5429
|
-
info: /* @__PURE__ */ (0,
|
|
5430
|
-
warning: /* @__PURE__ */ (0,
|
|
5431
|
-
success: /* @__PURE__ */ (0,
|
|
5432
|
-
error: /* @__PURE__ */ (0,
|
|
5496
|
+
info: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(TiptapCalloutInfo_default, {}),
|
|
5497
|
+
warning: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(TiptapCalloutWarning_default, {}),
|
|
5498
|
+
success: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(TiptapCalloutSuccess_default, {}),
|
|
5499
|
+
error: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(TiptapCalloutError_default, {})
|
|
5433
5500
|
};
|
|
5434
5501
|
var legacyTypeMap3 = {
|
|
5435
5502
|
question: "info",
|
|
@@ -5447,15 +5514,15 @@ var Callout = ({ type, bgColor, emoji: emoji2, children, iconWrapper, calloutTyp
|
|
|
5447
5514
|
if (emoji2) {
|
|
5448
5515
|
if (emoji2 in calloutIconComponents) {
|
|
5449
5516
|
const IconComponent = calloutIconComponents[emoji2];
|
|
5450
|
-
icon = /* @__PURE__ */ (0,
|
|
5517
|
+
icon = /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(IconComponent, {});
|
|
5451
5518
|
} else {
|
|
5452
5519
|
icon = emoji2;
|
|
5453
5520
|
}
|
|
5454
5521
|
} else {
|
|
5455
5522
|
icon = calloutIcons[finalType];
|
|
5456
5523
|
}
|
|
5457
|
-
const iconContent = iconWrapper ? iconWrapper(icon) : /* @__PURE__ */ (0,
|
|
5458
|
-
return /* @__PURE__ */ (0,
|
|
5524
|
+
const iconContent = iconWrapper ? iconWrapper(icon) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "callout-icon", children: icon });
|
|
5525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
5459
5526
|
"div",
|
|
5460
5527
|
{
|
|
5461
5528
|
className,
|
|
@@ -5465,33 +5532,33 @@ var Callout = ({ type, bgColor, emoji: emoji2, children, iconWrapper, calloutTyp
|
|
|
5465
5532
|
style,
|
|
5466
5533
|
children: [
|
|
5467
5534
|
iconContent,
|
|
5468
|
-
/* @__PURE__ */ (0,
|
|
5535
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "callout-content-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "callout-content", children }) })
|
|
5469
5536
|
]
|
|
5470
5537
|
}
|
|
5471
5538
|
);
|
|
5472
5539
|
};
|
|
5473
5540
|
|
|
5474
5541
|
// src/extensions/views/components/code-block.tsx
|
|
5475
|
-
var
|
|
5542
|
+
var import_react18 = require("react");
|
|
5476
5543
|
var import_xml2 = __toESM(require("highlight.js/lib/languages/xml"));
|
|
5477
5544
|
var import_lowlight2 = require("lowlight");
|
|
5478
5545
|
|
|
5479
5546
|
// src/extensions/views/components/copy-button.tsx
|
|
5480
|
-
var
|
|
5547
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
5481
5548
|
var CopyButton = ({ iconSize = 16, color = "black" }) => {
|
|
5482
|
-
return /* @__PURE__ */ (0,
|
|
5549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
5483
5550
|
"button",
|
|
5484
5551
|
{
|
|
5485
5552
|
className: `copy-button copy-icon-${color}`,
|
|
5486
5553
|
"data-copy-action": "copy",
|
|
5487
5554
|
type: "button",
|
|
5488
5555
|
children: [
|
|
5489
|
-
/* @__PURE__ */ (0,
|
|
5556
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
5490
5557
|
"span",
|
|
5491
5558
|
{
|
|
5492
5559
|
className: "copy-icon",
|
|
5493
5560
|
"data-copy-icon": "default",
|
|
5494
|
-
children: /* @__PURE__ */ (0,
|
|
5561
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
5495
5562
|
Copy_default,
|
|
5496
5563
|
{
|
|
5497
5564
|
width: iconSize,
|
|
@@ -5500,13 +5567,13 @@ var CopyButton = ({ iconSize = 16, color = "black" }) => {
|
|
|
5500
5567
|
)
|
|
5501
5568
|
}
|
|
5502
5569
|
),
|
|
5503
|
-
/* @__PURE__ */ (0,
|
|
5570
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
5504
5571
|
"span",
|
|
5505
5572
|
{
|
|
5506
5573
|
className: "copy-icon-success",
|
|
5507
5574
|
"data-copy-icon": "success",
|
|
5508
5575
|
style: { display: "none" },
|
|
5509
|
-
children: /* @__PURE__ */ (0,
|
|
5576
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
5510
5577
|
Check_default,
|
|
5511
5578
|
{
|
|
5512
5579
|
width: iconSize,
|
|
@@ -5521,7 +5588,7 @@ var CopyButton = ({ iconSize = 16, color = "black" }) => {
|
|
|
5521
5588
|
};
|
|
5522
5589
|
|
|
5523
5590
|
// src/extensions/views/components/code-block.tsx
|
|
5524
|
-
var
|
|
5591
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
5525
5592
|
var CodeBlock = ({
|
|
5526
5593
|
language,
|
|
5527
5594
|
isEditable,
|
|
@@ -5529,7 +5596,7 @@ var CodeBlock = ({
|
|
|
5529
5596
|
children,
|
|
5530
5597
|
translations: translations2
|
|
5531
5598
|
}) => {
|
|
5532
|
-
const languagesList = (0,
|
|
5599
|
+
const languagesList = (0, import_react18.useMemo)(() => {
|
|
5533
5600
|
const lowlight2 = (0, import_lowlight2.createLowlight)(import_lowlight2.common);
|
|
5534
5601
|
lowlight2.register("html", import_xml2.default);
|
|
5535
5602
|
const list = lowlight2.listLanguages();
|
|
@@ -5538,17 +5605,17 @@ var CodeBlock = ({
|
|
|
5538
5605
|
const handleChange = (e) => {
|
|
5539
5606
|
onLanguageChange?.(e.target.value);
|
|
5540
5607
|
};
|
|
5541
|
-
return /* @__PURE__ */ (0,
|
|
5542
|
-
/* @__PURE__ */ (0,
|
|
5543
|
-
isEditable ? /* @__PURE__ */ (0,
|
|
5608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "tiptap-code-block-wrapper", children: [
|
|
5609
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "tiptap-code-block-header", children: [
|
|
5610
|
+
isEditable ? /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
5544
5611
|
"select",
|
|
5545
5612
|
{
|
|
5546
5613
|
className: "tiptap-code-block-language-select",
|
|
5547
5614
|
value: language,
|
|
5548
5615
|
onChange: handleChange,
|
|
5549
5616
|
children: [
|
|
5550
|
-
/* @__PURE__ */ (0,
|
|
5551
|
-
languagesList.map((lang) => /* @__PURE__ */ (0,
|
|
5617
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("option", { value: "", children: translations2?.codeBlock.selectLanguage }),
|
|
5618
|
+
languagesList.map((lang) => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
5552
5619
|
"option",
|
|
5553
5620
|
{
|
|
5554
5621
|
value: lang,
|
|
@@ -5558,8 +5625,8 @@ var CodeBlock = ({
|
|
|
5558
5625
|
))
|
|
5559
5626
|
]
|
|
5560
5627
|
}
|
|
5561
|
-
) : /* @__PURE__ */ (0,
|
|
5562
|
-
/* @__PURE__ */ (0,
|
|
5628
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "tiptap-code-block-language-text", children: language || translations2?.codeBlock.selectLanguage }),
|
|
5629
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
5563
5630
|
CopyButton,
|
|
5564
5631
|
{
|
|
5565
5632
|
iconSize: 20,
|
|
@@ -5567,7 +5634,7 @@ var CodeBlock = ({
|
|
|
5567
5634
|
}
|
|
5568
5635
|
)
|
|
5569
5636
|
] }),
|
|
5570
|
-
/* @__PURE__ */ (0,
|
|
5637
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("pre", { className: "tiptap-code-block", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
5571
5638
|
"code",
|
|
5572
5639
|
{
|
|
5573
5640
|
className: "tiptap-code-block-content",
|
|
@@ -5579,22 +5646,22 @@ var CodeBlock = ({
|
|
|
5579
5646
|
};
|
|
5580
5647
|
|
|
5581
5648
|
// src/extensions/views/components/copyable-text.tsx
|
|
5582
|
-
var
|
|
5649
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
5583
5650
|
var CopyableText2 = ({ children }) => {
|
|
5584
|
-
return /* @__PURE__ */ (0,
|
|
5585
|
-
/* @__PURE__ */ (0,
|
|
5586
|
-
/* @__PURE__ */ (0,
|
|
5651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("span", { className: "copyable", children: [
|
|
5652
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { "data-copy-content": true, children }),
|
|
5653
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(CopyButton, { iconSize: 16 })
|
|
5587
5654
|
] });
|
|
5588
5655
|
};
|
|
5589
5656
|
|
|
5590
5657
|
// src/extensions/views/components/custom-quote.tsx
|
|
5591
|
-
var
|
|
5592
|
-
var CustomQuote = ({ children }) => /* @__PURE__ */ (0,
|
|
5593
|
-
/* @__PURE__ */ (0,
|
|
5594
|
-
/* @__PURE__ */ (0,
|
|
5658
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
5659
|
+
var CustomQuote = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { "data-custom-quote": "", children: [
|
|
5660
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "custom-quote-divider" }),
|
|
5661
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "custom-quote-svg-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Quote_default, {}) }),
|
|
5595
5662
|
children
|
|
5596
5663
|
] });
|
|
5597
|
-
var CustomQuoteText = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0,
|
|
5664
|
+
var CustomQuoteText = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
5598
5665
|
"div",
|
|
5599
5666
|
{
|
|
5600
5667
|
"data-custom-quote-text": true,
|
|
@@ -5603,7 +5670,7 @@ var CustomQuoteText = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0
|
|
|
5603
5670
|
children
|
|
5604
5671
|
}
|
|
5605
5672
|
);
|
|
5606
|
-
var CustomQuoteAuthor = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0,
|
|
5673
|
+
var CustomQuoteAuthor = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
5607
5674
|
"div",
|
|
5608
5675
|
{
|
|
5609
5676
|
"data-custom-quote-author": "",
|
|
@@ -5612,7 +5679,7 @@ var CustomQuoteAuthor = ({ children, isEmpty, placeholder }) => /* @__PURE__ */
|
|
|
5612
5679
|
children
|
|
5613
5680
|
}
|
|
5614
5681
|
);
|
|
5615
|
-
var CustomQuoteSign = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0,
|
|
5682
|
+
var CustomQuoteSign = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
5616
5683
|
"div",
|
|
5617
5684
|
{
|
|
5618
5685
|
"data-custom-quote-sign": "",
|
|
@@ -5623,7 +5690,7 @@ var CustomQuoteSign = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0
|
|
|
5623
5690
|
);
|
|
5624
5691
|
|
|
5625
5692
|
// src/extensions/views/components/figure.tsx
|
|
5626
|
-
var
|
|
5693
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
5627
5694
|
var Figure = ({
|
|
5628
5695
|
src,
|
|
5629
5696
|
alt,
|
|
@@ -5638,9 +5705,9 @@ var Figure = ({
|
|
|
5638
5705
|
getImageById
|
|
5639
5706
|
}) => {
|
|
5640
5707
|
const resolvedSrc = resolveImageSrc({ fileId, src }, { getImageById });
|
|
5641
|
-
return /* @__PURE__ */ (0,
|
|
5642
|
-
resolvedSrc && /* @__PURE__ */ (0,
|
|
5643
|
-
/* @__PURE__ */ (0,
|
|
5708
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("figure", { children: [
|
|
5709
|
+
resolvedSrc && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "figure-image-container", children: [
|
|
5710
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
5644
5711
|
"img",
|
|
5645
5712
|
{
|
|
5646
5713
|
src: resolvedSrc,
|
|
@@ -5650,7 +5717,7 @@ var Figure = ({
|
|
|
5650
5717
|
height: height || void 0
|
|
5651
5718
|
}
|
|
5652
5719
|
),
|
|
5653
|
-
isEditable && onEditClick && /* @__PURE__ */ (0,
|
|
5720
|
+
isEditable && onEditClick && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
5654
5721
|
"button",
|
|
5655
5722
|
{
|
|
5656
5723
|
type: "button",
|
|
@@ -5658,19 +5725,19 @@ var Figure = ({
|
|
|
5658
5725
|
onClick: onEditClick,
|
|
5659
5726
|
contentEditable: false,
|
|
5660
5727
|
"aria-label": "\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435",
|
|
5661
|
-
children: /* @__PURE__ */ (0,
|
|
5728
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Edit_default, {})
|
|
5662
5729
|
}
|
|
5663
5730
|
)
|
|
5664
5731
|
] }),
|
|
5665
|
-
caption && /* @__PURE__ */ (0,
|
|
5732
|
+
caption && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("figcaption", { children: caption }),
|
|
5666
5733
|
children
|
|
5667
5734
|
] });
|
|
5668
5735
|
};
|
|
5669
5736
|
|
|
5670
5737
|
// src/extensions/views/components/prompt.tsx
|
|
5671
|
-
var
|
|
5672
|
-
var PromptHeader = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0,
|
|
5673
|
-
/* @__PURE__ */ (0,
|
|
5738
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
5739
|
+
var PromptHeader = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "prompt-header-wrapper", children: [
|
|
5740
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
5674
5741
|
"div",
|
|
5675
5742
|
{
|
|
5676
5743
|
className: isEmpty ? "is-empty" : "",
|
|
@@ -5678,7 +5745,7 @@ var PromptHeader = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0, i
|
|
|
5678
5745
|
children
|
|
5679
5746
|
}
|
|
5680
5747
|
),
|
|
5681
|
-
/* @__PURE__ */ (0,
|
|
5748
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { className: "prompt-copy-icon-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
5682
5749
|
CopyButton,
|
|
5683
5750
|
{
|
|
5684
5751
|
iconSize: 16,
|
|
@@ -5686,7 +5753,7 @@ var PromptHeader = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0, i
|
|
|
5686
5753
|
}
|
|
5687
5754
|
) })
|
|
5688
5755
|
] });
|
|
5689
|
-
var PromptContent = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0,
|
|
5756
|
+
var PromptContent = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "prompt-content-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
5690
5757
|
"div",
|
|
5691
5758
|
{
|
|
5692
5759
|
className: isEmpty ? "is-empty" : "",
|
|
@@ -5697,22 +5764,22 @@ var PromptContent = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0,
|
|
|
5697
5764
|
) });
|
|
5698
5765
|
|
|
5699
5766
|
// src/extensions/views/components/video.tsx
|
|
5700
|
-
var
|
|
5767
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
5701
5768
|
var Video = ({ src, children }) => {
|
|
5702
5769
|
const videoInfo = detectVideoHosting(src);
|
|
5703
5770
|
if (!videoInfo?.embedUrl) {
|
|
5704
|
-
return /* @__PURE__ */ (0,
|
|
5705
|
-
/* @__PURE__ */ (0,
|
|
5771
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "video-node", children: [
|
|
5772
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "video-error", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { children: "Unsupported or invalid video URL" }) }),
|
|
5706
5773
|
children
|
|
5707
5774
|
] });
|
|
5708
5775
|
}
|
|
5709
|
-
return /* @__PURE__ */ (0,
|
|
5776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
5710
5777
|
"div",
|
|
5711
5778
|
{
|
|
5712
5779
|
className: "video-node",
|
|
5713
5780
|
"data-video": "",
|
|
5714
5781
|
children: [
|
|
5715
|
-
/* @__PURE__ */ (0,
|
|
5782
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "video-player-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
5716
5783
|
"iframe",
|
|
5717
5784
|
{
|
|
5718
5785
|
className: "video-iframe",
|
|
@@ -5729,13 +5796,13 @@ var Video = ({ src, children }) => {
|
|
|
5729
5796
|
};
|
|
5730
5797
|
|
|
5731
5798
|
// src/editor/controls/emoji-picker.tsx
|
|
5732
|
-
var
|
|
5799
|
+
var import_react19 = require("react");
|
|
5733
5800
|
var import_emoji_picker_react = __toESM(require("emoji-picker-react"));
|
|
5734
|
-
var
|
|
5801
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
5735
5802
|
var EmojiPickerComponent = ({ isOpen, onClose, onEmojiSelect }) => {
|
|
5736
|
-
const pickerRef = (0,
|
|
5803
|
+
const pickerRef = (0, import_react19.useRef)(null);
|
|
5737
5804
|
const translations2 = useTiptapTranslations();
|
|
5738
|
-
(0,
|
|
5805
|
+
(0, import_react19.useEffect)(() => {
|
|
5739
5806
|
const handleClickOutside = (event) => {
|
|
5740
5807
|
if (pickerRef.current && !pickerRef.current.contains(event.target)) {
|
|
5741
5808
|
onClose();
|
|
@@ -5749,12 +5816,12 @@ var EmojiPickerComponent = ({ isOpen, onClose, onEmojiSelect }) => {
|
|
|
5749
5816
|
};
|
|
5750
5817
|
}, [isOpen, onClose]);
|
|
5751
5818
|
if (!isOpen) return null;
|
|
5752
|
-
return /* @__PURE__ */ (0,
|
|
5819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
5753
5820
|
"div",
|
|
5754
5821
|
{
|
|
5755
5822
|
ref: pickerRef,
|
|
5756
5823
|
className: "tiptap__emoji-picker-wrapper",
|
|
5757
|
-
children: /* @__PURE__ */ (0,
|
|
5824
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
5758
5825
|
import_emoji_picker_react.default,
|
|
5759
5826
|
{
|
|
5760
5827
|
skinTonesDisabled: true,
|
|
@@ -5779,12 +5846,12 @@ var EmojiPickerComponent = ({ isOpen, onClose, onEmojiSelect }) => {
|
|
|
5779
5846
|
};
|
|
5780
5847
|
|
|
5781
5848
|
// src/extensions/views/node-views/callout.tsx
|
|
5782
|
-
var
|
|
5849
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
5783
5850
|
var CalloutView = (props) => {
|
|
5784
5851
|
const type = props.node.attrs.type || "info";
|
|
5785
5852
|
const bgColor = props.node.attrs.bgColor;
|
|
5786
5853
|
const emoji2 = props.node.attrs.emoji;
|
|
5787
|
-
const [showEmojiPicker, setShowEmojiPicker] = (0,
|
|
5854
|
+
const [showEmojiPicker, setShowEmojiPicker] = (0, import_react21.useState)(false);
|
|
5788
5855
|
const handleIconClick = (e) => {
|
|
5789
5856
|
e.preventDefault();
|
|
5790
5857
|
e.stopPropagation();
|
|
@@ -5794,23 +5861,23 @@ var CalloutView = (props) => {
|
|
|
5794
5861
|
props.updateAttributes({ emoji: newEmoji });
|
|
5795
5862
|
setShowEmojiPicker(false);
|
|
5796
5863
|
};
|
|
5797
|
-
return /* @__PURE__ */ (0,
|
|
5864
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react20.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
5798
5865
|
Callout,
|
|
5799
5866
|
{
|
|
5800
5867
|
type,
|
|
5801
5868
|
bgColor,
|
|
5802
5869
|
emoji: emoji2,
|
|
5803
|
-
iconWrapper: (icon) => /* @__PURE__ */ (0,
|
|
5804
|
-
/* @__PURE__ */ (0,
|
|
5870
|
+
iconWrapper: (icon) => /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "callout-icon-wrapper", children: [
|
|
5871
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
5805
5872
|
"button",
|
|
5806
5873
|
{
|
|
5807
5874
|
className: "callout-icon-button",
|
|
5808
5875
|
onClick: handleIconClick,
|
|
5809
5876
|
type: "button",
|
|
5810
|
-
children: /* @__PURE__ */ (0,
|
|
5877
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "callout-icon", children: icon })
|
|
5811
5878
|
}
|
|
5812
5879
|
),
|
|
5813
|
-
/* @__PURE__ */ (0,
|
|
5880
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
5814
5881
|
EmojiPickerComponent,
|
|
5815
5882
|
{
|
|
5816
5883
|
isOpen: showEmojiPicker,
|
|
@@ -5819,87 +5886,87 @@ var CalloutView = (props) => {
|
|
|
5819
5886
|
}
|
|
5820
5887
|
)
|
|
5821
5888
|
] }),
|
|
5822
|
-
children: /* @__PURE__ */ (0,
|
|
5889
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react20.NodeViewContent, { as: "div" })
|
|
5823
5890
|
}
|
|
5824
5891
|
) });
|
|
5825
5892
|
};
|
|
5826
5893
|
|
|
5827
5894
|
// src/extensions/views/node-views/code-block.tsx
|
|
5828
|
-
var
|
|
5829
|
-
var
|
|
5830
|
-
var
|
|
5895
|
+
var import_react22 = require("react");
|
|
5896
|
+
var import_react23 = require("@tiptap/react");
|
|
5897
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
5831
5898
|
var CodeBlockView = (props) => {
|
|
5832
|
-
const [selectedLanguage, setSelectedLanguage] = (0,
|
|
5899
|
+
const [selectedLanguage, setSelectedLanguage] = (0, import_react22.useState)(props.node.attrs.language ?? "");
|
|
5833
5900
|
const translations2 = useTiptapTranslations();
|
|
5834
5901
|
const handleLanguageChange = (language) => {
|
|
5835
5902
|
props.updateAttributes({ language });
|
|
5836
5903
|
setSelectedLanguage(language);
|
|
5837
5904
|
};
|
|
5838
|
-
return /* @__PURE__ */ (0,
|
|
5905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_react23.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
5839
5906
|
CodeBlock,
|
|
5840
5907
|
{
|
|
5841
5908
|
language: selectedLanguage,
|
|
5842
5909
|
isEditable: props.editor.isEditable,
|
|
5843
5910
|
onLanguageChange: handleLanguageChange,
|
|
5844
5911
|
translations: translations2,
|
|
5845
|
-
children: /* @__PURE__ */ (0,
|
|
5912
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_react23.NodeViewContent, {})
|
|
5846
5913
|
}
|
|
5847
5914
|
) });
|
|
5848
5915
|
};
|
|
5849
5916
|
|
|
5850
5917
|
// src/extensions/views/node-views/copyable-text.tsx
|
|
5851
|
-
var
|
|
5852
|
-
var
|
|
5918
|
+
var import_react24 = require("@tiptap/react");
|
|
5919
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
5853
5920
|
var CopyableTextView = () => {
|
|
5854
|
-
return /* @__PURE__ */ (0,
|
|
5921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(CopyableText2, { children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react24.MarkViewContent, {}) });
|
|
5855
5922
|
};
|
|
5856
5923
|
|
|
5857
5924
|
// src/extensions/views/node-views/custom-quote.tsx
|
|
5858
|
-
var
|
|
5859
|
-
var
|
|
5925
|
+
var import_react25 = require("@tiptap/react");
|
|
5926
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
5860
5927
|
var CustomQuoteView = () => {
|
|
5861
|
-
return /* @__PURE__ */ (0,
|
|
5928
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react25.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(CustomQuote, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react25.NodeViewContent, {}) }) });
|
|
5862
5929
|
};
|
|
5863
5930
|
var CustomQuoteTextView = (props) => {
|
|
5864
5931
|
const isEmpty = !props.node.content.size;
|
|
5865
5932
|
const translations2 = useTiptapTranslations();
|
|
5866
|
-
return /* @__PURE__ */ (0,
|
|
5933
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react25.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
5867
5934
|
CustomQuoteText,
|
|
5868
5935
|
{
|
|
5869
5936
|
isEmpty,
|
|
5870
5937
|
placeholder: translations2.customQuote.textPlaceholder,
|
|
5871
|
-
children: /* @__PURE__ */ (0,
|
|
5938
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react25.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
|
|
5872
5939
|
}
|
|
5873
5940
|
) });
|
|
5874
5941
|
};
|
|
5875
5942
|
var CustomQuoteAuthorView = (props) => {
|
|
5876
5943
|
const isEmpty = !props.node.content.size;
|
|
5877
5944
|
const translations2 = useTiptapTranslations();
|
|
5878
|
-
return /* @__PURE__ */ (0,
|
|
5945
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react25.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
5879
5946
|
CustomQuoteAuthor,
|
|
5880
5947
|
{
|
|
5881
5948
|
isEmpty,
|
|
5882
5949
|
placeholder: translations2.customQuote.authorPlaceholder,
|
|
5883
|
-
children: /* @__PURE__ */ (0,
|
|
5950
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react25.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
|
|
5884
5951
|
}
|
|
5885
5952
|
) });
|
|
5886
5953
|
};
|
|
5887
5954
|
var CustomQuoteSignView = (props) => {
|
|
5888
5955
|
const isEmpty = !props.node.content.size;
|
|
5889
5956
|
const translations2 = useTiptapTranslations();
|
|
5890
|
-
return /* @__PURE__ */ (0,
|
|
5957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react25.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
5891
5958
|
CustomQuoteSign,
|
|
5892
5959
|
{
|
|
5893
5960
|
isEmpty,
|
|
5894
5961
|
placeholder: translations2.customQuote.signPlaceholder,
|
|
5895
|
-
children: /* @__PURE__ */ (0,
|
|
5962
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react25.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
|
|
5896
5963
|
}
|
|
5897
5964
|
) });
|
|
5898
5965
|
};
|
|
5899
5966
|
|
|
5900
5967
|
// src/extensions/views/node-views/figure.tsx
|
|
5901
|
-
var
|
|
5902
|
-
var
|
|
5968
|
+
var import_react26 = require("@tiptap/react");
|
|
5969
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
5903
5970
|
var FigureView = ({ node, getPos, editor }) => {
|
|
5904
5971
|
const { fileId, src, alt, title, caption, width, height } = node.attrs;
|
|
5905
5972
|
const imageExtension = editor.extensionManager.extensions.find((ext) => ext.name === "image");
|
|
@@ -5908,12 +5975,12 @@ var FigureView = ({ node, getPos, editor }) => {
|
|
|
5908
5975
|
const handleEditClick = () => {
|
|
5909
5976
|
onFigureClick?.(node.attrs, getPos());
|
|
5910
5977
|
};
|
|
5911
|
-
return /* @__PURE__ */ (0,
|
|
5912
|
-
|
|
5978
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
5979
|
+
import_react26.NodeViewWrapper,
|
|
5913
5980
|
{
|
|
5914
5981
|
className: "figure-node-view",
|
|
5915
5982
|
"data-drag-handle": true,
|
|
5916
|
-
children: /* @__PURE__ */ (0,
|
|
5983
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
5917
5984
|
Figure,
|
|
5918
5985
|
{
|
|
5919
5986
|
fileId,
|
|
@@ -5933,40 +6000,40 @@ var FigureView = ({ node, getPos, editor }) => {
|
|
|
5933
6000
|
};
|
|
5934
6001
|
|
|
5935
6002
|
// src/extensions/views/node-views/prompt.tsx
|
|
5936
|
-
var
|
|
5937
|
-
var
|
|
6003
|
+
var import_react27 = require("@tiptap/react");
|
|
6004
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
5938
6005
|
var PromptHeaderView = (props) => {
|
|
5939
6006
|
const isEmpty = !props.node.content.size;
|
|
5940
6007
|
const translations2 = useTiptapTranslations();
|
|
5941
|
-
return /* @__PURE__ */ (0,
|
|
6008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react27.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5942
6009
|
PromptHeader,
|
|
5943
6010
|
{
|
|
5944
6011
|
isEmpty,
|
|
5945
6012
|
placeholder: translations2.prompt.headerPlaceholder,
|
|
5946
|
-
children: /* @__PURE__ */ (0,
|
|
6013
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react27.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
|
|
5947
6014
|
}
|
|
5948
6015
|
) });
|
|
5949
6016
|
};
|
|
5950
6017
|
var PromptContentView = (props) => {
|
|
5951
6018
|
const isEmpty = !props.node.content.size;
|
|
5952
6019
|
const translations2 = useTiptapTranslations();
|
|
5953
|
-
return /* @__PURE__ */ (0,
|
|
6020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react27.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5954
6021
|
PromptContent,
|
|
5955
6022
|
{
|
|
5956
6023
|
isEmpty,
|
|
5957
6024
|
placeholder: translations2.prompt.contentPlaceholder,
|
|
5958
|
-
children: /* @__PURE__ */ (0,
|
|
6025
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react27.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
|
|
5959
6026
|
}
|
|
5960
6027
|
) });
|
|
5961
6028
|
};
|
|
5962
6029
|
|
|
5963
6030
|
// src/extensions/views/node-views/video.tsx
|
|
5964
|
-
var
|
|
5965
|
-
var
|
|
6031
|
+
var import_react28 = require("@tiptap/react");
|
|
6032
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
5966
6033
|
var VideoView = (props) => {
|
|
5967
6034
|
const { src } = props.node.attrs;
|
|
5968
|
-
return /* @__PURE__ */ (0,
|
|
5969
|
-
|
|
6035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_react28.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Video, { src, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
6036
|
+
import_react28.NodeViewContent,
|
|
5970
6037
|
{
|
|
5971
6038
|
as: "div",
|
|
5972
6039
|
className: "video-content"
|
|
@@ -5977,66 +6044,66 @@ var VideoView = (props) => {
|
|
|
5977
6044
|
// src/extensions/editor/callout.ts
|
|
5978
6045
|
var Callout2 = BaseCallout.extend({
|
|
5979
6046
|
addNodeView() {
|
|
5980
|
-
return (0,
|
|
6047
|
+
return (0, import_react29.ReactNodeViewRenderer)(CalloutView);
|
|
5981
6048
|
}
|
|
5982
6049
|
});
|
|
5983
6050
|
var LegacyBookAlert = BaseLegacyBookAlert.extend({
|
|
5984
6051
|
addNodeView() {
|
|
5985
|
-
return (0,
|
|
6052
|
+
return (0, import_react29.ReactNodeViewRenderer)(CalloutView);
|
|
5986
6053
|
}
|
|
5987
6054
|
});
|
|
5988
6055
|
var LegacyBookTip = BaseLegacyBookTip.extend({
|
|
5989
6056
|
addNodeView() {
|
|
5990
|
-
return (0,
|
|
6057
|
+
return (0, import_react29.ReactNodeViewRenderer)(CalloutView);
|
|
5991
6058
|
}
|
|
5992
6059
|
});
|
|
5993
6060
|
|
|
5994
6061
|
// src/extensions/editor/code-block.ts
|
|
5995
|
-
var
|
|
6062
|
+
var import_react30 = require("@tiptap/react");
|
|
5996
6063
|
var CodeBlock2 = BaseCodeBlock.extend({
|
|
5997
6064
|
addNodeView() {
|
|
5998
|
-
return (0,
|
|
6065
|
+
return (0, import_react30.ReactNodeViewRenderer)(CodeBlockView);
|
|
5999
6066
|
}
|
|
6000
6067
|
});
|
|
6001
6068
|
|
|
6002
6069
|
// src/extensions/editor/custom-quote.ts
|
|
6003
|
-
var
|
|
6070
|
+
var import_react31 = require("@tiptap/react");
|
|
6004
6071
|
var CustomQuote2 = BaseCustomQuote.extend({
|
|
6005
6072
|
addNodeView() {
|
|
6006
|
-
return (0,
|
|
6073
|
+
return (0, import_react31.ReactNodeViewRenderer)(CustomQuoteView);
|
|
6007
6074
|
}
|
|
6008
6075
|
});
|
|
6009
6076
|
var CustomQuoteText2 = BaseCustomQuoteText.extend({
|
|
6010
6077
|
addNodeView() {
|
|
6011
|
-
return (0,
|
|
6078
|
+
return (0, import_react31.ReactNodeViewRenderer)(CustomQuoteTextView);
|
|
6012
6079
|
}
|
|
6013
6080
|
});
|
|
6014
6081
|
var CustomQuoteAuthor2 = BaseCustomQuoteAuthor.extend({
|
|
6015
6082
|
addNodeView() {
|
|
6016
|
-
return (0,
|
|
6083
|
+
return (0, import_react31.ReactNodeViewRenderer)(CustomQuoteAuthorView);
|
|
6017
6084
|
}
|
|
6018
6085
|
});
|
|
6019
6086
|
var CustomQuoteSign2 = BaseCustomQuoteSign.extend({
|
|
6020
6087
|
addNodeView() {
|
|
6021
|
-
return (0,
|
|
6088
|
+
return (0, import_react31.ReactNodeViewRenderer)(CustomQuoteSignView);
|
|
6022
6089
|
}
|
|
6023
6090
|
});
|
|
6024
6091
|
var LegacySEQuote = BaseLegacySEQuote.extend({
|
|
6025
6092
|
addNodeView() {
|
|
6026
|
-
return (0,
|
|
6093
|
+
return (0, import_react31.ReactNodeViewRenderer)(CustomQuoteView);
|
|
6027
6094
|
}
|
|
6028
6095
|
});
|
|
6029
6096
|
|
|
6030
6097
|
// src/extensions/editor/video.ts
|
|
6031
|
-
var
|
|
6098
|
+
var import_react32 = require("@tiptap/react");
|
|
6032
6099
|
var Video2 = BaseVideo.extend({
|
|
6033
6100
|
addNodeView() {
|
|
6034
|
-
return (0,
|
|
6101
|
+
return (0, import_react32.ReactNodeViewRenderer)(VideoView);
|
|
6035
6102
|
}
|
|
6036
6103
|
});
|
|
6037
6104
|
var LegacyYouTube = BaseLegacyYouTube.extend({
|
|
6038
6105
|
addNodeView() {
|
|
6039
|
-
return (0,
|
|
6106
|
+
return (0, import_react32.ReactNodeViewRenderer)(VideoView);
|
|
6040
6107
|
}
|
|
6041
6108
|
});
|
|
6042
6109
|
|
|
@@ -6412,14 +6479,14 @@ var TextStyleKit = import_core17.Extension.create({
|
|
|
6412
6479
|
});
|
|
6413
6480
|
|
|
6414
6481
|
// src/utils/get-shared-extensions.ts
|
|
6415
|
-
function getSharedExtensions() {
|
|
6482
|
+
function getSharedExtensions(options = {}) {
|
|
6416
6483
|
return [
|
|
6417
6484
|
import_starter_kit.default.configure({
|
|
6418
6485
|
codeBlock: false,
|
|
6419
6486
|
link: false
|
|
6420
6487
|
}),
|
|
6421
6488
|
import_extension_highlight.default.configure({ multicolor: true }),
|
|
6422
|
-
LinkExtension,
|
|
6489
|
+
LinkExtension.configure({ trustedDomains: options.trustedDomains ?? [] }),
|
|
6423
6490
|
import_extension_superscript.default,
|
|
6424
6491
|
import_extension_subscript.default,
|
|
6425
6492
|
import_extension_text_align.default.configure({
|
|
@@ -6445,44 +6512,44 @@ function getSharedExtensions() {
|
|
|
6445
6512
|
}
|
|
6446
6513
|
|
|
6447
6514
|
// src/extensions/editor/copyable-text.ts
|
|
6448
|
-
var
|
|
6515
|
+
var import_react33 = require("@tiptap/react");
|
|
6449
6516
|
var CopyableText3 = CopyableText.extend({
|
|
6450
6517
|
addMarkView() {
|
|
6451
|
-
return (0,
|
|
6518
|
+
return (0, import_react33.ReactMarkViewRenderer)(CopyableTextView);
|
|
6452
6519
|
}
|
|
6453
6520
|
});
|
|
6454
6521
|
|
|
6455
6522
|
// src/extensions/editor/prompt.ts
|
|
6456
|
-
var
|
|
6523
|
+
var import_react34 = require("@tiptap/react");
|
|
6457
6524
|
var PromptHeader2 = BasePromptHeader.extend({
|
|
6458
6525
|
addNodeView() {
|
|
6459
|
-
return (0,
|
|
6526
|
+
return (0, import_react34.ReactNodeViewRenderer)(PromptHeaderView);
|
|
6460
6527
|
}
|
|
6461
6528
|
});
|
|
6462
6529
|
var PromptContent2 = BasePromptContent.extend({
|
|
6463
6530
|
addNodeView() {
|
|
6464
|
-
return (0,
|
|
6531
|
+
return (0, import_react34.ReactNodeViewRenderer)(PromptContentView);
|
|
6465
6532
|
}
|
|
6466
6533
|
});
|
|
6467
6534
|
var LegacyPromptSEHeader = BaseLegacyPromptSEHeader.extend({
|
|
6468
6535
|
addNodeView() {
|
|
6469
|
-
return (0,
|
|
6536
|
+
return (0, import_react34.ReactNodeViewRenderer)(PromptHeaderView);
|
|
6470
6537
|
}
|
|
6471
6538
|
});
|
|
6472
6539
|
var LegacyPromptSEContent = BaseLegacyPromptSEContent.extend({
|
|
6473
6540
|
addNodeView() {
|
|
6474
|
-
return (0,
|
|
6541
|
+
return (0, import_react34.ReactNodeViewRenderer)(PromptContentView);
|
|
6475
6542
|
}
|
|
6476
6543
|
});
|
|
6477
6544
|
|
|
6478
6545
|
// src/extensions/editor/figure.ts
|
|
6479
|
-
var
|
|
6546
|
+
var import_react35 = require("@tiptap/react");
|
|
6480
6547
|
var import_core18 = require("@tiptap/core");
|
|
6481
6548
|
var Figure2 = BaseFigure.extend({
|
|
6482
6549
|
addNodeView() {
|
|
6483
6550
|
const resizeOptions = this.options.resize;
|
|
6484
6551
|
if (!resizeOptions) {
|
|
6485
|
-
return (0,
|
|
6552
|
+
return (0, import_react35.ReactNodeViewRenderer)(FigureView);
|
|
6486
6553
|
}
|
|
6487
6554
|
return (props) => {
|
|
6488
6555
|
const { node, getPos, editor } = props;
|
|
@@ -6647,7 +6714,7 @@ var Figure2 = BaseFigure.extend({
|
|
|
6647
6714
|
});
|
|
6648
6715
|
var LegacyFigure = BaseLegacyFigure.extend({
|
|
6649
6716
|
addNodeView() {
|
|
6650
|
-
return (0,
|
|
6717
|
+
return (0, import_react35.ReactNodeViewRenderer)(FigureView);
|
|
6651
6718
|
}
|
|
6652
6719
|
});
|
|
6653
6720
|
|
|
@@ -6660,9 +6727,10 @@ function getEditorExtensions(options) {
|
|
|
6660
6727
|
isEditable = false,
|
|
6661
6728
|
getImageById,
|
|
6662
6729
|
onKatexClick,
|
|
6663
|
-
onFigureClick
|
|
6730
|
+
onFigureClick,
|
|
6731
|
+
trustedDomains
|
|
6664
6732
|
} = options;
|
|
6665
|
-
const sharedExtensions = getSharedExtensions();
|
|
6733
|
+
const sharedExtensions = getSharedExtensions({ trustedDomains });
|
|
6666
6734
|
return [
|
|
6667
6735
|
...sharedExtensions,
|
|
6668
6736
|
Callout2,
|
|
@@ -6813,7 +6881,7 @@ var createHandleKatexAdd = (editor, closeDialogCommand, savedPos) => {
|
|
|
6813
6881
|
};
|
|
6814
6882
|
|
|
6815
6883
|
// src/editor/handlers/insertion-handlers.ts
|
|
6816
|
-
var
|
|
6884
|
+
var import_react36 = require("react");
|
|
6817
6885
|
|
|
6818
6886
|
// src/editor/handlers/markup-insertion.ts
|
|
6819
6887
|
var import_model2 = require("@tiptap/pm/model");
|
|
@@ -6899,9 +6967,9 @@ function applyUploadResultsToNodes(imagesToNodes, results) {
|
|
|
6899
6967
|
|
|
6900
6968
|
// src/editor/handlers/insertion-handlers.ts
|
|
6901
6969
|
function useInsertionHandlers(imageHandlers) {
|
|
6902
|
-
const [insertedImage, setInsertedImage] = (0,
|
|
6970
|
+
const [insertedImage, setInsertedImage] = (0, import_react36.useState)(null);
|
|
6903
6971
|
const { activeDialog, openDialogCommand } = useDialogCommand();
|
|
6904
|
-
(0,
|
|
6972
|
+
(0, import_react36.useEffect)(() => {
|
|
6905
6973
|
if (insertedImage && !activeDialog) {
|
|
6906
6974
|
setInsertedImage(null);
|
|
6907
6975
|
}
|
|
@@ -6961,7 +7029,7 @@ function useInsertionHandlers(imageHandlers) {
|
|
|
6961
7029
|
// src/editor/commands/suggestion.tsx
|
|
6962
7030
|
var import_dom = require("@floating-ui/dom");
|
|
6963
7031
|
var import_core19 = require("@tiptap/core");
|
|
6964
|
-
var
|
|
7032
|
+
var import_react37 = require("@tiptap/react");
|
|
6965
7033
|
|
|
6966
7034
|
// src/editor/commands/items.ts
|
|
6967
7035
|
var getCommandItems = (translations2, hasImageHandlers) => [
|
|
@@ -7262,7 +7330,7 @@ var filterCommandItems = (items, query) => {
|
|
|
7262
7330
|
};
|
|
7263
7331
|
|
|
7264
7332
|
// src/editor/commands/suggestion.tsx
|
|
7265
|
-
var
|
|
7333
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
7266
7334
|
var component = null;
|
|
7267
7335
|
var closeMenu = () => {
|
|
7268
7336
|
if (component) {
|
|
@@ -7276,7 +7344,7 @@ var mapCommandMenuItemToCommandItem = (item) => {
|
|
|
7276
7344
|
const IconComponent = item.icon;
|
|
7277
7345
|
return {
|
|
7278
7346
|
title: item.title,
|
|
7279
|
-
icon: /* @__PURE__ */ (0,
|
|
7347
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(IconComponent, {}),
|
|
7280
7348
|
command: ({ editor, range }) => {
|
|
7281
7349
|
editor.chain().focus().deleteRange(range).run();
|
|
7282
7350
|
item.onClick(editor);
|
|
@@ -7294,7 +7362,7 @@ var createSuggestions = (translations2, hasImageHandlers) => ({
|
|
|
7294
7362
|
render: () => {
|
|
7295
7363
|
return {
|
|
7296
7364
|
onStart: async (props) => {
|
|
7297
|
-
component = new
|
|
7365
|
+
component = new import_react37.ReactRenderer(CommandsList, {
|
|
7298
7366
|
props,
|
|
7299
7367
|
editor: props.editor
|
|
7300
7368
|
});
|
|
@@ -7485,9 +7553,7 @@ var ru_default = {
|
|
|
7485
7553
|
captionPlaceholder: "\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u043F\u043E\u0434 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435\u043C...",
|
|
7486
7554
|
save: "\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C",
|
|
7487
7555
|
add: "\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C",
|
|
7488
|
-
invalidFileType: "\
|
|
7489
|
-
unknownError: "\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u043E\u0448\u0438\u0431\u043A\u0430",
|
|
7490
|
-
clearError: "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u043E\u0448\u0438\u0431\u043A\u0443"
|
|
7556
|
+
invalidFileType: "\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442 \u0444\u0430\u0439\u043B\u0430."
|
|
7491
7557
|
},
|
|
7492
7558
|
videoUpload: {
|
|
7493
7559
|
title: "\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0432\u0438\u0434\u0435\u043E",
|
|
@@ -7532,7 +7598,9 @@ var ru_default = {
|
|
|
7532
7598
|
words: ["\u0441\u043B\u043E\u0432\u043E", "\u0441\u043B\u043E\u0432\u0430", "\u0441\u043B\u043E\u0432"]
|
|
7533
7599
|
},
|
|
7534
7600
|
common: {
|
|
7535
|
-
cancel: "\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C"
|
|
7601
|
+
cancel: "\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C",
|
|
7602
|
+
unknownError: "\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u043E\u0448\u0438\u0431\u043A\u0430",
|
|
7603
|
+
clearError: "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u043E\u0448\u0438\u0431\u043A\u0443"
|
|
7536
7604
|
}
|
|
7537
7605
|
};
|
|
7538
7606
|
|
|
@@ -7652,9 +7720,7 @@ var en_default = {
|
|
|
7652
7720
|
captionPlaceholder: "Description under image...",
|
|
7653
7721
|
save: "Save",
|
|
7654
7722
|
add: "Add",
|
|
7655
|
-
invalidFileType: "
|
|
7656
|
-
unknownError: "Unknown error",
|
|
7657
|
-
clearError: "Clear error"
|
|
7723
|
+
invalidFileType: "Invalid file format."
|
|
7658
7724
|
},
|
|
7659
7725
|
videoUpload: {
|
|
7660
7726
|
title: "Add video",
|
|
@@ -7699,7 +7765,9 @@ var en_default = {
|
|
|
7699
7765
|
words: ["word", "words", "words"]
|
|
7700
7766
|
},
|
|
7701
7767
|
common: {
|
|
7702
|
-
cancel: "Cancel"
|
|
7768
|
+
cancel: "Cancel",
|
|
7769
|
+
unknownError: "Unknown error",
|
|
7770
|
+
clearError: "Clear error"
|
|
7703
7771
|
}
|
|
7704
7772
|
};
|
|
7705
7773
|
|
|
@@ -7713,7 +7781,7 @@ function getTranslations(lang) {
|
|
|
7713
7781
|
}
|
|
7714
7782
|
|
|
7715
7783
|
// src/editor/editor.tsx
|
|
7716
|
-
var
|
|
7784
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
7717
7785
|
function TiptapContent({
|
|
7718
7786
|
content,
|
|
7719
7787
|
handleChange,
|
|
@@ -7721,20 +7789,21 @@ function TiptapContent({
|
|
|
7721
7789
|
isEditable = true,
|
|
7722
7790
|
isDisabled = false,
|
|
7723
7791
|
lang,
|
|
7724
|
-
error
|
|
7792
|
+
error,
|
|
7793
|
+
trustedDomains
|
|
7725
7794
|
}) {
|
|
7726
|
-
const [linkDialogContext, setLinkDialogContext] = (0,
|
|
7727
|
-
const [katexDialogContext, setKatexDialogContext] = (0,
|
|
7795
|
+
const [linkDialogContext, setLinkDialogContext] = (0, import_react38.useState)(null);
|
|
7796
|
+
const [katexDialogContext, setKatexDialogContext] = (0, import_react38.useState)(
|
|
7728
7797
|
null
|
|
7729
7798
|
);
|
|
7730
|
-
const [editFigureContext, setEditFigureContext] = (0,
|
|
7731
|
-
const [savedDialogCursorPos, setSavedDialogCursorPos] = (0,
|
|
7732
|
-
const [savedDialogRange, setSavedDialogRange] = (0,
|
|
7799
|
+
const [editFigureContext, setEditFigureContext] = (0, import_react38.useState)(null);
|
|
7800
|
+
const [savedDialogCursorPos, setSavedDialogCursorPos] = (0, import_react38.useState)(void 0);
|
|
7801
|
+
const [savedDialogRange, setSavedDialogRange] = (0, import_react38.useState)(
|
|
7733
7802
|
void 0
|
|
7734
7803
|
);
|
|
7735
7804
|
const { activeDialog, closeDialogCommand, openDialogCommand } = useDialogCommand();
|
|
7736
7805
|
const translations2 = useTiptapTranslations();
|
|
7737
|
-
const [isDisabledInternal, setIsDisabledInternal] = (0,
|
|
7806
|
+
const [isDisabledInternal, setIsDisabledInternal] = (0, import_react38.useState)(isDisabled);
|
|
7738
7807
|
const disabled = isDisabled || isDisabledInternal;
|
|
7739
7808
|
let safeContent;
|
|
7740
7809
|
try {
|
|
@@ -7748,7 +7817,7 @@ function TiptapContent({
|
|
|
7748
7817
|
onDrop,
|
|
7749
7818
|
onMarkupInsertion
|
|
7750
7819
|
} = useInsertionHandlers(imageHandlers);
|
|
7751
|
-
const editor = (0,
|
|
7820
|
+
const editor = (0, import_react39.useEditor)(
|
|
7752
7821
|
{
|
|
7753
7822
|
editable: isEditable && !disabled,
|
|
7754
7823
|
extensions: getEditorExtensions({
|
|
@@ -7756,6 +7825,7 @@ function TiptapContent({
|
|
|
7756
7825
|
suggestion: createSuggestions(translations2, !!imageHandlers),
|
|
7757
7826
|
isEditable: isEditable && !disabled,
|
|
7758
7827
|
getImageById: imageHandlers?.getImage,
|
|
7828
|
+
trustedDomains,
|
|
7759
7829
|
onKatexClick: (latex, pos) => {
|
|
7760
7830
|
setKatexDialogContext({ latex, pos });
|
|
7761
7831
|
openDialogCommand("katex");
|
|
@@ -7812,7 +7882,7 @@ function TiptapContent({
|
|
|
7812
7882
|
},
|
|
7813
7883
|
[lang]
|
|
7814
7884
|
);
|
|
7815
|
-
(0,
|
|
7885
|
+
(0, import_react38.useEffect)(() => {
|
|
7816
7886
|
if (activeDialog && editor && !editor.isDestroyed) {
|
|
7817
7887
|
const { from, to } = editor.state.selection;
|
|
7818
7888
|
setSavedDialogCursorPos(from);
|
|
@@ -7841,7 +7911,7 @@ function TiptapContent({
|
|
|
7841
7911
|
const katexHandler = createHandleKatexAdd(editor, handleCloseDialog, savedDialogCursorPos);
|
|
7842
7912
|
katexHandler(latex, katexDialogContext?.pos);
|
|
7843
7913
|
};
|
|
7844
|
-
(0,
|
|
7914
|
+
(0, import_react38.useEffect)(() => {
|
|
7845
7915
|
if (!editor || editor.isDestroyed) return;
|
|
7846
7916
|
editor.commands.setContent(safeContent, {
|
|
7847
7917
|
emitUpdate: false
|
|
@@ -7860,16 +7930,16 @@ function TiptapContent({
|
|
|
7860
7930
|
return true;
|
|
7861
7931
|
};
|
|
7862
7932
|
if (!editor) return null;
|
|
7863
|
-
return /* @__PURE__ */ (0,
|
|
7864
|
-
/* @__PURE__ */ (0,
|
|
7865
|
-
isEditable && !disabled && /* @__PURE__ */ (0,
|
|
7866
|
-
isEditable && !disabled && /* @__PURE__ */ (0,
|
|
7933
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
7934
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(DragHandle, { editor }),
|
|
7935
|
+
isEditable && !disabled && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(TableMenu, { editor }),
|
|
7936
|
+
isEditable && !disabled && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
7867
7937
|
import_menus.BubbleMenu,
|
|
7868
7938
|
{
|
|
7869
7939
|
shouldShow: shouldBubbleMenuShow,
|
|
7870
7940
|
editor,
|
|
7871
7941
|
options: { placement: "bottom", offset: 8, flip: true },
|
|
7872
|
-
children: /* @__PURE__ */ (0,
|
|
7942
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
7873
7943
|
BubbleMenuContent,
|
|
7874
7944
|
{
|
|
7875
7945
|
editor,
|
|
@@ -7878,19 +7948,19 @@ function TiptapContent({
|
|
|
7878
7948
|
)
|
|
7879
7949
|
}
|
|
7880
7950
|
),
|
|
7881
|
-
/* @__PURE__ */ (0,
|
|
7951
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
7882
7952
|
"div",
|
|
7883
7953
|
{
|
|
7884
7954
|
className: `tiptap-content-wrapper ${!!error ? "has-error" : ""} ${disabled ? "is-disabled" : ""}`,
|
|
7885
7955
|
children: [
|
|
7886
|
-
/* @__PURE__ */ (0,
|
|
7887
|
-
isEditable && !disabled && /* @__PURE__ */ (0,
|
|
7956
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_react39.EditorContent, { editor }),
|
|
7957
|
+
isEditable && !disabled && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(CharacterCount, { editor })
|
|
7888
7958
|
]
|
|
7889
7959
|
}
|
|
7890
7960
|
),
|
|
7891
|
-
!!error && /* @__PURE__ */ (0,
|
|
7892
|
-
isEditable && /* @__PURE__ */ (0,
|
|
7893
|
-
activeDialog === "image" && /* @__PURE__ */ (0,
|
|
7961
|
+
!!error && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("p", { className: "tiptap-error-message", children: error }),
|
|
7962
|
+
isEditable && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
7963
|
+
activeDialog === "image" && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
7894
7964
|
ImageDialog,
|
|
7895
7965
|
{
|
|
7896
7966
|
open: true,
|
|
@@ -7904,7 +7974,7 @@ function TiptapContent({
|
|
|
7904
7974
|
mode: editFigureContext ? "edit" : "add"
|
|
7905
7975
|
}
|
|
7906
7976
|
),
|
|
7907
|
-
activeDialog === "link" && /* @__PURE__ */ (0,
|
|
7977
|
+
activeDialog === "link" && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
7908
7978
|
AddLinkDialog,
|
|
7909
7979
|
{
|
|
7910
7980
|
open: true,
|
|
@@ -7913,7 +7983,7 @@ function TiptapContent({
|
|
|
7913
7983
|
linkDialogContext
|
|
7914
7984
|
}
|
|
7915
7985
|
),
|
|
7916
|
-
activeDialog === "video" && /* @__PURE__ */ (0,
|
|
7986
|
+
activeDialog === "video" && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
7917
7987
|
AddVideoDialog,
|
|
7918
7988
|
{
|
|
7919
7989
|
open: true,
|
|
@@ -7921,7 +7991,7 @@ function TiptapContent({
|
|
|
7921
7991
|
onVideoAdd: handleVideoAdd
|
|
7922
7992
|
}
|
|
7923
7993
|
),
|
|
7924
|
-
activeDialog === "katex" && /* @__PURE__ */ (0,
|
|
7994
|
+
activeDialog === "katex" && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
7925
7995
|
AddKatexDialog,
|
|
7926
7996
|
{
|
|
7927
7997
|
open: true,
|
|
@@ -7936,7 +8006,7 @@ function TiptapContent({
|
|
|
7936
8006
|
var Tiptap = (props) => {
|
|
7937
8007
|
const { lang = "ru" } = props;
|
|
7938
8008
|
const translations2 = getTranslations(lang);
|
|
7939
|
-
return /* @__PURE__ */ (0,
|
|
8009
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(TiptapTranslationsProvider, { translations: translations2, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(DialogCommandProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(TiptapContent, { ...props }) }) });
|
|
7940
8010
|
};
|
|
7941
8011
|
|
|
7942
8012
|
// src/utils/html-to-tiptap-content.ts
|
|
@@ -7945,7 +8015,7 @@ var import_extension_table2 = require("@tiptap/extension-table");
|
|
|
7945
8015
|
function isJSONContent(value) {
|
|
7946
8016
|
return typeof value === "object" && value !== null && "type" in value && typeof value.type === "string";
|
|
7947
8017
|
}
|
|
7948
|
-
function htmlToTiptapContent(content) {
|
|
8018
|
+
function htmlToTiptapContent(content, options = {}) {
|
|
7949
8019
|
if (isJSONContent(content)) {
|
|
7950
8020
|
return content;
|
|
7951
8021
|
}
|
|
@@ -7961,7 +8031,7 @@ function htmlToTiptapContent(content) {
|
|
|
7961
8031
|
if (!content || content.trim() === "") {
|
|
7962
8032
|
return { type: "doc", content: [{ type: "paragraph" }] };
|
|
7963
8033
|
}
|
|
7964
|
-
const sharedExtensions = getSharedExtensions();
|
|
8034
|
+
const sharedExtensions = getSharedExtensions(options);
|
|
7965
8035
|
const extensions = [...sharedExtensions, BaseFigure, import_extension_table2.TableKit, BaseCodeBlock];
|
|
7966
8036
|
try {
|
|
7967
8037
|
return (0, import_core20.generateJSON)(content, extensions);
|