@bigbinary/neeto-editor 1.47.126 → 1.47.130

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/v2/Editor.js CHANGED
@@ -16,7 +16,7 @@ import { is, intersection, difference, union, isEmpty, isNil, mergeRight, assoc,
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, v as validateUrl, b as buildLevelsFromOptions, g as getLinkPopoverPosition, L as LINK_VALIDATION_SCHEMA, c as validateAndFormatUrl, D as DEFAULT_EDITOR_OPTIONS, d as getEditorStyles, M as Menu$3, e as MenuDynamicVariables, f as MediaUploader, h as LinkAddPopOver, j as transformPastedHTML, k as clipboardTextParser, s as setInitialPosition } from '../chunk-COgPAsPy.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 clipboardTextParser, s as setInitialPosition } from '../chunk-BSdgi_3H.js';
20
20
  import Megaphone from '@bigbinary/neeto-icons/misc/Megaphone';
21
21
  import { m as PluginKey, P as Plugin, T as TextSelection } from '../chunk-C5svTfyQ.js';
22
22
  import { ChevronDown, Highlighter, X, Ratio, Ellipsis, AlignLeft, AlignCenter, AlignRight, RectangleHorizontal, RectangleVertical, Square, SquareDashed, Trash2, BookOpen, Pencil } from 'lucide-react';
@@ -758,16 +758,19 @@ var EditorContainer = Extension.create({
758
758
  name: "editorContainer",
759
759
  addOptions: function addOptions() {
760
760
  return {
761
- containerRef: null
761
+ containerRef: null,
762
+ appendSuggestionsToBody: false
762
763
  };
763
764
  },
764
765
  addStorage: function addStorage() {
765
766
  return {
766
- containerRef: null
767
+ containerRef: null,
768
+ appendSuggestionsToBody: false
767
769
  };
768
770
  },
769
771
  onBeforeCreate: function onBeforeCreate() {
770
772
  this.storage.containerRef = this.options.containerRef;
773
+ this.storage.appendSuggestionsToBody = this.options.appendSuggestionsToBody;
771
774
  }
772
775
  });
773
776
 
