@atlaskit/editor-core 187.47.9 → 187.48.2

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 (190) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/{editor-next → composable-editor}/editor-internal.js +2 -22
  3. package/dist/cjs/{editor-next/index.js → composable-editor/editor.js} +16 -10
  4. package/dist/cjs/composable-editor.js +2 -3
  5. package/dist/cjs/editor.js +4 -4
  6. package/dist/cjs/index.js +7 -7
  7. package/dist/cjs/labs/next/presets/default.js +2 -2
  8. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +3 -70
  9. package/dist/cjs/plugins/floating-toolbar/utils.js +0 -41
  10. package/dist/cjs/plugins/index.js +0 -7
  11. package/dist/cjs/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +28 -11
  12. package/dist/cjs/test-utils.js +2 -2
  13. package/dist/cjs/ui/CollapsedEditor/index.js +3 -3
  14. package/dist/cjs/version-wrapper.js +1 -1
  15. package/dist/es2019/{editor-next → composable-editor}/editor-internal.js +1 -23
  16. package/dist/es2019/{editor-next/index.js → composable-editor/editor.js} +15 -7
  17. package/dist/es2019/composable-editor.js +1 -1
  18. package/dist/es2019/editor.js +4 -4
  19. package/dist/es2019/index.js +1 -1
  20. package/dist/es2019/labs/next/presets/default.js +1 -1
  21. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +1 -52
  22. package/dist/es2019/plugins/floating-toolbar/utils.js +0 -36
  23. package/dist/es2019/plugins/index.js +0 -1
  24. package/dist/es2019/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +21 -4
  25. package/dist/es2019/test-utils.js +1 -1
  26. package/dist/es2019/ui/CollapsedEditor/index.js +3 -3
  27. package/dist/es2019/version-wrapper.js +1 -1
  28. package/dist/esm/{editor-next → composable-editor}/editor-internal.js +1 -20
  29. package/dist/esm/{editor-next/index.js → composable-editor/editor.js} +15 -7
  30. package/dist/esm/composable-editor.js +1 -1
  31. package/dist/esm/editor.js +4 -4
  32. package/dist/esm/index.js +1 -1
  33. package/dist/esm/labs/next/presets/default.js +1 -1
  34. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +1 -66
  35. package/dist/esm/plugins/floating-toolbar/utils.js +0 -37
  36. package/dist/esm/plugins/index.js +0 -1
  37. package/dist/esm/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +21 -4
  38. package/dist/esm/test-utils.js +1 -1
  39. package/dist/esm/ui/CollapsedEditor/index.js +3 -3
  40. package/dist/esm/version-wrapper.js +1 -1
  41. package/dist/{types-ts4.5/editor-next → types/composable-editor}/editor-internal.d.ts +4 -13
  42. package/dist/{types-ts4.5/editor-next/index.d.ts → types/composable-editor/editor.d.ts} +2 -4
  43. package/dist/types/{editor-next → composable-editor}/hooks/useMeasureEditorMountTime.d.ts +3 -3
  44. package/dist/types/{editor-next → composable-editor}/utils/getBaseFontSize.d.ts +1 -1
  45. package/dist/{types-ts4.5/editor-next → types/composable-editor}/utils/getProvidersFromEditorProps.d.ts +2 -2
  46. package/dist/types/{editor-next → composable-editor}/utils/sendDurationAnalytics.d.ts +4 -4
  47. package/dist/{types-ts4.5/editor-next → types/composable-editor}/utils/trackEditorActions.d.ts +3 -3
  48. package/dist/types/composable-editor.d.ts +1 -1
  49. package/dist/types/create-editor/create-plugins-list.d.ts +1 -1
  50. package/dist/types/index.d.ts +1 -1
  51. package/dist/types/labs/next/presets/default.d.ts +1 -1
  52. package/dist/types/plugins/code-block/ide-ux/quote-handling.d.ts +1 -1
  53. package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/commands.d.ts +1 -1
  54. package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin.d.ts +1 -1
  55. package/dist/types/plugins/floating-toolbar/ui/Select.d.ts +1 -1
  56. package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +3 -4
  57. package/dist/types/plugins/floating-toolbar/utils.d.ts +0 -2
  58. package/dist/types/plugins/index.d.ts +0 -1
  59. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  60. package/dist/types/ui/ConfigPanel/FormErrorBoundary.d.ts +1 -1
  61. package/dist/types/ui/ContentStyles/index.d.ts +2 -2
  62. package/dist/{types/editor-next → types-ts4.5/composable-editor}/editor-internal.d.ts +4 -13
  63. package/dist/{types/editor-next/index.d.ts → types-ts4.5/composable-editor/editor.d.ts} +2 -4
  64. package/dist/types-ts4.5/{editor-next → composable-editor}/hooks/useMeasureEditorMountTime.d.ts +3 -3
  65. package/dist/types-ts4.5/{editor-next → composable-editor}/utils/getBaseFontSize.d.ts +1 -1
  66. package/dist/{types/editor-next → types-ts4.5/composable-editor}/utils/getProvidersFromEditorProps.d.ts +2 -2
  67. package/dist/types-ts4.5/{editor-next → composable-editor}/utils/sendDurationAnalytics.d.ts +4 -4
  68. package/dist/{types/editor-next → types-ts4.5/composable-editor}/utils/trackEditorActions.d.ts +3 -3
  69. package/dist/types-ts4.5/composable-editor.d.ts +1 -1
  70. package/dist/types-ts4.5/create-editor/create-plugins-list.d.ts +1 -1
  71. package/dist/types-ts4.5/index.d.ts +1 -1
  72. package/dist/types-ts4.5/labs/next/presets/default.d.ts +1 -1
  73. package/dist/types-ts4.5/plugins/code-block/ide-ux/quote-handling.d.ts +1 -1
  74. package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/commands.d.ts +1 -1
  75. package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin.d.ts +1 -1
  76. package/dist/types-ts4.5/plugins/floating-toolbar/ui/Select.d.ts +1 -1
  77. package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +3 -4
  78. package/dist/types-ts4.5/plugins/floating-toolbar/utils.d.ts +0 -2
  79. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  80. package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  81. package/dist/types-ts4.5/ui/ConfigPanel/FormErrorBoundary.d.ts +1 -1
  82. package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
  83. package/package.json +8 -9
  84. package/report.api.md +3 -26
  85. package/tmp/api-report-tmp.d.ts +3 -26
  86. package/dist/cjs/plugins/base/commands.js +0 -20
  87. package/dist/cjs/plugins/base/index.js +0 -13
  88. package/dist/cjs/plugins/base/plugin.js +0 -143
  89. package/dist/cjs/plugins/base/pm-plugins/context-identifier.js +0 -58
  90. package/dist/cjs/plugins/base/pm-plugins/disable-spell-checking.js +0 -63
  91. package/dist/cjs/plugins/base/pm-plugins/filter-steps.js +0 -34
  92. package/dist/cjs/plugins/base/pm-plugins/fix-chrome-88-selection.js +0 -34
  93. package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +0 -265
  94. package/dist/cjs/plugins/base/pm-plugins/inline-cursor-target.js +0 -183
  95. package/dist/cjs/plugins/base/pm-plugins/newline-preserve-marks.js +0 -34
  96. package/dist/cjs/plugins/base/pm-plugins/scroll-gutter/index.js +0 -262
  97. package/dist/cjs/plugins/base/pm-plugins/scroll-gutter/plugin-key.js +0 -15
  98. package/dist/cjs/plugins/base/utils/frozen-editor.js +0 -11
  99. package/dist/cjs/plugins/base/utils/input-latency-tracking.js +0 -134
  100. package/dist/es2019/plugins/base/commands.js +0 -13
  101. package/dist/es2019/plugins/base/index.js +0 -2
  102. package/dist/es2019/plugins/base/plugin.js +0 -113
  103. package/dist/es2019/plugins/base/pm-plugins/context-identifier.js +0 -43
  104. package/dist/es2019/plugins/base/pm-plugins/disable-spell-checking.js +0 -54
  105. package/dist/es2019/plugins/base/pm-plugins/filter-steps.js +0 -23
  106. package/dist/es2019/plugins/base/pm-plugins/fix-chrome-88-selection.js +0 -24
  107. package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +0 -258
  108. package/dist/es2019/plugins/base/pm-plugins/inline-cursor-target.js +0 -186
  109. package/dist/es2019/plugins/base/pm-plugins/newline-preserve-marks.js +0 -20
  110. package/dist/es2019/plugins/base/pm-plugins/scroll-gutter/index.js +0 -242
  111. package/dist/es2019/plugins/base/pm-plugins/scroll-gutter/plugin-key.js +0 -7
  112. package/dist/es2019/plugins/base/utils/frozen-editor.js +0 -2
  113. package/dist/es2019/plugins/base/utils/input-latency-tracking.js +0 -104
  114. package/dist/esm/plugins/base/commands.js +0 -13
  115. package/dist/esm/plugins/base/index.js +0 -2
  116. package/dist/esm/plugins/base/plugin.js +0 -131
  117. package/dist/esm/plugins/base/pm-plugins/context-identifier.js +0 -48
  118. package/dist/esm/plugins/base/pm-plugins/disable-spell-checking.js +0 -56
  119. package/dist/esm/plugins/base/pm-plugins/filter-steps.js +0 -27
  120. package/dist/esm/plugins/base/pm-plugins/fix-chrome-88-selection.js +0 -26
  121. package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +0 -251
  122. package/dist/esm/plugins/base/pm-plugins/inline-cursor-target.js +0 -174
  123. package/dist/esm/plugins/base/pm-plugins/newline-preserve-marks.js +0 -26
  124. package/dist/esm/plugins/base/pm-plugins/scroll-gutter/index.js +0 -254
  125. package/dist/esm/plugins/base/pm-plugins/scroll-gutter/plugin-key.js +0 -7
  126. package/dist/esm/plugins/base/utils/frozen-editor.js +0 -4
  127. package/dist/esm/plugins/base/utils/input-latency-tracking.js +0 -128
  128. package/dist/types/plugins/base/commands.d.ts +0 -2
  129. package/dist/types/plugins/base/index.d.ts +0 -5
  130. package/dist/types/plugins/base/plugin.d.ts +0 -25
  131. package/dist/types/plugins/base/pm-plugins/context-identifier.d.ts +0 -13
  132. package/dist/types/plugins/base/pm-plugins/disable-spell-checking.d.ts +0 -4
  133. package/dist/types/plugins/base/pm-plugins/filter-steps.d.ts +0 -4
  134. package/dist/types/plugins/base/pm-plugins/fix-chrome-88-selection.d.ts +0 -5
  135. package/dist/types/plugins/base/pm-plugins/frozen-editor.d.ts +0 -12
  136. package/dist/types/plugins/base/pm-plugins/inline-cursor-target.d.ts +0 -17
  137. package/dist/types/plugins/base/pm-plugins/newline-preserve-marks.d.ts +0 -5
  138. package/dist/types/plugins/base/pm-plugins/scroll-gutter/index.d.ts +0 -22
  139. package/dist/types/plugins/base/pm-plugins/scroll-gutter/plugin-key.d.ts +0 -7
  140. package/dist/types/plugins/base/utils/frozen-editor.d.ts +0 -2
  141. package/dist/types/plugins/base/utils/input-latency-tracking.d.ts +0 -42
  142. package/dist/types-ts4.5/plugins/base/commands.d.ts +0 -2
  143. package/dist/types-ts4.5/plugins/base/index.d.ts +0 -5
  144. package/dist/types-ts4.5/plugins/base/plugin.d.ts +0 -27
  145. package/dist/types-ts4.5/plugins/base/pm-plugins/context-identifier.d.ts +0 -13
  146. package/dist/types-ts4.5/plugins/base/pm-plugins/disable-spell-checking.d.ts +0 -4
  147. package/dist/types-ts4.5/plugins/base/pm-plugins/filter-steps.d.ts +0 -4
  148. package/dist/types-ts4.5/plugins/base/pm-plugins/fix-chrome-88-selection.d.ts +0 -5
  149. package/dist/types-ts4.5/plugins/base/pm-plugins/frozen-editor.d.ts +0 -12
  150. package/dist/types-ts4.5/plugins/base/pm-plugins/inline-cursor-target.d.ts +0 -17
  151. package/dist/types-ts4.5/plugins/base/pm-plugins/newline-preserve-marks.d.ts +0 -5
  152. package/dist/types-ts4.5/plugins/base/pm-plugins/scroll-gutter/index.d.ts +0 -22
  153. package/dist/types-ts4.5/plugins/base/pm-plugins/scroll-gutter/plugin-key.d.ts +0 -7
  154. package/dist/types-ts4.5/plugins/base/utils/frozen-editor.d.ts +0 -2
  155. package/dist/types-ts4.5/plugins/base/utils/input-latency-tracking.d.ts +0 -42
  156. /package/dist/cjs/{editor-next → composable-editor}/hooks/useEditorMeasuresConstructor.js +0 -0
  157. /package/dist/cjs/{editor-next → composable-editor}/hooks/useMeasureEditorMountTime.js +0 -0
  158. /package/dist/cjs/{editor-next → composable-editor}/hooks/useProviderFactory.js +0 -0
  159. /package/dist/cjs/{editor-next → composable-editor}/utils/editorMeasureTTICallback.js +0 -0
  160. /package/dist/cjs/{editor-next → composable-editor}/utils/getBaseFontSize.js +0 -0
  161. /package/dist/cjs/{editor-next → composable-editor}/utils/getProvidersFromEditorProps.js +0 -0
  162. /package/dist/cjs/{editor-next → composable-editor}/utils/handleProviders.js +0 -0
  163. /package/dist/cjs/{editor-next → composable-editor}/utils/sendDurationAnalytics.js +0 -0
  164. /package/dist/cjs/{editor-next → composable-editor}/utils/trackEditorActions.js +0 -0
  165. /package/dist/es2019/{editor-next → composable-editor}/hooks/useEditorMeasuresConstructor.js +0 -0
  166. /package/dist/es2019/{editor-next → composable-editor}/hooks/useMeasureEditorMountTime.js +0 -0
  167. /package/dist/es2019/{editor-next → composable-editor}/hooks/useProviderFactory.js +0 -0
  168. /package/dist/es2019/{editor-next → composable-editor}/utils/editorMeasureTTICallback.js +0 -0
  169. /package/dist/es2019/{editor-next → composable-editor}/utils/getBaseFontSize.js +0 -0
  170. /package/dist/es2019/{editor-next → composable-editor}/utils/getProvidersFromEditorProps.js +0 -0
  171. /package/dist/es2019/{editor-next → composable-editor}/utils/handleProviders.js +0 -0
  172. /package/dist/es2019/{editor-next → composable-editor}/utils/sendDurationAnalytics.js +0 -0
  173. /package/dist/es2019/{editor-next → composable-editor}/utils/trackEditorActions.js +0 -0
  174. /package/dist/esm/{editor-next → composable-editor}/hooks/useEditorMeasuresConstructor.js +0 -0
  175. /package/dist/esm/{editor-next → composable-editor}/hooks/useMeasureEditorMountTime.js +0 -0
  176. /package/dist/esm/{editor-next → composable-editor}/hooks/useProviderFactory.js +0 -0
  177. /package/dist/esm/{editor-next → composable-editor}/utils/editorMeasureTTICallback.js +0 -0
  178. /package/dist/esm/{editor-next → composable-editor}/utils/getBaseFontSize.js +0 -0
  179. /package/dist/esm/{editor-next → composable-editor}/utils/getProvidersFromEditorProps.js +0 -0
  180. /package/dist/esm/{editor-next → composable-editor}/utils/handleProviders.js +0 -0
  181. /package/dist/esm/{editor-next → composable-editor}/utils/sendDurationAnalytics.js +0 -0
  182. /package/dist/esm/{editor-next → composable-editor}/utils/trackEditorActions.js +0 -0
  183. /package/dist/types/{editor-next → composable-editor}/hooks/useEditorMeasuresConstructor.d.ts +0 -0
  184. /package/dist/types/{editor-next → composable-editor}/hooks/useProviderFactory.d.ts +0 -0
  185. /package/dist/types/{editor-next → composable-editor}/utils/editorMeasureTTICallback.d.ts +0 -0
  186. /package/dist/types/{editor-next → composable-editor}/utils/handleProviders.d.ts +0 -0
  187. /package/dist/types-ts4.5/{editor-next → composable-editor}/hooks/useEditorMeasuresConstructor.d.ts +0 -0
  188. /package/dist/types-ts4.5/{editor-next → composable-editor}/hooks/useProviderFactory.d.ts +0 -0
  189. /package/dist/types-ts4.5/{editor-next → composable-editor}/utils/editorMeasureTTICallback.d.ts +0 -0
  190. /package/dist/types-ts4.5/{editor-next → composable-editor}/utils/handleProviders.d.ts +0 -0
