@mdxeditor/editor 4.1.1 → 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.
@@ -1,97 +1,97 @@
1
- const editorRoot = "_editorRoot_f3hmk_53";
2
- const editorWrapper = "_editorWrapper_f3hmk_155";
3
- const toolbarRoot = "_toolbarRoot_f3hmk_162";
4
- const readOnlyToolbarRoot = "_readOnlyToolbarRoot_f3hmk_189";
5
- const toolbarToggleItem = "_toolbarToggleItem_f3hmk_208";
6
- const toolbarGroupOfGroups = "_toolbarGroupOfGroups_f3hmk_219";
7
- const toolbarToggleSingleGroup = "_toolbarToggleSingleGroup_f3hmk_224";
8
- const toolbarButton = "_toolbarButton_f3hmk_239";
9
- const activeToolbarButton = "_activeToolbarButton_f3hmk_275";
10
- const toolbarButtonDropdownContainer = "_toolbarButtonDropdownContainer_f3hmk_286";
11
- const selectContainer = "_selectContainer_f3hmk_288";
12
- const selectItem = "_selectItem_f3hmk_301";
13
- const toolbarButtonSelectTrigger = "_toolbarButtonSelectTrigger_f3hmk_307";
14
- const selectTrigger = "_selectTrigger_f3hmk_308";
15
- const selectDropdownArrow = "_selectDropdownArrow_f3hmk_373";
16
- const contentEditable = "_contentEditable_f3hmk_379";
17
- const codeMirrorWrapper = "_codeMirrorWrapper_f3hmk_391";
18
- const codeMirrorToolbar = "_codeMirrorToolbar_f3hmk_408";
19
- const propertyPanelTitle = "_propertyPanelTitle_f3hmk_430";
20
- const propertyEditorTable = "_propertyEditorTable_f3hmk_438";
21
- const iconButton = "_iconButton_f3hmk_456";
22
- const readOnlyColumnCell = "_readOnlyColumnCell_f3hmk_461";
23
- const buttonsFooter = "_buttonsFooter_f3hmk_474";
24
- const propertyEditorInput = "_propertyEditorInput_f3hmk_480";
25
- const primaryButton = "_primaryButton_f3hmk_506";
26
- const secondaryButton = "_secondaryButton_f3hmk_507";
27
- const smallButton = "_smallButton_f3hmk_522";
28
- const dialogForm = "_dialogForm_f3hmk_534";
29
- const linkDialogEditForm = "_linkDialogEditForm_f3hmk_540";
30
- const linkDialogInputContainer = "_linkDialogInputContainer_f3hmk_548";
31
- const linkDialogInputWrapper = "_linkDialogInputWrapper_f3hmk_554";
32
- const linkDialogInput = "_linkDialogInput_f3hmk_548";
33
- const linkDialogAnchor = "_linkDialogAnchor_f3hmk_586";
34
- const linkDialogPopoverContent = "_linkDialogPopoverContent_f3hmk_600";
35
- const tableColumnEditorPopoverContent = "_tableColumnEditorPopoverContent_f3hmk_601";
36
- const dialogContent = "_dialogContent_f3hmk_602";
37
- const largeDialogContent = "_largeDialogContent_f3hmk_614";
38
- const dialogTitle = "_dialogTitle_f3hmk_624";
39
- const dialogCloseButton = "_dialogCloseButton_f3hmk_630";
40
- const popoverContent = "_popoverContent_f3hmk_637";
41
- const popoverArrow = "_popoverArrow_f3hmk_649";
42
- const linkDialogPreviewAnchor = "_linkDialogPreviewAnchor_f3hmk_653";
43
- const tooltipTrigger = "_tooltipTrigger_f3hmk_676";
44
- const tooltipContent = "_tooltipContent_f3hmk_680";
45
- const actionButton = "_actionButton_f3hmk_694";
46
- const primaryActionButton = "_primaryActionButton_f3hmk_701";
47
- const tableEditor = "_tableEditor_f3hmk_713";
48
- const toolCell = "_toolCell_f3hmk_724";
49
- const tableColumnEditorTrigger = "_tableColumnEditorTrigger_f3hmk_743";
50
- const addRowButton = "_addRowButton_f3hmk_745";
51
- const addColumnButton = "_addColumnButton_f3hmk_746";
52
- const tableColumnEditorToolbar = "_tableColumnEditorToolbar_f3hmk_788";
53
- const toggleGroupRoot = "_toggleGroupRoot_f3hmk_801";
54
- const tableToolsColumn = "_tableToolsColumn_f3hmk_819";
55
- const leftAlignedCell = "_leftAlignedCell_f3hmk_828";
56
- const rightAlignedCell = "_rightAlignedCell_f3hmk_832";
57
- const centeredCell = "_centeredCell_f3hmk_836";
58
- const dialogOverlay = "_dialogOverlay_f3hmk_869";
59
- const focusedImage = "_focusedImage_f3hmk_915";
60
- const imageWrapper = "_imageWrapper_f3hmk_919";
61
- const editImageToolbar = "_editImageToolbar_f3hmk_932";
62
- const editImageButton = "_editImageButton_f3hmk_936";
63
- const inlineEditor = "_inlineEditor_f3hmk_942";
64
- const blockEditor = "_blockEditor_f3hmk_951";
65
- const nestedEditor = "_nestedEditor_f3hmk_960";
66
- const genericComponentName = "_genericComponentName_f3hmk_979";
67
- const diffSourceToggleWrapper = "_diffSourceToggleWrapper_f3hmk_985";
68
- const ggDiffSourceToggle = "_ggDiffSourceToggle_f3hmk_993";
69
- const diffSourceToggle = "_diffSourceToggle_f3hmk_985";
70
- const selectWithLabel = "_selectWithLabel_f3hmk_1011";
71
- const toolbarTitleMode = "_toolbarTitleMode_f3hmk_1026";
72
- const imageControlWrapperResizing = "_imageControlWrapperResizing_f3hmk_1031";
73
- const imageResizer = "_imageResizer_f3hmk_1035";
74
- const imageResizerN = "_imageResizerN_f3hmk_1044";
75
- const imageResizerNe = "_imageResizerNe_f3hmk_1050";
76
- const imageResizerE = "_imageResizerE_f3hmk_1056";
77
- const imageResizerSe = "_imageResizerSe_f3hmk_1062";
78
- const imageResizerS = "_imageResizerS_f3hmk_1062";
79
- const imageResizerSw = "_imageResizerSw_f3hmk_1074";
80
- const imageResizerW = "_imageResizerW_f3hmk_1080";
81
- const imageResizerNw = "_imageResizerNw_f3hmk_1086";
82
- const imagePlaceholder = "_imagePlaceholder_f3hmk_1092";
83
- const imageDimensionsContainer = "_imageDimensionsContainer_f3hmk_1100";
84
- const placeholder = "_placeholder_f3hmk_1105";
85
- const rootContentEditableWrapper = "_rootContentEditableWrapper_f3hmk_1118";
86
- const downshiftInputWrapper = "_downshiftInputWrapper_f3hmk_1128";
87
- const downshiftInput = "_downshiftInput_f3hmk_1128";
88
- const downshiftAutocompleteContainer = "_downshiftAutocompleteContainer_f3hmk_1159";
89
- const textInput = "_textInput_f3hmk_1205";
90
- const multiFieldForm = "_multiFieldForm_f3hmk_1213";
91
- const formField = "_formField_f3hmk_1219";
92
- const markdownParseError = "_markdownParseError_f3hmk_1230";
93
- const popupContainer = "_popupContainer_f3hmk_1239";
94
- const inputSizer = "_inputSizer_f3hmk_1244";
1
+ const editorRoot = "_editorRoot_er3ed_53";
2
+ const editorWrapper = "_editorWrapper_er3ed_155";
3
+ const toolbarRoot = "_toolbarRoot_er3ed_162";
4
+ const readOnlyToolbarRoot = "_readOnlyToolbarRoot_er3ed_189";
5
+ const toolbarToggleItem = "_toolbarToggleItem_er3ed_208";
6
+ const toolbarGroupOfGroups = "_toolbarGroupOfGroups_er3ed_219";
7
+ const toolbarToggleSingleGroup = "_toolbarToggleSingleGroup_er3ed_224";
8
+ const toolbarButton = "_toolbarButton_er3ed_239";
9
+ const activeToolbarButton = "_activeToolbarButton_er3ed_275";
10
+ const toolbarButtonDropdownContainer = "_toolbarButtonDropdownContainer_er3ed_286";
11
+ const selectContainer = "_selectContainer_er3ed_288";
12
+ const selectItem = "_selectItem_er3ed_301";
13
+ const toolbarButtonSelectTrigger = "_toolbarButtonSelectTrigger_er3ed_307";
14
+ const selectTrigger = "_selectTrigger_er3ed_308";
15
+ const selectDropdownArrow = "_selectDropdownArrow_er3ed_373";
16
+ const contentEditable = "_contentEditable_er3ed_379";
17
+ const codeMirrorWrapper = "_codeMirrorWrapper_er3ed_391";
18
+ const codeMirrorToolbar = "_codeMirrorToolbar_er3ed_408";
19
+ const propertyPanelTitle = "_propertyPanelTitle_er3ed_430";
20
+ const propertyEditorTable = "_propertyEditorTable_er3ed_438";
21
+ const iconButton = "_iconButton_er3ed_456";
22
+ const readOnlyColumnCell = "_readOnlyColumnCell_er3ed_461";
23
+ const buttonsFooter = "_buttonsFooter_er3ed_474";
24
+ const propertyEditorInput = "_propertyEditorInput_er3ed_480";
25
+ const primaryButton = "_primaryButton_er3ed_506";
26
+ const secondaryButton = "_secondaryButton_er3ed_507";
27
+ const smallButton = "_smallButton_er3ed_522";
28
+ const dialogForm = "_dialogForm_er3ed_534";
29
+ const linkDialogEditForm = "_linkDialogEditForm_er3ed_540";
30
+ const linkDialogInputContainer = "_linkDialogInputContainer_er3ed_548";
31
+ const linkDialogInputWrapper = "_linkDialogInputWrapper_er3ed_554";
32
+ const linkDialogInput = "_linkDialogInput_er3ed_548";
33
+ const linkDialogAnchor = "_linkDialogAnchor_er3ed_586";
34
+ const linkDialogPopoverContent = "_linkDialogPopoverContent_er3ed_600";
35
+ const tableColumnEditorPopoverContent = "_tableColumnEditorPopoverContent_er3ed_601";
36
+ const dialogContent = "_dialogContent_er3ed_602";
37
+ const largeDialogContent = "_largeDialogContent_er3ed_614";
38
+ const dialogTitle = "_dialogTitle_er3ed_624";
39
+ const dialogCloseButton = "_dialogCloseButton_er3ed_630";
40
+ const popoverContent = "_popoverContent_er3ed_637";
41
+ const popoverArrow = "_popoverArrow_er3ed_649";
42
+ const linkDialogPreviewAnchor = "_linkDialogPreviewAnchor_er3ed_653";
43
+ const tooltipTrigger = "_tooltipTrigger_er3ed_676";
44
+ const tooltipContent = "_tooltipContent_er3ed_680";
45
+ const actionButton = "_actionButton_er3ed_694";
46
+ const primaryActionButton = "_primaryActionButton_er3ed_701";
47
+ const tableEditor = "_tableEditor_er3ed_713";
48
+ const toolCell = "_toolCell_er3ed_724";
49
+ const tableColumnEditorTrigger = "_tableColumnEditorTrigger_er3ed_743";
50
+ const addRowButton = "_addRowButton_er3ed_745";
51
+ const addColumnButton = "_addColumnButton_er3ed_746";
52
+ const tableColumnEditorToolbar = "_tableColumnEditorToolbar_er3ed_788";
53
+ const toggleGroupRoot = "_toggleGroupRoot_er3ed_801";
54
+ const tableToolsColumn = "_tableToolsColumn_er3ed_819";
55
+ const leftAlignedCell = "_leftAlignedCell_er3ed_828";
56
+ const rightAlignedCell = "_rightAlignedCell_er3ed_832";
57
+ const centeredCell = "_centeredCell_er3ed_836";
58
+ const dialogOverlay = "_dialogOverlay_er3ed_869";
59
+ const focusedImage = "_focusedImage_er3ed_915";
60
+ const imageWrapper = "_imageWrapper_er3ed_919";
61
+ const editImageToolbar = "_editImageToolbar_er3ed_932";
62
+ const editImageButton = "_editImageButton_er3ed_936";
63
+ const inlineEditor = "_inlineEditor_er3ed_942";
64
+ const blockEditor = "_blockEditor_er3ed_951";
65
+ const nestedEditor = "_nestedEditor_er3ed_960";
66
+ const genericComponentName = "_genericComponentName_er3ed_979";
67
+ const diffSourceToggleWrapper = "_diffSourceToggleWrapper_er3ed_985";
68
+ const ggDiffSourceToggle = "_ggDiffSourceToggle_er3ed_993";
69
+ const diffSourceToggle = "_diffSourceToggle_er3ed_985";
70
+ const selectWithLabel = "_selectWithLabel_er3ed_1011";
71
+ const toolbarTitleMode = "_toolbarTitleMode_er3ed_1026";
72
+ const imageControlWrapperResizing = "_imageControlWrapperResizing_er3ed_1031";
73
+ const imageResizer = "_imageResizer_er3ed_1035";
74
+ const imageResizerN = "_imageResizerN_er3ed_1044";
75
+ const imageResizerNe = "_imageResizerNe_er3ed_1050";
76
+ const imageResizerE = "_imageResizerE_er3ed_1056";
77
+ const imageResizerSe = "_imageResizerSe_er3ed_1062";
78
+ const imageResizerS = "_imageResizerS_er3ed_1062";
79
+ const imageResizerSw = "_imageResizerSw_er3ed_1074";
80
+ const imageResizerW = "_imageResizerW_er3ed_1080";
81
+ const imageResizerNw = "_imageResizerNw_er3ed_1086";
82
+ const imagePlaceholder = "_imagePlaceholder_er3ed_1092";
83
+ const imageDimensionsContainer = "_imageDimensionsContainer_er3ed_1100";
84
+ const placeholder = "_placeholder_er3ed_1105";
85
+ const rootContentEditableWrapper = "_rootContentEditableWrapper_er3ed_1118";
86
+ const downshiftInputWrapper = "_downshiftInputWrapper_er3ed_1128";
87
+ const downshiftInput = "_downshiftInput_er3ed_1128";
88
+ const downshiftAutocompleteContainer = "_downshiftAutocompleteContainer_er3ed_1159";
89
+ const textInput = "_textInput_er3ed_1205";
90
+ const multiFieldForm = "_multiFieldForm_er3ed_1213";
91
+ const formField = "_formField_er3ed_1219";
92
+ const markdownParseError = "_markdownParseError_er3ed_1230";
93
+ const popupContainer = "_popupContainer_er3ed_1239";
94
+ const inputSizer = "_inputSizer_er3ed_1244";
95
95
  const styles = {
96
96
  editorRoot,
97
97
  editorWrapper,
@@ -45,6 +45,32 @@ function getFixedContainingBlock(element) {
45
45
  }
46
46
  return null;
47
47
  }
