@inshapardaz/likhari-react 0.1.15-dev.118 → 0.1.15

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.
Files changed (37) hide show
  1. package/dist/EditorRoot.d.ts.map +1 -1
  2. package/dist/EditorRoot.js +1 -3
  3. package/dist/components/Toolbar.d.ts.map +1 -1
  4. package/dist/components/Toolbar.js +3 -24
  5. package/dist/i18n/strings.d.ts +0 -6
  6. package/dist/i18n/strings.d.ts.map +1 -1
  7. package/dist/i18n/strings.js +0 -18
  8. package/dist/nodes.d.ts.map +1 -1
  9. package/dist/nodes.js +0 -8
  10. package/dist/theme/editor.css +0 -57
  11. package/dist/theme/editorTheme.d.ts.map +1 -1
  12. package/dist/theme/editorTheme.js +0 -5
  13. package/package.json +1 -1
  14. package/dist/blocks/FootnoteListNode.d.ts +0 -46
  15. package/dist/blocks/FootnoteListNode.d.ts.map +0 -1
  16. package/dist/blocks/FootnoteListNode.js +0 -117
  17. package/dist/blocks/FootnoteNode.d.ts +0 -38
  18. package/dist/blocks/FootnoteNode.d.ts.map +0 -1
  19. package/dist/blocks/FootnoteNode.js +0 -90
  20. package/dist/blocks/LayoutNode.d.ts +0 -54
  21. package/dist/blocks/LayoutNode.d.ts.map +0 -1
  22. package/dist/blocks/LayoutNode.js +0 -138
  23. package/dist/blocks/footnoteActions.d.ts +0 -9
  24. package/dist/blocks/footnoteActions.d.ts.map +0 -1
  25. package/dist/blocks/footnoteActions.js +0 -42
  26. package/dist/blocks/layoutActions.d.ts +0 -12
  27. package/dist/blocks/layoutActions.d.ts.map +0 -1
  28. package/dist/blocks/layoutActions.js +0 -39
  29. package/dist/components/LayoutDialog.d.ts +0 -11
  30. package/dist/components/LayoutDialog.d.ts.map +0 -1
  31. package/dist/components/LayoutDialog.js +0 -24
  32. package/dist/plugins/FootnotePlugin.d.ts +0 -9
  33. package/dist/plugins/FootnotePlugin.d.ts.map +0 -1
  34. package/dist/plugins/FootnotePlugin.js +0 -51
  35. package/dist/plugins/LayoutPlugin.d.ts +0 -9
  36. package/dist/plugins/LayoutPlugin.d.ts.map +0 -1
  37. package/dist/plugins/LayoutPlugin.js +0 -23
@@ -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,EAA8B,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEjF,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;AAKjE,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,QAAQ,CAAC;IACjB,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,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;OAOG;IACH,M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IACnC,KAAK,IAAI,IAAI,CAAC;CACf;AAQD,eAAO,MAAM,UAAU,uGAiXrB,CAAC"}
@@ -21,8 +21,6 @@ import { Toolbar } from './components/Toolbar.js';
21
21
  import { injectUrduWebFontsCss } from './fonts/index.js';
22
22
  import { LinkPastePlugin } from './plugins/LinkPastePlugin.js';
23
23
  import { PageBreakPlugin } from './plugins/PageBreakPlugin.js';
24
- import { LayoutPlugin } from './plugins/LayoutPlugin.js';
25
- import { FootnotePlugin } from './plugins/FootnotePlugin.js';
26
24
  import { DraftRestore } from './components/DraftRestore.js';
27
25
  import { LeaveDialog } from './components/LeaveDialog.js';
28
26
  import { clearDraft, createDraftId, hasDraftContent, pruneDrafts, writeDraft, } from './persistence/draftStorage.js';
@@ -279,7 +277,7 @@ export const EditorRoot = forwardRef(function EditorRoot({ documentId, initialCo
279
277
  const portalTargetSelector = `#${CSS.escape(portalTargetId)}`;
280
278
  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
281
279
  ? { currentId: draftId, maxBytes: autosaveMaxBytes, adoptOnRestore: !documentId, onRestored: handleDraftRestored }
282
- : 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.pageBreak && _jsx(PageBreakPlugin, {}), config.columns && _jsx(LayoutPlugin, {}), config.footnotes && _jsx(FootnotePlugin, {}), config.tables && _jsx(TablePlugin, { hasCellMerge: true, hasTabHandler: true }), config.blocks.horizontalRule && _jsx(HorizontalRulePlugin, {}), _jsx(EditorInstancePlugin, { instanceRef: editorInstanceRef }), _jsx(OnChangePlugin, { onChange: handleChange })] }) }), _jsx(LeaveDialog, { opened: leavePrompt !== null, canSave: Boolean(onSave), canSaveDraft: autosave || navigationGuard === 'save-draft', draftFailed: leavePrompt?.draftFailed ?? false, onSave: () => {
280
+ : 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.pageBreak && _jsx(PageBreakPlugin, {}), config.tables && _jsx(TablePlugin, { hasCellMerge: true, hasTabHandler: true }), config.blocks.horizontalRule && _jsx(HorizontalRulePlugin, {}), _jsx(EditorInstancePlugin, { instanceRef: editorInstanceRef }), _jsx(OnChangePlugin, { onChange: handleChange })] }) }), _jsx(LeaveDialog, { opened: leavePrompt !== null, canSave: Boolean(onSave), canSaveDraft: autosave || navigationGuard === 'save-draft', draftFailed: leavePrompt?.draftFailed ?? false, onSave: () => {
283
281
  handleSave();
284
282
  settleLeave(true);
285
283
  }, onSaveDraft: () => {
@@ -1 +1 @@
1
- {"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/components/Toolbar.tsx"],"names":[],"mappings":"AA8DA,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;AA2avD,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,+BAg+BxJ"}
1
+ {"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/components/Toolbar.tsx"],"names":[],"mappings":"AA2DA,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;AAyavD,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,+BAk8BxJ"}
@@ -12,10 +12,7 @@ import { INSERT_HORIZONTAL_RULE_COMMAND } from '@lexical/react/LexicalHorizontal
12
12
  import { ImageDialog } from '../image/ImageDialog.js';
13
13
  import { $createImageNode } from '../image/ImageNode.js';
14
14
  import { INSERT_PAGE_BREAK_COMMAND } from '../blocks/PageBreakNode.js';
15
- import { INSERT_LAYOUT_COMMAND } from '../blocks/LayoutNode.js';
16
- import { INSERT_FOOTNOTE_COMMAND } from '../blocks/FootnoteNode.js';
17
15
  import { TableDialog } from './TableDialog.js';
18
- import { LayoutDialog } from './LayoutDialog.js';
19
16
  import { $getTableCellNodeFromLexicalNode, $isTableSelection, INSERT_TABLE_COMMAND } from '@lexical/table';
20
17
  import { $canMergeSelectedCells, $canUnmergeSelectedCell, $deleteTable, $deleteTableColumns, $deleteTableRows, $getTableSelectionSize, $insertTableColumns, $insertTableRows, $mergeTableCells, $unmergeTableCell, } from '../table/tableActions.js';
21
18
  import { $createLinkNode, $isLinkNode, TOGGLE_LINK_COMMAND } from '@lexical/link';
@@ -26,7 +23,7 @@ import { CANVAS_FONT_DEFAULTS, DEFAULT_FONT_OPTIONS, FONT_SIZES_PX } from '../fo
26
23
  import { setStyleProperty } from '../utils/style.js';
27
24
  import { useStrings } from '../i18n/useStrings.js';
28
25
  import { usePortalTarget } from '../PortalTargetContext.js';
29
- 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, IconPageBreak, IconPencil, IconPhoto, IconPilcrow, IconQuote, IconSeparatorHorizontal, IconSparkles, IconStrikethrough, IconSubscript, IconSuperscript, IconArrowMergeBoth, IconArrowsSplit2, IconColumnInsertLeft, IconColumnInsertRight, IconColumnRemove, IconColumns, IconNumber1Small, IconRowInsertBottom, IconRowInsertTop, IconRowRemove, IconTable, IconTableMinus, IconTableOptions, IconTextSize, IconTypography, IconUnderline, IconWand, } from '@tabler/icons-react';
26
+ 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, IconPageBreak, IconPencil, IconPhoto, IconPilcrow, IconQuote, IconSeparatorHorizontal, IconSparkles, IconStrikethrough, IconSubscript, IconSuperscript, IconArrowMergeBoth, IconArrowsSplit2, IconColumnInsertLeft, IconColumnInsertRight, IconColumnRemove, IconRowInsertBottom, IconRowInsertTop, IconRowRemove, IconTable, IconTableMinus, IconTableOptions, IconTextSize, IconTypography, IconUnderline, IconWand, } from '@tabler/icons-react';
30
27
  /** Sentinel for "no inline style": Lexical returns the default it is given when
31
28
  * the selection has none, so this tells "unstyled" (show the canvas default)
32
29
  * apart from "styled with a value the dropdown doesn't list" (show nothing). */
