@atlaskit/editor-core 220.0.3 → 220.1.1

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 (243) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/codemods/createRenameVariableTransform.ts +17 -0
  3. package/codemods/findImportFromPackage.ts +54 -0
  4. package/codemods/migrates/createJSXRenameVariableToNestedKeyTransform.ts +43 -0
  5. package/codemods/migrates/createUpdateEditorToMigrationComponent.ts +25 -0
  6. package/codemods/migrates/next-remove-allow-more-text-colors-prop.ts +1 -1
  7. package/codemods/migrates/remove-config-panel-width-prop.ts +1 -1
  8. package/codemods/migrates/rename-editor-to-editor-migration-component.ts +1 -22
  9. package/codemods/migrates/rename-smartlinks-prop.ts +1 -40
  10. package/codemods/migrates/rename-unsafe-allowUndoRedoButtons-prop.ts +1 -1
  11. package/codemods/migrates/rename-unsafe-cards-prop.ts +1 -1
  12. package/codemods/utils.ts +0 -67
  13. package/dist/cjs/actions/isEmptyParagraph.js +12 -0
  14. package/dist/cjs/actions/temp-is-empty-document.js +2 -9
  15. package/dist/cjs/composable-editor/BaseThemeWrapper.js +24 -5
  16. package/dist/cjs/composable-editor/editor-internal-compiled.js +5 -1
  17. package/dist/cjs/composable-editor/editor-internal-emotion.js +6 -2
  18. package/dist/cjs/composable-editor/editor-internal.js +11 -2
  19. package/dist/cjs/create-editor/ReactEditorView/useDispatchTransaction.js +2 -1
  20. package/dist/cjs/create-editor/ReactEditorView.js +6 -4
  21. package/dist/cjs/create-editor/addMetadataAttributes.js +36 -0
  22. package/dist/cjs/create-editor/create-editor.js +0 -62
  23. package/dist/cjs/create-editor/create-plugins-list.js +2 -15
  24. package/dist/cjs/create-editor/create-schema.js +4 -35
  25. package/dist/cjs/create-editor/createErrorReporter.js +14 -0
  26. package/dist/cjs/create-editor/createPMPlugins.js +39 -0
  27. package/dist/cjs/create-editor/fixExcludes.js +22 -0
  28. package/dist/cjs/create-editor/getScrollGutterOptions.js +19 -0
  29. package/dist/cjs/create-editor/sortByRank.js +9 -0
  30. package/dist/cjs/entry-points/test-utils.js +4 -2
  31. package/dist/cjs/isElementBySelectorInDocument.js +15 -0
  32. package/dist/cjs/setTextSelection.js +12 -0
  33. package/dist/cjs/test-utils.js +1 -18
  34. package/dist/cjs/ui/Addon/checkForModal.js +25 -0
  35. package/dist/cjs/ui/Addon/click-area-helper.js +5 -52
  36. package/dist/cjs/ui/Addon/outsideProsemirrorEditorClickHandler.js +35 -0
  37. package/dist/cjs/ui/Appearance/Chromeless.js +4 -16
  38. package/dist/cjs/ui/Appearance/ChromelessEditorContainer.js +19 -0
  39. package/dist/cjs/ui/Appearance/FullPage/CustomToolbarWrapperMigration.js +13 -0
  40. package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
  41. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +5 -2
  42. package/dist/cjs/ui/Appearance/FullPage/MainToolbar.js +2 -15
  43. package/dist/cjs/ui/Appearance/FullPage/MainToolbarIconBeforeMigration.js +13 -0
  44. package/dist/cjs/ui/Appearance/FullPage/NonCustomToolbarWrapperMigration.js +13 -0
  45. package/dist/cjs/ui/EditorContentContainer/EditorContentContainer-compiled.js +15 -21
  46. package/dist/cjs/ui/EditorContentContainer/EditorContentContainer-emotion.js +12 -17
  47. package/dist/cjs/ui/EditorContentContainer/styles/mentions.js +19 -0
  48. package/dist/cjs/utils/combineQuickInsertProviders.js +16 -0
  49. package/dist/cjs/utils/extensions.js +0 -11
  50. package/dist/cjs/utils/getNodesVisibleInViewport.js +3 -12
  51. package/dist/cjs/utils/isNodeVisible.js +15 -0
  52. package/dist/cjs/utils/prepare-quick-insert-provider.js +2 -1
  53. package/dist/cjs/utils/validNode.js +14 -0
  54. package/dist/cjs/utils/validateNodes.js +3 -11
  55. package/dist/cjs/version-wrapper.js +1 -1
  56. package/dist/es2019/actions/isEmptyParagraph.js +6 -0
  57. package/dist/es2019/actions/temp-is-empty-document.js +1 -6
  58. package/dist/es2019/composable-editor/BaseThemeWrapper.js +19 -3
  59. package/dist/es2019/composable-editor/editor-internal-compiled.js +5 -1
  60. package/dist/es2019/composable-editor/editor-internal-emotion.js +6 -2
  61. package/dist/es2019/composable-editor/editor-internal.js +11 -2
  62. package/dist/es2019/create-editor/ReactEditorView/useDispatchTransaction.js +2 -1
  63. package/dist/es2019/create-editor/ReactEditorView.js +3 -1
  64. package/dist/es2019/create-editor/addMetadataAttributes.js +29 -0
  65. package/dist/es2019/create-editor/create-editor.js +0 -53
  66. package/dist/es2019/create-editor/create-plugins-list.js +1 -13
  67. package/dist/es2019/create-editor/create-schema.js +2 -31
  68. package/dist/es2019/create-editor/createErrorReporter.js +8 -0
  69. package/dist/es2019/create-editor/createPMPlugins.js +30 -0
  70. package/dist/es2019/create-editor/fixExcludes.js +12 -0
  71. package/dist/es2019/create-editor/getScrollGutterOptions.js +13 -0
  72. package/dist/es2019/create-editor/sortByRank.js +3 -0
  73. package/dist/es2019/entry-points/test-utils.js +3 -1
  74. package/dist/es2019/isElementBySelectorInDocument.js +9 -0
  75. package/dist/es2019/setTextSelection.js +8 -0
  76. package/dist/es2019/test-utils.js +0 -18
  77. package/dist/es2019/ui/Addon/checkForModal.js +19 -0
  78. package/dist/es2019/ui/Addon/click-area-helper.js +2 -53
  79. package/dist/es2019/ui/Addon/outsideProsemirrorEditorClickHandler.js +33 -0
  80. package/dist/es2019/ui/Appearance/Chromeless.js +2 -12
  81. package/dist/es2019/ui/Appearance/ChromelessEditorContainer.js +12 -0
  82. package/dist/es2019/ui/Appearance/FullPage/CustomToolbarWrapperMigration.js +5 -0
  83. package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +3 -2
  84. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +4 -1
  85. package/dist/es2019/ui/Appearance/FullPage/MainToolbar.js +1 -8
  86. package/dist/es2019/ui/Appearance/FullPage/MainToolbarIconBeforeMigration.js +5 -0
  87. package/dist/es2019/ui/Appearance/FullPage/NonCustomToolbarWrapperMigration.js +5 -0
  88. package/dist/es2019/ui/EditorContentContainer/EditorContentContainer-compiled.js +14 -19
  89. package/dist/es2019/ui/EditorContentContainer/EditorContentContainer-emotion.js +17 -14
  90. package/dist/es2019/ui/EditorContentContainer/styles/mentions.js +19 -0
  91. package/dist/es2019/utils/combineQuickInsertProviders.js +11 -0
  92. package/dist/es2019/utils/extensions.js +0 -11
  93. package/dist/es2019/utils/getNodesVisibleInViewport.js +1 -9
  94. package/dist/es2019/utils/isNodeVisible.js +9 -0
  95. package/dist/es2019/utils/prepare-quick-insert-provider.js +2 -1
  96. package/dist/es2019/utils/validNode.js +8 -0
  97. package/dist/es2019/utils/validateNodes.js +1 -8
  98. package/dist/es2019/version-wrapper.js +1 -1
  99. package/dist/esm/actions/isEmptyParagraph.js +6 -0
  100. package/dist/esm/actions/temp-is-empty-document.js +1 -6
  101. package/dist/esm/composable-editor/BaseThemeWrapper.js +23 -4
  102. package/dist/esm/composable-editor/editor-internal-compiled.js +5 -1
  103. package/dist/esm/composable-editor/editor-internal-emotion.js +6 -2
  104. package/dist/esm/composable-editor/editor-internal.js +11 -2
  105. package/dist/esm/create-editor/ReactEditorView/useDispatchTransaction.js +2 -1
  106. package/dist/esm/create-editor/ReactEditorView.js +3 -1
  107. package/dist/esm/create-editor/addMetadataAttributes.js +29 -0
  108. package/dist/esm/create-editor/create-editor.js +0 -58
  109. package/dist/esm/create-editor/create-plugins-list.js +1 -13
  110. package/dist/esm/create-editor/create-schema.js +2 -31
  111. package/dist/esm/create-editor/createErrorReporter.js +8 -0
  112. package/dist/esm/create-editor/createPMPlugins.js +32 -0
  113. package/dist/esm/create-editor/fixExcludes.js +16 -0
  114. package/dist/esm/create-editor/getScrollGutterOptions.js +13 -0
  115. package/dist/esm/create-editor/sortByRank.js +3 -0
  116. package/dist/esm/entry-points/test-utils.js +3 -1
  117. package/dist/esm/isElementBySelectorInDocument.js +9 -0
  118. package/dist/esm/setTextSelection.js +6 -0
  119. package/dist/esm/test-utils.js +0 -16
  120. package/dist/esm/ui/Addon/checkForModal.js +19 -0
  121. package/dist/esm/ui/Addon/click-area-helper.js +2 -49
  122. package/dist/esm/ui/Addon/outsideProsemirrorEditorClickHandler.js +29 -0
  123. package/dist/esm/ui/Appearance/Chromeless.js +2 -14
  124. package/dist/esm/ui/Appearance/ChromelessEditorContainer.js +14 -0
  125. package/dist/esm/ui/Appearance/FullPage/CustomToolbarWrapperMigration.js +7 -0
  126. package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +3 -2
  127. package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +4 -1
  128. package/dist/esm/ui/Appearance/FullPage/MainToolbar.js +1 -14
  129. package/dist/esm/ui/Appearance/FullPage/MainToolbarIconBeforeMigration.js +7 -0
  130. package/dist/esm/ui/Appearance/FullPage/NonCustomToolbarWrapperMigration.js +7 -0
  131. package/dist/esm/ui/EditorContentContainer/EditorContentContainer-compiled.js +18 -21
  132. package/dist/esm/ui/EditorContentContainer/EditorContentContainer-emotion.js +11 -11
  133. package/dist/esm/ui/EditorContentContainer/styles/mentions.js +19 -0
  134. package/dist/esm/utils/combineQuickInsertProviders.js +10 -0
  135. package/dist/esm/utils/extensions.js +0 -10
  136. package/dist/esm/utils/getNodesVisibleInViewport.js +1 -9
  137. package/dist/esm/utils/isNodeVisible.js +9 -0
  138. package/dist/esm/utils/prepare-quick-insert-provider.js +2 -1
  139. package/dist/esm/utils/validNode.js +8 -0
  140. package/dist/esm/utils/validateNodes.js +1 -8
  141. package/dist/esm/version-wrapper.js +1 -1
  142. package/dist/types/actions/isEmptyParagraph.d.ts +5 -0
  143. package/dist/types/actions/temp-is-empty-document.d.ts +0 -4
  144. package/dist/types/composable-editor/BaseThemeWrapper.d.ts +1 -1
  145. package/dist/types/composable-editor/editor-internal-compiled.d.ts +2 -1
  146. package/dist/types/composable-editor/editor-internal-emotion.d.ts +2 -1
  147. package/dist/types/composable-editor/editor-internal.d.ts +1 -1
  148. package/dist/types/create-editor/ReactEditorView.d.ts +2 -2
  149. package/dist/types/create-editor/addMetadataAttributes.d.ts +16 -0
  150. package/dist/types/create-editor/create-editor.d.ts +1 -17
  151. package/dist/types/create-editor/create-plugins-list.d.ts +1 -4
  152. package/dist/types/create-editor/create-schema.d.ts +0 -15
  153. package/dist/types/create-editor/create-universal-preset.d.ts +1 -1
  154. package/dist/types/create-editor/createErrorReporter.d.ts +3 -0
  155. package/dist/types/create-editor/createPMPlugins.d.ts +3 -0
  156. package/dist/types/create-editor/fixExcludes.d.ts +6 -0
  157. package/dist/types/create-editor/get-ui-component.d.ts +1 -1
  158. package/dist/types/create-editor/getScrollGutterOptions.d.ts +3 -0
  159. package/dist/types/create-editor/sortByRank.d.ts +5 -0
  160. package/dist/types/editor.d.ts +1 -1
  161. package/dist/types/entry-points/editor.d.ts +10 -1
  162. package/dist/types/entry-points/test-utils.d.ts +5 -2
  163. package/dist/types/index.d.ts +3 -1
  164. package/dist/types/isElementBySelectorInDocument.d.ts +7 -0
  165. package/dist/types/presets/universal.d.ts +1 -2
  166. package/dist/types/setTextSelection.d.ts +2 -0
  167. package/dist/types/test-utils.d.ts +1 -10
  168. package/dist/types/types/with-appearance-component.d.ts +1 -1
  169. package/dist/types/ui/Addon/ClickAreaBlock/contentComponentWrapper.d.ts +1 -1
  170. package/dist/types/ui/Addon/checkForModal.d.ts +10 -0
  171. package/dist/types/ui/Addon/click-area-helper.d.ts +0 -11
  172. package/dist/types/ui/Addon/outsideProsemirrorEditorClickHandler.d.ts +2 -0
  173. package/dist/types/ui/Appearance/Chromeless.d.ts +2 -10
  174. package/dist/types/ui/Appearance/ChromelessEditorContainer.d.ts +9 -0
  175. package/dist/types/ui/Appearance/Comment/Comment.d.ts +1 -1
  176. package/dist/types/ui/Appearance/FullPage/CustomToolbarWrapperMigration.d.ts +4 -0
  177. package/dist/types/ui/Appearance/FullPage/FullPage.d.ts +1 -1
  178. package/dist/types/ui/Appearance/FullPage/FullPageContentArea.d.ts +1 -1
  179. package/dist/types/ui/Appearance/FullPage/FullPageToolbar.d.ts +1 -1
  180. package/dist/types/ui/Appearance/FullPage/FullPageToolbarNext.d.ts +1 -1
  181. package/dist/types/ui/Appearance/FullPage/MainToolbar.d.ts +0 -10
  182. package/dist/types/ui/Appearance/FullPage/MainToolbarIconBeforeMigration.d.ts +4 -0
  183. package/dist/types/ui/Appearance/FullPage/NonCustomToolbarWrapperMigration.d.ts +4 -0
  184. package/dist/types/utils/combineQuickInsertProviders.d.ts +2 -0
  185. package/dist/types/utils/extensions.d.ts +0 -1
  186. package/dist/types/utils/getNodesVisibleInViewport.d.ts +0 -5
  187. package/dist/types/utils/isNodeVisible.d.ts +5 -0
  188. package/dist/types/utils/validNode.d.ts +2 -0
  189. package/dist/types/utils/validateNodes.d.ts +0 -1
  190. package/dist/types-ts4.5/actions/isEmptyParagraph.d.ts +5 -0
  191. package/dist/types-ts4.5/actions/temp-is-empty-document.d.ts +0 -4
  192. package/dist/types-ts4.5/composable-editor/BaseThemeWrapper.d.ts +1 -1
  193. package/dist/types-ts4.5/composable-editor/editor-internal-compiled.d.ts +2 -1
  194. package/dist/types-ts4.5/composable-editor/editor-internal-emotion.d.ts +2 -1
  195. package/dist/types-ts4.5/composable-editor/editor-internal.d.ts +1 -1
  196. package/dist/types-ts4.5/create-editor/ReactEditorView.d.ts +2 -2
  197. package/dist/types-ts4.5/create-editor/addMetadataAttributes.d.ts +16 -0
  198. package/dist/types-ts4.5/create-editor/create-editor.d.ts +1 -17
  199. package/dist/types-ts4.5/create-editor/create-plugins-list.d.ts +1 -4
  200. package/dist/types-ts4.5/create-editor/create-schema.d.ts +0 -15
  201. package/dist/types-ts4.5/create-editor/create-universal-preset.d.ts +1 -1
  202. package/dist/types-ts4.5/create-editor/createErrorReporter.d.ts +3 -0
  203. package/dist/types-ts4.5/create-editor/createPMPlugins.d.ts +3 -0
  204. package/dist/types-ts4.5/create-editor/fixExcludes.d.ts +6 -0
  205. package/dist/types-ts4.5/create-editor/get-ui-component.d.ts +1 -1
  206. package/dist/types-ts4.5/create-editor/getScrollGutterOptions.d.ts +3 -0
  207. package/dist/types-ts4.5/create-editor/sortByRank.d.ts +5 -0
  208. package/dist/types-ts4.5/editor.d.ts +1 -1
  209. package/dist/types-ts4.5/entry-points/editor.d.ts +10 -1
  210. package/dist/types-ts4.5/entry-points/test-utils.d.ts +5 -2
  211. package/dist/types-ts4.5/index.d.ts +3 -1
  212. package/dist/types-ts4.5/isElementBySelectorInDocument.d.ts +7 -0
  213. package/dist/types-ts4.5/presets/universal.d.ts +1 -2
  214. package/dist/types-ts4.5/setTextSelection.d.ts +2 -0
  215. package/dist/types-ts4.5/test-utils.d.ts +1 -10
  216. package/dist/types-ts4.5/types/with-appearance-component.d.ts +1 -1
  217. package/dist/types-ts4.5/ui/Addon/ClickAreaBlock/contentComponentWrapper.d.ts +1 -1
  218. package/dist/types-ts4.5/ui/Addon/checkForModal.d.ts +10 -0
  219. package/dist/types-ts4.5/ui/Addon/click-area-helper.d.ts +0 -11
  220. package/dist/types-ts4.5/ui/Addon/outsideProsemirrorEditorClickHandler.d.ts +2 -0
  221. package/dist/types-ts4.5/ui/Appearance/Chromeless.d.ts +2 -10
  222. package/dist/types-ts4.5/ui/Appearance/ChromelessEditorContainer.d.ts +9 -0
  223. package/dist/types-ts4.5/ui/Appearance/Comment/Comment.d.ts +1 -1
  224. package/dist/types-ts4.5/ui/Appearance/FullPage/CustomToolbarWrapperMigration.d.ts +4 -0
  225. package/dist/types-ts4.5/ui/Appearance/FullPage/FullPage.d.ts +1 -1
  226. package/dist/types-ts4.5/ui/Appearance/FullPage/FullPageContentArea.d.ts +1 -1
  227. package/dist/types-ts4.5/ui/Appearance/FullPage/FullPageToolbar.d.ts +1 -1
  228. package/dist/types-ts4.5/ui/Appearance/FullPage/FullPageToolbarNext.d.ts +1 -1
  229. package/dist/types-ts4.5/ui/Appearance/FullPage/MainToolbar.d.ts +0 -10
  230. package/dist/types-ts4.5/ui/Appearance/FullPage/MainToolbarIconBeforeMigration.d.ts +4 -0
  231. package/dist/types-ts4.5/ui/Appearance/FullPage/NonCustomToolbarWrapperMigration.d.ts +4 -0
  232. package/dist/types-ts4.5/utils/combineQuickInsertProviders.d.ts +2 -0
  233. package/dist/types-ts4.5/utils/extensions.d.ts +0 -1
  234. package/dist/types-ts4.5/utils/getNodesVisibleInViewport.d.ts +0 -5
  235. package/dist/types-ts4.5/utils/isNodeVisible.d.ts +5 -0
  236. package/dist/types-ts4.5/utils/validNode.d.ts +2 -0
  237. package/dist/types-ts4.5/utils/validateNodes.d.ts +0 -1
  238. package/package.json +16 -16
  239. package/dist/cjs/types/index.js +0 -1
  240. package/dist/es2019/types/index.js +0 -0
  241. package/dist/esm/types/index.js +0 -0
  242. package/dist/types/types/index.d.ts +0 -9
  243. package/dist/types-ts4.5/types/index.d.ts +0 -9
