@flozy/editor 10.1.8 → 10.2.0

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.
@@ -105,7 +105,7 @@ const EditorButton = props => {
105
105
  };
106
106
  const buttonProps = handleLinkType(refURl, linkType, true,
107
107
  // button functionalities have to work on both edit mode and normal mode
108
- openInNewTab, handleTrigger);
108
+ openInNewTab, handleTrigger, metadata);
109
109
  const onMenuClick = val => () => {
110
110
  switch (val) {
111
111
  case "edit":
@@ -18,6 +18,17 @@ import SearchButton from "../../Elements/Search/SearchButton";
18
18
  import canOpen from "../../helper/canOpen";
19
19
  import { jsx as _jsx } from "react/jsx-runtime";
20
20
  const ELEMENTS_LIST = [{
21
+ name: "Ask AI to write anything",
22
+ group: "Infinity AI",
23
+ desc: "",
24
+ type: "infinityAI",
25
+ icon: /*#__PURE__*/_jsx(Icon, {
26
+ icon: "infinityIcon"
27
+ }),
28
+ onInsert: editor => {
29
+ insertInfinityAI(editor);
30
+ }
31
+ }, {
21
32
  name: "Heading 1",
22
33
  desc: "",
23
34
  group: "Text",
@@ -330,17 +341,6 @@ const ELEMENTS_LIST = [{
330
341
  onInsert: editor => {
331
342
  insertForm(editor);
332
343
  }
333
- }, {
334
- name: "Ask AI to write anything",
335
- group: "Infinity AI",
336
- desc: "",
337
- type: "infinityAI",
338
- icon: /*#__PURE__*/_jsx(Icon, {
339
- icon: "infinityIcon"
340
- }),
341
- onInsert: editor => {
342
- insertInfinityAI(editor);
343
- }
344
344
  }, {
345
345
  name: "Dynamic Table",
346
346
  group: "Dynamic Table",
@@ -34,7 +34,7 @@ import SimpleText from "../Elements/SimpleText";
34
34
  import CheckList from "../Elements/List/CheckList";
35
35
  import { getTextColor, isEmptyTextNode } from "../helper";
36
36
  import Attachments from "../Elements/Attachments/Attachments";
37
- import { getBreakpointLineSpacing, getBreakPointsValue, getDevice, groupByBreakpoint } from "../helper/theme";
37
+ import { getBreakpointLineSpacing, getBreakPointsValue, getDevice, getElementProperty, textThemeFields } from "../helper/theme";
38
38
  import Variables from "../Elements/Variables/Variable";
39
39
  import Divider from "../Elements/Divider/Divider";
40
40
  import { getBorderColor, getSlateDom } from "./helper";
@@ -306,15 +306,20 @@ const getScrollElement = () => {
306
306
  const scrollFrom = isSlateWrapperScroll ? slateWrapper : window;
307
307
  return scrollFrom;
308
308
  };
309
- const handleLinkBtnClick = (e, props, isMobilePreview) => {
309
+ const handleLinkBtnClick = (e, props, isMobilePreview, metadata) => {
310
310
  if (e) {
311
311
  e.preventDefault();
312
312
  e.stopPropagation();
313
313
  }
314
+ const mobileAppRedirect = metadata?.buttonLink?.inAppRedirection;
314
315
  if (props.target) {
315
316
  window.open(props.href);
316
317
  } else {
317
- window.location.href = props.href;
318
+ if (typeof mobileAppRedirect === "function") {
319
+ mobileAppRedirect(props.href);
320
+ } else {
321
+ window.location.href = props.href;
322
+ }
318
323
  if (isMobilePreview) {
319
324
  // on iframe - mobile preview, window.location.href is not scrolling to the element correctly
320
325
  const [, elementId] = props.href?.split("#");
@@ -330,7 +335,7 @@ const handleLinkBtnClick = (e, props, isMobilePreview) => {
330
335
  }
331
336
  }
332
337
  };
333
- export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick = () => {}) => {
338
+ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick = () => {}, metadata = {}) => {
334
339
  const props = {};
335
340
  if (!readOnly) {
336
341
  return {
@@ -429,13 +434,13 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
429
434
  let touchEndClicked = false;
430
435
  props.onTouchEnd = e => {
431
436
  touchEndClicked = true;
432
- handleLinkBtnClick(e, props);
437
+ handleLinkBtnClick(e, props, false, metadata);
433
438
  };
434
439
  props.onClick = e => {
435
440
  // This condition is used for mobile preview in the page editor.
436
441
  // 'touchEnd' will not work in the mobile page preview.
437
442
  if (!touchEndClicked && isMobile) {
438
- handleLinkBtnClick(e, props, true);
443
+ handleLinkBtnClick(e, props, true, metadata);
439
444
  }
440
445
  return false;
441
446
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "10.1.8",
3
+ "version": "10.2.0",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"