@payloadcms/richtext-lexical 3.76.0 → 3.76.1

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":"setFloatingElemPositionForLinkEditor.d.ts","sourceRoot":"","sources":["../../../src/lexical/utils/setFloatingElemPositionForLinkEditor.ts"],"names":[],"mappings":"AAIA,wBAAgB,oCAAoC,CAClD,UAAU,EAAE,OAAO,GAAG,IAAI,EAC1B,YAAY,EAAE,WAAW,EACzB,UAAU,EAAE,WAAW,EACvB,WAAW,GAAE,MAAqB,EAClC,gBAAgB,GAAE,MAA0B,GAC3C,IAAI,CA6BN"}
1
+ {"version":3,"file":"setFloatingElemPositionForLinkEditor.d.ts","sourceRoot":"","sources":["../../../src/lexical/utils/setFloatingElemPositionForLinkEditor.ts"],"names":[],"mappings":"AAIA,wBAAgB,oCAAoC,CAClD,UAAU,EAAE,OAAO,GAAG,IAAI,EAC1B,YAAY,EAAE,WAAW,EACzB,UAAU,EAAE,WAAW,EACvB,WAAW,GAAE,MAAqB,EAClC,gBAAgB,GAAE,MAA0B,GAC3C,IAAI,CAiEN"}
@@ -9,11 +9,40 @@ export function setFloatingElemPositionForLinkEditor(targetRect, floatingElem, a
9
9
  floatingElem.style.transform = 'translate(-10000px, -10000px)';
10
10
  return;
11
11
  }
12
- const floatingElemRect = floatingElem.getBoundingClientRect();
13
12
  const anchorElementRect = anchorElem.getBoundingClientRect();
14
13
  const editorScrollerRect = scrollerElem.getBoundingClientRect();
15
14
  let top = targetRect.top - verticalGap;
16
15
  let left = targetRect.left - horizontalOffset;
