@inshapardaz/likhari-react 0.1.13 → 0.1.14

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/components/Toolbar.tsx"],"names":[],"mappings":"AAuDA,OAAO,EAAgB,KAAK,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEzE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAA6D,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAItG,OAAO,KAAK,EAAE,MAAM,EAAW,MAAM,iBAAiB,CAAC;AA+YvD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,2BAA2B,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sEAAsE;IACtE,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,wFAAwF;IACxF,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAC1B,oFAAoF;IACpF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kGAAkG;IAClG,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B;AAED,wBAAgB,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAkC,EAAE,SAAiB,EAAE,MAAa,EAAE,MAAM,EAAE,EAAE,YAAY,+BAg7BxJ"}
1
+ {"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/components/Toolbar.tsx"],"names":[],"mappings":"AAuDA,OAAO,EAAgB,KAAK,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEzE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAA6D,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAItG,OAAO,KAAK,EAAE,MAAM,EAAW,MAAM,iBAAiB,CAAC;AAwZvD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,2BAA2B,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sEAAsE;IACtE,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,wFAAwF;IACxF,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAC1B,oFAAoF;IACpF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kGAAkG;IAClG,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B;AAED,wBAAgB,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAkC,EAAE,SAAiB,EAAE,MAAa,EAAE,MAAM,EAAE,EAAE,YAAY,+BAo7BxJ"}
@@ -45,7 +45,7 @@ const INITIAL_STATE = {
45
45
  };
46
46
  const ICON_SIZE = 17;
47
47
  const ICON_STROKE = 1.75;
48
- const ALIGN_ICONS = {
48
+ const ALIGN_ICONS_LTR = {
49
49
  start: IconAlignLeft,
50
50
  left: IconAlignLeft,
51
51
  center: IconAlignCenter,
@@ -53,6 +53,14 @@ const ALIGN_ICONS = {
53
53
  right: IconAlignRight,
54
54
  justify: IconAlignJustified,
55
55
  };
56
+ // UI spec §5: "start"/"end" are direction-relative — in RTL, start points
57
+ // right, so the icon has to swap glyphs. "left"/"right" are the poetry
58
+ // preset's literal per-couplet overrides and never mirror.
59
+ const ALIGN_ICONS_RTL = {
60
+ ...ALIGN_ICONS_LTR,
61
+ start: IconAlignRight,
62
+ end: IconAlignLeft,
63
+ };
56
64
  const HEADING_ICONS = {
57
65
  1: IconH1,
58
66
  2: IconH2,
@@ -149,6 +157,8 @@ export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAU
149
157
  const strings = useStrings(locale);
150
158
  const portalTarget = usePortalTarget();
151
159
  const [draftsOpen, setDraftsOpen] = useState(false);
160
+ const rtl = direction === 'rtl';
161
+ const ALIGN_ICONS = rtl ? ALIGN_ICONS_RTL : ALIGN_ICONS_LTR;
152
162
  // Responsive "priority+" overflow: the toolbar's outer container and a
153
163
  // hidden nowrap clone (rendered with every movable group forced inline)
154
164
  // are both measured; whenever the clone's natural width exceeds the
@@ -573,17 +583,19 @@ export function Toolbar({ config, onSave, isDirty, showSave, fontOptions = DEFAU
573
583
  if (fmt.clearFormatting) {
574
584
  scriptCleanupItems.push({ key: 'clear', icon: IconClearFormatting, label: strings.toolbar.clearFormatting, onClick: clearFormatting });
575
585
  }
586
+ // UI spec §5: indent/outdent arrows are direction-relative and swap in RTL
587
+ // (outdent moves content toward the start edge, which is the right in RTL).
576
588
  const indentItems = config.indent
577
589
  ? [
578
590
  {
579
591
  key: 'outdent',
580
- icon: IconIndentDecrease,
592
+ icon: rtl ? IconIndentIncrease : IconIndentDecrease,
581
593
  label: strings.toolbar.outdent,
582
594
  onClick: () => editor.dispatchCommand(OUTDENT_CONTENT_COMMAND, undefined),
583
595
  },
584
596
  {
585
597
  key: 'indent',
586
- icon: IconIndentIncrease,
598
+ icon: rtl ? IconIndentDecrease : IconIndentIncrease,
587
599
  label: strings.toolbar.indent,
588
600
  onClick: () => editor.dispatchCommand(INDENT_CONTENT_COMMAND, undefined),
589
601
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inshapardaz/likhari-react",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "React implementation of the Likhari editor, built on @lexical/react.",
5
5
  "license": "MIT",
6
6
  "repository": {