@@ -88,6 +88,25 @@ export const mentionNodeStyles = css({
88
88
  '&:active': {
89
89
  background: "var(--ds-background-brand-bold-pressed, #144794)"
90
90
  }
91
+ },
92
+ // Disabled variant — mirrors `MentionType.DISABLED` in
93
+ // `packages/elements/mention/src/components/Mention/PrimitiveMention.tsx`.
94
+ // Hover / active states are intentionally flat: a disabled chip should
95
+ // not respond to mouse interaction. The chip is still keyboard-focusable
96
+ // (see `MentionNodeView.setClassList`) so the focus ring is still
97
+ // allowed to render via `:focus-visible`.
98
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
99
+ '.editor-mention-primitive.mention-disabled': {
100
+ background: "var(--ds-background-disabled, #0515240F)",
101
+ border: '1px solid transparent',
102
+ color: "var(--ds-text-disabled, #080F214A)",
103
+ cursor: 'default',
104
+ '&:hover': {
105
+ background: "var(--ds-background-disabled, #0515240F)"
106
+ },
107
+ '&:active': {
108
+ background: "var(--ds-background-disabled, #0515240F)"
109
+ }
91
110
  }
92
111
  });
93
112
 
@@ -0,0 +1,11 @@
1
+ import { combineProviders } from '@atlaskit/editor-common/provider-helpers';
2
+ export function combineQuickInsertProviders(quickInsertProviders) {
3
+ const {
4
+ invokeList
5
+ } = combineProviders(quickInsertProviders);
6
+ return {
7
+ getItems() {
8
+ return invokeList('getItems');
9
+ }
10
+ };
11
+ }
@@ -2,7 +2,6 @@ import React from 'react';
2
2
  import Loadable from 'react-loadable';