48
+ function adjustedRectangle(rect, rootElement) {
49
+ const fixedContainer = getFixedContainingBlock(rootElement);
50
+ if (fixedContainer) {
51
+ const containerRect = fixedContainer.getBoundingClientRect();
52
+ return {
53
+ top: Math.round(rect.top - containerRect.top),
54
+ left: Math.round(rect.left - containerRect.left),
55
+ width: Math.round(rect.width),
56
+ height: Math.round(rect.height)
57
+ };
58
+ }
59
+ return {
60
+ top: Math.round(rect.top),
61
+ left: Math.round(rect.left),
62
+ width: Math.round(rect.width),
63
+ height: Math.round(rect.height)
64
+ };
65
+ }
66
+ function getNodeRectangle(editor, nodeKey) {
67
+ const rootElement = editor.getRootElement();
68
+ const element = editor.getElementByKey(nodeKey);
69
+ if (rootElement === null || element === null) {
70
+ return null;
71
+ }
72
+ return adjustedRectangle(element.getBoundingClientRect(), rootElement);
73
+ }
48
74
  function getSelectionRectangle(editor) {
49
75
  const selection = $getSelection();
50
76
  const nativeSelection = window.getSelection();
@@ -71,22 +97,7 @@ function getSelectionRectangle(editor) {
71
97
  rect = domRange.getBoundingClientRect();
72
98
  }
73
99
  }
