@bigbinary/neeto-editor 1.47.61 → 1.47.63

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
@@ -5,7 +5,7 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
5
5
  import * as React from 'react';
6
6
  import React__default, { memo, useState, useEffect, useRef, useCallback, createElement, forwardRef, useImperativeHandle } from 'react';
7
7
  import { E as Extension, a as Mark, m as mergeAttributes, b as markInputRule, c as markPasteRule, D as DecorationSet, d as Decoration, g as getMarkAttributes, N as Node, w as wrappingInputRule, t as textblockTypeInputRule, k as keydownHandler, e as callOrReturn, f as getExtensionField, i as isNodeSelection, n as nodeInputRule, h as getNodeType, j as getNodeAtPosition, l as isNodeActive, o as isAtStartOfNode, p as isAtEndOfNode, C as CALLOUT_TYPES, q as NodeViewWrapper, r as NodeViewContent, R as ReactNodeViewRenderer, s as findChildren, u as escapeForRegEx, v as ReactRenderer, x as EmojiPickerMenu, y as emojiPickerApi, z as combineTransactionSteps, A as getChangedRanges, B as findChildrenInRange, F as getMarksBetween, G as getAttributes, I as InputRule, H as highlightFocussedNode, J as resetFocussedNode, K as findParentNodeClosestToPos, P as PasteRule, L as BubbleMenu, O as getLinkPopoverPosition, Q as getMarkType, S as getMarkRange, T as useEditor, U as useEditorState, M as Menu$4, V as EditorContent, W as MediaUploader, X as LinkAddPopOver, Y as EditorView } from './chunk-P4uqYK53.js';
8
- import classnames$1 from 'classnames';
8
+ import classnames from 'classnames';
9
9
  import { D as DIRECT_UPLOAD_ENDPOINT, E as EDITOR_OPTIONS, C as COMBINED_REGEX, a as EDITOR_SIZES } from './chunk-faiBDOaS.js';
10
10
  import { isNotPresent, findBy, isNotEmpty, isPresent, noop as noop$1, slugify } from '@bigbinary/neeto-cist';
11
11
  import { withT, useOnClickOutside, useFuncDebounce } from '@bigbinary/neeto-commons-frontend/react-utils';