3
3
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, fireAnalyticsEvent, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { getQuickInsertItemsFromModule, resolveImport } from '@atlaskit/editor-common/extensions';
5
- import { combineProviders } from '@atlaskit/editor-common/provider-helpers';
6
5
  import { findInsertLocation } from '@atlaskit/editor-common/utils/analytics';
7
6
  import { fg } from '@atlaskit/platform-feature-flags';
8
7
 
@@ -130,14 +129,4 @@ export async function extensionProviderToQuickInsertProvider(extensionProvider,
130
129
  return Promise.all(quickInsertItems);
131
130
  }
132
131
  };
133
- }
134
- export function combineQuickInsertProviders(quickInsertProviders) {
135
- const {
136
- invokeList
137
- } = combineProviders(quickInsertProviders);
138
- return {
139
- getItems() {
140
- return invokeList('getItems');
141
- }
142
- };
143
132
  }
@@ -1,12 +1,4 @@
1
- /**
2
- * Check if a DOM element is visible within the viewport. We deem a node visible if the top left corner coordinate is within the viewport.
3
- * This may not look visible, and may include a node that looks below the fold – but it's more than 0 pixels within the viewport.
4
- */
5
- export const isNodeVisible = node => {
6
- const rect = node.getBoundingClientRect();
7
- const isVisible = rect.x >= 0 && rect.x < window.innerWidth && rect.y >= 0 && rect.y < window.innerHeight;
8
- return isVisible;
9
- };
1
+ import { isNodeVisible } from './isNodeVisible';
10
2
 