16
+ // Reset width constraints to measure natural content size
17
+ floatingElem.style.width = 'max-content';
18
+ floatingElem.style.maxWidth = 'none';
19
+ const naturalWidth = floatingElem.scrollWidth;
20
+ // Calculate available space on both sides to determine tooltip width
21
+ const availableRight = editorScrollerRect.right - left;
22
+ const availableLeft = left - editorScrollerRect.left;
23
+ let floatingElemRect;
24
+ // Only constrain width if content doesn't fit in available space
25
+ if (naturalWidth <= availableRight) {
26
+ // Content fits naturally on the right, don't constrain
27
+ floatingElemRect = floatingElem.getBoundingClientRect();
28
+ } else {
29
+ // Content doesn't fit on right, choose side with more space
30
+ const availableLeftTotal = availableLeft + targetRect.width;
31
+ const useLeftSide = availableLeft > availableRight;
32
+ const availableSpace = useLeftSide ? availableLeftTotal : availableRight;
33
+ const tooltipWidth = Math.min(naturalWidth, availableSpace);
34
+ // Apply width constraint if needed
35
+ if (tooltipWidth < naturalWidth) {
36
+ floatingElem.style.width = `${tooltipWidth}px`;
37
+ floatingElem.style.maxWidth = `${tooltipWidth}px`;
38
+ void floatingElem.offsetHeight;
39
+ }
40
+ // Position on chosen side
41
+ if (useLeftSide) {
42
+ left = targetRect.right - tooltipWidth;
43
+ }
44
+ floatingElemRect = floatingElem.getBoundingClientRect();
45
+ }
17
46
  if (top < editorScrollerRect.top) {
18
47
  top += floatingElemRect.height + targetRect.height + verticalGap * 2;
19
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"setFloatingElemPositionForLinkEditor.js","names":["VERTICAL_GAP","HORIZONTAL_OFFSET","setFloatingElemPositionForLinkEditor","targetRect","floatingElem","anchorElem","verticalGap","horizontalOffset","scrollerElem","parentElement","style","opacity","transform","floatingElemRect","getBoundingClientRect","anchorElementRect","editorScrollerRect","top","left","height","width","right"],"sources":["../../../src/lexical/utils/setFloatingElemPositionForLinkEditor.ts"],"sourcesContent":["'use client'\nconst VERTICAL_GAP = 10\nconst HORIZONTAL_OFFSET = 5\n\nexport function setFloatingElemPositionForLinkEditor(\n targetRect: DOMRect | null,\n floatingElem: HTMLElement,\n anchorElem: HTMLElement,\n verticalGap: number = VERTICAL_GAP,\n horizontalOffset: number = HORIZONTAL_OFFSET,\n): void {\n const scrollerElem = anchorElem.parentElement\n\n if (targetRect === null || scrollerElem == null) {\n floatingElem.style.opacity = '0'\n floatingElem.style.transform = 'translate(-10000px, -10000px)'\n return\n }\n\n const floatingElemRect = floatingElem.getBoundingClientRect()\n const anchorElementRect = anchorElem.getBoundingClientRect()\n const editorScrollerRect = scrollerElem.getBoundingClientRect()\n\n let top = targetRect.top - verticalGap\n let left = targetRect.left - horizontalOffset\n\n if (top < editorScrollerRect.top) {\n top += floatingElemRect.height + targetRect.height + verticalGap * 2\n }\n\n if (left + floatingElemRect.width > editorScrollerRect.right) {\n left = editorScrollerRect.right - floatingElemRect.width - horizontalOffset\n }\n\n top -= anchorElementRect.top\n left -= anchorElementRect.left\n\n floatingElem.style.opacity = '1'\n floatingElem.style.transform = `translate(${left}px, ${top}px)`\n}\n"],"mappings":"AAAA;;AACA,MAAMA,YAAA,GAAe;AACrB,MAAMC,iBAAA,GAAoB;AAE1B,OAAO,SAASC,qCACdC,UAA0B,EAC1BC,YAAyB,EACzBC,UAAuB,EACvBC,WAAA,GAAsBN,YAAY,EAClCO,gBAAA,GAA2BN,iBAAiB;EAE5C,MAAMO,YAAA,GAAeH,UAAA,CAAWI,aAAa;EAE7C,IAAIN,UAAA,KAAe,QAAQK,YAAA,IAAgB,MAAM;IAC/CJ,YAAA,CAAaM,KAAK,CAACC,OAAO,GAAG;IAC7BP,YAAA,CAAaM,KAAK,CAACE,SAAS,GAAG;IAC/B;EACF;EAEA,MAAMC,gBAAA,GAAmBT,YAAA,CAAaU,qBAAqB;EAC3D,MAAMC,iBAAA,GAAoBV,UAAA,CAAWS,qBAAqB;EAC1D,MAAME,kBAAA,GAAqBR,YAAA,CAAaM,qBAAqB;EAE7D,IAAIG,GAAA,GAAMd,UAAA,CAAWc,GAAG,GAAGX,WAAA;EAC3B,IAAIY,IAAA,GAAOf,UAAA,CAAWe,IAAI,GAAGX,gBAAA;EAE7B,IAAIU,GAAA,GAAMD,kBAAA,CAAmBC,GAAG,EAAE;IAChCA,GAAA,IAAOJ,gBAAA,CAAiBM,MAAM,GAAGhB,UAAA,CAAWgB,MAAM,GAAGb,WAAA,GAAc;EACrE;EAEA,IAAIY,IAAA,GAAOL,gBAAA,CAAiBO,KAAK,GAAGJ,kBAAA,CAAmBK,KAAK,EAAE;IAC5DH,IAAA,GAAOF,kBAAA,CAAmBK,KAAK,GAAGR,gBAAA,CAAiBO,KAAK,GAAGb,gBAAA;EAC7D;EAEAU,GAAA,IAAOF,iBAAA,CAAkBE,GAAG;EAC5BC,IAAA,IAAQH,iBAAA,CAAkBG,IAAI;EAE9Bd,YAAA,CAAaM,KAAK,CAACC,OAAO,GAAG;EAC7BP,YAAA,CAAaM,KAAK,CAACE,SAAS,GAAG,aAAaM,IAAA,OAAWD,GAAA,KAAQ;AACjE","ignoreList":[]}
1
+ {"version":3,"file":"setFloatingElemPositionForLinkEditor.js","names":["VERTICAL_GAP","HORIZONTAL_OFFSET","setFloatingElemPositionForLinkEditor","targetRect","floatingElem","anchorElem","verticalGap","horizontalOffset","scrollerElem","parentElement","style","opacity","transform","anchorElementRect","getBoundingClientRect","editorScrollerRect","top","left","width","maxWidth","naturalWidth","scrollWidth","availableRight","right","availableLeft","floatingElemRect","availableLeftTotal","useLeftSide","availableSpace","tooltipWidth","Math","min","offsetHeight","height"],"sources":["../../../src/lexical/utils/setFloatingElemPositionForLinkEditor.ts"],"sourcesContent":["'use client'\nconst VERTICAL_GAP = 10\nconst HORIZONTAL_OFFSET = 5\n\nexport function setFloatingElemPositionForLinkEditor(\n targetRect: DOMRect | null,\n floatingElem: HTMLElement,\n anchorElem: HTMLElement,\n verticalGap: number = VERTICAL_GAP,\n horizontalOffset: number = HORIZONTAL_OFFSET,\n): void {\n const scrollerElem = anchorElem.parentElement\n\n if (targetRect === null || scrollerElem == null) {\n floatingElem.style.opacity = '0'\n floatingElem.style.transform = 'translate(-10000px, -10000px)'\n return\n }\n\n const anchorElementRect = anchorElem.getBoundingClientRect()\n const editorScrollerRect = scrollerElem.getBoundingClientRect()\n\n let top = targetRect.top - verticalGap\n let left = targetRect.left - horizontalOffset\n\n // Reset width constraints to measure natural content size\n floatingElem.style.width = 'max-content'\n floatingElem.style.maxWidth = 'none'\n const naturalWidth = floatingElem.scrollWidth\n\n // Calculate available space on both sides to determine tooltip width\n const availableRight = editorScrollerRect.right - left\n const availableLeft = left - editorScrollerRect.left\n\n let floatingElemRect: DOMRect\n\n // Only constrain width if content doesn't fit in available space\n if (naturalWidth <= availableRight) {\n // Content fits naturally on the right, don't constrain\n floatingElemRect = floatingElem.getBoundingClientRect()\n } else {\n // Content doesn't fit on right, choose side with more space\n const availableLeftTotal = availableLeft + targetRect.width\n const useLeftSide = availableLeft > availableRight\n const availableSpace = useLeftSide ? availableLeftTotal : availableRight\n const tooltipWidth = Math.min(naturalWidth, availableSpace)\n\n // Apply width constraint if needed\n if (tooltipWidth < naturalWidth) {\n floatingElem.style.width = `${tooltipWidth}px`\n floatingElem.style.maxWidth = `${tooltipWidth}px`\n void floatingElem.offsetHeight\n }\n\n // Position on chosen side\n if (useLeftSide) {\n left = targetRect.right - tooltipWidth\n }\n\n floatingElemRect = floatingElem.getBoundingClientRect()\n }\n\n if (top < editorScrollerRect.top) {\n top += floatingElemRect.height + targetRect.height + verticalGap * 2\n }\n\n if (left + floatingElemRect.width > editorScrollerRect.right) {\n left = editorScrollerRect.right - floatingElemRect.width - horizontalOffset\n }\n\n top -= anchorElementRect.top\n left -= anchorElementRect.left\n\n floatingElem.style.opacity = '1'\n floatingElem.style.transform = `translate(${left}px, ${top}px)`\n}\n"],"mappings":"AAAA;;AACA,MAAMA,YAAA,GAAe;AACrB,MAAMC,iBAAA,GAAoB;AAE1B,OAAO,SAASC,qCACdC,UAA0B,EAC1BC,YAAyB,EACzBC,UAAuB,EACvBC,WAAA,GAAsBN,YAAY,EAClCO,gBAAA,GAA2BN,iBAAiB;EAE5C,MAAMO,YAAA,GAAeH,UAAA,CAAWI,aAAa;EAE7C,IAAIN,UAAA,KAAe,QAAQK,YAAA,IAAgB,MAAM;IAC/CJ,YAAA,CAAaM,KAAK,CAACC,OAAO,GAAG;IAC7BP,YAAA,CAAaM,KAAK,CAACE,SAAS,GAAG;IAC/B;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YAAA,CAAaU,qBAAqB;EACvD;EAEA,IAAIE,GAAA,GAAMD,kBAAA,CAAmBC,GAAG,EAAE;IAChCA,GAAA,IAAOS,gBAAA,CAAiBQ,MAAM,GAAG9B,UAAA,CAAW8B,MAAM,GAAG3B,WAAA,GAAc;EACrE;EAEA,IAAIW,IAAA,GAAOQ,gBAAA,CAAiBP,KAAK,GAAGH,kBAAA,CAAmBQ,KAAK,EAAE;IAC5DN,IAAA,GAAOF,kBAAA,CAAmBQ,KAAK,GAAGE,gBAAA,CAAiBP,KAAK,GAAGX,gBAAA;EAC7D;EAEAS,GAAA,IAAOH,iBAAA,CAAkBG,GAAG;EAC5BC,IAAA,IAAQJ,iBAAA,CAAkBI,IAAI;EAE9Bb,YAAA,CAAaM,KAAK,CAACC,OAAO,GAAG;EAC7BP,YAAA,CAAaM,KAAK,CAACE,SAAS,GAAG,aAAaK,IAAA,OAAWD,GAAA,KAAQ;AACjE","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "3.76.0",
3
+ "version": "3.76.1",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -374,8 +374,8 @@
374
374
  "react-error-boundary": "4.1.2",
375
375
  "ts-essentials": "10.0.3",
376
376
  "uuid": "10.0.0",
377
- "@payloadcms/translations": "3.76.0",
378
- "@payloadcms/ui": "3.76.0"
377
+ "@payloadcms/translations": "3.76.1",
378
+ "@payloadcms/ui": "3.76.1"
379
379
  },
380
380
  "devDependencies": {
381
381
  "@babel/cli": "7.27.2",
@@ -395,15 +395,15 @@
395
395
  "esbuild-sass-plugin": "3.3.1",
396
396
  "swc-plugin-transform-remove-imports": "8.3.0",
397
397
  "@payloadcms/eslint-config": "3.28.0",
398
- "payload": "3.76.0"
398
+ "payload": "3.76.1"
399
399
  },
400
400
  "peerDependencies": {
401
401
  "@faceless-ui/modal": "3.0.0",
402
402
  "@faceless-ui/scroll-info": "2.0.0",
403
403
  "react": "^19.0.1 || ^19.1.2 || ^19.2.1",
404
404
  "react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
405
- "@payloadcms/next": "3.76.0",
406
- "payload": "3.76.0"
405
+ "@payloadcms/next": "3.76.1",
406
+ "payload": "3.76.1"
407
407
  },
408
408
  "engines": {
409
409
  "node": "^18.20.2 || >=20.9.0"