@estiva-app/ui 0.78.0 → 0.79.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/EditorTableControls.d.ts +9 -1
- package/dist/EditorTableControls.d.ts.map +1 -1
- package/dist/editor.d.ts +1 -1
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +17 -1
- package/dist/editor.js.map +3 -3
- package/dist/index.js.map +1 -1
- package/dist/linked.d.ts +1 -1
- package/package.json +1 -1
- package/registry.json +21 -2
- package/src/CardUnder.tsx +1 -1
- package/src/EditorTableControls.mdx +7 -2
- package/src/EditorTableControls.stories.tsx +16 -3
- package/src/EditorTableControls.test.tsx +40 -2
- package/src/EditorTableControls.tsx +25 -2
- package/src/editor.ts +1 -1
- package/src/linked.ts +1 -1
- package/src/registry/registry.test.ts +3 -3
|
@@ -13,6 +13,12 @@ export interface EditorTableControlsProps {
|
|
|
13
13
|
* row makes the next row the header, so the table still opens with one.
|
|
14
14
|
*/
|
|
15
15
|
export declare function deleteTableRow(editor: Editor, cell: HTMLTableCellElement): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The table's first row becomes its header row, or an ordinary row again:
|
|
18
|
+
* whichever cell of the table `cell` is. A table with no header row has no
|
|
19
|
+
* text spelling, so the agent keeps it as written (SPEC §13.3, "No spelling").
|
|
20
|
+
*/
|
|
21
|
+
export declare function toggleTableHeaderRow(editor: Editor, cell: HTMLTableCellElement): boolean;
|
|
16
22
|
/** The same for a column: the last one deletes the table. */
|
|
17
23
|
export declare function deleteTableColumn(editor: Editor, cell: HTMLTableCellElement): boolean;
|
|
18
24
|
/** A row after the last one: the ➕ under the table. */
|
|
@@ -22,7 +28,9 @@ export declare function appendTableColumn(editor: Editor, table: HTMLTableElemen
|
|
|
22
28
|
/**
|
|
23
29
|
* A table's own controls in an editor, as in Notion: point at a cell and a
|
|
24
30
|
* handle sits on its row's left edge and on its column's top edge; press one
|
|
25
|
-
* for Insert above and below (left and right), Delete, and Delete table.
|
|
31
|
+
* for Insert above and below (left and right), Delete, and Delete table. The
|
|
32
|
+
* first row's menu also turns the header row on and off (Header row, ticked
|
|
33
|
+
* while it is on); with it off, the first row is an ordinary row. On
|
|
26
34
|
* the last row a ➕ bar under the table adds a row, and on the last column one
|
|
27
35
|
* right of it adds a column. Tab in
|
|
28
36
|
* the last cell adds a row too — that is TableKit's own.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorTableControls.d.ts","sourceRoot":"","sources":["../src/EditorTableControls.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6D,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACjG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAS1C,MAAM,WAAW,wBAAwB;IACvC,4HAA4H;IAC5H,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,2BAA2B;IAC3B,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAwCD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAMlF;AAED,6DAA6D;AAC7D,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAGrF;AAED,uDAAuD;AACvD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAG/E;AAED,6DAA6D;AAC7D,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAIlF;AA2BD
|
|
1
|
+
{"version":3,"file":"EditorTableControls.d.ts","sourceRoot":"","sources":["../src/EditorTableControls.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6D,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACjG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAS1C,MAAM,WAAW,wBAAwB;IACvC,4HAA4H;IAC5H,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,2BAA2B;IAC3B,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAwCD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAMlF;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAExF;AAED,6DAA6D;AAC7D,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAGrF;AAED,uDAAuD;AACvD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAG/E;AAED,6DAA6D;AAC7D,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAIlF;AA2BD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,wBAAwB,+BA0I5F"}
|
package/dist/editor.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export { PastedMarkdown, type PastedMarkdownOptions } from './PastedMarkdown';
|
|
|
17
17
|
export { CodeBlockColours } from './CodeBlockColours';
|
|
18
18
|
export { suggestionPopup, isSuggestionActive, isSuggestionOpen, type SuggestionPopupOptions } from './suggestionPopup';
|
|
19
19
|
export { EditorBlockHandle, blockDropCursor, deleteBlock, moveBlock, duplicateBlock, startBlockDrag, turnIntoRows, turnListInto, turnQuoteInto, type EditorBlockHandleProps, type BlockTurnInto, type ListKind, type QuoteKind, } from './EditorBlockHandle';
|
|
20
|
-
export { EditorTableControls, appendTableRow, appendTableColumn, deleteTableRow, deleteTableColumn, type EditorTableControlsProps } from './EditorTableControls';
|
|
20
|
+
export { EditorTableControls, appendTableRow, appendTableColumn, deleteTableRow, deleteTableColumn, toggleTableHeaderRow, type EditorTableControlsProps } from './EditorTableControls';
|
|
21
21
|
export { PersonMention, UrgentPersonMention, CaptionedReference, ReferenceTrigger, SlashCommands, peopleMenu, referenceMenu, filterPeople, urgentPubkeys, filterReferences, formatSection, applyFormat, typeTrigger, filterSlashSections, FORMATS, type MentionPerson, type PersonMentionOptions, type CaptionedItem, type CaptionedReferenceOptions, type ReferenceTriggerOptions, type ReferenceMenuOptions, type SlashCommand, type SlashSection, type SlashCommandsOptions, type FormatId, type FormatDef, type CodeFormat, } from './ComposerTriggers';
|
|
22
22
|
export { BlockId, Checklist, Callout, isChecklistTick, UnknownBlock, ReferenceNode, AttachmentNode, type ReferenceNodeOptions, type ReferenceViewProps, type AttachmentNodeOptions, type AttachmentViewProps, } from './BlockNodes';
|
|
23
23
|
export { ReferenceCards, useReferenceCards, referenceAtSelection, referenceCardPlacements, setReferenceCard, setReferenceCardAt, type ReferenceCard, type ReferenceCardLayout, type ReferenceCardSlot, } from './ReferenceCards';
|
package/dist/editor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,KAAK,MAAM,EAAE,KAAK,eAAe,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AACnL,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,sBAAsB,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAA;AACpG,OAAO,EACL,UAAU,EACV,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,eA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@ -2933,7 +2933,7 @@ function turnIntoRows(node, editor) {
|
|
|
2933
2933
|
import { useCallback as useCallback6, useEffect as useEffect6, useRef as useRef5, useState as useState6 } from "react";
|
|
2934
2934
|
import { TextSelection as TextSelection2 } from "@tiptap/pm/state";
|
|
2935
2935
|
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, deleteColumn, deleteRow, deleteTable, toggleHeader } from "@tiptap/pm/tables";
|
|
2936
|
-
import { IconColumnInsertLeft, IconColumnInsertRight, IconGripHorizontal, IconGripVertical, IconPlus, IconRowInsertBottom, IconRowInsertTop, IconTrash as IconTrash2 } from "@tabler/icons-react";
|
|
2936
|
+
import { IconCheck as IconCheck2, IconColumnInsertLeft, IconColumnInsertRight, IconGripHorizontal, IconGripVertical, IconPlus, IconRowInsertBottom, IconRowInsertTop, IconTableRow, IconTrash as IconTrash2 } from "@tabler/icons-react";
|
|
2937
2937
|
import { cn as cn4 } from "@estiva-app/ui";
|
|
2938
2938
|
import { IconButton as IconButton2 } from "@estiva-app/ui";
|
|
2939
2939
|
import { Menu, MenuItem as MenuItem3, MenuSeparator as MenuSeparator2 } from "@estiva-app/ui";
|
|
@@ -2957,6 +2957,9 @@ function deleteTableRow(editor, cell) {
|
|
|
2957
2957
|
const header = isHeaderRow(row);
|
|
2958
2958
|
return inCell(editor, cell, header ? (state, dispatch, view) => deleteRow(state, dispatch) && (!view || toggleHeader("row")(view.state, view.dispatch)) : deleteRow);
|
|
2959
2959
|
}
|
|
2960
|
+
function toggleTableHeaderRow(editor, cell) {
|
|
2961
|
+
return inCell(editor, cell, toggleHeader("row"));
|
|
2962
|
+
}
|
|
2960
2963
|
function deleteTableColumn(editor, cell) {
|
|
2961
2964
|
const row = cell.closest("tr");
|
|
2962
2965
|
return inCell(editor, cell, row && row.cells.length > 1 ? deleteColumn : deleteTable);
|
|
@@ -3042,6 +3045,18 @@ function EditorTableControls({ editor, children, className }) {
|
|
|
3042
3045
|
onOpenChange: (open) => setMenu(open ? "row" : null),
|
|
3043
3046
|
trigger: /* @__PURE__ */ jsx10(IconButton2, { "aria-label": "Row menu", tooltip: "Row", className: "h-6 w-4 p-0", children: /* @__PURE__ */ jsx10(IconGripVertical, { size: 16, stroke: 1.5 }) }),
|
|
3044
3047
|
children: [
|
|
3048
|
+
shown.row.rowIndex === 0 && /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
3049
|
+
/* @__PURE__ */ jsx10(
|
|
3050
|
+
MenuItem3,
|
|
3051
|
+
{
|
|
3052
|
+
label: "Header row",
|
|
3053
|
+
leading: /* @__PURE__ */ jsx10(IconTableRow, { ...ICON }),
|
|
3054
|
+
trailing: isHeaderRow(shown.row) ? /* @__PURE__ */ jsx10(IconCheck2, { ...ICON, "aria-hidden": true }) : void 0,
|
|
3055
|
+
onClick: run(() => toggleTableHeaderRow(editor, shown.cell))
|
|
3056
|
+
}
|
|
3057
|
+
),
|
|
3058
|
+
/* @__PURE__ */ jsx10(MenuSeparator2, {})
|
|
3059
|
+
] }),
|
|
3045
3060
|
!isHeaderRow(shown.row) && /* @__PURE__ */ jsx10(MenuItem3, { label: "Insert above", leading: /* @__PURE__ */ jsx10(IconRowInsertTop, { ...ICON }), onClick: run(() => inCell(editor, shown.cell, addRowBefore)) }),
|
|
3046
3061
|
/* @__PURE__ */ jsx10(MenuItem3, { label: "Insert below", leading: /* @__PURE__ */ jsx10(IconRowInsertBottom, { ...ICON }), onClick: run(() => inCell(editor, shown.cell, addRowAfter)) }),
|
|
3047
3062
|
/* @__PURE__ */ jsx10(MenuSeparator2, {}),
|
|
@@ -3141,6 +3156,7 @@ export {
|
|
|
3141
3156
|
setReferenceCardAt,
|
|
3142
3157
|
startBlockDrag,
|
|
3143
3158
|
suggestionPopup,
|
|
3159
|
+
toggleTableHeaderRow,
|
|
3144
3160
|
turnIntoRows,
|
|
3145
3161
|
turnListInto,
|
|
3146
3162
|
turnQuoteInto,
|