@fiestaboard/ui 3.1.0 → 3.3.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/components/editor/color-picker-content.d.ts +25 -0
- package/dist/components/editor/color-picker-content.js +118 -0
- package/dist/components/editor/color-picker-content.js.map +1 -0
- package/dist/components/editor/constants.d.ts +87 -0
- package/dist/components/editor/constants.js +29 -0
- package/dist/components/editor/constants.js.map +1 -0
- package/dist/components/editor/draw-char-picker-content.d.ts +22 -0
- package/dist/components/editor/draw-char-picker-content.js +79 -0
- package/dist/components/editor/draw-char-picker-content.js.map +1 -0
- package/dist/components/editor/extensions/color-tile-node.d.ts +10 -0
- package/dist/components/editor/extensions/color-tile-node.js +43 -0
- package/dist/components/editor/extensions/color-tile-node.js.map +1 -0
- package/dist/components/editor/extensions/fill-space-node.d.ts +10 -0
- package/dist/components/editor/extensions/fill-space-node.js +40 -0
- package/dist/components/editor/extensions/fill-space-node.js.map +1 -0
- package/dist/components/editor/extensions/formula-node.d.ts +6 -0
- package/dist/components/editor/extensions/formula-node.js +40 -0
- package/dist/components/editor/extensions/formula-node.js.map +1 -0
- package/dist/components/editor/extensions/line-navigation.d.ts +18 -0
- package/dist/components/editor/extensions/line-navigation.js +16 -0
- package/dist/components/editor/extensions/line-navigation.js.map +1 -0
- package/dist/components/editor/extensions/single-paragraph-doc.d.ts +15 -0
- package/dist/components/editor/extensions/single-paragraph-doc.js +11 -0
- package/dist/components/editor/extensions/single-paragraph-doc.js.map +1 -0
- package/dist/components/editor/extensions/trailing-newline.d.ts +13 -0
- package/dist/components/editor/extensions/trailing-newline.js +27 -0
- package/dist/components/editor/extensions/trailing-newline.js.map +1 -0
- package/dist/components/editor/extensions/variable-node.d.ts +15 -0
- package/dist/components/editor/extensions/variable-node.js +56 -0
- package/dist/components/editor/extensions/variable-node.js.map +1 -0
- package/dist/components/editor/extensions/wrapped-text-node.d.ts +9 -0
- package/dist/components/editor/extensions/wrapped-text-node.js +31 -0
- package/dist/components/editor/extensions/wrapped-text-node.js.map +1 -0
- package/dist/components/editor/filter-picker-content.d.ts +24 -0
- package/dist/components/editor/filter-picker-content.js +146 -0
- package/dist/components/editor/filter-picker-content.js.map +1 -0
- package/dist/components/editor/formatting-picker-content.d.ts +30 -0
- package/dist/components/editor/formatting-picker-content.js +154 -0
- package/dist/components/editor/formatting-picker-content.js.map +1 -0
- package/dist/components/editor/formula/formula-editor-panel.d.ts +102 -0
- package/dist/components/editor/formula/formula-editor-panel.js +527 -0
- package/dist/components/editor/formula/formula-editor-panel.js.map +1 -0
- package/dist/components/editor/node-views/color-tile-node-view.d.ts +21 -0
- package/dist/components/editor/node-views/color-tile-node-view.js +66 -0
- package/dist/components/editor/node-views/color-tile-node-view.js.map +1 -0
- package/dist/components/editor/node-views/fill-space-node-view.d.ts +16 -0
- package/dist/components/editor/node-views/fill-space-node-view.js +43 -0
- package/dist/components/editor/node-views/fill-space-node-view.js.map +1 -0
- package/dist/components/editor/node-views/formula-node-view.d.ts +39 -0
- package/dist/components/editor/node-views/formula-node-view.js +109 -0
- package/dist/components/editor/node-views/formula-node-view.js.map +1 -0
- package/dist/components/editor/node-views/node-view-context.d.ts +58 -0
- package/dist/components/editor/node-views/node-view-context.js +22 -0
- package/dist/components/editor/node-views/node-view-context.js.map +1 -0
- package/dist/components/editor/node-views/variable-node-view.d.ts +16 -0
- package/dist/components/editor/node-views/variable-node-view.js +63 -0
- package/dist/components/editor/node-views/variable-node-view.js.map +1 -0
- package/dist/components/editor/node-views/wrapped-text-view.d.ts +14 -0
- package/dist/components/editor/node-views/wrapped-text-view.js +46 -0
- package/dist/components/editor/node-views/wrapped-text-view.js.map +1 -0
- package/dist/components/editor/template-editor-toolbar.d.ts +146 -0
- package/dist/components/editor/template-editor-toolbar.js +434 -0
- package/dist/components/editor/template-editor-toolbar.js.map +1 -0
- package/dist/components/editor/template-editor.d.ts +109 -0
- package/dist/components/editor/template-editor.js +662 -0
- package/dist/components/editor/template-editor.js.map +1 -0
- package/dist/components/editor/toolbar-dropdown.d.ts +20 -0
- package/dist/components/editor/toolbar-dropdown.js +88 -0
- package/dist/components/editor/toolbar-dropdown.js.map +1 -0
- package/dist/components/editor/utils/draw-mode.d.ts +55 -0
- package/dist/components/editor/utils/draw-mode.js +79 -0
- package/dist/components/editor/utils/draw-mode.js.map +1 -0
- package/dist/components/editor/utils/insertion.d.ts +11 -0
- package/dist/components/editor/utils/insertion.js +26 -0
- package/dist/components/editor/utils/insertion.js.map +1 -0
- package/dist/components/editor/utils/length-calculator.d.ts +36 -0
- package/dist/components/editor/utils/length-calculator.js +32 -0
- package/dist/components/editor/utils/length-calculator.js.map +1 -0
- package/dist/components/editor/utils/serialization.d.ts +34 -0
- package/dist/components/editor/utils/serialization.js +184 -0
- package/dist/components/editor/utils/serialization.js.map +1 -0
- package/dist/components/editor/utils/stroke-transaction.d.ts +36 -0
- package/dist/components/editor/utils/stroke-transaction.js +57 -0
- package/dist/components/editor/utils/stroke-transaction.js.map +1 -0
- package/dist/components/editor/variable-picker-content.d.ts +130 -0
- package/dist/components/editor/variable-picker-content.js +422 -0
- package/dist/components/editor/variable-picker-content.js.map +1 -0
- package/dist/editor.css +164 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +41 -13
- package/dist/lib/board-colors.d.ts +16 -0
- package/dist/lib/board-colors.js +14 -14
- package/dist/lib/board-colors.js.map +1 -1
- package/dist/lib/use-deps-changed.d.ts +33 -0
- package/dist/lib/use-deps-changed.js +11 -0
- package/dist/lib/use-deps-changed.js.map +1 -0
- package/package.json +50 -2
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type BoardColorName } from "../../lib/board-colors";
|
|
2
|
+
import type { DeviceType } from "../../lib/board-dimensions";
|
|
3
|
+
export interface ColorPickerLabels {
|
|
4
|
+
/** Accessible name for the swatch grid. */
|
|
5
|
+
colorPickerAriaLabel: string;
|
|
6
|
+
/**
|
|
7
|
+
* Display name per board color. Maps 1:1 to the app's
|
|
8
|
+
* `templateEditor.drawColors` catalog — the app's picker rendered the raw
|
|
9
|
+
* English key, which is the one string in it that never got translated.
|
|
10
|
+
*/
|
|
11
|
+
colorNames: Record<BoardColorName, string>;
|
|
12
|
+
/** Accessible name for one swatch, given its display name. */
|
|
13
|
+
colorOptionLabel: (colorName: string) => string;
|
|
14
|
+
heartCharacterAriaLabel: string;
|
|
15
|
+
heartLabel: string;
|
|
16
|
+
insertHeartTooltip: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const DEFAULT_COLOR_PICKER_LABELS: ColorPickerLabels;
|
|
19
|
+
export interface ColorPickerContentProps {
|
|
20
|
+
/** Receives a template color token, e.g. `{{red}}` — or `°` for the Note heart. */
|
|
21
|
+
onInsert: (colorValue: string) => void;
|
|
22
|
+
deviceType?: DeviceType;
|
|
23
|
+
labels?: Partial<ColorPickerLabels>;
|
|
24
|
+
}
|
|
25
|
+
export declare function ColorPickerContent({ onInsert, deviceType, labels }: ColorPickerContentProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import { Box as t } from "../layout/box.js";
|
|
4
|
+
import { Grid as n } from "../layout/grid.js";
|
|
5
|
+
import { Text as r } from "../typography/text.js";
|
|
6
|
+
import { Tooltip as i, TooltipContent as a, TooltipProvider as o, TooltipTrigger as s } from "../overlays/tooltip.js";
|
|
7
|
+
import { AVAILABLE_COLORS as c, COLOR_DISPLAY as l } from "../../lib/board-colors.js";
|
|
8
|
+
import { Heart as u } from "lucide-react";
|
|
9
|
+
import { useRef as d, useState as f } from "react";
|
|
10
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
11
|
+
//#region src/components/editor/color-picker-content.tsx
|
|
12
|
+
var h = {
|
|
13
|
+
colorPickerAriaLabel: "Color picker",
|
|
14
|
+
colorNames: {
|
|
15
|
+
red: "Red",
|
|
16
|
+
orange: "Orange",
|
|
17
|
+
yellow: "Yellow",
|
|
18
|
+
green: "Green",
|
|
19
|
+
blue: "Blue",
|
|
20
|
+
violet: "Violet",
|
|
21
|
+
white: "White",
|
|
22
|
+
black: "Black"
|
|
23
|
+
},
|
|
24
|
+
colorOptionLabel: (e) => `${e} color`,
|
|
25
|
+
heartCharacterAriaLabel: "Heart character",
|
|
26
|
+
heartLabel: "heart",
|
|
27
|
+
insertHeartTooltip: "Insert heart character (Note only)"
|
|
28
|
+
}, g = c, _ = { red: "text-black" }, v = 4;
|
|
29
|
+
function y({ onInsert: c, deviceType: y, labels: b }) {
|
|
30
|
+
let x = {
|
|
31
|
+
...h,
|
|
32
|
+
...b
|
|
33
|
+
}, S = y === "note", [C, w] = f(-1), T = d([]), E = (e) => {
|
|
34
|
+
let t = (e % g.length + g.length) % g.length;
|
|
35
|
+
w(t);
|
|
36
|
+
let n = T.current[t];
|
|
37
|
+
n?.scrollIntoView({
|
|
38
|
+
block: "nearest",
|
|
39
|
+
behavior: "smooth"
|
|
40
|
+
}), n?.focus();
|
|
41
|
+
};
|
|
42
|
+
return /* @__PURE__ */ p(o, { children: /* @__PURE__ */ m(t, {
|
|
43
|
+
className: e("p-2", !S && "pb-1"),
|
|
44
|
+
tabIndex: 0,
|
|
45
|
+
role: "listbox",
|
|
46
|
+
"aria-label": x.colorPickerAriaLabel,
|
|
47
|
+
onKeyDown: (e) => {
|
|
48
|
+
switch (e.key) {
|
|
49
|
+
case "ArrowRight":
|
|
50
|
+
e.preventDefault(), E(C + 1);
|
|
51
|
+
break;
|
|
52
|
+
case "ArrowLeft":
|
|
53
|
+
e.preventDefault(), E(C - 1);
|
|
54
|
+
break;
|
|
55
|
+
case "ArrowDown":
|
|
56
|
+
e.preventDefault(), E(C + v);
|
|
57
|
+
break;
|
|
58
|
+
case "ArrowUp":
|
|
59
|
+
e.preventDefault(), E(C - v);
|
|
60
|
+
break;
|
|
61
|
+
case "Enter":
|
|
62
|
+
case " ": e.preventDefault(), c(`{{${g[C] ?? g[0]}}}`);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
onFocus: (e) => {
|
|
66
|
+
e.target === e.currentTarget && C === -1 && E(0);
|
|
67
|
+
},
|
|
68
|
+
children: [/* @__PURE__ */ p(n, {
|
|
69
|
+
cols: "4",
|
|
70
|
+
gap: "2",
|
|
71
|
+
className: "w-64",
|
|
72
|
+
role: "presentation",
|
|
73
|
+
children: g.map((t, n) => {
|
|
74
|
+
let o = C === n;
|
|
75
|
+
return /* @__PURE__ */ m(i, { children: [/* @__PURE__ */ p(s, {
|
|
76
|
+
asChild: !0,
|
|
77
|
+
children: /* @__PURE__ */ p("button", {
|
|
78
|
+
ref: (e) => {
|
|
79
|
+
T.current[n] = e;
|
|
80
|
+
},
|
|
81
|
+
type: "button",
|
|
82
|
+
onClick: () => c(`{{${t}}}`),
|
|
83
|
+
onFocus: () => w(n),
|
|
84
|
+
className: e("h-10 rounded-md text-xs font-medium transition-all hover:scale-105 hover:shadow-md", "flex items-center justify-center focus:outline-none", o && "ring-2 ring-offset-2 ring-primary scale-105 shadow-md", l[t].bg, _[t] ?? l[t].text),
|
|
85
|
+
"aria-label": x.colorOptionLabel(x.colorNames[t]),
|
|
86
|
+
role: "option",
|
|
87
|
+
"aria-selected": o,
|
|
88
|
+
children: x.colorNames[t]
|
|
89
|
+
})
|
|
90
|
+
}), /* @__PURE__ */ p(a, { children: /* @__PURE__ */ p(r, { children: x.colorNames[t] }) })] }, t);
|
|
91
|
+
})
|
|
92
|
+
}), S && /* @__PURE__ */ p(t, {
|
|
93
|
+
className: "mt-2 pt-2 border-t border-border",
|
|
94
|
+
role: "presentation",
|
|
95
|
+
children: /* @__PURE__ */ m(i, { children: [/* @__PURE__ */ p(s, {
|
|
96
|
+
asChild: !0,
|
|
97
|
+
children: /* @__PURE__ */ m("button", {
|
|
98
|
+
type: "button",
|
|
99
|
+
onClick: () => c("°"),
|
|
100
|
+
className: e("w-full h-10 rounded-md text-sm font-medium transition-all hover:scale-[1.02] hover:shadow-md", "flex items-center justify-center gap-1.5 focus:outline-none", "bg-board-red/10 text-board-red border border-board-red/20 hover:bg-board-red/20"),
|
|
101
|
+
"aria-label": x.heartCharacterAriaLabel,
|
|
102
|
+
role: "option",
|
|
103
|
+
"aria-selected": !1,
|
|
104
|
+
children: [/* @__PURE__ */ p(u, { className: "w-4 h-4 fill-current" }), /* @__PURE__ */ p(r, {
|
|
105
|
+
as: "span",
|
|
106
|
+
weight: "medium",
|
|
107
|
+
className: "text-board-red",
|
|
108
|
+
children: x.heartLabel
|
|
109
|
+
})]
|
|
110
|
+
})
|
|
111
|
+
}), /* @__PURE__ */ p(a, { children: /* @__PURE__ */ p(r, { children: x.insertHeartTooltip }) })] })
|
|
112
|
+
})]
|
|
113
|
+
}) });
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
export { y as ColorPickerContent, h as DEFAULT_COLOR_PICKER_LABELS };
|
|
117
|
+
|
|
118
|
+
//# sourceMappingURL=color-picker-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-picker-content.js","names":[],"sources":["../../../src/components/editor/color-picker-content.tsx"],"mappings":"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"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants for the TipTap template editor.
|
|
3
|
+
* Maps template syntax to FiestaBoard hardware constraints.
|
|
4
|
+
*
|
|
5
|
+
* PORTING NOTE — this file is deliberately thin. The FiestaBoard app's
|
|
6
|
+
* `tiptap-template-editor/utils/constants.ts` re-declared the device grid, the
|
|
7
|
+
* board palette and the board character set, all of which FiestaUI already owns
|
|
8
|
+
* in `src/lib/`. Duplicating them here would give the package two sources of
|
|
9
|
+
* truth for a hardware parity contract. So everything that already exists is
|
|
10
|
+
* re-exported, and only genuinely new editor-specific values are defined below.
|
|
11
|
+
*
|
|
12
|
+
* Already owned by FiestaUI (re-exported, never redefined):
|
|
13
|
+
* - DeviceType / DEVICE_DIMENSIONS / resolveDimensions → lib/board-dimensions
|
|
14
|
+
* - BOARD_COLORS (name → hex) / BoardColorName → lib/board-colors
|
|
15
|
+
* - BOARD_CHARS (code → character) → lib/board-characters
|
|
16
|
+
*/
|
|
17
|
+
import type { BoardColorName } from "../../lib/board-colors";
|
|
18
|
+
import type { BoardDimensions } from "../../lib/board-dimensions";
|
|
19
|
+
export { BOARD_CHARS } from "../../lib/board-characters";
|
|
20
|
+
export { BOARD_COLORS, type BoardColorName } from "../../lib/board-colors";
|
|
21
|
+
export { type BoardDimensions, DEVICE_DIMENSIONS, type DeviceType, resolveDimensions, } from "../../lib/board-dimensions";
|
|
22
|
+
/**
|
|
23
|
+
* `DeviceDimensions` was the app's name for the { rows, cols } shape that
|
|
24
|
+
* FiestaUI calls `BoardDimensions`. Aliased so ported editor code reads the
|
|
25
|
+
* same, without a second interface declaration.
|
|
26
|
+
*/
|
|
27
|
+
export type DeviceDimensions = BoardDimensions;
|
|
28
|
+
/**
|
|
29
|
+
* Color names usable inside a template token, including the `purple` alias for
|
|
30
|
+
* `violet`. Wider than `BoardColorName` (which is the hardware palette) because
|
|
31
|
+
* template authors may type either spelling.
|
|
32
|
+
*/
|
|
33
|
+
export type BoardColorToken = BoardColorName | "purple";
|
|
34
|
+
/**
|
|
35
|
+
* FiestaBoard color codes (63–70), keyed by template token name.
|
|
36
|
+
*
|
|
37
|
+
* NEW: FiestaUI's `lib/board-colors` maps names → hex and codes → hex, but has
|
|
38
|
+
* no name → numeric code direction. The editor needs it because a colorTile
|
|
39
|
+
* node stores the numeric code the board hardware addresses.
|
|
40
|
+
*
|
|
41
|
+
* The `satisfies` clause fails the build if a palette color is ever added to
|
|
42
|
+
* BOARD_COLORS without a code being assigned here.
|
|
43
|
+
*/
|
|
44
|
+
export declare const BOARD_COLOR_CODES: {
|
|
45
|
+
readonly red: 63;
|
|
46
|
+
readonly orange: 64;
|
|
47
|
+
readonly yellow: 65;
|
|
48
|
+
readonly green: 66;
|
|
49
|
+
readonly blue: 67;
|
|
50
|
+
readonly violet: 68;
|
|
51
|
+
readonly purple: 68;
|
|
52
|
+
readonly white: 69;
|
|
53
|
+
readonly black: 70;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Numeric board codes → canonical color names (71 = filled tile; the closest
|
|
57
|
+
* palette entry is black). Inverse of BOARD_COLOR_CODES, minus the alias.
|
|
58
|
+
*/
|
|
59
|
+
export declare const BOARD_CODE_TO_COLOR: Record<number, BoardColorName>;
|
|
60
|
+
/**
|
|
61
|
+
* Flagship geometry, used ONLY as a default when no device is known.
|
|
62
|
+
*
|
|
63
|
+
* The app's constants.ts exported these as `BOARD_WIDTH` / `BOARD_LINES` and
|
|
64
|
+
* modules imported them directly, which silently hard-coded flagship even when
|
|
65
|
+
* the caller was editing a Note template. They are renamed to DEFAULT_* here so
|
|
66
|
+
* that reaching for one is a visible choice: anything that knows its device
|
|
67
|
+
* MUST take the width / line count as a parameter (see length-calculator.ts).
|
|
68
|
+
*/
|
|
69
|
+
export declare const DEFAULT_BOARD_WIDTH: number;
|
|
70
|
+
export declare const DEFAULT_BOARD_LINES: number;
|
|
71
|
+
/** Special variable names. */
|
|
72
|
+
export declare const FILL_SPACE_VAR = "fill_space";
|
|
73
|
+
export declare const FILL_SPACE_REPEAT_VAR = "fill_space_repeat";
|
|
74
|
+
/**
|
|
75
|
+
* Zero-width space (U+200B) inserted at the start and end of each line, and on
|
|
76
|
+
* both sides of every inline atom, so the caret always has a text node to sit
|
|
77
|
+
* in. Without it the cursor does not render at line boundaries, and it
|
|
78
|
+
* "selects" atom nodes during arrow navigation.
|
|
79
|
+
*
|
|
80
|
+
* Stripped on serialize so it never appears in a saved template string.
|
|
81
|
+
*
|
|
82
|
+
* Single source of truth: the app declared this character separately in
|
|
83
|
+
* serialization.ts, stroke-transaction.ts and trailing-newline.ts (each with a
|
|
84
|
+
* "mirroring serialization.ts" comment). Three copies of one caret contract is
|
|
85
|
+
* exactly the drift those comments were warning about, so it lives here.
|
|
86
|
+
*/
|
|
87
|
+
export declare const CURSOR_ANCHOR = "\u200B";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import "../../lib/board-colors.js";
|
|
2
|
+
import "../../lib/board-characters.js";
|
|
3
|
+
import { DEVICE_DIMENSIONS as e, resolveDimensions as t } from "../../lib/board-dimensions.js";
|
|
4
|
+
//#region src/components/editor/constants.ts
|
|
5
|
+
var n = {
|
|
6
|
+
red: 63,
|
|
7
|
+
orange: 64,
|
|
8
|
+
yellow: 65,
|
|
9
|
+
green: 66,
|
|
10
|
+
blue: 67,
|
|
11
|
+
violet: 68,
|
|
12
|
+
purple: 68,
|
|
13
|
+
white: 69,
|
|
14
|
+
black: 70
|
|
15
|
+
}, r = {
|
|
16
|
+
63: "red",
|
|
17
|
+
64: "orange",
|
|
18
|
+
65: "yellow",
|
|
19
|
+
66: "green",
|
|
20
|
+
67: "blue",
|
|
21
|
+
68: "violet",
|
|
22
|
+
69: "white",
|
|
23
|
+
70: "black",
|
|
24
|
+
71: "black"
|
|
25
|
+
}, i = e.flagship.cols, a = e.flagship.rows, o = "fill_space", s = "fill_space_repeat", c = "";
|
|
26
|
+
//#endregion
|
|
27
|
+
export { r as BOARD_CODE_TO_COLOR, n as BOARD_COLOR_CODES, c as CURSOR_ANCHOR, a as DEFAULT_BOARD_LINES, i as DEFAULT_BOARD_WIDTH, s as FILL_SPACE_REPEAT_VAR, o as FILL_SPACE_VAR, t as resolveDimensions };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../../../src/components/editor/constants.ts"],"mappings":";;;;AAwDA,IAAa,IAAoB;CAC/B,KAAK;CACL,QAAQ;CACR,QAAQ;CACR,OAAO;CACP,MAAM;CACN,QAAQ;CACR,QAAQ;CACR,OAAO;CACP,OAAO;AACT,GAMa,IAAsD;CACjE,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN,GAaa,IAAsB,EAAkB,SAAS,MACjD,IAAsB,EAAkB,SAAS,MAKjD,IAAiB,cACjB,IAAwB,qBAexB,IAAgB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { DeviceType } from "../../lib/board-dimensions";
|
|
2
|
+
import type { DrawBrush } from "./utils/draw-mode";
|
|
3
|
+
export interface DrawCharPickerLabels {
|
|
4
|
+
/** Accessible name for the character grid. */
|
|
5
|
+
characters: string;
|
|
6
|
+
/** Accessible name for the code-62 button on Flagship hardware. */
|
|
7
|
+
degree: string;
|
|
8
|
+
/** Accessible name for the code-62 button on a Note, where it draws a heart. */
|
|
9
|
+
heart: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const DEFAULT_DRAW_CHAR_PICKER_LABELS: DrawCharPickerLabels;
|
|
12
|
+
export interface DrawCharPickerContentProps {
|
|
13
|
+
current: DrawBrush;
|
|
14
|
+
onSelect: (brush: DrawBrush) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Board the template targets. Only affects how code 62 is drawn and named —
|
|
17
|
+
* the inserted character is the degree symbol either way.
|
|
18
|
+
*/
|
|
19
|
+
deviceType?: DeviceType;
|
|
20
|
+
labels?: Partial<DrawCharPickerLabels>;
|
|
21
|
+
}
|
|
22
|
+
export declare function DrawCharPickerContent({ current, onSelect, deviceType, labels }: DrawCharPickerContentProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import { Box as t } from "../layout/box.js";
|
|
4
|
+
import { Grid as n } from "../layout/grid.js";
|
|
5
|
+
import { DRAW_CHARS as r } from "./utils/draw-mode.js";
|
|
6
|
+
import { useRef as i, useState as a } from "react";
|
|
7
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/editor/draw-char-picker-content.tsx
|
|
9
|
+
var s = "°", c = "♥", l = {
|
|
10
|
+
characters: "Characters",
|
|
11
|
+
degree: "Degree",
|
|
12
|
+
heart: "Heart"
|
|
13
|
+
}, u = 8;
|
|
14
|
+
function d({ current: d, onSelect: f, deviceType: p, labels: m }) {
|
|
15
|
+
let h = {
|
|
16
|
+
...l,
|
|
17
|
+
...m
|
|
18
|
+
}, g = p === "note", _ = d.kind === "char" ? d.char : null, v = i([]), [y, b] = a(() => {
|
|
19
|
+
let e = _ ? r.indexOf(_) : -1;
|
|
20
|
+
return e >= 0 ? e : 0;
|
|
21
|
+
}), x = (e) => {
|
|
22
|
+
let t = (e % r.length + r.length) % r.length;
|
|
23
|
+
b(t), v.current[t]?.focus();
|
|
24
|
+
}, S = (e, t) => {
|
|
25
|
+
switch (e.key) {
|
|
26
|
+
case "ArrowRight":
|
|
27
|
+
e.preventDefault(), x(t + 1);
|
|
28
|
+
break;
|
|
29
|
+
case "ArrowLeft":
|
|
30
|
+
e.preventDefault(), x(t - 1);
|
|
31
|
+
break;
|
|
32
|
+
case "ArrowDown":
|
|
33
|
+
e.preventDefault(), x(t + u);
|
|
34
|
+
break;
|
|
35
|
+
case "ArrowUp":
|
|
36
|
+
e.preventDefault(), x(t - u);
|
|
37
|
+
break;
|
|
38
|
+
case "Home":
|
|
39
|
+
e.preventDefault(), x(0);
|
|
40
|
+
break;
|
|
41
|
+
case "End": e.preventDefault(), x(r.length - 1);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return /* @__PURE__ */ o(t, {
|
|
45
|
+
className: "w-64 p-2",
|
|
46
|
+
"data-testid": "draw-char-picker",
|
|
47
|
+
role: "group",
|
|
48
|
+
"aria-label": h.characters,
|
|
49
|
+
children: /* @__PURE__ */ o(n, {
|
|
50
|
+
cols: "8",
|
|
51
|
+
gap: "1",
|
|
52
|
+
children: r.map((t, n) => {
|
|
53
|
+
let r = t === s, i = r && g ? c : t;
|
|
54
|
+
return /* @__PURE__ */ o("button", {
|
|
55
|
+
ref: (e) => {
|
|
56
|
+
v.current[n] = e;
|
|
57
|
+
},
|
|
58
|
+
type: "button",
|
|
59
|
+
"data-draw-char": t,
|
|
60
|
+
tabIndex: n === y ? 0 : -1,
|
|
61
|
+
"aria-pressed": _ === t,
|
|
62
|
+
"aria-label": r ? g ? h.heart : h.degree : t,
|
|
63
|
+
onClick: () => f({
|
|
64
|
+
kind: "char",
|
|
65
|
+
char: t
|
|
66
|
+
}),
|
|
67
|
+
onFocus: () => b(n),
|
|
68
|
+
onKeyDown: (e) => S(e, n),
|
|
69
|
+
className: e("flex h-7 w-7 items-center justify-center rounded-md border font-mono text-sm transition-shadow", _ === t ? "ring-2 ring-primary ring-offset-1" : "hover:bg-muted/50"),
|
|
70
|
+
children: i
|
|
71
|
+
}, t);
|
|
72
|
+
})
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { l as DEFAULT_DRAW_CHAR_PICKER_LABELS, d as DrawCharPickerContent };
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=draw-char-picker-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draw-char-picker-content.js","names":[],"sources":["../../../src/components/editor/draw-char-picker-content.tsx"],"mappings":";;;;;;;;AA0BA,IAAM,IAAc,KAEd,IAAkB,KAWX,IAAwD;CACnE,YAAY;CACZ,QAAQ;CACR,OAAO;AACT,GAaM,IAAY;AAElB,SAAgB,EAAsB,EAAE,YAAS,aAAU,eAAY,aAAsC;CAC3G,IAAM,IAAI;EAAE,GAAG;EAAiC,GAAG;CAAO,GAIpD,IAAS,MAAe,QACxB,IAAe,EAAQ,SAAS,SAAS,EAAQ,OAAO,MACxD,IAAa,EAAqC,CAAC,CAAC,GAGpD,CAAC,GAAc,KAAmB,QAAe;EACrD,IAAM,IAAgB,IAAe,EAAW,QAAQ,CAAY,IAAI;EACxE,OAAO,KAAiB,IAAI,IAAgB;CAC9C,CAAC,GAEK,KAAa,MAAkB;EACnC,IAAM,KAAY,IAAQ,EAAW,SAAU,EAAW,UAAU,EAAW;EAE/E,AADA,EAAgB,CAAO,GACvB,EAAW,QAAQ,EAAQ,EAAE,MAAM;CACrC,GAEM,KAAiB,GAA+C,MAAkB;EACtF,QAAQ,EAAM,KAAd;GACE,KAAK;IAEH,AADA,EAAM,eAAe,GACrB,EAAU,IAAQ,CAAC;IACnB;GACF,KAAK;IAEH,AADA,EAAM,eAAe,GACrB,EAAU,IAAQ,CAAC;IACnB;GACF,KAAK;IAEH,AADA,EAAM,eAAe,GACrB,EAAU,IAAQ,CAAS;IAC3B;GACF,KAAK;IAEH,AADA,EAAM,eAAe,GACrB,EAAU,IAAQ,CAAS;IAC3B;GACF,KAAK;IAEH,AADA,EAAM,eAAe,GACrB,EAAU,CAAC;IACX;GACF,KAAK,OAEH,AADA,EAAM,eAAe,GACrB,EAAU,EAAW,SAAS,CAAC;EAEnC;CACF;CAEA,OAKE,kBAAC,GAAD;EAAK,WAAU;EAAW,eAAY;EAAmB,MAAK;EAAQ,cAAY,EAAE;EAClF,UAAA,kBAAC,GAAD;GAAM,MAAK;GAAI,KAAI;GAChB,UAAA,EAAW,KAAK,GAAM,MAAU;IAG/B,IAAM,IAAW,MAAS,GACpB,IAAQ,KAAY,IAAS,IAAkB;IAErD,OACE,kBAAC,UAAD;KAEE,MAAM,MAAO;MACX,EAAW,QAAQ,KAAS;KAC9B;KACA,MAAK;KACL,kBAAgB;KAChB,UAAU,MAAU,IAAe,IAAI;KACvC,gBAAc,MAAiB;KAC/B,cAAY,IAAY,IAAS,EAAE,QAAQ,EAAE,SAAU;KACvD,eAAe,EAAS;MAAE,MAAM;MAAQ;KAAK,CAAC;KAC9C,eAAe,EAAgB,CAAK;KACpC,YAAY,MAAU,EAAc,GAAO,CAAK;KAChD,WAAW,EACT,kGACA,MAAiB,IAAO,sCAAsC,mBAChE;KAEC,UAAA;IACK,GAlBD,CAkBC;GAEZ,CAAC;EACG,CAAA;CACH,CAAA;AAET"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ColorTileNode - Inline node for {{red}}, {{blue}}, etc.
|
|
3
|
+
* Renders as actual colored tiles matching FiestaBoard hardware
|
|
4
|
+
*/
|
|
5
|
+
import { Node } from "@tiptap/core";
|
|
6
|
+
export interface ColorTileAttrs {
|
|
7
|
+
color: string;
|
|
8
|
+
code: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const ColorTileNode: Node<any, any>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ColorTileNodeView as e } from "../node-views/color-tile-node-view.js";
|
|
3
|
+
import { ReactNodeViewRenderer as t } from "@tiptap/react";
|
|
4
|
+
import { Node as n, mergeAttributes as r } from "@tiptap/core";
|
|
5
|
+
//#region src/components/editor/extensions/color-tile-node.ts
|
|
6
|
+
var i = n.create({
|
|
7
|
+
name: "colorTile",
|
|
8
|
+
group: "inline",
|
|
9
|
+
inline: !0,
|
|
10
|
+
atom: !0,
|
|
11
|
+
selectable: !1,
|
|
12
|
+
draggable: !0,
|
|
13
|
+
addAttributes() {
|
|
14
|
+
return {
|
|
15
|
+
color: {
|
|
16
|
+
default: "red",
|
|
17
|
+
parseHTML: (e) => e.getAttribute("data-color"),
|
|
18
|
+
renderHTML: (e) => ({ "data-color": e.color })
|
|
19
|
+
},
|
|
20
|
+
code: {
|
|
21
|
+
default: 63,
|
|
22
|
+
parseHTML: (e) => {
|
|
23
|
+
let t = e.getAttribute("data-code");
|
|
24
|
+
return t ? parseInt(t, 10) : 63;
|
|
25
|
+
},
|
|
26
|
+
renderHTML: (e) => ({ "data-code": e.code?.toString() || "63" })
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
parseHTML() {
|
|
31
|
+
return [{ tag: "span[data-type=\"color-tile\"]" }];
|
|
32
|
+
},
|
|
33
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
34
|
+
return ["span", r({ "data-type": "color-tile" }, e)];
|
|
35
|
+
},
|
|
36
|
+
addNodeView() {
|
|
37
|
+
return t(e);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
//#endregion
|
|
41
|
+
export { i as ColorTileNode };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=color-tile-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-tile-node.js","names":[],"sources":["../../../../src/components/editor/extensions/color-tile-node.ts"],"mappings":";;;;;AAgBA,IAAa,IAAgB,EAAK,OAAO;CACvC,MAAM;CAEN,OAAO;CAEP,QAAQ;CAER,MAAM;CAEN,YAAY;CAEZ,WAAW;CAEX,gBAAgB;EACd,OAAO;GACL,OAAO;IACL,SAAS;IACT,YAAY,MAAY,EAAQ,aAAa,YAAY;IACzD,aAAa,OAAgB,EAC3B,cAAc,EAAW,MAC3B;GACF;GACA,MAAM;IACJ,SAAS;IACT,YAAY,MAAY;KACtB,IAAM,IAAO,EAAQ,aAAa,WAAW;KAC7C,OAAO,IAAO,SAAS,GAAM,EAAE,IAAI;IACrC;IACA,aAAa,OAAgB,EAC3B,aAAa,EAAW,MAAM,SAAS,KAAK,KAC9C;GACF;EACF;CACF;CAEA,YAAY;EACV,OAAO,CACL,EACE,KAAK,iCACP,CACF;CACF;CAEA,WAAW,EAAE,qBAAkB;EAC7B,OAAO,CAAC,QAAQ,EAAgB,EAAE,aAAa,aAAa,GAAG,CAAc,CAAC;CAChF;CAEA,cAAc;EACZ,OAAO,EAAsB,CAAiB;CAChD;AACF,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FillSpaceNode - Inline node for {{fill_space}}
|
|
3
|
+
* Visualizes expandable spacing that fills remaining line width
|
|
4
|
+
*/
|
|
5
|
+
import { Node } from "@tiptap/core";
|
|
6
|
+
export interface FillSpaceAttrs {
|
|
7
|
+
id: string;
|
|
8
|
+
repeatChar?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const FillSpaceNode: Node<any, any>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { FillSpaceNodeView as e } from "../node-views/fill-space-node-view.js";
|
|
3
|
+
import { ReactNodeViewRenderer as t } from "@tiptap/react";
|
|
4
|
+
import { Node as n, mergeAttributes as r } from "@tiptap/core";
|
|
5
|
+
//#region src/components/editor/extensions/fill-space-node.ts
|
|
6
|
+
var i = n.create({
|
|
7
|
+
name: "fillSpace",
|
|
8
|
+
group: "inline",
|
|
9
|
+
inline: !0,
|
|
10
|
+
atom: !0,
|
|
11
|
+
selectable: !1,
|
|
12
|
+
draggable: !0,
|
|
13
|
+
addAttributes() {
|
|
14
|
+
return {
|
|
15
|
+
id: {
|
|
16
|
+
default: "",
|
|
17
|
+
parseHTML: (e) => e.getAttribute("data-id"),
|
|
18
|
+
renderHTML: (e) => ({ "data-id": e.id })
|
|
19
|
+
},
|
|
20
|
+
repeatChar: {
|
|
21
|
+
default: void 0,
|
|
22
|
+
parseHTML: (e) => e.getAttribute("data-repeat-char") || void 0,
|
|
23
|
+
renderHTML: (e) => e.repeatChar ? { "data-repeat-char": e.repeatChar } : {}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
parseHTML() {
|
|
28
|
+
return [{ tag: "span[data-type=\"fill-space\"]" }];
|
|
29
|
+
},
|
|
30
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
31
|
+
return ["span", r({ "data-type": "fill-space" }, e)];
|
|
32
|
+
},
|
|
33
|
+
addNodeView() {
|
|
34
|
+
return t(e);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
//#endregion
|
|
38
|
+
export { i as FillSpaceNode };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=fill-space-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fill-space-node.js","names":[],"sources":["../../../../src/components/editor/extensions/fill-space-node.ts"],"mappings":";;;;;AAgBA,IAAa,IAAgB,EAAK,OAAO;CACvC,MAAM;CAEN,OAAO;CAEP,QAAQ;CAER,MAAM;CAEN,YAAY;CAEZ,WAAW;CAEX,gBAAgB;EACd,OAAO;GACL,IAAI;IACF,SAAS;IACT,YAAY,MAAY,EAAQ,aAAa,SAAS;IACtD,aAAa,OAAgB,EAC3B,WAAW,EAAW,GACxB;GACF;GACA,YAAY;IACV,SAAS,KAAA;IACT,YAAY,MAAY,EAAQ,aAAa,kBAAkB,KAAK,KAAA;IACpE,aAAa,MACP,EAAW,aACN,EAAE,oBAAoB,EAAW,WAAW,IAE9C,CAAC;GAEZ;EACF;CACF;CAEA,YAAY;EACV,OAAO,CACL,EACE,KAAK,iCACP,CACF;CACF;CAEA,WAAW,EAAE,qBAAkB;EAC7B,OAAO,CAAC,QAAQ,EAAgB,EAAE,aAAa,aAAa,GAAG,CAAc,CAAC;CAChF;CAEA,cAAc;EACZ,OAAO,EAAsB,CAAiB;CAChD;AACF,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { FormulaNodeView as e } from "../node-views/formula-node-view.js";
|
|
3
|
+
import { ReactNodeViewRenderer as t } from "@tiptap/react";
|
|
4
|
+
import { Node as n, mergeAttributes as r } from "@tiptap/core";
|
|
5
|
+
//#region src/components/editor/extensions/formula-node.ts
|
|
6
|
+
var i = n.create({
|
|
7
|
+
name: "formula",
|
|
8
|
+
group: "inline",
|
|
9
|
+
inline: !0,
|
|
10
|
+
atom: !0,
|
|
11
|
+
selectable: !1,
|
|
12
|
+
draggable: !0,
|
|
13
|
+
addAttributes() {
|
|
14
|
+
return {
|
|
15
|
+
expression: {
|
|
16
|
+
default: "",
|
|
17
|
+
parseHTML: (e) => e.getAttribute("data-expression") ?? "",
|
|
18
|
+
renderHTML: (e) => ({ "data-expression": e.expression })
|
|
19
|
+
},
|
|
20
|
+
autoOpen: {
|
|
21
|
+
default: !1,
|
|
22
|
+
parseHTML: () => !1,
|
|
23
|
+
renderHTML: () => ({})
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
parseHTML() {
|
|
28
|
+
return [{ tag: "span[data-type=\"formula\"]" }];
|
|
29
|
+
},
|
|
30
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
31
|
+
return ["span", r({ "data-type": "formula" }, e)];
|
|
32
|
+
},
|
|
33
|
+
addNodeView() {
|
|
34
|
+
return t(e);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
//#endregion
|
|
38
|
+
export { i as FormulaNode };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=formula-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formula-node.js","names":[],"sources":["../../../../src/components/editor/extensions/formula-node.ts"],"mappings":";;;;;AAWA,IAAa,IAAc,EAAK,OAAO;CACrC,MAAM;CAEN,OAAO;CAEP,QAAQ;CAER,MAAM;CAEN,YAAY;CAEZ,WAAW;CAEX,gBAAgB;EACd,OAAO;GACL,YAAY;IACV,SAAS;IACT,YAAY,MAAY,EAAQ,aAAa,iBAAiB,KAAK;IACnE,aAAa,OAAgB,EAC3B,mBAAmB,EAAW,WAChC;GACF;GAGA,UAAU;IACR,SAAS;IACT,iBAAiB;IACjB,mBAAmB,CAAC;GACtB;EACF;CACF;CAEA,YAAY;EACV,OAAO,CACL,EACE,KAAK,8BACP,CACF;CACF;CAEA,WAAW,EAAE,qBAAkB;EAC7B,OAAO,CAAC,QAAQ,EAAgB,EAAE,aAAa,UAAU,GAAG,CAAc,CAAC;CAC7E;CAEA,cAAc;EACZ,OAAO,EAAsB,CAAe;CAC9C;AACF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LineNavigation Extension
|
|
3
|
+
*
|
|
4
|
+
* Handles Enter key in the single-paragraph / hardBreak document model.
|
|
5
|
+
* Enter always inserts a hardBreak (line splitting). Validation of the
|
|
6
|
+
* line count is handled externally (the parent shows a warning when over
|
|
7
|
+
* the board limit, but doesn't prevent typing).
|
|
8
|
+
*
|
|
9
|
+
* Shift+Enter is blocked to prevent accidental double-breaks.
|
|
10
|
+
*
|
|
11
|
+
* NOTE: In the full TipTapTemplateEditor, the editorProps `handleKeyDown`
|
|
12
|
+
* intercepts Enter/Shift-Enter before plugin keymaps run, so the shortcuts
|
|
13
|
+
* below are effectively redundant at runtime. They are retained so that
|
|
14
|
+
* unit tests (which instantiate a bare Editor with this extension but
|
|
15
|
+
* without editorProps) still get correct Enter-as-hardBreak behavior.
|
|
16
|
+
*/
|
|
17
|
+
import { Extension } from "@tiptap/core";
|
|
18
|
+
export declare const LineNavigation: Extension<any, any>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Extension as e } from "@tiptap/core";
|
|
2
|
+
//#region src/components/editor/extensions/line-navigation.ts
|
|
3
|
+
var t = e.create({
|
|
4
|
+
name: "lineNavigation",
|
|
5
|
+
priority: 1e3,
|
|
6
|
+
addKeyboardShortcuts() {
|
|
7
|
+
return {
|
|
8
|
+
Enter: () => (this.editor.commands.setHardBreak(), !0),
|
|
9
|
+
"Shift-Enter": () => !0
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
export { t as LineNavigation };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=line-navigation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line-navigation.js","names":[],"sources":["../../../../src/components/editor/extensions/line-navigation.ts"],"mappings":";;AAkBA,IAAa,IAAiB,EAAU,OAAO;CAC7C,MAAM;CAEN,UAAU;CAEV,uBAAuB;EACrB,OAAO;GACL,cACE,KAAK,OAAO,SAAS,aAAa,GAC3B;GAGT,qBAAqB;EACvB;CACF;AACF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SingleParagraphDoc Extension
|
|
3
|
+
*
|
|
4
|
+
* Overrides the default Document node to allow EXACTLY one paragraph.
|
|
5
|
+
* This prevents ProseMirror's built-in `splitBlock` command (bound to
|
|
6
|
+
* Enter in the base keymap) from ever creating a second paragraph.
|
|
7
|
+
*
|
|
8
|
+
* Without this, a race condition or priority mis-ordering could let
|
|
9
|
+
* splitBlock run, which would:
|
|
10
|
+
* 1. Create two <p> nodes,
|
|
11
|
+
* 2. Place the cursor at position 0 of the second <p>,
|
|
12
|
+
* 3. Confuse the serializer (which reads only the first <p>).
|
|
13
|
+
*/
|
|
14
|
+
import { Node } from "@tiptap/core";
|
|
15
|
+
export declare const SingleParagraphDoc: Node<any, any>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Node as e } from "@tiptap/core";
|
|
2
|
+
//#region src/components/editor/extensions/single-paragraph-doc.ts
|
|
3
|
+
var t = e.create({
|
|
4
|
+
name: "doc",
|
|
5
|
+
topNode: !0,
|
|
6
|
+
content: "paragraph"
|
|
7
|
+
});
|
|
8
|
+
//#endregion
|
|
9
|
+
export { t as SingleParagraphDoc };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=single-paragraph-doc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"single-paragraph-doc.js","names":[],"sources":["../../../../src/components/editor/extensions/single-paragraph-doc.ts"],"mappings":";;AAeA,IAAa,IAAqB,EAAK,OAAO;CAC5C,MAAM;CACN,SAAS;CACT,SAAS;AACX,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TrailingNewline Extension
|
|
3
|
+
*
|
|
4
|
+
* Ensures that a hardBreak at the end of a paragraph always has a ZWS
|
|
5
|
+
* text node after it. Browsers collapse a bare trailing <br> inside a
|
|
6
|
+
* block element, making the new empty line invisible. By appending a
|
|
7
|
+
* zero-width space we give the line height and a cursor position.
|
|
8
|
+
*
|
|
9
|
+
* Runs as an appendTransaction plugin so it fires after any command
|
|
10
|
+
* (setHardBreak, paste, undo, etc.) that might leave a trailing <br>.
|
|
11
|
+
*/
|
|
12
|
+
import { Extension } from "@tiptap/core";
|
|
13
|
+
export declare const TrailingNewline: Extension<any, any>;
|