@bigbinary/neeto-editor-frontend 2.0.4 → 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.
Files changed (101) hide show
  1. package/README.md +2 -0
  2. package/dist/.ready +1 -1
  3. package/dist/Attachments.js +3 -3
  4. package/dist/Editor.js +42 -28
  5. package/dist/Editor.js.map +1 -1
  6. package/dist/EditorContent.js +3 -3
  7. package/dist/FormikEditor.js +7 -7
  8. package/dist/Menu.js +5 -5
  9. package/dist/{chunk-BXYtUHQm.js → chunk-2yDx3K8L.js} +5 -5
  10. package/dist/{chunk-BXYtUHQm.js.map → chunk-2yDx3K8L.js.map} +1 -1
  11. package/dist/{chunk-CiVaat1H.js → chunk-9vP3rEtI.js} +3 -3
  12. package/dist/{chunk-CiVaat1H.js.map → chunk-9vP3rEtI.js.map} +1 -1
  13. package/dist/{chunk-BrtRq7Gb.js → chunk-C4efob7L.js} +3 -3
  14. package/dist/{chunk-BrtRq7Gb.js.map → chunk-C4efob7L.js.map} +1 -1
  15. package/dist/{chunk-BNY-ueoj.js → chunk-C6Wn4nia.js} +2 -2
  16. package/dist/{chunk-BNY-ueoj.js.map → chunk-C6Wn4nia.js.map} +1 -1
  17. package/dist/{chunk-CfQriKjH.js → chunk-C893rdfW.js} +3 -3
  18. package/dist/{chunk-CfQriKjH.js.map → chunk-C893rdfW.js.map} +1 -1
  19. package/dist/{chunk-DByRVJk9.js → chunk-CA9DTddx.js} +2 -2
  20. package/dist/{chunk-DByRVJk9.js.map → chunk-CA9DTddx.js.map} +1 -1
  21. package/dist/{chunk-SHwPiLy9.js → chunk-CJfLgMJF.js} +4 -4
  22. package/dist/{chunk-SHwPiLy9.js.map → chunk-CJfLgMJF.js.map} +1 -1
  23. package/dist/{chunk-DSKEeXyj.js → chunk-CNIDH-FD.js} +2 -2
  24. package/dist/{chunk-DSKEeXyj.js.map → chunk-CNIDH-FD.js.map} +1 -1
  25. package/dist/{chunk-Bg0xYw5S.js → chunk-C_P2M3zF.js} +3 -3
  26. package/dist/{chunk-Bg0xYw5S.js.map → chunk-C_P2M3zF.js.map} +1 -1
  27. package/dist/{chunk-Ba4Q3HC8.js → chunk-CxFukRwo.js} +56 -11
  28. package/dist/chunk-CxFukRwo.js.map +1 -0
  29. package/dist/{chunk-DIORcYan.js → chunk-Dm4Qt79M.js} +4 -4
  30. package/dist/{chunk-DIORcYan.js.map → chunk-Dm4Qt79M.js.map} +1 -1
  31. package/dist/{chunk-CyfiHLWx.js → chunk-UwzgbfZD.js} +12 -2
  32. package/dist/{chunk-CyfiHLWx.js.map → chunk-UwzgbfZD.js.map} +1 -1
  33. package/dist/{chunk-BzEP-HS9.js → chunk-jiUuXPs1.js} +4 -4
  34. package/dist/{chunk-BzEP-HS9.js.map → chunk-jiUuXPs1.js.map} +1 -1
  35. package/dist/cjs/Attachments.cjs.js +3 -3
  36. package/dist/cjs/Editor.cjs.js +89 -75
  37. package/dist/cjs/Editor.cjs.js.map +1 -1
  38. package/dist/cjs/EditorContent.cjs.js +3 -3
  39. package/dist/cjs/FormikEditor.cjs.js +7 -7
  40. package/dist/cjs/Menu.cjs.js +5 -5
  41. package/dist/cjs/{chunk-CtTb6u9F.cjs.js → chunk-B1X-JIj8.cjs.js} +2 -2
  42. package/dist/cjs/{chunk-CtTb6u9F.cjs.js.map → chunk-B1X-JIj8.cjs.js.map} +1 -1
  43. package/dist/cjs/{chunk-DxXc6tiG.cjs.js → chunk-B7RhUrgV.cjs.js} +57 -10
  44. package/dist/cjs/chunk-B7RhUrgV.cjs.js.map +1 -0
  45. package/dist/cjs/{chunk-DqjTYIpN.cjs.js → chunk-BETPWBif.cjs.js} +3 -3
  46. package/dist/cjs/{chunk-DqjTYIpN.cjs.js.map → chunk-BETPWBif.cjs.js.map} +1 -1
  47. package/dist/cjs/{chunk-CcJ_Jcsm.cjs.js → chunk-BL4O70ER.cjs.js} +4 -4
  48. package/dist/cjs/{chunk-CcJ_Jcsm.cjs.js.map → chunk-BL4O70ER.cjs.js.map} +1 -1
  49. package/dist/cjs/{chunk-BfUeWeV6.cjs.js → chunk-Bm1Dzh4r.cjs.js} +2 -2
  50. package/dist/cjs/{chunk-BfUeWeV6.cjs.js.map → chunk-Bm1Dzh4r.cjs.js.map} +1 -1
  51. package/dist/cjs/{chunk-BNUTjVYA.cjs.js → chunk-BxKa_XOs.cjs.js} +12 -1
  52. package/dist/cjs/{chunk-BNUTjVYA.cjs.js.map → chunk-BxKa_XOs.cjs.js.map} +1 -1
  53. package/dist/cjs/{chunk-D1iu346F.cjs.js → chunk-CQ-j2kAX.cjs.js} +2 -2
  54. package/dist/cjs/{chunk-D1iu346F.cjs.js.map → chunk-CQ-j2kAX.cjs.js.map} +1 -1
  55. package/dist/cjs/{chunk-Bv4wbN1E.cjs.js → chunk-DBQBe3dq.cjs.js} +3 -3
  56. package/dist/cjs/{chunk-Bv4wbN1E.cjs.js.map → chunk-DBQBe3dq.cjs.js.map} +1 -1
  57. package/dist/cjs/{chunk-C98N-sIR.cjs.js → chunk-DRTgn9TG.cjs.js} +5 -5
  58. package/dist/cjs/{chunk-C98N-sIR.cjs.js.map → chunk-DRTgn9TG.cjs.js.map} +1 -1
  59. package/dist/cjs/{chunk-MFytiUwB.cjs.js → chunk-TCCIxl2A.cjs.js} +3 -3
  60. package/dist/cjs/{chunk-MFytiUwB.cjs.js.map → chunk-TCCIxl2A.cjs.js.map} +1 -1
  61. package/dist/cjs/{chunk-BuuzKD6e.cjs.js → chunk-Ty2BpOZ5.cjs.js} +3 -3
  62. package/dist/cjs/{chunk-BuuzKD6e.cjs.js.map → chunk-Ty2BpOZ5.cjs.js.map} +1 -1
  63. package/dist/cjs/{chunk-DIpaV2xG.cjs.js → chunk-UyXI9oIp.cjs.js} +4 -4
  64. package/dist/cjs/{chunk-DIpaV2xG.cjs.js.map → chunk-UyXI9oIp.cjs.js.map} +1 -1
  65. package/dist/cjs/{chunk-CUiAHc9-.cjs.js → chunk-WeNbd2ic.cjs.js} +4 -4
  66. package/dist/cjs/{chunk-CUiAHc9-.cjs.js.map → chunk-WeNbd2ic.cjs.js.map} +1 -1
  67. package/dist/cjs/constants.cjs.js +2 -2
  68. package/dist/cjs/index.cjs.js +8 -8
  69. package/dist/cjs/utils.cjs.js +3 -3
  70. package/dist/cjs/v2/Attachments.cjs.js +3 -3
  71. package/dist/cjs/v2/Editor.cjs.js +72 -58
  72. package/dist/cjs/v2/Editor.cjs.js.map +1 -1
  73. package/dist/cjs/v2/EditorContent.cjs.js +3 -3
  74. package/dist/cjs/v2/FormikEditor.cjs.js +6 -6
  75. package/dist/cjs/v2/Menu.cjs.js +3 -3
  76. package/dist/cjs/v2/constants.cjs.js +2 -2
  77. package/dist/cjs/v2/index.cjs.js +7 -7
  78. package/dist/cjs/v2/utils.cjs.js +3 -3
  79. package/dist/constants.js +2 -2
  80. package/dist/editor-content.min.css +1 -1
  81. package/dist/editor-output-pdf-email.css +1 -1
  82. package/dist/editor-output.js +1 -1
  83. package/dist/editor-stats.html +1 -19
  84. package/dist/index.js +8 -8
  85. package/dist/utils.js +3 -3
  86. package/dist/v2/Attachments.js +3 -3
  87. package/dist/v2/Editor.js +40 -26
  88. package/dist/v2/Editor.js.map +1 -1
  89. package/dist/v2/EditorContent.js +3 -3
  90. package/dist/v2/FormikEditor.js +6 -6
  91. package/dist/v2/Menu.js +3 -3
  92. package/dist/v2/constants.js +2 -2
  93. package/dist/v2/editor-content-styles.js +1 -1
  94. package/dist/v2/editor-content.min.css +1 -1
  95. package/dist/v2/index.js +7 -7
  96. package/dist/v2/styles.css +1 -1
  97. package/dist/v2/styles.js +1 -1
  98. package/dist/v2/utils.js +3 -3
  99. package/package.json +8 -7
  100. package/dist/chunk-Ba4Q3HC8.js.map +0 -1
  101. package/dist/cjs/chunk-DxXc6tiG.cjs.js.map +0 -1
