@cyberyozh/text-editor 0.5.1 → 0.5.2
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.d.mts +2 -2
- package/dist/editor.d.ts +2 -2
- package/dist/editor.js +115 -207
- package/dist/editor.js.map +1 -1
- package/dist/editor.mjs +108 -200
- package/dist/editor.mjs.map +1 -1
- package/dist/render.js +128 -220
- package/dist/render.js.map +1 -1
- package/dist/render.mjs +108 -200
- package/dist/render.mjs.map +1 -1
- package/package.json +35 -34
- package/src/editor/commands/items.ts +1 -6
- package/src/extensions/base/compatibility.ts +3 -1
- package/src/extensions/base/myth-reality.ts +0 -1
package/dist/render.js
CHANGED
|
@@ -2037,39 +2037,24 @@ var import_extension_text_align = __toESM(require("@tiptap/extension-text-align"
|
|
|
2037
2037
|
|
|
2038
2038
|
// node_modules/@tiptap/extension-text-style/dist/index.js
|
|
2039
2039
|
var import_core9 = require("@tiptap/core");
|
|
2040
|
-
var import_core10 = require("@tiptap/core");
|
|
2041
|
-
var import_core11 = require("@tiptap/core");
|
|
2042
|
-
var import_core12 = require("@tiptap/core");
|
|
2043
|
-
var import_core13 = require("@tiptap/core");
|
|
2044
|
-
var import_core14 = require("@tiptap/core");
|
|
2045
|
-
var import_core15 = require("@tiptap/core");
|
|
2046
2040
|
var MAX_FIND_CHILD_SPAN_DEPTH = 20;
|
|
2047
2041
|
var findChildSpans = (element, depth = 0) => {
|
|
2048
2042
|
const childSpans = [];
|
|
2049
|
-
if (!element.children.length || depth > MAX_FIND_CHILD_SPAN_DEPTH)
|
|
2050
|
-
return childSpans;
|
|
2051
|
-
}
|
|
2043
|
+
if (!element.children.length || depth > MAX_FIND_CHILD_SPAN_DEPTH) return childSpans;
|
|
2052
2044
|
Array.from(element.children).forEach((child) => {
|
|
2053
|
-
if (child.tagName === "SPAN")
|
|
2054
|
-
|
|
2055
|
-
} else if (child.children.length) {
|
|
2056
|
-
childSpans.push(...findChildSpans(child, depth + 1));
|
|
2057
|
-
}
|
|
2045
|
+
if (child.tagName === "SPAN") childSpans.push(child);
|
|
2046
|
+
else if (child.children.length) childSpans.push(...findChildSpans(child, depth + 1));
|
|
2058
2047
|
});
|
|
2059
2048
|
return childSpans;
|
|
2060
2049
|
};
|
|
2061
2050
|
var mergeNestedSpanStyles = (element) => {
|
|
2062
|
-
if (!element.children.length)
|
|
2063
|
-
return;
|
|
2064
|
-
}
|
|
2051
|
+
if (!element.children.length) return;
|
|
2065
2052
|
const childSpans = findChildSpans(element);
|
|
2066
|
-
if (!childSpans)
|
|
2067
|
-
return;
|
|
2068
|
-
}
|
|
2053
|
+
if (!childSpans) return;
|
|
2069
2054
|
childSpans.forEach((childSpan) => {
|
|
2070
|
-
var
|
|
2055
|
+
var _childSpan$parentElem;
|
|
2071
2056
|
const childStyle = childSpan.getAttribute("style");
|
|
2072
|
-
const closestParentSpanStyleOfChild = (
|
|
2057
|
+
const closestParentSpanStyleOfChild = (_childSpan$parentElem = childSpan.parentElement) === null || _childSpan$parentElem === void 0 || (_childSpan$parentElem = _childSpan$parentElem.closest("span")) === null || _childSpan$parentElem === void 0 ? void 0 : _childSpan$parentElem.getAttribute("style");
|
|
2073
2058
|
childSpan.setAttribute("style", `${closestParentSpanStyleOfChild};${childStyle}`);
|
|
2074
2059
|
});
|
|
2075
2060
|
};
|
|
@@ -2083,25 +2068,22 @@ var TextStyle = import_core9.Mark.create({
|
|
|
2083
2068
|
};
|
|
2084
2069
|
},
|
|
2085
2070
|
parseHTML() {
|
|
2086
|
-
return [
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
return false;
|
|
2094
|
-
}
|
|
2095
|
-
if (this.options.mergeNestedSpanStyles) {
|
|
2096
|
-
mergeNestedSpanStyles(element);
|
|
2097
|
-
}
|
|
2098
|
-
return {};
|
|
2099
|
-
}
|
|
2071
|
+
return [{
|
|
2072
|
+
tag: "span",
|
|
2073
|
+
consuming: false,
|
|
2074
|
+
getAttrs: (element) => {
|
|
2075
|
+
if (!element.hasAttribute("style")) return false;
|
|
2076
|
+
if (this.options.mergeNestedSpanStyles) mergeNestedSpanStyles(element);
|
|
2077
|
+
return {};
|
|
2100
2078
|
}
|
|
2101
|
-
];
|
|
2079
|
+
}];
|
|
2102
2080
|
},
|
|
2103
2081
|
renderHTML({ HTMLAttributes }) {
|
|
2104
|
-
return [
|
|
2082
|
+
return [
|
|
2083
|
+
"span",
|
|
2084
|
+
(0, import_core9.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes),
|
|
2085
|
+
0
|
|
2086
|
+
];
|
|
2105
2087
|
},
|
|
2106
2088
|
addCommands() {
|
|
2107
2089
|
return {
|
|
@@ -2111,49 +2093,35 @@ var TextStyle = import_core9.Mark.create({
|
|
|
2111
2093
|
removeEmptyTextStyle: () => ({ tr: tr2 }) => {
|
|
2112
2094
|
const { selection } = tr2;
|
|
2113
2095
|
tr2.doc.nodesBetween(selection.from, selection.to, (node, pos) => {
|
|
2114
|
-
if (node.
|
|
2115
|
-
|
|
2116
|
-
}
|
|
2117
|
-
if (!node.marks.filter((mark) => mark.type === this.type).some((mark) => Object.values(mark.attrs).some((value) => !!value))) {
|
|
2118
|
-
tr2.removeMark(pos, pos + node.nodeSize, this.type);
|
|
2119
|
-
}
|
|
2096
|
+
if (!node.isInline) return true;
|
|
2097
|
+
if (!node.marks.filter((mark) => mark.type === this.type).some((mark) => Object.values(mark.attrs).some((value) => !!value))) tr2.removeMark(pos, pos + node.nodeSize, this.type);
|
|
2120
2098
|
});
|
|
2121
2099
|
return true;
|
|
2122
2100
|
}
|
|
2123
2101
|
};
|
|
2124
2102
|
}
|
|
2125
2103
|
});
|
|
2126
|
-
var BackgroundColor =
|
|
2104
|
+
var BackgroundColor = import_core9.Extension.create({
|
|
2127
2105
|
name: "backgroundColor",
|
|
2128
2106
|
addOptions() {
|
|
2129
|
-
return {
|
|
2130
|
-
types: ["textStyle"]
|
|
2131
|
-
};
|
|
2107
|
+
return { types: ["textStyle"] };
|
|
2132
2108
|
},
|
|
2133
2109
|
addGlobalAttributes() {
|
|
2134
|
-
return [
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
if (!attributes.backgroundColor) {
|
|
2147
|
-
return {};
|
|
2148
|
-
}
|
|
2149
|
-
return {
|
|
2150
|
-
style: `background-color: ${attributes.backgroundColor}`
|
|
2151
|
-
};
|
|
2152
|
-
}
|
|
2153
|
-
}
|
|
2110
|
+
return [{
|
|
2111
|
+
types: this.options.types,
|
|
2112
|
+
attributes: { backgroundColor: {
|
|
2113
|
+
default: null,
|
|
2114
|
+
parseHTML: (element) => {
|
|
2115
|
+
var _getStyleProperty;
|
|
2116
|
+
const value = (_getStyleProperty = (0, import_core9.getStyleProperty)(element, "background-color")) !== null && _getStyleProperty !== void 0 ? _getStyleProperty : element.style.backgroundColor;
|
|
2117
|
+
return value === null || value === void 0 ? void 0 : value.replace(/['"]+/g, "");
|
|
2118
|
+
},
|
|
2119
|
+
renderHTML: (attributes) => {
|
|
2120
|
+
if (!attributes.backgroundColor) return {};
|
|
2121
|
+
return { style: `background-color: ${attributes.backgroundColor}` };
|
|
2154
2122
|
}
|
|
2155
|
-
}
|
|
2156
|
-
];
|
|
2123
|
+
} }
|
|
2124
|
+
}];
|
|
2157
2125
|
},
|
|
2158
2126
|
addCommands() {
|
|
2159
2127
|
return {
|
|
@@ -2166,37 +2134,27 @@ var BackgroundColor = import_core10.Extension.create({
|
|
|
2166
2134
|
};
|
|
2167
2135
|
}
|
|
2168
2136
|
});
|
|
2169
|
-
var Color =
|
|
2137
|
+
var Color = import_core9.Extension.create({
|
|
2170
2138
|
name: "color",
|
|
2171
2139
|
addOptions() {
|
|
2172
|
-
return {
|
|
2173
|
-
types: ["textStyle"]
|
|
2174
|
-
};
|
|
2140
|
+
return { types: ["textStyle"] };
|
|
2175
2141
|
},
|
|
2176
2142
|
addGlobalAttributes() {
|
|
2177
|
-
return [
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
if (!attributes.color) {
|
|
2190
|
-
return {};
|
|
2191
|
-
}
|
|
2192
|
-
return {
|
|
2193
|
-
style: `color: ${attributes.color}`
|
|
2194
|
-
};
|
|
2195
|
-
}
|
|
2196
|
-
}
|
|
2143
|
+
return [{
|
|
2144
|
+
types: this.options.types,
|
|
2145
|
+
attributes: { color: {
|
|
2146
|
+
default: null,
|
|
2147
|
+
parseHTML: (element) => {
|
|
2148
|
+
var _getStyleProperty;
|
|
2149
|
+
const value = (_getStyleProperty = (0, import_core9.getStyleProperty)(element, "color")) !== null && _getStyleProperty !== void 0 ? _getStyleProperty : element.style.color;
|
|
2150
|
+
return value === null || value === void 0 ? void 0 : value.replace(/['"]+/g, "");
|
|
2151
|
+
},
|
|
2152
|
+
renderHTML: (attributes) => {
|
|
2153
|
+
if (!attributes.color) return {};
|
|
2154
|
+
return { style: `color: ${attributes.color}` };
|
|
2197
2155
|
}
|
|
2198
|
-
}
|
|
2199
|
-
];
|
|
2156
|
+
} }
|
|
2157
|
+
}];
|
|
2200
2158
|
},
|
|
2201
2159
|
addCommands() {
|
|
2202
2160
|
return {
|
|
@@ -2209,40 +2167,26 @@ var Color = import_core11.Extension.create({
|
|
|
2209
2167
|
};
|
|
2210
2168
|
}
|
|
2211
2169
|
});
|
|
2212
|
-
var FontFamily =
|
|
2170
|
+
var FontFamily = import_core9.Extension.create({
|
|
2213
2171
|
name: "fontFamily",
|
|
2214
2172
|
addOptions() {
|
|
2215
|
-
return {
|
|
2216
|
-
types: ["textStyle"]
|
|
2217
|
-
};
|
|
2173
|
+
return { types: ["textStyle"] };
|
|
2218
2174
|
},
|
|
2219
2175
|
addGlobalAttributes() {
|
|
2220
|
-
return [
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
var _a;
|
|
2232
|
-
return (_a = (0, import_core12.getStyleProperty)(element, "font-family")) != null ? _a : element.style.fontFamily;
|
|
2233
|
-
},
|
|
2234
|
-
renderHTML: (attributes) => {
|
|
2235
|
-
if (!attributes.fontFamily) {
|
|
2236
|
-
return {};
|
|
2237
|
-
}
|
|
2238
|
-
return {
|
|
2239
|
-
style: `font-family: ${attributes.fontFamily}`
|
|
2240
|
-
};
|
|
2241
|
-
}
|
|
2242
|
-
}
|
|
2176
|
+
return [{
|
|
2177
|
+
types: this.options.types,
|
|
2178
|
+
attributes: { fontFamily: {
|
|
2179
|
+
default: null,
|
|
2180
|
+
parseHTML: (element) => {
|
|
2181
|
+
var _getStyleProperty;
|
|
2182
|
+
return (_getStyleProperty = (0, import_core9.getStyleProperty)(element, "font-family")) !== null && _getStyleProperty !== void 0 ? _getStyleProperty : element.style.fontFamily;
|
|
2183
|
+
},
|
|
2184
|
+
renderHTML: (attributes) => {
|
|
2185
|
+
if (!attributes.fontFamily) return {};
|
|
2186
|
+
return { style: `font-family: ${attributes.fontFamily}` };
|
|
2243
2187
|
}
|
|
2244
|
-
}
|
|
2245
|
-
];
|
|
2188
|
+
} }
|
|
2189
|
+
}];
|
|
2246
2190
|
},
|
|
2247
2191
|
addCommands() {
|
|
2248
2192
|
return {
|
|
@@ -2255,39 +2199,26 @@ var FontFamily = import_core12.Extension.create({
|
|
|
2255
2199
|
};
|
|
2256
2200
|
}
|
|
2257
2201
|
});
|
|
2258
|
-
var FontSize =
|
|
2202
|
+
var FontSize = import_core9.Extension.create({
|
|
2259
2203
|
name: "fontSize",
|
|
2260
2204
|
addOptions() {
|
|
2261
|
-
return {
|
|
2262
|
-
types: ["textStyle"]
|
|
2263
|
-
};
|
|
2205
|
+
return { types: ["textStyle"] };
|
|
2264
2206
|
},
|
|
2265
2207
|
addGlobalAttributes() {
|
|
2266
|
-
return [
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
return (_a = (0, import_core13.getStyleProperty)(element, "font-size")) != null ? _a : element.style.fontSize;
|
|
2278
|
-
},
|
|
2279
|
-
renderHTML: (attributes) => {
|
|
2280
|
-
if (!attributes.fontSize) {
|
|
2281
|
-
return {};
|
|
2282
|
-
}
|
|
2283
|
-
return {
|
|
2284
|
-
style: `font-size: ${attributes.fontSize}`
|
|
2285
|
-
};
|
|
2286
|
-
}
|
|
2287
|
-
}
|
|
2208
|
+
return [{
|
|
2209
|
+
types: this.options.types,
|
|
2210
|
+
attributes: { fontSize: {
|
|
2211
|
+
default: null,
|
|
2212
|
+
parseHTML: (element) => {
|
|
2213
|
+
var _getStyleProperty;
|
|
2214
|
+
return (_getStyleProperty = (0, import_core9.getStyleProperty)(element, "font-size")) !== null && _getStyleProperty !== void 0 ? _getStyleProperty : element.style.fontSize;
|
|
2215
|
+
},
|
|
2216
|
+
renderHTML: (attributes) => {
|
|
2217
|
+
if (!attributes.fontSize) return {};
|
|
2218
|
+
return { style: `font-size: ${attributes.fontSize}` };
|
|
2288
2219
|
}
|
|
2289
|
-
}
|
|
2290
|
-
];
|
|
2220
|
+
} }
|
|
2221
|
+
}];
|
|
2291
2222
|
},
|
|
2292
2223
|
addCommands() {
|
|
2293
2224
|
return {
|
|
@@ -2300,39 +2231,26 @@ var FontSize = import_core13.Extension.create({
|
|
|
2300
2231
|
};
|
|
2301
2232
|
}
|
|
2302
2233
|
});
|
|
2303
|
-
var LineHeight =
|
|
2234
|
+
var LineHeight = import_core9.Extension.create({
|
|
2304
2235
|
name: "lineHeight",
|
|
2305
2236
|
addOptions() {
|
|
2306
|
-
return {
|
|
2307
|
-
types: ["textStyle"]
|
|
2308
|
-
};
|
|
2237
|
+
return { types: ["textStyle"] };
|
|
2309
2238
|
},
|
|
2310
2239
|
addGlobalAttributes() {
|
|
2311
|
-
return [
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
return (_a = (0, import_core14.getStyleProperty)(element, "line-height")) != null ? _a : element.style.lineHeight;
|
|
2323
|
-
},
|
|
2324
|
-
renderHTML: (attributes) => {
|
|
2325
|
-
if (!attributes.lineHeight) {
|
|
2326
|
-
return {};
|
|
2327
|
-
}
|
|
2328
|
-
return {
|
|
2329
|
-
style: `line-height: ${attributes.lineHeight}`
|
|
2330
|
-
};
|
|
2331
|
-
}
|
|
2332
|
-
}
|
|
2240
|
+
return [{
|
|
2241
|
+
types: this.options.types,
|
|
2242
|
+
attributes: { lineHeight: {
|
|
2243
|
+
default: null,
|
|
2244
|
+
parseHTML: (element) => {
|
|
2245
|
+
var _getStyleProperty;
|
|
2246
|
+
return (_getStyleProperty = (0, import_core9.getStyleProperty)(element, "line-height")) !== null && _getStyleProperty !== void 0 ? _getStyleProperty : element.style.lineHeight;
|
|
2247
|
+
},
|
|
2248
|
+
renderHTML: (attributes) => {
|
|
2249
|
+
if (!attributes.lineHeight) return {};
|
|
2250
|
+
return { style: `line-height: ${attributes.lineHeight}` };
|
|
2333
2251
|
}
|
|
2334
|
-
}
|
|
2335
|
-
];
|
|
2252
|
+
} }
|
|
2253
|
+
}];
|
|
2336
2254
|
},
|
|
2337
2255
|
addCommands() {
|
|
2338
2256
|
return {
|
|
@@ -2345,37 +2263,25 @@ var LineHeight = import_core14.Extension.create({
|
|
|
2345
2263
|
};
|
|
2346
2264
|
}
|
|
2347
2265
|
});
|
|
2348
|
-
var TextStyleKit =
|
|
2266
|
+
var TextStyleKit = import_core9.Extension.create({
|
|
2349
2267
|
name: "textStyleKit",
|
|
2350
2268
|
addExtensions() {
|
|
2351
2269
|
const extensions = [];
|
|
2352
|
-
if (this.options.backgroundColor !== false)
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
if (this.options.
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
if (this.options.fontFamily !== false) {
|
|
2359
|
-
extensions.push(FontFamily.configure(this.options.fontFamily));
|
|
2360
|
-
}
|
|
2361
|
-
if (this.options.fontSize !== false) {
|
|
2362
|
-
extensions.push(FontSize.configure(this.options.fontSize));
|
|
2363
|
-
}
|
|
2364
|
-
if (this.options.lineHeight !== false) {
|
|
2365
|
-
extensions.push(LineHeight.configure(this.options.lineHeight));
|
|
2366
|
-
}
|
|
2367
|
-
if (this.options.textStyle !== false) {
|
|
2368
|
-
extensions.push(TextStyle.configure(this.options.textStyle));
|
|
2369
|
-
}
|
|
2270
|
+
if (this.options.backgroundColor !== false) extensions.push(BackgroundColor.configure(this.options.backgroundColor));
|
|
2271
|
+
if (this.options.color !== false) extensions.push(Color.configure(this.options.color));
|
|
2272
|
+
if (this.options.fontFamily !== false) extensions.push(FontFamily.configure(this.options.fontFamily));
|
|
2273
|
+
if (this.options.fontSize !== false) extensions.push(FontSize.configure(this.options.fontSize));
|
|
2274
|
+
if (this.options.lineHeight !== false) extensions.push(LineHeight.configure(this.options.lineHeight));
|
|
2275
|
+
if (this.options.textStyle !== false) extensions.push(TextStyle.configure(this.options.textStyle));
|
|
2370
2276
|
return extensions;
|
|
2371
2277
|
}
|
|
2372
2278
|
});
|
|
2373
2279
|
|
|
2374
2280
|
// src/extensions/base/compatibility.ts
|
|
2375
|
-
var
|
|
2281
|
+
var import_core10 = require("@tiptap/core");
|
|
2376
2282
|
var import_state5 = require("@tiptap/pm/state");
|
|
2377
2283
|
var import_extension_image2 = __toESM(require("@tiptap/extension-image"));
|
|
2378
|
-
var BaseLegacyBookAlert =
|
|
2284
|
+
var BaseLegacyBookAlert = import_core10.Node.create({
|
|
2379
2285
|
name: "calloutAlert",
|
|
2380
2286
|
group: "block",
|
|
2381
2287
|
content: "block+",
|
|
@@ -2427,10 +2333,10 @@ var BaseLegacyBookAlert = import_core16.Node.create({
|
|
|
2427
2333
|
};
|
|
2428
2334
|
},
|
|
2429
2335
|
renderHTML({ HTMLAttributes }) {
|
|
2430
|
-
return ["div", (0,
|
|
2336
|
+
return ["div", (0, import_core10.mergeAttributes)(HTMLAttributes, { "data-type": "callout-alert" }), 0];
|
|
2431
2337
|
}
|
|
2432
2338
|
});
|
|
2433
|
-
var BaseLegacyBookTip =
|
|
2339
|
+
var BaseLegacyBookTip = import_core10.Node.create({
|
|
2434
2340
|
name: "calloutTip",
|
|
2435
2341
|
group: "block",
|
|
2436
2342
|
content: "block+",
|
|
@@ -2477,7 +2383,7 @@ var BaseLegacyBookTip = import_core16.Node.create({
|
|
|
2477
2383
|
];
|
|
2478
2384
|
},
|
|
2479
2385
|
renderHTML({ HTMLAttributes }) {
|
|
2480
|
-
return ["div", (0,
|
|
2386
|
+
return ["div", (0, import_core10.mergeAttributes)(HTMLAttributes, { "data-type": "callout-tip" }), 0];
|
|
2481
2387
|
},
|
|
2482
2388
|
addKeyboardShortcuts() {
|
|
2483
2389
|
return {
|
|
@@ -2485,7 +2391,7 @@ var BaseLegacyBookTip = import_core16.Node.create({
|
|
|
2485
2391
|
};
|
|
2486
2392
|
}
|
|
2487
2393
|
});
|
|
2488
|
-
var BaseLegacySEQuote =
|
|
2394
|
+
var BaseLegacySEQuote = import_core10.Node.create({
|
|
2489
2395
|
name: "customQuoteV2",
|
|
2490
2396
|
group: "block",
|
|
2491
2397
|
content: "customQuoteText customQuoteAuthor customQuoteSign",
|
|
@@ -2531,10 +2437,10 @@ var BaseLegacySEQuote = import_core16.Node.create({
|
|
|
2531
2437
|
];
|
|
2532
2438
|
},
|
|
2533
2439
|
renderHTML({ HTMLAttributes }) {
|
|
2534
|
-
return ["div", (0,
|
|
2440
|
+
return ["div", (0, import_core10.mergeAttributes)(HTMLAttributes, { "data-custom-quote-v2": "" }), 0];
|
|
2535
2441
|
}
|
|
2536
2442
|
});
|
|
2537
|
-
var BaseLegacyPromptSE =
|
|
2443
|
+
var BaseLegacyPromptSE = import_core10.Node.create({
|
|
2538
2444
|
name: "promptV2",
|
|
2539
2445
|
group: "block",
|
|
2540
2446
|
content: "(promptHeader | promptV2Header) (promptContent | promptV2Content)",
|
|
@@ -2579,10 +2485,10 @@ var BaseLegacyPromptSE = import_core16.Node.create({
|
|
|
2579
2485
|
];
|
|
2580
2486
|
},
|
|
2581
2487
|
renderHTML({ HTMLAttributes }) {
|
|
2582
|
-
return ["div", (0,
|
|
2488
|
+
return ["div", (0, import_core10.mergeAttributes)(HTMLAttributes, { "data-prompt": "" }), 0];
|
|
2583
2489
|
}
|
|
2584
2490
|
});
|
|
2585
|
-
var BaseLegacyPromptSEHeader =
|
|
2491
|
+
var BaseLegacyPromptSEHeader = import_core10.Node.create({
|
|
2586
2492
|
name: "promptV2Header",
|
|
2587
2493
|
group: "block",
|
|
2588
2494
|
content: "inline*",
|
|
@@ -2596,13 +2502,13 @@ var BaseLegacyPromptSEHeader = import_core16.Node.create({
|
|
|
2596
2502
|
];
|
|
2597
2503
|
},
|
|
2598
2504
|
renderHTML({ HTMLAttributes }) {
|
|
2599
|
-
return ["div", (0,
|
|
2505
|
+
return ["div", (0, import_core10.mergeAttributes)(HTMLAttributes, { "data-prompt-header": "" }), 0];
|
|
2600
2506
|
}
|
|
2601
2507
|
// addNodeView() {
|
|
2602
2508
|
// return ReactNodeViewRenderer(PromptHeaderView);
|
|
2603
2509
|
// },
|
|
2604
2510
|
});
|
|
2605
|
-
var BaseLegacyPromptSEContent =
|
|
2511
|
+
var BaseLegacyPromptSEContent = import_core10.Node.create({
|
|
2606
2512
|
name: "promptV2Content",
|
|
2607
2513
|
group: "block",
|
|
2608
2514
|
content: "text*",
|
|
@@ -2616,10 +2522,10 @@ var BaseLegacyPromptSEContent = import_core16.Node.create({
|
|
|
2616
2522
|
];
|
|
2617
2523
|
},
|
|
2618
2524
|
renderHTML({ HTMLAttributes }) {
|
|
2619
|
-
return ["div", (0,
|
|
2525
|
+
return ["div", (0, import_core10.mergeAttributes)(HTMLAttributes, { "data-prompt-content": "" }), 0];
|
|
2620
2526
|
}
|
|
2621
2527
|
});
|
|
2622
|
-
var BaseLegacyCustomBlockquote =
|
|
2528
|
+
var BaseLegacyCustomBlockquote = import_core10.Node.create({
|
|
2623
2529
|
name: "customBlockquote",
|
|
2624
2530
|
group: "block",
|
|
2625
2531
|
content: "block+",
|
|
@@ -2635,7 +2541,7 @@ var BaseLegacyCustomBlockquote = import_core16.Node.create({
|
|
|
2635
2541
|
return ["blockquote", 0];
|
|
2636
2542
|
}
|
|
2637
2543
|
});
|
|
2638
|
-
var BaseLegacyYouTube =
|
|
2544
|
+
var BaseLegacyYouTube = import_core10.Node.create({
|
|
2639
2545
|
name: "youtube",
|
|
2640
2546
|
group: "block",
|
|
2641
2547
|
selectable: true,
|
|
@@ -2671,7 +2577,7 @@ var BaseLegacyYouTube = import_core16.Node.create({
|
|
|
2671
2577
|
return ["video-embed", { src: HTMLAttributes.src }];
|
|
2672
2578
|
}
|
|
2673
2579
|
});
|
|
2674
|
-
var LegacyInlineLatexSE =
|
|
2580
|
+
var LegacyInlineLatexSE = import_core10.Node.create({
|
|
2675
2581
|
name: "inlineLatex",
|
|
2676
2582
|
group: "inline",
|
|
2677
2583
|
inline: true,
|
|
@@ -2693,7 +2599,7 @@ var LegacyInlineLatexSE = import_core16.Node.create({
|
|
|
2693
2599
|
];
|
|
2694
2600
|
},
|
|
2695
2601
|
renderHTML({ HTMLAttributes }) {
|
|
2696
|
-
return ["code", (0,
|
|
2602
|
+
return ["code", (0, import_core10.mergeAttributes)(HTMLAttributes, { class: "inline-latex" }), 0];
|
|
2697
2603
|
}
|
|
2698
2604
|
});
|
|
2699
2605
|
var BaseLegacyFigure = import_extension_image2.default.extend({
|
|
@@ -2704,7 +2610,9 @@ var BaseLegacyFigure = import_extension_image2.default.extend({
|
|
|
2704
2610
|
isolating: true,
|
|
2705
2611
|
selectable: false,
|
|
2706
2612
|
addOptions() {
|
|
2613
|
+
const parentOptions = this.parent?.() || {};
|
|
2707
2614
|
return {
|
|
2615
|
+
...parentOptions,
|
|
2708
2616
|
HTMLAttributes: {},
|
|
2709
2617
|
getImageById: void 0
|
|
2710
2618
|
};
|
|
@@ -2778,7 +2686,7 @@ var BaseLegacyFigure = import_extension_image2.default.extend({
|
|
|
2778
2686
|
},
|
|
2779
2687
|
{ getImageById: this.options.getImageById }
|
|
2780
2688
|
);
|
|
2781
|
-
const figureAttrs = (0,
|
|
2689
|
+
const figureAttrs = (0, import_core10.mergeAttributes)(this.options.HTMLAttributes);
|
|
2782
2690
|
const imgAttrs = {
|
|
2783
2691
|
src: resolvedSrc
|
|
2784
2692
|
};
|
|
@@ -3836,7 +3744,7 @@ function TiptapRender({ content, getImageById }) {
|
|
|
3836
3744
|
}
|
|
3837
3745
|
|
|
3838
3746
|
// src/utils/html-to-tiptap-content.ts
|
|
3839
|
-
var
|
|
3747
|
+
var import_core11 = require("@tiptap/core");
|
|
3840
3748
|
var import_extension_table2 = require("@tiptap/extension-table");
|
|
3841
3749
|
function isJSONContent(value) {
|
|
3842
3750
|
return typeof value === "object" && value !== null && "type" in value && typeof value.type === "string";
|
|
@@ -3860,7 +3768,7 @@ function htmlToTiptapContent(content, options = {}) {
|
|
|
3860
3768
|
const sharedExtensions = getSharedExtensions(options);
|
|
3861
3769
|
const extensions = [...sharedExtensions, BaseFigure, import_extension_table2.TableKit, BaseCodeBlock];
|
|
3862
3770
|
try {
|
|
3863
|
-
return (0,
|
|
3771
|
+
return (0, import_core11.generateJSON)(content, extensions);
|
|
3864
3772
|
} catch (error) {
|
|
3865
3773
|
console.error("Failed to convert HTML to Tiptap content:", error);
|
|
3866
3774
|
return { type: "doc", content: [{ type: "paragraph" }] };
|