@bigbinary/neeto-editor 1.47.51 → 1.47.52

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,7 +4,7 @@ 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, { memo, useEffect, useState, useRef, useCallback, createElement, forwardRef, useImperativeHandle } from 'react';
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-BuwZ56CV.js';
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-DiadEIO-.js';
8
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-7IwD_Poi.js';
10
10
  import { isNotPresent, findBy, isNotEmpty, isPresent, noop as noop$1, slugify } from '@bigbinary/neeto-cist';
@@ -20792,10 +20792,13 @@ var LinkPopOver = function LinkPopOver(_ref) {
20792
20792
  _useState8 = _slicedToArray(_useState7, 2),
20793
20793
  isLinkActive = _useState8[0],
20794
20794
  setIsLinkActive = _useState8[1];
20795
+ var _useState9 = useState(editor === null || editor === void 0 ? void 0 : editor.getAttributes("link")),
20796
+ _useState10 = _slicedToArray(_useState9, 2),
20797
+ linkAttributes = _useState10[0],
20798
+ setLinkAttributes = _useState10[1];
20795
20799
  var popoverRef = useRef(null);
20796
20800
  var _useTranslation = useTranslation(),
20797
20801
  t = _useTranslation.t;
20798
- var linkAttributes = editor === null || editor === void 0 ? void 0 : editor.getAttributes("link");
20799
20802
  var updatePopoverPosition = function updatePopoverPosition() {
20800
20803
  if (!view) return;
20801
20804
  var _getLinkPopoverPositi = getLinkPopoverPosition(editor, popoverRef),
@@ -20826,7 +20829,7 @@ var LinkPopOver = function LinkPopOver(_ref) {
20826
20829
  if (equals(textContent, initialTextContent)) {
20827
20830
  editor.chain().focus().extendMarkRange("link").setLink({
20828
20831
  href: formattedUrl,
20829
- target: openInNewTab ? "_blank" : null
20832
+ target: openInNewTab ? "_blank" : "_self"
20830
20833
  }).run();
20831
20834
  setIsEditing(false);
20832
20835
  return;
@@ -20844,7 +20847,7 @@ var LinkPopOver = function LinkPopOver(_ref) {
20844
20847
  if (isNil(from) || isNil(to)) return;
20845
20848
  var attrs = {
20846
20849
  href: formattedUrl,
20847
- target: openInNewTab ? "_blank" : null
20850
+ target: openInNewTab ? "_blank" : "_self"
20848
20851
  };
20849
20852
  var linkMark = state.schema.marks.link.create(attrs);
20850
20853
  var linkTextWithMark = state.schema.text(textContent, [linkMark]);
@@ -20871,16 +20874,19 @@ var LinkPopOver = function LinkPopOver(_ref) {
20871
20874
  setIsLinkActive(isActive);
20872
20875
  if (isActive) {
20873
20876
  updatePopoverPosition();
20877
+ var currentLinkAttributes = editor === null || editor === void 0 ? void 0 : editor.getAttributes("link");
20878
+ setLinkAttributes(currentLinkAttributes);
20874
20879
  }
20875
20880
  }, [view === null || view === void 0 || (_view$state2 = view.state) === null || _view$state2 === void 0 || (_view$state2 = _view$state2.selection) === null || _view$state2 === void 0 || (_view$state2 = _view$state2.$from) === null || _view$state2 === void 0 ? void 0 : _view$state2.pos, isEditing]);
20876
20881
  var renderEditingMode = function renderEditingMode() {
20882
+ var initialValues = {
20883
+ textContent: initialTextContent,
20884
+ urlString: (linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.href) || "",
20885
+ openInNewTab: (linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.target) === "_blank"
20886
+ };
20877
20887
  return /*#__PURE__*/jsx(Form, {
20878
20888
  formikProps: {
20879
- initialValues: {
20880
- textContent: initialTextContent,
20881
- urlString: (linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.href) || "",
20882
- openInNewTab: (linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.target) === "_blank"
20883
- },
20889
+ initialValues: initialValues,
20884
20890
  onSubmit: handleSubmit,
20885
20891
  validationSchema: LINK_VALIDATION_SCHEMA
20886
20892
  },
@@ -20940,14 +20946,14 @@ var LinkPopOver = function LinkPopOver(_ref) {
20940
20946
  })]
20941
20947
  });
20942
20948
  }
20943
- });
20949
+ }, "".concat(linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.href, "-").concat(linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.target));
20944
20950
  };
20945
20951
  var renderViewMode = function renderViewMode() {
20946
20952
  return /*#__PURE__*/jsxs(Fragment, {
20947
20953
  children: [/*#__PURE__*/jsx("a", {
20948
20954
  href: linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.href,
20949
- rel: "noreferrer",
20950
- target: "_blank",
20955
+ rel: "noreferrer noopener",
20956
+ target: (linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.target) || "_self",
20951
20957
  children: linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.href
20952
20958
  }), " - ", /*#__PURE__*/jsx(Button, {
20953
20959
  className: "ne-link-popover__option-button",