@inshapardaz/likhari-react 0.1.18-dev.162 → 0.1.18-dev.167
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/components/FindReplaceBar.d.ts +12 -0
- package/dist/components/FindReplaceBar.d.ts.map +1 -0
- package/dist/components/FindReplaceBar.js +71 -0
- package/dist/components/Toolbar.d.ts.map +1 -1
- package/dist/components/Toolbar.js +5 -3
- package/dist/find/findReplaceActions.d.ts +23 -0
- package/dist/find/findReplaceActions.d.ts.map +1 -0
- package/dist/find/findReplaceActions.js +81 -0
- package/dist/i18n/strings.d.ts +13 -0
- package/dist/i18n/strings.d.ts.map +1 -1
- package/dist/i18n/strings.js +39 -0
- package/dist/theme/editor.css +70 -0
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Strings } from '../i18n/strings.js';
|
|
2
|
+
/**
|
|
3
|
+
* A compact find widget, right-aligned above the canvas (VS Code style). The
|
|
4
|
+
* first row is search; a chevron reveals the second row for replace. Typing
|
|
5
|
+
* only counts matches — the editor's selection moves to a match only when the
|
|
6
|
+
* user asks (next, previous, replace), so typing keeps going into the bar.
|
|
7
|
+
*/
|
|
8
|
+
export declare function FindReplaceBar({ strings, onClose }: {
|
|
9
|
+
strings: Strings;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=FindReplaceBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FindReplaceBar.d.ts","sourceRoot":"","sources":["../../src/components/FindReplaceBar.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG/C;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,+BAyH7F"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
4
|
+
import { IconChevronDown, IconChevronRight, IconX } from '@tabler/icons-react';
|
|
5
|
+
import { $findMatches, $replaceAll, $replaceMatch, $selectMatch } from '../find/findReplaceActions.js';
|
|
6
|
+
/**
|
|
7
|
+
* A compact find widget, right-aligned above the canvas (VS Code style). The
|
|
8
|
+
* first row is search; a chevron reveals the second row for replace. Typing
|
|
9
|
+
* only counts matches — the editor's selection moves to a match only when the
|
|
10
|
+
* user asks (next, previous, replace), so typing keeps going into the bar.
|
|
11
|
+
*/
|
|
12
|
+
export function FindReplaceBar({ strings, onClose }) {
|
|
13
|
+
const [editor] = useLexicalComposerContext();
|
|
14
|
+
const t = strings.findReplace;
|
|
15
|
+
const [query, setQuery] = useState('');
|
|
16
|
+
const [replacement, setReplacement] = useState('');
|
|
17
|
+
const [showReplace, setShowReplace] = useState(false);
|
|
18
|
+
const [index, setIndex] = useState(0);
|
|
19
|
+
const [count, setCount] = useState(0);
|
|
20
|
+
const findInput = useRef(null);
|
|
21
|
+
// Runs `action` against the current matches inside a committed update, then
|
|
22
|
+
// syncs the count and index. Selecting a match is up to the action, so
|
|
23
|
+
// typing never moves the editor's selection.
|
|
24
|
+
const run = (action) => {
|
|
25
|
+
let result = { nextIndex: 0, matches: [], select: false };
|
|
26
|
+
editor.update(() => {
|
|
27
|
+
result = action($findMatches(query));
|
|
28
|
+
const match = result.matches[result.nextIndex];
|
|
29
|
+
if (result.select && match)
|
|
30
|
+
$selectMatch(match);
|
|
31
|
+
}, { discrete: true });
|
|
32
|
+
setCount(result.matches.length);
|
|
33
|
+
setIndex(result.nextIndex);
|
|
34
|
+
const match = result.matches[result.nextIndex];
|
|
35
|
+
if (result.select && match) {
|
|
36
|
+
editor.getElementByKey(match.anchorKey)?.scrollIntoView({ block: 'center' });
|
|
37
|
+
findInput.current?.focus();
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
run((matches) => ({ nextIndex: 0, matches, select: false }));
|
|
42
|
+
// Re-count when the query changes; `run` closes over it.
|
|
43
|
+
}, [query]);
|
|
44
|
+
const step = (delta) => run((matches) => ({
|
|
45
|
+
matches,
|
|
46
|
+
nextIndex: matches.length === 0 ? 0 : (index + delta + matches.length) % matches.length,
|
|
47
|
+
select: true,
|
|
48
|
+
}));
|
|
49
|
+
const replaceCurrent = () => run((matches) => {
|
|
50
|
+
const match = matches[index];
|
|
51
|
+
if (match)
|
|
52
|
+
$replaceMatch(match, replacement);
|
|
53
|
+
const after = $findMatches(query);
|
|
54
|
+
return { matches: after, nextIndex: Math.min(index, Math.max(0, after.length - 1)), select: true };
|
|
55
|
+
});
|
|
56
|
+
const replaceEverything = () => run(() => {
|
|
57
|
+
$replaceAll(query, replacement);
|
|
58
|
+
return { matches: $findMatches(query), nextIndex: 0, select: false };
|
|
59
|
+
});
|
|
60
|
+
const status = query === '' ? '' : count === 0 ? t.noMatches : `${index + 1} / ${count}`;
|
|
61
|
+
const Chevron = showReplace ? IconChevronDown : IconChevronRight;
|
|
62
|
+
return (_jsxs("div", { className: "likhari-find-widget", role: "search", children: [_jsxs("div", { className: "likhari-find-row", children: [_jsx("button", { type: "button", className: "likhari-find-icon", onClick: () => setShowReplace((v) => !v), "aria-label": t.replace, "aria-expanded": showReplace, title: t.replace, children: _jsx(Chevron, { size: 14, stroke: 1.75 }) }), _jsx("input", { ref: findInput, "aria-label": t.find, placeholder: t.findPlaceholder, value: query, onChange: (e) => setQuery(e.target.value), onKeyDown: (e) => {
|
|
63
|
+
if (e.key === 'Enter')
|
|
64
|
+
step(e.shiftKey ? -1 : 1);
|
|
65
|
+
if (e.key === 'Escape')
|
|
66
|
+
onClose();
|
|
67
|
+
}, autoFocus: true }), _jsx("span", { className: "likhari-find-status", "aria-live": "polite", children: status }), _jsx("button", { type: "button", className: "likhari-find-icon", onClick: () => step(-1), disabled: count === 0, "aria-label": t.previous, title: t.previous, children: _jsx(IconChevronDown, { size: 14, stroke: 1.75, style: { transform: 'rotate(180deg)' } }) }), _jsx("button", { type: "button", className: "likhari-find-icon", onClick: () => step(1), disabled: count === 0, "aria-label": t.next, title: t.next, children: _jsx(IconChevronDown, { size: 14, stroke: 1.75 }) }), _jsx("button", { type: "button", className: "likhari-find-icon", onClick: onClose, "aria-label": t.close, title: t.close, children: _jsx(IconX, { size: 14, stroke: 1.75 }) })] }), showReplace && (_jsxs("div", { className: "likhari-find-row", children: [_jsx("span", { className: "likhari-find-icon-spacer", "aria-hidden": "true" }), _jsx("input", { "aria-label": t.replace, placeholder: t.replacePlaceholder, value: replacement, onChange: (e) => setReplacement(e.target.value), onKeyDown: (e) => {
|
|
68
|
+
if (e.key === 'Enter' && count > 0)
|
|
69
|
+
replaceCurrent();
|
|
70
|
+
} }), _jsx("button", { type: "button", onClick: replaceCurrent, disabled: count === 0, children: t.replaceOne }), _jsx("button", { type: "button", onClick: replaceEverything, disabled: count === 0, children: t.replaceAll })] }))] }));
|
|
71
|
+
}
|
|
@@ -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":"AAsFA,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;AA+gBvD,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,+BAwkCxJ"}
|
|
@@ -8,6 +8,7 @@ import { $createParagraphNode } from 'lexical';
|
|
|
8
8
|
import { $createHeadingNode, $createQuoteNode, $isHeadingNode, $isQuoteNode } from '@lexical/rich-text';
|
|
9
9
|
import { $isListNode, INSERT_CHECK_LIST_COMMAND, INSERT_ORDERED_LIST_COMMAND, INSERT_UNORDERED_LIST_COMMAND, REMOVE_LIST_COMMAND, } from '@lexical/list';
|
|
10
10
|
import { $findMatchingParent, $insertNodeToNearestRoot } from '@lexical/utils';
|
|
11
|
+
import { FindReplaceBar } from './FindReplaceBar.js';
|
|
11
12
|
import { INSERT_HORIZONTAL_RULE_COMMAND } from '@lexical/react/LexicalHorizontalRuleNode';
|
|
12
13
|
import { ImageDialog } from '../image/ImageDialog.js';
|
|
13
14
|
import { $createImageNode } from '../image/ImageNode.js';
|
|
@@ -29,7 +30,7 @@ import { CANVAS_FONT_DEFAULTS, DEFAULT_FONT_OPTIONS, FONT_SIZES_PX } from '../fo
|
|
|
29
30
|
import { setStyleProperty } from '../utils/style.js';
|
|
30
31
|
import { useStrings } from '../i18n/useStrings.js';
|
|
31
32
|
import { usePortalTarget } from '../PortalTargetContext.js';
|
|
32
|
-
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, IconArrowsMaximize, IconArrowsMinimize, IconArrowsShuffle, IconTable, IconTableMinus, IconTrash, IconTableOptions, IconTextSize, IconTypography, IconUnderline, IconWand, } from '@tabler/icons-react';
|
|
33
|
+
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, IconSearch, IconColumns1, IconColumns2, IconNumber1Small, IconRowInsertBottom, IconRowInsertTop, IconRowRemove, IconArrowsMaximize, IconArrowsMinimize, IconArrowsShuffle, IconTable, IconTableMinus, IconTrash, IconTableOptions, IconTextSize, IconTypography, IconUnderline, IconWand, } from '@tabler/icons-react';
|
|
33
34
|
/** Sentinel for "no inline style": Lexical returns the default it is given when
|
|
34
35
|
* the selection has none, so this tells "unstyled" (show the canvas default)
|
|
35
36
|
* apart from "styled with a value the dropdown doesn't list" (show nothing). */
|
|
@@ -385,6 +386,7 @@ export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAU
|
|
|
385
386
|
closeTableDialog();
|
|
386
387
|
};
|
|
387
388
|
const [layoutDialogOpen, setLayoutDialogOpen] = useState(false);
|
|
389
|
+
const [findOpen, setFindOpen] = useState(false);
|
|
388
390
|
const openLayoutDialog = () => {
|
|
389
391
|
snapshotSelection();
|
|
390
392
|
setLayoutDialogOpen(true);
|
|
@@ -808,7 +810,7 @@ export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAU
|
|
|
808
810
|
restoreSelection();
|
|
809
811
|
openLinkDialog();
|
|
810
812
|
}, onRemove: removeLink, strings: strings }) })] })) : (_jsx(ToolbarButton, { icon: IconLink, title: strings.toolbar.insertLink, onClick: openLinkDialog })) }, "link")),
|
|
811
|
-
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 && locale !== 'en' && (_jsx(ToolbarButton, { icon: IconFeather, title: strings.toolbar.insertPoetryCouplet, onClick: () => editor.dispatchCommand(INSERT_POETRY_COUPLET_COMMAND, { layout: config.poetry.defaultLayout }) }))] }, "stubInsert")),
|
|
813
|
+
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.findReplace && (_jsx(ToolbarButton, { icon: IconSearch, title: strings.findReplace.toggle, active: findOpen, onClick: () => setFindOpen((v) => !v) })), config.poetry.enabled && locale !== 'en' && (_jsx(ToolbarButton, { icon: IconFeather, title: strings.toolbar.insertPoetryCouplet, onClick: () => editor.dispatchCommand(INSERT_POETRY_COUPLET_COMMAND, { layout: config.poetry.defaultLayout }) }))] }, "stubInsert")),
|
|
812
814
|
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: runMenuAction }) })] }) }, "tableActions")),
|
|
813
815
|
config.poetry.enabled && state.inPoetry && (_jsx("div", { className: "likhari-toolbar-group", children: _jsxs(Menu, { position: "bottom-start", withinPortal: true, portalProps: { target: portalTarget }, shadow: "sm", width: 200, 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.poetryOptions, title: strings.toolbar.poetryOptions, onMouseDown: (e) => e.preventDefault(), children: _jsx(IconFeather, { size: ICON_SIZE, stroke: ICON_STROKE }) }) }), _jsx(Menu.Dropdown, { children: _jsx(PoetryMenuItems, { strings: strings, layout: state.poetryLayout, scale: state.poetryScale, centered: state.poetryCentered, onAction: runMenuAction }) })] }) }, "poetryActions")),
|
|
814
816
|
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")),
|
|
@@ -838,5 +840,5 @@ export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAU
|
|
|
838
840
|
display: 'flex',
|
|
839
841
|
flexWrap: 'nowrap',
|
|
840
842
|
gap: 8,
|
|
841
|
-
}, 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 })] }));
|
|
843
|
+
}, 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.findReplace && findOpen && _jsx(FindReplaceBar, { strings: strings, onClose: () => setFindOpen(false) }), 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 })] }));
|
|
842
844
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** A match as a Lexical selection range: start and end points, each in a text node. */
|
|
2
|
+
export interface FindMatch {
|
|
3
|
+
anchorKey: string;
|
|
4
|
+
anchorOffset: number;
|
|
5
|
+
focusKey: string;
|
|
6
|
+
focusOffset: number;
|
|
7
|
+
}
|
|
8
|
+
/** Every non-overlapping occurrence of `query` in the document, case-sensitive. */
|
|
9
|
+
export declare function $findMatches(query: string): FindMatch[];
|
|
10
|
+
/** Makes the match the editor's selection, so it's highlighted and scrolled to. */
|
|
11
|
+
export declare function $selectMatch(match: FindMatch): void;
|
|
12
|
+
/**
|
|
13
|
+
* Replaces one match, keeping the formatting of the text around it. The
|
|
14
|
+
* replacement takes the formatting of the match's first character.
|
|
15
|
+
*/
|
|
16
|
+
export declare function $replaceMatch(match: FindMatch, replacement: string): void;
|
|
17
|
+
/**
|
|
18
|
+
* Replaces every match. Walks from the last match to the first, so each
|
|
19
|
+
* replacement leaves the positions of the matches before it unchanged.
|
|
20
|
+
* Returns how many were replaced.
|
|
21
|
+
*/
|
|
22
|
+
export declare function $replaceAll(query: string, replacement: string): number;
|
|
23
|
+
//# sourceMappingURL=findReplaceActions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findReplaceActions.d.ts","sourceRoot":"","sources":["../../src/find/findReplaceActions.ts"],"names":[],"mappings":"AAEA,uFAAuF;AACvF,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB;AAgCD,mFAAmF;AACnF,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,CAcvD;AAED,mFAAmF;AACnF,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAKnD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAMzE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAItE"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { $createRangeSelection, $getRoot, $getSelection, $isRangeSelection, $setSelection } from 'lexical';
|
|
2
|
+
/**
|
|
3
|
+
* Text nodes grouped by their parent, in document order. A match is searched
|
|
4
|
+
* for within one parent only, so it never spans two paragraphs or table
|
|
5
|
+
* cells, but it can span the several text nodes that formatting splits a
|
|
6
|
+
* paragraph into.
|
|
7
|
+
*/
|
|
8
|
+
function $textGroups() {
|
|
9
|
+
const groups = new Map();
|
|
10
|
+
for (const node of $getRoot().getAllTextNodes()) {
|
|
11
|
+
const parentKey = node.getParentOrThrow().getKey();
|
|
12
|
+
const group = groups.get(parentKey);
|
|
13
|
+
if (group)
|
|
14
|
+
group.push(node);
|
|
15
|
+
else
|
|
16
|
+
groups.set(parentKey, [node]);
|
|
17
|
+
}
|
|
18
|
+
return [...groups.values()];
|
|
19
|
+
}
|
|
20
|
+
/** The text node and offset that a character index in a group falls in. */
|
|
21
|
+
function $locate(group, index, end) {
|
|
22
|
+
let start = 0;
|
|
23
|
+
for (const node of group) {
|
|
24
|
+
const length = node.getTextContent().length;
|
|
25
|
+
const inside = end ? index > start && index <= start + length : index >= start && index < start + length;
|
|
26
|
+
if (inside)
|
|
27
|
+
return { key: node.getKey(), offset: index - start };
|
|
28
|
+
start += length;
|
|
29
|
+
}
|
|
30
|
+
const last = group[group.length - 1];
|
|
31
|
+
return { key: last.getKey(), offset: last.getTextContent().length };
|
|
32
|
+
}
|
|
33
|
+
/** Every non-overlapping occurrence of `query` in the document, case-sensitive. */
|
|
34
|
+
export function $findMatches(query) {
|
|
35
|
+
if (query === '')
|
|
36
|
+
return [];
|
|
37
|
+
const matches = [];
|
|
38
|
+
for (const group of $textGroups()) {
|
|
39
|
+
const text = group.map((node) => node.getTextContent()).join('');
|
|
40
|
+
let index = text.indexOf(query);
|
|
41
|
+
while (index !== -1) {
|
|
42
|
+
const start = $locate(group, index, false);
|
|
43
|
+
const end = $locate(group, index + query.length, true);
|
|
44
|
+
matches.push({ anchorKey: start.key, anchorOffset: start.offset, focusKey: end.key, focusOffset: end.offset });
|
|
45
|
+
index = text.indexOf(query, index + query.length);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return matches;
|
|
49
|
+
}
|
|
50
|
+
/** Makes the match the editor's selection, so it's highlighted and scrolled to. */
|
|
51
|
+
export function $selectMatch(match) {
|
|
52
|
+
const selection = $createRangeSelection();
|
|
53
|
+
selection.anchor.set(match.anchorKey, match.anchorOffset, 'text');
|
|
54
|
+
selection.focus.set(match.focusKey, match.focusOffset, 'text');
|
|
55
|
+
$setSelection(selection);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Replaces one match, keeping the formatting of the text around it. The
|
|
59
|
+
* replacement takes the formatting of the match's first character.
|
|
60
|
+
*/
|
|
61
|
+
export function $replaceMatch(match, replacement) {
|
|
62
|
+
$selectMatch(match);
|
|
63
|
+
const selection = $getSelection();
|
|
64
|
+
if (!$isRangeSelection(selection))
|
|
65
|
+
return;
|
|
66
|
+
if (replacement === '')
|
|
67
|
+
selection.removeText();
|
|
68
|
+
else
|
|
69
|
+
selection.insertText(replacement);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Replaces every match. Walks from the last match to the first, so each
|
|
73
|
+
* replacement leaves the positions of the matches before it unchanged.
|
|
74
|
+
* Returns how many were replaced.
|
|
75
|
+
*/
|
|
76
|
+
export function $replaceAll(query, replacement) {
|
|
77
|
+
const matches = $findMatches(query);
|
|
78
|
+
for (let i = matches.length - 1; i >= 0; i--)
|
|
79
|
+
$replaceMatch(matches[i], replacement);
|
|
80
|
+
return matches.length;
|
|
81
|
+
}
|
package/dist/i18n/strings.d.ts
CHANGED
|
@@ -156,6 +156,19 @@ export interface Strings {
|
|
|
156
156
|
deleteCouplet: string;
|
|
157
157
|
deletePoetry: string;
|
|
158
158
|
};
|
|
159
|
+
findReplace: {
|
|
160
|
+
toggle: string;
|
|
161
|
+
find: string;
|
|
162
|
+
replace: string;
|
|
163
|
+
findPlaceholder: string;
|
|
164
|
+
replacePlaceholder: string;
|
|
165
|
+
previous: string;
|
|
166
|
+
next: string;
|
|
167
|
+
replaceOne: string;
|
|
168
|
+
replaceAll: string;
|
|
169
|
+
noMatches: string;
|
|
170
|
+
close: string;
|
|
171
|
+
};
|
|
159
172
|
link: {
|
|
160
173
|
menuLabel: string;
|
|
161
174
|
noUrl: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/i18n/strings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;+DAC+D;AAC/D,MAAM,MAAM,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,cAAc,CAAC;AAElD,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE;QACN,mGAAmG;QACnG,WAAW,EAAE,MAAM,CAAC;QACpB,gDAAgD;QAChD,YAAY,EAAE,MAAM,CAAC;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,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,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MAAM,GAAG,OAAO,CAElD"}
|
package/dist/i18n/strings.js
CHANGED
|
@@ -139,6 +139,19 @@ const en = {
|
|
|
139
139
|
deleteCouplet: 'Delete couplet',
|
|
140
140
|
deletePoetry: 'Delete poetry',
|
|
141
141
|
},
|
|
142
|
+
findReplace: {
|
|
143
|
+
toggle: 'Find and replace',
|
|
144
|
+
find: 'Find',
|
|
145
|
+
replace: 'Replace',
|
|
146
|
+
findPlaceholder: 'Text to find',
|
|
147
|
+
replacePlaceholder: 'Replacement text',
|
|
148
|
+
previous: 'Previous',
|
|
149
|
+
next: 'Next',
|
|
150
|
+
replaceOne: 'Replace',
|
|
151
|
+
replaceAll: 'Replace all',
|
|
152
|
+
noMatches: 'No matches',
|
|
153
|
+
close: 'Close',
|
|
154
|
+
},
|
|
142
155
|
link: {
|
|
143
156
|
menuLabel: 'Link',
|
|
144
157
|
noUrl: '(no URL)',
|
|
@@ -359,6 +372,19 @@ const ur = {
|
|
|
359
372
|
deleteCouplet: 'شعر حذف کریں',
|
|
360
373
|
deletePoetry: 'پوری شاعری حذف کریں',
|
|
361
374
|
},
|
|
375
|
+
findReplace: {
|
|
376
|
+
toggle: 'تلاش اور تبدیلی',
|
|
377
|
+
find: 'تلاش کریں',
|
|
378
|
+
replace: 'تبدیل کریں',
|
|
379
|
+
findPlaceholder: 'جو متن تلاش کرنا ہے',
|
|
380
|
+
replacePlaceholder: 'تبدیل کرنے کا متن',
|
|
381
|
+
previous: 'پچھلا',
|
|
382
|
+
next: 'اگلا',
|
|
383
|
+
replaceOne: 'تبدیل کریں',
|
|
384
|
+
replaceAll: 'سب تبدیل کریں',
|
|
385
|
+
noMatches: 'کوئی میچ نہیں',
|
|
386
|
+
close: 'بند کریں',
|
|
387
|
+
},
|
|
362
388
|
link: {
|
|
363
389
|
menuLabel: 'لنک',
|
|
364
390
|
noUrl: '(کوئی یو آر ایل نہیں)',
|
|
@@ -579,6 +605,19 @@ const paShahmukhi = {
|
|
|
579
605
|
deleteCouplet: 'شعر مٹاؤ',
|
|
580
606
|
deletePoetry: 'ساری شاعری مٹاؤ',
|
|
581
607
|
},
|
|
608
|
+
findReplace: {
|
|
609
|
+
toggle: 'لبھو تے بدلو',
|
|
610
|
+
find: 'لبھo',
|
|
611
|
+
replace: 'بدلo',
|
|
612
|
+
findPlaceholder: 'جو لبھنا اے',
|
|
613
|
+
replacePlaceholder: 'بدلن والا متن',
|
|
614
|
+
previous: 'پچھلا',
|
|
615
|
+
next: 'اگلا',
|
|
616
|
+
replaceOne: 'بدلo',
|
|
617
|
+
replaceAll: 'سارے بدلo',
|
|
618
|
+
noMatches: 'کوئی ملدا نئیں',
|
|
619
|
+
close: 'بند کرo',
|
|
620
|
+
},
|
|
582
621
|
link: {
|
|
583
622
|
menuLabel: 'لنک',
|
|
584
623
|
noUrl: '(کوئی یو آر ایل نئیں)',
|
package/dist/theme/editor.css
CHANGED
|
@@ -755,3 +755,73 @@
|
|
|
755
755
|
outline: 2px solid var(--editor-accent);
|
|
756
756
|
outline-offset: 1px;
|
|
757
757
|
}
|
|
758
|
+
|
|
759
|
+
/* A compact widget, sized to its controls and pushed to the inline end — not a
|
|
760
|
+
full-width bar. margin-inline-start: auto works in block and flex parents. */
|
|
761
|
+
.likhari-find-widget {
|
|
762
|
+
display: flex;
|
|
763
|
+
flex-direction: column;
|
|
764
|
+
gap: 6px;
|
|
765
|
+
width: fit-content;
|
|
766
|
+
margin-inline: auto 10px;
|
|
767
|
+
margin-block: 6px;
|
|
768
|
+
padding: 6px;
|
|
769
|
+
border: 1px solid var(--editor-line);
|
|
770
|
+
border-radius: 6px;
|
|
771
|
+
background: var(--editor-paper-dim);
|
|
772
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
|
|
773
|
+
font-size: 13px;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
.likhari-find-row {
|
|
777
|
+
display: flex;
|
|
778
|
+
align-items: center;
|
|
779
|
+
justify-content: flex-end;
|
|
780
|
+
gap: 4px;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
.likhari-find-widget input {
|
|
784
|
+
width: 180px;
|
|
785
|
+
padding: 3px 6px;
|
|
786
|
+
border: 1px solid var(--editor-line);
|
|
787
|
+
border-radius: 4px;
|
|
788
|
+
background: var(--editor-paper);
|
|
789
|
+
color: inherit;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
.likhari-find-widget button {
|
|
793
|
+
padding: 2px 8px;
|
|
794
|
+
border: 1px solid var(--editor-line);
|
|
795
|
+
border-radius: 4px;
|
|
796
|
+
background: transparent;
|
|
797
|
+
color: inherit;
|
|
798
|
+
cursor: pointer;
|
|
799
|
+
white-space: nowrap;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
.likhari-find-widget button:disabled {
|
|
803
|
+
opacity: 0.5;
|
|
804
|
+
cursor: default;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
.likhari-find-widget .likhari-find-icon {
|
|
808
|
+
display: inline-flex;
|
|
809
|
+
align-items: center;
|
|
810
|
+
justify-content: center;
|
|
811
|
+
width: 24px;
|
|
812
|
+
height: 24px;
|
|
813
|
+
padding: 0;
|
|
814
|
+
border: none;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
.likhari-find-icon-spacer {
|
|
818
|
+
display: inline-block;
|
|
819
|
+
width: 24px;
|
|
820
|
+
flex: 0 0 24px;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
.likhari-find-status {
|
|
824
|
+
min-width: 56px;
|
|
825
|
+
text-align: end;
|
|
826
|
+
opacity: 0.8;
|
|
827
|
+
}
|