11
3
  /**
12
4
  * Get visible nodes in viewport by looping through the first N nodes (MAX_NODES_TO_COUNT)
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Check if a DOM element is visible within the viewport. We deem a node visible if the top left corner coordinate is within the viewport.
3
+ * This may not look visible, and may include a node that looks below the fold – but it's more than 0 pixels within the viewport.
4
+ */
5
+ export const isNodeVisible = node => {
6
+ const rect = node.getBoundingClientRect();
7
+ const isVisible = rect.x >= 0 && rect.x < window.innerWidth && rect.y >= 0 && rect.y < window.innerHeight;
8
+ return isVisible;
9
+ };
@@ -1,4 +1,5 @@
1
- import { combineQuickInsertProviders, extensionProviderToQuickInsertProvider } from './extensions';
1
+ import { combineQuickInsertProviders } from './combineQuickInsertProviders';
2
+ import { extensionProviderToQuickInsertProvider } from './extensions';
2
3
 
3
4
  /**
4
5
  *
@@ -0,0 +1,8 @@
1
+ export const validNode = node => {
2
+ try {
3
+ node.check();
4
+ } catch (error) {
5
+ return false;
6
+ }
7
+ return true;
8
+ };
@@ -1,11 +1,4 @@
1
- export const validNode = node => {
2
- try {
3
- node.check();
4
- } catch (error) {
5
- return false;
6
- }
7
- return true;
8
- };
1
+ import { validNode } from './validNode';
9
2
 
10
3
  /** Validates prosemirror nodes, and returns true only if all nodes are valid */
