rte-builder 2.0.6 → 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +28 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +49 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1572,8 +1572,18 @@ var init_Indent = __esm({
|
|
|
1572
1572
|
},
|
|
1573
1573
|
addKeyboardShortcuts() {
|
|
1574
1574
|
return {
|
|
1575
|
-
Tab: () =>
|
|
1576
|
-
|
|
1575
|
+
Tab: () => {
|
|
1576
|
+
if (this.editor.isActive("listItem")) {
|
|
1577
|
+
return false;
|
|
1578
|
+
}
|
|
1579
|
+
return this.editor.commands.indent();
|
|
1580
|
+
},
|
|
1581
|
+
"Shift-Tab": () => {
|
|
1582
|
+
if (this.editor.isActive("listItem")) {
|
|
1583
|
+
return false;
|
|
1584
|
+
}
|
|
1585
|
+
return this.editor.commands.outdent();
|
|
1586
|
+
}
|
|
1577
1587
|
};
|
|
1578
1588
|
}
|
|
1579
1589
|
});
|
|
@@ -1908,6 +1918,16 @@ var init_TipTapToolbar = __esm({
|
|
|
1908
1918
|
case "textColor":
|
|
1909
1919
|
const textPresetColors = ["#11a161", "#85144b", "#ff851b", "#b10dc9"];
|
|
1910
1920
|
return /* @__PURE__ */ jsxs("span", { className: "rte-builder-toolbar-color-group", children: [
|
|
1921
|
+
/* @__PURE__ */ jsx(
|
|
1922
|
+
"button",
|
|
1923
|
+
{
|
|
1924
|
+
className: "rte-builder-color-preset rte-builder-color-preset-none",
|
|
1925
|
+
onClick: () => editor.chain().focus().unsetColor().run(),
|
|
1926
|
+
title: "Text Color: None (Reset)",
|
|
1927
|
+
type: "button"
|
|
1928
|
+
},
|
|
1929
|
+
"text-none"
|
|
1930
|
+
),
|
|
1911
1931
|
textPresetColors.map((color) => /* @__PURE__ */ jsx(
|
|
1912
1932
|
"button",
|
|
1913
1933
|
{
|
|
@@ -2458,6 +2478,12 @@ var init_TipTapEditorComponent = __esm({
|
|
|
2458
2478
|
attributes: {
|
|
2459
2479
|
class: "rte-builder-content",
|
|
2460
2480
|
style: `min-height: ${minHeight}px; ${maxHeight ? `max-height: ${maxHeight}px;` : ""}`
|
|
2481
|
+
},
|
|
2482
|
+
transformPastedHTML(html) {
|
|
2483
|
+
return html.replace(/(<br\s*\/?>\s*){3,}/gi, "<br><br>").replace(/(<p>\s*<\/p>\s*){2,}/gi, "<p></p>").replace(/>\s{2,}</g, "> <").replace(/( \s*){2,}/g, " ").replace(/[\u200B\u200C\u200D\uFEFF]/g, "").replace(
|
|
2484
|
+
/style="[^"]*"/gi,
|
|
2485
|
+
(match) => match.replace(/margin(-top|-bottom):\s*[\d.]+(px|em|rem|pt)\s*;?/gi, "").replace(/padding(-top|-bottom):\s*[\d.]+(px|em|rem|pt)\s*;?/gi, "").replace(/line-height:\s*[\d.]+(px|em|rem|pt|%)?\s*;?/gi, "").replace(/style="\s*"/gi, "")
|
|
2486
|
+
);
|
|
2461
2487
|
}
|
|
2462
2488
|
},
|
|
2463
2489
|
...editorConfig
|
|
@@ -6332,17 +6358,29 @@ var Toolbar = ({
|
|
|
6332
6358
|
"lineHeight"
|
|
6333
6359
|
);
|
|
6334
6360
|
case "textColor":
|
|
6335
|
-
return /* @__PURE__ */
|
|
6336
|
-
/* @__PURE__ */ jsx8(Type, { size: 18 }),
|
|
6361
|
+
return /* @__PURE__ */ jsxs8("span", { className: "rte-builder-toolbar-color-group", children: [
|
|
6337
6362
|
/* @__PURE__ */ jsx8(
|
|
6338
|
-
"
|
|
6363
|
+
"button",
|
|
6339
6364
|
{
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6365
|
+
className: "rte-builder-color-preset rte-builder-color-preset-none",
|
|
6366
|
+
onClick: () => editor.chain().focus().unsetColor().run(),
|
|
6367
|
+
title: "Text Color: None (Reset)",
|
|
6368
|
+
type: "button"
|
|
6369
|
+
},
|
|
6370
|
+
"text-none"
|
|
6371
|
+
),
|
|
6372
|
+
/* @__PURE__ */ jsx8("span", { className: "rte-builder-toolbar-color", children: /* @__PURE__ */ jsxs8("label", { title: "Text Color", children: [
|
|
6373
|
+
/* @__PURE__ */ jsx8(Type, { size: 18 }),
|
|
6374
|
+
/* @__PURE__ */ jsx8(
|
|
6375
|
+
"input",
|
|
6376
|
+
{
|
|
6377
|
+
type: "color",
|
|
6378
|
+
onChange: (e) => editor.chain().focus().setColor(e.target.value).run(),
|
|
6379
|
+
value: editor.getAttributes("textStyle").color || "#000000"
|
|
6380
|
+
}
|
|
6381
|
+
)
|
|
6382
|
+
] }) })
|
|
6383
|
+
] }, "textColor");
|
|
6346
6384
|
case "backgroundColor":
|
|
6347
6385
|
return /* @__PURE__ */ jsx8("span", { className: "rte-builder-toolbar-color", children: /* @__PURE__ */ jsxs8("label", { title: "Background Color", children: [
|
|
6348
6386
|
/* @__PURE__ */ jsx8(Highlighter, { size: 18 }),
|