@@ -348,22 +345,6 @@ export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAU
348
345
  });
349
346
  closeTableDialog();
350
347
  };
351
- const [layoutDialogOpen, setLayoutDialogOpen] = useState(false);
352
- const openLayoutDialog = () => {
353
- snapshotSelection();
354
- setLayoutDialogOpen(true);
355
- };
356
- const closeLayoutDialog = () => {
357
- setLayoutDialogOpen(false);
358
- editor.focus();
359
- };
360
- const insertLayout = ({ columnCount }) => {
361
- const saved = menuSelectionRef.current;
362
- if (saved)
363
- editor.update(() => $setSelection(saved.clone()), { discrete: true });
364
- editor.dispatchCommand(INSERT_LAYOUT_COMMAND, { columnCount });
365
- closeLayoutDialog();
366
- };
367
348
  /** Applies a font property per `config.font.scope`: to the selection, to
368
349
  * every text node in the document, or (for 'both') to the selection when
369
350
  * there is a range and to the whole document when there isn't. */
@@ -566,8 +547,6 @@ export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAU
566
547
  config.tables ||
567
548
  config.blocks.horizontalRule ||
568
549
  config.blocks.pageBreak ||
569
- config.columns ||
570
- config.footnotes ||
571
550
  config.poetry.enabled;
572
551
  const showLanguageGroup = config.language.autocorrect || config.language.textCleanup || config.language.spellCheck;
573
552
  // The "script & cleanup" and "indent/outdent" groups (UI spec §3.3) render
@@ -740,7 +719,7 @@ export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAU
740
719
  restoreSelection();
741
720
  openLinkDialog();
742
721
  }, onRemove: removeLink, strings: strings }) })] })) : (_jsx(ToolbarButton, { icon: IconLink, title: strings.toolbar.insertLink, onClick: openLinkDialog })) }, "link")),
743
- 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.pageBreak && (_jsx(ToolbarButton, { icon: IconPageBreak, title: strings.toolbar.insertPageBreak, onClick: () => editor.dispatchCommand(INSERT_PAGE_BREAK_COMMAND, undefined) })), config.tables && _jsx(ToolbarButton, { icon: IconTable, title: strings.toolbar.insertTable, onClick: openTableDialog }), config.columns && _jsx(ToolbarButton, { icon: IconColumns, title: strings.toolbar.insertColumns, onClick: openLayoutDialog }), config.footnotes && (_jsx(ToolbarButton, { icon: IconNumber1Small, title: strings.toolbar.insertFootnote, onClick: () => editor.dispatchCommand(INSERT_FOOTNOTE_COMMAND, undefined) })), 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")),
722
+ 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.pageBreak && (_jsx(ToolbarButton, { icon: IconPageBreak, title: strings.toolbar.insertPageBreak, onClick: () => editor.dispatchCommand(INSERT_PAGE_BREAK_COMMAND, undefined) })), 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")),
744
723
  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, canMergeCells: state.canMergeCells, canUnmergeCell: state.canUnmergeCell, onAction: runTableAction }) })] }) }, "tableActions")),
745
724
  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")),
746
725
  ];
@@ -766,5 +745,5 @@ export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAU
766
745
  display: 'flex',
767
746
  flexWrap: 'nowrap',
768
747
  gap: 8,
769
- }, 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.columns && _jsx(LayoutDialog, { opened: layoutDialogOpen, onSubmit: insertLayout, onClose: closeLayoutDialog }), 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 })] }));
748
+ }, 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 })] }));
770
749
  }
