@inshapardaz/likhari-react 0.1.9-dev.96 → 0.1.9

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.
@@ -1 +1 @@
1
- {"version":3,"file":"EditorRoot.d.ts","sourceRoot":"","sources":["../src/EditorRoot.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAY1D,OAAO,KAAK,EAAe,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAyB,KAAK,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AACvF,OAAO,EAAwB,KAAK,mBAAmB,EAAE,KAAK,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAKzH,OAAO,EAAyB,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAEjE,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAYhF,OAAO,EAAgC,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAMnE,yEAAyE;AACzE,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,YAAY,GAAG,KAAK,CAAC;AAEnE,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,OAAO,CAAC,QAAQ,EAAE,cAAc,GAAG,YAAY,CAAC,CAAC;IACzD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC/B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAA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AC;IAClD,iBAAiB,IAAI,OAAO,CAAC;IAC7B,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC,KAAK,IAAI,IAAI,CAAC;CACf;AAQD,eAAO,MAAM,UAAU,uGAyWrB,CAAC"}
@@ -7,7 +7,6 @@ import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin';
7
7
  import { ListPlugin } from '@lexical/react/LexicalListPlugin';
8
8
  import { CheckListPlugin } from '@lexical/react/LexicalCheckListPlugin';
9
9
  import { LinkPlugin } from '@lexical/react/LexicalLinkPlugin';
10
- import { TablePlugin } from '@lexical/react/LexicalTablePlugin';
11
10
  import { HorizontalRulePlugin } from '@lexical/react/LexicalHorizontalRulePlugin';
12
11
  import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin';
13
12
  import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary';
@@ -267,7 +266,7 @@ export const EditorRoot = forwardRef(function EditorRoot({ documentId, initialCo
267
266
  const portalTargetSelector = `#${CSS.escape(portalTargetId)}`;
268
267
  return (_jsx(EditorThemeProvider, { theme: theme, colorScheme: colorScheme, accentColor: accentColor, scopeElementId: portalTargetId, children: _jsxs("div", { className: "likhari-root", dir: dir, ref: rootElementRef, "data-document-id": documentId, style: { height: typeof height === 'number' ? `${height}px` : height }, children: [_jsx("div", { id: portalTargetId, className: "likhari-portal-target" }), _jsx(PortalTargetContext.Provider, { value: portalTargetSelector, children: _jsxs(UiStringsContext.Provider, { value: strings, children: [_jsx(ImageOptionsContext.Provider, { value: imageOptions, children: _jsxs(LexicalComposer, { initialConfig: initialConfig, children: [_jsx(Toolbar, { config: config, onSave: handleSave, isDirty: isDirty, showSave: showSave, fontOptions: fontOptions, direction: dir, locale: locale, drafts: autosave
269
268
  ? { currentId: draftId, maxBytes: autosaveMaxBytes, adoptOnRestore: !documentId, onRestored: handleDraftRestored }
270
- : undefined }), documentId && (_jsx(DraftRestore, { draftId: documentId, mode: restoreDraft, initialJson: initialContentJsonRef.current, locale: locale, onRestored: handleDraftRestored })), _jsx("div", { className: "likhari-canvas", children: _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "likhari-content-editable", dir: dir, "aria-label": strings.editor.contentLabel }), placeholder: _jsx("div", { className: "likhari-placeholder", children: resolvedPlaceholder }), ErrorBoundary: LexicalErrorBoundary }) }), config.history && _jsx(HistoryPlugin, {}), (config.lists.bullet || config.lists.numbered || config.lists.check) && _jsx(ListPlugin, {}), config.lists.check && _jsx(CheckListPlugin, {}), config.links && _jsx(LinkPlugin, {}), config.links && _jsx(LinkPastePlugin, {}), config.tables && _jsx(TablePlugin, { hasCellMerge: false, hasTabHandler: true }), config.blocks.horizontalRule && _jsx(HorizontalRulePlugin, {}), _jsx(OnChangePlugin, { onChange: handleChange })] }) }), _jsx(LeaveDialog, { opened: leavePrompt !== null, canSave: Boolean(onSave), canSaveDraft: autosave || navigationGuard === 'save-draft', draftFailed: leavePrompt?.draftFailed ?? false, onSave: () => {
269
+ : undefined }), documentId && (_jsx(DraftRestore, { draftId: documentId, mode: restoreDraft, initialJson: initialContentJsonRef.current, locale: locale, onRestored: handleDraftRestored })), _jsx("div", { className: "likhari-canvas", children: _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "likhari-content-editable", dir: dir, "aria-label": strings.editor.contentLabel }), placeholder: _jsx("div", { className: "likhari-placeholder", children: resolvedPlaceholder }), ErrorBoundary: LexicalErrorBoundary }) }), config.history && _jsx(HistoryPlugin, {}), (config.lists.bullet || config.lists.numbered || config.lists.check) && _jsx(ListPlugin, {}), config.lists.check && _jsx(CheckListPlugin, {}), config.links && _jsx(LinkPlugin, {}), config.links && _jsx(LinkPastePlugin, {}), config.blocks.horizontalRule && _jsx(HorizontalRulePlugin, {}), _jsx(OnChangePlugin, { onChange: handleChange })] }) }), _jsx(LeaveDialog, { opened: leavePrompt !== null, canSave: Boolean(onSave), canSaveDraft: autosave || navigationGuard === 'save-draft', draftFailed: leavePrompt?.draftFailed ?? false, onSave: () => {
271
270
  handleSave();
272
271
  settleLeave(true);
273
272
  }, onSaveDraft: () => {
@@ -1 +1 @@
1
- {"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/components/Toolbar.tsx"],"names":[],"mappings":"AAsDA,OAAO,EAAgB,KAAK,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEzE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAA6D,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAItG,OAAO,KAAK,EAAE,MAAM,EAAW,MAAM,iBAAiB,CAAC;AA8YvD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,2BAA2B,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sEAAsE;IACtE,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,wFAAwF;IACxF,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAC1B,oFAAoF;IACpF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kGAAkG;IAClG,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B;AAED,wBAAgB,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAkC,EAAE,SAAiB,EAAE,MAAa,EAAE,MAAM,EAAE,EAAE,YAAY,+BAo6BxJ"}
1
+ {"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/components/Toolbar.tsx"],"names":[],"mappings":"AA4CA,OAAO,EAAgB,KAAK,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEzE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAA6D,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAItG,OAAO,KAAK,EAAE,MAAM,EAAW,MAAM,iBAAiB,CAAC;AAuUvD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,2BAA2B,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sEAAsE;IACtE,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,wFAAwF;IACxF,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAC1B,oFAAoF;IACpF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kGAAkG;IAClG,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B;AAED,wBAAgB,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAkC,EAAE,SAAiB,EAAE,MAAa,EAAE,MAAM,EAAE,EAAE,YAAY,+BA4xBxJ"}
@@ -11,9 +11,6 @@ import { $findMatchingParent, $insertNodeToNearestRoot } from '@lexical/utils';
11
11
  import { INSERT_HORIZONTAL_RULE_COMMAND } from '@lexical/react/LexicalHorizontalRuleNode';
12
12
  import { ImageDialog } from '../image/ImageDialog.js';
13
13
  import { $createImageNode } from '../image/ImageNode.js';
14
- import { TableDialog } from './TableDialog.js';
15
- import { $getTableCellNodeFromLexicalNode, $isTableSelection, INSERT_TABLE_COMMAND } from '@lexical/table';
16
- import { $deleteTable, $deleteTableColumns, $deleteTableRows, $getTableSelectionSize, $insertTableColumns, $insertTableRows, } from '../table/tableActions.js';
17
14
  import { $createLinkNode, $isLinkNode, TOGGLE_LINK_COMMAND } from '@lexical/link';
18
15
  import { LinkDialog } from './LinkDialog.js';
19
16
  import { DraftsDialog } from './DraftsDialog.js';
@@ -22,7 +19,7 @@ import { CANVAS_FONT_DEFAULTS, DEFAULT_FONT_OPTIONS, FONT_SIZES_PX } from '../fo
22
19
  import { setStyleProperty } from '../utils/style.js';
23
20
  import { useStrings } from '../i18n/useStrings.js';
24
21
  import { usePortalTarget } from '../PortalTargetContext.js';
25
- import { IconAbc, IconAlignCenter, IconAlignJustified, IconAlignLeft, IconAlignRight, IconArrowBackUp, IconArrowForwardUp, IconBold, IconClearFormatting, IconDeviceFloppy, IconDots, IconHistory, IconExternalLink, IconFeather, IconH1, IconH2, IconH3, IconH4, IconH5, IconH6, IconIndentDecrease, IconIndentIncrease, IconItalic, IconLetterCase, IconLetterCaseLower, IconLetterCaseUpper, IconLink, IconLinkOff, IconList, IconListCheck, IconListNumbers, IconPencil, IconPhoto, IconPilcrow, IconQuote, IconSeparatorHorizontal, IconSparkles, IconStrikethrough, IconSubscript, IconSuperscript, IconColumnInsertLeft, IconColumnInsertRight, IconColumnRemove, IconRowInsertBottom, IconRowInsertTop, IconRowRemove, IconTable, IconTableMinus, IconTableOptions, IconTextSize, IconTypography, IconUnderline, IconWand, } from '@tabler/icons-react';
22
+ import { IconAbc, IconAlignCenter, IconAlignJustified, IconAlignLeft, IconAlignRight, IconArrowBackUp, IconArrowForwardUp, IconBold, IconClearFormatting, IconDeviceFloppy, IconDots, IconHistory, IconExternalLink, IconFeather, IconH1, IconH2, IconH3, IconH4, IconH5, IconH6, IconIndentDecrease, IconIndentIncrease, IconItalic, IconLetterCase, IconLetterCaseLower, IconLetterCaseUpper, IconLink, IconLinkOff, IconList, IconListCheck, IconListNumbers, IconPencil, IconPhoto, IconPilcrow, IconQuote, IconSeparatorHorizontal, IconSparkles, IconStrikethrough, IconSubscript, IconSuperscript, IconTextSize, IconTypography, IconUnderline, IconWand, } from '@tabler/icons-react';
26
23
  /** Sentinel for "no inline style": Lexical returns the default it is given when
27
24
  * the selection has none, so this tells "unstyled" (show the canvas default)
28
25
  * apart from "styled with a value the dropdown doesn't list" (show nothing). */
@@ -36,9 +33,6 @@ const INITIAL_STATE = {
36
33
  fontSize: UNSET_STYLE,
37
34
  isLink: false,
38
35
  linkUrl: '',
39
- inTable: false,
40
- tableRows: 1,
41
- tableColumns: 1,
42
36
  canUndo: false,
43
37
  canRedo: false,
44
38
  };
@@ -127,21 +121,6 @@ function LinkMenuItems({ url, onEdit, onRemove, strings }) {
127
121
  // Not a URL the editor would accept (e.g. loaded from a document): show it, don't make it clickable.
128
122
  _jsx(Menu.Item, { disabled: true, title: url, className: "likhari-link-menu-url", children: url || strings.link.noUrl })), _jsx(Menu.Item, { leftSection: _jsx(IconPencil, { size: ICON_SIZE, stroke: ICON_STROKE }), onMouseDown: (e) => e.preventDefault(), onClick: onEdit, children: strings.link.editLink }), _jsx(Menu.Item, { color: "red", leftSection: _jsx(IconLinkOff, { size: ICON_SIZE, stroke: ICON_STROKE }), onMouseDown: (e) => e.preventDefault(), onClick: onRemove, children: strings.link.removeLink })] }));
