@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.
@@ -5,7 +5,7 @@ var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
5
5
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
6
6
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
7
7
  var React = require('react');
8
- var Menu$4 = require('./chunk-D-D5oWUE.cjs.js');
8
+ var Menu$4 = require('./chunk-C8-dRWVT.cjs.js');
9
9
  var classnames = require('classnames');
10
10
  var constants = require('./chunk-D1TqtxZX.cjs.js');
11
11
  var neetoCist = require('@bigbinary/neeto-cist');
@@ -20366,8 +20366,13 @@ var UnifiedVideoExtension = Menu$4.Node.create({
20366
20366
  },
20367
20367
  parseHTML: function parseHTML() {
20368
20368
  return [{
20369
- tag: "figure[data-video]",
20369
+ tag: "div.neeto-editor__image-wrapper",
20370
20370
  getAttrs: function getAttrs(node) {
20371
+ var figure = node.querySelector("figure[data-video]");
20372
+ if (!figure) return false;
20373
+ var videoEl = figure.querySelector("video");
20374
+ var iframeEl = figure.querySelector("iframe");
20375
+ if (!videoEl && !iframeEl) return false;
20371
20376
  return node.style.fontWeight !== "normal" && null;
20372
20377
  },
20373
20378
  contentElement: "figcaption"
@@ -20812,10 +20817,13 @@ var LinkPopOver = function LinkPopOver(_ref) {
20812
20817
  _useState8 = _slicedToArray(_useState7, 2),
20813
20818
  isLinkActive = _useState8[0],
20814
20819
  setIsLinkActive = _useState8[1];
20820
+ var _useState9 = React.useState(editor === null || editor === void 0 ? void 0 : editor.getAttributes("link")),
20821
+ _useState10 = _slicedToArray(_useState9, 2),
20822
+ linkAttributes = _useState10[0],
20823
+ setLinkAttributes = _useState10[1];
20815
20824
  var popoverRef = React.useRef(null);
20816
20825
  var _useTranslation = reactI18next.useTranslation(),
20817
20826
  t = _useTranslation.t;
20818
- var linkAttributes = editor === null || editor === void 0 ? void 0 : editor.getAttributes("link");
20819
20827
  var updatePopoverPosition = function updatePopoverPosition() {
20820
20828
  if (!view) return;
20821
20829
  var _getLinkPopoverPositi = Menu$4.getLinkPopoverPosition(editor, popoverRef),
@@ -20846,7 +20854,7 @@ var LinkPopOver = function LinkPopOver(_ref) {
20846
20854
  if (ramda.equals(textContent, initialTextContent)) {
20847
20855
  editor.chain().focus().extendMarkRange("link").setLink({
20848
20856
  href: formattedUrl,
20849
- target: openInNewTab ? "_blank" : null
20857
+ target: openInNewTab ? "_blank" : "_self"
20850
20858
  }).run();
20851
20859
  setIsEditing(false);
20852
20860
  return;
@@ -20864,7 +20872,7 @@ var LinkPopOver = function LinkPopOver(_ref) {
20864
20872
  if (ramda.isNil(from) || ramda.isNil(to)) return;
20865
20873
  var attrs = {
20866
20874
  href: formattedUrl,
20867
- target: openInNewTab ? "_blank" : null
20875
+ target: openInNewTab ? "_blank" : "_self"
20868
20876
  };
20869
20877
  var linkMark = state.schema.marks.link.create(attrs);
20870
20878
  var linkTextWithMark = state.schema.text(textContent, [linkMark]);
@@ -20891,16 +20899,19 @@ var LinkPopOver = function LinkPopOver(_ref) {
20891
20899
  setIsLinkActive(isActive);
20892
20900
  if (isActive) {
20893
20901
  updatePopoverPosition();
20902
+ var currentLinkAttributes = editor === null || editor === void 0 ? void 0 : editor.getAttributes("link");
20903
+ setLinkAttributes(currentLinkAttributes);
20894
20904
  }
20895
20905
  }, [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]);
20896
20906
  var renderEditingMode = function renderEditingMode() {
20907
+ var initialValues = {
20908
+ textContent: initialTextContent,
20909
+ urlString: (linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.href) || "",
20910
+ openInNewTab: (linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.target) === "_blank"
20911
+ };
20897
20912
  return /*#__PURE__*/jsxRuntime.jsx(Form, {
20898
20913
  formikProps: {
20899
- initialValues: {
20900
- textContent: initialTextContent,
20901
- urlString: (linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.href) || "",
20902
- openInNewTab: (linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.target) === "_blank"
20903
- },
20914
+ initialValues: initialValues,
20904
20915
  onSubmit: handleSubmit,
20905
20916
  validationSchema: constants$1.LINK_VALIDATION_SCHEMA
20906
20917
  },
@@ -20960,14 +20971,14 @@ var LinkPopOver = function LinkPopOver(_ref) {
20960
20971
  })]
20961
20972
  });
20962
20973
  }
20963
- });
20974
+ }, "".concat(linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.href, "-").concat(linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.target));
20964
20975
  };
20965
20976
  var renderViewMode = function renderViewMode() {
20966
20977
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
20967
20978
  children: [/*#__PURE__*/jsxRuntime.jsx("a", {
20968
20979
  href: linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.href,
20969
- rel: "noreferrer",
20970
- target: "_blank",
20980
+ rel: "noreferrer noopener",
20981
+ target: (linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.target) || "_self",
20971
20982
  children: linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes.href
20972
20983
  }), " - ", /*#__PURE__*/jsxRuntime.jsx(Button, {
20973
20984
  className: "ne-link-popover__option-button",