package/dist/v2/Editor.js CHANGED
@@ -9,14 +9,14 @@ import classnames from 'classnames';
9
9
  import { isNotPresent, findBy, isNotEmpty, isPresent, noop, slugify } from '@bigbinary/neeto-cist';
10
10
  import { useOnClickOutside, withT, useFuncDebounce } from '@bigbinary/neeto-commons-frontend/v2/react-utils';
11
11
  import { createPortal } from 'react-dom';
12
- import { B as BulletList$1, s as src_default, a as src_default$1, R as Resizable, b as src_default$2, L as Link$1, c as scrollHandler, d as src_default$3, O as OrderedList$1, e as src_default$4, f as fuzzySearch, T as Table$2, g as TaskList, h as TaskItem, C as CharacterCount, i as src_default$5, j as src_default$6, k as safeSplitBlock, l as TextStyle, m as src_default$7, F as Focus, n as src_default$8, o as TableRow, p as TableHeader, q as TableCell, r as Color, t as ListItem, u as src_default$9, v as src_default$a, w as useFetchKbArticles, H as useEditorWarnings, I as useDeletedArticles } from '../chunk-Ba4Q3HC8.js';
13
- import { D as DIRECT_UPLOAD_ENDPOINT, E as EDITOR_OPTIONS, C as COMBINED_REGEX, a as EDITOR_SIZES } from '../chunk-CyfiHLWx.js';
14
- import '../chunk-DSKEeXyj.js';
12
+ import { B as BulletList$1, s as src_default, a as src_default$1, R as Resizable, b as src_default$2, L as Link$1, c as scrollHandler, d as src_default$3, O as OrderedList$1, e as src_default$4, f as fuzzySearch, T as Table$2, g as TaskList, h as TaskItem, i as getVideoDimension, C as CharacterCount, j as src_default$5, k as src_default$6, l as safeSplitBlock, m as safeListKeymap, n as TextStyle, o as src_default$7, F as Focus, p as src_default$8, q as TableRow, r as TableHeader, t as TableCell, u as Color, v as ListItem, w as src_default$9, x as src_default$a, y as useFetchKbArticles, J as useEditorWarnings, K as useDeletedArticles } from '../chunk-CxFukRwo.js';
13
+ import { D as DIRECT_UPLOAD_ENDPOINT, E as EDITOR_OPTIONS, C as COMBINED_REGEX, a as EDITOR_SIZES } from '../chunk-UwzgbfZD.js';
14
+ import '../chunk-CNIDH-FD.js';
15
15
  import { is, intersection, difference, union, isEmpty, isNil, mergeRight, assoc, equals } from 'ramda';