129
123
  }
130
- /** The table actions menu's contents — shared by the toolbar button and the
131
- * right-click menu. Each acts on the selected cell, or on every row/column a
132
- * multi-cell selection covers. */
133
- function TableMenuItems({ strings, direction, rows, columns, onAction, }) {
134
- const t = strings.tableMenu;
135
- // "Before" is the start side, which is on the right in an RTL table.
136
- const rtl = direction === 'rtl';
137
- const manyRows = rows > 1;
138
- const manyColumns = columns > 1;
139
- const item = (icon, label, action, color) => {
140
- const Icon = icon;
141
- return (_jsx(Menu.Item, { color: color, leftSection: _jsx(Icon, { size: ICON_SIZE, stroke: ICON_STROKE }), onMouseDown: (e) => e.preventDefault(), onClick: onAction(action), children: label }));
142
- };
143
- return (_jsxs(_Fragment, { children: [_jsx(Menu.Label, { children: t.menuLabel }), item(IconRowInsertTop, manyRows ? t.insertRowsBefore : t.insertRowBefore, () => $insertTableRows(false)), item(IconRowInsertBottom, manyRows ? t.insertRowsAfter : t.insertRowAfter, () => $insertTableRows(true)), item(rtl ? IconColumnInsertRight : IconColumnInsertLeft, manyColumns ? t.insertColumnsBefore : t.insertColumnBefore, () => $insertTableColumns(false)), item(rtl ? IconColumnInsertLeft : IconColumnInsertRight, manyColumns ? t.insertColumnsAfter : t.insertColumnAfter, () => $insertTableColumns(true)), _jsx(Menu.Divider, {}), item(IconRowRemove, manyRows ? t.deleteRows : t.deleteRow, $deleteTableRows), item(IconColumnRemove, manyColumns ? t.deleteColumns : t.deleteColumn, $deleteTableColumns), item(IconTableMinus, t.deleteTable, $deleteTable, 'red')] }));
144
- }
145
124
  export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAULT_FONT_OPTIONS, direction = 'ltr', locale = 'en', drafts }) {
146
125
  const [editor] = useLexicalComposerContext();
147
126
  const [state, setState] = useState(INITIAL_STATE);
@@ -160,17 +139,9 @@ export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAU
160
139
  const updateToolbar = useCallback(() => {
161
140
  editor.getEditorState().read(() => {
162
141
  const selection = $getSelection();
163
- // A selection of several table cells isn't a range selection.
164
- if ($isTableSelection(selection)) {
165
- const { rows, columns } = $getTableSelectionSize();
166
- setState((s) => ({ ...s, inTable: true, tableRows: rows, tableColumns: columns }));
167
- return;
168
- }
169
142
  if (!$isRangeSelection(selection))
170
143
  return;
171
144
  const anchorNode = selection.anchor.getNode();
172
- const inTable = $getTableCellNodeFromLexicalNode(anchorNode) !== null;
173
- const tableSize = inTable ? $getTableSelectionSize() : { rows: 1, columns: 1 };
174
145
  const element = anchorNode.getKey() === 'root' ? anchorNode : (anchorNode.getTopLevelElement() ?? anchorNode);
175
146
  const listParent = $findMatchingParent(anchorNode, $isListNode);
176
147
  const listType = listParent && $isListNode(listParent) ? listParent.getListType() : null;
@@ -206,9 +177,6 @@ export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAU
206
177
  fontSize,
207
178
  isLink,
208
179
  linkUrl,
209
- inTable,
210
- tableRows: tableSize.rows,
211
- tableColumns: tableSize.columns,
212
180
  }));
213
181
  });
