@bigbinary/neeto-editor-frontend 2.0.5 → 2.0.6

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.
@@ -11,7 +11,7 @@ var classnames = require('classnames');
11
11
  var neetoCist = require('@bigbinary/neeto-cist');
12
12
  var reactUtils = require('@bigbinary/neeto-commons-frontend/v2/react-utils');
13
13
  var ReactDOM$1 = require('react-dom');
14
- var fuzzySearch = require('../chunk-CNhef3wf.cjs.js');
14
+ var getVideoDimension = require('../chunk-B7RhUrgV.cjs.js');
15
15
  var constants = require('../chunk-BxKa_XOs.cjs.js');
16
16
  require('../chunk-CQ-j2kAX.cjs.js');
17
17
  var ramda = require('ramda');
@@ -246,7 +246,7 @@ var HighlightInternal = useEditorStore.Extension.create({
246
246
  }
247
247
  });
248
248
 
249
- var BulletList = fuzzySearch.BulletList.configure({
249
+ var BulletList = getVideoDimension.BulletList.configure({
250
250
  HTMLAttributes: {
251
251
  "class": "bulletList"
252
252
  },
@@ -673,7 +673,7 @@ var CodeBlockComponent = function CodeBlockComponent(_ref) {
673
673
 
674
674
  function ownKeys$i(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
675
675
  function _objectSpread$i(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$i(Object(t), true).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$i(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
676
- var CodeBlock = fuzzySearch.src_default.extend({
676
+ var CodeBlock = getVideoDimension.src_default.extend({
677
677
  addAttributes: function addAttributes() {
678
678
  var _this$parent;
679
679
  return _objectSpread$i(_objectSpread$i({}, (_this$parent = this.parent) === null || _this$parent === void 0 ? void 0 : _this$parent.call(this)), {}, {
@@ -869,7 +869,7 @@ var EmojiPicker = useEditorStore.Node.create({
869
869
  };
870
870
  },
871
871
  addProseMirrorPlugins: function addProseMirrorPlugins() {
872
- return [fuzzySearch.src_default$1(_objectSpread$h({
872
+ return [getVideoDimension.src_default$1(_objectSpread$h({
873
873
  editor: this.editor
874
874
  }, this.options.suggestion))];
875
875
  }
@@ -1170,7 +1170,7 @@ var EmojiSuggestion$1 = useEditorStore.Node.create({
1170
1170
  };
1171
1171
  },
1172
1172
  addProseMirrorPlugins: function addProseMirrorPlugins() {
1173
- return [fuzzySearch.src_default$1(_objectSpread$g({
1173
+ return [getVideoDimension.src_default$1(_objectSpread$g({
1174
1174
  editor: this.editor
1175
1175
  }, this.options.suggestion))];
1176
1176
  }
@@ -1529,7 +1529,7 @@ var ImageComponent = function ImageComponent(_ref) {
1529
1529
  deleteNode: deleteNode,
1530
1530
  editor: editor,
1531
1531
  updateAttributes: updateAttributes
1532
- }), src ? /*#__PURE__*/jsxRuntime.jsx(fuzzySearch.Resizable, {
1532
+ }), src ? /*#__PURE__*/jsxRuntime.jsx(getVideoDimension.Resizable, {
1533
1533
  lockAspectRatio: true,
1534
1534
  className: "neeto-editor__image",
1535
1535
  minWidth: "50px",
@@ -1910,7 +1910,7 @@ var FigCaption = useEditorStore.Node.create({
1910
1910
  }
1911
1911
  });
1912
1912
 
1913
- var Italic = fuzzySearch.src_default$2.extend({
1913
+ var Italic = getVideoDimension.src_default$2.extend({
1914
1914
  addInputRules: function addInputRules() {
1915
1915
  return [];
1916
1916
  },
@@ -2001,7 +2001,7 @@ var withTrimmedLinkPaste = function withTrimmedLinkPaste(plugin) {
2001
2001
  })
2002
2002
  }));
2003
2003
  };
2004
- var Link = fuzzySearch.Link.extend({
2004
+ var Link = getVideoDimension.Link.extend({
2005
2005
  inclusive: false,
2006
2006
  addAttributes: function addAttributes() {
2007
2007
  var _this$parent;
@@ -2155,7 +2155,7 @@ var MentionList = /*#__PURE__*/function (_React$Component) {
2155
2155
  selectedIndex: 0
2156
2156
  });
2157
2157
  }
2158
- fuzzySearch.scrollHandler({
2158
+ getVideoDimension.scrollHandler({
2159
2159
  wrapperRef: this.mentionRef,
2160
2160
  index: this.state.selectedIndex
2161
2161
  });
@@ -2277,7 +2277,7 @@ var suggestion$1 = {
2277
2277
  };
2278
2278
  }
2279
2279
  };
2280
- var Mentions = fuzzySearch.src_default$3.extend({
2280
+ var Mentions = getVideoDimension.src_default$3.extend({
2281
2281
  addCommands: function addCommands() {
2282
2282
  var _this = this;
2283
2283
  return {
@@ -2312,7 +2312,7 @@ var Mention = {
2312
2312
  }
2313
2313
  };
2314
2314
 
2315
- var OrderedList = fuzzySearch.OrderedList.configure({
2315
+ var OrderedList = getVideoDimension.OrderedList.configure({
2316
2316
  HTMLAttributes: {
2317
2317
  "class": "orderedList"
2318
2318
  },
@@ -2379,7 +2379,7 @@ var Placeholder = useEditorStore.Extension.create({
2379
2379
  }
2380
2380
  });
2381
2381
 
2382
- var SelectionDecoration = fuzzySearch.src_default$4.extend({
2382
+ var SelectionDecoration = getVideoDimension.src_default$4.extend({
2383
2383
  name: "selectionDecorator",
2384
2384
  addProseMirrorPlugins: function addProseMirrorPlugins() {
2385
2385
  var editor = this.editor;
@@ -2523,7 +2523,7 @@ var Menu = /*#__PURE__*/function (_React$Component) {
2523
2523
  if (items !== oldProps.items) this.setState({
2524
2524
  selectedIndex: 0
2525
2525
  });
2526
- fuzzySearch.scrollHandler({
2526
+ getVideoDimension.scrollHandler({
2527
2527
  wrapperRef: this.menuRef,
2528
2528
  index: this.state.selectedIndex
2529
2529
  });
@@ -3083,7 +3083,7 @@ var SlashCommands = {
3083
3083
  items: function items(_ref3) {
3084
3084
  var query = _ref3.query;
3085
3085
  if (!query) return commandItems;
3086
- var filteredItems = fuzzySearch.fuzzySearch(commandItems, query);
3086
+ var filteredItems = getVideoDimension.fuzzySearch(commandItems, query);
3087
3087
  return ramda.isEmpty(filteredItems) ? [NO_RESULT_MENU_ITEM] : filteredItems;
3088
3088
  },
3089
3089
  render: function render() {
@@ -3142,7 +3142,7 @@ var SlashCommands = {
3142
3142
  };
3143
3143
  },
3144
3144
  addProseMirrorPlugins: function addProseMirrorPlugins() {
3145
- return [fuzzySearch.src_default$1(_objectSpread$8({
3145
+ return [getVideoDimension.src_default$1(_objectSpread$8({
3146
3146
  editor: this.editor
3147
3147
  }, this.options.suggestion))];
3148
3148
  }
@@ -3206,7 +3206,7 @@ var suggestion = {
3206
3206
  };
3207
3207
  }
3208
3208
  };
3209
- var SpecialMentions$1 = fuzzySearch.src_default$3.extend({
3209
+ var SpecialMentions$1 = getVideoDimension.src_default$3.extend({
3210
3210
  name: "special-mention",
3211
3211
  renderHTML: function renderHTML(_ref2) {
3212
3212
  var node = _ref2.node,
@@ -3508,7 +3508,7 @@ var exitTable = function exitTable(editor) {
3508
3508
 
3509
3509
  function ownKeys$6(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3510
3510
  function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), true).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3511
- var Table$1 = fuzzySearch.Table.extend({
3511
+ var Table$1 = getVideoDimension.Table.extend({
3512
3512
  addOptions: function addOptions() {
3513
3513
  return {
3514
3514
  HTMLAttributes: {},
@@ -3644,7 +3644,7 @@ var Table$1 = fuzzySearch.Table.extend({
3644
3644
  });
3645
3645
  var Table = Table$1.configure({});
3646
3646
 
3647
- var TodoListExtension = fuzzySearch.TaskList.extend({
3647
+ var TodoListExtension = getVideoDimension.TaskList.extend({
3648
3648
  name: "todoList",
3649
3649
  addKeyboardShortcuts: function addKeyboardShortcuts() {
3650
3650
  var _this = this;
@@ -3655,7 +3655,7 @@ var TodoListExtension = fuzzySearch.TaskList.extend({
3655
3655
  };
3656
3656
  }
3657
3657
  });
3658
- var TodoItemExtension = fuzzySearch.TaskItem.extend({
3658
+ var TodoItemExtension = getVideoDimension.TaskItem.extend({
3659
3659
  addKeyboardShortcuts: function addKeyboardShortcuts() {
3660
3660
  var _this2 = this;
3661
3661
  return {
@@ -3849,7 +3849,7 @@ var VideoComponent = function VideoComponent(_ref) {
3849
3849
  deleteNode: deleteNode,
3850
3850
  editor: editor,
3851
3851
  updateAttributes: updateAttributes
3852
- }), /*#__PURE__*/jsxRuntime.jsx(fuzzySearch.Resizable, {
3852
+ }), /*#__PURE__*/jsxRuntime.jsx(getVideoDimension.Resizable, {
3853
3853
  lockAspectRatio: true,
3854
3854
  className: "neeto-editor__image",
3855
3855
  size: {
@@ -3910,12 +3910,14 @@ var EmbedComponent = function EmbedComponent(_ref) {
3910
3910
  })));
3911
3911
  editor.commands.focus();
3912
3912
  };
3913
- return /*#__PURE__*/jsxRuntime.jsx(useEditorStore.NodeViewWrapper, {
3913
+ return /*#__PURE__*/jsxRuntime.jsxs(useEditorStore.NodeViewWrapper, {
3914
3914
  "data-testid": "neeto-editor-video-wrapper",
3915
3915
  className: classnames__default.default("neeto-editor__video-wrapper", "neeto-editor__video--".concat(align), {
3916
3916
  "neeto-editor__video--bordered": border
3917
3917
  }),
3918
- children: /*#__PURE__*/jsxRuntime.jsxs(fuzzySearch.Resizable, {
3918
+ children: [/*#__PURE__*/jsxRuntime.jsx(useEditorStore.NodeViewContent, {
3919
+ className: "neeto-editor__video-content"
3920
+ }), /*#__PURE__*/jsxRuntime.jsxs(getVideoDimension.Resizable, {
3919
3921
  lockAspectRatio: true,
3920
3922
  size: {
3921
3923
  height: height,
@@ -3940,7 +3942,7 @@ var EmbedComponent = function EmbedComponent(_ref) {
3940
3942
  allowFullScreen: true,
3941
3943
  "data-border": border
3942
3944
  }))]
3943
- })
3945
+ })]
3944
3946
  });
3945
3947
  };
3946
3948
 
@@ -4012,13 +4014,15 @@ var getEmbedAttributes = function getEmbedAttributes() {
4012
4014
  figheight: {
4013
4015
  "default": 281,
4014
4016
  parseHTML: function parseHTML(element) {
4015
- return element.getAttribute("figheight");
4017
+ var _element$querySelecto7;
4018
+ return getVideoDimension.getVideoDimension(((_element$querySelecto7 = element.querySelector("iframe")) !== null && _element$querySelecto7 !== void 0 ? _element$querySelecto7 : element).getAttribute("figheight"), 281);
4016
4019
  }
4017
4020
  },
4018
4021
  figwidth: {
4019
4022
  "default": 500,
4020
4023
  parseHTML: function parseHTML(element) {
4021
- return element.getAttribute("figwidth");
4024
+ var _element$querySelecto8;
4025
+ return getVideoDimension.getVideoDimension(((_element$querySelecto8 = element.querySelector("iframe")) !== null && _element$querySelecto8 !== void 0 ? _element$querySelecto8 : element).getAttribute("figwidth"), 500);
4022
4026
  }
4023
4027
  },
4024
4028
  aspectRatio: {
@@ -4057,6 +4061,8 @@ var renderEmbedHTML = function renderEmbedHTML(node, HTMLAttributes, options) {
4057
4061
  "neeto-editor__video--bordered": border
4058
4062
  })
4059
4063
  }, ["div", {
4064
+ "class": "neeto-editor__video-content"
4065
+ }, 0], ["div", {
4060
4066
  "class": classnames__default.default("neeto-editor__video-iframe", {
4061
4067
  "neeto-editor-aspect-1-1": aspectRatio === "1/1",
4062
4068
  "neeto-editor-aspect-16-9": aspectRatio === "16/9",
@@ -4064,7 +4070,7 @@ var renderEmbedHTML = function renderEmbedHTML(node, HTMLAttributes, options) {
4064
4070
  "neeto-editor-aspect-4-3": aspectRatio === "4/3",
4065
4071
  "neeto-editor-aspect-3-2": aspectRatio === "3/2"
4066
4072
  }),
4067
- style: "width: ".concat(figwidth, "px; height: ").concat(figheight, "px;"),
4073
+ style: "width: ".concat(getVideoDimension.getVideoDimension(figwidth, 500), "px; height: ").concat(getVideoDimension.getVideoDimension(figheight, 281), "px;"),
4068
4074
  "data-aspect-ratio": aspectRatio
4069
4075
  }, ["iframe", useEditorStore.mergeAttributes(options.HTMLAttributes, _objectSpread$3(_objectSpread$3({}, HTMLAttributes), {}, {
4070
4076
  allowfullscreen: true,
@@ -4158,6 +4164,9 @@ var UnifiedVideoExtension = useEditorStore.Node.create({
4158
4164
  tag: "div.neeto-editor__video-wrapper",
4159
4165
  getAttrs: function getAttrs(element) {
4160
4166
  return element.querySelector("iframe[src]") ? null : false;
4167
+ },
4168
+ contentElement: function contentElement(element) {
4169
+ return element.querySelector(".neeto-editor__video-content") || element;
4161
4170
  }
4162
4171
  }];
4163
4172
  },
@@ -4208,13 +4217,26 @@ var UnifiedVideoExtension = useEditorStore.Node.create({
4208
4217
  },
4209
4218
  setExternalVideo: function setExternalVideo(options) {
4210
4219
  return function (_ref7) {
4211
- var commands = _ref7.commands;
4212
- return commands.insertContent({
4220
+ var chain = _ref7.chain;
4221
+ return chain().insertContent({
4213
4222
  type: _this.name,
4214
4223
  attrs: _objectSpread$3(_objectSpread$3({}, options), {}, {
4215
4224
  videoType: "embed"
4216
4225
  })
4217
- });
4226
+ }).command(function (_ref8) {
4227
+ var _tr$doc$nodeAt;
4228
+ var tr = _ref8.tr,
4229
+ commands = _ref8.commands;
4230
+ var $to = tr.selection.$to;
4231
+ if ($to.parent.type.name !== _this.name) return true;
4232
+ var position = $to.after();
4233
+ if (((_tr$doc$nodeAt = tr.doc.nodeAt(position)) === null || _tr$doc$nodeAt === void 0 ? void 0 : _tr$doc$nodeAt.type.name) !== "paragraph") {
4234
+ commands.insertContentAt(position, {
4235
+ type: "paragraph"
4236
+ });
4237
+ }
4238
+ return commands.setTextSelection(position + 1);
4239
+ }).run();
4218
4240
  };
4219
4241
  }
4220
4242
  };
@@ -4250,11 +4272,11 @@ var useCustomExtensions = function useCustomExtensions(_ref) {
4250
4272
  var customExtensions = [EditorContainer.configure({
4251
4273
  containerRef: containerRef,
4252
4274
  appendSuggestionsToBody: appendSuggestionsToBody
4253
- }), fuzzySearch.CharacterCount, fuzzySearch.src_default$5, CodeBlock.configure({
4275
+ }), getVideoDimension.CharacterCount, getVideoDimension.src_default$5, CodeBlock.configure({
4254
4276
  enableReactNodeViewOptimization: enableReactNodeViewOptimization
4255
- }), CustomCommands, fuzzySearch.src_default$4, FigCaption, HighlightInternal, SelectionDecoration, fuzzySearch.Focus.configure({
4277
+ }), CustomCommands, getVideoDimension.src_default$4, FigCaption, HighlightInternal, SelectionDecoration, getVideoDimension.Focus.configure({
4256
4278
  mode: "shallowest"
4257
- }), fuzzySearch.src_default$6, ImageExtension.configure({
4279
+ }), getVideoDimension.src_default$6, ImageExtension.configure({
4258
4280
  openImageInNewTab: openImageInNewTab,
4259
4281
  enableReactNodeViewOptimization: enableReactNodeViewOptimization
4260
4282
  }), Link.configure({
@@ -4264,7 +4286,7 @@ var useCustomExtensions = function useCustomExtensions(_ref) {
4264
4286
  }), Placeholder.configure({
4265
4287
  placeholder: placeholder,
4266
4288
  isSlashCommandsActive: isSlashCommandsActive
4267
- }), fuzzySearch.src_default$8.configure({
4289
+ }), getVideoDimension.src_default$8.configure({
4268
4290
  document: false,
4269
4291
  codeBlock: false,
4270
4292
  code: false,
@@ -4285,7 +4307,7 @@ var useCustomExtensions = function useCustomExtensions(_ref) {
4285
4307
  heading: {
4286
4308
  levels: v2_Menu.buildLevelsFromOptions(options)
4287
4309
  }
4288
- }), fuzzySearch.safeSplitBlock, fuzzySearch.safeListKeymap, fuzzySearch.TextStyle, fuzzySearch.src_default$7, Italic, KeyboardShortcuts.configure({
4310
+ }), getVideoDimension.safeSplitBlock, getVideoDimension.safeListKeymap, getVideoDimension.TextStyle, getVideoDimension.src_default$7, Italic, KeyboardShortcuts.configure({
4289
4311
  onSubmit: onSubmit,
4290
4312
  shortcuts: keyboardShortcuts,
4291
4313
  isBlockQuoteActive: options.includes(constants.EDITOR_OPTIONS.BLOCKQUOTE)
@@ -4301,10 +4323,10 @@ var useCustomExtensions = function useCustomExtensions(_ref) {
4301
4323
  if (options.includes(constants.EDITOR_OPTIONS.TABLE)) {
4302
4324
  customExtensions.push(Table.configure({
4303
4325
  resizable: true
4304
- }), fuzzySearch.TableRow, fuzzySearch.TableHeader, fuzzySearch.TableCell);
4326
+ }), getVideoDimension.TableRow, getVideoDimension.TableHeader, getVideoDimension.TableCell);
4305
4327
  }
4306
4328
  if (options.includes(constants.EDITOR_OPTIONS.TEXT_COLOR) || options.includes(constants.EDITOR_OPTIONS.HIGHLIGHT)) {
4307
- customExtensions.push(fuzzySearch.Color);
4329
+ customExtensions.push(getVideoDimension.Color);
4308
4330
  }
4309
4331
  if (options.includes(constants.EDITOR_OPTIONS.LIST_BULLETS)) {
4310
4332
  customExtensions.push(BulletList);
@@ -4313,7 +4335,7 @@ var useCustomExtensions = function useCustomExtensions(_ref) {
4313
4335
  customExtensions.push(OrderedList);
4314
4336
  }
4315
4337
  if (options.includes(constants.EDITOR_OPTIONS.LIST_BULLETS) || options.includes(constants.EDITOR_OPTIONS.LIST_ORDERED)) {
4316
- customExtensions.push(fuzzySearch.ListItem);
4338
+ customExtensions.push(getVideoDimension.ListItem);
4317
4339
  }
4318
4340
  if (options.includes(constants.EDITOR_OPTIONS.CALLOUT)) {
4319
4341
  customExtensions.push(Callout);
@@ -4350,10 +4372,10 @@ var useCustomExtensions = function useCustomExtensions(_ref) {
4350
4372
  }
4351
4373
  if (collaborationProvider) {
4352
4374
  var _collaborationProvide;
4353
- customExtensions.push(fuzzySearch.src_default$9.configure({
4375
+ customExtensions.push(getVideoDimension.src_default$9.configure({
4354
4376
  document: (_collaborationProvide = collaborationProvider.document) !== null && _collaborationProvide !== void 0 ? _collaborationProvide : collaborationProvider.doc
4355
4377
  }));
4356
- customExtensions.push(fuzzySearch.src_default$10.configure({
4378
+ customExtensions.push(getVideoDimension.src_default$10.configure({
4357
4379
  provider: collaborationProvider
4358
4380
  }));
4359
4381
  }
@@ -4527,7 +4549,7 @@ var ArticlePicker = function ArticlePicker(_ref) {
4527
4549
  setSearchTerm = _useState2[1];
4528
4550
  var modalRef = React.useRef(null);
4529
4551
  var articlesContainerRef = React.useRef(null);
4530
- var _useFetchKbArticles = fuzzySearch.useFetchKbArticles({
4552
+ var _useFetchKbArticles = getVideoDimension.useFetchKbArticles({
4531
4553
  searchTerm: searchTerm,
4532
4554
  reactQueryOptions: {
4533
4555
  enabled: !externalOptions
@@ -5025,7 +5047,7 @@ var LinkPopOver = function LinkPopOver(_ref) {
5025
5047
  var _useTranslation = reactI18next.useTranslation(),
5026
5048
  t = _useTranslation.t;
5027
5049
  var isNeetoKbArticle = (linkAttributes === null || linkAttributes === void 0 ? void 0 : linkAttributes["data-neeto-kb-article"]) === "true";
5028
- var _useFetchKbArticles = fuzzySearch.useFetchKbArticles({
5050
+ var _useFetchKbArticles = getVideoDimension.useFetchKbArticles({
5029
5051
  searchTerm: "",
5030
5052
  reactQueryOptions: {
5031
5053
  enabled: isEditing && isNeetoKbArticle
@@ -5546,7 +5568,7 @@ var Editor$1 = function Editor(_ref, ref) {
5546
5568
  containerRef: wrapperRef,
5547
5569
  appendSuggestionsToBody: appendSuggestionsToBody
5548
5570
  });
5549
- fuzzySearch.useEditorWarnings({
5571
+ getVideoDimension.useEditorWarnings({
5550
5572
  initialValue: initialValue
5551
5573
  });
5552
5574
  var editorClasses = classnames__default.default("neeto-editor", _defineProperty__default.default({
@@ -5605,7 +5627,7 @@ var Editor$1 = function Editor(_ref, ref) {
5605
5627
  };
5606
5628
  }
5607
5629
  });
5608
- var deletedArticlesHook = fuzzySearch.useDeletedArticles(isArticleOptActive ? editor : null);
5630
+ var deletedArticlesHook = getVideoDimension.useDeletedArticles(isArticleOptActive ? editor : null);
5609
5631
  React.useImperativeHandle(ref, function () {
5610
5632
  return {
5611
5633
  editor: editor,