16
16
  import ReactDOM from 'react-dom/server';
17
17
  import { l as lowlight, d as decodeHtmlEntities, r as removeEmptyTags } from '../chunk-Qg4uQqj3.js';
18
18
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
19
- import { C as CALLOUT_TYPES, E as EmojiPickerMenu, g as getSuggestionAppendTo, v as validateUrl, b as buildLevelsFromOptions, c as getLinkPopoverPosition, L as LINK_VALIDATION_SCHEMA, d as validateAndFormatUrl, D as DEFAULT_EDITOR_OPTIONS, e as getEditorStyles, M as Menu$3, f as MenuDynamicVariables, h as MediaUploader, j as LinkAddPopOver, k as transformPastedHTML, l as handlePaste, m as clipboardTextParser, s as setInitialPosition } from '../chunk-CfQriKjH.js';
19
+ import { C as CALLOUT_TYPES, E as EmojiPickerMenu, g as getSuggestionAppendTo, v as validateUrl, b as buildLevelsFromOptions, c as getLinkPopoverPosition, L as LINK_VALIDATION_SCHEMA, d as validateAndFormatUrl, D as DEFAULT_EDITOR_OPTIONS, e as getEditorStyles, M as Menu$3, f as MenuDynamicVariables, h as MediaUploader, j as LinkAddPopOver, k as transformPastedHTML, l as handlePaste, m as clipboardTextParser, s as setInitialPosition } from '../chunk-C893rdfW.js';
20
20
  import Megaphone from '@bigbinary/neeto-icons/misc/Megaphone';