11
4
  export const validateNodes = nodes => nodes.every(validNode);
@@ -1,2 +1,2 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "220.0.2";
2
+ export const version = "220.1.0";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Checks if node is an empty paragraph.
3
+ */
4
+ export function isEmptyParagraph(node) {
5
+ return !!node && node.type.name === 'paragraph' && !node.childCount;
6
+ }
@@ -5,12 +5,7 @@
5
5
  * help decouple it from editor-common
6
6
  */
7
7
 
8
- /**
9
- * Checks if node is an empty paragraph.
10
- */
11
- export function isEmptyParagraph(node) {
12
- return !!node && node.type.name === 'paragraph' && !node.childCount;
13
- }
8
+ import { isEmptyParagraph } from './isEmptyParagraph';
14
9
 
15
10
  /**
16
11
  * Checks if a node looks like an empty document
@@ -3,11 +3,24 @@ import React, { useMemo } from 'react';
3
3
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
4
4
  import { ThemeProvider } from '@emotion/react';
5
5
  import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
6
+ import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
7
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
8
  // Default value from: `import { fontSize } from '@atlaskit/theme/constants';`
7
9
  var defaultFontSize = 14;
8
- export function BaseThemeWrapper(_ref) {
9
- var baseFontSize = _ref.baseFontSize,
10
- children = _ref.children;
10
+
11
+ // No-op variant used when the static-css experiment is enabled. Editor consumers
12
+ // no longer read theme.baseFontSize / theme.layoutMaxWidth via Emotion's useTheme(),
13
+ // so no <ThemeProvider> is required in the React tree.
14
+ var BaseThemeWrapperNoop = function BaseThemeWrapperNoop(_ref) {
15
+ var children = _ref.children;
16
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
17
+ };
18
+
19
+ // Legacy variant keeping the original Emotion <ThemeProvider> behaviour for
20
+ // callers that still rely on theme.baseFontSize / theme.layoutMaxWidth.
21
+ var BaseThemeWrapperLegacy = function BaseThemeWrapperLegacy(_ref2) {
22
+ var baseFontSize = _ref2.baseFontSize,
23
+ children = _ref2.children;
11
24
  var memoizedTheme = useMemo(function () {
12
25
  return {
13
26
  baseFontSize: baseFontSize || defaultFontSize,
@@ -17,4 +30,10 @@ export function BaseThemeWrapper(_ref) {
17
30
  return /*#__PURE__*/React.createElement(ThemeProvider, {
18
31
  theme: memoizedTheme
19
32
  }, children);
20
- }
33
+ };
34
+
35
+ // Gated at module load — when the experiment is enabled, this becomes a no-op
36
+ // wrapper; otherwise it preserves today's Emotion <ThemeProvider> behaviour.
37
+ export var BaseThemeWrapper = componentWithCondition(function () {
38
+ return expValEquals('platform_editor_core_non_ecc_static_css', 'isEnabled', true);
39
+ }, BaseThemeWrapperNoop, BaseThemeWrapperLegacy);
@@ -12,8 +12,12 @@ var editorContainerCompiledStyles = {
12
12
  root: "_kqswh2mm _1bsb1osq _4t3i1osq"
13
13
  };
14
14
  export var EditorInternalContainerCompiled = function EditorInternalContainerCompiled(_ref) {
15
- var children = _ref.children;
15
+ var children = _ref.children,
16
+ fontSize = _ref.fontSize;
16
17
  return /*#__PURE__*/React.createElement("div", {
18
+ style: {
19
+ '--ak-editor-base-font-size': "".concat(fontSize, "px")
20
+ },
17
21
  className: ax([editorContainerCompiledStyles.root])
18
22
  }, children);
19
23
  };
@@ -17,8 +17,12 @@ var editorContainerEmotionStyles = css({
17
17
  height: '100%'
18
18
  });
19
19
  export var EditorInternalContainerEmotion = function EditorInternalContainerEmotion(_ref) {
20
- var children = _ref.children;
20
+ var children = _ref.children,
21
+ fontSize = _ref.fontSize;
21
22
  return jsx("div", {
22
- css: editorContainerEmotionStyles
23
+ css: editorContainerEmotionStyles,
24
+ style: {
25
+ '--ak-editor-base-font-size': "".concat(fontSize, "px")
26
+ }
23
27
  }, children);
24
28
  };
@@ -5,6 +5,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
5
5
  import React, { Fragment, memo } from 'react';
