@sethumadhavan004/ink-editor 0.0.2 → 0.0.3
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 +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +36 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2243,7 +2243,8 @@ import {
|
|
|
2243
2243
|
ListOrdered,
|
|
2244
2244
|
Indent,
|
|
2245
2245
|
Outdent,
|
|
2246
|
-
Rows
|
|
2246
|
+
Rows,
|
|
2247
|
+
FilePlus
|
|
2247
2248
|
} from "lucide-react";
|
|
2248
2249
|
|
|
2249
2250
|
// src/components/FontPicker.tsx
|
|
@@ -2376,7 +2377,7 @@ function ColorPanel({ colors, onChange, open, onToggle, onClose }) {
|
|
|
2376
2377
|
}
|
|
2377
2378
|
|
|
2378
2379
|
// src/components/FloatingToolbar.tsx
|
|
2379
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2380
|
+
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2380
2381
|
function Sep() {
|
|
2381
2382
|
return /* @__PURE__ */ jsx3("span", { className: "ink-toolbar-sep", "aria-hidden": "true" });
|
|
2382
2383
|
}
|
|
@@ -2388,7 +2389,9 @@ function FloatingToolbar({
|
|
|
2388
2389
|
font,
|
|
2389
2390
|
onFontChange,
|
|
2390
2391
|
colors,
|
|
2391
|
-
onColorsChange
|
|
2392
|
+
onColorsChange,
|
|
2393
|
+
toolbarStart,
|
|
2394
|
+
toolbarEnd
|
|
2392
2395
|
}) {
|
|
2393
2396
|
const [openPanel, setOpenPanel] = useState(null);
|
|
2394
2397
|
useEffect3(() => {
|
|
@@ -2479,10 +2482,26 @@ function FloatingToolbar({
|
|
|
2479
2482
|
isActive: () => ruled,
|
|
2480
2483
|
action: onToggleRuled
|
|
2481
2484
|
}]
|
|
2485
|
+
},
|
|
2486
|
+
{
|
|
2487
|
+
key: "addpage",
|
|
2488
|
+
configs: [{
|
|
2489
|
+
label: "Add page",
|
|
2490
|
+
icon: /* @__PURE__ */ jsx3(FilePlus, { size: iconSize }),
|
|
2491
|
+
isActive: () => false,
|
|
2492
|
+
action: () => {
|
|
2493
|
+
const end = editor.state.doc.content.size - 1;
|
|
2494
|
+
editor.chain().focus().insertContentAt(end, [{ type: "paragraph" }, { type: "paragraph" }]).run();
|
|
2495
|
+
}
|
|
2496
|
+
}]
|
|
2482
2497
|
}
|
|
2483
2498
|
];
|
|
2484
2499
|
const activeGroups = allGroups.filter((g) => buttons.includes(g.key));
|
|
2485
2500
|
return /* @__PURE__ */ jsx3("div", { className: "ink-floating-toolbar-wrap", children: /* @__PURE__ */ jsxs3("div", { className: "ink-floating-toolbar", role: "toolbar", "aria-label": "Text formatting", children: [
|
|
2501
|
+
toolbarStart && toolbarStart.length > 0 && /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
2502
|
+
toolbarStart.map((node, i) => /* @__PURE__ */ jsx3("span", { style: { display: "contents" }, children: node }, i)),
|
|
2503
|
+
/* @__PURE__ */ jsx3(Sep, {})
|
|
2504
|
+
] }),
|
|
2486
2505
|
activeGroups.map((group, gi) => /* @__PURE__ */ jsxs3("span", { className: "ink-toolbar-group", style: { display: "contents" }, children: [
|
|
2487
2506
|
group.configs.map((cfg) => /* @__PURE__ */ jsx3(
|
|
2488
2507
|
"button",
|
|
@@ -2518,7 +2537,11 @@ function FloatingToolbar({
|
|
|
2518
2537
|
onToggle: () => togglePanel("color"),
|
|
2519
2538
|
onClose: () => setOpenPanel(null)
|
|
2520
2539
|
}
|
|
2521
|
-
)
|
|
2540
|
+
),
|
|
2541
|
+
toolbarEnd && toolbarEnd.length > 0 && /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
2542
|
+
/* @__PURE__ */ jsx3(Sep, {}),
|
|
2543
|
+
toolbarEnd.map((node, i) => /* @__PURE__ */ jsx3("span", { style: { display: "contents" }, children: node }, i))
|
|
2544
|
+
] })
|
|
2522
2545
|
] }) });
|
|
2523
2546
|
}
|
|
2524
2547
|
|
|
@@ -2534,7 +2557,9 @@ function PagedEditorContent({
|
|
|
2534
2557
|
font,
|
|
2535
2558
|
onFontChange,
|
|
2536
2559
|
colors,
|
|
2537
|
-
onColorsChange
|
|
2560
|
+
onColorsChange,
|
|
2561
|
+
toolbarStart,
|
|
2562
|
+
toolbarEnd
|
|
2538
2563
|
}) {
|
|
2539
2564
|
const widthPx = getPageWidthPx(pageSize);
|
|
2540
2565
|
const bodyWidthPx = getBodyWidthPx(pageSize);
|
|
@@ -2566,7 +2591,9 @@ function PagedEditorContent({
|
|
|
2566
2591
|
font,
|
|
2567
2592
|
onFontChange,
|
|
2568
2593
|
colors,
|
|
2569
|
-
onColorsChange
|
|
2594
|
+
onColorsChange,
|
|
2595
|
+
toolbarStart,
|
|
2596
|
+
toolbarEnd
|
|
2570
2597
|
}
|
|
2571
2598
|
),
|
|
2572
2599
|
/* @__PURE__ */ jsx4(
|
|
@@ -2600,7 +2627,9 @@ function InkEditor({
|
|
|
2600
2627
|
theme = "parchment",
|
|
2601
2628
|
toolbar = DEFAULT_TOOLBAR,
|
|
2602
2629
|
initialFont = "cursive",
|
|
2603
|
-
initialColors
|
|
2630
|
+
initialColors,
|
|
2631
|
+
toolbarStart,
|
|
2632
|
+
toolbarEnd
|
|
2604
2633
|
}) {
|
|
2605
2634
|
const [ruled, setRuled] = useState2(false);
|
|
2606
2635
|
const [font, setFont] = useState2(initialFont);
|
|
@@ -2637,7 +2666,9 @@ function InkEditor({
|
|
|
2637
2666
|
font,
|
|
2638
2667
|
onFontChange: setFont,
|
|
2639
2668
|
colors,
|
|
2640
|
-
onColorsChange: setColors
|
|
2669
|
+
onColorsChange: setColors,
|
|
2670
|
+
toolbarStart,
|
|
2671
|
+
toolbarEnd
|
|
2641
2672
|
}
|
|
2642
2673
|
);
|
|
2643
2674
|
}
|