@inshapardaz/likhari-react 0.1.25-dev.234 → 0.1.25-dev.237
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 +3 -0
- package/dist/EditorRoot.d.ts.map +1 -1
- package/dist/EditorRoot.js +5 -2
- package/dist/components/Toolbar.d.ts +4 -1
- package/dist/components/Toolbar.d.ts.map +1 -1
- package/dist/components/Toolbar.js +22 -6
- package/dist/i18n/strings.d.ts +5 -0
- package/dist/i18n/strings.d.ts.map +1 -1
- package/dist/i18n/strings.js +15 -0
- package/dist/thesaurus/thesaurusStores.d.ts +45 -0
- package/dist/thesaurus/thesaurusStores.d.ts.map +1 -0
- package/dist/thesaurus/thesaurusStores.js +131 -0
- package/package.json +1 -1
package/dist/EditorRoot.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { type DraftRestoreMode } from './components/DraftRestore.js';
|
|
|
7
7
|
import { type AutoCorrectStore } from './autocorrect/autoCorrectStores.js';
|
|
8
8
|
import type { UrduNormalizationOptions } from './normalization/urduNormalize.js';
|
|
9
9
|
import type { PunctuationOptions } from './autocorrect/punctuationRules.js';
|
|
10
|
+
import { type ThesaurusStore } from './thesaurus/thesaurusStores.js';
|
|
10
11
|
import { type CompletionStore } from './autocomplete/completionStores.js';
|
|
11
12
|
import { type UserWordStore } from './spellcheck/userWords.js';
|
|
12
13
|
import type { SpellLanguage } from './spellcheck/spellDictionaries.js';
|
|
@@ -25,6 +26,8 @@ export interface EditorRootProps {
|
|
|
25
26
|
dictionaryStores?: UserWordStore[];
|
|
26
27
|
/** Where autocomplete words come from, combined per language. Defaults to the dictionaries and the user's words. Pass a stable array. */
|
|
27
28
|
completionStores?: CompletionStore[];
|
|
29
|
+
/** Where synonyms come from, merged in order. Defaults to English WordNet. Pass a stable array. */
|
|
30
|
+
thesaurusStores?: ThesaurusStore[];
|
|
28
31
|
/** The language autocomplete works in: 'auto' follows each block's direction (English for LTR, Urdu for RTL). */
|
|
29
32
|
autoCompleteLanguage?: SpellLanguage | 'auto';
|
|
30
33
|
/** Urdu normalisation applied as part of auto-correct. Diacritics are kept unless `removeDiacritics` is set. */
|
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;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;AAOjE,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAIhF,OAAO,EAAgC,KAAK,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACtG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,OAAO,EAA6B,KAAK,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClG,OAAO,EAA4C,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACtG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAYpE,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;
|
|
1
|
+
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;;;OASG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC;;;;;;;;;;;;;;;OAeG;IACH,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACtC,uGAAuG;IACvG,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC3E,6EAA6E;IAC7E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,SAAS;IACxB,UAAU,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,CAAC;IACrC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAC;IAClD,iBAAiB,IAAI,OAAO,CAAC;IAC7B,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC,KAAK,IAAI,IAAI,CAAC;CACf;AAQD,eAAO,MAAM,UAAU,uGAybrB,CAAC"}
|
package/dist/EditorRoot.js
CHANGED
|
@@ -33,6 +33,7 @@ import { localStorageAutoCorrectStore } from './autocorrect/autoCorrectStores.js
|
|
|
33
33
|
import { SpellcheckPanel } from './components/SpellcheckPanel.js';
|
|
34
34
|
import { SpellHighlightPlugin } from './spellcheck/SpellHighlightPlugin.js';
|
|
35
35
|
import { AutocompletePlugin } from './autocomplete/AutocompletePlugin.js';
|
|
36
|
+
import { wordNetThesaurusStore } from './thesaurus/thesaurusStores.js';
|
|
36
37
|
import { dictionaryCompletionStore } from './autocomplete/completionStores.js';
|
|
37
38
|
import { loadUserWords, localStorageUserWordStore } from './spellcheck/userWords.js';
|
|
38
39
|
import { LeaveDialog } from './components/LeaveDialog.js';
|
|
@@ -45,6 +46,8 @@ const DEFAULT_AUTOSAVE_MAX_BYTES = 2000000;
|
|
|
45
46
|
const DEFAULT_AUTOSAVE_MAX_DRAFTS = 20;
|
|
46
47
|
/** Used when the host passes no stores: corrections are kept in this browser. */
|
|
47
48
|
const DEFAULT_AUTOCORRECT_STORES = [localStorageAutoCorrectStore()];
|
|
49
|
+
/** Used when the host passes no thesaurus stores: English synonyms from WordNet, loaded on first use. */
|
|
50
|
+
const DEFAULT_THESAURUS_STORES = [wordNetThesaurusStore()];
|
|
48
51
|
/** Used when the host passes no completion stores: the dictionary's words and the user's added words. */
|
|
49
52
|
const DEFAULT_COMPLETION_STORES = [dictionaryCompletionStore()];
|
|
50
53
|
/** Used when the host passes no dictionary stores: added words are kept in this browser. */
|
|
@@ -55,7 +58,7 @@ function initialEditorStateJson(initialContent) {
|
|
|
55
58
|
const state = defaultFormatRegistry.parse(initialContent.format, initialContent.value);
|
|
56
59
|
return JSON.stringify(state);
|
|
57
60
|
}
|
|
58
|
-
export const EditorRoot = forwardRef(function EditorRoot({ documentId, autoCorrectStores, dictionaryStores, completionStores, autoCompleteLanguage = 'auto', urduNormalization, punctuation, initialContent, featureConfig, featurePreset, theme, colorScheme, accentColor, locale = 'en', placeholder, height = '480px', onChange, onSave, showSave = Boolean(onSave), onImageUpload, fetchImage, fontOptions, autosave = true, restoreDraft = 'prompt', navigationGuard = 'confirm', onDraftRestored, autosaveDelayMs = DEFAULT_AUTOSAVE_DELAY_MS, autosaveMaxBytes = DEFAULT_AUTOSAVE_MAX_BYTES, autosaveMaxDrafts = DEFAULT_AUTOSAVE_MAX_DRAFTS, }, ref) {
|
|
61
|
+
export const EditorRoot = forwardRef(function EditorRoot({ documentId, autoCorrectStores, dictionaryStores, completionStores, thesaurusStores, autoCompleteLanguage = 'auto', urduNormalization, punctuation, initialContent, featureConfig, featurePreset, theme, colorScheme, accentColor, locale = 'en', placeholder, height = '480px', onChange, onSave, showSave = Boolean(onSave), onImageUpload, fetchImage, fontOptions, autosave = true, restoreDraft = 'prompt', navigationGuard = 'confirm', onDraftRestored, autosaveDelayMs = DEFAULT_AUTOSAVE_DELAY_MS, autosaveMaxBytes = DEFAULT_AUTOSAVE_MAX_BYTES, autosaveMaxDrafts = DEFAULT_AUTOSAVE_MAX_DRAFTS, }, ref) {
|
|
59
62
|
const config = useMemo(() => resolveFeatureConfig(featureConfig, featurePreset), [featureConfig, featurePreset]);
|
|
60
63
|
const strings = useMemo(() => getStrings(locale), [locale]);
|
|
61
64
|
const resolvedPlaceholder = placeholder ?? strings.editor.placeholder;
|
|
@@ -308,7 +311,7 @@ export const EditorRoot = forwardRef(function EditorRoot({ documentId, autoCorre
|
|
|
308
311
|
// rather than colliding on a shared one.
|
|
309
312
|
const portalTargetId = useId();
|
|
310
313
|
const portalTargetSelector = `#${CSS.escape(portalTargetId)}`;
|
|
311
|
-
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, dictionaryStores: wordStores, onAddAutoCorrect: config.language.autocorrect ? openAutoCorrectFor : undefined, onSave: handleSave, findOpen: openPanel === 'find', onToggleFind: () => togglePanel('find'), spellOpen: openPanel === 'spell', onToggleSpell: () => togglePanel('spell'), autoCorrectOpen: openPanel === 'autocorrect', onToggleAutoCorrect: () => togglePanel('autocorrect'), isDirty: isDirty, showSave: showSave, fontOptions: fontOptions, direction: dir, locale: locale, drafts: autosave
|
|
314
|
+
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, dictionaryStores: wordStores, thesaurusStores: thesaurusStores ?? DEFAULT_THESAURUS_STORES, onAddAutoCorrect: config.language.autocorrect ? openAutoCorrectFor : undefined, onSave: handleSave, findOpen: openPanel === 'find', onToggleFind: () => togglePanel('find'), spellOpen: openPanel === 'spell', onToggleSpell: () => togglePanel('spell'), autoCorrectOpen: openPanel === 'autocorrect', onToggleAutoCorrect: () => togglePanel('autocorrect'), isDirty: isDirty, showSave: showSave, fontOptions: fontOptions, direction: dir, locale: locale, drafts: autosave
|
|
312
315
|
? { currentId: draftId, maxBytes: autosaveMaxBytes, adoptOnRestore: !documentId, onRestored: handleDraftRestored }
|
|
313
316
|
: undefined }), documentId && (_jsx(DraftRestore, { draftId: documentId, mode: restoreDraft, initialJson: initialContentJsonRef.current, locale: locale, onRestored: handleDraftRestored })), _jsxs("div", { className: "likhari-canvas-frame", children: [config.findReplace && openPanel === 'find' && _jsx(FindReplaceBar, { strings: strings, dir: dir, onClose: () => setOpenPanel(null) }), config.language.spellCheck && openPanel === 'spell' && (_jsx(SpellcheckPanel, { strings: strings, dir: dir, dictionaryStores: wordStores, onAddAutoCorrect: config.language.autocorrect ? openAutoCorrectFor : undefined, onClose: () => setOpenPanel(null) })), config.language.autocorrect && openPanel === 'autocorrect' && (_jsx(AutoCorrectPanel, { strings: strings, dir: dir, stores: stores, initialFrom: autoCorrectPrefill?.from, initialLanguage: autoCorrectPrefill?.language, onSaved: () => setAutoCorrectVersion((v) => v + 1), onClose: () => setOpenPanel(null) }, autoCorrectPrefill?.id ?? 0)), _jsx("div", { className: "likhari-canvas", children: _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "likhari-content-editable", dir: dir, spellCheck: false, "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.language.spellCheck && _jsx(SpellHighlightPlugin, {}), config.language.autocomplete && (_jsx(AutocompletePlugin, { label: strings.autoComplete.label, stores: resolvedCompletionStores, language: autoCompleteLanguage })), (config.language.autocorrect || config.language.textCleanup) && _jsx(AutoCorrectPlugin, { stores: stores, version: autoCorrectVersion, enabled: true, typing: config.language.autocorrect, urduNormalization: urduNormalization, punctuation: punctuation }), config.columns && _jsx(LayoutPlugin, {}), config.footnotes && _jsx(FootnotePlugin, {}), config.poetry.enabled && _jsx(PoetryPlugin, {}), config.poetry.enabled && _jsx(PoetryResizer, {}), 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: () => {
|
|
314
317
|
handleSave();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type SpellLanguage } from '../spellcheck/spellDictionaries.js';
|
|
2
|
+
import { type ThesaurusStore } from '../thesaurus/thesaurusStores.js';
|
|
2
3
|
import { type UserWordStore } from '../spellcheck/userWords.js';
|
|
3
4
|
import { type DraftsToolbarOptions } from './DraftsDialog.js';
|
|
4
5
|
import type { ResolvedEditorFeatureConfig } from '@inshapardaz/likhari-core';
|
|
@@ -6,6 +7,8 @@ import { type FontOption } from '../fonts/index.js';
|
|
|
6
7
|
import type { Locale } from '../i18n/strings.js';
|
|
7
8
|
export interface ToolbarProps {
|
|
8
9
|
config: ResolvedEditorFeatureConfig;
|
|
10
|
+
/** Where synonyms come from. */
|
|
11
|
+
thesaurusStores?: ThesaurusStore[];
|
|
9
12
|
/** Where words added to the dictionary are saved. */
|
|
10
13
|
dictionaryStores?: UserWordStore[];
|
|
11
14
|
/** Opens the auto-correct panel with the word filled in. */
|
|
@@ -31,5 +34,5 @@ export interface ToolbarProps {
|
|
|
31
34
|
/** Autosave drafts: when set, the toolbar offers a Drafts button that lists and restores them. */
|
|
32
35
|
drafts?: DraftsToolbarOptions;
|
|
33
36
|
}
|
|
34
|
-
export declare function Toolbar({ config, dictionaryStores, onAddAutoCorrect, onSave, isDirty, showSave, findOpen, onToggleFind, spellOpen, onToggleSpell, autoCorrectOpen, onToggleAutoCorrect, fontOptions, direction, locale, drafts }: ToolbarProps): import("react").JSX.Element;
|
|
37
|
+
export declare function Toolbar({ config, dictionaryStores, thesaurusStores, onAddAutoCorrect, onSave, isDirty, showSave, findOpen, onToggleFind, spellOpen, onToggleSpell, autoCorrectOpen, onToggleAutoCorrect, fontOptions, direction, locale, drafts }: ToolbarProps): import("react").JSX.Element;
|
|
35
38
|
//# sourceMappingURL=Toolbar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/components/Toolbar.tsx"],"names":[],"mappings":"AA0CA,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAgDtF,OAAO,EAAgB,KAAK,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IAC1B,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,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,gBAAqB,EAAE,eAAoB,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAgB,EAAE,YAAY,EAAE,SAAiB,EAAE,aAAa,EAAE,eAAuB,EAAE,mBAAmB,EAAE,WAAkC,EAAE,SAAiB,EAAE,MAAa,EAAE,MAAM,EAAE,EAAE,YAAY,+BAspCvU"}
|
|
@@ -11,6 +11,7 @@ import { $findMatchingParent, $insertNodeToNearestRoot } from '@lexical/utils';
|
|
|
11
11
|
import { CORRECT_DOCUMENT_COMMAND } from '../autocorrect/AutoCorrectPlugin.js';
|
|
12
12
|
import { $replaceMatch } from '../find/findReplaceActions.js';
|
|
13
13
|
import { getSpeller } from '../spellcheck/spellDictionaries.js';
|
|
14
|
+
import { lookupSynonyms } from '../thesaurus/thesaurusStores.js';
|
|
14
15
|
import { addUserWord, ignoreWord } from '../spellcheck/userWords.js';
|
|
15
16
|
import { $wordAtDomPoint, textPointAt } from '../spellcheck/spellingMenu.js';
|
|
16
17
|
import { INSERT_HORIZONTAL_RULE_COMMAND } from '@lexical/react/LexicalHorizontalRuleNode';
|
|
@@ -185,7 +186,7 @@ function PoetryMenuItems({ strings, layout, scale, centered, onAction, }) {
|
|
|
185
186
|
};
|
|
186
187
|
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'), item(IconArrowsShuffle, t.staggered, setLayout('staggered'), layout === 'staggered'), _jsx(Menu.Divider, {}), _jsx(Menu.Divider, {}), item(IconRowInsertTop, t.insertCoupletBefore, () => $insertCoupletRelativeToSelection('before')), item(IconRowInsertBottom, t.insertCoupletAfter, () => $insertCoupletRelativeToSelection('after')), item(IconArrowsMinimize, t.tighterSpacing, () => $adjustPoetrySpacing(-1), !canStep(POETRY_SPACINGS, scale.spacing, -1)), item(IconArrowsMaximize, t.looserSpacing, () => $adjustPoetrySpacing(1), !canStep(POETRY_SPACINGS, scale.spacing, 1)), layout === 'staggered' && (_jsxs(_Fragment, { children: [item(IconArrowsMinimize, t.narrowerCouplets, () => $adjustPoetryStagger(-1), !canStep(POETRY_STAGGERS, scale.stagger, -1)), item(IconArrowsMaximize, t.widerCouplets, () => $adjustPoetryStagger(1), !canStep(POETRY_STAGGERS, scale.stagger, 1))] })), layout === 'two-column' && (_jsxs(_Fragment, { children: [item(IconAlignCenter, centered ? t.uncenterCouplet : t.centerCouplet, () => $setCoupletCentered(!centered)), item(IconColumns2, t.narrowerGutter, () => $adjustPoetryGutter(-1), !canStep(POETRY_GUTTERS, scale.gutter, -1)), item(IconColumns2, t.widerGutter, () => $adjustPoetryGutter(1), !canStep(POETRY_GUTTERS, scale.gutter, 1))] })), item(IconTrash, t.deleteCouplet, $deletePoetryCouplet, false, 'red'), item(IconTrash, t.deletePoetry, $deletePoetryBlock, false, 'red')] }));
|
|
187
188
|
}
|
|
188
|
-
export function Toolbar({ config, dictionaryStores = [], onAddAutoCorrect, onSave, isDirty, showSave, findOpen = false, onToggleFind, spellOpen = false, onToggleSpell, autoCorrectOpen = false, onToggleAutoCorrect, fontOptions = DEFAULT_FONT_OPTIONS, direction = 'ltr', locale = 'en', drafts }) {
|
|
189
|
+
export function Toolbar({ config, dictionaryStores = [], thesaurusStores = [], onAddAutoCorrect, onSave, isDirty, showSave, findOpen = false, onToggleFind, spellOpen = false, onToggleSpell, autoCorrectOpen = false, onToggleAutoCorrect, fontOptions = DEFAULT_FONT_OPTIONS, direction = 'ltr', locale = 'en', drafts }) {
|
|
189
190
|
const [editor] = useLexicalComposerContext();
|
|
190
191
|
const [state, setState] = useState(INITIAL_STATE);
|
|
191
192
|
const strings = useStrings(locale);
|
|
@@ -483,7 +484,7 @@ export function Toolbar({ config, dictionaryStores = [], onAddAutoCorrect, onSav
|
|
|
483
484
|
const anchor = config.links ? (target?.closest?.('a') ?? null) : null;
|
|
484
485
|
const cell = config.tables ? (target?.closest?.('td, th') ?? null) : null;
|
|
485
486
|
const couplet = config.poetry.enabled ? (target?.closest?.('.likhari-poetry') ?? null) : null;
|
|
486
|
-
const point = config.language.spellCheck ? textPointAt(event.clientX, event.clientY) : null;
|
|
487
|
+
const point = config.language.spellCheck || config.language.thesaurus ? textPointAt(event.clientX, event.clientY) : null;
|
|
487
488
|
const menu = { x: event.clientX, y: event.clientY };
|
|
488
489
|
let word = null;
|
|
489
490
|
editor.update(() => {
|
|
@@ -521,8 +522,11 @@ export function Toolbar({ config, dictionaryStores = [], onAddAutoCorrect, onSav
|
|
|
521
522
|
if (point)
|
|
522
523
|
word = $wordAtDomPoint(point.node, point.offset);
|
|
523
524
|
}, { discrete: true });
|
|
524
|
-
|
|
525
|
-
|
|
525
|
+
const language = word?.direction === 'rtl' ? 'ur' : 'en';
|
|
526
|
+
if (word && config.language.thesaurus) {
|
|
527
|
+
menu.thesaurus = { language, word: word.word, match: word.match };
|
|
528
|
+
}
|
|
529
|
+
if (word && config.language.spellCheck) {
|
|
526
530
|
const speller = getSpeller(language);
|
|
527
531
|
if (speller) {
|
|
528
532
|
const checked = await speller;
|
|
@@ -532,12 +536,20 @@ export function Toolbar({ config, dictionaryStores = [], onAddAutoCorrect, onSav
|
|
|
532
536
|
}
|
|
533
537
|
}
|
|
534
538
|
setContextMenu(menu);
|
|
539
|
+
if (word && menu.thesaurus) {
|
|
540
|
+
// Synonyms can take a while (the first WordNet lookup downloads the database), so the menu
|
|
541
|
+
// is already open and fills in when they arrive, unless the user has moved on.
|
|
542
|
+
const items = await lookupSynonyms(thesaurusStores, word.word, language);
|
|
543
|
+
setContextMenu((current) => current && current.x === menu.x && current.y === menu.y && current.thesaurus
|
|
544
|
+
? { ...current, thesaurus: { ...current.thesaurus, items } }
|
|
545
|
+
: current);
|
|
546
|
+
}
|
|
535
547
|
};
|
|
536
548
|
return editor.registerRootListener((root, previous) => {
|
|
537
549
|
previous?.removeEventListener('contextmenu', onContextMenu);
|
|
538
550
|
root?.addEventListener('contextmenu', onContextMenu);
|
|
539
551
|
});
|
|
540
|
-
}, [editor, config.links, config.tables, config.poetry.enabled, config.language.spellCheck]);
|
|
552
|
+
}, [editor, config.links, config.tables, config.poetry.enabled, config.language.spellCheck, config.language.thesaurus, thesaurusStores]);
|
|
541
553
|
// Cut and copy put the selected text on the clipboard as plain text.
|
|
542
554
|
const copyOrCut = (cut) => async () => {
|
|
543
555
|
restoreSelection();
|
|
@@ -845,7 +857,11 @@ export function Toolbar({ config, dictionaryStores = [], onAddAutoCorrect, onSav
|
|
|
845
857
|
}, children: strings.contextMenu.addToDictionary }), onAddAutoCorrect && config.language.autocorrect && (_jsx(Menu.Item, { onClick: () => {
|
|
846
858
|
onAddAutoCorrect(contextMenu.spelling.word, contextMenu.spelling.language);
|
|
847
859
|
setContextMenu(null);
|
|
848
|
-
}, children: strings.contextMenu.addToAutoCorrect })), _jsx(Menu.Divider, {})] })), contextMenu?.
|
|
860
|
+
}, children: strings.contextMenu.addToAutoCorrect })), _jsx(Menu.Divider, {})] })), contextMenu?.thesaurus && (_jsxs(_Fragment, { children: [_jsx(Menu.Label, { children: strings.thesaurus.synonyms }), contextMenu.thesaurus.items === undefined && _jsx(Menu.Item, { disabled: true, children: strings.thesaurus.loading }), contextMenu.thesaurus.items?.length === 0 && _jsx(Menu.Item, { disabled: true, children: strings.thesaurus.none }), contextMenu.thesaurus.items?.map((synonym) => (_jsx(Menu.Item, { onClick: () => {
|
|
861
|
+
const match = contextMenu.thesaurus.match;
|
|
862
|
+
editor.update(() => $replaceMatch(match, synonym), { discrete: true });
|
|
863
|
+
editor.focus();
|
|
864
|
+
}, children: synonym }, synonym))), _jsx(Menu.Divider, {})] })), contextMenu?.link !== undefined && (_jsxs(_Fragment, { children: [_jsx(LinkMenuItems, { url: contextMenu.link, onEdit: () => {
|
|
849
865
|
restoreSelection();
|
|
850
866
|
openLinkDialog();
|
|
851
867
|
}, onRemove: removeLink, strings: strings }), _jsx(Menu.Divider, {})] })), contextMenu?.table && (_jsxs(_Fragment, { children: [_jsx(TableMenuItems, { strings: strings, direction: direction, rows: contextMenu.table.rows, columns: contextMenu.table.columns, canMergeCells: state.canMergeCells, canUnmergeCell: state.canUnmergeCell, onAction: runMenuAction }), _jsx(Menu.Divider, {})] })), contextMenu?.poetry && (_jsxs(_Fragment, { children: [_jsx(PoetryMenuItems, { strings: strings, layout: state.poetryLayout, scale: state.poetryScale, centered: state.poetryCentered, onAction: runMenuAction }), _jsx(Menu.Divider, {})] })), _jsx(Menu.Item, { leftSection: _jsx(IconCut, { size: ICON_SIZE, stroke: ICON_STROKE }), onClick: () => void copyOrCut(true)(), children: strings.contextMenu.cut }), _jsx(Menu.Item, { leftSection: _jsx(IconCopy, { size: ICON_SIZE, stroke: ICON_STROKE }), onClick: () => void copyOrCut(false)(), children: strings.contextMenu.copy }), _jsx(Menu.Item, { leftSection: _jsx(IconClipboard, { size: ICON_SIZE, stroke: ICON_STROKE }), onClick: () => void paste(), children: strings.contextMenu.paste }), _jsx(Menu.Item, { leftSection: _jsx(IconSelectAll, { size: ICON_SIZE, stroke: ICON_STROKE }), onClick: runMenuAction(() => $selectAll()), children: strings.contextMenu.selectAll })] })] }), _jsxs("div", { "aria-hidden": "true", ref: toolbarMeasureRef, style: {
|
package/dist/i18n/strings.d.ts
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AC;QACpB,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,EAAE,CAAC,OAAO,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,KAAK,MAAM,CAAC;QACxE,MAAM,EAAE;YACN,cAAc,EAAE,MAAM,CAAC;YACvB,YAAY,EAAE,MAAM,CAAC;YACrB,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;SAC3C,CAAC;KACH,CAAC;IACF,SAAS,EAAE;QACT,SAAS,EAAE,MAAM,CAAC;QAClB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAo0BD,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
|
@@ -190,6 +190,11 @@ const en = {
|
|
|
190
190
|
autoComplete: {
|
|
191
191
|
label: 'Suggestions',
|
|
192
192
|
},
|
|
193
|
+
thesaurus: {
|
|
194
|
+
synonyms: 'Synonyms',
|
|
195
|
+
loading: 'Loading synonyms…',
|
|
196
|
+
none: 'No synonyms',
|
|
197
|
+
},
|
|
193
198
|
link: {
|
|
194
199
|
menuLabel: 'Link',
|
|
195
200
|
noUrl: '(no URL)',
|
|
@@ -461,6 +466,11 @@ const ur = {
|
|
|
461
466
|
autoComplete: {
|
|
462
467
|
label: 'تجاویز',
|
|
463
468
|
},
|
|
469
|
+
thesaurus: {
|
|
470
|
+
synonyms: 'مترادفات',
|
|
471
|
+
loading: 'مترادفات لوڈ ہو رہے ہیں…',
|
|
472
|
+
none: 'کوئی مترادف نہیں',
|
|
473
|
+
},
|
|
464
474
|
link: {
|
|
465
475
|
menuLabel: 'لنک',
|
|
466
476
|
noUrl: '(کوئی یو آر ایل نہیں)',
|
|
@@ -732,6 +742,11 @@ const paShahmukhi = {
|
|
|
732
742
|
autoComplete: {
|
|
733
743
|
label: 'تجویزاں',
|
|
734
744
|
},
|
|
745
|
+
thesaurus: {
|
|
746
|
+
synonyms: 'ہم معنی لفظ',
|
|
747
|
+
loading: 'ہم معنی لبھ رہے نیں…',
|
|
748
|
+
none: 'کوئی ہم معنی نئیں',
|
|
749
|
+
},
|
|
735
750
|
link: {
|
|
736
751
|
menuLabel: 'لنک',
|
|
737
752
|
noUrl: '(کوئی یو آر ایل نئیں)',
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { SpellLanguage } from '../spellcheck/spellDictionaries.js';
|
|
2
|
+
/**
|
|
3
|
+
* Where synonyms come from. The host can pass several; their synonyms are merged
|
|
4
|
+
* in order, without repeats. A failing store is skipped.
|
|
5
|
+
*/
|
|
6
|
+
export interface ThesaurusStore {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
/** Synonyms of `word` in `language`. Returns [] when there are none. */
|
|
9
|
+
lookup(word: string, language: SpellLanguage): Promise<string[]>;
|
|
10
|
+
}
|
|
11
|
+
/** One WordNet index entry for a lemma in one part of speech: its synset offsets. */
|
|
12
|
+
interface IndexEntry {
|
|
13
|
+
pos: string;
|
|
14
|
+
offsets: string[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Parses a WordNet `index.<pos>` file: lemma → the synsets it belongs to. Lines
|
|
18
|
+
* starting with a space are the licence header.
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseWordNetIndex(text: string, pos: string): Map<string, IndexEntry[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Parses a WordNet `data.<pos>` file: synset offset → the words in that synset.
|
|
23
|
+
* Multi-word entries use underscores in WordNet; they are returned with spaces.
|
|
24
|
+
*/
|
|
25
|
+
export declare function parseWordNetData(text: string): Map<string, string[]>;
|
|
26
|
+
/**
|
|
27
|
+
* English synonyms from WordNet. The database is about 35MB, so it is fetched
|
|
28
|
+
* from `baseUrl` on the first lookup, and only the files needed are read.
|
|
29
|
+
* Browsers cache the files after that.
|
|
30
|
+
*/
|
|
31
|
+
export declare function wordNetThesaurusStore(options?: {
|
|
32
|
+
baseUrl?: string;
|
|
33
|
+
fetch?: typeof fetch;
|
|
34
|
+
}): ThesaurusStore;
|
|
35
|
+
/** Synonyms from a service. `GET {url}?word=…&language=xx` returns a JSON array of strings. */
|
|
36
|
+
export declare function apiThesaurusStore(options: {
|
|
37
|
+
id?: string;
|
|
38
|
+
url: string;
|
|
39
|
+
headers?: Record<string, string>;
|
|
40
|
+
fetch?: typeof fetch;
|
|
41
|
+
}): ThesaurusStore;
|
|
42
|
+
/** Synonyms of `word` from all stores, merged in order without repeats, at most `limit`. */
|
|
43
|
+
export declare function lookupSynonyms(stores: ThesaurusStore[], word: string, language: SpellLanguage, limit?: number): Promise<string[]>;
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=thesaurusStores.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thesaurusStores.d.ts","sourceRoot":"","sources":["../../src/thesaurus/thesaurusStores.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAErE;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,wEAAwE;IACxE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAClE;AAID,qFAAqF;AACrF,UAAU,UAAU;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAetF;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAgBpE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;CAAO,GAAG,cAAc,CAkD9G;AAED,+FAA+F;AAC/F,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IACzC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB,GAAG,cAAc,CAYjB;AAED,4FAA4F;AAC5F,wBAAsB,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,SAAK,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAQnI"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
const POS_FILES = ['noun', 'verb', 'adj', 'adv'];
|
|
2
|
+
/**
|
|
3
|
+
* Parses a WordNet `index.<pos>` file: lemma → the synsets it belongs to. Lines
|
|
4
|
+
* starting with a space are the licence header.
|
|
5
|
+
*/
|
|
6
|
+
export function parseWordNetIndex(text, pos) {
|
|
7
|
+
const entries = new Map();
|
|
8
|
+
for (const line of text.split('\n')) {
|
|
9
|
+
if (line === '' || line.startsWith(' '))
|
|
10
|
+
continue;
|
|
11
|
+
const fields = line.split(' ');
|
|
12
|
+
const lemma = fields[0];
|
|
13
|
+
const synsetCount = Number(fields[2]);
|
|
14
|
+
const pointerCount = Number(fields[3]);
|
|
15
|
+
// lemma pos synset_cnt p_cnt [pointer...] sense_cnt tagsense_cnt offset...
|
|
16
|
+
const offsets = fields.slice(4 + pointerCount + 2, 4 + pointerCount + 2 + synsetCount);
|
|
17
|
+
const list = entries.get(lemma) ?? [];
|
|
18
|
+
list.push({ pos, offsets });
|
|
19
|
+
entries.set(lemma, list);
|
|
20
|
+
}
|
|
21
|
+
return entries;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Parses a WordNet `data.<pos>` file: synset offset → the words in that synset.
|
|
25
|
+
* Multi-word entries use underscores in WordNet; they are returned with spaces.
|
|
26
|
+
*/
|
|
27
|
+
export function parseWordNetData(text) {
|
|
28
|
+
const synsets = new Map();
|
|
29
|
+
for (const line of text.split('\n')) {
|
|
30
|
+
if (line === '' || line.startsWith(' '))
|
|
31
|
+
continue;
|
|
32
|
+
const fields = line.split(' ');
|
|
33
|
+
const offset = fields[0];
|
|
34
|
+
const wordCount = parseInt(fields[3], 16);
|
|
35
|
+
const words = [];
|
|
36
|
+
for (let i = 0; i < wordCount; i++) {
|
|
37
|
+
// Each word is followed by its lex_id; a "(a)"-style marker is not part of the word.
|
|
38
|
+
const word = fields[4 + i * 2].replace(/\(.*\)$/, '').replace(/_/g, ' ');
|
|
39
|
+
words.push(word);
|
|
40
|
+
}
|
|
41
|
+
synsets.set(offset, words);
|
|
42
|
+
}
|
|
43
|
+
return synsets;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* English synonyms from WordNet. The database is about 35MB, so it is fetched
|
|
47
|
+
* from `baseUrl` on the first lookup, and only the files needed are read.
|
|
48
|
+
* Browsers cache the files after that.
|
|
49
|
+
*/
|
|
50
|
+
export function wordNetThesaurusStore(options = {}) {
|
|
51
|
+
const base = options.baseUrl ?? 'https://cdn.jsdelivr.net/npm/wordnet-db@3.1.14/dict/';
|
|
52
|
+
const doFetch = options.fetch ?? fetch;
|
|
53
|
+
const indexes = new Map();
|
|
54
|
+
const datas = new Map();
|
|
55
|
+
const text = async (file) => {
|
|
56
|
+
const response = await doFetch(`${base}${file}`);
|
|
57
|
+
if (!response.ok)
|
|
58
|
+
throw new Error(`WordNet file failed to load: ${file}`);
|
|
59
|
+
return response.text();
|
|
60
|
+
};
|
|
61
|
+
const indexFor = (pos) => {
|
|
62
|
+
let loaded = indexes.get(pos);
|
|
63
|
+
if (!loaded) {
|
|
64
|
+
loaded = text(`index.${pos}`).then((t) => parseWordNetIndex(t, pos));
|
|
65
|
+
indexes.set(pos, loaded);
|
|
66
|
+
}
|
|
67
|
+
return loaded;
|
|
68
|
+
};
|
|
69
|
+
const dataFor = (pos) => {
|
|
70
|
+
let loaded = datas.get(pos);
|
|
71
|
+
if (!loaded) {
|
|
72
|
+
loaded = text(`data.${pos}`).then(parseWordNetData);
|
|
73
|
+
datas.set(pos, loaded);
|
|
74
|
+
}
|
|
75
|
+
return loaded;
|
|
76
|
+
};
|
|
77
|
+
return {
|
|
78
|
+
id: 'wordnet',
|
|
79
|
+
async lookup(word, language) {
|
|
80
|
+
if (language !== 'en')
|
|
81
|
+
return [];
|
|
82
|
+
const lemma = word.trim().toLowerCase().replace(/ /g, '_');
|
|
83
|
+
if (lemma === '')
|
|
84
|
+
return [];
|
|
85
|
+
const synonyms = new Set();
|
|
86
|
+
for (const pos of POS_FILES) {
|
|
87
|
+
const entries = (await indexFor(pos)).get(lemma);
|
|
88
|
+
if (!entries)
|
|
89
|
+
continue;
|
|
90
|
+
const synsets = await dataFor(pos);
|
|
91
|
+
for (const entry of entries) {
|
|
92
|
+
for (const offset of entry.offsets) {
|
|
93
|
+
for (const synonym of synsets.get(offset) ?? []) {
|
|
94
|
+
if (synonym.toLowerCase() !== lemma.replace(/_/g, ' '))
|
|
95
|
+
synonyms.add(synonym);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return [...synonyms];
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/** Synonyms from a service. `GET {url}?word=…&language=xx` returns a JSON array of strings. */
|
|
105
|
+
export function apiThesaurusStore(options) {
|
|
106
|
+
const doFetch = options.fetch ?? fetch;
|
|
107
|
+
return {
|
|
108
|
+
id: options.id ?? 'api',
|
|
109
|
+
async lookup(word, language) {
|
|
110
|
+
const query = `?word=${encodeURIComponent(word)}&language=${encodeURIComponent(language)}`;
|
|
111
|
+
const response = await doFetch(`${options.url}${query}`, { headers: options.headers });
|
|
112
|
+
if (!response.ok)
|
|
113
|
+
throw new Error(`Thesaurus API failed: ${response.status}`);
|
|
114
|
+
const data = await response.json();
|
|
115
|
+
return Array.isArray(data) ? data.filter((s) => typeof s === 'string') : [];
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/** Synonyms of `word` from all stores, merged in order without repeats, at most `limit`. */
|
|
120
|
+
export async function lookupSynonyms(stores, word, language, limit = 10) {
|
|
121
|
+
const results = await Promise.allSettled(stores.map((store) => store.lookup(word, language)));
|
|
122
|
+
const merged = new Set();
|
|
123
|
+
for (const result of results) {
|
|
124
|
+
if (result.status !== 'fulfilled')
|
|
125
|
+
continue;
|
|
126
|
+
for (const synonym of result.value)
|
|
127
|
+
if (synonym !== word)
|
|
128
|
+
merged.add(synonym);
|
|
129
|
+
}
|
|
130
|
+
return [...merged].slice(0, limit);
|
|
131
|
+
}
|