@mdxeditor/editor 4.1.0 → 4.2.0

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 (35) hide show
  1. package/dist/MDXEditor.js +1 -1
  2. package/dist/index.d.ts +17 -0
  3. package/dist/index.js +8 -7
  4. package/dist/plugins/codeblock/CodeBlockNode.js +1 -4
  5. package/dist/plugins/codeblock/index.js +1 -1
  6. package/dist/plugins/codemirror/CodeMirrorEditor.js +1 -1
  7. package/dist/plugins/core/GenericHTMLNode.js +2 -5
  8. package/dist/plugins/core/NestedLexicalEditor.js +2 -2
  9. package/dist/plugins/core/index.js +2 -2
  10. package/dist/plugins/diff-source/SourceEditor.js +1 -1
  11. package/dist/plugins/directives/DirectiveNode.js +1 -4
  12. package/dist/plugins/frontmatter/FrontmatterNode.js +4 -4
  13. package/dist/plugins/frontmatter/index.js +1 -1
  14. package/dist/plugins/headings/index.js +2 -1
  15. package/dist/plugins/image/ImageDialog.js +1 -2
  16. package/dist/plugins/image/ImageEditor.js +1 -2
  17. package/dist/plugins/image/ImageNode.js +1 -4
  18. package/dist/plugins/image/index.js +4 -6
  19. package/dist/plugins/jsx/LexicalJsxNode.js +1 -4
  20. package/dist/plugins/jsx/LexicalMdxExpressionNode.js +1 -4
  21. package/dist/plugins/link-dialog/LinkDialog.js +9 -4
  22. package/dist/plugins/link-dialog/index.js +149 -41
  23. package/dist/plugins/lists/index.js +3 -3
  24. package/dist/plugins/markdown-shortcut/index.js +1 -1
  25. package/dist/plugins/search/index.js +24 -47
  26. package/dist/plugins/table/TableEditor.js +1 -1
  27. package/dist/plugins/table/TableNode.js +1 -4
  28. package/dist/plugins/toolbar/components/CreateLink.js +3 -0
  29. package/dist/plugins/toolbar/components/KitchenSinkToolbar.js +1 -1
  30. package/dist/plugins/toolbar/primitives/toolbar.js +1 -1
  31. package/dist/style.css +1503 -1448
  32. package/dist/styles/ui.module.css.js +94 -94
  33. package/dist/utils/lexicalHelpers.js +29 -17
  34. package/package.json +2 -2
  35. package/dist/styles/globals.css.js +0 -1