@@ -1,254 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { GUTTER_SELECTOR, GUTTER_SIZE_IN_PX, isEmptyDocument } from '@atlaskit/editor-common/utils';
3
- import { getScrollGutterPluginState, scrollGutterPluginKey } from './plugin-key';
4
- export var getKeyboardHeight = function getKeyboardHeight(state) {
5
- if (state) {
6
- var scrollGutterPluginState = getScrollGutterPluginState(state);
7
- return scrollGutterPluginState ? scrollGutterPluginState.keyboardHeight : undefined;
8
- }
9
- };
10
- var MIN_TAP_SIZE_IN_PX = 40;
11
- function supportsIntersectionObserver() {
12
- if (typeof window !== 'undefined' && 'IntersectionObserver' in window && 'IntersectionObserverEntry' in window && 'intersectionRatio' in window.IntersectionObserverEntry.prototype) {
13
- return true;
14
- }
15
- return false;
16
- }
17
- function listenForGutterVisibilityChanges(scrollElement, gutterIsVisible) {
18
- if (supportsIntersectionObserver()) {
19
- var observer = new IntersectionObserver(function (entries, _) {
20
- entries.forEach(function (entry) {
21
- gutterIsVisible(entry.intersectionRatio > 0);
22
- });
23
- }, {
24
- root: scrollElement,
25
- rootMargin: '0px',
26
- threshold: 0
27
- });
28
- return observer;
29
- }
30
- return undefined;
31
- }
32
-
33
- /**
34
- * Create a gutter element that can be added or removed from the DOM.
35
- */
36
- function createGutter(gutterSize) {
37
- var gutter = document.createElement('div');
38
- gutter.style.paddingBottom = "".concat(gutterSize, "px");
39
- gutter.id = GUTTER_SELECTOR.substr(1);
40
- var initialized = false;
41
- var mounted = false;
42
- var currentParent = null;
43
- var observer;
44
- var isVisible = false;
45
- return {
46
- addGutter: function addGutter(parent) {
47
- if (parent) {
48
- currentParent = parent;
49
- parent.appendChild(gutter);
50
- mounted = true;
51
- if (observer) {
52
- observer.observe(gutter);
53
- }
54
- }
55
- },
56
- removeGutter: function removeGutter() {
57
- if (currentParent && mounted) {
58
- mounted = false;
59
- currentParent.removeChild(gutter);
60
- if (observer) {
61
- observer.unobserve(gutter);
62
- }
63
- }
64
- },
65
- element: function element() {
66
- return gutter;
67
- },
68
- isMounted: function isMounted() {
69
- return mounted;
70
- },
71
- visible: function visible() {
72
- // If we know whether it's visible we can avoid expensive calculations
73
- if (observer) {
74
- return isVisible;
75
- }
76
- // Fallback for legacy browsers assumes it's visible (if mounted)
77
- return mounted;
78
- },
79
- observe: function observe(scrollElement) {
80
- if (!initialized) {
81
- initialized = true;
82
- observer = listenForGutterVisibilityChanges(scrollElement, function (visible) {
83
- return isVisible = visible;
84
- });
85
- }
86
- },
87
- destroy: function destroy() {
88
- if (observer) {
89
- observer.disconnect();
90
- }
91
- observer = undefined;
92
- this.removeGutter();
93
- initialized = mounted = false;
94
- }
95
- };
96
- }
97
-
98
- /**
99
- * Get caret top position given the current selection,
100
- * use start container position as fallback
101
- */
102
- function getCaretTopPosition() {
103
- var windowSelection = window.getSelection();
104
- if (windowSelection && windowSelection.rangeCount > 0) {
105
- var range = windowSelection.getRangeAt(0);
106
- if (range) {
107
- var clientRects = range.getClientRects();
108
- // Return client rects
109
- if (clientRects && clientRects.length > 0) {
110
- return clientRects[0].top;
111
- }
112
-
113
- // Return container top
114
- var container = range.startContainer;
115
- if (container && container.getBoundingClientRect) {
116
- return container.getBoundingClientRect().top;
117
- }
118
- }
119
- }
120
- return;
121
- }
122
- function scrollToGutterElement(scrollContainer, gutterElement, gutterSize) {
123
- var viewportHeight = scrollContainer.offsetHeight;
124
- var viewportOffsetY = scrollContainer.getBoundingClientRect().top;
125
- var caretTopPosition = getCaretTopPosition();
126
- if (!caretTopPosition) {
127
- return false;
128
- }
129
- var caretTopFromContainer = caretTopPosition - viewportOffsetY;
130
- var gutterThresholdTop = viewportHeight - gutterSize - MIN_TAP_SIZE_IN_PX * 2;
131
- if (caretTopFromContainer < gutterThresholdTop) {
132
- return false;
133
- }
134
-
135
- // Clamp the scroll position to above the scroll gutter element.
136
- gutterElement.scrollIntoView(false);
137
-
138
- // Mark scrolling as handled so that other plugin's don't override our position.
139
- return true;
140
- }
141
- export default (function () {
142
- var pluginOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
143
- var getScrollElement = pluginOptions.getScrollElement,
144
- allowCustomScrollHandler = pluginOptions.allowCustomScrollHandler,
145
- _pluginOptions$gutter = pluginOptions.gutterSize,
146
- gutterSize = _pluginOptions$gutter === void 0 ? GUTTER_SIZE_IN_PX : _pluginOptions$gutter;
147
- if (!getScrollElement) {
148
- return undefined;
149
- }
150
- var gutter = createGutter(gutterSize);
151
- var scrollElement = null; // | undefined;
152
-
153
- return new SafePlugin({
154
- key: scrollGutterPluginKey,
155
- state: {
156
- init: function init() {
157
- return {};
158
- },
159
- apply: function apply(tr, pluginState) {
160
- if (tr.getMeta(scrollGutterPluginKey)) {
161
- return tr.getMeta(scrollGutterPluginKey);
162
- }
163
- return pluginState;
164
- }
165
- },
166
- props: {
167
- // Determines the distance (in pixels) between the cursor and the end of the visible viewport at which point,
168
- // when scrolling the cursor into view, scrolling takes place.
169
- // Defaults to 0: https://prosemirror.net/docs/ref/#view.EditorProps.scrollThreshold
170
- scrollThreshold: gutterSize / 2,
171
- // Determines the extra space (in pixels) that is left above or below the cursor when it is scrolled into view.
172
- // Defaults to 5: https://prosemirror.net/docs/ref/#view.EditorProps.scrollMargin
173
- scrollMargin: gutterSize,
174
- // Called when the view, after updating its state, tries to scroll the selection into view
175
- // https://prosemirror.net/docs/ref/#view.EditorProps.handleScrollToSelection
176
- handleScrollToSelection: function handleScrollToSelection() {
177
- if (allowCustomScrollHandler === false) {
178
- return false;
179
- }
180
- if (!gutter.isMounted() || !gutter.visible() || !scrollElement) {
181
- // Avoid scrolling until applicable
182
- return false;
183
- }
184
- return scrollToGutterElement(scrollElement, gutter.element(), gutterSize);
185
- }
186
- },
187
- view: function (_view) {
188
- function view(_x) {
189
- return _view.apply(this, arguments);
190
- }
191
- view.toString = function () {
192
- return _view.toString();
193
- };
194
- return view;
195
- }(function (view) {
196
- // Store references to avoid lookups on successive checks.
197
- scrollElement = getScrollElement(view);
198
- var editorElement = view.dom;
199
- var editorParentElement = editorElement.parentElement;
200
- return {
201
- destroy: function destroy() {
202
- // Remove if it's mounted
203
- gutter.destroy();
204
- scrollElement = editorParentElement = editorElement = null;
205
- },
206
- /**
207
- * Toggle the Scroll Gutter Element
208
- */
209
- update: function update(view, prevState) {
210
- var _getKeyboardHeight;
211
- if (!scrollElement || !editorParentElement) {
212
- return;
213
- }
214
- var state = view.state;
215
- if (prevState.selection === state.selection) {
216
- // No need to recheck if the selected node hasn't changed.
217
- return;
218
- }
219
- var gutterMounted = gutter.isMounted();
220
- var addAndObserveGutter = function addAndObserveGutter() {
221
- if (!gutterMounted) {
222
- gutter.observe(scrollElement);
223
- gutter.addGutter(editorParentElement);
224
- }
225
- };
226
- if (pluginOptions.persistScrollGutter) {
227
- if (!isEmptyDocument(state.doc)) {
228
- addAndObserveGutter();
229
- } else {
230
- gutter.removeGutter();
231
- }
232
- return;
233
- }
234
- // Determine whether we need to consider Keyboard Height
235
- var keyboardHeight = (_getKeyboardHeight = getKeyboardHeight(state)) !== null && _getKeyboardHeight !== void 0 ? _getKeyboardHeight : 0;
236
- var viewportHeight = scrollElement.offsetHeight - keyboardHeight;
237
- var contentHeight = editorParentElement.offsetHeight - (gutterMounted ? gutterSize : 0);
238
-
239
- // Add or remove the gutter based on whether the content is about to exceed the viewport height.
240
- // We do this to ensure there is sufficient white space below the last content node in order to
241
- // see any UI control elements which may sit beneath it.
242
- var gutterThresholdHeight = viewportHeight - gutterSize;
243
- if (contentHeight >= gutterThresholdHeight) {
244
- addAndObserveGutter();
245
- } else {
246
- if (gutterMounted) {
247
- gutter.removeGutter();
248
- }
249
- }
250
- }
251
- };
252
- })
253
- });
254
- });
@@ -1,7 +0,0 @@
1
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- export var scrollGutterPluginKey = new PluginKey('scrollGutter');
3
- export var getScrollGutterPluginState = function getScrollGutterPluginState(state) {
4
- if (state) {
5
- return scrollGutterPluginKey.getState(state);
6
- }
7
- };
@@ -1,4 +0,0 @@
1
- /** Allows the possibility of overriding interaction type values in unit tests via jest.mock or spyOn. */
2
- export var setInteractionType = function setInteractionType(value) {
3
- return value;
4
- };
@@ -1,128 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- import { getTimeSince } from '@atlaskit/editor-common/utils';
5
- import { getAnalyticsEventSeverity } from '@atlaskit/editor-common/utils';
6
- var InputLatencyTracker = /*#__PURE__*/function () {
7
- function InputLatencyTracker(_ref) {
8
- var samplingRate = _ref.samplingRate,
9
- slowThreshold = _ref.slowThreshold,
10
- normalThreshold = _ref.normalThreshold,
11
- degradedThreshold = _ref.degradedThreshold,
12
- dispatchAverage = _ref.dispatchAverage,
13
- dispatchSample = _ref.dispatchSample,
14
- onSampleStart = _ref.onSampleStart,
15
- onSampleEnd = _ref.onSampleEnd,
16
- onSlowInput = _ref.onSlowInput;
17
- _classCallCheck(this, InputLatencyTracker);
18
- _defineProperty(this, "samples", []);
19
- _defineProperty(this, "total", 0);
20
- this.samplingRate = samplingRate;
21
- this.slowThreshold = slowThreshold;
22
- this.normalThreshold = normalThreshold;
23
- this.degradedThreshold = degradedThreshold;
24
- this.dispatchAverage = dispatchAverage;
25
- this.dispatchSample = dispatchSample;
26
- this.onSampleStart = onSampleStart;
27
- this.onSampleEnd = onSampleEnd;
28
- this.onSlowInput = onSlowInput;
29
- }
30
- _createClass(InputLatencyTracker, [{
31
- key: "start",
32
- value: function start() {
33
- var _this = this;
34
- var currentStart = performance.now();
35
- if (this.samples.length + 1 === this.samplingRate) {
36
- var _this$onSampleStart;
37
- (_this$onSampleStart = this.onSampleStart) === null || _this$onSampleStart === void 0 ? void 0 : _this$onSampleStart.call(this);
38
- }
39
- var end = function end() {
40
- if (currentStart === null) {
41
- return;
42
- }
43
- var isSlow = false;
44
- var time = getTimeSince(currentStart);
45
- _this.push(time);
46
- if (time > _this.slowThreshold) {
47
- var _this$onSlowInput;
48
- (_this$onSlowInput = _this.onSlowInput) === null || _this$onSlowInput === void 0 ? void 0 : _this$onSlowInput.call(_this, time);
49
- isSlow = true;
50
- }
51
- if (_this.samples.length === _this.samplingRate) {
52
- var _this$onSampleEnd;
53
- _this.flush();
54
- (_this$onSampleEnd = _this.onSampleEnd) === null || _this$onSampleEnd === void 0 ? void 0 : _this$onSampleEnd.call(_this, time, {
55
- isSlow: isSlow,
56
- severity: _this.severity(time)
57
- });
58
- }
59
- };
60
- return end;
61
- }
62
- }, {
63
- key: "flush",
64
- value: function flush() {
65
- if (this.samples.length === 0) {
66
- return;
67
- }
68
- this.dispatch();
69
- this.samples = [];
70
- this.total = 0;
71
- }
72
- }, {
73
- key: "dispatch",
74
- value: function dispatch() {
75
- var _this$dispatchSample, _this$dispatchAverage;
76
- (_this$dispatchSample = this.dispatchSample) === null || _this$dispatchSample === void 0 ? void 0 : _this$dispatchSample.call(this, this.getLast(), this.severity(this.getLast()));
77
- // cache
78
- var median = this.getMedian();
79
- (_this$dispatchAverage = this.dispatchAverage) === null || _this$dispatchAverage === void 0 ? void 0 : _this$dispatchAverage.call(this, {
80
- mean: this.getMean(),
81
- median: median,
82
- sampleSize: this.samples.length
83
- }, this.severity(median));
84
- }
85
- }, {
86
- key: "push",
87
- value: function push(latency) {
88
- this.samples.push(latency);
89
- this.total += latency;
90
- }
91
- }, {
92
- key: "severity",
93
- value: function severity(time) {
94
- return getAnalyticsEventSeverity(time, this.normalThreshold, this.degradedThreshold);
95
- }
96
- }, {
97
- key: "getLast",
98
- value: function getLast() {
99
- return this.samples[this.samples.length - 1];
100
- }
101
- }, {
102
- key: "getMean",
103
- value: function getMean() {
104
- return this.total / this.samples.length;
105
- }
106
- }, {
107
- key: "getMedian",
108
- value: function getMedian() {
109
- if (this.samples.length === 1) {
110
- return this.samples[0];
111
- }
112
- this.samples.sort(function (a, b) {
113
- return a - b;
114
- });
115
- var middle = (this.samples.length + 1) / 2;
116
- var floorMiddle = Math.floor(middle);
117
- var remainder = middle % floorMiddle;
118
- if (remainder === 0) {
119
- return this.samples[middle - 1];
120
- }
121
- var left = this.samples[floorMiddle - 1];
122
- var right = this.samples[floorMiddle];
123
- return (left + right) / 2;
124
- }
125
- }]);
126
- return InputLatencyTracker;
127
- }();
128
- export { InputLatencyTracker as default };
@@ -1,2 +0,0 @@
1
- import type { Command } from '@atlaskit/editor-common/types';
2
- export declare const setKeyboardHeight: (keyboardHeight: number) => Command;
@@ -1,5 +0,0 @@
1
- import basePlugin from './plugin';
2
- import type { BasePlugin, BasePluginState, BasePluginOptions } from './plugin';
3
- import type { ScrollGutterPluginOptions } from './pm-plugins/scroll-gutter';
4
- export { basePlugin };
5
- export type { BasePlugin, BasePluginState, BasePluginOptions, ScrollGutterPluginOptions, };
@@ -1,25 +0,0 @@
1
- import type { NextEditorPlugin } from '../../types';
2
- import type { ScrollGutterPluginOptions } from './pm-plugins/scroll-gutter';
3
- import type { InputTracking, BrowserFreezetracking } from '../../types/performance-tracking';
4
- import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
5
- import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
6
- export interface BasePluginOptions {
7
- allowScrollGutter?: ScrollGutterPluginOptions;
8
- allowInlineCursorTarget?: boolean;
9
- inputTracking?: InputTracking;
10
- browserFreezeTracking?: BrowserFreezetracking;
11
- ufo?: boolean;
12
- }
13
- export type BasePluginState = {
14
- contextIdentifier: ContextIdentifierProvider | undefined;
15
- /** Current height of keyboard (+ custom toolbar) in iOS app */
16
- keyboardHeight: number | undefined;
17
- };
18
- export type BasePlugin = NextEditorPlugin<'base', {
19
- pluginConfiguration: BasePluginOptions | undefined;
20
- dependencies: [FeatureFlagsPlugin];
21
- sharedState: BasePluginState;
22
- }>;
23
- export declare const isChromeWithSelectionBug: any;
24
- declare const basePlugin: BasePlugin;
25
- export default basePlugin;
@@ -1,13 +0,0 @@
1
- import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
2
- import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
3
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
5
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
- import type { Dispatch } from '../../../event-dispatcher';
7
- export declare const stateKey: PluginKey<any>;
8
- export interface PluginState {
9
- contextIdentifierProvider?: ContextIdentifierProvider;
10
- }
11
- export declare const getContextIdentifier: (state?: EditorState) => ContextIdentifierProvider | undefined;
12
- declare const _default: (dispatch: Dispatch, providerFactory?: ProviderFactory) => SafePlugin<{}>;
13
- export default _default;
@@ -1,4 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
3
- declare const _default: (featureFlags: FeatureFlags) => SafePlugin<any>;
4
- export default _default;
@@ -1,4 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
3
- declare const _default: (dispatchAnalyticsEvent: DispatchAnalyticsEvent) => SafePlugin<any>;
4
- export default _default;
@@ -1,5 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- export declare const fixChromeSelectionKey: PluginKey<any>;
4
- declare const _default: () => SafePlugin<any>;
5
- export default _default;
@@ -1,12 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
4
- import type { InputTracking, BrowserFreezetracking } from '../../../types/performance-tracking';
5
- export declare const frozenEditorPluginKey: PluginKey<any>;
6
- export declare const DEFAULT_FREEZE_THRESHOLD = 600;
7
- export declare const NORMAL_SEVERITY_THRESHOLD = 2000;
8
- export declare const DEGRADED_SEVERITY_THRESHOLD = 3000;
9
- export declare const DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL = 100;
10
- export declare const DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED = 500;
11
- declare const _default: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, inputTracking?: InputTracking, browserFreezeTracking?: BrowserFreezetracking, ufo?: boolean) => SafePlugin<any>;
12
- export default _default;
@@ -1,17 +0,0 @@
1
- import { Decoration } from '@atlaskit/editor-prosemirror/view';
2
- import type { Node } from '@atlaskit/editor-prosemirror/model';
3
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
- export declare const inlineCursorTargetStateKey: PluginKey<any>;
6
- export declare const isInlineNodeView: (node: Node | null | undefined) => boolean | null | undefined;
7
- export interface InlineCursorTargetState {
8
- cursorTarget?: {
9
- decorations: (Decoration | null)[];
10
- positions: {
11
- from: number;
12
- to: number;
13
- };
14
- };
15
- }
16
- declare const _default: () => SafePlugin<InlineCursorTargetState>;
17
- export default _default;
@@ -1,5 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- export declare const newlinePreserveMarksKey: PluginKey<any>;
4
- declare const _default: () => SafePlugin<any>;
5
- export default _default;
@@ -1,22 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- export declare const getKeyboardHeight: (state?: EditorState) => number | undefined;
5
- export type ScrollGutterPluginOptions = {
6
- /** Element the page uses for scrolling */
7
- getScrollElement?: (view: EditorView) => HTMLElement | null;
8
- /**
9
- * Whether to allow custom functionality to scroll to gutter element in
10
- * plugin's handleScrollToSelection function
11
- * Default is true
12
- */
13
- allowCustomScrollHandler?: boolean;
14
- /**
15
- * Persist scroll gutter when the mobile appearance is COMPACT
16
- * Default is false
17
- */
18
- persistScrollGutter?: boolean;
19
- gutterSize?: number;
20
- };
21
- declare const _default: (pluginOptions?: ScrollGutterPluginOptions) => SafePlugin<{}> | undefined;
22
- export default _default;
@@ -1,7 +0,0 @@
1
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- export type ScrollGutterPluginState = {
4
- keyboardHeight: number;
5
- };
6
- export declare const scrollGutterPluginKey: PluginKey<ScrollGutterPluginState>;
7
- export declare const getScrollGutterPluginState: (state?: EditorState) => ScrollGutterPluginState | undefined;
@@ -1,2 +0,0 @@
1
- /** Allows the possibility of overriding interaction type values in unit tests via jest.mock or spyOn. */
2
- export declare const setInteractionType: <T>(value: T) => T;
@@ -1,42 +0,0 @@
1
- import type { SEVERITY } from '@atlaskit/editor-common/utils';
2
- interface Opts {
3
- dispatchAverage?: (data: {
4
- mean: number;
5
- median: number;
6
- sampleSize: number;
7
- }, severity: SEVERITY) => void;
8
- dispatchSample?: (sample: number, severity: SEVERITY) => void;
9
- onSampleStart?: () => void;
10
- onSampleEnd?: (time: number, info: {
11
- isSlow: boolean;
12
- severity: SEVERITY;
13
- }) => void;
14
- onSlowInput?: (time: number) => void;
15
- samplingRate: number;
16
- slowThreshold: number;
17
- normalThreshold: number;
18
- degradedThreshold: number;
19
- }
20
- export default class InputLatencyTracker {
21
- private samples;
22
- private total;
23
- private samplingRate;
24
- private slowThreshold;
25
- private normalThreshold;
26
- private degradedThreshold;
27
- private dispatchAverage;
28
- private dispatchSample;
29
- private onSampleStart;
30
- private onSampleEnd;
31
- private onSlowInput;
32
- constructor({ samplingRate, slowThreshold, normalThreshold, degradedThreshold, dispatchAverage, dispatchSample, onSampleStart, onSampleEnd, onSlowInput, }: Opts);
33
- start(): () => void;
34
- flush(): void;
35
- private dispatch;
36
- private push;
37
- private severity;
38
- private getLast;
39
- private getMean;
40
- private getMedian;
41
- }
42
- export {};
@@ -1,2 +0,0 @@
1
- import type { Command } from '@atlaskit/editor-common/types';
2
- export declare const setKeyboardHeight: (keyboardHeight: number) => Command;
@@ -1,5 +0,0 @@
1
- import basePlugin from './plugin';
2
- import type { BasePlugin, BasePluginState, BasePluginOptions } from './plugin';
3
- import type { ScrollGutterPluginOptions } from './pm-plugins/scroll-gutter';
4
- export { basePlugin };
5
- export type { BasePlugin, BasePluginState, BasePluginOptions, ScrollGutterPluginOptions, };
@@ -1,27 +0,0 @@
1
- import type { NextEditorPlugin } from '../../types';
2
- import type { ScrollGutterPluginOptions } from './pm-plugins/scroll-gutter';
3
- import type { InputTracking, BrowserFreezetracking } from '../../types/performance-tracking';
4
- import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
5
- import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
6
- export interface BasePluginOptions {
7
- allowScrollGutter?: ScrollGutterPluginOptions;
8
- allowInlineCursorTarget?: boolean;
9
- inputTracking?: InputTracking;
10
- browserFreezeTracking?: BrowserFreezetracking;
11
- ufo?: boolean;
12
- }
13
- export type BasePluginState = {
14
- contextIdentifier: ContextIdentifierProvider | undefined;
15
- /** Current height of keyboard (+ custom toolbar) in iOS app */
16
- keyboardHeight: number | undefined;
17
- };
18
- export type BasePlugin = NextEditorPlugin<'base', {
19
- pluginConfiguration: BasePluginOptions | undefined;
20
- dependencies: [
21
- FeatureFlagsPlugin
22
- ];
23
- sharedState: BasePluginState;
24
- }>;
25
- export declare const isChromeWithSelectionBug: any;
26
- declare const basePlugin: BasePlugin;
27
- export default basePlugin;
@@ -1,13 +0,0 @@
1
- import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
2
- import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
3
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
5
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
- import type { Dispatch } from '../../../event-dispatcher';
7
- export declare const stateKey: PluginKey<any>;
8
- export interface PluginState {
9
- contextIdentifierProvider?: ContextIdentifierProvider;
10
- }
11
- export declare const getContextIdentifier: (state?: EditorState) => ContextIdentifierProvider | undefined;
12
- declare const _default: (dispatch: Dispatch, providerFactory?: ProviderFactory) => SafePlugin<{}>;
13
- export default _default;
@@ -1,4 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
3
- declare const _default: (featureFlags: FeatureFlags) => SafePlugin<any>;
4
- export default _default;
@@ -1,4 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
3
- declare const _default: (dispatchAnalyticsEvent: DispatchAnalyticsEvent) => SafePlugin<any>;
4
- export default _default;
@@ -1,5 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- export declare const fixChromeSelectionKey: PluginKey<any>;
4
- declare const _default: () => SafePlugin<any>;
5
- export default _default;