@inshapardaz/likhari-react 0.1.46 → 0.1.47-dev.346
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/Toolbar.d.ts +6 -0
- package/dist/components/Toolbar.d.ts.map +1 -1
- package/dist/components/Toolbar.js +134 -55
- package/dist/i18n/strings.d.ts +15 -0
- package/dist/i18n/strings.d.ts.map +1 -1
- package/dist/i18n/strings.js +33 -0
- package/dist/theme/editor.css +93 -0
- package/package.json +1 -1
|
@@ -7,6 +7,12 @@ 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 {
|
|
10
|
+
/**
|
|
11
|
+
* `classic` is the single row of command groups (UI spec §3.1); `ribbon` puts the same
|
|
12
|
+
* commands on tabs (Home, Insert, Tools, View) with Table, Poetry and Link tabs that
|
|
13
|
+
* appear while the caret is in that kind of content (UI spec §3.4). Default `classic`.
|
|
14
|
+
*/
|
|
15
|
+
layout?: 'classic' | 'ribbon';
|
|
10
16
|
/** Outline the toolbar and each button cluster. Default true. */
|
|
11
17
|
bordered?: boolean;
|
|
12
18
|
/** `light` tints the active button, `filled` fills it with the accent. Default `light`. */
|
|
@@ -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,EAAE,2BAA2B,EAAE,MAAM,2BAA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gB,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAgB,EAAE,YAAY,EAAE,SAAiB,EAAE,aAAa,EAAE,eAAuB,EAAE,mBAAmB,EAAE,WAAkC,EAAE,QAAsB,EAAE,iBAAiB,EAAE,IAAU,EAAE,yBAAyB,EAAE,YAAY,EAAE,SAAiB,EAAE,MAAa,EAAE,kBAA2B,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,YAAY,+BAm/C3d"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment, forwardRef, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { Fragment, forwardRef, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { Menu, Select, Toolbar as MantineToolbar } from '@mantine/core';
|
|
4
4
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
5
5
|
import { $getSelection, $isRangeSelection, $isElementNode, $setSelection, $getRoot, $selectAll, $getNearestNodeFromDOMNode, $createTextNode, KEY_MODIFIER_COMMAND, COMMAND_PRIORITY_NORMAL, FORMAT_TEXT_COMMAND, FORMAT_ELEMENT_COMMAND, INDENT_CONTENT_COMMAND, OUTDENT_CONTENT_COMMAND, UNDO_COMMAND, REDO_COMMAND, SELECTION_CHANGE_COMMAND, CAN_UNDO_COMMAND, CAN_REDO_COMMAND, COMMAND_PRIORITY_LOW, } from 'lexical';
|
|
@@ -172,27 +172,34 @@ function ToolbarSelect({ icon: Icon, label, value, data, width, disabled, placeh
|
|
|
172
172
|
function MoreMenuItem({ icon: Icon, label, active, onClick, }) {
|
|
173
173
|
return (_jsx(Menu.Item, { leftSection: _jsx(Icon, { size: ICON_SIZE, stroke: ICON_STROKE }), "data-active": active ? 'true' : 'false', onMouseDown: (e) => e.preventDefault(), onClick: onClick, children: label }));
|
|
174
174
|
}
|
|
175
|
-
|
|
175
|
+
/** One command, as a menu item or as a ribbon button (the label becomes its tooltip and name). */
|
|
176
|
+
function CommandItem({ mode, icon: Icon, label, onClick, disabled, color, }) {
|
|
177
|
+
if (mode === 'ribbon') {
|
|
178
|
+
return _jsx(ToolbarButton, { icon: Icon, title: label, disabled: disabled, "data-danger": color === 'red' ? 'true' : undefined, onClick: onClick });
|
|
179
|
+
}
|
|
180
|
+
return (_jsx(Menu.Item, { color: color, disabled: disabled, leftSection: _jsx(Icon, { size: ICON_SIZE, stroke: ICON_STROKE }), onMouseDown: (e) => e.preventDefault(), onClick: onClick, children: label }));
|
|
181
|
+
}
|
|
182
|
+
/** A group heading in a menu; the ribbon's tab already names the group, so it shows nothing there. */
|
|
183
|
+
const ItemLabel = ({ mode, children }) => (mode === 'ribbon' ? null : _jsx(Menu.Label, { children: children }));
|
|
184
|
+
const ItemDivider = ({ mode }) => (mode === 'ribbon' ? _jsx(MantineToolbar.Divider, {}) : _jsx(Menu.Divider, {}));
|
|
185
|
+
function LinkMenuItems({ url, onEdit, onRemove, strings, mode = 'menu' }) {
|
|
176
186
|
// Only offer the link as clickable if it's a URL the editor would have accepted.
|
|
177
187
|
const safeUrl = normalizeLinkUrl(url);
|
|
178
|
-
return (_jsxs(_Fragment, { children: [_jsx(
|
|
188
|
+
return (_jsxs(_Fragment, { children: [_jsx(ItemLabel, { mode: mode, children: strings.link.menuLabel }), mode === 'ribbon' ? (safeUrl && (_jsx(MantineToolbar.Toggle, { component: "a", href: safeUrl, target: "_blank", rel: "noopener noreferrer", "aria-label": url, title: url, children: _jsx(IconExternalLink, { size: ICON_SIZE, stroke: ICON_STROKE }) }))) : safeUrl ? (_jsx(Menu.Item, { component: "a", href: safeUrl, target: "_blank", rel: "noopener noreferrer", leftSection: _jsx(IconExternalLink, { size: ICON_SIZE, stroke: ICON_STROKE }), title: url, className: "likhari-link-menu-url", children: url })) : (
|
|
179
189
|
// Not a URL the editor would accept (e.g. loaded from a document): show it, don't make it clickable.
|
|
180
|
-
_jsx(Menu.Item, { disabled: true, title: url, className: "likhari-link-menu-url", children: url || strings.link.noUrl })), _jsx(
|
|
190
|
+
_jsx(Menu.Item, { disabled: true, title: url, className: "likhari-link-menu-url", children: url || strings.link.noUrl })), _jsx(CommandItem, { mode: mode, icon: IconPencil, label: strings.link.editLink, onClick: onEdit }), _jsx(CommandItem, { mode: mode, icon: IconLinkOff, label: strings.link.removeLink, onClick: onRemove, color: "red" })] }));
|
|
181
191
|
}
|
|
182
192
|
/** The table actions menu's contents — shared by the toolbar button and the
|
|
183
193
|
* right-click menu. Each acts on the selected cell, or on every row/column a
|
|
184
194
|
* multi-cell selection covers. */
|
|
185
|
-
function TableMenuItems({ strings, direction, rows, columns, canMergeCells, canUnmergeCell, onAction, }) {
|
|
195
|
+
function TableMenuItems({ strings, direction, rows, columns, canMergeCells, canUnmergeCell, onAction, mode = 'menu', }) {
|
|
186
196
|
const t = strings.tableMenu;
|
|
187
197
|
// "Before" is the start side, which is on the right in an RTL table.
|
|
188
198
|
const rtl = direction === 'rtl';
|
|
189
199
|
const manyRows = rows > 1;
|
|
190
200
|
const manyColumns = columns > 1;
|
|
191
|
-
const item = (icon, label, action, color) => {
|
|
192
|
-
|
|
193
|
-
return (_jsx(Menu.Item, { color: color, leftSection: _jsx(Icon, { size: ICON_SIZE, stroke: ICON_STROKE }), onMouseDown: (e) => e.preventDefault(), onClick: onAction(action), children: label }));
|
|
194
|
-
};
|
|
195
|
-
return (_jsxs(_Fragment, { children: [_jsx(Menu.Label, { children: t.menuLabel }), item(IconRowInsertTop, manyRows ? t.insertRowsBefore : t.insertRowBefore, () => $insertTableRows(false)), item(IconRowInsertBottom, manyRows ? t.insertRowsAfter : t.insertRowAfter, () => $insertTableRows(true)), item(rtl ? IconColumnInsertRight : IconColumnInsertLeft, manyColumns ? t.insertColumnsBefore : t.insertColumnBefore, () => $insertTableColumns(false)), item(rtl ? IconColumnInsertLeft : IconColumnInsertRight, manyColumns ? t.insertColumnsAfter : t.insertColumnAfter, () => $insertTableColumns(true)), (canMergeCells || canUnmergeCell) && _jsx(Menu.Divider, {}), canMergeCells && item(IconArrowMergeBoth, t.mergeCells, $mergeTableCells), canUnmergeCell && item(IconArrowsSplit2, t.unmergeCell, $unmergeTableCell), _jsx(Menu.Divider, {}), item(IconRowRemove, manyRows ? t.deleteRows : t.deleteRow, $deleteTableRows), item(IconColumnRemove, manyColumns ? t.deleteColumns : t.deleteColumn, $deleteTableColumns), item(IconTableMinus, t.deleteTable, $deleteTable, 'red')] }));
|
|
201
|
+
const item = (icon, label, action, color) => (_jsx(CommandItem, { mode: mode, icon: icon, label: label, onClick: onAction(action), color: color }));
|
|
202
|
+
return (_jsxs(_Fragment, { children: [_jsx(ItemLabel, { mode: mode, children: t.menuLabel }), item(IconRowInsertTop, manyRows ? t.insertRowsBefore : t.insertRowBefore, () => $insertTableRows(false)), item(IconRowInsertBottom, manyRows ? t.insertRowsAfter : t.insertRowAfter, () => $insertTableRows(true)), item(rtl ? IconColumnInsertRight : IconColumnInsertLeft, manyColumns ? t.insertColumnsBefore : t.insertColumnBefore, () => $insertTableColumns(false)), item(rtl ? IconColumnInsertLeft : IconColumnInsertRight, manyColumns ? t.insertColumnsAfter : t.insertColumnAfter, () => $insertTableColumns(true)), (canMergeCells || canUnmergeCell) && _jsx(ItemDivider, { mode: mode }), canMergeCells && item(IconArrowMergeBoth, t.mergeCells, $mergeTableCells), canUnmergeCell && item(IconArrowsSplit2, t.unmergeCell, $unmergeTableCell), _jsx(ItemDivider, { mode: mode }), item(IconRowRemove, manyRows ? t.deleteRows : t.deleteRow, $deleteTableRows), item(IconColumnRemove, manyColumns ? t.deleteColumns : t.deleteColumn, $deleteTableColumns), item(IconTableMinus, t.deleteTable, $deleteTable, 'red')] }));
|
|
196
203
|
}
|
|
197
204
|
/** Whether a one-notch step from `value` stays on the scale — a step that
|
|
198
205
|
* would fall off either end is disabled rather than silently clamped. */
|
|
@@ -200,18 +207,15 @@ function canStep(scale, value, step) {
|
|
|
200
207
|
const next = scale.indexOf(value) + step;
|
|
201
208
|
return next >= 0 && next < scale.length;
|
|
202
209
|
}
|
|
203
|
-
function PoetryMenuItems({ strings, layout, scale, centered, onAction, }) {
|
|
210
|
+
function PoetryMenuItems({ strings, layout, scale, centered, onAction, mode = 'menu', }) {
|
|
204
211
|
const t = strings.poetryMenu;
|
|
205
|
-
const item = (icon, label, action, active = false, color) => {
|
|
206
|
-
const Icon = icon;
|
|
207
|
-
return (_jsx(Menu.Item, { color: color, disabled: active, leftSection: _jsx(Icon, { size: ICON_SIZE, stroke: ICON_STROKE }), onMouseDown: (e) => e.preventDefault(), onClick: onAction(action), children: label }));
|
|
208
|
-
};
|
|
212
|
+
const item = (icon, label, action, active = false, color) => (_jsx(CommandItem, { mode: mode, icon: icon, label: label, onClick: onAction(action), disabled: active, color: color }));
|
|
209
213
|
const setLayout = (next) => () => {
|
|
210
214
|
const node = $getPoetryBlockFromSelection();
|
|
211
215
|
if (node)
|
|
212
216
|
$setPoetryLayout(node, next);
|
|
213
217
|
};
|
|
214
|
-
return (_jsxs(_Fragment, { children: [_jsx(
|
|
218
|
+
return (_jsxs(_Fragment, { children: [_jsx(ItemLabel, { mode: mode, 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(ItemDivider, { mode: mode }), _jsx(ItemDivider, { mode: mode }), 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)), centered && (_jsxs(_Fragment, { children: [item(IconArrowsMinimize, t.narrowerCenter, () => $adjustPoetryCenterWidth(-1), !canStep(POETRY_CENTER_WIDTHS, scale.centerWidth, -1)), item(IconArrowsMaximize, t.widerCenter, () => $adjustPoetryCenterWidth(1), !canStep(POETRY_CENTER_WIDTHS, scale.centerWidth, 1))] })), 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')] }));
|
|
215
219
|
}
|
|
216
220
|
/** `docs/markdown-dialect.md` at the repository's default branch — the Markdown
|
|
217
221
|
* format this editor reads and writes, including the poetry container syntax. */
|
|
@@ -220,6 +224,7 @@ export function Toolbar({ config, toolbarStyle, dictionaryStores = [], thesaurus
|
|
|
220
224
|
const bordered = toolbarStyle?.bordered ?? true;
|
|
221
225
|
const variant = toolbarStyle?.variant ?? 'light';
|
|
222
226
|
const overflowEnabled = toolbarStyle?.overflow ?? true;
|
|
227
|
+
const ribbon = toolbarStyle?.layout === 'ribbon';
|
|
223
228
|
const [editor] = useLexicalComposerContext();
|
|
224
229
|
const [state, setState] = useState(INITIAL_STATE);
|
|
225
230
|
const strings = useStrings(locale);
|
|
@@ -559,6 +564,8 @@ export function Toolbar({ config, toolbarStyle, dictionaryStores = [], thesaurus
|
|
|
559
564
|
editor.focus();
|
|
560
565
|
};
|
|
561
566
|
const [contextMenu, setContextMenu] = useState(null);
|
|
567
|
+
const [ribbonTab, setRibbonTab] = useState('home');
|
|
568
|
+
const ribbonId = useId();
|
|
562
569
|
useEffect(() => {
|
|
563
570
|
const onContextMenu = async (event) => {
|
|
564
571
|
event.preventDefault();
|
|
@@ -847,17 +854,22 @@ export function Toolbar({ config, toolbarStyle, dictionaryStores = [], thesaurus
|
|
|
847
854
|
editor.focus();
|
|
848
855
|
}
|
|
849
856
|
: 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"));
|
|
850
|
-
|
|
851
|
-
|
|
857
|
+
/** The insert commands. `contextual` also puts the link, table and poetry option menus among them (the classic
|
|
858
|
+
* toolbar); the ribbon shows those on their own tabs instead. */
|
|
859
|
+
const insertButtons = (contextual) => (_jsxs(_Fragment, { children: [config.links &&
|
|
860
|
+
(contextual && 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: () => {
|
|
852
861
|
restoreSelection();
|
|
853
862
|
openLinkDialog();
|
|
854
|
-
}, onRemove: removeLink, strings: strings }) })] })) : (_jsx(ToolbarButton, { icon: IconLink, title: strings.toolbar.insertLink, onClick: openLinkDialog }))), (config.images.linked || config.images.embedded) && (_jsx(ToolbarButton, { icon: IconPhoto, title: strings.toolbar.insertImage, onClick: openImageDialog })), config.blocks.horizontalRule && (_jsx(ToolbarButton, { icon: IconSeparatorHorizontal, title: strings.toolbar.insertHorizontalRule, onClick: () => editor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, undefined) })), config.tables && _jsx(ToolbarButton, { icon: IconTable, title: strings.toolbar.insertTable, onClick: openTableDialog }), config.tables && state.inTable && (_jsxs(Menu, { position: "bottom-start", withinPortal: true, portalProps: { target: portalTarget }, shadow: "sm", width: 240, onOpen: snapshotSelection, children: [_jsx(Menu.Target, { children: _jsx(ToolbarButton, { icon: IconTableOptions, title: strings.toolbar.tableOptions, active: true, "aria-haspopup": "menu" }) }), _jsx(Menu.Dropdown, { children: _jsx(TableMenuItems, { strings: strings, direction: direction, rows: state.tableRows, columns: state.tableColumns, canMergeCells: state.canMergeCells, canUnmergeCell: state.canUnmergeCell, onAction: runMenuAction }) })] })), 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.pageBreak && (_jsx(ToolbarButton, { icon: IconPageBreak, title: strings.toolbar.insertPageBreak, onClick: () => editor.dispatchCommand(INSERT_PAGE_BREAK_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 }) })), config.poetry.enabled && state.inPoetry && (_jsxs(Menu, { position: "bottom-start", withinPortal: true, portalProps: { target: portalTarget }, shadow: "sm", width: 200, onOpen: snapshotSelection, children: [_jsx(Menu.Target, { children: _jsx(ToolbarButton, { icon: IconFeather, title: strings.toolbar.poetryOptions, active: true, "aria-haspopup": "menu" }) }), _jsx(Menu.Dropdown, { children: _jsx(PoetryMenuItems, { strings: strings, layout: state.poetryLayout, scale: state.poetryScale, centered: state.poetryCentered, onAction: runMenuAction }) })] }))] }
|
|
863
|
+
}, onRemove: removeLink, strings: strings }) })] })) : (_jsx(ToolbarButton, { icon: IconLink, title: strings.toolbar.insertLink, onClick: openLinkDialog }))), (config.images.linked || config.images.embedded) && (_jsx(ToolbarButton, { icon: IconPhoto, title: strings.toolbar.insertImage, onClick: openImageDialog })), config.blocks.horizontalRule && (_jsx(ToolbarButton, { icon: IconSeparatorHorizontal, title: strings.toolbar.insertHorizontalRule, onClick: () => editor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, undefined) })), config.tables && _jsx(ToolbarButton, { icon: IconTable, title: strings.toolbar.insertTable, onClick: openTableDialog }), contextual && config.tables && state.inTable && (_jsxs(Menu, { position: "bottom-start", withinPortal: true, portalProps: { target: portalTarget }, shadow: "sm", width: 240, onOpen: snapshotSelection, children: [_jsx(Menu.Target, { children: _jsx(ToolbarButton, { icon: IconTableOptions, title: strings.toolbar.tableOptions, active: true, "aria-haspopup": "menu" }) }), _jsx(Menu.Dropdown, { children: _jsx(TableMenuItems, { strings: strings, direction: direction, rows: state.tableRows, columns: state.tableColumns, canMergeCells: state.canMergeCells, canUnmergeCell: state.canUnmergeCell, onAction: runMenuAction }) })] })), 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.pageBreak && (_jsx(ToolbarButton, { icon: IconPageBreak, title: strings.toolbar.insertPageBreak, onClick: () => editor.dispatchCommand(INSERT_PAGE_BREAK_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 }) })), contextual && config.poetry.enabled && state.inPoetry && (_jsxs(Menu, { position: "bottom-start", withinPortal: true, portalProps: { target: portalTarget }, shadow: "sm", width: 200, onOpen: snapshotSelection, children: [_jsx(Menu.Target, { children: _jsx(ToolbarButton, { icon: IconFeather, title: strings.toolbar.poetryOptions, active: true, "aria-haspopup": "menu" }) }), _jsx(Menu.Dropdown, { children: _jsx(PoetryMenuItems, { strings: strings, layout: state.poetryLayout, scale: state.poetryScale, centered: state.poetryCentered, onAction: runMenuAction }) })] }))] }));
|
|
864
|
+
const insertSection = showInsertGroup && (_jsx(MantineToolbar.Group, { className: "likhari-toolbar-cluster", children: insertButtons(true) }, "insert"));
|
|
855
865
|
const joinLines = () => {
|
|
856
866
|
editor.update(() => {
|
|
857
867
|
$joinSelectedLines();
|
|
858
868
|
}, { discrete: true });
|
|
859
869
|
editor.focus();
|
|
860
870
|
};
|
|
871
|
+
// The tools group is always built, even when every command in it is off, so the ribbon asks first.
|
|
872
|
+
const hasToolsGroup = config.language.autocorrect || config.language.textCleanup || config.language.spellCheck || config.joinLines;
|
|
861
873
|
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"));
|
|
862
874
|
// Uniform mode's zoom: [-] 100% [+], stepping through the preset levels; the
|
|
863
875
|
// percentage resets to 100%. Always laid out left-to-right, like a number.
|
|
@@ -866,13 +878,18 @@ export function Toolbar({ config, toolbarStyle, dictionaryStores = [], thesaurus
|
|
|
866
878
|
const zoomInTo = ZOOM_LEVELS_PERCENT.find((level) => level > zoom);
|
|
867
879
|
const hasEndUtilities = Boolean(drafts || config.findReplace || helpUrl !== false);
|
|
868
880
|
const zoomGroup = showZoom && (_jsxs(MantineToolbar.Group, { className: "likhari-toolbar-cluster", role: "group", "aria-label": strings.toolbar.zoom, dir: "ltr", 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"));
|
|
881
|
+
const draftsButton = drafts && _jsx(ToolbarButton, { icon: IconHistory, title: strings.toolbar.drafts, onClick: () => setDraftsOpen(true) });
|
|
882
|
+
const findButton = config.findReplace && (_jsx(ToolbarButton, { icon: IconSearch, title: strings.findReplace.toggle, active: findOpen, onClick: onToggleFind }));
|
|
883
|
+
const helpButton = 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 }) }));
|
|
869
884
|
// Drafts, search and help: the far-end group (see `endMovable` below).
|
|
870
|
-
const utilitiesGroup = hasEndUtilities && (_jsxs(MantineToolbar.Group, { className: "likhari-toolbar-cluster", children: [
|
|
885
|
+
const utilitiesGroup = hasEndUtilities && (_jsxs(MantineToolbar.Group, { className: "likhari-toolbar-cluster", children: [draftsButton, findButton, helpButton] }, "end"));
|
|
886
|
+
const saveGroup = showSave && (_jsx(MantineToolbar.Group, { className: "likhari-toolbar-cluster", children: _jsx(ToolbarButton, { icon: IconDeviceFloppy, title: strings.toolbar.save, dirty: Boolean(isDirty),
|
|
887
|
+
// Nothing to save until the content has changed since it was loaded or last saved.
|
|
888
|
+
disabled: !isDirty, onClick: onSave }) }, "save"));
|
|
889
|
+
const historyGroup = 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"));
|
|
871
890
|
const startSections = [
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
disabled: !isDirty, onClick: onSave }) }, "save")),
|
|
875
|
-
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")),
|
|
891
|
+
saveGroup,
|
|
892
|
+
historyGroup,
|
|
876
893
|
formatSection,
|
|
877
894
|
alignSection,
|
|
878
895
|
];
|
|
@@ -942,35 +959,97 @@ export function Toolbar({ config, toolbarStyle, dictionaryStores = [], thesaurus
|
|
|
942
959
|
const visibleEnd = endMovable.filter(isVisible);
|
|
943
960
|
// Shown in the menu in toolbar order: the inline sections, then the far-end ones.
|
|
944
961
|
const hiddenMovable = [...mainMovable, ...endMovable].filter((section) => !isVisible(section));
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
962
|
+
// The right-click menu and the dialogs are the same in both layouts.
|
|
963
|
+
const contextMenuEl = (_jsxs(Menu, { opened: contextMenu !== null, onChange: (opened) => {
|
|
964
|
+
if (!opened)
|
|
965
|
+
setContextMenu(null);
|
|
966
|
+
}, position: "bottom-start", withinPortal: true, portalProps: { target: portalTarget }, shadow: "sm", width: 260, children: [_jsx(Menu.Target, { children: _jsx("span", { "aria-hidden": "true", style: { position: 'fixed', left: contextMenu?.x ?? -9999, top: contextMenu?.y ?? -9999, width: 1, height: 1, pointerEvents: 'none' } }) }), _jsxs(Menu.Dropdown, { children: [contextMenu?.spelling && (_jsxs(_Fragment, { children: [_jsx(Menu.Label, { children: strings.contextMenu.spelling }), contextMenu.spelling.suggestions.length === 0 && _jsx(Menu.Item, { disabled: true, children: strings.contextMenu.noSuggestions }), contextMenu.spelling.suggestions.map((suggestion) => (_jsx(Menu.Item, { onClick: () => {
|
|
967
|
+
const match = contextMenu.spelling.match;
|
|
968
|
+
editor.update(() => $replaceMatch(match, suggestion), { discrete: true });
|
|
969
|
+
editor.focus();
|
|
970
|
+
}, children: suggestion }, suggestion))), _jsx(Menu.Item, { onClick: () => {
|
|
971
|
+
ignoreWord(contextMenu.spelling.language, contextMenu.spelling.word);
|
|
972
|
+
setContextMenu(null);
|
|
973
|
+
}, children: strings.contextMenu.ignore }), _jsx(Menu.Item, { onClick: () => {
|
|
974
|
+
const { language, word } = contextMenu.spelling;
|
|
975
|
+
// Without a writable store, the word is ignored for this session instead.
|
|
976
|
+
void addUserWord(dictionaryStores, language, word).then((added) => {
|
|
977
|
+
if (!added)
|
|
978
|
+
ignoreWord(language, word);
|
|
979
|
+
});
|
|
980
|
+
setContextMenu(null);
|
|
981
|
+
}, children: strings.contextMenu.addToDictionary }), onAddAutoCorrect && config.language.autocorrect && (_jsx(Menu.Item, { onClick: () => {
|
|
982
|
+
onAddAutoCorrect(contextMenu.spelling.word, contextMenu.spelling.language);
|
|
983
|
+
setContextMenu(null);
|
|
984
|
+
}, 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: () => {
|
|
985
|
+
const match = contextMenu.thesaurus.match;
|
|
986
|
+
editor.update(() => $replaceMatch(match, synonym), { discrete: true });
|
|
987
|
+
editor.focus();
|
|
988
|
+
}, children: synonym }, synonym))), _jsx(Menu.Divider, {})] })), contextMenu?.link !== undefined && (_jsxs(_Fragment, { children: [_jsx(LinkMenuItems, { url: contextMenu.link, onEdit: () => {
|
|
989
|
+
restoreSelection();
|
|
990
|
+
openLinkDialog();
|
|
991
|
+
}, 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, {})] })), contextMenu?.text && (_jsxs(_Fragment, { children: [_jsx(Menu.Item, { leftSection: _jsx(IconArrowsJoin, { size: ICON_SIZE, stroke: ICON_STROKE }), disabled: !contextMenu.canJoin, onClick: runMenuAction(() => {
|
|
992
|
+
$joinSelectedLines();
|
|
993
|
+
}), children: strings.contextMenu.joinLines }), _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 })] })] }));
|
|
994
|
+
const dialogsEl = (_jsxs(_Fragment, { children: [(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 })] }));
|
|
995
|
+
// The ribbon layout (UI spec §3.4): the same command groups as above, on tabs.
|
|
996
|
+
if (ribbon) {
|
|
997
|
+
const rt = strings.toolbar.ribbon;
|
|
998
|
+
const cluster = (key, children) => (_jsx(MantineToolbar.Group, { className: "likhari-toolbar-cluster", children: children }, key));
|
|
999
|
+
const groupsByTab = {
|
|
1000
|
+
home: [formatSection, alignSection, fontSection],
|
|
1001
|
+
insert: [showInsertGroup && cluster('insert', insertButtons(false))],
|
|
1002
|
+
tools: [hasToolsGroup && toolsSection],
|
|
1003
|
+
view: [zoomGroup],
|
|
1004
|
+
table: [
|
|
1005
|
+
config.tables &&
|
|
1006
|
+
state.inTable &&
|
|
1007
|
+
cluster('table', _jsx(TableMenuItems, { mode: "ribbon", strings: strings, direction: direction, rows: state.tableRows, columns: state.tableColumns, canMergeCells: state.canMergeCells, canUnmergeCell: state.canUnmergeCell, onAction: runMenuAction })),
|
|
1008
|
+
],
|
|
1009
|
+
poetry: [
|
|
1010
|
+
config.poetry.enabled &&
|
|
1011
|
+
state.inPoetry &&
|
|
1012
|
+
cluster('poetry', _jsx(PoetryMenuItems, { mode: "ribbon", strings: strings, layout: state.poetryLayout, scale: state.poetryScale, centered: state.poetryCentered, onAction: runMenuAction })),
|
|
1013
|
+
],
|
|
1014
|
+
link: [
|
|
1015
|
+
config.links &&
|
|
1016
|
+
state.isLink &&
|
|
1017
|
+
cluster('link', _jsx(LinkMenuItems, { mode: "ribbon", url: state.linkUrl, onEdit: () => {
|
|
1018
|
+
restoreSelection();
|
|
1019
|
+
openLinkDialog();
|
|
1020
|
+
}, onRemove: removeLink, strings: strings })),
|
|
1021
|
+
],
|
|
1022
|
+
};
|
|
1023
|
+
const CONTEXTUAL = ['table', 'poetry', 'link'];
|
|
1024
|
+
// A tab with nothing to show (its features are off, or the caret is not in that content) is left out.
|
|
1025
|
+
const tabs = ['home', 'insert', 'tools', 'view', ...CONTEXTUAL]
|
|
1026
|
+
.map((id) => ({ id, label: rt[id], groups: groupsByTab[id].filter(Boolean) }))
|
|
1027
|
+
.filter((tab) => tab.groups.length > 0);
|
|
1028
|
+
const activeTab = tabs.find((tab) => tab.id === ribbonTab) ?? tabs[0];
|
|
1029
|
+
// A context tab that went away (the caret left the table) must not come back selected on its own later.
|
|
1030
|
+
if (activeTab && activeTab.id !== ribbonTab)
|
|
1031
|
+
setRibbonTab(activeTab.id);
|
|
1032
|
+
const tabDomId = (id) => `${ribbonId}-tab-${id}`;
|
|
1033
|
+
const onTabKeyDown = (event) => {
|
|
1034
|
+
if (!['ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key) || tabs.length === 0)
|
|
1035
|
+
return;
|
|
1036
|
+
const index = Math.max(0, tabs.findIndex((tab) => tab.id === activeTab?.id));
|
|
1037
|
+
const forward = event.key === (direction === 'rtl' ? 'ArrowLeft' : 'ArrowRight');
|
|
1038
|
+
const next = event.key === 'Home' ? 0 : event.key === 'End' ? tabs.length - 1 : (index + (forward ? 1 : -1) + tabs.length) % tabs.length;
|
|
1039
|
+
event.preventDefault();
|
|
1040
|
+
setRibbonTab(tabs[next].id);
|
|
1041
|
+
event.currentTarget.querySelectorAll('[role="tab"]')[next]?.focus();
|
|
1042
|
+
};
|
|
1043
|
+
// Drafts, search and help are not part of any tab: they stay on the tab row, with save, undo and redo.
|
|
1044
|
+
const utilities = (draftsButton || findButton || helpButton) &&
|
|
1045
|
+
cluster('utilities', _jsxs(_Fragment, { children: [draftsButton, findButton, helpButton] }));
|
|
1046
|
+
const quickAccess = [utilities, saveGroup, historyGroup].filter(Boolean);
|
|
1047
|
+
return (_jsxs("div", { className: bordered ? 'likhari-ribbon' : 'likhari-ribbon likhari-ribbon--plain', children: [_jsxs("div", { className: "likhari-ribbon-top", children: [tabs.length > 0 && (_jsx("div", { role: "tablist", "aria-label": rt.tabsLabel, className: "likhari-ribbon-tabs", onKeyDown: onTabKeyDown, children: tabs.map((tab) => {
|
|
1048
|
+
const selected = tab.id === activeTab?.id;
|
|
1049
|
+
return (_jsx("button", { type: "button", role: "tab", id: tabDomId(tab.id), "aria-selected": selected, "aria-controls": `${ribbonId}-panel`, tabIndex: selected ? 0 : -1, className: "likhari-ribbon-tab", "data-contextual": CONTEXTUAL.includes(tab.id) ? 'true' : undefined,
|
|
1050
|
+
// Keep the editor's selection: a mousedown here would blur the canvas.
|
|
1051
|
+
onMouseDown: (e) => e.preventDefault(), onClick: () => setRibbonTab(tab.id), children: tab.label }, tab.id));
|
|
1052
|
+
}) })), quickAccess.length > 0 && (_jsx(MantineToolbar, { "aria-label": rt.quickAccess, className: "likhari-ribbon-quick", withBorder: false, variant: variant, color: "var(--editor-accent)", children: withDividers(quickAccess) }))] }), activeTab && (_jsx("div", { role: "tabpanel", id: `${ribbonId}-panel`, "aria-labelledby": tabDomId(activeTab.id), className: "likhari-ribbon-panel-wrap", children: _jsx(MantineToolbar, { "aria-label": strings.toolbar.ariaLabel, className: bordered ? 'likhari-toolbar likhari-ribbon-panel' : 'likhari-toolbar likhari-toolbar--plain likhari-ribbon-panel', withBorder: bordered, variant: variant, color: "var(--editor-accent)", children: withDividers(activeTab.groups) }) })), contextMenuEl, dialogsEl] }));
|
|
1053
|
+
}
|
|
1054
|
+
return (_jsxs(MantineToolbar, { ref: toolbarContainerRef, "aria-label": strings.toolbar.ariaLabel, className: bordered ? 'likhari-toolbar' : 'likhari-toolbar likhari-toolbar--plain', withBorder: bordered, variant: variant, color: "var(--editor-accent)", children: [withDividers(startSections), visibleMovable.map((section) => (_jsxs(Fragment, { children: [_jsx(MantineToolbar.Divider, {}), section.node] }, section.key))), hiddenMovable.length > 0 && (_jsxs(_Fragment, { children: [_jsx(MantineToolbar.Divider, {}), _jsxs(Menu, { opened: overflowMenuOpen, onChange: handleOverflowMenuChange, position: "bottom-end", withinPortal: true, portalProps: { target: portalTarget }, shadow: "sm", width: "max-content", closeOnItemClick: false, children: [_jsx(Menu.Target, { children: _jsx(ToolbarButton, { icon: IconDots, title: strings.toolbar.moreFormatting }) }), _jsx(Menu.Dropdown, { p: 6, children: _jsx(MantineToolbar, { withBorder: false, variant: variant, color: "var(--editor-accent)", style: { maxWidth: 320 }, children: withDividers(hiddenMovable.map((section) => section.node)) }) })] })] })), _jsx("span", { "aria-hidden": "true", style: { flex: '1 1 auto' } }), visibleEnd.map((section) => section.node), contextMenuEl, overflowEnabled && (_jsxs(MantineToolbar, { "aria-hidden": "true", ref: toolbarMeasureRef, withBorder: bordered, variant: variant, color: "var(--editor-accent)", style: { position: 'absolute', visibility: 'hidden', pointerEvents: 'none', top: 0, left: 0, flexWrap: 'nowrap', width: 'max-content' }, children: [withDividers(startSections), movableSections.map((section) => (_jsxs(Fragment, { children: [_jsx(MantineToolbar.Divider, {}), _jsx("span", { "data-group-key": section.key, style: { display: 'inline-flex' }, children: section.node })] }, section.key)))] })), dialogsEl] }));
|
|
976
1055
|
}
|
package/dist/i18n/strings.d.ts
CHANGED
|
@@ -74,6 +74,21 @@ export interface Strings {
|
|
|
74
74
|
clearFormatting: string;
|
|
75
75
|
outdent: string;
|
|
76
76
|
indent: string;
|
|
77
|
+
/** The ribbon layout (`toolbarStyle.layout: 'ribbon'`): its tab strip and tabs. */
|
|
78
|
+
ribbon: {
|
|
79
|
+
/** aria-label on the tab strip. */
|
|
80
|
+
tabsLabel: string;
|
|
81
|
+
/** aria-label on the group beside the tabs that holds save, undo and redo. */
|
|
82
|
+
quickAccess: string;
|
|
83
|
+
home: string;
|
|
84
|
+
insert: string;
|
|
85
|
+
tools: string;
|
|
86
|
+
view: string;
|
|
87
|
+
/** Contextual tabs, shown only while the caret is in that kind of content. */
|
|
88
|
+
table: string;
|
|
89
|
+
poetry: string;
|
|
90
|
+
link: string;
|
|
91
|
+
};
|
|
77
92
|
formattingOptions: {
|
|
78
93
|
paragraph: string;
|
|
79
94
|
heading: (level: number) => string;
|
|
@@ -1 +1 @@
|
|
|
1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,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;AAg4BD,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
|
@@ -62,6 +62,17 @@ const en = {
|
|
|
62
62
|
clearFormatting: 'Clear formatting',
|
|
63
63
|
outdent: 'Outdent',
|
|
64
64
|
indent: 'Indent',
|
|
65
|
+
ribbon: {
|
|
66
|
+
tabsLabel: 'Ribbon tabs',
|
|
67
|
+
quickAccess: 'Quick access',
|
|
68
|
+
home: 'Home',
|
|
69
|
+
insert: 'Insert',
|
|
70
|
+
tools: 'Tools',
|
|
71
|
+
view: 'View',
|
|
72
|
+
table: 'Table',
|
|
73
|
+
poetry: 'Poetry',
|
|
74
|
+
link: 'Link',
|
|
75
|
+
},
|
|
65
76
|
formattingOptions: {
|
|
66
77
|
paragraph: 'Paragraph',
|
|
67
78
|
heading: (level) => `Heading ${level}`,
|
|
@@ -347,6 +358,17 @@ const ur = {
|
|
|
347
358
|
clearFormatting: 'فارمیٹنگ ختم کریں',
|
|
348
359
|
outdent: 'حاشیہ کم کریں',
|
|
349
360
|
indent: 'حاشیہ بڑھائیں',
|
|
361
|
+
ribbon: {
|
|
362
|
+
tabsLabel: 'ربن کے ٹیب',
|
|
363
|
+
quickAccess: 'فوری رسائی',
|
|
364
|
+
home: 'ہوم',
|
|
365
|
+
insert: 'شامل کریں',
|
|
366
|
+
tools: 'اوزار',
|
|
367
|
+
view: 'منظر',
|
|
368
|
+
table: 'جدول',
|
|
369
|
+
poetry: 'شاعری',
|
|
370
|
+
link: 'لنک',
|
|
371
|
+
},
|
|
350
372
|
formattingOptions: {
|
|
351
373
|
paragraph: 'پیراگراف',
|
|
352
374
|
heading: (level) => `عنوان ${level}`,
|
|
@@ -632,6 +654,17 @@ const paShahmukhi = {
|
|
|
632
654
|
clearFormatting: 'فارمیٹنگ ہٹاؤ',
|
|
633
655
|
outdent: 'حاشیہ گھٹاؤ',
|
|
634
656
|
indent: 'حاشیہ ودھاؤ',
|
|
657
|
+
ribbon: {
|
|
658
|
+
tabsLabel: 'ربن دے ٹیب',
|
|
659
|
+
quickAccess: 'جھٹ رسائی',
|
|
660
|
+
home: 'ہوم',
|
|
661
|
+
insert: 'شامل کرو',
|
|
662
|
+
tools: 'اوزار',
|
|
663
|
+
view: 'ویکھو',
|
|
664
|
+
table: 'جدول',
|
|
665
|
+
poetry: 'شاعری',
|
|
666
|
+
link: 'لنک',
|
|
667
|
+
},
|
|
635
668
|
formattingOptions: {
|
|
636
669
|
paragraph: 'پیراگراف',
|
|
637
670
|
heading: (level) => `سرلیکھ ${level}`,
|
package/dist/theme/editor.css
CHANGED
|
@@ -1119,3 +1119,96 @@
|
|
|
1119
1119
|
background: var(--editor-accent-soft);
|
|
1120
1120
|
}
|
|
1121
1121
|
|
|
1122
|
+
|
|
1123
|
+
/* Ribbon layout (toolbarStyle.layout: 'ribbon', UI spec §3.4): a strip of tabs over one row of the active
|
|
1124
|
+
tab's command groups, with drafts, search, help, save, undo and redo at the end of the strip. */
|
|
1125
|
+
.likhari-ribbon {
|
|
1126
|
+
display: flex;
|
|
1127
|
+
flex-direction: column;
|
|
1128
|
+
flex-shrink: 0;
|
|
1129
|
+
background: var(--editor-paper-dim);
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
.likhari-ribbon-top {
|
|
1133
|
+
display: flex;
|
|
1134
|
+
align-items: center;
|
|
1135
|
+
justify-content: space-between;
|
|
1136
|
+
gap: 8px;
|
|
1137
|
+
padding: 2px 8px 0;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
.likhari-ribbon-tabs {
|
|
1141
|
+
display: flex;
|
|
1142
|
+
gap: 2px;
|
|
1143
|
+
min-width: 0;
|
|
1144
|
+
/* Narrow screens scroll the tabs sideways rather than wrapping them. */
|
|
1145
|
+
overflow-x: auto;
|
|
1146
|
+
scrollbar-width: none;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
.likhari-ribbon-tab {
|
|
1150
|
+
appearance: none;
|
|
1151
|
+
flex: 0 0 auto;
|
|
1152
|
+
margin: 0;
|
|
1153
|
+
padding: 6px 12px;
|
|
1154
|
+
border: 0;
|
|
1155
|
+
border-bottom: 2px solid transparent;
|
|
1156
|
+
border-radius: 4px 4px 0 0;
|
|
1157
|
+
background: transparent;
|
|
1158
|
+
color: var(--editor-ink-soft);
|
|
1159
|
+
font: inherit;
|
|
1160
|
+
font-size: 13px;
|
|
1161
|
+
line-height: 1.2;
|
|
1162
|
+
white-space: nowrap;
|
|
1163
|
+
cursor: pointer;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
.likhari-ribbon-tab:hover {
|
|
1167
|
+
background: var(--editor-accent-soft);
|
|
1168
|
+
color: var(--editor-ink);
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
.likhari-ribbon-tab[aria-selected='true'] {
|
|
1172
|
+
border-bottom-color: var(--editor-accent);
|
|
1173
|
+
color: var(--editor-accent);
|
|
1174
|
+
font-weight: 600;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
/* A context tab (Table, Poetry, Link) is tinted so it reads as appearing because of where the caret is. */
|
|
1178
|
+
.likhari-ribbon-tab[data-contextual] {
|
|
1179
|
+
background: var(--editor-accent-soft);
|
|
1180
|
+
color: var(--editor-accent);
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
.likhari-ribbon-tab:focus-visible {
|
|
1184
|
+
outline: 2px solid var(--editor-accent);
|
|
1185
|
+
outline-offset: -2px;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
.likhari-ribbon-quick {
|
|
1189
|
+
display: flex;
|
|
1190
|
+
/* At the end of the row, also when there are no tabs to push it there. */
|
|
1191
|
+
margin-inline-start: auto;
|
|
1192
|
+
flex: 0 0 auto;
|
|
1193
|
+
flex-wrap: nowrap;
|
|
1194
|
+
align-items: center;
|
|
1195
|
+
gap: 8px;
|
|
1196
|
+
min-height: 0;
|
|
1197
|
+
padding: 0;
|
|
1198
|
+
background: transparent;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
/* The panel scrolls sideways when its groups do not fit, instead of wrapping onto a second row. */
|
|
1202
|
+
.likhari-ribbon-panel {
|
|
1203
|
+
flex-wrap: nowrap;
|
|
1204
|
+
overflow-x: auto;
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
.likhari-ribbon-panel > * {
|
|
1208
|
+
flex: 0 0 auto;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
/* A destructive command (delete table, delete couplet) on the ribbon, as red as it is in the menus. */
|
|
1212
|
+
.likhari-ribbon-panel [data-danger='true'] {
|
|
1213
|
+
color: var(--mantine-color-red-6, #e03131);
|
|
1214
|
+
}
|