@flozy/editor 10.3.1 → 10.3.2

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.
@@ -96,7 +96,7 @@ const EditorButton = props => {
96
96
  };
97
97
  const buttonProps = handleLinkType(refURl, linkType, true,
98
98
  // button functionalities have to work on both edit mode and normal mode
99
- openInNewTab, handleTrigger);
99
+ openInNewTab, handleTrigger, metadata);
100
100
  const onMenuClick = val => () => {
101
101
  switch (val) {
102
102
  case "edit":
@@ -127,7 +127,7 @@ const RnD = props => {
127
127
  isInteracting,
128
128
  handleStart,
129
129
  handleStop
130
- } = useFreeGrid();
130
+ } = useFreeGrid() || {};
131
131
  const {
132
132
  translation
133
133
  } = customProps;
@@ -304,15 +304,20 @@ const getScrollElement = () => {
304
304
  const scrollFrom = isSlateWrapperScroll ? slateWrapper : window;
305
305
  return scrollFrom;
306
306
  };
307
- const handleLinkBtnClick = (e, props, isMobilePreview) => {
307
+ const handleLinkBtnClick = (e, props, isMobilePreview, metadata) => {
308
308
  if (e) {
309
309
  e.preventDefault();
310
310
  e.stopPropagation();
311
311
  }
312
+ const mobileAppRedirect = metadata?.buttonLink?.inAppRedirection;
312
313
  if (props.target) {
313
314
  window.open(props.href);
314
315
  } else {
315
- window.location.href = props.href;
316
+ if (typeof mobileAppRedirect === "function") {
317
+ mobileAppRedirect(props.href);
318
+ } else {
319
+ window.location.href = props.href;
320
+ }
316
321
  if (isMobilePreview) {
317
322
  // on iframe - mobile preview, window.location.href is not scrolling to the element correctly
318
323
  const [, elementId] = props.href?.split("#");
@@ -328,7 +333,7 @@ const handleLinkBtnClick = (e, props, isMobilePreview) => {
328
333
  }
329
334
  }
330
335
  };
331
- export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick = () => {}) => {
336
+ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick = () => {}, metadata = {}) => {
332
337
  const props = {};
333
338
  if (!readOnly) {
334
339
  return {
@@ -427,13 +432,13 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
427
432
  let touchEndClicked = false;
428
433
  props.onTouchEnd = e => {
429
434
  touchEndClicked = true;
430
- handleLinkBtnClick(e, props);
435
+ handleLinkBtnClick(e, props, false, metadata);
431
436
  };
432
437
  props.onClick = e => {
433
438
  // This condition is used for mobile preview in the page editor.
434
439
  // 'touchEnd' will not work in the mobile page preview.
435
440
  if (!touchEndClicked && isMobile) {
436
- handleLinkBtnClick(e, props, true);
441
+ handleLinkBtnClick(e, props, true, metadata);
437
442
  }
438
443
  return false;
439
444
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "10.3.1",
3
+ "version": "10.3.2",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"