214
182
  }, [editor]);
@@ -308,26 +276,6 @@ export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAU
308
276
  });
309
277
  closeImageDialog();
310
278
  };
311
- const [tableDialogOpen, setTableDialogOpen] = useState(false);
312
- const openTableDialog = () => {
313
- snapshotSelection();
314
- setTableDialogOpen(true);
315
- };
316
- const closeTableDialog = () => {
317
- setTableDialogOpen(false);
318
- editor.focus();
319
- };
320
- const insertTable = ({ rows, columns, headerRow }) => {
321
- const saved = menuSelectionRef.current;
322
- if (saved)
323
- editor.update(() => $setSelection(saved.clone()), { discrete: true });
324
- editor.dispatchCommand(INSERT_TABLE_COMMAND, {
325
- rows: String(rows),
326
- columns: String(columns),
327
- includeHeaders: { rows: headerRow, columns: false },
328
- });
329
- closeTableDialog();
330
- };
331
279
  /** Applies a font property per `config.font.scope`: to the selection, to
332
280
  * every text node in the document, or (for 'both') to the selection when
333
281
  * there is a range and to the whole document when there isn't. */
@@ -421,50 +369,6 @@ export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAU
421
369
  root?.addEventListener('contextmenu', onContextMenu);
422
370
  });
423
371
  }, [editor, config.links]);
424
- // Table actions. The menu takes focus, so the selection is snapshotted when it
425
- // opens and restored before an action runs.
426
- const runTableAction = (action) => () => {
427
- restoreSelection();
428
- editor.update(action);
429
- editor.focus();
430
- };
431
- // Right-clicking a table cell opens the same actions at the pointer.
432
- const [tableContext, setTableContext] = useState(null);
433
- useEffect(() => {
434
- if (!config.tables)
435
- return;
436
- const onContextMenu = (event) => {
437
- if (event.defaultPrevented)
438
- return; // a link inside the cell already took it
439
- const cellElement = event.target?.closest?.('td, th');
440
- if (!cellElement)
441
- return;
442
- let handled = false;
443
- editor.update(() => {
444
- const node = $getNearestNodeFromDOMNode(cellElement);
445
- const cell = node ? $getTableCellNodeFromLexicalNode(node) : null;
446
- if (!cell)
447
- return;
448
- handled = true;
449
- const selection = $getSelection();
450
- // Keep a multi-cell selection that includes this cell, so "insert
451
- // rows" / "delete columns" act on everything selected.
452
- const insideSelection = $isTableSelection(selection) && selection.getNodes().some((n) => n.getKey() === cell.getKey());
453
- if (!insideSelection)
454
- cell.selectEnd();
455
- }, { discrete: true });
456
- if (!handled)
457
- return;
458
- event.preventDefault();
459
- snapshotSelectionRef.current();
460
- const size = editor.getEditorState().read($getTableSelectionSize);
461
- setTableContext({ x: event.clientX, y: event.clientY, rows: size.rows, columns: size.columns });
462
- };
463
- return editor.registerRootListener((root, previous) => {
464
- previous?.removeEventListener('contextmenu', onContextMenu);
465
- root?.addEventListener('contextmenu', onContextMenu);
466
- });
467
- }, [editor, config.tables]);
468
372
  // Ctrl/Cmd+K opens the link dialog.