6
6
  import { ACTION, ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
7
7
  import { usePortalProvider } from '@atlaskit/editor-common/portal';
8
+ import { editorFontSize } from '@atlaskit/editor-shared-styles';
8
9
  import { fg } from '@atlaskit/platform-feature-flags';
9
10
  import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
10
11
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -58,6 +59,12 @@ export var EditorInternal = /*#__PURE__*/memo(function (_ref) {
58
59
  nodeViewPortalProviderAPI = _usePortalProvider4[0],
59
60
  NodeViewPortalRenderer = _usePortalProvider4[1];
60
61
  var propsToIgnore = expValEquals('platform_editor_perf_lint_cleanup', 'isEnabled', true) ? DEFAULT_VALUE_PROP_TO_IGNORE : ['defaultValue'];
62
+ var baseFontSize = getBaseFontSize(props.appearance, props.contentMode);
63
+ var fontSize = expValEquals('platform_editor_core_non_ecc_static_css', 'isEnabled', true) || expValEquals('platform_editor_core_static_css', 'isEnabled', true) ? editorFontSize({
64
+ theme: {
65
+ baseFontSize: baseFontSize
66
+ }
67
+ }) : undefined;
61
68
  return /*#__PURE__*/React.createElement(Fragment, null, renderTrackingEnabled && /*#__PURE__*/React.createElement(RenderTracking, {
62
69
  componentProps: props,
63
70
  action: ACTION.RE_RENDERED,
@@ -70,7 +77,9 @@ export var EditorInternal = /*#__PURE__*/memo(function (_ref) {
70
77
  createAnalyticsEvent: createAnalyticsEvent,
71
78
  contextIdentifierProvider: props.contextIdentifierProvider,
72
79
  featureFlags: featureFlags
73
- }, /*#__PURE__*/React.createElement(EditorInternalContainerMigration, null, /*#__PURE__*/React.createElement(EditorContext, {
80
+ }, /*#__PURE__*/React.createElement(EditorInternalContainerMigration, {
81
+ fontSize: fontSize
82
+ }, /*#__PURE__*/React.createElement(EditorContext, {
74
83
  editorActions: editorActions
75
84
  }, /*#__PURE__*/React.createElement(IntlProviderIfMissingWrapper, null, /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(ReactEditorViewNext, {
76
85
  editorProps: overriddenEditorProps,
@@ -94,7 +103,7 @@ export var EditorInternal = /*#__PURE__*/memo(function (_ref) {
94
103
  editorRef = _ref2.editorRef,
95
104
  editorAPI = _ref2.editorAPI;
96
105
  return /*#__PURE__*/React.createElement(BaseThemeWrapper, {
97
- baseFontSize: getBaseFontSize(props.appearance, props.contentMode)
106
+ baseFontSize: baseFontSize
98
107
  }, /*#__PURE__*/React.createElement(AppearanceComponent, {
99
108
  innerRef: editorRef,
100
109
  editorAPI: editorAPI
@@ -6,7 +6,8 @@ import { startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-m
6
6
  import { findChangedNodesFromTransaction } from '../../utils/findChangedNodesFromTransaction';
7
7
  import { freezeUnsafeTransactionProperties } from '../../utils/performance/safer-transactions';
8
8
  import { EVENT_NAME_ON_CHANGE } from '../../utils/performance/track-transactions';
9
- import { validateNodes, validNode } from '../../utils/validateNodes';
9
+ import { validateNodes } from '../../utils/validateNodes';
10
+ import { validNode } from '../../utils/validNode';
10
11
  export var useDispatchTransaction = function useDispatchTransaction(_ref) {
11
12
  var onChange = _ref.onChange,
12
13
  dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
@@ -44,9 +44,11 @@ import { isFullPage } from '../utils/is-full-page';
44
44
  import { RenderTracking } from '../utils/performance/components/RenderTracking';
45
45
  import measurements from '../utils/performance/measure-enum';
46
46
  import { PROSEMIRROR_RENDERED_DEGRADED_SEVERITY_THRESHOLD, PROSEMIRROR_RENDERED_NORMAL_SEVERITY_THRESHOLD } from './consts';
47
- import { createErrorReporter, createPMPlugins, processPluginsList } from './create-editor';
47
+ import { processPluginsList } from './create-editor';
48
48
  import createPluginsList from './create-plugins-list';
49
49
  import { createSchema } from './create-schema';
50
+ import { createErrorReporter } from './createErrorReporter';
51
+ import { createPMPlugins } from './createPMPlugins';
50
52
  import { filterPluginsForReconfigure } from './filter-plugins-for-reconfigure';
51
53
  import { editorMessages } from './messages';
52
54
  import { focusEditorElement } from './ReactEditorView/focusEditorElement';
@@ -0,0 +1,29 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
2
+ import { createProseMirrorMetadata } from '@atlaskit/editor-common/prosemirror-dom-metadata';
3
+ /**
4
+ * 🧱 Internal Helper Function: Editor FE Platform
5
+ *
6
+ * Adds generic metadata attributes to a DOMOutputSpec array based on the provided node or mark.
7
+ * This function ensures that the DOMOutputSpec is annotated with ProseMirror-specific metadata.
8
+ *
9
+ * @param {object} params - Parameters object.
10
+ * @param {PMNode | PMMark} params.nodeOrMark - The ProseMirror node or mark to extract metadata from.
11
+ * @param {DOMOutputSpec} params.domSpec - The DOMOutputSpec to which attributes will be added.
12
+ * @returns {DOMOutputSpec} The modified DOMOutputSpec with additional metadata.
13
+ */
14
+ export var addMetadataAttributes = function addMetadataAttributes(_ref) {
15
+ var nodeOrMark = _ref.nodeOrMark,
16
+ domSpec = _ref.domSpec;
17
+ if (!Array.isArray(domSpec)) {
18
+ return domSpec;
19
+ }
20
+ var maybeDefinedAttributes = domSpec[1];
21
+ var metadata = createProseMirrorMetadata(nodeOrMark);
22
+ var hasDefinedAttributes = _typeof(maybeDefinedAttributes) === 'object' && !Array.isArray(maybeDefinedAttributes);
23
+ if (hasDefinedAttributes) {
24
+ domSpec[1] = Object.assign(maybeDefinedAttributes, metadata);
25
+ } else {
26
+ domSpec.splice(1, 0, metadata);
27
+ }
28
+ return domSpec;
29
+ };
@@ -1,28 +1,4 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- import { ErrorReporter } from '@atlaskit/editor-common/error-reporter';
3
- import { sortByOrder } from '@atlaskit/editor-common/legacy-rank-plugins';
4
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
- import { createEditorNativeAnchorSupportPlugin } from './editorNativeAnchorSupportPlugin';
6
- import { createEditorStateNotificationPlugin } from './editorStateNotificationPlugin';
7
- export function sortByRank(a, b) {
8
- return a.rank - b.rank;
9
- }
10
- export function fixExcludes(marks) {
11
- var markKeys = Object.keys(marks);
12
- var markGroups = new Set(markKeys.map(function (mark) {
13
- return marks[mark].group;
14
- }));
15
- markKeys.forEach(function (markKey) {
16
- var mark = marks[markKey];
17
- if (mark.excludes) {
18
- // eslint-disable-next-line @atlassian/perf-linting/no-expensive-split-replace -- Ignored via go/ees017 (to be fixed)
19
- mark.excludes = mark.excludes.split(' ').filter(function (group) {
20
- return markGroups.has(group);
21
- }).join(' ');
22
- }
23
- });
24
- return marks;
25
- }
26
2
  export function processPluginsList(plugins) {
27
3
  /**
28
4
  * First pass to collect pluginsOptions
@@ -91,38 +67,4 @@ export function processPluginsList(plugins) {
91
67
  secondaryToolbarComponents: [],
92
68
  onEditorViewStateUpdatedCallbacks: []
93
69
  });
94
- }
95
- export function createPMPlugins(config) {
96
- var editorConfig = config.editorConfig;
97
- var pmPlugins = editorConfig.pmPlugins.sort(sortByOrder('plugins')).map(function (_ref) {
98
- var plugin = _ref.plugin;
99
- return plugin({
100
- schema: config.schema,
101
- dispatch: config.dispatch,
102
- eventDispatcher: config.eventDispatcher,
103
- providerFactory: config.providerFactory,
104
- errorReporter: config.errorReporter,
105
- portalProviderAPI: config.portalProviderAPI,
106
- nodeViewPortalProviderAPI: config.nodeViewPortalProviderAPI,
107
- dispatchAnalyticsEvent: config.dispatchAnalyticsEvent,
108
- featureFlags: config.featureFlags || {},
109
- getIntl: config.getIntl
110
- });
111
- }).filter(function (plugin) {
112
- return typeof plugin !== 'undefined';
113
- });
114
- if (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
115
- pmPlugins.push(createEditorNativeAnchorSupportPlugin(config.schema));
116
- }
117
- if (config.onEditorStateUpdated !== undefined) {
118
- return [createEditorStateNotificationPlugin(config.onEditorStateUpdated, config.editorConfig.onEditorViewStateUpdatedCallbacks)].concat(_toConsumableArray(pmPlugins));
119
- }
120
- return pmPlugins;
121
- }
122
- export function createErrorReporter(errorReporterHandler) {
123
- var errorReporter = new ErrorReporter();
124
- if (errorReporterHandler) {
125
- errorReporter.handler = errorReporterHandler;
126
- }
127
- return errorReporter;
128
70
  }
@@ -2,23 +2,11 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  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; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).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; }
4
4
  import { createFeatureFlagsFromProps } from '../utils/feature-flags-from-props';
5
- import { isFullPage as fullPageCheck } from '../utils/is-full-page';
5
+ import { getScrollGutterOptions } from './getScrollGutterOptions';
6
6
  var isCodeBlockAllowed = function isCodeBlockAllowed(options) {
7
7
  var exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
8
8
  return exclude.indexOf('codeBlock') === -1;
9
9
  };
10
- export function getScrollGutterOptions(props) {
11
- var appearance = props.appearance;
12
- if (fullPageCheck(appearance)) {
13
- // Full Page appearance uses a scrollable div wrapper.
14
- return {
15
- getScrollElement: function getScrollElement() {
16
- return document.querySelector('.fabric-editor-popup-scroll-parent');
17
- }
18
- };
19
- }
20
- return undefined;
21
- }
22
10
  export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent
23
11
  // Omit placeholder since it's an existing prop in `DefaultPresetPluginOptions` and will get overridden there
24
12
  ) {
@@ -1,37 +1,8 @@
1
- import _typeof from "@babel/runtime/helpers/typeof";
2
1
  import { sanitizeNodes } from '@atlaskit/adf-schema/schema';
3
2
  import { sortByOrder } from '@atlaskit/editor-common/legacy-rank-plugins';
4
- import { createProseMirrorMetadata } from '@atlaskit/editor-common/prosemirror-dom-metadata';
5
3
  import { Schema } from '@atlaskit/editor-prosemirror/model';
6
- import { fixExcludes } from './create-editor';
7
- /**
8
- * 🧱 Internal Helper Function: Editor FE Platform
9
- *
10
- * Adds generic metadata attributes to a DOMOutputSpec array based on the provided node or mark.
11
- * This function ensures that the DOMOutputSpec is annotated with ProseMirror-specific metadata.
12
- *
13
- * @param {object} params - Parameters object.
14
- * @param {PMNode | PMMark} params.nodeOrMark - The ProseMirror node or mark to extract metadata from.
15
- * @param {DOMOutputSpec} params.domSpec - The DOMOutputSpec to which attributes will be added.
16
- * @returns {DOMOutputSpec} The modified DOMOutputSpec with additional metadata.
17
- */
18
- export var addMetadataAttributes = function addMetadataAttributes(_ref) {
19
- var nodeOrMark = _ref.nodeOrMark,
20
- domSpec = _ref.domSpec;
21
- if (!Array.isArray(domSpec)) {
22
- return domSpec;
23
- }
24
- var maybeDefinedAttributes = domSpec[1];
25
- var metadata = createProseMirrorMetadata(nodeOrMark);
26
- var hasDefinedAttributes = _typeof(maybeDefinedAttributes) === 'object' && !Array.isArray(maybeDefinedAttributes);
27
- if (hasDefinedAttributes) {
28
- domSpec[1] = Object.assign(maybeDefinedAttributes, metadata);
29
- } else {
30
- domSpec.splice(1, 0, metadata);
31
- }
32
- return domSpec;
33
- };
34
-
4
+ import { addMetadataAttributes } from './addMetadataAttributes';
5
+ import { fixExcludes } from './fixExcludes';
35
6
  /**
36
7
  * 🧱 Internal Helper Function: Editor FE Platform
37
8
  *
@@ -0,0 +1,8 @@
1
+ import { ErrorReporter } from '@atlaskit/editor-common/error-reporter';
2
+ export function createErrorReporter(errorReporterHandler) {
3
+ var errorReporter = new ErrorReporter();
4
+ if (errorReporterHandler) {
5
+ errorReporter.handler = errorReporterHandler;
6
+ }
7
+ return errorReporter;
8
+ }
@@ -0,0 +1,32 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import { sortByOrder } from '@atlaskit/editor-common/legacy-rank-plugins';
3
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
+ import { createEditorNativeAnchorSupportPlugin } from './editorNativeAnchorSupportPlugin';
5
+ import { createEditorStateNotificationPlugin } from './editorStateNotificationPlugin';
6
+ export function createPMPlugins(config) {
7
+ var editorConfig = config.editorConfig;
8
+ var pmPlugins = editorConfig.pmPlugins.sort(sortByOrder('plugins')).map(function (_ref) {
9
+ var plugin = _ref.plugin;
10
+ return plugin({
11
+ schema: config.schema,
12
+ dispatch: config.dispatch,
13
+ eventDispatcher: config.eventDispatcher,
14
+ providerFactory: config.providerFactory,
15
+ errorReporter: config.errorReporter,
16
+ portalProviderAPI: config.portalProviderAPI,
17
+ nodeViewPortalProviderAPI: config.nodeViewPortalProviderAPI,
18
+ dispatchAnalyticsEvent: config.dispatchAnalyticsEvent,
19
+ featureFlags: config.featureFlags || {},
20
+ getIntl: config.getIntl
21
+ });
22
+ }).filter(function (plugin) {
23
+ return typeof plugin !== 'undefined';
24
+ });
25
+ if (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
26
+ pmPlugins.push(createEditorNativeAnchorSupportPlugin(config.schema));
27
+ }
28
+ if (config.onEditorStateUpdated !== undefined) {
29
+ return [createEditorStateNotificationPlugin(config.onEditorStateUpdated, config.editorConfig.onEditorViewStateUpdatedCallbacks)].concat(_toConsumableArray(pmPlugins));
30
+ }
31
+ return pmPlugins;
32
+ }
@@ -0,0 +1,16 @@
1
+ export function fixExcludes(marks) {
2
+ var markKeys = Object.keys(marks);
3
+ var markGroups = new Set(markKeys.map(function (mark) {
4
+ return marks[mark].group;
5
+ }));
6
+ markKeys.forEach(function (markKey) {
7
+ var mark = marks[markKey];
8
+ if (mark.excludes) {
9
+ // eslint-disable-next-line @atlassian/perf-linting/no-expensive-split-replace -- Ignored via go/ees017 (to be fixed)
10
+ mark.excludes = mark.excludes.split(' ').filter(function (group) {
11
+ return markGroups.has(group);
12
+ }).join(' ');
13
+ }
14
+ });
15
+ return marks;
16
+ }
@@ -0,0 +1,13 @@
1
+ import { isFullPage as fullPageCheck } from '../utils/is-full-page';
2
+ export function getScrollGutterOptions(props) {
3
+ var appearance = props.appearance;
4
+ if (fullPageCheck(appearance)) {
5
+ // Full Page appearance uses a scrollable div wrapper.
6
+ return {
7
+ getScrollElement: function getScrollElement() {
8
+ return document.querySelector('.fabric-editor-popup-scroll-parent');
9
+ }
10
+ };
11
+ }
12
+ return undefined;
13
+ }
@@ -0,0 +1,3 @@
1
+ export function sortByRank(a, b) {
2
+ return a.rank - b.rank;
3
+ }
@@ -1,2 +1,4 @@
1
1
  /* eslint-disable @atlaskit/editor/no-re-export */
2
- export { createPMSchemaAndPlugins, isElementBySelectorInDocument, setTextSelection } from '../test-utils';
2
+ export { isElementBySelectorInDocument } from '../isElementBySelectorInDocument';
3
+ export { setTextSelection } from '../setTextSelection';
4
+ export { createPMSchemaAndPlugins } from '../test-utils';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Given a selector, checks if an element matching the selector exists in the
3
+ * document.
4
+ * @param selector
5
+ * @returns true if element matching selector exists in document, false otherwise
6
+ */
7
+ export var isElementBySelectorInDocument = function isElementBySelectorInDocument(selector) {
8
+ return Boolean(document.querySelector(selector));
9
+ };
@@ -0,0 +1,6 @@
1
+ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
2
+ export function setTextSelection(view, anchor, head) {
3
+ var state = view.state;
4
+ var tr = state.tr.setSelection(TextSelection.create(state.doc, anchor, head));
5
+ view.dispatch(tr);
6
+ }
@@ -8,7 +8,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
8
8
  import { sortByOrder } from '@atlaskit/editor-common/legacy-rank-plugins';
9
9
  import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
10
10
  import { basePlugin } from '@atlaskit/editor-plugins/base';
11
- import { TextSelection } from '@atlaskit/editor-prosemirror/state';
12
11
  import { createSchema } from './create-editor/create-schema';
13
12
  function lightProcessPluginsList(editorPlugins) {
14
13
  /**
@@ -96,19 +95,4 @@ export var createPMSchemaAndPlugins = function createPMSchemaAndPlugins() {
96
95
  editorConfig: editorConfig
97
96
  };
98
97
  };
99
- };
100
- export function setTextSelection(view, anchor, head) {
101
- var state = view.state;
102
- var tr = state.tr.setSelection(TextSelection.create(state.doc, anchor, head));
103
- view.dispatch(tr);
104
- }
105
-
106
- /**
107
- * Given a selector, checks if an element matching the selector exists in the
108
- * document.
109
- * @param selector
110
- * @returns true if element matching selector exists in document, false otherwise
111
- */
112
- export var isElementBySelectorInDocument = function isElementBySelectorInDocument(selector) {
113
- return Boolean(document.querySelector(selector));
114
98
  };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @see ED-14699 - check if editor is inside a modal to continue to bring cursor to input when
3
+ * any part of the editor container is clicked
4
+ *
5
+ * Handles two cases when a click event is fired:
6
+ *
7
+ * 1. if editor (e.g. comment inside of Jira ticket view) is inside modal then ensure focus and cursor is brought to the input
8
+ * 2. if another modal is open (e.g. delete confirmation modal for confluence table) then ignore clicks as they shouldn't influence editor state
9
+ */
10
+ export var checkForModal = function checkForModal(target) {
11
+ var modalDialog = target === null || target === void 0 ? void 0 : target.closest('[role=dialog]');
12
+ if (modalDialog) {
13
+ // return false if not an editor inside modal, otherwise return true
14
+ return !!(modalDialog !== null && modalDialog !== void 0 && modalDialog.querySelector('.akEditor'));
15
+ }
16
+
17
+ // no modal present so we can return true
18
+ return true;
19
+ };