@inshapardaz/likhari-react 0.1.7-dev.79 → 0.1.7
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/EditorRoot.d.ts.map +1 -1
- package/dist/EditorRoot.js +1 -2
- package/dist/components/Toolbar.d.ts.map +1 -1
- package/dist/components/Toolbar.js +4 -26
- package/dist/i18n/strings.d.ts +0 -7
- package/dist/i18n/strings.d.ts.map +1 -1
- package/dist/i18n/strings.js +0 -21
- package/dist/nodes.d.ts.map +1 -1
- package/dist/nodes.js +0 -4
- package/dist/theme/editor.css +0 -31
- package/dist/theme/editorTheme.d.ts.map +1 -1
- package/dist/theme/editorTheme.js +0 -5
- package/package.json +1 -2
- package/dist/components/TableDialog.d.ts +0 -17
- package/dist/components/TableDialog.d.ts.map +0 -1
- package/dist/components/TableDialog.js +0 -33
package/dist/EditorRoot.d.ts.map
CHANGED
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"EditorRoot.d.ts","sourceRoot":"","sources":["../src/EditorRoot.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAU1D,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;AAIjE,OAAO,EAAgC,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEnE,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE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;IAC7B,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC,KAAK,IAAI,IAAI,CAAC;CACf;AAQD,eAAO,MAAM,UAAU,uGAkKrB,CAAC"}
|
package/dist/EditorRoot.js
CHANGED
|
@@ -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 { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin';
|
|
12
11
|
import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary';
|
|
13
12
|
import { defaultFormatRegistry } from '@inshapardaz/likhari-converters';
|
|
@@ -112,5 +111,5 @@ export const EditorRoot = forwardRef(function EditorRoot({ documentId, initialCo
|
|
|
112
111
|
// rather than colliding on a shared one.
|
|
113
112
|
const portalTargetId = useId();
|
|
114
113
|
const portalTargetSelector = `#${CSS.escape(portalTargetId)}`;
|
|
115
|
-
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: _jsx(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 }), _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, {}),
|
|
114
|
+
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: _jsx(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 }), _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, {}), _jsx(OnChangePlugin, { onChange: handleChange })] }) }) }) })] }) }));
|
|
116
115
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/components/Toolbar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/components/Toolbar.tsx"],"names":[],"mappings":"AA4CA,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;AAqUvD,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;CACjB;AAED,wBAAgB,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAkC,EAAE,SAAiB,EAAE,MAAa,EAAE,EAAE,YAAY,+BA8wBhJ"}
|
|
@@ -10,8 +10,6 @@ import { $isListNode, INSERT_CHECK_LIST_COMMAND, INSERT_ORDERED_LIST_COMMAND, IN
|
|
|
10
10
|
import { $findMatchingParent, $insertNodeToNearestRoot } from '@lexical/utils';
|
|
11
11
|
import { ImageDialog } from '../image/ImageDialog.js';
|
|
12
12
|
import { $createImageNode } from '../image/ImageNode.js';
|
|
13
|
-
import { TableDialog } from './TableDialog.js';
|
|
14
|
-
import { INSERT_TABLE_COMMAND } from '@lexical/table';
|
|
15
13
|
import { $createLinkNode, $isLinkNode, TOGGLE_LINK_COMMAND } from '@lexical/link';
|
|
16
14
|
import { LinkDialog } from './LinkDialog.js';
|
|
17
15
|
import { normalizeLinkUrl } from '../utils/linkUrl.js';
|
|
@@ -19,7 +17,7 @@ import { CANVAS_FONT_DEFAULTS, DEFAULT_FONT_OPTIONS, FONT_SIZES_PX } from '../fo
|
|
|
19
17
|
import { setStyleProperty } from '../utils/style.js';
|
|
20
18
|
import { useStrings } from '../i18n/useStrings.js';
|
|
21
19
|
import { usePortalTarget } from '../PortalTargetContext.js';
|
|
22
|
-
import { IconAbc, IconAlignCenter, IconAlignJustified, IconAlignLeft, IconAlignRight, IconArrowBackUp, IconArrowForwardUp, IconBold, IconClearFormatting, IconDeviceFloppy, IconDots, IconExternalLink, IconFeather, IconH1, IconH2, IconH3, IconH4, IconH5, IconH6, IconIndentDecrease, IconIndentIncrease, IconItalic, IconLetterCase, IconLetterCaseLower, IconLetterCaseUpper, IconLink, IconLinkOff, IconList, IconListCheck, IconListNumbers, IconPencil, IconPhoto, IconPilcrow, IconQuote, IconSparkles, IconStrikethrough, IconSubscript, IconSuperscript,
|
|
20
|
+
import { IconAbc, IconAlignCenter, IconAlignJustified, IconAlignLeft, IconAlignRight, IconArrowBackUp, IconArrowForwardUp, IconBold, IconClearFormatting, IconDeviceFloppy, IconDots, IconExternalLink, IconFeather, IconH1, IconH2, IconH3, IconH4, IconH5, IconH6, IconIndentDecrease, IconIndentIncrease, IconItalic, IconLetterCase, IconLetterCaseLower, IconLetterCaseUpper, IconLink, IconLinkOff, IconList, IconListCheck, IconListNumbers, IconPencil, IconPhoto, IconPilcrow, IconQuote, IconSparkles, IconStrikethrough, IconSubscript, IconSuperscript, IconTextSize, IconTypography, IconUnderline, IconWand, } from '@tabler/icons-react';
|
|
23
21
|
/** Sentinel for "no inline style": Lexical returns the default it is given when
|
|
24
22
|
* the selection has none, so this tells "unstyled" (show the canvas default)
|
|
25
23
|
* apart from "styled with a value the dropdown doesn't list" (show nothing). */
|
|
@@ -275,26 +273,6 @@ export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAU
|
|
|
275
273
|
});
|
|
276
274
|
closeImageDialog();
|
|
277
275
|
};
|
|
278
|
-
const [tableDialogOpen, setTableDialogOpen] = useState(false);
|
|
279
|
-
const openTableDialog = () => {
|
|
280
|
-
snapshotSelection();
|
|
281
|
-
setTableDialogOpen(true);
|
|
282
|
-
};
|
|
283
|
-
const closeTableDialog = () => {
|
|
284
|
-
setTableDialogOpen(false);
|
|
285
|
-
editor.focus();
|
|
286
|
-
};
|
|
287
|
-
const insertTable = ({ rows, columns, headerRow }) => {
|
|
288
|
-
const saved = menuSelectionRef.current;
|
|
289
|
-
if (saved)
|
|
290
|
-
editor.update(() => $setSelection(saved.clone()), { discrete: true });
|
|
291
|
-
editor.dispatchCommand(INSERT_TABLE_COMMAND, {
|
|
292
|
-
rows: String(rows),
|
|
293
|
-
columns: String(columns),
|
|
294
|
-
includeHeaders: { rows: headerRow, columns: false },
|
|
295
|
-
});
|
|
296
|
-
closeTableDialog();
|
|
297
|
-
};
|
|
298
276
|
/** Applies a font property per `config.font.scope`: to the selection, to
|
|
299
277
|
* every text node in the document, or (for 'both') to the selection when
|
|
300
278
|
* there is a range and to the whole document when there isn't. */
|
|
@@ -448,7 +426,7 @@ export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAU
|
|
|
448
426
|
const showFormattingGroup = headingLevels.length > 0 || config.lists.bullet || config.lists.numbered || config.lists.check || config.blocks.quote;
|
|
449
427
|
const showInlineGroup = fmt.bold || fmt.italic || fmt.underline;
|
|
450
428
|
const showAlignGroup = config.alignment.start || config.alignment.center || config.alignment.justify || config.alignment.left || config.alignment.right;
|
|
451
|
-
const showStubInsertGroup = config.images.linked || config.images.embedded || config.
|
|
429
|
+
const showStubInsertGroup = config.images.linked || config.images.embedded || config.poetry.enabled;
|
|
452
430
|
const showLanguageGroup = config.language.autocorrect || config.language.textCleanup || config.language.spellCheck;
|
|
453
431
|
// The "script & cleanup" and "indent/outdent" groups (UI spec §3.3) render
|
|
454
432
|
// as normal inline toolbar groups whenever there's room, and only move
|
|
@@ -617,7 +595,7 @@ export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAU
|
|
|
617
595
|
restoreSelection();
|
|
618
596
|
openLinkDialog();
|
|
619
597
|
}, onRemove: removeLink, strings: strings }) })] })) : (_jsx(ToolbarButton, { icon: IconLink, title: strings.toolbar.insertLink, onClick: openLinkDialog })) }, "link")),
|
|
620
|
-
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.
|
|
598
|
+
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.poetry.enabled && _jsx(StubButton, { icon: IconFeather, title: strings.toolbar.poetryBlocks, comingSoon: strings.toolbar.comingSoon })] }, "stubInsert")),
|
|
621
599
|
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")),
|
|
622
600
|
];
|
|
623
601
|
return (_jsxs("div", { className: "likhari-toolbar", role: "toolbar", "aria-label": strings.toolbar.ariaLabel, ref: toolbarContainerRef, children: [fixedGroups, movableGroups
|
|
@@ -639,5 +617,5 @@ export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAU
|
|
|
639
617
|
display: 'flex',
|
|
640
618
|
flexWrap: 'nowrap',
|
|
641
619
|
gap: 8,
|
|
642
|
-
}, 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.
|
|
620
|
+
}, 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 }))] }));
|
|
643
621
|
}
|
package/dist/i18n/strings.d.ts
CHANGED
|
@@ -40,7 +40,6 @@ export interface Strings {
|
|
|
40
40
|
linkOptions: string;
|
|
41
41
|
insertLink: string;
|
|
42
42
|
insertImage: string;
|
|
43
|
-
insertTable: string;
|
|
44
43
|
poetryBlocks: string;
|
|
45
44
|
comingSoon: (label: string) => string;
|
|
46
45
|
autocorrect: string;
|
|
@@ -89,12 +88,6 @@ export interface Strings {
|
|
|
89
88
|
invalidUrl: string;
|
|
90
89
|
apply: string;
|
|
91
90
|
};
|
|
92
|
-
tableDialog: {
|
|
93
|
-
title: string;
|
|
94
|
-
rows: string;
|
|
95
|
-
columns: string;
|
|
96
|
-
headerRow: string;
|
|
97
|
-
};
|
|
98
91
|
imageDialog: {
|
|
99
92
|
titleInsert: string;
|
|
100
93
|
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;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,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAgaD,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAI3C,CAAC;AAEF;;sDAEsD;AACtD,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAElD"}
|
package/dist/i18n/strings.js
CHANGED
|
@@ -33,7 +33,6 @@ const en = {
|
|
|
33
33
|
linkOptions: 'Link options',
|
|
34
34
|
insertLink: 'Insert link (Ctrl+K)',
|
|
35
35
|
insertImage: 'Insert image',
|
|
36
|
-
insertTable: 'Insert table',
|
|
37
36
|
poetryBlocks: 'Poetry blocks',
|
|
38
37
|
comingSoon: (label) => `${label} (coming soon)`,
|
|
39
38
|
autocorrect: 'Auto-correct',
|
|
@@ -82,12 +81,6 @@ const en = {
|
|
|
82
81
|
invalidUrl: 'Enter a valid http(s), mailto, tel or relative URL',
|
|
83
82
|
apply: 'Apply',
|
|
84
83
|
},
|
|
85
|
-
tableDialog: {
|
|
86
|
-
title: 'Insert table',
|
|
87
|
-
rows: 'Rows',
|
|
88
|
-
columns: 'Columns',
|
|
89
|
-
headerRow: 'Header row',
|
|
90
|
-
},
|
|
91
84
|
imageDialog: {
|
|
92
85
|
titleInsert: 'Insert image',
|
|
93
86
|
titleEdit: 'Edit image',
|
|
@@ -176,7 +169,6 @@ const ur = {
|
|
|
176
169
|
linkOptions: 'لنک کے اختیارات',
|
|
177
170
|
insertLink: 'لنک شامل کریں (Ctrl+K)',
|
|
178
171
|
insertImage: 'تصویر شامل کریں',
|
|
179
|
-
insertTable: 'جدول شامل کریں',
|
|
180
172
|
poetryBlocks: 'شاعری کے بلاکس',
|
|
181
173
|
comingSoon: (label) => `${label} (جلد آ رہا ہے)`,
|
|
182
174
|
autocorrect: 'خودکار تصحیح',
|
|
@@ -225,12 +217,6 @@ const ur = {
|
|
|
225
217
|
invalidUrl: 'براہِ کرم ایک درست http(s)، mailto، tel یا رشتہ دار یو آر ایل درج کریں',
|
|
226
218
|
apply: 'لاگو کریں',
|
|
227
219
|
},
|
|
228
|
-
tableDialog: {
|
|
229
|
-
title: 'جدول شامل کریں',
|
|
230
|
-
rows: 'قطاریں',
|
|
231
|
-
columns: 'کالم',
|
|
232
|
-
headerRow: 'سرِ فہرست قطار',
|
|
233
|
-
},
|
|
234
220
|
imageDialog: {
|
|
235
221
|
titleInsert: 'تصویر شامل کریں',
|
|
236
222
|
titleEdit: 'تصویر میں ترمیم کریں',
|
|
@@ -319,7 +305,6 @@ const paShahmukhi = {
|
|
|
319
305
|
linkOptions: 'لنک دے اختیار',
|
|
320
306
|
insertLink: 'لنک پاؤ (Ctrl+K)',
|
|
321
307
|
insertImage: 'تصویر پاؤ',
|
|
322
|
-
insertTable: 'ٹیبل پاؤ',
|
|
323
308
|
poetryBlocks: 'شاعری بلاک',
|
|
324
309
|
comingSoon: (label) => `${label} (چھیتی آ رہا اے)`,
|
|
325
310
|
autocorrect: 'خودکار درستی',
|
|
@@ -368,12 +353,6 @@ const paShahmukhi = {
|
|
|
368
353
|
invalidUrl: 'کِرپا کر کے صحیح http(s)، mailto، tel یا نسبتی یو آر ایل پاؤ',
|
|
369
354
|
apply: 'لاگو کرو',
|
|
370
355
|
},
|
|
371
|
-
tableDialog: {
|
|
372
|
-
title: 'ٹیبل پاؤ',
|
|
373
|
-
rows: 'قطاراں',
|
|
374
|
-
columns: 'کالم',
|
|
375
|
-
headerRow: 'سرکڑی قطار',
|
|
376
|
-
},
|
|
377
356
|
imageDialog: {
|
|
378
357
|
titleInsert: 'تصویر پاؤ',
|
|
379
358
|
titleEdit: 'تصویر وچ تبدیلی کرو',
|
package/dist/nodes.d.ts.map
CHANGED
|
@@ -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;
|
|
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
|
];
|
package/dist/theme/editor.css
CHANGED
|
@@ -253,37 +253,6 @@
|
|
|
253
253
|
margin: 1.5em 0;
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
/* Tables — cell merge/split is deliberately out of scope for now (a flagged
|
|
257
|
-
open risk, lexical-editor-spec.md §12 item 3, needing its own scope
|
|
258
|
-
decision); TablePlugin is configured with hasCellMerge={false} to keep
|
|
259
|
-
every table a plain grid until that's resolved. */
|
|
260
|
-
.likhari-table {
|
|
261
|
-
border-collapse: collapse;
|
|
262
|
-
margin: 1em 0;
|
|
263
|
-
width: 100%;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
.likhari-table-row {
|
|
267
|
-
border-bottom: 1px solid var(--editor-line);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
.likhari-table-cell {
|
|
271
|
-
border: 1px solid var(--editor-line);
|
|
272
|
-
padding: 6px 10px;
|
|
273
|
-
min-width: 72px;
|
|
274
|
-
vertical-align: top;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
.likhari-table-cell-header {
|
|
278
|
-
background: var(--editor-paper-dim);
|
|
279
|
-
font-weight: 600;
|
|
280
|
-
text-align: start;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
.likhari-table-cell-selected {
|
|
284
|
-
background: var(--editor-accent-soft);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
256
|
/* Images — block-level figure; the caption is static text (edited in the
|
|
288
257
|
image's dialog), and a selected image gets a corner resize handle. */
|
|
289
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,
|
|
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.7
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "React implementation of the Likhari editor, built on @lexical/react.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
"@lexical/react": "^0.20.0",
|
|
38
38
|
"@lexical/rich-text": "^0.20.0",
|
|
39
39
|
"@lexical/selection": "^0.20.0",
|
|
40
|
-
"@lexical/table": "^0.20.0",
|
|
41
40
|
"@lexical/utils": "^0.20.0",
|
|
42
41
|
"@inshapardaz/likhari-converters": "^0.1.0",
|
|
43
42
|
"@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
|
-
}
|