469
373
  useEffect(() => {
470
374
  if (!config.links)
@@ -525,7 +429,7 @@ export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAU
525
429
  const showFormattingGroup = headingLevels.length > 0 || config.lists.bullet || config.lists.numbered || config.lists.check || config.blocks.quote;
526
430
  const showInlineGroup = fmt.bold || fmt.italic || fmt.underline;
527
431
  const showAlignGroup = config.alignment.start || config.alignment.center || config.alignment.justify || config.alignment.left || config.alignment.right;
528
- const showStubInsertGroup = config.images.linked || config.images.embedded || config.tables || config.blocks.horizontalRule || config.poetry.enabled;
432
+ const showStubInsertGroup = config.images.linked || config.images.embedded || config.blocks.horizontalRule || config.poetry.enabled;
529
433
  const showLanguageGroup = config.language.autocorrect || config.language.textCleanup || config.language.spellCheck;
530
434
  // The "script & cleanup" and "indent/outdent" groups (UI spec §3.3) render
531
435
  // as normal inline toolbar groups whenever there's room, and only move
@@ -695,8 +599,7 @@ export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAU
695
599
  restoreSelection();
696
600
  openLinkDialog();
697
601
  }, onRemove: removeLink, strings: strings }) })] })) : (_jsx(ToolbarButton, { icon: IconLink, title: strings.toolbar.insertLink, onClick: openLinkDialog })) }, "link")),
698
- showStubInsertGroup && (_jsxs("div", { className: "likhari-toolbar-group likhari-toolbar-group--collapse-tablet", children: [(config.images.linked || config.images.embedded) && (_jsx(ToolbarButton, { icon: IconPhoto, title: strings.toolbar.insertImage, onClick: openImageDialog })), config.tables && _jsx(ToolbarButton, { icon: IconTable, title: strings.toolbar.insertTable, onClick: openTableDialog }), config.blocks.horizontalRule && (_jsx(ToolbarButton, { icon: IconSeparatorHorizontal, title: strings.toolbar.insertHorizontalRule, onClick: () => editor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, undefined) })), config.poetry.enabled && _jsx(StubButton, { icon: IconFeather, title: strings.toolbar.poetryBlocks, comingSoon: strings.toolbar.comingSoon })] }, "stubInsert")),
699
- config.tables && state.inTable && (_jsx("div", { className: "likhari-toolbar-group", children: _jsxs(Menu, { position: "bottom-start", withinPortal: true, portalProps: { target: portalTarget }, shadow: "sm", width: 240, onOpen: snapshotSelection, children: [_jsx(Menu.Target, { children: _jsx("button", { type: "button", className: "likhari-toolbar-button", "data-active": "true", "aria-pressed": "true", "aria-haspopup": "menu", "aria-label": strings.toolbar.tableOptions, title: strings.toolbar.tableOptions, onMouseDown: (e) => e.preventDefault(), children: _jsx(IconTableOptions, { size: ICON_SIZE, stroke: ICON_STROKE }) }) }), _jsx(Menu.Dropdown, { children: _jsx(TableMenuItems, { strings: strings, direction: direction, rows: state.tableRows, columns: state.tableColumns, onAction: runTableAction }) })] }) }, "tableActions")),
602
+ showStubInsertGroup && (_jsxs("div", { className: "likhari-toolbar-group likhari-toolbar-group--collapse-tablet", children: [(config.images.linked || config.images.embedded) && (_jsx(ToolbarButton, { icon: IconPhoto, title: strings.toolbar.insertImage, onClick: openImageDialog })), config.blocks.horizontalRule && (_jsx(ToolbarButton, { icon: IconSeparatorHorizontal, title: strings.toolbar.insertHorizontalRule, onClick: () => editor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, undefined) })), config.poetry.enabled && _jsx(StubButton, { icon: IconFeather, title: strings.toolbar.poetryBlocks, comingSoon: strings.toolbar.comingSoon })] }, "stubInsert")),
700
603
  showLanguageGroup && (_jsxs("div", { className: "likhari-toolbar-group likhari-toolbar-group--collapse-tablet", children: [config.language.autocorrect && _jsx(StubButton, { icon: IconWand, title: strings.toolbar.autocorrect, comingSoon: strings.toolbar.comingSoon }), config.language.textCleanup && _jsx(StubButton, { icon: IconSparkles, title: strings.toolbar.textCleanup, comingSoon: strings.toolbar.comingSoon }), config.language.spellCheck && _jsx(StubButton, { icon: IconAbc, title: strings.toolbar.spellChecker, comingSoon: strings.toolbar.comingSoon })] }, "language")),
701
604
  ];
702
605
  return (_jsxs("div", { className: "likhari-toolbar", role: "toolbar", "aria-label": strings.toolbar.ariaLabel, ref: toolbarContainerRef, children: [fixedGroups, movableGroups
@@ -709,10 +612,7 @@ export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAU
709
612
  }, position: "bottom-start", withinPortal: true, portalProps: { target: portalTarget }, shadow: "sm", width: 240, children: [_jsx(Menu.Target, { children: _jsx("span", { "aria-hidden": "true", style: { position: 'fixed', left: linkContext?.x ?? -9999, top: linkContext?.y ?? -9999, width: 1, height: 1, pointerEvents: 'none' } }) }), _jsx(Menu.Dropdown, { children: _jsx(LinkMenuItems, { url: linkContext?.url ?? '', onEdit: () => {
710
613
  restoreSelection();
711
614
  openLinkDialog();
712
- }, onRemove: removeLink, strings: strings }) })] })), config.tables && (_jsxs(Menu, { opened: tableContext !== null, onChange: (opened) => {
713
- if (!opened)
714
- setTableContext(null);
715
- }, position: "bottom-start", withinPortal: true, portalProps: { target: portalTarget }, shadow: "sm", width: 240, children: [_jsx(Menu.Target, { children: _jsx("span", { "aria-hidden": "true", style: { position: 'fixed', left: tableContext?.x ?? -9999, top: tableContext?.y ?? -9999, width: 1, height: 1, pointerEvents: 'none' } }) }), _jsx(Menu.Dropdown, { children: _jsx(TableMenuItems, { strings: strings, direction: direction, rows: tableContext?.rows ?? 1, columns: tableContext?.columns ?? 1, onAction: runTableAction }) })] })), _jsxs("div", { "aria-hidden": "true", ref: toolbarMeasureRef, style: {
615
+ }, onRemove: removeLink, strings: strings }) })] })), _jsxs("div", { "aria-hidden": "true", ref: toolbarMeasureRef, style: {
716
616
  position: 'absolute',
717
617
  visibility: 'hidden',
718
618
  pointerEvents: 'none',
@@ -721,5 +621,5 @@ export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAU
721
621
  display: 'flex',
722
622
  flexWrap: 'nowrap',
723
623
  gap: 8,
724
- }, children: [fixedGroups, movableGroups.map((group) => (_jsx(MovableGroupButtons, { group: group }, group.key)))] }), (config.images.linked || config.images.embedded) && (_jsx(ImageDialog, { mode: "insert", opened: imageDialogOpen, onSubmit: insertImage, onClose: closeImageDialog })), config.tables && _jsx(TableDialog, { opened: tableDialogOpen, onSubmit: insertTable, onClose: closeTableDialog }), config.links && (_jsx(LinkDialog, { opened: linkDialogOpen, initialUrl: state.linkUrl, showTextField: linkNeedsText, onSubmit: applyLink, onRemove: state.isLink ? removeLink : undefined, onClose: closeLinkDialog })), drafts && _jsx(DraftsDialog, { opened: draftsOpen, locale: locale, onClose: () => setDraftsOpen(false), ...drafts })] }));
624
+ }, children: [fixedGroups, movableGroups.map((group) => (_jsx(MovableGroupButtons, { group: group }, group.key)))] }), (config.images.linked || config.images.embedded) && (_jsx(ImageDialog, { mode: "insert", opened: imageDialogOpen, onSubmit: insertImage, onClose: closeImageDialog })), config.links && (_jsx(LinkDialog, { opened: linkDialogOpen, initialUrl: state.linkUrl, showTextField: linkNeedsText, onSubmit: applyLink, onRemove: state.isLink ? removeLink : undefined, onClose: closeLinkDialog })), drafts && _jsx(DraftsDialog, { opened: draftsOpen, locale: locale, onClose: () => setDraftsOpen(false), ...drafts })] }));
725
625
  }