@@ -46,8 +46,6 @@ export interface Strings {
46
46
  insertImage: string;
47
47
  insertPageBreak: string;
48
48
  insertTable: string;
49
- insertColumns: string;
50
- insertFootnote: string;
51
49
  insertHorizontalRule: string;
52
50
  poetryBlocks: string;
53
51
  comingSoon: (label: string) => string;
@@ -158,10 +156,6 @@ export interface Strings {
158
156
  columns: string;
159
157
  headerRow: string;
160
158
  };
161
- layoutDialog: {
162
- title: string;
163
- columnCount: string;
164
- };
165
159
  imageDialog: {
166
160
  titleInsert: string;
167
161
  titleEdit: string;
@@ -1 +1 @@
1
- {"version":3,"file":"strings.d.ts","sourceRoot":"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,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;AAilBD,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAI3C,CAAC;AAEF;;sDAEsD;AACtD,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAElD"}
@@ -37,8 +37,6 @@ const en = {
37
37
  insertImage: 'Insert image',
38
38
  insertPageBreak: 'Insert page break',
39
39
  insertTable: 'Insert table',
40
- insertColumns: 'Insert columns',
41
- insertFootnote: 'Insert footnote',
42
40
  insertHorizontalRule: 'Insert horizontal rule',
43
41
  poetryBlocks: 'Poetry blocks',
44
42
  comingSoon: (label) => `${label} (coming soon)`,
@@ -142,10 +140,6 @@ const en = {
142
140
  columns: 'Columns',
143
141
  headerRow: 'Header row',
144
142
  },
145
- layoutDialog: {
146
- title: 'Insert columns',
147
- columnCount: 'Number of columns',
148
- },
149
143
  imageDialog: {
150
144
  titleInsert: 'Insert image',
151
145
  titleEdit: 'Edit image',
@@ -238,8 +232,6 @@ const ur = {
238
232
  insertImage: 'تصویر شامل کریں',
239
233
  insertPageBreak: 'صفحے کی تقسیم شامل کریں',
240
234
  insertTable: 'جدول شامل کریں',
241
- insertColumns: 'کالم شامل کریں',
242
- insertFootnote: 'فٹ نوٹ شامل کریں',
243
235
  insertHorizontalRule: 'افقی لکیر شامل کریں',
244
236
  poetryBlocks: 'شاعری کے بلاکس',
245
237
  comingSoon: (label) => `${label} (جلد آ رہا ہے)`,
@@ -343,10 +335,6 @@ const ur = {
343
335
  columns: 'کالم',
344
336
  headerRow: 'سرِ فہرست قطار',
345
337
  },
346
- layoutDialog: {
347
- title: 'کالم شامل کریں',
348
- columnCount: 'کالموں کی تعداد',
349
- },
350
338
  imageDialog: {
351
339
  titleInsert: 'تصویر شامل کریں',
352
340
  titleEdit: 'تصویر میں ترمیم کریں',
@@ -439,8 +427,6 @@ const paShahmukhi = {
439
427
  insertImage: 'تصویر پاؤ',
440
428
  insertPageBreak: 'صفحے دی ونڈ پاؤ',
441
429
  insertTable: 'ٹیبل پاؤ',
442
- insertColumns: 'کالم پاؤ',
443
- insertFootnote: 'فٹ نوٹ پاؤ',
444
430
  insertHorizontalRule: 'لیٹی لکیر پاؤ',
445
431
  poetryBlocks: 'شاعری بلاک',
446
432
  comingSoon: (label) => `${label} (چھیتی آ رہا اے)`,
@@ -544,10 +530,6 @@ const paShahmukhi = {
544
530
  columns: 'کالم',
545
531
  headerRow: 'سرکڑی قطار',
546
532
  },
547
- layoutDialog: {
548
- title: 'کالم پاؤ',
549
- columnCount: 'کالماں دی گنتی',
550
- },
551
533
  imageDialog: {
552
534
  titleInsert: 'تصویر پاؤ',
553
535
  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;AAYlD;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,WAAW,CAAC,EAiB5C,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;AASlD;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,WAAW,CAAC,EAY5C,CAAC"}
package/dist/nodes.js CHANGED
@@ -5,9 +5,6 @@ import { HorizontalRuleNode } from '@lexical/react/LexicalHorizontalRuleNode';
5
5
  import { TableCellNode, TableNode, TableRowNode } from '@lexical/table';
6
6
  import { ImageNode } from './image/ImageNode.js';
7
7
  import { PageBreakNode } from './blocks/PageBreakNode.js';
8
- import { LayoutContainerNode, LayoutItemNode } from './blocks/LayoutNode.js';
9
- import { FootnoteReferenceNode } from './blocks/FootnoteNode.js';
10
- import { FootnoteItemNode, FootnoteListNode } from './blocks/FootnoteListNode.js';
11
8
  /**
12
9
  * Node types registered on the editor at construction time. Per
13
10
  * editor-architecture-design.md §2, node registration cannot be conditional
@@ -29,9 +26,4 @@ export const EDITOR_NODES = [
29
26
  TableCellNode,
30
27
  ImageNode,
31
28
  PageBreakNode,
32
- LayoutContainerNode,
33
- LayoutItemNode,
34
- FootnoteReferenceNode,
35
- FootnoteListNode,
36
- FootnoteItemNode,
37
29
  ];
@@ -178,10 +178,6 @@
178
178
  font-family: 'IBM Plex Serif', Georgia, serif;
179
179
  font-size: 15px;
180
180
  line-height: 1.75;
181
- /* Scopes the footnote-reference counter to the whole document (editor.css
182
- footnote rules below), so numbering is consistent regardless of which
183
- blocks the references happen to sit in. */
184
- counter-reset: likhari-footnote-ref;
185
181
  }
186
182
 
187
183
  .likhari-content-editable[dir='rtl'] {
@@ -321,59 +317,6 @@
321
317
  }
322
318
  }
323
319
 
324
- /* Columns layout (lexical-editor-spec.md §4.9) — a CSS grid row whose
325
- column count/widths come from the node's own inline style, not this
326
- stylesheet, so each container can differ. */
327
- .likhari-layout-container {
328
- display: grid;
329
- gap: 24px;
330
- margin: 0 0 1em 0;
331
- }
332
-
333
- .likhari-layout-item {
334
- min-width: 0;
335
- overflow-wrap: break-word;
336
- }
337
-
338
- .likhari-layout-item > :last-child {
339
- margin-bottom: 0;
340
- }
341
-
342
- /* Footnotes (lexical-editor-spec.md §4.10). The bracketed number on both
343
- the inline reference and its list entry is a CSS counter, not stored
344
- state — Lexical insert/delete/reorder of the underlying nodes renumbers
345
- both sequences automatically as long as list items stay in the same
346
- order their references were inserted (FootnotePlugin's insert command
347
- always appends in that order). */
348
- .likhari-footnote-ref {
349
- counter-increment: likhari-footnote-ref;
350
- cursor: default;
351
- }
352
-
353
- .likhari-footnote-ref::after {
354
- content: '[' counter(likhari-footnote-ref) ']';
355
- }
356
-
357
- .likhari-footnote-list {
358
- counter-reset: likhari-footnote-item;
359
- list-style: none;
360
- margin: 2em 0 0 0;
361
- padding-inline-start: 1.5em;
362
- border-top: 1px solid var(--editor-line);
363
- padding-top: 0.75em;
364
- font-size: 0.9em;
365
- color: var(--editor-ink-soft);
366
- }
367
-
368
- .likhari-footnote-item {
369
- counter-increment: likhari-footnote-item;
370
- margin: 0.3em 0;
371
- }
372
-
373
- .likhari-footnote-item::marker {
374
- content: '[' counter(likhari-footnote-item) '] ';
375
- }
376
-
377
320
  .likhari-table {
378
321
  border-collapse: collapse;
379
322
  margin: 1em 0;
@@ -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,kBA+CzB,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,kBA0CzB,CAAC"}
@@ -40,11 +40,6 @@ export const editorTheme = {
40
40
  hr: 'likhari-hr',
41
41
  image: 'likhari-image-block',
42
42
  pageBreak: 'likhari-page-break',
43
- layoutContainer: 'likhari-layout-container',
44
- layoutItem: 'likhari-layout-item',
45
- footnoteReference: 'likhari-footnote-ref',
46
- footnoteList: 'likhari-footnote-list',
47
- footnoteItem: 'likhari-footnote-item',
48
43
  table: 'likhari-table',
49
44
  tableRow: 'likhari-table-row',
50
45
  tableCell: 'likhari-table-cell',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inshapardaz/likhari-react",
3
- "version": "0.1.15-dev.118",
3
+ "version": "0.1.15",
4
4
  "description": "React implementation of the Likhari editor, built on @lexical/react.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,46 +0,0 @@
1
- import { type DOMConversionMap, type DOMExportOutput, type EditorConfig, type LexicalNode, type NodeKey, type SerializedElementNode, type Spread, ElementNode } from 'lexical';
2
- export type SerializedFootnoteListNode = SerializedElementNode;
3
- export type SerializedFootnoteItemNode = Spread<{
4
- footnoteId: string;
5
- }, SerializedElementNode>;
6
- /** The document's single footnote list, rendered at the end (requirements
7
- * doc §4.10). An ordered-list-like container of FootnoteItemNode; its items'
8
- * displayed numbers are a CSS counter (editor.css), same mechanism as
9
- * FootnoteReferenceNode, so both sequences stay in sync as long as items
10
- * are appended in the same order their references were inserted — which
11
- * FootnotePlugin's insert command always does. */
12
- export declare class FootnoteListNode extends ElementNode {
13
- static getType(): string;
14
- static clone(node: FootnoteListNode): FootnoteListNode;
15
- static importJSON(): FootnoteListNode;
16
- exportJSON(): SerializedFootnoteListNode;
17
- static importDOM(): DOMConversionMap | null;
18
- exportDOM(): DOMExportOutput;
19
- createDOM(config: EditorConfig): HTMLElement;
20
- updateDOM(): boolean;
21
- isShadowRoot(): boolean;
22
- insertNewAfter(): null;
23
- }
24
- export declare function $createFootnoteListNode(): FootnoteListNode;
25
- export declare function $isFootnoteListNode(node: LexicalNode | null | undefined): node is FootnoteListNode;
26
- /** One entry in the FootnoteListNode — the editable note text for a given
27
- * footnoteId. Always keeps at least an empty paragraph (mirrors
28
- * TableCellNode/LayoutItemNode). */
29
- export declare class FootnoteItemNode extends ElementNode {
30
- __footnoteId: string;
31
- constructor(footnoteId: string, key?: NodeKey);
32
- static getType(): string;
33
- static clone(node: FootnoteItemNode): FootnoteItemNode;
34
- getFootnoteId(): string;
35
- static importJSON(serializedNode: SerializedFootnoteItemNode): FootnoteItemNode;
36
- exportJSON(): SerializedFootnoteItemNode;
37
- static importDOM(): DOMConversionMap | null;
38
- exportDOM(): DOMExportOutput;
39
- createDOM(config: EditorConfig): HTMLElement;
40
- updateDOM(): boolean;
41
- canBeEmpty(): false;
42
- canIndent(): false;
43
- }
44
- export declare function $createFootnoteItemNode(footnoteId: string): FootnoteItemNode;
45
- export declare function $isFootnoteItemNode(node: LexicalNode | null | undefined): node is FootnoteItemNode;
46
- //# sourceMappingURL=FootnoteListNode.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FootnoteListNode.d.ts","sourceRoot":"","sources":["../../src/blocks/FootnoteListNode.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,qBAAqB,EAC1B,KAAK,MAAM,EACX,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,0BAA0B,GAAG,qBAAqB,CAAC;AAC/D,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,EAAE,qBAAqB,CAAC,CAAC;AAE/F;;;;;kDAKkD;AAClD,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C,MAAM,CAAC,OAAO,IAAI,MAAM;IAIxB,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB;IAItD,MAAM,CAAC,UAAU,IAAI,gBAAgB;IAIrC,UAAU,IAAI,0BAA0B;IAIxC,MAAM,CAAC,SAAS,IAAI,gBAAgB,GAAG,IAAI;IAS3C,SAAS,IAAI,eAAe;IAM5B,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW;IAM5C,SAAS,IAAI,OAAO;IAIpB,YAAY,IAAI,OAAO;IAIvB,cAAc,IAAI,IAAI;CAGvB;AAED,wBAAgB,uBAAuB,IAAI,gBAAgB,CAE1D;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,gBAAgB,CAElG;AAED;;oCAEoC;AACpC,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C,YAAY,EAAE,MAAM,CAAC;gBAET,UAAU,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO;IAK7C,MAAM,CAAC,OAAO,IAAI,MAAM;IAIxB,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB;IAItD,aAAa,IAAI,MAAM;IAIvB,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,0BAA0B,GAAG,gBAAgB;IAI/E,UAAU,IAAI,0BAA0B;IAIxC,MAAM,CAAC,SAAS,IAAI,gBAAgB,GAAG,IAAI;IAU3C,SAAS,IAAI,eAAe;IAO5B,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW;IAO5C,SAAS,IAAI,OAAO;IAIpB,UAAU,IAAI,KAAK;IAInB,SAAS,IAAI,KAAK;CAGnB;AAED,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,CAE5E;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,gBAAgB,CAElG"}
@@ -1,117 +0,0 @@
1
- import { addClassNamesToElement } from '@lexical/utils';
2
- import { $applyNodeReplacement, ElementNode, } from 'lexical';
3
- /** The document's single footnote list, rendered at the end (requirements
4
- * doc §4.10). An ordered-list-like container of FootnoteItemNode; its items'
5
- * displayed numbers are a CSS counter (editor.css), same mechanism as
6
- * FootnoteReferenceNode, so both sequences stay in sync as long as items
7
- * are appended in the same order their references were inserted — which
8
- * FootnotePlugin's insert command always does. */
9
- export class FootnoteListNode extends ElementNode {
10
- static getType() {
11
- return 'footnote-list';
12
- }
13
- static clone(node) {
14
- return new FootnoteListNode(node.__key);
15
- }
16
- static importJSON() {
17
- return $createFootnoteListNode();
18
- }
19
- exportJSON() {
20
- return { ...super.exportJSON(), type: 'footnote-list', version: 1 };
21
- }
22
- static importDOM() {
23
- return {
24
- ol: (domNode) => {
25
- if (!domNode.hasAttribute('data-likhari-footnote-list'))
26
- return null;
27
- return { conversion: () => ({ node: $createFootnoteListNode() }), priority: 2 };
28
- },
29
- };
30
- }
31
- exportDOM() {
32
- const element = document.createElement('ol');
33
- element.setAttribute('data-likhari-footnote-list', '');
34
- return { element };
35
- }
36
- createDOM(config) {
37
- const element = document.createElement('ol');
38
- addClassNamesToElement(element, config.theme.footnoteList ?? 'likhari-footnote-list');
39
- return element;
40
- }
41
- updateDOM() {
42
- return false;
43
- }
44
- isShadowRoot() {
45
- return true;
46
- }
47
- insertNewAfter() {
48
- return null;
49
- }
50
- }
51
- export function $createFootnoteListNode() {
52
- return $applyNodeReplacement(new FootnoteListNode());
53
- }
54
- export function $isFootnoteListNode(node) {
55
- return node instanceof FootnoteListNode;
56
- }
57
- /** One entry in the FootnoteListNode — the editable note text for a given
58
- * footnoteId. Always keeps at least an empty paragraph (mirrors
59
- * TableCellNode/LayoutItemNode). */
60
- export class FootnoteItemNode extends ElementNode {
61
- constructor(footnoteId, key) {
62
- super(key);
63
- this.__footnoteId = footnoteId;
64
- }
65
- static getType() {
66
- return 'footnote-item';
67
- }
68
- static clone(node) {
69
- return new FootnoteItemNode(node.__footnoteId, node.__key);
70
- }
71
- getFootnoteId() {
72
- return this.getLatest().__footnoteId;
73
- }
74
- static importJSON(serializedNode) {
75
- return $createFootnoteItemNode(serializedNode.footnoteId);
76
- }
77
- exportJSON() {
78
- return { ...super.exportJSON(), type: 'footnote-item', version: 1, footnoteId: this.getFootnoteId() };
79
- }
80
- static importDOM() {
81
- return {
82
- li: (domNode) => {
83
- const id = domNode.getAttribute('data-likhari-footnote-item');
84
- if (!id)
85
- return null;
86
- return { conversion: () => ({ node: $createFootnoteItemNode(id) }), priority: 2 };
87
- },
88
- };
89
- }
90
- exportDOM() {
91
- const element = document.createElement('li');
92
- element.setAttribute('id', `fn-${this.getFootnoteId()}`);
93
- element.setAttribute('data-likhari-footnote-item', this.getFootnoteId());
94
- return { element };
95
- }
96
- createDOM(config) {
97
- const element = document.createElement('li');
98
- addClassNamesToElement(element, config.theme.footnoteItem ?? 'likhari-footnote-item');
99
- element.id = `fn-${this.getFootnoteId()}`;
100
- return element;
101
- }
102
- updateDOM() {
103
- return false;
104
- }
105
- canBeEmpty() {
106
- return false;
107
- }
108
- canIndent() {
109
- return false;
110
- }
111
- }
112
- export function $createFootnoteItemNode(footnoteId) {
113
- return $applyNodeReplacement(new FootnoteItemNode(footnoteId));
114
- }
115
- export function $isFootnoteItemNode(node) {
116
- return node instanceof FootnoteItemNode;
117
- }
@@ -1,38 +0,0 @@
1
- import type { ReactElement } from 'react';
2
- import { DecoratorNode, type DOMConversionMap, type DOMExportOutput, type EditorConfig, type EditorState, type LexicalCommand, type LexicalNode, type NodeKey, type SerializedLexicalNode, type Spread } from 'lexical';
3
- export declare const INSERT_FOOTNOTE_COMMAND: LexicalCommand<void>;
4
- export type SerializedFootnoteReferenceNode = Spread<{
5
- footnoteId: string;
6
- }, SerializedLexicalNode>;
7
- /** Inline marker in the text flow (requirements doc §4.10, architecture doc
8
- * §3.3). Holds only an id — its displayed number is never stored, it's
9
- * rendered by a CSS counter (editor.css) that counts these markers in DOM
10
- * order, so insert/delete/reorder auto-renumbers with no JS bookkeeping.
11
- * The note's actual content lives in a matching FootnoteItemNode inside the
12
- * document's single FootnoteListNode, not here (same split as Lexical's own
13
- * comments/annotations pattern: reference in the flow, content out-of-band). */
14
- export declare class FootnoteReferenceNode extends DecoratorNode<ReactElement> {
15
- __footnoteId: string;
16
- constructor(footnoteId: string, key?: NodeKey);
17
- static getType(): string;
18
- static clone(node: FootnoteReferenceNode): FootnoteReferenceNode;
19
- getFootnoteId(): string;
20
- static importJSON(serializedNode: SerializedFootnoteReferenceNode): FootnoteReferenceNode;
21
- exportJSON(): SerializedFootnoteReferenceNode;
22
- static importDOM(): DOMConversionMap | null;
23
- exportDOM(): DOMExportOutput;
24
- createDOM(config: EditorConfig): HTMLElement;
25
- updateDOM(): boolean;
26
- getTextContent(): string;
27
- isInline(): true;
28
- decorate(): ReactElement;
29
- }
30
- export declare function $createFootnoteReferenceNode(footnoteId: string): FootnoteReferenceNode;
31
- export declare function $isFootnoteReferenceNode(node: LexicalNode | null | undefined): node is FootnoteReferenceNode;
32
- /** Resolves a reference's footnoteId from the editor state just before its
33
- * deletion committed — a mutation listener's 'destroyed' entries only carry
34
- * the NodeKey, and by the time the listener fires the *current* state no
35
- * longer has the node, so the caller must pass the listener's own
36
- * `prevEditorState` here to know which FootnoteItemNode to clean up. */
37
- export declare function $getFootnoteIdByKey(prevEditorState: EditorState, key: NodeKey): string | null;
38
- //# sourceMappingURL=FootnoteNode.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FootnoteNode.d.ts","sourceRoot":"","sources":["../../src/blocks/FootnoteNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAIL,aAAa,EAEb,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,qBAAqB,EAC1B,KAAK,MAAM,EACZ,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,uBAAuB,EAAE,cAAc,CAAC,IAAI,CAA4C,CAAC;AAEtG,MAAM,MAAM,+BAA+B,GAAG,MAAM,CAAC;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,EAAE,qBAAqB,CAAC,CAAC;AAEpG;;;;;;gFAMgF;AAChF,qBAAa,qBAAsB,SAAQ,aAAa,CAAC,YAAY,CAAC;IACpE,YAAY,EAAE,MAAM,CAAC;gBAET,UAAU,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO;IAK7C,MAAM,CAAC,OAAO,IAAI,MAAM;IAIxB,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,qBAAqB,GAAG,qBAAqB;IAIhE,aAAa,IAAI,MAAM;IAIvB,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,+BAA+B,GAAG,qBAAqB;IAIzF,UAAU,IAAI,+BAA+B;IAI7C,MAAM,CAAC,SAAS,IAAI,gBAAgB,GAAG,IAAI;IAU3C,SAAS,IAAI,eAAe;IAU5B,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW;IAM5C,SAAS,IAAI,OAAO;IAIpB,cAAc,IAAI,MAAM;IAIxB,QAAQ,IAAI,IAAI;IAIhB,QAAQ,IAAI,YAAY;CAKzB;AAED,wBAAgB,4BAA4B,CAAC,UAAU,EAAE,MAAM,GAAG,qBAAqB,CAEtF;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,qBAAqB,CAE5G;AAED;;;;wEAIwE;AACxE,wBAAgB,mBAAmB,CAAC,eAAe,EAAE,WAAW,EAAE,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAO7F"}
@@ -1,90 +0,0 @@
1
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
- import { addClassNamesToElement } from '@lexical/utils';
3
- import { $applyNodeReplacement, $getNodeByKey, createCommand, DecoratorNode, } from 'lexical';
4
- export const INSERT_FOOTNOTE_COMMAND = createCommand('INSERT_FOOTNOTE_COMMAND');
5
- /** Inline marker in the text flow (requirements doc §4.10, architecture doc
6
- * §3.3). Holds only an id — its displayed number is never stored, it's
7
- * rendered by a CSS counter (editor.css) that counts these markers in DOM
8
- * order, so insert/delete/reorder auto-renumbers with no JS bookkeeping.
9
- * The note's actual content lives in a matching FootnoteItemNode inside the
10
- * document's single FootnoteListNode, not here (same split as Lexical's own
11
- * comments/annotations pattern: reference in the flow, content out-of-band). */
12
- export class FootnoteReferenceNode extends DecoratorNode {
13
- constructor(footnoteId, key) {
14
- super(key);
15
- this.__footnoteId = footnoteId;
16
- }
17
- static getType() {
18
- return 'footnote-reference';
19
- }
20
- static clone(node) {
21
- return new FootnoteReferenceNode(node.__footnoteId, node.__key);
22
- }
23
- getFootnoteId() {
24
- return this.getLatest().__footnoteId;
25
- }
26
- static importJSON(serializedNode) {
27
- return $createFootnoteReferenceNode(serializedNode.footnoteId);
28
- }
29
- exportJSON() {
30
- return { type: 'footnote-reference', version: 1, footnoteId: this.getFootnoteId() };
31
- }
32
- static importDOM() {
33
- return {
34
- sup: (domNode) => {
35
- const id = domNode.getAttribute('data-likhari-footnote-ref');
36
- if (!id)
37
- return null;
38
- return { conversion: () => ({ node: $createFootnoteReferenceNode(id) }), priority: 2 };
39
- },
40
- };
41
- }
42
- exportDOM() {
43
- const element = document.createElement('sup');
44
- element.setAttribute('data-likhari-footnote-ref', this.getFootnoteId());
45
- const anchor = document.createElement('a');
46
- anchor.setAttribute('href', `#fn-${this.getFootnoteId()}`);
47
- anchor.setAttribute('id', `fnref-${this.getFootnoteId()}`);
48
- element.appendChild(anchor);
49
- return { element };
50
- }
51
- createDOM(config) {
52
- const element = document.createElement('sup');
53
- addClassNamesToElement(element, config.theme.footnoteReference ?? 'likhari-footnote-ref');
54
- return element;
55
- }
56
- updateDOM() {
57
- return false;
58
- }
59
- getTextContent() {
60
- return `[^${this.getFootnoteId()}]`;
61
- }
62
- isInline() {
63
- return true;
64
- }
65
- decorate() {
66
- // The bracketed number itself is a CSS ::after counter (editor.css) —
67
- // nothing to render here but the counted element.
68
- return _jsx(_Fragment, {});
69
- }
70
- }
71
- export function $createFootnoteReferenceNode(footnoteId) {
72
- return $applyNodeReplacement(new FootnoteReferenceNode(footnoteId));
73
- }
74
- export function $isFootnoteReferenceNode(node) {
75
- return node instanceof FootnoteReferenceNode;
76
- }
77
- /** Resolves a reference's footnoteId from the editor state just before its
78
- * deletion committed — a mutation listener's 'destroyed' entries only carry
79
- * the NodeKey, and by the time the listener fires the *current* state no
80
- * longer has the node, so the caller must pass the listener's own
81
- * `prevEditorState` here to know which FootnoteItemNode to clean up. */
82
- export function $getFootnoteIdByKey(prevEditorState, key) {
83
- let id = null;
84
- prevEditorState.read(() => {
85
- const node = $getNodeByKey(key);
86
- if ($isFootnoteReferenceNode(node))
87
- id = node.getFootnoteId();
88
- });
89
- return id;
90
- }
@@ -1,54 +0,0 @@
1
- import { type DOMConversionMap, type DOMExportOutput, type EditorConfig, type LexicalCommand, type LexicalNode, type NodeKey, type SerializedElementNode, type Spread, ElementNode } from 'lexical';
2
- /** Payload: how many (equal-width) columns to create. Ratio support beyond
3
- * equal widths is deferred (lexical-editor-spec.md §4.9 mentions it as a
4
- * "configurable" possibility, not a committed requirement for Phase 3). */
5
- export declare const INSERT_LAYOUT_COMMAND: LexicalCommand<{
6
- columnCount: number;
7
- }>;
8
- export type SerializedLayoutContainerNode = Spread<{
9
- templateColumns: string;
10
- }, SerializedElementNode>;
11
- export type SerializedLayoutItemNode = SerializedElementNode;
12
- /** A multi-column row (editor-architecture-design.md §3.2): an ElementNode
13
- * holding one LayoutItemNode per column, laid out with CSS grid. Reused as
14
- * the structural basis for two-column poetry layouts (spec §4.11). */
15
- export declare class LayoutContainerNode extends ElementNode {
16
- __templateColumns: string;
17
- constructor(templateColumns?: string, key?: NodeKey);
18
- static getType(): string;
19
- static clone(node: LayoutContainerNode): LayoutContainerNode;
20
- getTemplateColumns(): string;
21
- setTemplateColumns(templateColumns: string): this;
22
- static importJSON(serializedNode: SerializedLayoutContainerNode): LayoutContainerNode;
23
- exportJSON(): SerializedLayoutContainerNode;
24
- static importDOM(): DOMConversionMap | null;
25
- exportDOM(): DOMExportOutput;
26
- createDOM(config: EditorConfig): HTMLElement;
27
- updateDOM(prevNode: LayoutContainerNode, dom: HTMLElement): boolean;
28
- canBeEmpty(): false;
29
- isShadowRoot(): boolean;
30
- }
31
- export declare function $createLayoutContainerNode(templateColumns?: string): LayoutContainerNode;
32
- export declare function $isLayoutContainerNode(node: LexicalNode | null | undefined): node is LayoutContainerNode;
33
- /** One column's content area inside a LayoutContainerNode. Always keeps at
34
- * least an empty paragraph (mirrors TableCellNode), so a column can never
35
- * collapse to an unselectable, unfocusable void. */
36
- export declare class LayoutItemNode extends ElementNode {
37
- static getType(): string;
38
- static clone(node: LayoutItemNode): LayoutItemNode;
39
- static importJSON(): LayoutItemNode;
40
- exportJSON(): SerializedLayoutItemNode;
41
- static importDOM(): DOMConversionMap | null;
42
- exportDOM(): DOMExportOutput;
43
- createDOM(config: EditorConfig): HTMLElement;
44
- updateDOM(): boolean;
45
- canBeEmpty(): false;
46
- canIndent(): false;
47
- }
48
- export declare function $createLayoutItemNode(): LayoutItemNode;
49
- export declare function $isLayoutItemNode(node: LexicalNode | null | undefined): node is LayoutItemNode;
50
- /** Builds a container with `columnCount` empty items — the shape every
51
- * LAYOUT insert produces, and what the node-transform below re-normalizes
52
- * a malformed tree back toward. */
53
- export declare function $createLayoutWithColumns(columnCount: number): LayoutContainerNode;
54
- //# sourceMappingURL=LayoutNode.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LayoutNode.d.ts","sourceRoot":"","sources":["../../src/blocks/LayoutNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,qBAAqB,EAC1B,KAAK,MAAM,EAEX,WAAW,EACZ,MAAM,SAAS,CAAC;AAGjB;;2EAE2E;AAC3E,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAA0C,CAAC;AAErH,MAAM,MAAM,6BAA6B,GAAG,MAAM,CAAC;IAAE,eAAe,EAAE,MAAM,CAAA;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YAAY,GAAG,WAAW;IAM5C,SAAS,IAAI,OAAO;IAIpB,UAAU,IAAI,KAAK;IAInB,SAAS,IAAI,KAAK;CAGnB;AAED,wBAAgB,qBAAqB,IAAI,cAAc,CAEtD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,cAAc,CAE9F;AAED;;mCAEmC;AACnC,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,mBAAmB,CAOjF"}
@@ -1,138 +0,0 @@
1
- import { $applyNodeReplacement, $createParagraphNode, createCommand, ElementNode, } from 'lexical';
2
- import { addClassNamesToElement } from '@lexical/utils';
3
- /** Payload: how many (equal-width) columns to create. Ratio support beyond
4
- * equal widths is deferred (lexical-editor-spec.md §4.9 mentions it as a
5
- * "configurable" possibility, not a committed requirement for Phase 3). */
6
- export const INSERT_LAYOUT_COMMAND = createCommand('INSERT_LAYOUT_COMMAND');
7
- /** A multi-column row (editor-architecture-design.md §3.2): an ElementNode
8
- * holding one LayoutItemNode per column, laid out with CSS grid. Reused as
9
- * the structural basis for two-column poetry layouts (spec §4.11). */
10
- export class LayoutContainerNode extends ElementNode {
11
- constructor(templateColumns = 'repeat(2, 1fr)', key) {
12
- super(key);
13
- this.__templateColumns = templateColumns;
14
- }
15
- static getType() {
16
- return 'layout-container';
17
- }
18
- static clone(node) {
19
- return new LayoutContainerNode(node.__templateColumns, node.__key);
20
- }
21
- getTemplateColumns() {
22
- return this.getLatest().__templateColumns;
23
- }
24
- setTemplateColumns(templateColumns) {
25
- const writable = this.getWritable();
26
- writable.__templateColumns = templateColumns;
27
- return writable;
28
- }
29
- static importJSON(serializedNode) {
30
- return $createLayoutContainerNode(serializedNode.templateColumns);
31
- }
32
- exportJSON() {
33
- return { ...super.exportJSON(), type: 'layout-container', version: 1, templateColumns: this.getTemplateColumns() };
34
- }
35
- static importDOM() {
36
- return {
37
- div: (domNode) => {
38
- if (!domNode.hasAttribute('data-likhari-layout-container'))
39
- return null;
40
- const templateColumns = domNode.style.gridTemplateColumns || undefined;
41
- return { conversion: () => ({ node: $createLayoutContainerNode(templateColumns) }), priority: 2 };
42
- },
43
- };
44
- }
45
- exportDOM() {
46
- const element = document.createElement('div');
47
- element.setAttribute('data-likhari-layout-container', '');
48
- element.style.display = 'grid';
49
- element.style.gridTemplateColumns = this.getTemplateColumns();
50
- return { element };
51
- }
52
- createDOM(config) {
53
- const element = document.createElement('div');
54
- addClassNamesToElement(element, config.theme.layoutContainer ?? 'likhari-layout-container');
55
- element.style.gridTemplateColumns = this.__templateColumns;
56
- return element;
57
- }
58
- updateDOM(prevNode, dom) {
59
- if (prevNode.__templateColumns !== this.__templateColumns) {
60
- dom.style.gridTemplateColumns = this.__templateColumns;
61
- }
62
- return false;
63
- }
64
- canBeEmpty() {
65
- return false;
66
- }
67
- isShadowRoot() {
68
- return true;
69
- }
70
- }
71
- export function $createLayoutContainerNode(templateColumns = 'repeat(2, 1fr)') {
72
- return $applyNodeReplacement(new LayoutContainerNode(templateColumns));
73
- }
74
- export function $isLayoutContainerNode(node) {
75
- return node instanceof LayoutContainerNode;
76
- }
77
- /** One column's content area inside a LayoutContainerNode. Always keeps at
78
- * least an empty paragraph (mirrors TableCellNode), so a column can never
79
- * collapse to an unselectable, unfocusable void. */
80
- export class LayoutItemNode extends ElementNode {
81
- static getType() {
82
- return 'layout-item';
83
- }
84
- static clone(node) {
85
- return new LayoutItemNode(node.__key);
86
- }
87
- static importJSON() {
88
- return $createLayoutItemNode();
89
- }
90
- exportJSON() {
91
- return { ...super.exportJSON(), type: 'layout-item', version: 1 };
92
- }
93
- static importDOM() {
94
- return {
95
- div: (domNode) => {
96
- if (!domNode.hasAttribute('data-likhari-layout-item'))
97
- return null;
98
- return { conversion: () => ({ node: $createLayoutItemNode() }), priority: 2 };
99
- },
100
- };
101
- }
102
- exportDOM() {
103
- const element = document.createElement('div');
104
- element.setAttribute('data-likhari-layout-item', '');
105
- return { element };
106
- }
107
- createDOM(config) {
108
- const element = document.createElement('div');
109
- addClassNamesToElement(element, config.theme.layoutItem ?? 'likhari-layout-item');
110
- return element;
111
- }
112
- updateDOM() {
113
- return false;
114
- }
115
- canBeEmpty() {
116
- return false;
117
- }
118
- canIndent() {
119
- return false;
120
- }
121
- }
122
- export function $createLayoutItemNode() {
123
- return $applyNodeReplacement(new LayoutItemNode());
124
- }
125
- export function $isLayoutItemNode(node) {
126
- return node instanceof LayoutItemNode;
127
- }
128
- /** Builds a container with `columnCount` empty items — the shape every
129
- * LAYOUT insert produces, and what the node-transform below re-normalizes
130
- * a malformed tree back toward. */
131
- export function $createLayoutWithColumns(columnCount) {
132
- const count = Math.max(2, Math.min(6, Math.round(columnCount)));
133
- const container = $createLayoutContainerNode(`repeat(${count}, 1fr)`);
134
- for (let i = 0; i < count; i++) {
135
- container.append($createLayoutItemNode().append($createParagraphNode()));
136
- }
137
- return container;
138
- }
@@ -1,9 +0,0 @@
1
- /** Inserts a reference at the caret and a matching empty item at the end of
2
- * the document's footnote list (creating the list if this is the first
3
- * footnote), then focuses the new item so the user can type the note. */
4
- export declare function $insertFootnote(): boolean;
5
- /** Removes the FootnoteItemNode for `footnoteId`, and the FootnoteListNode
6
- * itself if that was its last item — called by FootnotePlugin's mutation
7
- * listener when a FootnoteReferenceNode is deleted from the text. */
8
- export declare function $removeFootnoteItem(footnoteId: string): void;
9
- //# sourceMappingURL=footnoteActions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"footnoteActions.d.ts","sourceRoot":"","sources":["../../src/blocks/footnoteActions.ts"],"names":[],"mappings":"AAcA;;yEAEyE;AACzE,wBAAgB,eAAe,IAAI,OAAO,CAgBzC;AAED;;qEAEqE;AACrE,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAM5D"}
@@ -1,42 +0,0 @@
1
- import { $createParagraphNode, $getRoot, $getSelection, $isRangeSelection } from 'lexical';
2
- import { $createFootnoteReferenceNode } from './FootnoteNode.js';
3
- import { $createFootnoteItemNode, $createFootnoteListNode, $isFootnoteItemNode, $isFootnoteListNode } from './FootnoteListNode.js';
4
- let counter = 0;
5
- /** Short, collision-resistant within a single document: a monotonic counter
6
- * is enough here (ids never need to be stable/meaningful across documents),
7
- * and avoids a hard dependency on crypto.randomUUID being available. */
8
- function newFootnoteId() {
9
- counter += 1;
10
- return `${Date.now().toString(36)}${counter.toString(36)}`;
11
- }
12
- /** Inserts a reference at the caret and a matching empty item at the end of
13
- * the document's footnote list (creating the list if this is the first
14
- * footnote), then focuses the new item so the user can type the note. */
15
- export function $insertFootnote() {
16
- const selection = $getSelection();
17
- if (!$isRangeSelection(selection))
18
- return false;
19
- const footnoteId = newFootnoteId();
20
- selection.insertNodes([$createFootnoteReferenceNode(footnoteId)]);
21
- const root = $getRoot();
22
- const lastChild = root.getLastChild();
23
- const list = $isFootnoteListNode(lastChild) ? lastChild : $createFootnoteListNode();
24
- if (!$isFootnoteListNode(lastChild))
25
- root.append(list);
26
- const item = $createFootnoteItemNode(footnoteId).append($createParagraphNode());
27
- list.append(item);
28
- item.getFirstDescendant()?.selectStart();
29
- return true;
30
- }
31
- /** Removes the FootnoteItemNode for `footnoteId`, and the FootnoteListNode
32
- * itself if that was its last item — called by FootnotePlugin's mutation
33
- * listener when a FootnoteReferenceNode is deleted from the text. */
34
- export function $removeFootnoteItem(footnoteId) {
35
- const list = $getRoot().getChildren().find($isFootnoteListNode);
36
- if (!list)
37
- return;
38
- const item = list.getChildren().find((child) => $isFootnoteItemNode(child) && child.getFootnoteId() === footnoteId);
39
- item?.remove();
40
- if (list.getChildrenSize() === 0)
41
- list.remove();
42
- }
@@ -1,12 +0,0 @@
1
- import { LayoutContainerNode, LayoutItemNode } from './LayoutNode.js';
2
- /** Inserts a `columnCount`-column layout right after the selection's
3
- * top-level block, and focuses its first column. Returns false (so the
4
- * command falls through) when there's no usable selection to anchor on. */
5
- export declare function $insertLayout(columnCount: number): boolean;
6
- /** Keeps LayoutContainerNode/LayoutItemNode nesting valid against malformed
7
- * trees from paste, undo or JSON import — a LayoutItemNode can only live
8
- * directly inside a LayoutContainerNode and vice versa. */
9
- export declare function $normalizeLayoutItem(node: LayoutItemNode): void;
10
- /** See $normalizeLayoutItem — the container-side half of the same rule. */
11
- export declare function $normalizeLayoutContainer(node: LayoutContainerNode): void;
12
- //# sourceMappingURL=layoutActions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layoutActions.d.ts","sourceRoot":"","sources":["../../src/blocks/layoutActions.ts"],"names":[],"mappings":"AACA,OAAO,EAAuE,mBAAmB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAExI;;2EAE2E;AAC3E,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAQ1D;AAED;;2DAE2D;AAC3D,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAM/D;AAED,2EAA2E;AAC3E,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI,CASzE"}
@@ -1,39 +0,0 @@
1
- import { $getSelection, $isRangeSelection } from 'lexical';
2
- import { $createLayoutWithColumns, $isLayoutContainerNode, $isLayoutItemNode } from './LayoutNode.js';
3
- /** Inserts a `columnCount`-column layout right after the selection's
4
- * top-level block, and focuses its first column. Returns false (so the
5
- * command falls through) when there's no usable selection to anchor on. */
6
- export function $insertLayout(columnCount) {
7
- const selection = $getSelection();
8
- if (!$isRangeSelection(selection))
9
- return false;
10
- const anchorTopLevel = selection.anchor.getNode().getTopLevelElementOrThrow();
11
- const container = $createLayoutWithColumns(columnCount);
12
- anchorTopLevel.insertAfter(container);
13
- container.getFirstDescendant()?.selectStart();
14
- return true;
15
- }
16
- /** Keeps LayoutContainerNode/LayoutItemNode nesting valid against malformed
17
- * trees from paste, undo or JSON import — a LayoutItemNode can only live
18
- * directly inside a LayoutContainerNode and vice versa. */
19
- export function $normalizeLayoutItem(node) {
20
- const parent = node.getParent();
21
- if ($isLayoutContainerNode(parent))
22
- return;
23
- // Orphaned: unwrap into plain content rather than leaving a stray node.
24
- for (const child of node.getChildren())
25
- node.insertBefore(child);
26
- node.remove();
27
- }
28
- /** See $normalizeLayoutItem — the container-side half of the same rule. */
29
- export function $normalizeLayoutContainer(node) {
30
- const children = node.getChildren();
31
- if (children.length === 0) {
32
- node.remove();
33
- return;
34
- }
35
- for (const child of children) {
36
- if (!$isLayoutItemNode(child))
37
- child.remove();
38
- }
39
- }
@@ -1,11 +0,0 @@
1
- export interface LayoutDialogValue {
2
- columnCount: number;
3
- }
4
- export interface LayoutDialogProps {
5
- opened: boolean;
6
- onSubmit: (value: LayoutDialogValue) => void;
7
- onClose: () => void;
8
- }
9
- /** Insert-columns dialog: how many equal-width columns to create. */
10
- export declare function LayoutDialog({ opened, onSubmit, onClose }: LayoutDialogProps): import("react").JSX.Element;
11
- //# sourceMappingURL=LayoutDialog.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LayoutDialog.d.ts","sourceRoot":"","sources":["../../src/components/LayoutDialog.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC7C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAMD,qEAAqE;AACrE,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,iBAAiB,+BAmC5E"}
@@ -1,24 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useState } from 'react';
3
- import { Button, Group, Modal, NumberInput } from '@mantine/core';
4
- import { useUiStrings } from '../i18n/useStrings.js';
5
- import { usePortalTarget } from '../PortalTargetContext.js';
6
- const MIN_COLUMNS = 2;
7
- const MAX_COLUMNS = 6;
8
- const DEFAULT_COLUMNS = 2;
9
- /** Insert-columns dialog: how many equal-width columns to create. */
10
- export function LayoutDialog({ opened, onSubmit, onClose }) {
11
- const strings = useUiStrings();
12
- const portalTarget = usePortalTarget();
13
- const [columnCount, setColumnCount] = useState(DEFAULT_COLUMNS);
14
- useEffect(() => {
15
- if (!opened)
16
- return;
17
- setColumnCount(DEFAULT_COLUMNS);
18
- }, [opened]);
19
- const handleSubmit = (e) => {
20
- e.preventDefault();
21
- onSubmit({ columnCount });
22
- };
23
- return (_jsx(Modal, { opened: opened, onClose: onClose, title: strings.layoutDialog.title, centered: true, size: "sm", portalProps: { target: portalTarget }, children: _jsxs("form", { onSubmit: handleSubmit, children: [_jsx(NumberInput, { label: strings.layoutDialog.columnCount, min: MIN_COLUMNS, max: MAX_COLUMNS, value: columnCount, onChange: (v) => setColumnCount(typeof v === 'number' ? v : DEFAULT_COLUMNS), "data-autofocus": true }), _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 })] })] }) }));
24
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Registers INSERT_FOOTNOTE_COMMAND, a mutation listener that removes a
3
- * FootnoteItemNode when its matching FootnoteReferenceNode is deleted from
4
- * the text (so the list never accumulates orphaned notes), and two node
5
- * transforms that keep the list/item nesting valid against malformed trees
6
- * from paste, undo or JSON import — mirrors LayoutPlugin's shape.
7
- */
8
- export declare function FootnotePlugin(): null;
9
- //# sourceMappingURL=FootnotePlugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FootnotePlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/FootnotePlugin.tsx"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,wBAAgB,cAAc,SAyC7B"}
@@ -1,51 +0,0 @@
1
- import { useEffect } from 'react';
2
- import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
3
- import { mergeRegister } from '@lexical/utils';
4
- import { COMMAND_PRIORITY_EDITOR } from 'lexical';
5
- import { $getFootnoteIdByKey, FootnoteReferenceNode, INSERT_FOOTNOTE_COMMAND } from '../blocks/FootnoteNode.js';
6
- import { $isFootnoteItemNode, $isFootnoteListNode, FootnoteItemNode, FootnoteListNode } from '../blocks/FootnoteListNode.js';
7
- import { $insertFootnote, $removeFootnoteItem } from '../blocks/footnoteActions.js';
8
- /**
9
- * Registers INSERT_FOOTNOTE_COMMAND, a mutation listener that removes a
10
- * FootnoteItemNode when its matching FootnoteReferenceNode is deleted from
11
- * the text (so the list never accumulates orphaned notes), and two node
12
- * transforms that keep the list/item nesting valid against malformed trees
13
- * from paste, undo or JSON import — mirrors LayoutPlugin's shape.
14
- */
15
- export function FootnotePlugin() {
16
- const [editor] = useLexicalComposerContext();
17
- useEffect(() => {
18
- if (!editor.hasNodes([FootnoteReferenceNode, FootnoteListNode, FootnoteItemNode])) {
19
- throw new Error('FootnotePlugin: footnote node types not registered on the editor');
20
- }
21
- return mergeRegister(editor.registerCommand(INSERT_FOOTNOTE_COMMAND, () => $insertFootnote(), COMMAND_PRIORITY_EDITOR), editor.registerMutationListener(FootnoteReferenceNode, (mutations, { prevEditorState }) => {
22
- const destroyedIds = [];
23
- for (const [key, mutation] of mutations) {
24
- if (mutation !== 'destroyed')
25
- continue;
26
- const id = $getFootnoteIdByKey(prevEditorState, key);
27
- if (id)
28
- destroyedIds.push(id);
29
- }
30
- if (destroyedIds.length === 0)
31
- return;
32
- editor.update(() => {
33
- for (const id of destroyedIds)
34
- $removeFootnoteItem(id);
35
- });
36
- }, { skipInitialization: true }), editor.registerNodeTransform(FootnoteItemNode, (node) => {
37
- const parent = node.getParent();
38
- if ($isFootnoteListNode(parent))
39
- return;
40
- for (const child of node.getChildren())
41
- node.insertBefore(child);
42
- node.remove();
43
- }), editor.registerNodeTransform(FootnoteListNode, (node) => {
44
- for (const child of node.getChildren()) {
45
- if (!$isFootnoteItemNode(child))
46
- child.remove();
47
- }
48
- }));
49
- }, [editor]);
50
- return null;
51
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Registers INSERT_LAYOUT_COMMAND (mirrors PageBreakPlugin) and two node
3
- * transforms that keep the container/item pairing structurally valid —
4
- * needed because paste, undo and JSON import can all produce a tree the UI
5
- * itself never would. The actual logic lives in blocks/layoutActions.ts so
6
- * it's testable without mounting a React tree.
7
- */
8
- export declare function LayoutPlugin(): null;
9
- //# sourceMappingURL=LayoutPlugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LayoutPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/LayoutPlugin.tsx"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,wBAAgB,YAAY,SAgB3B"}
@@ -1,23 +0,0 @@
1
- import { useEffect } from 'react';
2
- import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
3
- import { mergeRegister } from '@lexical/utils';
4
- import { COMMAND_PRIORITY_EDITOR } from 'lexical';
5
- import { INSERT_LAYOUT_COMMAND, LayoutContainerNode, LayoutItemNode } from '../blocks/LayoutNode.js';
6
- import { $insertLayout, $normalizeLayoutContainer, $normalizeLayoutItem } from '../blocks/layoutActions.js';
7
- /**
8
- * Registers INSERT_LAYOUT_COMMAND (mirrors PageBreakPlugin) and two node
9
- * transforms that keep the container/item pairing structurally valid —
10
- * needed because paste, undo and JSON import can all produce a tree the UI
11
- * itself never would. The actual logic lives in blocks/layoutActions.ts so
12
- * it's testable without mounting a React tree.
13
- */
14
- export function LayoutPlugin() {
15
- const [editor] = useLexicalComposerContext();
16
- useEffect(() => {
17
- if (!editor.hasNodes([LayoutContainerNode, LayoutItemNode])) {
18
- throw new Error('LayoutPlugin: LayoutContainerNode/LayoutItemNode not registered on the editor');
19
- }
20
- return mergeRegister(editor.registerCommand(INSERT_LAYOUT_COMMAND, ({ columnCount }) => $insertLayout(columnCount), COMMAND_PRIORITY_EDITOR), editor.registerNodeTransform(LayoutItemNode, $normalizeLayoutItem), editor.registerNodeTransform(LayoutContainerNode, $normalizeLayoutContainer));
21
- }, [editor]);
22
- return null;
23
- }