@@ -801,10 +804,7 @@ var EmojiPicker = Node3.create({
801
804
  popup = tippy("body", {
802
805
  theme: "light",
803
806
  getReferenceClientRect: props.clientRect,
804
- appendTo: function appendTo() {
805
- var _props$editor$storage, _props$editor;
806
- return (_props$editor$storage = (_props$editor = props.editor) === null || _props$editor === void 0 || (_props$editor = _props$editor.storage) === null || _props$editor === void 0 || (_props$editor = _props$editor.editorContainer) === null || _props$editor === void 0 || (_props$editor = _props$editor.containerRef) === null || _props$editor === void 0 ? void 0 : _props$editor.current) !== null && _props$editor$storage !== void 0 ? _props$editor$storage : document.body;
807
- },
807
+ appendTo: getSuggestionAppendTo(props.editor),
808
808
  content: reactRenderer.element,
809
809
  showOnCreate: true,
810
810
  interactive: true,
@@ -1167,10 +1167,7 @@ var suggestionConfig = {
1167
1167
  popup = tippy("body", {
1168
1168
  theme: "light",
1169
1169
  getReferenceClientRect: props.clientRect,
1170
- appendTo: function appendTo() {
1171
- var _props$editor$storage, _props$editor;
1172
- return (_props$editor$storage = (_props$editor = props.editor) === null || _props$editor === void 0 || (_props$editor = _props$editor.storage) === null || _props$editor === void 0 || (_props$editor = _props$editor.editorContainer) === null || _props$editor === void 0 || (_props$editor = _props$editor.containerRef) === null || _props$editor === void 0 ? void 0 : _props$editor.current) !== null && _props$editor$storage !== void 0 ? _props$editor$storage : document.body;
1173
- },
1170
+ appendTo: getSuggestionAppendTo(props.editor),
1174
1171
  content: reactRenderer.element,
1175
1172
  showOnCreate: true,
1176
1173
  interactive: true,
@@ -2150,10 +2147,7 @@ var suggestion$1 = {
2150
2147
  popup = tippy("body", {
2151
2148
  theme: "light neeto-editor-mentions-tooltip",
2152
2149
  getReferenceClientRect: props.clientRect,
2153
- appendTo: function appendTo() {
2154
- var _props$editor$storage, _props$editor;
2155
- return (_props$editor$storage = (_props$editor = props.editor) === null || _props$editor === void 0 || (_props$editor = _props$editor.storage) === null || _props$editor === void 0 || (_props$editor = _props$editor.editorContainer) === null || _props$editor === void 0 || (_props$editor = _props$editor.containerRef) === null || _props$editor === void 0 ? void 0 : _props$editor.current) !== null && _props$editor$storage !== void 0 ? _props$editor$storage : document.body;
2156
- },
2150
+ appendTo: getSuggestionAppendTo(props.editor),
2157
2151
  content: reactRenderer.element,
2158
2152
  showOnCreate: true,
2159
2153
  interactive: true,
@@ -3004,10 +2998,7 @@ var SlashCommands = {
3004
2998
  });
3005
2999
  popup = tippy("body", {
3006
3000
  getReferenceClientRect: props.clientRect,
3007
- appendTo: function appendTo() {
3008
- var _props$editor$storage, _props$editor;
3009
- return (_props$editor$storage = (_props$editor = props.editor) === null || _props$editor === void 0 || (_props$editor = _props$editor.storage) === null || _props$editor === void 0 || (_props$editor = _props$editor.editorContainer) === null || _props$editor === void 0 || (_props$editor = _props$editor.containerRef) === null || _props$editor === void 0 ? void 0 : _props$editor.current) !== null && _props$editor$storage !== void 0 ? _props$editor$storage : document.body;
3010
- },
3001
+ appendTo: getSuggestionAppendTo(props.editor),
3011
3002
  content: reactRenderer.element,
3012
3003
  showOnCreate: true,
3013
3004
  interactive: true,
@@ -3082,10 +3073,7 @@ var suggestion = {
3082
3073
  popup = tippy("body", {
3083
3074
  theme: "light neeto-editor-mentions-tooltip",
3084
3075
  getReferenceClientRect: props.clientRect,
3085
- appendTo: function appendTo() {
3086
- var _props$editor$storage, _props$editor;
3087
- return (_props$editor$storage = (_props$editor = props.editor) === null || _props$editor === void 0 || (_props$editor = _props$editor.storage) === null || _props$editor === void 0 || (_props$editor = _props$editor.editorContainer) === null || _props$editor === void 0 || (_props$editor = _props$editor.containerRef) === null || _props$editor === void 0 ? void 0 : _props$editor.current) !== null && _props$editor$storage !== void 0 ? _props$editor$storage : document.body;
3088
- },
3076
+ appendTo: getSuggestionAppendTo(props.editor),
3089
3077
  content: reactRenderer.element,
3090
3078
  showOnCreate: true,
3091
3079
  interactive: true,
@@ -3769,6 +3757,13 @@ var getEmbedAttributes = function getEmbedAttributes() {
3769
3757
  title: {
3770
3758
  "default": null
3771
3759
  },
3760
+ originalUrl: {
3761
+ "default": "",
3762
+ parseHTML: function parseHTML(element) {
3763
+ var iframe = element.querySelector(".neeto-editor__video-iframe");
3764
+ return (iframe === null || iframe === void 0 ? void 0 : iframe.getAttribute("data-original-url")) || "";
3765
+ }
3766
+ },
3772
3767
  frameBorder: "0",
3773
3768
  allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen",
3774
3769
  allowfullscreen: true
@@ -3780,7 +3775,8 @@ var renderEmbedHTML = function renderEmbedHTML(node, HTMLAttributes, options) {
3780
3775
  figheight = _node$attrs.figheight,
3781
3776
  figwidth = _node$attrs.figwidth,
3782
3777
  border = _node$attrs.border,
3783
- aspectRatio = _node$attrs.aspectRatio;
3778
+ aspectRatio = _node$attrs.aspectRatio,
3779
+ originalUrl = _node$attrs.originalUrl;
3784
3780
  return ["div", {
3785
3781
  "class": classnames("neeto-editor__video-wrapper", "neeto-editor__video--".concat(align), {
3786
3782
  "neeto-editor__video--bordered": border
@@ -3797,7 +3793,8 @@ var renderEmbedHTML = function renderEmbedHTML(node, HTMLAttributes, options) {
3797
3793
  "data-aspect-ratio": aspectRatio
3798
3794
  }, ["iframe", mergeAttributes(options.HTMLAttributes, _objectSpread$4(_objectSpread$4({}, HTMLAttributes), {}, {
3799
3795
  allowfullscreen: true,
3800
- "data-border": border
3796
+ "data-border": border,
3797
+ "data-original-url": originalUrl
3801
3798
  }))]]];
3802
3799
  };
3803
3800
  var renderUploadHTML = function renderUploadHTML(node, HTMLAttributes, options) {
@@ -3840,7 +3837,8 @@ var handleVideoPaste = function handleVideoPaste(_ref) {
3840
3837
  if (validatedUrl) {
3841
3838
  var node = state.schema.nodes["unified-video"].create({
3842
3839
  src: validatedUrl,
3843
- videoType: "embed"
3840
+ videoType: "embed",
3841
+ originalUrl: match[0]
3844
3842
  });
3845
3843
  state.tr.insert(range.from, node);
3846
3844
  state.tr.insert(range.from + node.nodeSize + 1, state.schema.nodes.paragraph.create());
@@ -3963,9 +3961,11 @@ var useCustomExtensions = function useCustomExtensions(_ref) {
3963
3961
  enableReactNodeViewOptimization = _ref.enableReactNodeViewOptimization,
3964
3962
  collaborationProvider = _ref.collaborationProvider,
3965
3963
  setIsNeetoKbArticleActive = _ref.setIsNeetoKbArticleActive,
3966
- containerRef = _ref.containerRef;
3964
+ containerRef = _ref.containerRef,
3965
+ appendSuggestionsToBody = _ref.appendSuggestionsToBody;
3967
3966
  var customExtensions = [EditorContainer.configure({
3968
- containerRef: containerRef
3967
+ containerRef: containerRef,
3968
+ appendSuggestionsToBody: appendSuggestionsToBody
3969
3969
  }), CharacterCount, index_default$5, CodeBlock.configure({
3970
3970
  enableReactNodeViewOptimization: enableReactNodeViewOptimization
3971
3971
  }), CustomCommands, index_default$4, FigCaption, HighlightInternal, SelectionDecoration, Focus.configure({
@@ -5172,7 +5172,7 @@ var LinkPopOver = function LinkPopOver(_ref) {
5172
5172
  });
5173
5173
  };
5174
5174
 
5175
- var _excluded = ["addonCommands", "addons", "attachments", "attachmentsConfig", "autoFocus", "className", "contentClassName", "contentWrapperClassName", "errorWrapperClassName", "contentAttributes", "menuClassName", "attachmentsClassName", "isMenuIndependent", "defaults", "editorSecrets", "error", "extensions", "hideSlashCommands", "initialValue", "isCharacterCountActive", "keyboardShortcuts", "label", "mentions", "menuType", "placeholder", "required", "rows", "tooltips", "variables", "disableTrimOnBlur", "onChange", "onFocus", "onBlur", "onSubmit", "onChangeAttachments", "children", "openImageInNewTab", "openLinkInNewTab", "showAssetLibrary", "collaborationProvider", "enableReactNodeViewOptimization", "size", "otherAttachmentProps"];
5175
+ var _excluded = ["addonCommands", "addons", "attachments", "attachmentsConfig", "autoFocus", "className", "contentClassName", "contentWrapperClassName", "errorWrapperClassName", "contentAttributes", "menuClassName", "attachmentsClassName", "isMenuIndependent", "defaults", "editorSecrets", "error", "extensions", "hideSlashCommands", "appendSuggestionsToBody", "initialValue", "isCharacterCountActive", "keyboardShortcuts", "label", "mentions", "menuType", "placeholder", "required", "rows", "tooltips", "variables", "disableTrimOnBlur", "onChange", "onFocus", "onBlur", "onSubmit", "onChangeAttachments", "children", "openImageInNewTab", "openLinkInNewTab", "showAssetLibrary", "collaborationProvider", "enableReactNodeViewOptimization", "size", "otherAttachmentProps"];
5176
5176
  function ownKeys(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; }
5177
5177
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5178
5178
  var Editor = function Editor(_ref, ref) {
@@ -5207,6 +5207,8 @@ var Editor = function Editor(_ref, ref) {
5207
5207
  extensions = _ref$extensions === void 0 ? [] : _ref$extensions,
5208
5208
  _ref$hideSlashCommand = _ref.hideSlashCommands,
5209
5209
  hideSlashCommands = _ref$hideSlashCommand === void 0 ? true : _ref$hideSlashCommand,
5210
+ _ref$appendSuggestion = _ref.appendSuggestionsToBody,
5211
+ appendSuggestionsToBody = _ref$appendSuggestion === void 0 ? false : _ref$appendSuggestion,
5210
5212
  _ref$initialValue = _ref.initialValue,
5211
5213
  initialValue = _ref$initialValue === void 0 ? "" : _ref$initialValue,
5212
5214
  _ref$isCharacterCount = _ref.isCharacterCountActive,
@@ -5327,7 +5329,8 @@ var Editor = function Editor(_ref, ref) {
5327
5329
  enableReactNodeViewOptimization: enableReactNodeViewOptimization,
5328
5330
  collaborationProvider: collaborationProvider,
5329
5331
  setIsNeetoKbArticleActive: setNeetoKbArticleState,
5330
- containerRef: wrapperRef
5332
+ containerRef: wrapperRef,
5333
+ appendSuggestionsToBody: appendSuggestionsToBody
5331
5334
  });
5332
5335
  useEditorWarnings({
5333
5336
  initialValue: initialValue