@@ -38,11 +38,8 @@ export interface Strings {
38
38
  noMatch: string;
39
39
  alignment: string;
40
40
  linkOptions: string;
41
- /** Toolbar button (shown while the caret is in a table) that opens the table actions menu. */
42
- tableOptions: string;
43
41
  insertLink: string;
44
42
  insertImage: string;
45
- insertTable: string;
46
43
  insertHorizontalRule: string;
47
44
  poetryBlocks: string;
48
45
  comingSoon: (label: string) => string;
@@ -111,24 +108,6 @@ export interface Strings {
111
108
  delete: string;
112
109
  close: string;
113
110
  };
114
- /** The table actions menu (toolbar button and right-click on a cell). */
115
- tableMenu: {
116
- menuLabel: string;
117
- insertRowBefore: string;
118
- insertRowAfter: string;
119
- insertColumnBefore: string;
120
- insertColumnAfter: string;
121
- deleteRow: string;
122
- deleteColumn: string;
123
- deleteTable: string;
124
- /** Plural forms, used when the selection spans several rows or columns. */
125
- insertRowsBefore: string;
126
- insertRowsAfter: string;
127
- insertColumnsBefore: string;
128
- insertColumnsAfter: string;
129
- deleteRows: string;
130
- deleteColumns: string;
131
- };
132
111
  link: {
133
112
  menuLabel: string;
134
113
  noUrl: string;
@@ -145,12 +124,6 @@ export interface Strings {
145
124
  invalidUrl: string;
146
125
  apply: string;
147
126
  };
148
- tableDialog: {
149
- title: string;
150
- rows: string;
151
- columns: string;
152
- headerRow: string;
153
- };
154
127
  imageDialog: {
155
128
  titleInsert: string;
156
129
  titleEdit: string;
@@ -1 +1 @@
1
- {"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/i18n/strings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;+DAC+D;AAC/D,MAAM,MAAM,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,cAAc,CAAC;AAElD,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE;QACN,mGAAmG;QACnG,WAAW,EAAE,MAAM,CAAC;QACpB,gDAAgD;QAChD,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,OAAO,EAAE;QACP,gEAAgE;QAChE,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,0CAA0C;QAC1C,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,eAAe,EAAE,MAAM,CAAC;QACxB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,M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M,CAAC;YACrB,eAAe,EAAE,MAAM,CAAC;YACxB,gBAAgB,EAAE,MAAM,CAAC;YACzB,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;SAC3C,CAAC;KACH,CAAC;IACF,eAAe,EAAE;QACf,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,EAAE,CAAC,OAAO,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,KAAK,MAAM,CAAC;QACxE,MAAM,EAAE;YACN,cAAc,EAAE,MAAM,CAAC;YACvB,YAAY,EAAE,MAAM,CAAC;YACrB,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;SAC3C,CAAC;KACH,CAAC;IACF,SAAS,EAAE;QACT,SAAS,EAAE,MAAM,CAAC;QAClB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AA6fD,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAI3C,CAAC;AAEF;;sDAEsD;AACtD,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAElD"}
@@ -31,10 +31,8 @@ const en = {
31
31
  noMatch: 'No match',
32
32
  alignment: 'Alignment',
33
33
  linkOptions: 'Link options',
34
- tableOptions: 'Table options',
35
34
  insertLink: 'Insert link (Ctrl+K)',
36
35
  insertImage: 'Insert image',
37
- insertTable: 'Insert table',
38
36
  insertHorizontalRule: 'Insert horizontal rule',
39
37
  poetryBlocks: 'Poetry blocks',
40
38
  comingSoon: (label) => `${label} (coming soon)`,
@@ -98,22 +96,6 @@ const en = {
98
96
  delete: 'Delete',
99
97
  close: 'Close',
100
98
  },
101
- tableMenu: {
102
- menuLabel: 'Table',
103
- insertRowBefore: 'Insert row before',
104
- insertRowAfter: 'Insert row after',
105
- insertColumnBefore: 'Insert column before',
106
- insertColumnAfter: 'Insert column after',
107
- deleteRow: 'Delete row',
108
- deleteColumn: 'Delete column',
109
- deleteTable: 'Delete table',
110
- insertRowsBefore: 'Insert rows before',
111
- insertRowsAfter: 'Insert rows after',
112
- insertColumnsBefore: 'Insert columns before',
113
- insertColumnsAfter: 'Insert columns after',
114
- deleteRows: 'Delete rows',
115
- deleteColumns: 'Delete columns',
116
- },
117
99
  link: {
118
100
  menuLabel: 'Link',
119
101
  noUrl: '(no URL)',
@@ -130,12 +112,6 @@ const en = {
130
112
  invalidUrl: 'Enter a valid http(s), mailto, tel or relative URL',
131
113
  apply: 'Apply',
132
114
  },
133
- tableDialog: {
134
- title: 'Insert table',
135
- rows: 'Rows',
136
- columns: 'Columns',
137
- headerRow: 'Header row',
138
- },
139
115
  imageDialog: {
140
116
  titleInsert: 'Insert image',
141
117
  titleEdit: 'Edit image',
@@ -222,10 +198,8 @@ const ur = {
222
198
  noMatch: 'کوئی مماثلت نہیں',
223
199
  alignment: 'سیدھ',
224
200
  linkOptions: 'لنک کے اختیارات',
225
- tableOptions: 'جدول کے اختیارات',
226
201
  insertLink: 'لنک شامل کریں (Ctrl+K)',
227
202
  insertImage: 'تصویر شامل کریں',
228
- insertTable: 'جدول شامل کریں',
229
203
  insertHorizontalRule: 'افقی لکیر شامل کریں',
230
204
  poetryBlocks: 'شاعری کے بلاکس',
231
205
  comingSoon: (label) => `${label} (جلد آ رہا ہے)`,
@@ -289,22 +263,6 @@ const ur = {
289
263
  delete: 'حذف کریں',
290
264
  close: 'بند کریں',
291
265
  },
292
- tableMenu: {
293
- menuLabel: 'جدول',
294
- insertRowBefore: 'پہلے قطار شامل کریں',
295
- insertRowAfter: 'بعد میں قطار شامل کریں',
296
- insertColumnBefore: 'پہلے کالم شامل کریں',
297
- insertColumnAfter: 'بعد میں کالم شامل کریں',
298
- deleteRow: 'قطار حذف کریں',
299
- deleteColumn: 'کالم حذف کریں',
300
- deleteTable: 'جدول حذف کریں',
301
- insertRowsBefore: 'پہلے قطاریں شامل کریں',
302
- insertRowsAfter: 'بعد میں قطاریں شامل کریں',
303
- insertColumnsBefore: 'پہلے کالمز شامل کریں',
304
- insertColumnsAfter: 'بعد میں کالمز شامل کریں',
305
- deleteRows: 'قطاریں حذف کریں',
306
- deleteColumns: 'کالمز حذف کریں',
307
- },
308
266
  link: {
309
267
  menuLabel: 'لنک',
310
268
  noUrl: '(کوئی یو آر ایل نہیں)',
@@ -321,12 +279,6 @@ const ur = {
321
279
  invalidUrl: 'براہِ کرم ایک درست http(s)، mailto، tel یا رشتہ دار یو آر ایل درج کریں',
322
280
  apply: 'لاگو کریں',
323
281
  },
324
- tableDialog: {
325
- title: 'جدول شامل کریں',
326
- rows: 'قطاریں',
327
- columns: 'کالم',
328
- headerRow: 'سرِ فہرست قطار',
329
- },
330
282
  imageDialog: {
331
283
  titleInsert: 'تصویر شامل کریں',
332
284
  titleEdit: 'تصویر میں ترمیم کریں',
@@ -413,10 +365,8 @@ const paShahmukhi = {
413
365
  noMatch: 'کوئی نئیں ملیا',
414
366
  alignment: 'سیدھ',
415
367
  linkOptions: 'لنک دے اختیار',
416
- tableOptions: 'ٹیبل دے اختیار',
417
368
  insertLink: 'لنک پاؤ (Ctrl+K)',
418
369
  insertImage: 'تصویر پاؤ',
419
- insertTable: 'ٹیبل پاؤ',
420
370
  insertHorizontalRule: 'لیٹی لکیر پاؤ',
421
371
  poetryBlocks: 'شاعری بلاک',
422
372
  comingSoon: (label) => `${label} (چھیتی آ رہا اے)`,
@@ -480,22 +430,6 @@ const paShahmukhi = {
480
430
  delete: 'مٹاؤ',
481
431
  close: 'بند کرو',
482
432
  },
483
- tableMenu: {
484
- menuLabel: 'ٹیبل',
485
- insertRowBefore: 'پہلاں قطار پاؤ',
486
- insertRowAfter: 'بعد وچ قطار پاؤ',
487
- insertColumnBefore: 'پہلاں کالم پاؤ',
488
- insertColumnAfter: 'بعد وچ کالم پاؤ',
489
- deleteRow: 'قطار مٹاؤ',
490
- deleteColumn: 'کالم مٹاؤ',
491
- deleteTable: 'ٹیبل مٹاؤ',
492
- insertRowsBefore: 'پہلاں قطاراں پاؤ',
493
- insertRowsAfter: 'بعد وچ قطاراں پاؤ',
494
- insertColumnsBefore: 'پہلاں کالماں پاؤ',
495
- insertColumnsAfter: 'بعد وچ کالماں پاؤ',
496
- deleteRows: 'قطاراں مٹاؤ',
497
- deleteColumns: 'کالماں مٹاؤ',
498
- },
499
433
  link: {
500
434
  menuLabel: 'لنک',
501
435
  noUrl: '(کوئی یو آر ایل نئیں)',
@@ -512,12 +446,6 @@ const paShahmukhi = {
512
446
  invalidUrl: 'کِرپا کر کے صحیح http(s)، mailto، tel یا نسبتی یو آر ایل پاؤ',
513
447
  apply: 'لاگو کرو',
514
448
  },
515
- tableDialog: {
516
- title: 'ٹیبل پاؤ',
517
- rows: 'قطاراں',
518
- columns: 'کالم',
519
- headerRow: 'سرکڑی قطار',
520
- },
521
449
  imageDialog: {
522
450
  titleInsert: 'تصویر پاؤ',
523
451
  titleEdit: 'تصویر وچ تبدیلی کرو',
@@ -1 +1 @@
1
- {"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../src/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAQlD;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,WAAW,CAAC,EAW5C,CAAC"}
1
+ {"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../src/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAOlD;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,WAAW,CAAC,EAQ5C,CAAC"}
package/dist/nodes.js CHANGED
@@ -2,7 +2,6 @@ import { HeadingNode, QuoteNode } from '@lexical/rich-text';
2
2
  import { ListItemNode, ListNode } from '@lexical/list';
3
3
  import { LinkNode } from '@lexical/link';
4
4
  import { HorizontalRuleNode } from '@lexical/react/LexicalHorizontalRuleNode';
5
- import { TableCellNode, TableNode, TableRowNode } from '@lexical/table';
6
5
  import { ImageNode } from './image/ImageNode.js';
7
6
  /**
8
7
  * Node types registered on the editor at construction time. Per
@@ -20,8 +19,5 @@ export const EDITOR_NODES = [
20
19
  ListItemNode,
21
20
  LinkNode,
22
21
  HorizontalRuleNode,
23
- TableNode,
24
- TableRowNode,
25
- TableCellNode,
26
22
  ImageNode,
27
23
  ];
@@ -51,12 +51,6 @@
51
51
  pointer-events: none;
52
52
  }
53
53
 
54
- /* pointer-events is inherited, so without this every menu, dropdown and dialog
55
- portaled into the (pointer-transparent) anchor would be unclickable. */
56
- .likhari-portal-target > * {
57
- pointer-events: auto;
58
- }
59
-
60
54
  .likhari-toolbar-group {
61
55
  display: flex;
62
56
  align-items: center;
@@ -259,37 +253,6 @@
259
253
  margin: 1.5em 0;
260
254
  }
261
255
 
262
- /* Tables — cell merge/split is deliberately out of scope for now (a flagged
263
- open risk, lexical-editor-spec.md §12 item 3, needing its own scope
264
- decision); TablePlugin is configured with hasCellMerge={false} to keep
265
- every table a plain grid until that's resolved. */
266
- .likhari-table {
267
- border-collapse: collapse;
268
- margin: 1em 0;
269
- width: 100%;
270
- }
271
-
272
- .likhari-table-row {
273
- border-bottom: 1px solid var(--editor-line);
274
- }
275
-
276
- .likhari-table-cell {
277
- border: 1px solid var(--editor-line);
278
- padding: 6px 10px;
279
- min-width: 72px;
280
- vertical-align: top;
281
- }
282
-
283
- .likhari-table-cell-header {
284
- background: var(--editor-paper-dim);
285
- font-weight: 600;
286
- text-align: start;
287
- }
288
-
289
- .likhari-table-cell-selected {
290
- background: var(--editor-accent-soft);
291
- }
292
-
293
256
  /* Images — block-level figure; the caption is static text (edited in the
294
257
  image's dialog), and a selected image gets a corner resize handle. */
295
258
  .likhari-image-block {
@@ -1 +1 @@
1
- {"version":3,"file":"editorTheme.d.ts","sourceRoot":"","sources":["../../src/theme/editorTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,kBAmCzB,CAAC"}
1
+ {"version":3,"file":"editorTheme.d.ts","sourceRoot":"","sources":["../../src/theme/editorTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,kBA8BzB,CAAC"}
@@ -33,9 +33,4 @@ export const editorTheme = {
33
33
  },
34
34
  hr: 'likhari-hr',
35
35
  image: 'likhari-image-block',
36
- table: 'likhari-table',
37
- tableRow: 'likhari-table-row',
38
- tableCell: 'likhari-table-cell',
39
- tableCellHeader: 'likhari-table-cell-header',
40
- tableCellSelected: 'likhari-table-cell-selected',
41
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inshapardaz/likhari-react",
3
- "version": "0.1.9-dev.96",
3
+ "version": "0.1.9",
4
4
  "description": "React implementation of the Likhari editor, built on @lexical/react.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -38,7 +38,6 @@
38
38
  "@lexical/react": "^0.20.0",
39
39
  "@lexical/rich-text": "^0.20.0",
40
40
  "@lexical/selection": "^0.20.0",
41
- "@lexical/table": "^0.20.0",
42
41
  "@lexical/utils": "^0.20.0",
43
42
  "@inshapardaz/likhari-converters": "^0.1.0",
44
43
  "@inshapardaz/likhari-core": "^0.1.0",
@@ -1,17 +0,0 @@
1
- export interface TableDialogValue {
2
- rows: number;
3
- columns: number;
4
- headerRow: boolean;
5
- }
6
- export interface TableDialogProps {
7
- opened: boolean;
8
- onSubmit: (value: TableDialogValue) => void;
9
- onClose: () => void;
10
- }
11
- /**
12
- * Insert-table dialog: rows x columns and an optional header row. Cell
13
- * merge/split is intentionally not offered anywhere in this dialog or the
14
- * table it creates — see the comment on `TablePlugin` in `EditorRoot.tsx`.
15
- */
16
- export declare function TableDialog({ opened, onSubmit, onClose }: TableDialogProps): import("react").JSX.Element;
17
- //# sourceMappingURL=TableDialog.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TableDialog.d.ts","sourceRoot":"","sources":["../../src/components/TableDialog.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC5C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAOD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,gBAAgB,+BAiD1E"}
@@ -1,33 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useState } from 'react';
3
- import { Button, Checkbox, Group, Modal, NumberInput } from '@mantine/core';
4
- import { useUiStrings } from '../i18n/useStrings.js';
5
- import { usePortalTarget } from '../PortalTargetContext.js';
6
- const MIN_DIMENSION = 1;
7
- const MAX_DIMENSION = 20;
8
- const DEFAULT_ROWS = 3;
9
- const DEFAULT_COLUMNS = 3;
10
- /**
11
- * Insert-table dialog: rows x columns and an optional header row. Cell
12
- * merge/split is intentionally not offered anywhere in this dialog or the
13
- * table it creates — see the comment on `TablePlugin` in `EditorRoot.tsx`.
14
- */
15
- export function TableDialog({ opened, onSubmit, onClose }) {
16
- const strings = useUiStrings();
17
- const portalTarget = usePortalTarget();
18
- const [rows, setRows] = useState(DEFAULT_ROWS);
19
- const [columns, setColumns] = useState(DEFAULT_COLUMNS);
20
- const [headerRow, setHeaderRow] = useState(true);
21
- useEffect(() => {
22
- if (!opened)
23
- return;
24
- setRows(DEFAULT_ROWS);
25
- setColumns(DEFAULT_COLUMNS);
26
- setHeaderRow(true);
27
- }, [opened]);
28
- const handleSubmit = (e) => {
29
- e.preventDefault();
30
- onSubmit({ rows, columns, headerRow });
31
- };
32
- return (_jsx(Modal, { opened: opened, onClose: onClose, title: strings.tableDialog.title, centered: true, size: "sm", portalProps: { target: portalTarget }, children: _jsxs("form", { onSubmit: handleSubmit, children: [_jsxs(Group, { grow: true, align: "flex-end", children: [_jsx(NumberInput, { label: strings.tableDialog.rows, min: MIN_DIMENSION, max: MAX_DIMENSION, value: rows, onChange: (v) => setRows(typeof v === 'number' ? v : DEFAULT_ROWS), "data-autofocus": true }), _jsx(NumberInput, { label: strings.tableDialog.columns, min: MIN_DIMENSION, max: MAX_DIMENSION, value: columns, onChange: (v) => setColumns(typeof v === 'number' ? v : DEFAULT_COLUMNS) })] }), _jsx(Checkbox, { mt: "sm", label: strings.tableDialog.headerRow, checked: headerRow, onChange: (e) => setHeaderRow(e.currentTarget.checked) }), _jsxs(Group, { justify: "flex-end", gap: "xs", mt: "md", children: [_jsx(Button, { variant: "default", onClick: onClose, children: strings.common.cancel }), _jsx(Button, { type: "submit", children: strings.common.insert })] })] }) }));
33
- }
@@ -1,21 +0,0 @@
1
- /** How many rows and columns the selection spans (1 × 1 for a caret in a cell, 0 × 0 outside a table). */
2
- export declare function $getTableSelectionSize(): {
3
- rows: number;
4
- columns: number;
5
- };
6
- /**
7
- * Inserts as many rows as the selection spans, before its first row or after
8
- * its last. Lexical's own insert works from the selection's focus cell and adds
9
- * one row, so with several rows selected it would land mid-selection.
10
- */
11
- export declare function $insertTableRows(insertAfter: boolean): void;
12
- /** Like $insertTableRows, for columns. "Before" is the column index below the
13
- * first selected one (the right-hand side in a right-to-left table). */
14
- export declare function $insertTableColumns(insertAfter: boolean): void;
15
- /** Deletes every row the selection touches (Lexical handles a multi-cell selection). */
16
- export declare function $deleteTableRows(): void;
17
- /** Deletes every column the selection touches. */
18
- export declare function $deleteTableColumns(): void;
19
- /** Removes the whole table the selection is in. */
20
- export declare function $deleteTable(): void;
21
- //# sourceMappingURL=tableActions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tableActions.d.ts","sourceRoot":"","sources":["../../src/table/tableActions.ts"],"names":[],"mappings":"AA2BA,0GAA0G;AAC1G,wBAAgB,sBAAsB,IAAI;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAS1E;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,OAAO,GAAG,IAAI,CAS3D;AAED;wEACwE;AACxE,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,OAAO,GAAG,IAAI,CAQ9D;AAED,wFAAwF;AACxF,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AAED,kDAAkD;AAClD,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAED,mDAAmD;AACnD,wBAAgB,YAAY,IAAI,IAAI,CAInC"}
@@ -1,71 +0,0 @@
1
- import { $deleteTableColumn__EXPERIMENTAL, $deleteTableRow__EXPERIMENTAL, $getTableCellNodeFromLexicalNode, $getTableColumnIndexFromTableCellNode, $getTableNodeFromLexicalNodeOrThrow, $getTableRowIndexFromTableCellNode, $insertTableColumn__EXPERIMENTAL, $insertTableRow__EXPERIMENTAL, $isTableCellNode, $isTableSelection, } from '@lexical/table';
2
- import { $getSelection, $isRangeSelection } from 'lexical';
3
- /** Table cells the selection covers: the caret's own cell, or every cell of a
4
- * multi-cell selection. Empty when the selection isn't in a table. */
5
- function $selectedCells() {
6
- const selection = $getSelection();
7
- if ($isTableSelection(selection))
8
- return selection.getNodes().filter($isTableCellNode);
9
- if ($isRangeSelection(selection)) {
10
- const cell = $getTableCellNodeFromLexicalNode(selection.anchor.getNode());
11
- return cell ? [cell] : [];
12
- }
13
- return [];
14
- }
15
- /** How many rows and columns the selection spans (1 × 1 for a caret in a cell, 0 × 0 outside a table). */
16
- export function $getTableSelectionSize() {
17
- const cells = $selectedCells();
18
- if (cells.length === 0)
19
- return { rows: 0, columns: 0 };
20
- const rows = cells.map($getTableRowIndexFromTableCellNode);
21
- const columns = cells.map($getTableColumnIndexFromTableCellNode);
22
- return {
23
- rows: Math.max(...rows) - Math.min(...rows) + 1,
24
- columns: Math.max(...columns) - Math.min(...columns) + 1,
25
- };
26
- }
27
- /**
28
- * Inserts as many rows as the selection spans, before its first row or after
29
- * its last. Lexical's own insert works from the selection's focus cell and adds
30
- * one row, so with several rows selected it would land mid-selection.
31
- */
32
- export function $insertTableRows(insertAfter) {
33
- const cells = $selectedCells();
34
- if (cells.length === 0)
35
- return;
36
- const rows = cells.map($getTableRowIndexFromTableCellNode);
37
- const first = Math.min(...rows);
38
- const last = Math.max(...rows);
39
- // Park the caret in a cell on the edge row; every insert then lands right next to it.
40
- cells[rows.indexOf(insertAfter ? last : first)].selectEnd();
41
- for (let i = 0; i <= last - first; i++)
42
- $insertTableRow__EXPERIMENTAL(insertAfter);
43
- }
44
- /** Like $insertTableRows, for columns. "Before" is the column index below the
45
- * first selected one (the right-hand side in a right-to-left table). */
46
- export function $insertTableColumns(insertAfter) {
47
- const cells = $selectedCells();
48
- if (cells.length === 0)
49
- return;
50
- const columns = cells.map($getTableColumnIndexFromTableCellNode);
51
- const first = Math.min(...columns);
52
- const last = Math.max(...columns);
53
- cells[columns.indexOf(insertAfter ? last : first)].selectEnd();
54
- for (let i = 0; i <= last - first; i++)
55
- $insertTableColumn__EXPERIMENTAL(insertAfter);
56
- }
57
- /** Deletes every row the selection touches (Lexical handles a multi-cell selection). */
58
- export function $deleteTableRows() {
59
- $deleteTableRow__EXPERIMENTAL();
60
- }
61
- /** Deletes every column the selection touches. */
62
- export function $deleteTableColumns() {
63
- $deleteTableColumn__EXPERIMENTAL();
64
- }
65
- /** Removes the whole table the selection is in. */
66
- export function $deleteTable() {
67
- const selection = $getSelection();
68
- const anchor = $isRangeSelection(selection) || $isTableSelection(selection) ? selection.anchor.getNode() : null;
69
- if (anchor)
70
- $getTableNodeFromLexicalNodeOrThrow(anchor).remove();
71
- }