@bigbinary/neeto-editor 1.38.11 → 1.39.0-beta1

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/Editor.js CHANGED
@@ -4,10 +4,11 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
4
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
5
5
  import * as React from 'react';
6
6
  import React__default, { useEffect, useState, useRef, forwardRef, useCallback, useImperativeHandle } from 'react';
7
- import { E as Extension, a as Mark, m as mergeAttributes, b as markInputRule, c as markPasteRule, g as getMarkAttributes, N as Node, D as DecorationSet, d as Decoration, w as wrappingInputRule, t as textblockTypeInputRule, k as keydownHandler, e as callOrReturn, f as getExtensionField, n as nodeInputRule, h as findChildren, i as NodeViewWrapper, j as NodeViewContent, R as ReactNodeViewRenderer, P as PasteRule, v as validateUrl, l as escapeForRegEx, o as ReactRenderer, p as EmojiPickerMenu, q as emojiPickerApi, r as combineTransactionSteps, s as getChangedRanges, u as findChildrenInRange, x as getMarksBetween, y as getAttributes, I as InputRule, z as highlightFocussedNode, A as resetFocussedNode, B as findParentNodeClosestToPos, C as BubbleMenu, F as getLinkPopoverPosition, G as getMarkType, H as getMarkRange, J as useEditor, M as Menu$4, K as EditorContent, L as MediaUploader, O as EmbedOption, Q as EditorView } from './chunk-17c1b4e1.js';
7
+ import { E as Extension, a as Mark, m as mergeAttributes, b as markInputRule, c as markPasteRule, g as getMarkAttributes, N as Node, D as DecorationSet, d as Decoration, w as wrappingInputRule, t as textblockTypeInputRule, k as keydownHandler, e as callOrReturn, f as getExtensionField, n as nodeInputRule, h as findChildren, i as NodeViewWrapper, j as NodeViewContent, R as ReactNodeViewRenderer, P as PasteRule, v as validateUrl, l as escapeForRegEx, o as ReactRenderer, p as EmojiPickerMenu, q as emojiPickerApi, r as combineTransactionSteps, s as getChangedRanges, u as findChildrenInRange, x as getMarksBetween, y as getAttributes, I as InputRule, z as highlightFocussedNode, A as resetFocussedNode, B as findParentNodeClosestToPos, C as BubbleMenu, F as getLinkPopoverPosition, G as getMarkType, H as getMarkRange, J as useEditor, M as Menu$4, K as EditorContent, L as MediaUploader, O as EmbedOption, Q as EditorView } from './chunk-1888361f.js';
8
8
  import classnames from 'classnames';
9
9
  import { C as COMBINED_REGEX, D as DIRECT_UPLOAD_ENDPOINT, E as EDITOR_OPTIONS } from './chunk-edd8b9fe.js';
10
10
  import { isNotPresent, isNotEmpty, isPresent, noop as noop$1, slugify } from '@bigbinary/neeto-cist';
11
+ import { useOnClickOutside, useFuncDebounce } from '@bigbinary/neeto-commons-frontend/react-utils';
11
12
  import { Dropdown, Input, Button, Spinner, Modal, Toastr, Avatar, Typography, Checkbox, Label } from '@bigbinary/neetoui';
12
13
  import { is, isNil, mergeRight, isEmpty as isEmpty$1, assoc, equals } from 'ramda';
13
14
  import { n } from './chunk-15c449f1.js';
@@ -32,7 +33,6 @@ import { globalProps } from '@bigbinary/neeto-commons-frontend/initializers';
32
33
  import _extends from '@babel/runtime/helpers/extends';
33
34
  import { M as MARGIN_HEIGHT } from './chunk-5bc5e361.js';
34
35
  import Tippy from '@tippyjs/react';
35
- import { useOnClickOutside } from '@bigbinary/neeto-commons-frontend/react-utils';
36
36
  import { Form, Input as Input$1 } from '@bigbinary/neetoui/formik';
37
37
  import { A as Attachments } from './chunk-b66ef3a3.js';
38
38
  import 'tippy.js/dist/svg-arrow.css';
@@ -41,9 +41,9 @@ import 'axios';
41
41
  import 'react-colorful';
42
42
  import '@bigbinary/neeto-molecules/DynamicVariables';
43
43
  import './chunk-65f73e5a.js';
44
- import 'yup';
45
44
  import 'zustand/shallow';
46
45
  import 'zustand';
46
+ import 'yup';
47
47
 
48
48
  var ErrorWrapper = function ErrorWrapper(_ref) {
49
49
  var error = _ref.error,
@@ -7566,6 +7566,7 @@ var ImageComponent = function ImageComponent(_ref) {
7566
7566
  })));
7567
7567
  editor.commands.focus();
7568
7568
  };
7569
+ if (isNotPresent(src)) return null;
7569
7570
  return /*#__PURE__*/React__default.createElement(NodeViewWrapper, {
7570
7571
  className: "neeto-editor__image-wrapper neeto-editor__image--".concat(align),
7571
7572
  "data-cy": "neeto-editor-image-wrapper"
@@ -14028,6 +14029,7 @@ var VideoComponent = function VideoComponent(_ref) {
14028
14029
  })));
14029
14030
  editor.commands.focus();
14030
14031
  };
14032
+ if (isNotPresent(src)) return null;
14031
14033
  return /*#__PURE__*/React__default.createElement(NodeViewWrapper, {
14032
14034
  className: "neeto-editor__image-wrapper neeto-editor__image--".concat(align)
14033
14035
  }, /*#__PURE__*/React__default.createElement("figure", {
@@ -14691,6 +14693,10 @@ var Editor = function Editor(_ref, ref) {
14691
14693
  },
14692
14694
  isDisabled: isAttachmentsUploading
14693
14695
  };
14696
+ var debouncedOnChangeHandler = useFuncDebounce(function (_ref2) {
14697
+ var editor = _ref2.editor;
14698
+ return onChange(editor.getHTML());
14699
+ }, 100);
14694
14700
  var customExtensions = useCustomExtensions({
14695
14701
  placeholder: placeholder,
14696
14702
  extensions: extensions,
@@ -14742,14 +14748,11 @@ var Editor = function Editor(_ref, ref) {
14742
14748
  parseOptions: {
14743
14749
  preserveWhitespace: true
14744
14750
  },
14745
- onCreate: function onCreate(_ref2) {
14746
- var editor = _ref2.editor;
14747
- return !autoFocus && setInitialPosition(editor);
14748
- },
14749
- onUpdate: function onUpdate(_ref3) {
14751
+ onCreate: function onCreate(_ref3) {
14750
14752
  var editor = _ref3.editor;
14751
- return onChange(editor.getHTML());
14753
+ return !autoFocus && setInitialPosition(editor);
14752
14754
  },
14755
+ onUpdate: debouncedOnChangeHandler,
14753
14756
  onFocus: onFocus,
14754
14757
  onBlur: onBlur
14755
14758
  });