@bigbinary/neeto-editor 1.47.51 → 1.47.53

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';
@@ -20346,8 +20346,13 @@ var UnifiedVideoExtension = Node.create({
20346
20346
  },
20347
20347
  parseHTML: function parseHTML() {
20348
20348
  return [{
20349
- tag: "figure[data-video]",
20349
+ tag: "div.neeto-editor__image-wrapper",
20350
20350
  getAttrs: function getAttrs(node) {
20351
+ var figure = node.querySelector("figure[data-video]");
20352
+ if (!figure) return false;
20353
+ var videoEl = figure.querySelector("video");
20354
+ var iframeEl = figure.querySelector("iframe");
20355
+ if (!videoEl && !iframeEl) return false;
20351
20356
  return node.style.fontWeight !== "normal" && null;
20352
20357
  },
20353
20358
  contentElement: "figcaption"
@@ -20792,10 +20797,13 @@ var LinkPopOver = function LinkPopOver(_ref) {
20792
20797
  _useState8 = _slicedToArray(_useState7, 2),
20793
20798
  isLinkActive = _useState8[0],
20794
20799
  setIsLinkActive = _useState8[1];
20800
+ var _useState9 = useState(editor === null || editor === void 0 ? void 0 : editor.getAttributes("link")),
20801
+ _useState10 = _slicedToArray(_useState9, 2),
20802
+ linkAttributes = _useState10[0],
20803
+ setLinkAttributes = _useState10[1];
20795
20804
  var popoverRef = useRef(null);
20796
20805
  var _useTranslation = useTranslation(),
20797
20806
  t = _useTranslation.t;
20798
- var linkAttributes = editor === null || editor === void 0 ? void 0 : editor.getAttributes("link");
20799
20807
  var updatePopoverPosition = function updatePopoverPosition() {
20800
20808
  if (!view) return;
20801
20809
  var _getLinkPopoverPositi = getLinkPopoverPosition(editor, popoverRef),
@@ -20826,7 +20834,7 @@ var LinkPopOver = function LinkPopOver(_ref) {
20826
20834
  if (equals(textContent, initialTextContent)) {
20827
20835
  editor.chain().focus().extendMarkRange("link").setLink({
20828
20836
  href: formattedUrl,
20829
- target: openInNewTab ? "_blank" : null
20837
+ target: openInNewTab ? "_blank" : "_self"
20830
20838
  }).run();
20831
20839
  setIsEditing(false);
20832
20840
  return;
@@ -20844,7 +20852,7 @@ var LinkPopOver = function LinkPopOver(_ref) {
20844
20852
  if (isNil(from) || isNil(to)) return;
20845
20853
  var attrs = {
20846
20854
  href: formattedUrl,
20847
- target: openInNewTab ? "_blank" : null
20855
+ target: openInNewTab ? "_blank" : "_self"
20848
20856
  };
20849
20857
  var linkMark = state.schema.marks.link.create(attrs);
20850
20858
  var linkTextWithMark = state.schema.text(textContent, [linkMark]);
@@ -20871,16 +20879,19 @@ var LinkPopOver = function LinkPopOver(_ref) {
20871
20879
  setIsLinkActive(isActive);
20872
20880
  if (isActive) {
20873
20881
  updatePopoverPosition();
20882
+ var currentLinkAttributes = editor === null || editor === void 0 ? void 0 : editor.getAttributes("link");
20883
+ setLinkAttributes(currentLinkAttributes);
20874
20884
  }
20875
20885
  }, [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
20886
  var renderEditingMode = function renderEditingMode() {
20887
+ var initialValues = {
20888
+ textContent: initialTextContent,
20889
+ urlString: (linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.href) || "",
20890
+ openInNewTab: (linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.target) === "_blank"
20891
+ };
20877
20892
  return /*#__PURE__*/jsx(Form, {
20878
20893
  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
- },
20894
+ initialValues: initialValues,
20884
20895
  onSubmit: handleSubmit,
20885
20896
  validationSchema: LINK_VALIDATION_SCHEMA
20886
20897
  },
@@ -20940,14 +20951,14 @@ var LinkPopOver = function LinkPopOver(_ref) {
20940
20951
  })]
20941
20952
  });
20942
20953
  }
20943
- });
20954
+ }, "".concat(linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.href, "-").concat(linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.target));
20944
20955
  };
20945
20956
  var renderViewMode = function renderViewMode() {
20946
20957
  return /*#__PURE__*/jsxs(Fragment, {
20947
20958
  children: [/*#__PURE__*/jsx("a", {
20948
20959
  href: linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.href,
20949
- rel: "noreferrer",
20950
- target: "_blank",
20960
+ rel: "noreferrer noopener",
20961
+ target: (linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.target) || "_self",
20951
20962
  children: linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.href
20952
20963
  }), " - ", /*#__PURE__*/jsx(Button, {
20953
20964
  className: "ne-link-popover__option-button",