21
21
  import { m as PluginKey, P as Plugin, a as Selection, S as Slice, F as Fragment$1, T as TextSelection } from '../chunk-DgZGzqPs.js';
22
22
  import { ChevronDown, Highlighter, X, Ratio, Ellipsis, AlignLeft, AlignCenter, AlignRight, RectangleHorizontal, RectangleVertical, Square, SquareDashed, Trash2, Minus as Minus$1, Plus, BookOpen, Pencil } from 'lucide-react';
@@ -59,11 +59,11 @@ import Link$2 from '@bigbinary/neeto-icons/Link';
59
59
  import Attachment from '@bigbinary/neeto-icons/Attachment';
60
60
  import MessageSquare from '@bigbinary/neeto-icons/MessageSquare';
61
61
  import File from '@bigbinary/neeto-icons/File';
62
- import { h as DEFAULT_ASPECT_RATIO } from '../chunk-DByRVJk9.js';
62
+ import { h as DEFAULT_ASPECT_RATIO } from '../chunk-CA9DTddx.js';
63
63
  import _typeof from '@babel/runtime/helpers/typeof';
64
64
  import Search from '@bigbinary/neeto-molecules/v2/Search';
65
65
  import { Form, Input as Input$1 } from '@bigbinary/neeto-atoms/formik';
66
- import { A as Attachments } from '../chunk-BrtRq7Gb.js';
66
+ import { A as Attachments } from '../chunk-C4efob7L.js';
67
67
  import 'axios';
68
68
  import '@bigbinary/neeto-commons-frontend/react-utils';
69
69
  import 'zustand';
@@ -3861,12 +3861,14 @@ var EmbedComponent = function EmbedComponent(_ref) {
3861
3861
  })));
3862
3862
  editor.commands.focus();
3863
3863
  };
3864
- return /*#__PURE__*/jsx(NodeViewWrapper, {
3864
+ return /*#__PURE__*/jsxs(NodeViewWrapper, {
3865
3865
  "data-testid": "neeto-editor-video-wrapper",
3866
3866
  className: classnames("neeto-editor__video-wrapper", "neeto-editor__video--".concat(align), {
3867
3867
  "neeto-editor__video--bordered": border
3868
3868
  }),
3869
- children: /*#__PURE__*/jsxs(Resizable, {
3869
+ children: [/*#__PURE__*/jsx(NodeViewContent, {
3870
+ className: "neeto-editor__video-content"
3871
+ }), /*#__PURE__*/jsxs(Resizable, {
3870
3872
  lockAspectRatio: true,
3871
3873
  size: {
3872
3874
  height: height,
@@ -3891,7 +3893,7 @@ var EmbedComponent = function EmbedComponent(_ref) {
3891
3893
  allowFullScreen: true,
3892
3894
  "data-border": border
3893
3895
  }))]
3894
- })
3896
+ })]
3895
3897
  });
3896
3898
  };
3897
3899
 
