@inshapardaz/likhari-react 0.1.18-dev.142 → 0.1.18-dev.144
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocks/poetryActions.d.ts +14 -0
- package/dist/blocks/poetryActions.d.ts.map +1 -1
- package/dist/blocks/poetryActions.js +43 -1
- package/dist/components/Toolbar.d.ts.map +1 -1
- package/dist/components/Toolbar.js +5 -5
- package/dist/i18n/strings.d.ts +1 -0
- package/dist/i18n/strings.d.ts.map +1 -1
- package/dist/i18n/strings.js +3 -0
- package/dist/plugins/PoetryPlugin.d.ts +5 -2
- package/dist/plugins/PoetryPlugin.d.ts.map +1 -1
- package/dist/plugins/PoetryPlugin.js +12 -4
- package/package.json +1 -1
|
@@ -24,6 +24,20 @@ export declare function $ensureTrailingParagraph(node: PoetryBlockNode): void;
|
|
|
24
24
|
/** Inserts a new two-misra couplet after the selection's top-level block,
|
|
25
25
|
* in `layout`/`align`, and focuses its first misra. */
|
|
26
26
|
export declare function $insertPoetryCouplet(layout: PoetryLayout, align: PoetryAlign): boolean;
|
|
27
|
+
/** Removes the whole couplet the selection is inside, if any — the explicit,
|
|
28
|
+
* always-available counterpart to $deletePoetryOnBackspace's empty-couplet
|
|
29
|
+
* shortcut (mirrors the table menu's own "Delete table" action). */
|
|
30
|
+
export declare function $deletePoetryCouplet(): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Backspace at the very start of an empty couplet's first misra removes the
|
|
33
|
+
* whole block — the natural keystroke to try first, and otherwise there was
|
|
34
|
+
* no way to get rid of an empty couplet created by mistake (its two misra
|
|
35
|
+
* paragraphs each have their own default canBeEmpty, so Lexical's usual
|
|
36
|
+
* "delete the empty block" handling never reaches the couplet itself).
|
|
37
|
+
* Returns false for every other caret position, including a non-empty
|
|
38
|
+
* couplet, so normal Backspace handling (e.g. deleting within text) proceeds.
|
|
39
|
+
*/
|
|
40
|
+
export declare function $deletePoetryOnBackspace(): boolean;
|
|
27
41
|
/**
|
|
28
42
|
* Enter at the end of a couplet's last misra would otherwise land inside
|
|
29
43
|
* ParagraphNode's own insertNewAfter — which inserts the new paragraph as a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poetryActions.d.ts","sourceRoot":"","sources":["../../src/blocks/poetryActions.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"poetryActions.d.ts","sourceRoot":"","sources":["../../src/blocks/poetryActions.ts"],"names":[],"mappings":"AACA,OAAO,EAA4F,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAEvI,OAAO,EAA8C,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAErI;wCACwC;AACxC,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,eAAe,GAAG,aAAa,EAAE,CAW1E;AAED,oEAAoE;AACpE,wBAAgB,4BAA4B,IAAI,eAAe,GAAG,IAAI,CAKrE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAclF;AAED;;;;;;qDAMqD;AACrD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,CAEpE;AAED;uDACuD;AACvD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,GAAG,OAAO,CAyBtF;AAED;;oEAEoE;AACpE,wBAAgB,oBAAoB,IAAI,OAAO,CAK9C;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAoBlD;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAuB5C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $findMatchingParent } from '@lexical/utils';
|
|
2
|
-
import { $createParagraphNode, $getSelection, $isParagraphNode, $isRangeSelection } from 'lexical';
|
|
2
|
+
import { $createParagraphNode, $getSelection, $isElementNode, $isParagraphNode, $isRangeSelection } from 'lexical';
|
|
3
3
|
import { $createLayoutContainerNode, $createLayoutItemNode, $isLayoutContainerNode, $isLayoutItemNode } from './LayoutNode.js';
|
|
4
4
|
import { $createPoetryBlockNode, $isPoetryBlockNode } from './PoetryNode.js';
|
|
5
5
|
/** The couplet's two misra paragraphs, in document order, regardless of
|
|
@@ -91,6 +91,48 @@ export function $insertPoetryCouplet(layout, align) {
|
|
|
91
91
|
misraA.selectStart();
|
|
92
92
|
return true;
|
|
93
93
|
}
|
|
94
|
+
/** Removes the whole couplet the selection is inside, if any — the explicit,
|
|
95
|
+
* always-available counterpart to $deletePoetryOnBackspace's empty-couplet
|
|
96
|
+
* shortcut (mirrors the table menu's own "Delete table" action). */
|
|
97
|
+
export function $deletePoetryCouplet() {
|
|
98
|
+
const couplet = $getPoetryBlockFromSelection();
|
|
99
|
+
if (!couplet)
|
|
100
|
+
return false;
|
|
101
|
+
couplet.remove();
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Backspace at the very start of an empty couplet's first misra removes the
|
|
106
|
+
* whole block — the natural keystroke to try first, and otherwise there was
|
|
107
|
+
* no way to get rid of an empty couplet created by mistake (its two misra
|
|
108
|
+
* paragraphs each have their own default canBeEmpty, so Lexical's usual
|
|
109
|
+
* "delete the empty block" handling never reaches the couplet itself).
|
|
110
|
+
* Returns false for every other caret position, including a non-empty
|
|
111
|
+
* couplet, so normal Backspace handling (e.g. deleting within text) proceeds.
|
|
112
|
+
*/
|
|
113
|
+
export function $deletePoetryOnBackspace() {
|
|
114
|
+
const selection = $getSelection();
|
|
115
|
+
if (!$isRangeSelection(selection) || !selection.isCollapsed())
|
|
116
|
+
return false;
|
|
117
|
+
const couplet = $getPoetryBlockFromSelection();
|
|
118
|
+
if (!couplet)
|
|
119
|
+
return false;
|
|
120
|
+
const misras = $getMisraParagraphs(couplet);
|
|
121
|
+
const firstMisra = misras[0];
|
|
122
|
+
if (!firstMisra)
|
|
123
|
+
return false;
|
|
124
|
+
if (misras.some((m) => !m.isEmpty()))
|
|
125
|
+
return false;
|
|
126
|
+
const anchor = selection.anchor;
|
|
127
|
+
const isAtStart = anchor.key === firstMisra.getKey() && anchor.offset === 0;
|
|
128
|
+
if (!isAtStart)
|
|
129
|
+
return false;
|
|
130
|
+
const previous = couplet.getPreviousSibling();
|
|
131
|
+
couplet.remove();
|
|
132
|
+
if ($isElementNode(previous))
|
|
133
|
+
previous.selectEnd();
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
94
136
|
/**
|
|
95
137
|
* Enter at the end of a couplet's last misra would otherwise land inside
|
|
96
138
|
* ParagraphNode's own insertNewAfter — which inserts the new paragraph as a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/components/Toolbar.tsx"],"names":[],"mappings":"AAiEA,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;
|
|
1
|
+
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/components/Toolbar.tsx"],"names":[],"mappings":"AAiEA,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;AA4evD,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,+BAugCxJ"}
|
|
@@ -14,7 +14,7 @@ import { $createImageNode } from '../image/ImageNode.js';
|
|
|
14
14
|
import { INSERT_PAGE_BREAK_COMMAND } from '../blocks/PageBreakNode.js';
|
|
15
15
|
import { INSERT_LAYOUT_COMMAND } from '../blocks/LayoutNode.js';
|
|
16
16
|
import { INSERT_FOOTNOTE_COMMAND } from '../blocks/FootnoteNode.js';
|
|
17
|
-
import { $getPoetryBlockFromSelection, $setPoetryLayout } from '../blocks/poetryActions.js';
|
|
17
|
+
import { $deletePoetryCouplet, $getPoetryBlockFromSelection, $setPoetryLayout } from '../blocks/poetryActions.js';
|
|
18
18
|
import { INSERT_POETRY_COUPLET_COMMAND } from '../plugins/PoetryPlugin.js';
|
|
19
19
|
import { TableDialog } from './TableDialog.js';
|
|
20
20
|
import { LayoutDialog } from './LayoutDialog.js';
|
|
@@ -28,7 +28,7 @@ import { CANVAS_FONT_DEFAULTS, DEFAULT_FONT_OPTIONS, FONT_SIZES_PX } from '../fo
|
|
|
28
28
|
import { setStyleProperty } from '../utils/style.js';
|
|
29
29
|
import { useStrings } from '../i18n/useStrings.js';
|
|
30
30
|
import { usePortalTarget } from '../PortalTargetContext.js';
|
|
31
|
-
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, IconColumns1, IconColumns2, IconNumber1Small, IconRowInsertBottom, IconRowInsertTop, IconRowRemove, IconTable, IconTableMinus, IconTableOptions, IconTextSize, IconTypography, IconUnderline, IconWand, } from '@tabler/icons-react';
|
|
31
|
+
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, IconColumns1, IconColumns2, IconNumber1Small, IconRowInsertBottom, IconRowInsertTop, IconRowRemove, IconTable, IconTableMinus, IconTrash, IconTableOptions, IconTextSize, IconTypography, IconUnderline, IconWand, } from '@tabler/icons-react';
|
|
32
32
|
/** Sentinel for "no inline style": Lexical returns the default it is given when
|
|
33
33
|
* the selection has none, so this tells "unstyled" (show the canvas default)
|
|
34
34
|
* apart from "styled with a value the dropdown doesn't list" (show nothing). */
|
|
@@ -167,9 +167,9 @@ function TableMenuItems({ strings, direction, rows, columns, canMergeCells, canU
|
|
|
167
167
|
function PoetryMenuItems({ strings, alignIcons, layout, align, onAction, }) {
|
|
168
168
|
const t = strings.poetryMenu;
|
|
169
169
|
const a = strings.toolbar.alignOptions;
|
|
170
|
-
const item = (icon, label, action, active) => {
|
|
170
|
+
const item = (icon, label, action, active = false, color) => {
|
|
171
171
|
const Icon = icon;
|
|
172
|
-
return (_jsx(Menu.Item, { disabled: active, leftSection: _jsx(Icon, { size: ICON_SIZE, stroke: ICON_STROKE }), onMouseDown: (e) => e.preventDefault(), onClick: onAction(action), children: label }));
|
|
172
|
+
return (_jsx(Menu.Item, { color: color, disabled: active, leftSection: _jsx(Icon, { size: ICON_SIZE, stroke: ICON_STROKE }), onMouseDown: (e) => e.preventDefault(), onClick: onAction(action), children: label }));
|
|
173
173
|
};
|
|
174
174
|
const setLayout = (next) => () => {
|
|
175
175
|
const node = $getPoetryBlockFromSelection();
|
|
@@ -179,7 +179,7 @@ function PoetryMenuItems({ strings, alignIcons, layout, align, onAction, }) {
|
|
|
179
179
|
const setAlign = (next) => () => {
|
|
180
180
|
$getPoetryBlockFromSelection()?.setAlign(next);
|
|
181
181
|
};
|
|
182
|
-
return (_jsxs(_Fragment, { children: [_jsx(Menu.Label, { children: t.menuLabel }), item(IconColumns1, t.singleColumn, setLayout('single'), layout === 'single'), item(IconColumns2, t.twoColumn, setLayout('two-column'), layout === 'two-column'), _jsx(Menu.Divider, {}), item(alignIcons.justify ?? IconAlignJustified, a.justify, setAlign('justify'), align === 'justify'), item(alignIcons.start ?? IconAlignLeft, a.start, setAlign('start'), align === 'start'), item(IconAlignLeft, a.left, setAlign('left'), align === 'left'), item(IconAlignRight, a.right, setAlign('right'), align === 'right')] }));
|
|
182
|
+
return (_jsxs(_Fragment, { children: [_jsx(Menu.Label, { children: t.menuLabel }), item(IconColumns1, t.singleColumn, setLayout('single'), layout === 'single'), item(IconColumns2, t.twoColumn, setLayout('two-column'), layout === 'two-column'), _jsx(Menu.Divider, {}), item(alignIcons.justify ?? IconAlignJustified, a.justify, setAlign('justify'), align === 'justify'), item(alignIcons.start ?? IconAlignLeft, a.start, setAlign('start'), align === 'start'), item(IconAlignLeft, a.left, setAlign('left'), align === 'left'), item(IconAlignRight, a.right, setAlign('right'), align === 'right'), _jsx(Menu.Divider, {}), item(IconTrash, t.deleteCouplet, $deletePoetryCouplet, false, 'red')] }));
|
|
183
183
|
}
|
|
184
184
|
export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAULT_FONT_OPTIONS, direction = 'ltr', locale = 'en', drafts }) {
|
|
185
185
|
const [editor] = useLexicalComposerContext();
|
package/dist/i18n/strings.d.ts
CHANGED
|
@@ -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;QACrB,sEAAsE;QACtE,cAAc,EAAE,MAAM,CAAC;KACxB,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,IA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E,OAAO,CAI3C,CAAC;AAEF;;sDAEsD;AACtD,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAElD"}
|
package/dist/i18n/strings.js
CHANGED
|
@@ -125,6 +125,7 @@ const en = {
|
|
|
125
125
|
menuLabel: 'Poetry',
|
|
126
126
|
singleColumn: 'Single column',
|
|
127
127
|
twoColumn: 'Two column',
|
|
128
|
+
deleteCouplet: 'Delete couplet',
|
|
128
129
|
},
|
|
129
130
|
link: {
|
|
130
131
|
menuLabel: 'Link',
|
|
@@ -332,6 +333,7 @@ const ur = {
|
|
|
332
333
|
menuLabel: 'شاعری',
|
|
333
334
|
singleColumn: 'ایک کالم',
|
|
334
335
|
twoColumn: 'دو کالم',
|
|
336
|
+
deleteCouplet: 'شعر حذف کریں',
|
|
335
337
|
},
|
|
336
338
|
link: {
|
|
337
339
|
menuLabel: 'لنک',
|
|
@@ -539,6 +541,7 @@ const paShahmukhi = {
|
|
|
539
541
|
menuLabel: 'شاعری',
|
|
540
542
|
singleColumn: 'اک کالم',
|
|
541
543
|
twoColumn: 'دو کالم',
|
|
544
|
+
deleteCouplet: 'شعر مٹاؤ',
|
|
542
545
|
},
|
|
543
546
|
link: {
|
|
544
547
|
menuLabel: 'لنک',
|
|
@@ -8,10 +8,13 @@ export declare const INSERT_POETRY_COUPLET_COMMAND: LexicalCommand<{
|
|
|
8
8
|
* Registers INSERT_POETRY_COUPLET_COMMAND (mirrors LayoutPlugin/FootnotePlugin's
|
|
9
9
|
* shape); a node transform that removes a couplet left with no misra
|
|
10
10
|
* content (e.g. after undo/paste leaves it structurally empty) and keeps a
|
|
11
|
-
* trailing couplet always followed by an editable paragraph;
|
|
11
|
+
* trailing couplet always followed by an editable paragraph; a
|
|
12
12
|
* KEY_ENTER_COMMAND handler (above RichTextPlugin's own, which would
|
|
13
13
|
* otherwise trap Enter inside the couplet — see poetryActions.ts) that lets
|
|
14
|
-
* Enter at the end of the last misra add a paragraph after the block
|
|
14
|
+
* Enter at the end of the last misra add a paragraph after the block; and a
|
|
15
|
+
* KEY_BACKSPACE_COMMAND handler that removes an empty couplet entirely when
|
|
16
|
+
* Backspace is pressed at its very start (the explicit "Delete couplet"
|
|
17
|
+
* menu action in Toolbar.tsx covers removing a non-empty one).
|
|
15
18
|
*/
|
|
16
19
|
export declare function PoetryPlugin(): null;
|
|
17
20
|
//# sourceMappingURL=PoetryPlugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PoetryPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/PoetryPlugin.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"PoetryPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/PoetryPlugin.tsx"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAmB,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAG5F,eAAO,MAAM,6BAA6B,EAAE,cAAc,CAAC;IAAE,MAAM,EAAE,YAAY,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAAE,CAEtG,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,SA4C3B"}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
3
|
-
import { COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_HIGH, KEY_ENTER_COMMAND, createCommand } from 'lexical';
|
|
3
|
+
import { COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_HIGH, KEY_BACKSPACE_COMMAND, KEY_ENTER_COMMAND, createCommand, } from 'lexical';
|
|
4
4
|
import { mergeRegister } from '@lexical/utils';
|
|
5
5
|
import { LayoutContainerNode, LayoutItemNode } from '../blocks/LayoutNode.js';
|
|
6
6
|
import { PoetryBlockNode } from '../blocks/PoetryNode.js';
|
|
7
|
-
import { $ensureTrailingParagraph, $exitPoetryOnEnter, $insertPoetryCouplet } from '../blocks/poetryActions.js';
|
|
7
|
+
import { $deletePoetryOnBackspace, $ensureTrailingParagraph, $exitPoetryOnEnter, $insertPoetryCouplet } from '../blocks/poetryActions.js';
|
|
8
8
|
export const INSERT_POETRY_COUPLET_COMMAND = createCommand('INSERT_POETRY_COUPLET_COMMAND');
|
|
9
9
|
/**
|
|
10
10
|
* Registers INSERT_POETRY_COUPLET_COMMAND (mirrors LayoutPlugin/FootnotePlugin's
|
|
11
11
|
* shape); a node transform that removes a couplet left with no misra
|
|
12
12
|
* content (e.g. after undo/paste leaves it structurally empty) and keeps a
|
|
13
|
-
* trailing couplet always followed by an editable paragraph;
|
|
13
|
+
* trailing couplet always followed by an editable paragraph; a
|
|
14
14
|
* KEY_ENTER_COMMAND handler (above RichTextPlugin's own, which would
|
|
15
15
|
* otherwise trap Enter inside the couplet — see poetryActions.ts) that lets
|
|
16
|
-
* Enter at the end of the last misra add a paragraph after the block
|
|
16
|
+
* Enter at the end of the last misra add a paragraph after the block; and a
|
|
17
|
+
* KEY_BACKSPACE_COMMAND handler that removes an empty couplet entirely when
|
|
18
|
+
* Backspace is pressed at its very start (the explicit "Delete couplet"
|
|
19
|
+
* menu action in Toolbar.tsx covers removing a non-empty one).
|
|
17
20
|
*/
|
|
18
21
|
export function PoetryPlugin() {
|
|
19
22
|
const [editor] = useLexicalComposerContext();
|
|
@@ -34,6 +37,11 @@ export function PoetryPlugin() {
|
|
|
34
37
|
if (handled)
|
|
35
38
|
event?.preventDefault();
|
|
36
39
|
return handled;
|
|
40
|
+
}, COMMAND_PRIORITY_HIGH), editor.registerCommand(KEY_BACKSPACE_COMMAND, (event) => {
|
|
41
|
+
const handled = $deletePoetryOnBackspace();
|
|
42
|
+
if (handled)
|
|
43
|
+
event?.preventDefault();
|
|
44
|
+
return handled;
|
|
37
45
|
}, COMMAND_PRIORITY_HIGH));
|
|
38
46
|
}, [editor]);
|
|
39
47
|
return null;
|