package/dist/MDXEditor.js CHANGED
@@ -35,7 +35,7 @@ const RichTextEditor = () => {
35
35
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, topAreaChildren.map((Child, index) => /* @__PURE__ */ React__default.createElement(Child, { key: index })), /* @__PURE__ */ React__default.createElement(RenderRecursiveWrappers, { wrappers: editorWrappers }, /* @__PURE__ */ React__default.createElement("div", { className: classNames(styles.rootContentEditableWrapper, "mdxeditor-root-contenteditable") }, /* @__PURE__ */ React__default.createElement(
36
36
  RichTextPlugin,
37
37
  {
38
- contentEditable: /* @__PURE__ */ React__default.createElement("div", { ref: onRef }, /* @__PURE__ */ React__default.createElement(
38
+ contentEditable: /* @__PURE__ */ React__default.createElement("div", { ref: onRef, className: "mdxeditor-contenteditable-wrapper" }, /* @__PURE__ */ React__default.createElement(
39
39
  ContentEditable,
40
40
  {
41
41
  className: classNames(styles.contentEditable, contentEditableClassName),
package/dist/index.d.ts CHANGED
@@ -1160,6 +1160,8 @@ export declare interface EditLinkDialog {
1160
1160
  text: string;
1161
1161
  withAnchorText: boolean;
1162
1162
  linkNodeKey: string;
1163
+ /** Set when the dialog targets a single inline decorator node (e.g. an image) instead of a text selection. */
1164
+ decoratorNodeKey?: string;
1163
1165
  rectangle: RectData;
1164
1166
  }
1165
1167
 
@@ -1309,6 +1311,7 @@ export declare class FrontmatterNode extends DecoratorNode<JSX.Element> {
1309
1311
  setYaml(yaml: string): void;
1310
1312
  decorate(editor: LexicalEditor): JSX.Element;
1311
1313
  isKeyboardSelectable(): boolean;
1314
+ isInline(): boolean;
1312
1315
  }
1313
1316
 
1314
1317
  /**
@@ -1385,6 +1388,17 @@ export declare function getCodeBlockLanguageSelectData(normalized: NormalizedCod
1385
1388
  }[];
1386
1389
  };
1387
1390
 
1391
+ /**
1392
+ * Gets the coordinates of the DOM element that renders the node with the given key.
1393
+ * @group Utils
1394
+ */
1395
+ export declare function getNodeRectangle(editor: LexicalEditor, nodeKey: string): {
1396
+ top: number;
1397
+ left: number;
1398
+ width: number;
1399
+ height: number;
1400
+ } | null;
1401
+
1388
1402
  /**
1389
1403
  * Gets the selected node from the Lexical editor.
1390
1404
  * @group Utils
@@ -1591,6 +1605,7 @@ export declare interface InactiveLinkDialog {
1591
1605
  type: 'inactive';
1592
1606
  rectangle?: undefined;
1593
1607
  linkNodeKey?: undefined;
1608
+ decoratorNodeKey?: undefined;
1594
1609
  }
1595
1610
 
1596
1611
  /**
@@ -2623,6 +2638,8 @@ export declare interface PreviewLinkDialog {
2623
2638
  /** The fail-closed URL used only for automatic preview navigation. */
2624
2639
  href?: string;
2625
2640
  linkNodeKey: string;
2641
+ /** Set when the link wraps a single inline decorator node (e.g. an image) that the dialog targets. */
2642
+ decoratorNodeKey?: string;
2626
2643
  rectangle: RectData;
2627
2644
  }
2628
2645
 
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./styles/globals.css.js";
1
+ /* empty css */
2
2
  export * from "@mdxeditor/gurx";
3
3
  import { MDXEditor } from "./MDXEditor.js";
4
4
  import { defaultSvgIcons } from "./defaultSvgIcons.js";
@@ -54,7 +54,7 @@ import { RemoteMDXEditorRealmProvider, remoteRealmPlugin, useRemoteMDXEditorReal
54
54
  import { CAN_USE_DOM, IS_APPLE, controlOrMeta } from "./utils/detectMac.js";
55
55
  import { always, call, compose, curry1to0, curry2to1, joinProc, noop, prop, tap, thrush } from "./utils/fp.js";
56
56
  import { isPartOftheEditorUI } from "./utils/isPartOftheEditorUI.js";
57
- import { fromWithinEditorRead, getSelectedNode, getSelectionAsMarkdown, getSelectionRectangle, getStateAsMarkdown } from "./utils/lexicalHelpers.js";
57
+ import { fromWithinEditorRead, getNodeRectangle, getSelectedNode, getSelectionAsMarkdown, getSelectionRectangle, getStateAsMarkdown } from "./utils/lexicalHelpers.js";
58
58
  import { makeHslTransparent } from "./utils/makeHslTransparent.js";
59
59
  import { uuidv4 } from "./utils/uuid4.js";
60
60
  import { voidEmitter } from "./utils/voidEmitter.js";
@@ -62,13 +62,13 @@ import { RealmWithPlugins, realmPlugin } from "./RealmWithPlugins.js";
62
62
  import { DEFAULT_FORMAT, IS_BOLD, IS_CODE, IS_HIGHLIGHT, IS_ITALIC, IS_STRIKETHROUGH, IS_SUBSCRIPT, IS_SUPERSCRIPT, IS_UNDERLINE } from "./FormatConstants.js";
63
63
  import { lexicalTheme } from "./styles/lexicalTheme.js";
64
64
  import * as lexical from "lexical";
65
- import { htmlTags, isMdastHTMLNode } from "./plugins/core/MdastHTMLNode.js";
66
- import { $createGenericHTMLNode, $isGenericHTMLNode, GenericHTMLNode, TYPE_NAME } from "./plugins/core/GenericHTMLNode.js";
67
- import { $convertTableElement, $createTableNode, $isTableNode, TableNode } from "./plugins/table/TableNode.js";
68
- import { $createImageNode, $isImageNode, ImageNode } from "./plugins/image/ImageNode.js";
69
- import { $createFrontmatterNode, $isFrontmatterNode, FrontmatterNode } from "./plugins/frontmatter/FrontmatterNode.js";
70
65
  import { $convertPreElement, $createCodeBlockNode, $isCodeBlockNode, CodeBlockNode, useCodeBlockEditorContext } from "./plugins/codeblock/CodeBlockNode.js";
66
+ import { $convertTableElement, $createTableNode, $isTableNode, TableNode } from "./plugins/table/TableNode.js";
71
67
  import { $createDirectiveNode, $isDirectiveNode, DirectiveNode } from "./plugins/directives/DirectiveNode.js";
68
+ import { $createFrontmatterNode, $isFrontmatterNode, FrontmatterNode } from "./plugins/frontmatter/FrontmatterNode.js";
69
+ import { $createGenericHTMLNode, $isGenericHTMLNode, GenericHTMLNode, TYPE_NAME } from "./plugins/core/GenericHTMLNode.js";
70
+ import { $createImageNode, $isImageNode, ImageNode } from "./plugins/image/ImageNode.js";
71
+ import { htmlTags, isMdastHTMLNode } from "./plugins/core/MdastHTMLNode.js";
72
72
  export {
73
73
  $convertPreElement,
74
74
  $convertTableElement,
@@ -242,6 +242,7 @@ export {
242
242
  frontmatterDialogOpen$,
243
243
  frontmatterPlugin,
244
244
  getCodeBlockLanguageSelectData,
245
+ getNodeRectangle,
245
246
  getSelectedNode,
246
247
  getSelectionAsMarkdown,
247
248
  getSelectionRectangle,
@@ -1,9 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
4
  import { useCellValue } from "@mdxeditor/gurx";
8
5
  import { DecoratorNode } from "lexical";
9
6
  import React__default from "react";
@@ -1,6 +1,6 @@
1
1
  import { CodeBlockVisitor } from "./CodeBlockVisitor.js";
2
2
  import { MdastCodeVisitor } from "./MdastCodeVisitor.js";
3
- import { Appender, defaultCodeBlockLanguage$, insertDecoratorNode$, codeBlockEditorDescriptors$, addExportVisitor$, addLexicalNode$, addImportVisitor$, addActivePlugin$ } from "../core/index.js";
3
+ import { Appender, codeBlockEditorDescriptors$, defaultCodeBlockLanguage$, insertDecoratorNode$, addExportVisitor$, addLexicalNode$, addImportVisitor$, addActivePlugin$ } from "../core/index.js";
4
4
  import { $createCodeBlockNode, CodeBlockNode } from "./CodeBlockNode.js";
5
5
  import { $convertPreElement, $isCodeBlockNode, useCodeBlockEditorContext } from "./CodeBlockNode.js";
6
6
  import { Signal, withLatestFrom, map } from "@mdxeditor/gurx";
@@ -5,7 +5,7 @@ import { useCodeBlockEditorContext } from "../codeblock/CodeBlockNode.js";
5
5
  import { useTranslation, readOnly$, iconComponentFor$ } from "../core/index.js";
6
6
  import { languages } from "@codemirror/language-data";
7
7
  import { EditorState } from "@codemirror/state";
8
- import { lineNumbers, keymap, EditorView } from "@codemirror/view";
8
+ import { EditorView, lineNumbers, keymap } from "@codemirror/view";
9
9
  import { indentWithTab } from "@codemirror/commands";
10
10
  import { basicLight } from "cm6-theme-basic-light";
11
11
  import { basicSetup } from "codemirror";
@@ -1,10 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
7
- import { ElementNode, $applyNodeReplacement } from "lexical";
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import { $applyNodeReplacement, ElementNode } from "lexical";
8
5
  const TYPE_NAME = "generic-html";
9
6
  class GenericHTMLNode extends ElementNode {
10
7
  /**
@@ -1,6 +1,6 @@
1
- import { $addUpdateTag, $getNodeByKey, FOCUS_COMMAND, COMMAND_PRIORITY_LOW, BLUR_COMMAND, COMMAND_PRIORITY_EDITOR, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_HIGH, KEY_BACKSPACE_COMMAND, COMMAND_PRIORITY_CRITICAL, $getRoot } from "lexical";
1
+ import { FOCUS_COMMAND, COMMAND_PRIORITY_LOW, BLUR_COMMAND, COMMAND_PRIORITY_EDITOR, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_HIGH, KEY_BACKSPACE_COMMAND, COMMAND_PRIORITY_CRITICAL, $getNodeByKey, $addUpdateTag, $getRoot } from "lexical";
2
2
  import React__default from "react";
3
- import { NESTED_EDITOR_UPDATED_COMMAND, rootEditor$, importVisitors$, exportVisitors$, usedLexicalNodes$, jsxComponentDescriptors$, directiveDescriptors$, codeBlockEditorDescriptors$, defaultCodeBlockLanguage$, jsxIsAvailable$, nestedEditorChildren$, lexicalTheme$, editorInFocus$, historyState$ } from "./index.js";
3
+ import { rootEditor$, importVisitors$, exportVisitors$, usedLexicalNodes$, jsxComponentDescriptors$, directiveDescriptors$, codeBlockEditorDescriptors$, defaultCodeBlockLanguage$, jsxIsAvailable$, nestedEditorChildren$, lexicalTheme$, editorInFocus$, historyState$, NESTED_EDITOR_UPDATED_COMMAND } from "./index.js";
4
4
  import { ContentEditable } from "@lexical/react/LexicalContentEditable";
5
5
  import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
6
6
  import { LexicalExtensionEditorComposer } from "@lexical/react/LexicalExtensionEditorComposer";
@@ -3,8 +3,8 @@ import { createEmptyHistoryState } from "@lexical/history";
3
3
  import { $isHeadingNode } from "@lexical/rich-text";
4
4
  import { $setBlocksType } from "@lexical/selection";
5
5
  import { $findMatchingParent, $wrapNodeInElement, $insertNodeToNearestRoot } from "@lexical/utils";
6
- import { Cell, Signal, withLatestFrom, filter, map, useCellValue, scan } from "@mdxeditor/gurx";
7
- import { createCommand, FORMAT_TEXT_COMMAND, $isRootOrShadowRoot, $getRoot, $setSelection, $getSelection, $insertNodes, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_CRITICAL, DecoratorNode, $createParagraphNode, FOCUS_COMMAND, BLUR_COMMAND, $isRangeSelection, ParagraphNode, TextNode } from "lexical";
6
+ import { Signal, Cell, withLatestFrom, map, filter, useCellValue, scan } from "@mdxeditor/gurx";
7
+ import { createCommand, FORMAT_TEXT_COMMAND, $getSelection, $isRangeSelection, BLUR_COMMAND, COMMAND_PRIORITY_CRITICAL, SELECTION_CHANGE_COMMAND, $getRoot, DecoratorNode, $createParagraphNode, FOCUS_COMMAND, $isRootOrShadowRoot, $insertNodes, $setSelection, ParagraphNode, TextNode } from "lexical";
8
8
  import { gfmStrikethrough } from "micromark-extension-gfm-strikethrough";
9
9
  import { gfmStrikethroughToMarkdown, gfmStrikethroughFromMarkdown } from "mdast-util-gfm-strikethrough";
10
10
  import { highlightMarkToMarkdown, highlightMarkFromMarkdown } from "mdast-util-highlight-mark";
@@ -1,6 +1,6 @@
1
1
  import { markdown } from "@codemirror/lang-markdown";
2
2
  import { EditorState } from "@codemirror/state";
3
- import { lineNumbers, EditorView } from "@codemirror/view";
3
+ import { EditorView, lineNumbers } from "@codemirror/view";
4
4
  import { basicLight } from "cm6-theme-basic-light";
5
5
  import { basicSetup } from "codemirror";
6
6
  import React__default from "react";
@@ -1,9 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
4
  import React__default from "react";
8
5
  import { DecoratorNode } from "lexical";
9
6
  import { NestedEditorsContext } from "../core/NestedLexicalEditor.js";
@@ -1,9 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
4
  import { DecoratorNode } from "lexical";
8
5
  import React__default from "react";
9
6
  import { FrontmatterEditor } from "./FrontmatterEditor.js";
@@ -62,6 +59,9 @@ class FrontmatterNode extends DecoratorNode {
62
59
  isKeyboardSelectable() {
63
60
  return false;
64
61
  }
62
+ isInline() {
63
+ return false;
64
+ }
65
65
  }
66
66
  function $createFrontmatterNode(yaml) {
67
67
  return new FrontmatterNode(yaml);
@@ -1,5 +1,5 @@
1
1
  import { realmPlugin } from "../../RealmWithPlugins.js";
2
- import { rootEditor$, createRootEditorSubscription$, addToMarkdownExtension$, addExportVisitor$, addImportVisitor$, addLexicalNode$, addSyntaxExtension$, addMdastExtension$ } from "../core/index.js";
2
+ import { createRootEditorSubscription$, rootEditor$, addToMarkdownExtension$, addExportVisitor$, addImportVisitor$, addLexicalNode$, addSyntaxExtension$, addMdastExtension$ } from "../core/index.js";
3
3
  import { Cell, Action, withLatestFrom } from "@mdxeditor/gurx";
4
4
  import { $getRoot, KEY_DOWN_COMMAND, $getSelection, $isRangeSelection, $isTextNode, COMMAND_PRIORITY_CRITICAL } from "lexical";
5
5
  import { frontmatterToMarkdown, frontmatterFromMarkdown } from "mdast-util-frontmatter";
@@ -44,13 +44,14 @@ const allowedHeadingLevels$ = Cell(ALL_HEADING_LEVELS, (r) => {
44
44
  });
45
45
  });
46
46
  const headingsPlugin = realmPlugin({
47
- init(realm) {
47
+ init(realm, params) {
48
48
  realm.pubIn({
49
49
  [addActivePlugin$]: "headings",
50
50
  [addImportVisitor$]: MdastHeadingVisitor,
51
51
  [addLexicalNode$]: HeadingNode,
52
52
  [addExportVisitor$]: LexicalHeadingVisitor
53
53
  });
54
+ realm.pub(allowedHeadingLevels$, (params == null ? void 0 : params.allowedHeadingLevels) ?? ALL_HEADING_LEVELS);
54
55
  },
55
56
  update(realm, params) {
56
57
  realm.pub(allowedHeadingLevels$, (params == null ? void 0 : params.allowedHeadingLevels) ?? ALL_HEADING_LEVELS);
@@ -25,8 +25,7 @@ const ImageDialog = () => {
25
25
  const resetFormState = () => {
26
26
  reset({ src: "", title: "", altText: "", width: void 0, height: void 0 });
27
27
  };
28
- if (state.type === "inactive")
29
- return null;
28
+ if (state.type === "inactive") return null;
30
29
  return /* @__PURE__ */ React__default.createElement(
31
30
  Dialog.Root,
32
31
  {
@@ -132,8 +132,7 @@ function ImageEditor({ src, title, alt, nodeKey, width, height, rest }) {
132
132
  React__default.useEffect(() => {
133
133
  if (imagePreviewHandler) {
134
134
  const callPreviewHandler = async () => {
135
- if (!initialImagePath)
136
- setInitialImagePath(src);
135
+ if (!initialImagePath) setInitialImagePath(src);
137
136
  const updatedSrc = await imagePreviewHandler(src);
138
137
  setImageSource(updatedSrc);
139
138
  };
@@ -1,9 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
4
  import React__default from "react";
8
5
  import { DecoratorNode } from "lexical";
9
6
  import { ImageEditor } from "./ImageEditor.js";
@@ -1,13 +1,13 @@
1
1
  import { ImagePlaceholder } from "./ImagePlaceholder.js";
2
2
  import { mergeRegister, $wrapNodeInElement } from "@lexical/utils";
3
- import { Signal, Cell, Action, withLatestFrom, mapTo, map } from "@mdxeditor/gurx";
3
+ import { Cell, Action, mapTo, withLatestFrom, Signal, map } from "@mdxeditor/gurx";
4
4
  import { createCommand, $getNodeByKey, $insertNodes, $isRootOrShadowRoot, $createParagraphNode, COMMAND_PRIORITY_EDITOR, DRAGSTART_COMMAND, COMMAND_PRIORITY_HIGH, DRAGOVER_COMMAND, COMMAND_PRIORITY_LOW, DROP_COMMAND, PASTE_COMMAND, COMMAND_PRIORITY_CRITICAL, $createRangeSelection, $setSelection, $getSelection, $isNodeSelection } from "lexical";
5
5
  import { realmPlugin } from "../../RealmWithPlugins.js";
6
6
  import { CAN_USE_DOM } from "../../utils/detectMac.js";
7
7
  import { activeEditor$, createActiveEditorSubscription$, addComposerChild$, addExportVisitor$, addLexicalNode$, addImportVisitor$ } from "../core/index.js";
8
8
  import { EditImageToolbar } from "./EditImageToolbar.js";
9
9
  import { ImageDialog } from "./ImageDialog.js";
10
- import { $createImageNode, ImageNode, $isImageNode } from "./ImageNode.js";
10
+ import { $createImageNode, $isImageNode, ImageNode } from "./ImageNode.js";
11
11
  import { LexicalImageVisitor } from "./LexicalImageVisitor.js";
12
12
  import { MdastImageVisitor, MdastHtmlImageVisitor, MdastJsxImageVisitor } from "./MdastImageVisitor.js";
13
13
  const internalInsertImage$ = Signal((r) => {
@@ -129,8 +129,7 @@ const imageDialogState$ = Cell(
129
129
  }
130
130
  const cbPayload = Array.from(((_b = event.clipboardData) == null ? void 0 : _b.items) ?? []);
131
131
  const isMixedPayload = cbPayload.some((item) => !item.type.includes("image"));
132
- if (isMixedPayload)
133
- return false;
132
+ if (isMixedPayload) return false;
134
133
  if (!cbPayload.length || cbPayload.length === 0) {
135
134
  return false;
136
135
  }
@@ -173,8 +172,7 @@ const allowSetImageDimensions$ = Cell(false);
173
172
  const saveImage$ = Signal();
174
173
  const editImageToolbarComponent$ = Cell(EditImageToolbar);
175
174
  const parseImageDimension = (value) => {
176
- if (typeof value === "undefined")
177
- return void 0;
175
+ if (typeof value === "undefined") return void 0;
178
176
  const parsed = parseInt(String(value), 10);
179
177
  return Number.isNaN(parsed) ? void 0 : parsed;
180
178
  };
@@ -1,9 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
4
  import { DecoratorNode } from "lexical";
8
5
  import React__default from "react";
9
6
  import { NestedEditorsContext } from "../core/NestedLexicalEditor.js";
@@ -1,9 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
4
  import React__default from "react";
8
5
  import { DecoratorNode, $applyNodeReplacement } from "lexical";
9
6
  import lexicalThemeStyles from "../../styles/lexical-theme.module.css.js";
@@ -1,7 +1,7 @@
1
1
  import * as RadixPopover from "@radix-ui/react-popover";
2
2
  import * as Tooltip from "@radix-ui/react-tooltip";
3
3
  import React__default from "react";
4
- import { editorRootElementRef$, activeEditor$, iconComponentFor$, useTranslation } from "../core/index.js";
4
+ import { editorRootElementRef$, contentEditableWrapperElement$, activeEditor$, iconComponentFor$, useTranslation } from "../core/index.js";
5
5
  import { DownshiftAutoComplete } from "../core/ui/DownshiftAutoComplete.js";
6
6
  import styles from "../../styles/ui.module.css.js";
7
7
  import classNames from "classnames";
@@ -93,6 +93,7 @@ function LinkEditForm({
93
93
  const LinkDialog = () => {
94
94
  const [
95
95
  editorRootElementRef,
96
+ contentEditableWrapperElement,
96
97
  activeEditor,
97
98
  iconComponentFor,
98
99
  linkDialogState,
@@ -101,6 +102,7 @@ const LinkDialog = () => {
101
102
  showLinkTitleField
102
103
  ] = useCellValues(
103
104
  editorRootElementRef$,
105
+ contentEditableWrapperElement$,
104
106
  activeEditor$,
105
107
  iconComponentFor$,
106
108
  linkDialogState$,
@@ -114,6 +116,7 @@ const LinkDialog = () => {
114
116
  const switchFromPreviewToLinkEdit = usePublisher(switchFromPreviewToLinkEdit$);
115
117
  const removeLink = usePublisher(removeLink$);
116
118
  React__default.useEffect(() => {
119
+ const scrollContainer = contentEditableWrapperElement == null ? void 0 : contentEditableWrapperElement.closest(".mdxeditor-root-contenteditable");
117
120
  const update = () => {
118
121
  activeEditor == null ? void 0 : activeEditor.getEditorState().read(() => {
119
122
  publishWindowChange(true);
@@ -121,15 +124,16 @@ const LinkDialog = () => {
121
124
  };
122
125
  window.addEventListener("resize", update);
123
126
  window.addEventListener("scroll", update);
127
+ scrollContainer == null ? void 0 : scrollContainer.addEventListener("scroll", update);
124
128
  return () => {
125
129
  window.removeEventListener("resize", update);
126
130
  window.removeEventListener("scroll", update);
131
+ scrollContainer == null ? void 0 : scrollContainer.removeEventListener("scroll", update);
127
132
  };
128
- }, [activeEditor, publishWindowChange]);
133
+ }, [activeEditor, contentEditableWrapperElement, publishWindowChange]);
129
134
  const [copyUrlTooltipOpen, setCopyUrlTooltipOpen] = React__default.useState(false);
130
135
  const t = useTranslation();
131
- if (linkDialogState.type === "inactive")
132
- return null;
136
+ if (linkDialogState.type === "inactive") return null;
133
137
  const theRect = linkDialogState.rectangle;
134
138
  const urlIsExternal = linkDialogState.type === "preview" && linkDialogState.url.startsWith("http");
135
139
  return /* @__PURE__ */ React__default.createElement(RadixPopover.Root, { open: true }, /* @__PURE__ */ React__default.createElement(
@@ -149,6 +153,7 @@ const LinkDialog = () => {
149
153
  {
150
154
  className: classNames(styles.linkDialogPopoverContent),
151
155
  sideOffset: 5,
156
+ updatePositionStrategy: "always",
152
157
  onOpenAutoFocus: (e) => {
153
158
  e.preventDefault();
154
159
  },