@@ -3963,13 +3965,15 @@ var getEmbedAttributes = function getEmbedAttributes() {
3963
3965
  figheight: {
3964
3966
  "default": 281,
3965
3967
  parseHTML: function parseHTML(element) {
3966
- return element.getAttribute("figheight");
3968
+ var _element$querySelecto7;
3969
+ return getVideoDimension(((_element$querySelecto7 = element.querySelector("iframe")) !== null && _element$querySelecto7 !== void 0 ? _element$querySelecto7 : element).getAttribute("figheight"), 281);
3967
3970
  }
3968
3971
  },
3969
3972
  figwidth: {
3970
3973
  "default": 500,
3971
3974
  parseHTML: function parseHTML(element) {
3972
- return element.getAttribute("figwidth");
3975
+ var _element$querySelecto8;
3976
+ return getVideoDimension(((_element$querySelecto8 = element.querySelector("iframe")) !== null && _element$querySelecto8 !== void 0 ? _element$querySelecto8 : element).getAttribute("figwidth"), 500);
3973
3977
  }
3974
3978
  },
3975
3979
  aspectRatio: {
@@ -4008,6 +4012,8 @@ var renderEmbedHTML = function renderEmbedHTML(node, HTMLAttributes, options) {
4008
4012
  "neeto-editor__video--bordered": border
4009
4013
  })
4010
4014
  }, ["div", {
4015
+ "class": "neeto-editor__video-content"
4016
+ }, 0], ["div", {
4011
4017
  "class": classnames("neeto-editor__video-iframe", {
4012
4018
  "neeto-editor-aspect-1-1": aspectRatio === "1/1",
4013
4019
  "neeto-editor-aspect-16-9": aspectRatio === "16/9",
@@ -4015,7 +4021,7 @@ var renderEmbedHTML = function renderEmbedHTML(node, HTMLAttributes, options) {
4015
4021
  "neeto-editor-aspect-4-3": aspectRatio === "4/3",
4016
4022
  "neeto-editor-aspect-3-2": aspectRatio === "3/2"
4017
4023
  }),
4018
- style: "width: ".concat(figwidth, "px; height: ").concat(figheight, "px;"),
4024
+ style: "width: ".concat(getVideoDimension(figwidth, 500), "px; height: ").concat(getVideoDimension(figheight, 281), "px;"),
4019
4025
  "data-aspect-ratio": aspectRatio
4020
4026
  }, ["iframe", mergeAttributes(options.HTMLAttributes, _objectSpread$3(_objectSpread$3({}, HTMLAttributes), {}, {
4021
4027
  allowfullscreen: true,
@@ -4109,6 +4115,9 @@ var UnifiedVideoExtension = Node.create({
4109
4115
  tag: "div.neeto-editor__video-wrapper",
4110
4116
  getAttrs: function getAttrs(element) {
4111
4117
  return element.querySelector("iframe[src]") ? null : false;
4118
+ },
4119
+ contentElement: function contentElement(element) {
4120
+ return element.querySelector(".neeto-editor__video-content") || element;
4112
4121
  }
4113
4122
  }];
4114
4123
  },
@@ -4159,13 +4168,26 @@ var UnifiedVideoExtension = Node.create({
4159
4168
  },
4160
4169
  setExternalVideo: function setExternalVideo(options) {
4161
4170
  return function (_ref7) {
4162
- var commands = _ref7.commands;
4163
- return commands.insertContent({
4171
+ var chain = _ref7.chain;
4172
+ return chain().insertContent({
4164
4173
  type: _this.name,
4165
4174
  attrs: _objectSpread$3(_objectSpread$3({}, options), {}, {
4166
4175
  videoType: "embed"
4167
4176
  })
4168
- });
4177
+ }).command(function (_ref8) {
4178
+ var _tr$doc$nodeAt;
4179
+ var tr = _ref8.tr,
4180
+ commands = _ref8.commands;
4181
+ var $to = tr.selection.$to;
4182
+ if ($to.parent.type.name !== _this.name) return true;
4183
+ var position = $to.after();
4184
+ if (((_tr$doc$nodeAt = tr.doc.nodeAt(position)) === null || _tr$doc$nodeAt === void 0 ? void 0 : _tr$doc$nodeAt.type.name) !== "paragraph") {
4185
+ commands.insertContentAt(position, {
4186
+ type: "paragraph"
4187
+ });
4188
+ }
4189
+ return commands.setTextSelection(position + 1);
4190
+ }).run();
4169
4191
  };
4170
4192
  }
4171
4193
  };
@@ -4228,23 +4250,15 @@ var useCustomExtensions = function useCustomExtensions(_ref) {
4228
4250
  // v3 StarterKit bundles Link; we register a custom Link extension
4229
4251
  underline: false,
4230
4252
  // v3 StarterKit bundles Underline; we register it explicitly below
4231
- listKeymap: {
4232
- // TodoList renames Tiptap's taskList wrapper to todoList
4233
- listTypes: [{
4234
- itemName: "listItem",
4235
- wrapperNames: ["bulletList", "orderedList"]
4236
- }, {
4237
- itemName: "taskItem",
4238
- wrapperNames: ["todoList"]
4239
- }]
4240
- },
4253
+ listKeymap: false,
4254
+ // replaced by safeListKeymap, registered below
4241
4255
  trailingNode: false,
4242
4256
  // new in v3 StarterKit; disabled to keep v2 behavior
4243
4257
  undoRedo: !collaborationProvider,
4244
4258
  heading: {
4245
4259
  levels: buildLevelsFromOptions(options)
4246
4260
  }
4247
- }), safeSplitBlock, TextStyle, src_default$7, Italic, KeyboardShortcuts$1.configure({
4261
+ }), safeSplitBlock, safeListKeymap, TextStyle, src_default$7, Italic, KeyboardShortcuts$1.configure({
4248
4262
  onSubmit: onSubmit,
4249
4263
  shortcuts: keyboardShortcuts,
4250
4264
  isBlockQuoteActive: options.includes(EDITOR_OPTIONS.BLOCKQUOTE)