@@ -131,7 +131,7 @@ var ErrorWrapper = function ErrorWrapper(_ref) {
131
131
  children = _ref.children,
132
132
  className = _ref.className;
133
133
  var isError = !isNotPresent(error);
134
- var wrapperClasses = classnames$1(_defineProperty({
134
+ var wrapperClasses = classnames(_defineProperty({
135
135
  "neeto-editor-error": isError
136
136
  }, className, className));
137
137
  var getErrorMessage = function getErrorMessage() {
@@ -268,12 +268,16 @@ var useDeletedArticles = function useDeletedArticles(editor) {
268
268
  deletedArticleIds = _useState2[0],
269
269
  setDeletedArticleIds = _useState2[1];
270
270
  var _useFetchKbArticles = useFetchKbArticles({
271
- searchTerm: ""
271
+ searchTerm: "",
272
+ reactQueryOptions: {
273
+ enabled: !!editor
274
+ }
272
275
  }),
273
276
  _useFetchKbArticles$d = _useFetchKbArticles.data,
274
277
  allArticles = _useFetchKbArticles$d === void 0 ? [] : _useFetchKbArticles$d,
275
278
  isCheckingDeleted = _useFetchKbArticles.isLoading;
276
279
  var checkAllArticles = function checkAllArticles() {
280
+ if (!editor) return;
277
281
  var articleIdsInEditor = extractKbArticleIds(editor);
278
282
  if (isEmpty$1(articleIdsInEditor)) {
279
283
  setDeletedArticleIds(new Set());
@@ -288,7 +292,7 @@ var useDeletedArticles = function useDeletedArticles(editor) {
288
292
  useEffect(function () {
289
293
  if (!editor || isEmpty$1(allArticles)) return;
290
294
  checkAllArticles();
291
- }, [allArticles]);
295
+ }, [allArticles, editor]);
292
296
  return {
293
297
  deletedArticleIds: deletedArticleIds,
294
298
  isCheckingDeleted: isCheckingDeleted,
@@ -10077,7 +10081,7 @@ var EmojiSuggestionMenu = /*#__PURE__*/function (_React$Component) {
10077
10081
  children: [this.state.isLoading && /*#__PURE__*/jsx(Spinner, {}), !this.state.isLoading && (isNotEmpty(this.state.emojiSuggestions) ? this.state.emojiSuggestions.map(function (emoji, index) {
10078
10082
  return /*#__PURE__*/jsx("div", {
10079
10083
  "data-cy": "neeto-editor-emoji-suggestion-".concat(emoji.id),
10080
- className: classnames$1("neeto-editor-emoji-suggestion__item", {
10084
+ className: classnames("neeto-editor-emoji-suggestion__item", {
10081
10085
  "neeto-editor-emoji-suggestion__item--selected": index === _this2.state.selectedIndex
10082
10086
  }),
10083
10087
  onClick: function onClick() {
@@ -11117,7 +11121,7 @@ var ImagePreviewModal = function ImagePreviewModal(_ref) {
11117
11121
  }), /*#__PURE__*/jsx("img", {
11118
11122
  alt: "Preview",
11119
11123
  src: previewUrl,
11120
- className: classnames$1({
11124
+ className: classnames({
11121
11125
  "display-none": isLoading || isNil(previewUrl)
11122
11126
  }),
11123
11127
  onLoad: handleImageLoad
@@ -11279,7 +11283,7 @@ var ImageComponent = function ImageComponent(_ref) {
11279
11283
  if (isNotPresent(src) && isNotPresent(alt)) return null;
11280
11284
  return /*#__PURE__*/jsxs(NodeViewWrapper, {
11281
11285
  "data-cy": "neeto-editor-image-wrapper",
11282
- className: classnames$1("neeto-editor__image-wrapper", "neeto-editor__image--".concat(align), {
11286
+ className: classnames("neeto-editor__image-wrapper", "neeto-editor__image--".concat(align), {
11283
11287
  "neeto-editor__image--bordered": border
11284
11288
  }),
11285
11289
  children: [/*#__PURE__*/jsxs("figure", {
@@ -11317,7 +11321,7 @@ var ImageComponent = function ImageComponent(_ref) {
11317
11321
  children: /*#__PURE__*/jsx(Spinner, {})
11318
11322
  }), /*#__PURE__*/jsx(NodeViewContent, {
11319
11323
  as: "figcaption",
11320
- className: classnames$1({
11324
+ className: classnames({
11321
11325
  "is-empty": isEmpty$1(caption)
11322
11326
  }),
11323
11327
  style: {
@@ -14161,7 +14165,7 @@ var MentionList = /*#__PURE__*/function (_React$Component) {
14161
14165
  return /*#__PURE__*/jsxs(MenuItem.Button, {
14162
14166
  "data-cy": "neeto-editor-mention-list-".concat(name),
14163
14167
  type: "button",
14164
- className: classnames$1("neeto-editor-mentions__item", {
14168
+ className: classnames("neeto-editor-mentions__item", {
14165
14169
  active: index === selectedIndex
14166
14170
  }),
14167
14171
  onClick: function onClick() {
@@ -14646,7 +14650,7 @@ var MenuItem$1 = /*#__PURE__*/forwardRef(function (_ref2, ref) {
14646
14650
  return /*#__PURE__*/jsxs("button", {
14647
14651
  ref: ref,
14648
14652
  "data-cy": "neeto-editor-command-list-item-".concat(index),
14649
- className: classnames$1("neeto-editor-slash-commands__item", {
14653
+ className: classnames("neeto-editor-slash-commands__item", {
14650
14654
  active: index === selectedIndex
14651
14655
  }),
14652
14656
  onClick: selectItem,
@@ -20436,7 +20440,7 @@ var VideoComponent = function VideoComponent(_ref) {
20436
20440
  };
20437
20441
  if (isNotPresent(src)) return null;
20438
20442
  return /*#__PURE__*/jsx(NodeViewWrapper, {
20439
- className: classnames$1("neeto-editor__image-wrapper", "neeto-editor__image--".concat(align), {
20443
+ className: classnames("neeto-editor__image-wrapper", "neeto-editor__image--".concat(align), {
20440
20444
  "neeto-editor__image--bordered": border
20441
20445
  }),
20442
20446
  children: /*#__PURE__*/jsxs("figure", {
@@ -20469,7 +20473,7 @@ var VideoComponent = function VideoComponent(_ref) {
20469
20473
  }))
20470
20474
  }), /*#__PURE__*/jsx(NodeViewContent, {
20471
20475
  as: "figcaption",
20472
- className: classnames$1({
20476
+ className: classnames({
20473
20477
  "is-empty": isEmpty$1(caption)
20474
20478
  }),
20475
20479
  style: {
@@ -20641,11 +20645,11 @@ var renderEmbedHTML = function renderEmbedHTML(node, HTMLAttributes, options) {
20641
20645
  border = _node$attrs.border,
20642
20646
  aspectRatio = _node$attrs.aspectRatio;
20643
20647
  return ["div", {
20644
- "class": classnames$1("neeto-editor__video-wrapper", "neeto-editor__video--".concat(align), {
20648
+ "class": classnames("neeto-editor__video-wrapper", "neeto-editor__video--".concat(align), {
20645
20649
  "neeto-editor__video--bordered": border
20646
20650
  })
20647
20651
  }, ["div", {
20648
- "class": classnames$1("neeto-editor__video-iframe", {
20652
+ "class": classnames("neeto-editor__video-iframe", {
20649
20653
  "neeto-editor-aspect-1-1": aspectRatio === "1/1",
20650
20654
  "neeto-editor-aspect-16-9": aspectRatio === "16/9",
20651
20655
  "neeto-editor-aspect-9-16": aspectRatio === "9/16",
@@ -20666,7 +20670,7 @@ var renderUploadHTML = function renderUploadHTML(node, HTMLAttributes, options)
20666
20670
  vidwidth = _node$attrs2.vidwidth,
20667
20671
  border = _node$attrs2.border;
20668
20672
  var wrapperDivAttrs = {
20669
- "class": classnames$1("neeto-editor__image-wrapper", "neeto-editor__image--".concat(align), {
20673
+ "class": classnames("neeto-editor__image-wrapper", "neeto-editor__image--".concat(align), {
20670
20674
  "neeto-editor__image--bordered": border
20671
20675
  })
20672
20676
  };
@@ -21455,7 +21459,7 @@ var KbArticleView = withT(function (_ref) {
21455
21459
  href: linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.href,
21456
21460
  rel: "noreferrer",
21457
21461
  target: "_blank",
21458
- className: classnames$1("ne-link-popover__kb-article-link", {
21462
+ className: classnames("ne-link-popover__kb-article-link", {
21459
21463
  "ne-link-popover__kb-article-link--deleted": isDeleted
21460
21464
  }),
21461
21465
  onClick: function onClick(event) {
@@ -21971,6 +21975,7 @@ var Editor = function Editor(_ref, ref) {
21971
21975
  isAttachmentsUploading = _useState2[0],
21972
21976
  setIsAttachmentsUploading = _useState2[1];
21973
21977
  var wrapperRef = useRef(null);
21978
+ var isArticleOptActive = addons.includes(EDITOR_OPTIONS.NEETO_KB_ARTICLE);
21974
21979
  var isAttachmentsActive = addons.includes(EDITOR_OPTIONS.ATTACHMENTS);
21975
21980
  var isMediaUploaderActive = addons.includes(EDITOR_OPTIONS.IMAGE_UPLOAD) || addons.includes(EDITOR_OPTIONS.VIDEO_UPLOAD);
21976
21981
  var isFixedMenuActive = menuType === "fixed";
@@ -22038,7 +22043,7 @@ var Editor = function Editor(_ref, ref) {
22038
22043
  useEditorWarnings({
22039
22044
  initialValue: initialValue
22040
22045
  });
22041
- var editorClasses = classnames$1("neeto-editor", _defineProperty({
22046
+ var editorClasses = classnames("neeto-editor", _defineProperty({
22042
22047
  "fixed-menu-active": isFixedMenuActive,
22043
22048
  "bubble-menu-active": isBubbleMenuActive,
22044
22049
  "placeholder-active": isPlaceholderActive,
@@ -22093,7 +22098,7 @@ var Editor = function Editor(_ref, ref) {
22093
22098
  };
22094
22099
  }
22095
22100
  });
22096
- var deletedArticlesHook = useDeletedArticles(editor);
22101
+ var deletedArticlesHook = useDeletedArticles(isArticleOptActive ? editor : null);
22097
22102
 
22098
22103
  /* Make editor object available to the parent */
22099
22104
  useImperativeHandle(ref, function () {
@@ -22130,7 +22135,7 @@ var Editor = function Editor(_ref, ref) {
22130
22135
  return /*#__PURE__*/jsxs("div", {
22131
22136
  "data-cy": "neeto-editor-wrapper",
22132
22137
  ref: wrapperRef,
22133
- className: classnames$1(_defineProperty(_defineProperty({}, className, className), "ne-attachments__wrapper", isAttachmentsActive)),
22138
+ className: classnames(_defineProperty(_defineProperty({}, className, className), "ne-attachments__wrapper", isAttachmentsActive)),
22134
22139
  children: [label && /*#__PURE__*/jsx(Label, {
22135
22140
  required: required,
22136
22141
  className: "neeto-ui-mb-2",
@@ -22176,7 +22181,7 @@ var Editor = function Editor(_ref, ref) {
22176
22181
  isIndependent: false,
22177
22182
  ref: addAttachmentsRef,
22178
22183
  setIsUploading: setIsAttachmentsUploading,
22179
- className: classnames$1("ne-attachments--integrated", _defineProperty({}, attachmentsClassName, attachmentsClassName)),
22184
+ className: classnames("ne-attachments--integrated", _defineProperty({}, attachmentsClassName, attachmentsClassName)),
22180
22185
  onChange: onChangeAttachments
22181
22186
  }, otherAttachmentProps)), (editor === null || editor === void 0 ? void 0 : editor.isActive("link")) && /*#__PURE__*/jsx(LinkPopOver, {
22182
22187
  deletedArticlesHook: deletedArticlesHook,