@inshapardaz/likhari-react 0.1.39 → 0.1.40-dev.310
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 +31 -1
- package/dist/EditorRoot.d.ts.map +1 -1
- package/dist/EditorRoot.js +35 -6
- package/dist/components/Toolbar.d.ts +14 -2
- package/dist/components/Toolbar.d.ts.map +1 -1
- package/dist/components/Toolbar.js +29 -6
- package/dist/fonts/index.d.ts +9 -0
- package/dist/fonts/index.d.ts.map +1 -1
- package/dist/fonts/index.js +11 -0
- package/dist/i18n/strings.d.ts +4 -0
- package/dist/i18n/strings.d.ts.map +1 -1
- package/dist/i18n/strings.js +12 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/persistence/fontStorage.d.ts +14 -0
- package/dist/persistence/fontStorage.d.ts.map +1 -0
- package/dist/persistence/fontStorage.js +46 -0
- package/dist/theme/editor.css +44 -0
- package/package.json +1 -1
package/dist/EditorRoot.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { SerializedEditorState } from 'lexical';
|
|
|
3
3
|
import { type FormatId } from '@inshapardaz/likhari-converters';
|
|
4
4
|
import { type EditorFeatureConfig, type FeatureConfigPresetName } from '@inshapardaz/likhari-core';
|
|
5
5
|
import { type ToolbarStyle } from './components/Toolbar.js';
|
|
6
|
-
import { type FontOption } from './fonts/index.js';
|
|
6
|
+
import { type FontMode, type FontOption } from './fonts/index.js';
|
|
7
7
|
import { type DraftRestoreMode } from './components/DraftRestore.js';
|
|
8
8
|
import { type AutoCorrectStore } from './autocorrect/autoCorrectStores.js';
|
|
9
9
|
import type { UrduNormalizationOptions } from './normalization/urduNormalize.js';
|
|
@@ -103,6 +103,36 @@ export interface EditorRootProps {
|
|
|
103
103
|
* `[...DEFAULT_FONT_OPTIONS, { name: 'Mine', family: '"Mine", serif' }]`.
|
|
104
104
|
*/
|
|
105
105
|
fontOptions?: FontOption[];
|
|
106
|
+
/**
|
|
107
|
+
* How fonts are applied:
|
|
108
|
+
* - `'selective'` (default): the toolbar's font-family and font-size
|
|
109
|
+
* dropdowns style the selection (or the document, per `font.scope`) with
|
|
110
|
+
* inline styles stored in the document;
|
|
111
|
+
* - `'uniform'`: one font for all text, and a zoom control in place of the
|
|
112
|
+
* font-size dropdown that scales every size together. Both are a view
|
|
113
|
+
* setting, not part of the document, so exports are unaffected and text
|
|
114
|
+
* styled inline elsewhere (e.g. imported HTML) is shown in the uniform
|
|
115
|
+
* font and zoom too. `font.family` / `font.size` in the feature config
|
|
116
|
+
* show or hide the font and zoom controls.
|
|
117
|
+
*/
|
|
118
|
+
fontMode?: FontMode;
|
|
119
|
+
/**
|
|
120
|
+
* `fontMode="uniform"` only: the font family for all text, e.g. a
|
|
121
|
+
* `fontOptions[].family` value. Omit for the canvas default (which follows
|
|
122
|
+
* each block's direction). Changing it from the toolbar updates the editor
|
|
123
|
+
* and calls `onFontChange`; changing the prop updates the editor too.
|
|
124
|
+
*/
|
|
125
|
+
fontFamily?: string;
|
|
126
|
+
/**
|
|
127
|
+
* `fontMode="uniform"` only: the zoom as a percentage of the normal text
|
|
128
|
+
* size, 50–300. Default `100`. Behaves like `fontFamily`.
|
|
129
|
+
*/
|
|
130
|
+
zoom?: number;
|
|
131
|
+
/** `fontMode="uniform"` only: called when the user picks a font or zoom in the toolbar. */
|
|
132
|
+
onFontChange?: (change: {
|
|
133
|
+
fontFamily: string | undefined;
|
|
134
|
+
zoom: number;
|
|
135
|
+
}) => void;
|
|
106
136
|
/**
|
|
107
137
|
* Saves drafts: a debounced autosave of the current content to
|
|
108
138
|
* `localStorage` (lexical-editor-spec.md §6.2), a resilience net against an
|
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,o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;;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,uGAifrB,CAAC"}
|
package/dist/EditorRoot.js
CHANGED
|
@@ -18,7 +18,8 @@ import { EDITOR_NODES } from './nodes.js';
|
|
|
18
18
|
import { editorTheme } from './theme/editorTheme.js';
|
|
19
19
|
import { EditorThemeProvider } from './theme/EditorThemeProvider.js';
|
|
20
20
|
import { Toolbar } from './components/Toolbar.js';
|
|
21
|
-
import {
|
|
21
|
+
import { readFontSettings, writeFontSettings } from './persistence/fontStorage.js';
|
|
22
|
+
import { clampZoom, injectUrduWebFontsCss } from './fonts/index.js';
|
|
22
23
|
import { LinkPastePlugin } from './plugins/LinkPastePlugin.js';
|
|
23
24
|
import { PageBreakPlugin } from './plugins/PageBreakPlugin.js';
|
|
24
25
|
import { LayoutPlugin } from './plugins/LayoutPlugin.js';
|
|
@@ -58,7 +59,7 @@ function initialEditorStateJson(initialContent) {
|
|
|
58
59
|
const state = defaultFormatRegistry.parse(initialContent.format, initialContent.value);
|
|
59
60
|
return JSON.stringify(state);
|
|
60
61
|
}
|
|
61
|
-
export const EditorRoot = forwardRef(function EditorRoot({ documentId, autoCorrectStores, dictionaryStores, completionStores, thesaurusStores, autoCompleteLanguage = 'auto', urduNormalization, punctuation, initialContent, featureConfig, featurePreset, theme, colorScheme, accentColor, toolbarStyle, helpUrl, 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) {
|
|
62
|
+
export const EditorRoot = forwardRef(function EditorRoot({ documentId, autoCorrectStores, dictionaryStores, completionStores, thesaurusStores, autoCompleteLanguage = 'auto', urduNormalization, punctuation, initialContent, featureConfig, featurePreset, theme, colorScheme, accentColor, toolbarStyle, helpUrl, locale = 'en', placeholder, height = '480px', onChange, onSave, showSave = Boolean(onSave), onImageUpload, fetchImage, fontOptions, fontMode = 'selective', fontFamily, zoom, onFontChange, autosave = true, restoreDraft = 'prompt', navigationGuard = 'confirm', onDraftRestored, autosaveDelayMs = DEFAULT_AUTOSAVE_DELAY_MS, autosaveMaxBytes = DEFAULT_AUTOSAVE_MAX_BYTES, autosaveMaxDrafts = DEFAULT_AUTOSAVE_MAX_DRAFTS, }, ref) {
|
|
62
63
|
const config = useMemo(() => resolveFeatureConfig(featureConfig, featurePreset), [featureConfig, featurePreset]);
|
|
63
64
|
const strings = useMemo(() => getStrings(locale), [locale]);
|
|
64
65
|
const resolvedPlaceholder = placeholder ?? strings.editor.placeholder;
|
|
@@ -70,10 +71,36 @@ export const EditorRoot = forwardRef(function EditorRoot({ documentId, autoCorre
|
|
|
70
71
|
const draftId = documentId ?? adoptedDraftId ?? generatedDraftId;
|
|
71
72
|
// The urdu-web-fonts stylesheets are needed for the font dropdown and for
|
|
72
73
|
// RTL content, whose canvas font (editor.css) is one of those families.
|
|
74
|
+
// Uniform font mode: the toolbar and the host's props both drive these. They
|
|
75
|
+
// start from the props, else from what the user chose last time (kept in
|
|
76
|
+
// localStorage), and a prop that is given wins whenever it changes. A toolbar
|
|
77
|
+
// change is saved, and reported through onFontChange.
|
|
78
|
+
const uniform = fontMode === 'uniform';
|
|
79
|
+
const [uniformFamily, setUniformFamily] = useState(() => fontFamily ?? readFontSettings(documentId).fontFamily);
|
|
80
|
+
const [uniformZoom, setUniformZoom] = useState(() => clampZoom(zoom ?? readFontSettings(documentId).zoom));
|
|
73
81
|
useEffect(() => {
|
|
74
|
-
if (
|
|
82
|
+
if (fontFamily !== undefined)
|
|
83
|
+
setUniformFamily(fontFamily);
|
|
84
|
+
}, [fontFamily]);
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if (zoom !== undefined)
|
|
87
|
+
setUniformZoom(clampZoom(zoom));
|
|
88
|
+
}, [zoom]);
|
|
89
|
+
const handleUniformFamily = (family) => {
|
|
90
|
+
setUniformFamily(family);
|
|
91
|
+
writeFontSettings({ fontFamily: family, zoom: uniformZoom }, documentId);
|
|
92
|
+
onFontChange?.({ fontFamily: family, zoom: uniformZoom });
|
|
93
|
+
};
|
|
94
|
+
const handleUniformZoom = (level) => {
|
|
95
|
+
const next = clampZoom(level);
|
|
96
|
+
setUniformZoom(next);
|
|
97
|
+
writeFontSettings({ fontFamily: uniformFamily, zoom: next }, documentId);
|
|
98
|
+
onFontChange?.({ fontFamily: uniformFamily, zoom: next });
|
|
99
|
+
};
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
if (config.font.family || uniformFamily || locale !== 'en')
|
|
75
102
|
injectUrduWebFontsCss();
|
|
76
|
-
}, [config.font.family, locale]);
|
|
103
|
+
}, [config.font.family, uniformFamily, locale]);
|
|
77
104
|
const imageOptions = useMemo(() => ({
|
|
78
105
|
allowLinked: config.images.linked,
|
|
79
106
|
allowEmbedded: config.images.embedded,
|
|
@@ -311,9 +338,11 @@ export const EditorRoot = forwardRef(function EditorRoot({ documentId, autoCorre
|
|
|
311
338
|
// rather than colliding on a shared one.
|
|
312
339
|
const portalTargetId = useId();
|
|
313
340
|
const portalTargetSelector = `#${CSS.escape(portalTargetId)}`;
|
|
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, toolbarStyle: toolbarStyle, helpUrl: helpUrl, 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
|
|
341
|
+
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, toolbarStyle: toolbarStyle, helpUrl: helpUrl, 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, fontMode: fontMode, uniformFontFamily: uniformFamily, zoom: uniformZoom, onUniformFontFamilyChange: handleUniformFamily, onZoomChange: handleUniformZoom, direction: dir, locale: locale, drafts: autosave
|
|
315
342
|
? { currentId: draftId, maxBytes: autosaveMaxBytes, adoptOnRestore: !documentId, onRestored: handleDraftRestored }
|
|
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
|
|
343
|
+
: 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, "data-font-mode": uniform ? 'uniform' : undefined, "data-uniform-font": uniform && uniformFamily ? '' : undefined, style: uniform
|
|
344
|
+
? { '--likhari-zoom': uniformZoom / 100, ...(uniformFamily && { '--likhari-uniform-font': uniformFamily }) }
|
|
345
|
+
: undefined }), 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, ignoreSelectionChange: true })] }) }), _jsx(LeaveDialog, { opened: leavePrompt !== null, canSave: Boolean(onSave), canSaveDraft: autosave || navigationGuard === 'save-draft', draftFailed: leavePrompt?.draftFailed ?? false, onSave: () => {
|
|
317
346
|
handleSave();
|
|
318
347
|
settleLeave(true);
|
|
319
348
|
}, onSaveDraft: () => {
|
|
@@ -3,7 +3,7 @@ import { type ThesaurusStore } from '../thesaurus/thesaurusStores.js';
|
|
|
3
3
|
import { type UserWordStore } from '../spellcheck/userWords.js';
|
|
4
4
|
import { type DraftsToolbarOptions } from './DraftsDialog.js';
|
|
5
5
|
import type { ResolvedEditorFeatureConfig } from '@inshapardaz/likhari-core';
|
|
6
|
-
import { type FontOption } from '../fonts/index.js';
|
|
6
|
+
import { type FontMode, type FontOption } from '../fonts/index.js';
|
|
7
7
|
import type { Locale } from '../i18n/strings.js';
|
|
8
8
|
/** Appearance of the toolbar. The accent colour comes from the editor's `accentColor`. */
|
|
9
9
|
export interface ToolbarStyle {
|
|
@@ -41,6 +41,18 @@ export interface ToolbarProps {
|
|
|
41
41
|
showSave?: boolean;
|
|
42
42
|
/** Font-family dropdown entries; defaults to DEFAULT_FONT_OPTIONS. */
|
|
43
43
|
fontOptions?: FontOption[];
|
|
44
|
+
/**
|
|
45
|
+
* `'selective'` (default): the font dropdowns style the selection or document
|
|
46
|
+
* as inline styles. `'uniform'`: one font for all text plus a zoom control,
|
|
47
|
+
* both owned by EditorRoot (`uniformFontFamily` / `zoom`) and applied by CSS.
|
|
48
|
+
*/
|
|
49
|
+
fontMode?: FontMode;
|
|
50
|
+
/** Uniform mode: the editor-wide font family, or undefined for the canvas default. */
|
|
51
|
+
uniformFontFamily?: string;
|
|
52
|
+
/** Uniform mode: the zoom percentage. */
|
|
53
|
+
zoom?: number;
|
|
54
|
+
onUniformFontFamilyChange?: (family: string) => void;
|
|
55
|
+
onZoomChange?: (zoom: number) => void;
|
|
44
56
|
/** Text direction of the canvas; picks which default font and size are pre-selected. */
|
|
45
57
|
direction?: 'ltr' | 'rtl';
|
|
46
58
|
/** UI locale — picks the translated strings for labels, tooltips and menu items. */
|
|
@@ -57,5 +69,5 @@ export interface ToolbarProps {
|
|
|
57
69
|
/** `docs/markdown-dialect.md` at the repository's default branch — the Markdown
|
|
58
70
|
* format this editor reads and writes, including the poetry container syntax. */
|
|
59
71
|
export declare const DEFAULT_HELP_URL = "https://github.com/inshapardaz/likhari/blob/main/docs/markdown-dialect.md";
|
|
60
|
-
export declare function Toolbar({ config, toolbarStyle, dictionaryStores, thesaurusStores, onAddAutoCorrect, onSave, isDirty, showSave, findOpen, onToggleFind, spellOpen, onToggleSpell, autoCorrectOpen, onToggleAutoCorrect, fontOptions, direction, locale, drafts, helpUrl }: ToolbarProps): import("react").JSX.Element;
|
|
72
|
+
export declare function Toolbar({ config, toolbarStyle, dictionaryStores, thesaurusStores, onAddAutoCorrect, onSave, isDirty, showSave, findOpen, onToggleFind, spellOpen, onToggleSpell, autoCorrectOpen, onToggleAutoCorrect, fontOptions, fontMode, uniformFontFamily, zoom, onUniformFontFamilyChange, onZoomChange, direction, locale, drafts, helpUrl }: ToolbarProps): import("react").JSX.Element;
|
|
61
73
|
//# sourceMappingURL=Toolbar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/components/Toolbar.tsx"],"names":[],"mappings":"AA2CA,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAmDtF,OAAO,EAAgB,KAAK,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEzE,OAAO,KAAK,EA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AAE,MAAM,EAAE,OAAO,EAAE,EAAE,YAAY,+BA0wC9b"}
|
|
@@ -32,11 +32,11 @@ import { $createLinkNode, $isLinkNode, TOGGLE_LINK_COMMAND } from '@lexical/link
|
|
|
32
32
|
import { LinkDialog } from './LinkDialog.js';
|
|
33
33
|
import { DraftsDialog } from './DraftsDialog.js';
|
|
34
34
|
import { normalizeLinkUrl } from '../utils/linkUrl.js';
|
|
35
|
-
import { CANVAS_FONT_DEFAULTS, DEFAULT_FONT_OPTIONS, FONT_SIZES_PX } from '../fonts/index.js';
|
|
35
|
+
import { CANVAS_FONT_DEFAULTS, DEFAULT_FONT_OPTIONS, FONT_SIZES_PX, ZOOM_LEVELS_PERCENT } from '../fonts/index.js';
|
|
36
36
|
import { setStyleProperty } from '../utils/style.js';
|
|
37
37
|
import { useStrings } from '../i18n/useStrings.js';
|
|
38
38
|
import { usePortalTarget } from '../PortalTargetContext.js';
|
|
39
|
-
import { IconAbc, IconAlignCenter, IconAlignJustified, IconAlignLeft, IconAlignRight, IconArrowBackUp, IconArrowForwardUp, IconArrowsJoin, IconBold, IconClearFormatting, IconDeviceFloppy, IconDots, IconHelpCircle, 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, IconClipboard, IconCopy, IconCut, IconSearch, IconSelectAll, IconColumns1, IconColumns2, IconNumber1Small, IconRowInsertBottom, IconRowInsertTop, IconRowRemove, IconArrowsMaximize, IconArrowsMinimize, IconArrowsShuffle, IconTable, IconTableMinus, IconTrash, IconTableOptions, IconTextSize, IconTypography, IconUnderline, IconWand, } from '@tabler/icons-react';
|
|
39
|
+
import { IconAbc, IconAlignCenter, IconAlignJustified, IconAlignLeft, IconAlignRight, IconArrowBackUp, IconArrowForwardUp, IconArrowsJoin, IconBold, IconClearFormatting, IconDeviceFloppy, IconDots, IconHelpCircle, 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, IconClipboard, IconCopy, IconCut, IconSearch, IconSelectAll, IconColumns1, IconColumns2, IconNumber1Small, IconRowInsertBottom, IconRowInsertTop, IconRowRemove, IconArrowsMaximize, IconArrowsMinimize, IconArrowsShuffle, IconTable, IconTableMinus, IconTrash, IconTableOptions, IconMinus, IconPlus, IconTextSize, IconTypography, IconUnderline, IconWand, } from '@tabler/icons-react';
|
|
40
40
|
/** Sentinel for "no inline style": Lexical returns the default it is given when
|
|
41
41
|
* the selection has none, so this tells "unstyled" (show the canvas default)
|
|
42
42
|
* apart from "styled with a value the dropdown doesn't list" (show nothing). */
|
|
@@ -216,7 +216,7 @@ function PoetryMenuItems({ strings, layout, scale, centered, onAction, }) {
|
|
|
216
216
|
/** `docs/markdown-dialect.md` at the repository's default branch — the Markdown
|
|
217
217
|
* format this editor reads and writes, including the poetry container syntax. */
|
|
218
218
|
export const DEFAULT_HELP_URL = 'https://github.com/inshapardaz/likhari/blob/main/docs/markdown-dialect.md';
|
|
219
|
-
export function Toolbar({ config, toolbarStyle, dictionaryStores = [], thesaurusStores = [], onAddAutoCorrect, onSave, isDirty, showSave, findOpen = false, onToggleFind, spellOpen = false, onToggleSpell, autoCorrectOpen = false, onToggleAutoCorrect, fontOptions = DEFAULT_FONT_OPTIONS, direction = 'ltr', locale = 'en', drafts, helpUrl }) {
|
|
219
|
+
export function Toolbar({ config, toolbarStyle, dictionaryStores = [], thesaurusStores = [], onAddAutoCorrect, onSave, isDirty, showSave, findOpen = false, onToggleFind, spellOpen = false, onToggleSpell, autoCorrectOpen = false, onToggleAutoCorrect, fontOptions = DEFAULT_FONT_OPTIONS, fontMode = 'selective', uniformFontFamily, zoom = 100, onUniformFontFamilyChange, onZoomChange, direction = 'ltr', locale = 'en', drafts, helpUrl }) {
|
|
220
220
|
const bordered = toolbarStyle?.bordered ?? true;
|
|
221
221
|
const variant = toolbarStyle?.variant ?? 'light';
|
|
222
222
|
const overflowEnabled = toolbarStyle?.overflow ?? true;
|
|
@@ -784,7 +784,10 @@ export function Toolbar({ config, toolbarStyle, dictionaryStores = [], thesaurus
|
|
|
784
784
|
})();
|
|
785
785
|
// Unstyled text shows the canvas default (pre-selected).
|
|
786
786
|
const canvasDefaults = CANVAS_FONT_DEFAULTS[direction];
|
|
787
|
-
const
|
|
787
|
+
const uniform = fontMode === 'uniform';
|
|
788
|
+
const shownFontFamily = uniform
|
|
789
|
+
? uniformFontFamily ?? canvasDefaults.family
|
|
790
|
+
: state.fontFamily === UNSET_STYLE ? canvasDefaults.family : state.fontFamily;
|
|
788
791
|
const shownFontSize = state.fontSize === UNSET_STYLE ? canvasDefaults.size : state.fontSize;
|
|
789
792
|
const formattingOptions = [
|
|
790
793
|
{ value: 'paragraph', label: strings.toolbar.formattingOptions.paragraph },
|
|
@@ -806,7 +809,13 @@ export function Toolbar({ config, toolbarStyle, dictionaryStores = [], thesaurus
|
|
|
806
809
|
const AlignIcon = ALIGN_ICONS[state.elementFormat] ?? IconAlignLeft;
|
|
807
810
|
const formatSection = (showFormattingGroup || fmt.bold || fmt.italic || fmt.underline || fmt.strikethrough || moreItems.length > 0) && (_jsxs(Fragment, { children: [showFormattingGroup && (_jsx(MantineToolbar.Group, { children: _jsx(ToolbarSelect, { icon: IconPilcrow, label: strings.toolbar.formattingLabel, width: 148, value: formattingValue, data: formattingOptions, comingSoon: strings.toolbar.comingSoon, renderOption: iconOptionRenderer(FORMATTING_ICONS, IconPilcrow), onMouseDown: snapshotSelection, onChange: withRefocus((v) => applyFormatting(v)) }) })), (fmt.bold || fmt.italic || fmt.underline || fmt.strikethrough || moreItems.length > 0) && (_jsxs(MantineToolbar.Group, { className: "likhari-toolbar-cluster", children: [fmt.bold && _jsx(ToolbarButton, { icon: IconBold, title: strings.toolbar.bold, active: state.activeFormats.has('bold'), onClick: () => formatText('bold') }), fmt.italic && (_jsx(ToolbarButton, { icon: IconItalic, title: strings.toolbar.italic, active: state.activeFormats.has('italic'), onClick: () => formatText('italic') })), fmt.underline && (_jsx(ToolbarButton, { icon: IconUnderline, title: strings.toolbar.underline, active: state.activeFormats.has('underline'), onClick: () => formatText('underline') })), fmt.strikethrough && (_jsx(ToolbarButton, { icon: IconStrikethrough, title: strings.toolbar.strikethrough, active: state.activeFormats.has('strikethrough'), onClick: () => formatText('strikethrough') })), moreItems.length > 0 && (_jsxs(Menu, { position: "bottom-start", withinPortal: true, portalProps: { target: portalTarget }, shadow: "sm", width: 210, closeOnItemClick: true, onOpen: snapshotSelection, children: [_jsx(Menu.Target, { children: _jsx(ToolbarButton, { icon: IconDots, title: strings.toolbar.moreFormatting }) }), _jsx(Menu.Dropdown, { children: moreItems.map((item) => (_jsx(MoreMenuItem, { icon: item.icon, label: item.label, active: item.active, onClick: runMenuItem(item.onClick) }, item.key))) })] }))] }))] }, "format"));
|
|
808
811
|
const alignSection = (showAlignGroup || indentItems.length > 0) && (_jsxs(Fragment, { children: [showAlignGroup && (_jsx(MantineToolbar.Group, { children: _jsx(ToolbarSelect, { icon: AlignIcon, label: strings.toolbar.alignment, width: 138, value: state.elementFormat || 'start', data: alignOptions, renderOption: iconOptionRenderer(ALIGN_ICONS, IconAlignLeft), onMouseDown: snapshotSelection, onChange: withRefocus((v) => formatElement(v)) }) })), indentItems.length > 0 && (_jsx(MantineToolbar.Group, { className: "likhari-toolbar-cluster", children: indentItems.map((item) => (_jsx(ToolbarButton, { icon: item.icon, title: item.label, onClick: item.onClick }, item.key))) }))] }, "align"));
|
|
809
|
-
const fontSection = (config.font.family || config.font.size) && (_jsxs(MantineToolbar.Group, { children: [config.font.family && (_jsx(ToolbarSelect, { icon: IconTypography, label: strings.toolbar.fontFamily, width: 150, value: fontOptions.some((f) => f.family === shownFontFamily) ? shownFontFamily : null, placeholder: strings.toolbar.fontFamilyPlaceholder, data: fontData, searchable: true, noMatchMessage: strings.toolbar.noMatch, renderOption: ({ option }) => _jsx("span", { style: { fontFamily: option.value }, children: option.label }), onMouseDown: snapshotSelection, onChange:
|
|
812
|
+
const fontSection = (config.font.family || (config.font.size && !uniform)) && (_jsxs(MantineToolbar.Group, { children: [config.font.family && (_jsx(ToolbarSelect, { icon: IconTypography, label: strings.toolbar.fontFamily, width: 150, value: fontOptions.some((f) => f.family === shownFontFamily) ? shownFontFamily : null, placeholder: strings.toolbar.fontFamilyPlaceholder, data: fontData, searchable: true, noMatchMessage: strings.toolbar.noMatch, renderOption: ({ option }) => _jsx("span", { style: { fontFamily: option.value }, children: option.label }), onMouseDown: snapshotSelection, onChange: uniform
|
|
813
|
+
? // A view setting: leave the editor state and selection alone, just hand the caret back.
|
|
814
|
+
(v) => {
|
|
815
|
+
onUniformFontFamilyChange?.(v);
|
|
816
|
+
editor.focus();
|
|
817
|
+
}
|
|
818
|
+
: withRefocus((v) => applyFont('font-family', v)) })), config.font.size && !uniform && (_jsx(ToolbarSelect, { icon: IconTextSize, label: strings.toolbar.fontSize, width: 84, value: FONT_SIZES_PX.some((px) => `${px}px` === shownFontSize) ? shownFontSize : null, placeholder: strings.toolbar.fontSizePlaceholder, data: FONT_SIZES_PX.map((px) => ({ value: `${px}px`, label: String(px) })), onMouseDown: snapshotSelection, onChange: withRefocus((v) => applyFont('font-size', v)) }))] }, "font"));
|
|
810
819
|
const insertSection = showInsertGroup && (_jsxs(MantineToolbar.Group, { className: "likhari-toolbar-cluster", children: [config.links &&
|
|
811
820
|
(state.isLink ? (_jsxs(Menu, { position: "bottom-start", withinPortal: true, portalProps: { target: portalTarget }, shadow: "sm", width: 240, onOpen: snapshotSelection, children: [_jsx(Menu.Target, { children: _jsx(ToolbarButton, { icon: IconLink, title: strings.toolbar.linkOptions, active: true, "aria-haspopup": "menu" }) }), _jsx(Menu.Dropdown, { children: _jsx(LinkMenuItems, { url: state.linkUrl, onEdit: () => {
|
|
812
821
|
restoreSelection();
|
|
@@ -819,7 +828,21 @@ export function Toolbar({ config, toolbarStyle, dictionaryStores = [], thesaurus
|
|
|
819
828
|
editor.focus();
|
|
820
829
|
};
|
|
821
830
|
const toolsSection = (_jsxs(MantineToolbar.Group, { className: "likhari-toolbar-cluster", children: [config.language.autocorrect && (_jsx(ToolbarButton, { icon: IconWand, title: strings.toolbar.autocorrect, active: autoCorrectOpen, onClick: onToggleAutoCorrect })), config.language.textCleanup && (_jsx(ToolbarButton, { icon: IconSparkles, title: strings.autoCorrect.correctDocument, onClick: () => editor.dispatchCommand(CORRECT_DOCUMENT_COMMAND, undefined) })), config.language.spellCheck && (_jsx(ToolbarButton, { icon: IconAbc, title: strings.toolbar.spellChecker, active: spellOpen, onClick: onToggleSpell })), config.joinLines && (_jsx(ToolbarButton, { icon: IconArrowsJoin, title: strings.toolbar.joinLines, disabled: !state.canJoinLines, onClick: joinLines }))] }, "tools"));
|
|
822
|
-
|
|
831
|
+
// Uniform mode's zoom: [-] 100% [+], stepping through the preset levels; the
|
|
832
|
+
// percentage resets to 100%. Always laid out left-to-right, like a number.
|
|
833
|
+
const showZoom = uniform && config.font.size;
|
|
834
|
+
const zoomOutTo = [...ZOOM_LEVELS_PERCENT].reverse().find((level) => level < zoom);
|
|
835
|
+
const zoomInTo = ZOOM_LEVELS_PERCENT.find((level) => level > zoom);
|
|
836
|
+
const hasEndUtilities = Boolean(drafts || config.findReplace || helpUrl !== false);
|
|
837
|
+
const zoomGroup = showZoom && (_jsxs(MantineToolbar.Group, { className: "likhari-toolbar-cluster", role: "group", "aria-label": strings.toolbar.zoom, dir: "ltr",
|
|
838
|
+
// The group is forced left-to-right, which would flip a logical margin
|
|
839
|
+
// too, so the "push to the end" margin is set on the physical side: the
|
|
840
|
+
// toolbar's end is the left edge in RTL and the right edge in LTR.
|
|
841
|
+
style: rtl ? { marginRight: 'auto' } : { marginLeft: 'auto' }, children: [_jsx(ToolbarButton, { icon: IconMinus, title: strings.toolbar.zoomOut, disabled: zoomOutTo === undefined, onClick: () => zoomOutTo !== undefined && onZoomChange?.(zoomOutTo) }), _jsxs(MantineToolbar.Toggle, { title: strings.toolbar.zoomReset, "aria-label": `${strings.toolbar.zoomReset} (${zoom}%)`, onMouseDown: (e) => e.preventDefault(), onClick: () => onZoomChange?.(100), style: { width: 'auto', minWidth: 52, padding: '0 6px', fontSize: 12 }, children: [zoom, "%"] }), _jsx(ToolbarButton, { icon: IconPlus, title: strings.toolbar.zoomIn, disabled: zoomInTo === undefined, onClick: () => zoomInTo !== undefined && onZoomChange?.(zoomInTo) })] }, "zoom"));
|
|
842
|
+
// Drafts, search and help sit at the far end; the zoom stepper is its own
|
|
843
|
+
// group just before them, and takes over the "push to the end" margin.
|
|
844
|
+
const utilitiesGroup = hasEndUtilities && (_jsxs(MantineToolbar.Group, { className: "likhari-toolbar-cluster", style: showZoom ? undefined : { marginInlineStart: 'auto' }, children: [drafts && _jsx(ToolbarButton, { icon: IconHistory, title: strings.toolbar.drafts, onClick: () => setDraftsOpen(true) }), config.findReplace && (_jsx(ToolbarButton, { icon: IconSearch, title: strings.findReplace.toggle, active: findOpen, onClick: onToggleFind })), helpUrl !== false && (_jsx(MantineToolbar.Toggle, { component: "a", href: helpUrl ?? DEFAULT_HELP_URL, target: "_blank", rel: "noopener noreferrer", "aria-label": strings.toolbar.help, title: strings.toolbar.help, children: _jsx(IconHelpCircle, { size: ICON_SIZE, stroke: ICON_STROKE }) }))] }, "end"));
|
|
845
|
+
const endSection = (zoomGroup || utilitiesGroup) && (_jsxs(Fragment, { children: [zoomGroup, utilitiesGroup] }, "end-sections"));
|
|
823
846
|
const startSections = [
|
|
824
847
|
showSave && (_jsx(MantineToolbar.Group, { className: "likhari-toolbar-cluster", children: _jsx(ToolbarButton, { icon: IconDeviceFloppy, title: strings.toolbar.save, dirty: Boolean(isDirty), onClick: onSave }) }, "save")),
|
|
825
848
|
config.history && (_jsxs(MantineToolbar.Group, { className: "likhari-toolbar-cluster", children: [_jsx(ToolbarButton, { icon: IconArrowBackUp, title: strings.toolbar.undo, disabled: !state.canUndo, onClick: () => editor.dispatchCommand(UNDO_COMMAND, undefined) }), _jsx(ToolbarButton, { icon: IconArrowForwardUp, title: strings.toolbar.redo, disabled: !state.canRedo, onClick: () => editor.dispatchCommand(REDO_COMMAND, undefined) })] }, "history")),
|
package/dist/fonts/index.d.ts
CHANGED
|
@@ -4,6 +4,15 @@ export { URDU_WEB_FONT_OPTIONS, injectUrduWebFontsCss, type FontOption } from '.
|
|
|
4
4
|
export declare const DEFAULT_FONT_OPTIONS: FontOption[];
|
|
5
5
|
/** Sizes offered by the toolbar's font-size dropdown, in px. */
|
|
6
6
|
export declare const FONT_SIZES_PX: number[];
|
|
7
|
+
/** How fonts are applied: per selection (`'selective'`) or editor-wide (`'uniform'`). */
|
|
8
|
+
export type FontMode = 'selective' | 'uniform';
|
|
9
|
+
/** Zoom levels offered in `uniform` mode, as percentages of the normal text size. */
|
|
10
|
+
export declare const ZOOM_LEVELS_PERCENT: number[];
|
|
11
|
+
export declare const ZOOM_MIN_PERCENT: number;
|
|
12
|
+
export declare const ZOOM_MAX_PERCENT: number;
|
|
13
|
+
export declare const ZOOM_DEFAULT_PERCENT = 100;
|
|
14
|
+
/** Keeps a zoom percentage inside the supported range; non-numbers become 100. */
|
|
15
|
+
export declare function clampZoom(value: number | undefined): number;
|
|
7
16
|
/**
|
|
8
17
|
* What the canvas renders when text has no explicit font style — kept in sync
|
|
9
18
|
* with `.likhari-content-editable` in theme/editor.css. The toolbar's font
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fonts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAExE,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fonts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAExE,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC/F,yEAAyE;AACzE,eAAO,MAAM,oBAAoB,EAAE,UAAU,EAK5C,CAAC;AAEF,gEAAgE;AAChE,eAAO,MAAM,aAAa,UAAmD,CAAC;AAE9E,yFAAyF;AACzF,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;AAE/C,qFAAqF;AACrF,eAAO,MAAM,mBAAmB,UAAuD,CAAC;AACxF,eAAO,MAAM,gBAAgB,QAAyB,CAAC;AACvD,eAAO,MAAM,gBAAgB,QAAsD,CAAC;AACpF,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,kFAAkF;AAClF,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAG3D;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;CAGvB,CAAC"}
|
package/dist/fonts/index.js
CHANGED
|
@@ -9,6 +9,17 @@ export const DEFAULT_FONT_OPTIONS = [
|
|
|
9
9
|
];
|
|
10
10
|
/** Sizes offered by the toolbar's font-size dropdown, in px. */
|
|
11
11
|
export const FONT_SIZES_PX = [12, 13, 14, 15, 16, 18, 20, 24, 28, 32, 36, 48];
|
|
12
|
+
/** Zoom levels offered in `uniform` mode, as percentages of the normal text size. */
|
|
13
|
+
export const ZOOM_LEVELS_PERCENT = [50, 75, 90, 100, 110, 125, 150, 175, 200, 250, 300];
|
|
14
|
+
export const ZOOM_MIN_PERCENT = ZOOM_LEVELS_PERCENT[0];
|
|
15
|
+
export const ZOOM_MAX_PERCENT = ZOOM_LEVELS_PERCENT[ZOOM_LEVELS_PERCENT.length - 1];
|
|
16
|
+
export const ZOOM_DEFAULT_PERCENT = 100;
|
|
17
|
+
/** Keeps a zoom percentage inside the supported range; non-numbers become 100. */
|
|
18
|
+
export function clampZoom(value) {
|
|
19
|
+
if (value === undefined || !Number.isFinite(value))
|
|
20
|
+
return ZOOM_DEFAULT_PERCENT;
|
|
21
|
+
return Math.min(ZOOM_MAX_PERCENT, Math.max(ZOOM_MIN_PERCENT, Math.round(value)));
|
|
22
|
+
}
|
|
12
23
|
/**
|
|
13
24
|
* What the canvas renders when text has no explicit font style — kept in sync
|
|
14
25
|
* with `.likhari-content-editable` in theme/editor.css. The toolbar's font
|
package/dist/i18n/strings.d.ts
CHANGED
|
@@ -39,6 +39,10 @@ export interface Strings {
|
|
|
39
39
|
fontFamilyPlaceholder: string;
|
|
40
40
|
fontSize: string;
|
|
41
41
|
fontSizePlaceholder: string;
|
|
42
|
+
zoom: string;
|
|
43
|
+
zoomIn: string;
|
|
44
|
+
zoomOut: string;
|
|
45
|
+
zoomReset: string;
|
|
42
46
|
noMatch: string;
|
|
43
47
|
alignment: string;
|
|
44
48
|
linkOptions: 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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
30
|
fontFamilyPlaceholder: 'Font',
|
|
31
31
|
fontSize: 'Font size',
|
|
32
32
|
fontSizePlaceholder: 'Size',
|
|
33
|
+
zoom: 'Zoom',
|
|
34
|
+
zoomIn: 'Zoom in',
|
|
35
|
+
zoomOut: 'Zoom out',
|
|
36
|
+
zoomReset: 'Reset zoom to 100%',
|
|
33
37
|
noMatch: 'No match',
|
|
34
38
|
alignment: 'Alignment',
|
|
35
39
|
linkOptions: 'Link options',
|
|
@@ -311,6 +315,10 @@ const ur = {
|
|
|
311
315
|
fontFamilyPlaceholder: 'فونٹ',
|
|
312
316
|
fontSize: 'فونٹ کا سائز',
|
|
313
317
|
fontSizePlaceholder: 'سائز',
|
|
318
|
+
zoom: 'زوم',
|
|
319
|
+
zoomIn: 'بڑا کریں',
|
|
320
|
+
zoomOut: 'چھوٹا کریں',
|
|
321
|
+
zoomReset: 'زوم ۱۰۰٪ پر واپس لائیں',
|
|
314
322
|
noMatch: 'کوئی مماثلت نہیں',
|
|
315
323
|
alignment: 'سیدھ',
|
|
316
324
|
linkOptions: 'لنک کے اختیارات',
|
|
@@ -592,6 +600,10 @@ const paShahmukhi = {
|
|
|
592
600
|
fontFamilyPlaceholder: 'فونٹ',
|
|
593
601
|
fontSize: 'فونٹ دا سائز',
|
|
594
602
|
fontSizePlaceholder: 'سائز',
|
|
603
|
+
zoom: 'زوم',
|
|
604
|
+
zoomIn: 'وڈا کرو',
|
|
605
|
+
zoomOut: 'چھوٹا کرو',
|
|
606
|
+
zoomReset: 'زوم ۱۰۰٪ تے واپس لیاؤ',
|
|
595
607
|
noMatch: 'کوئی نئیں ملیا',
|
|
596
608
|
alignment: 'سیدھ',
|
|
597
609
|
linkOptions: 'لنک دے اختیار',
|
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export type { DraftRestoreMode } from './components/DraftRestore.js';
|
|
|
6
6
|
export { defaultMantineTheme } from './theme/mantineTheme.js';
|
|
7
7
|
export { ImageNode, $createImageNode, $isImageNode } from './image/ImageNode.js';
|
|
8
8
|
export type { ImagePayload, ImageLinkType, SerializedImageNode } from './image/ImageNode.js';
|
|
9
|
-
export { DEFAULT_FONT_OPTIONS, URDU_WEB_FONT_OPTIONS, FONT_SIZES_PX } from './fonts/index.js';
|
|
10
|
-
export type { FontOption } from './fonts/index.js';
|
|
9
|
+
export { DEFAULT_FONT_OPTIONS, URDU_WEB_FONT_OPTIONS, FONT_SIZES_PX, ZOOM_LEVELS_PERCENT } from './fonts/index.js';
|
|
10
|
+
export type { FontOption, FontMode } from './fonts/index.js';
|
|
11
11
|
export { STRINGS, getStrings, useStrings, useUiStrings, UiStringsContext } from './i18n/index.js';
|
|
12
12
|
export type { Locale, Strings } from './i18n/index.js';
|
|
13
13
|
export { registerSpellDictionary, hasSpellDictionary, setEnglishDictionaryBaseUrl, type HunspellFiles, type SpellLanguage } from './spellcheck/spellDictionaries.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC1G,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC9E,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,aAAa,E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,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAChI,YAAY,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAC1F,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAClI,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAChG,YAAY,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export { EditorRoot } from './EditorRoot.js';
|
|
|
2
2
|
export { DEFAULT_HELP_URL } from './components/Toolbar.js';
|
|
3
3
|
export { defaultMantineTheme } from './theme/mantineTheme.js';
|
|
4
4
|
export { ImageNode, $createImageNode, $isImageNode } from './image/ImageNode.js';
|
|
5
|
-
export { DEFAULT_FONT_OPTIONS, URDU_WEB_FONT_OPTIONS, FONT_SIZES_PX } from './fonts/index.js';
|
|
5
|
+
export { DEFAULT_FONT_OPTIONS, URDU_WEB_FONT_OPTIONS, FONT_SIZES_PX, ZOOM_LEVELS_PERCENT } from './fonts/index.js';
|
|
6
6
|
export { STRINGS, getStrings, useStrings, useUiStrings, UiStringsContext } from './i18n/index.js';
|
|
7
7
|
export { registerSpellDictionary, hasSpellDictionary, setEnglishDictionaryBaseUrl } from './spellcheck/spellDictionaries.js';
|
|
8
8
|
export { localStorageAutoCorrectStore, apiAutoCorrectStore, fileAutoCorrectStore } from './autocorrect/autoCorrectStores.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remembers the uniform font mode's font family and zoom in `localStorage`, so a
|
|
3
|
+
* reader's choice survives a reload. They are a view preference, not document
|
|
4
|
+
* content, so they are stored apart from drafts: under `documentId` when the
|
|
5
|
+
* editor has one, otherwise shared by editors on the page. Every function is a
|
|
6
|
+
* no-op (never throws) when `localStorage` is unavailable or holds bad data.
|
|
7
|
+
*/
|
|
8
|
+
export interface StoredFontSettings {
|
|
9
|
+
fontFamily?: string;
|
|
10
|
+
zoom?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function readFontSettings(documentId?: string): StoredFontSettings;
|
|
13
|
+
export declare function writeFontSettings(settings: StoredFontSettings, documentId?: string): void;
|
|
14
|
+
//# sourceMappingURL=fontStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fontStorage.d.ts","sourceRoot":"","sources":["../../src/persistence/fontStorage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAcD,wBAAgB,gBAAgB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,kBAAkB,CAcxE;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAMzF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remembers the uniform font mode's font family and zoom in `localStorage`, so a
|
|
3
|
+
* reader's choice survives a reload. They are a view preference, not document
|
|
4
|
+
* content, so they are stored apart from drafts: under `documentId` when the
|
|
5
|
+
* editor has one, otherwise shared by editors on the page. Every function is a
|
|
6
|
+
* no-op (never throws) when `localStorage` is unavailable or holds bad data.
|
|
7
|
+
*/
|
|
8
|
+
const KEY_PREFIX = 'likhari:font:';
|
|
9
|
+
const SHARED_ID = '_';
|
|
10
|
+
function storage() {
|
|
11
|
+
try {
|
|
12
|
+
return typeof localStorage === 'undefined' ? null : localStorage;
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function keyFor(documentId) {
|
|
19
|
+
return `${KEY_PREFIX}${documentId ?? SHARED_ID}`;
|
|
20
|
+
}
|
|
21
|
+
export function readFontSettings(documentId) {
|
|
22
|
+
try {
|
|
23
|
+
const raw = storage()?.getItem(keyFor(documentId));
|
|
24
|
+
if (!raw)
|
|
25
|
+
return {};
|
|
26
|
+
const parsed = JSON.parse(raw);
|
|
27
|
+
if (!parsed || typeof parsed !== 'object')
|
|
28
|
+
return {};
|
|
29
|
+
const { fontFamily, zoom } = parsed;
|
|
30
|
+
return {
|
|
31
|
+
...(typeof fontFamily === 'string' && fontFamily !== '' && { fontFamily }),
|
|
32
|
+
...(typeof zoom === 'number' && Number.isFinite(zoom) && { zoom }),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return {};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export function writeFontSettings(settings, documentId) {
|
|
40
|
+
try {
|
|
41
|
+
storage()?.setItem(keyFor(documentId), JSON.stringify(settings));
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// Storage full or blocked: the setting still applies for this session.
|
|
45
|
+
}
|
|
46
|
+
}
|
package/dist/theme/editor.css
CHANGED
|
@@ -180,6 +180,50 @@
|
|
|
180
180
|
line-height: 1.75;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
/* Uniform font mode (EditorRoot `fontMode="uniform"`): zoom scales the base
|
|
184
|
+
size of each direction, and headings, sub/superscript and the like follow
|
|
185
|
+
because they are em-based. --likhari-zoom is a unitless factor (1 = 100%). */
|
|
186
|
+
.likhari-content-editable[data-font-mode='uniform'] {
|
|
187
|
+
font-size: calc(15px * var(--likhari-zoom, 1));
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.likhari-content-editable[data-font-mode='uniform'][dir='rtl'],
|
|
191
|
+
.likhari-content-editable[data-font-mode='uniform'] .likhari-rtl {
|
|
192
|
+
font-size: calc(20px * var(--likhari-zoom, 1));
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.likhari-content-editable[data-font-mode='uniform'] .likhari-ltr {
|
|
196
|
+
font-size: calc(15px * var(--likhari-zoom, 1));
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/* Headings carry a direction class too, which the rules above would otherwise
|
|
200
|
+
pin to the body size; their em sizes (relative to the zoomed canvas) win. */
|
|
201
|
+
.likhari-content-editable[data-font-mode='uniform'] .likhari-h1 { font-size: 1.8em; }
|
|
202
|
+
.likhari-content-editable[data-font-mode='uniform'] .likhari-h2 { font-size: 1.5em; }
|
|
203
|
+
.likhari-content-editable[data-font-mode='uniform'] .likhari-h3 { font-size: 1.3em; }
|
|
204
|
+
.likhari-content-editable[data-font-mode='uniform'] .likhari-h4 { font-size: 1.2em; }
|
|
205
|
+
.likhari-content-editable[data-font-mode='uniform'] .likhari-h5 { font-size: 1.1em; }
|
|
206
|
+
.likhari-content-editable[data-font-mode='uniform'] .likhari-h6 { font-size: 1.05em; }
|
|
207
|
+
|
|
208
|
+
/* A chosen font replaces the per-direction defaults too, so every block gets it. */
|
|
209
|
+
.likhari-content-editable[data-uniform-font],
|
|
210
|
+
.likhari-content-editable[data-uniform-font] .likhari-ltr,
|
|
211
|
+
.likhari-content-editable[data-uniform-font] .likhari-rtl {
|
|
212
|
+
font-family: var(--likhari-uniform-font);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/* Text styled inline (imported HTML, content from selective mode) must not
|
|
216
|
+
escape the uniform font and zoom. Headings and sub/superscript size by
|
|
217
|
+
class, not inline style, so they keep their proportions. (An inline style
|
|
218
|
+
on a block's own element is not expected; Lexical styles text runs.) */
|
|
219
|
+
.likhari-content-editable[data-font-mode='uniform'] [style*='font-size'] {
|
|
220
|
+
font-size: inherit !important;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.likhari-content-editable[data-uniform-font] [style*='font-family'] {
|
|
224
|
+
font-family: inherit !important;
|
|
225
|
+
}
|
|
226
|
+
|
|
183
227
|
.likhari-placeholder {
|
|
184
228
|
position: absolute;
|
|
185
229
|
top: 20px;
|