74
- const fixedContainer = getFixedContainingBlock(rootElement);
75
- if (fixedContainer) {
76
- const containerRect = fixedContainer.getBoundingClientRect();
77
- return {
78
- top: Math.round(rect.top - containerRect.top),
79
- left: Math.round(rect.left - containerRect.left),
80
- width: Math.round(rect.width),
81
- height: Math.round(rect.height)
82
- };
83
- }
84
- return {
85
- top: Math.round(rect.top),
86
- left: Math.round(rect.left),
87
- width: Math.round(rect.width),
88
- height: Math.round(rect.height)
89
- };
100
+ return adjustedRectangle(rect, rootElement);
90
101
  } else if ((activeElement == null ? void 0 : activeElement.className) !== "link-input") {
91
102
  return null;
92
103
  }
@@ -157,6 +168,7 @@ function getSelectionAsMarkdown(editor, exportParams) {
157
168
  }
158
169
  export {
159
170
  fromWithinEditorRead,
171
+ getNodeRectangle,
160
172
  getSelectedNode,
161
173
  getSelectionAsMarkdown,
162
174
  getSelectionRectangle,
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "*.css"
12
12
  ],
13
13
  "type": "module",
14
- "version": "4.1.1",
14
+ "version": "4.2.0",
15
15
  "description": "React component for rich text markdown editing",
16
16
  "scripts": {
17
17
  "build": "vite build",