@atlaskit/editor-plugin-base 1.12.2 → 2.0.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.
- package/CHANGELOG.md +27 -0
- package/dist/cjs/plugin.js +18 -7
- package/dist/cjs/pm-plugins/frozen-editor.js +3 -27
- package/dist/cjs/pm-plugins/scroll-gutter/next.js +80 -0
- package/dist/es2019/plugin.js +14 -5
- package/dist/es2019/pm-plugins/frozen-editor.js +3 -30
- package/dist/es2019/pm-plugins/scroll-gutter/next.js +70 -0
- package/dist/esm/plugin.js +18 -7
- package/dist/esm/pm-plugins/frozen-editor.js +3 -27
- package/dist/esm/pm-plugins/scroll-gutter/next.js +74 -0
- package/dist/types/plugin.d.ts +0 -1
- package/dist/types/pm-plugins/frozen-editor.d.ts +1 -1
- package/dist/types/pm-plugins/scroll-gutter/next.d.ts +26 -0
- package/dist/types-ts4.5/plugin.d.ts +0 -1
- package/dist/types-ts4.5/pm-plugins/frozen-editor.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/scroll-gutter/next.d.ts +26 -0
- package/package.json +11 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-base
|
|
2
2
|
|
|
3
|
+
## 2.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#155735](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/155735)
|
|
8
|
+
[`1beeeda29023a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1beeeda29023a) -
|
|
9
|
+
Upgrades editor packages to react 18
|
|
10
|
+
|
|
11
|
+
## 2.0.0
|
|
12
|
+
|
|
13
|
+
### Major Changes
|
|
14
|
+
|
|
15
|
+
- [#154731](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/154731)
|
|
16
|
+
[`c07d9c6cecf8e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c07d9c6cecf8e) -
|
|
17
|
+
EDF-1411 Removed UFO experience events from Editor.
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#154843](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/154843)
|
|
22
|
+
[`33209df89f059`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/33209df89f059) -
|
|
23
|
+
[ux] Improve how the scroll gutter at the bottom of the screen works to prevent flickering while
|
|
24
|
+
typing.
|
|
25
|
+
- [#154186](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/154186)
|
|
26
|
+
[`5c316170d29dd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5c316170d29dd) -
|
|
27
|
+
Bump @atlaskit/adf-schema to 42.3.1
|
|
28
|
+
- Updated dependencies
|
|
29
|
+
|
|
3
30
|
## 1.12.2
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -11,6 +11,7 @@ var _adfSchema = require("@atlaskit/adf-schema");
|
|
|
11
11
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
12
12
|
var _commands = require("@atlaskit/editor-prosemirror/commands");
|
|
13
13
|
var _history = require("@atlaskit/editor-prosemirror/history");
|
|
14
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
15
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
15
16
|
var _commands2 = require("./commands");
|
|
16
17
|
var _disableSpellChecking = _interopRequireDefault(require("./pm-plugins/disable-spell-checking"));
|
|
@@ -20,6 +21,7 @@ var _inlineCursorTarget = _interopRequireDefault(require("./pm-plugins/inline-cu
|
|
|
20
21
|
var _lazyNodeViewDecoration = require("./pm-plugins/lazy-node-view-decoration");
|
|
21
22
|
var _newlinePreserveMarks = _interopRequireDefault(require("./pm-plugins/newline-preserve-marks"));
|
|
22
23
|
var _scrollGutter = _interopRequireWildcard(require("./pm-plugins/scroll-gutter"));
|
|
24
|
+
var _next = _interopRequireDefault(require("./pm-plugins/scroll-gutter/next"));
|
|
23
25
|
var _inputTrackingConfig = require("./utils/inputTrackingConfig");
|
|
24
26
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
25
27
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -83,7 +85,7 @@ var basePlugin = function basePlugin(_ref) {
|
|
|
83
85
|
name: 'frozenEditor',
|
|
84
86
|
plugin: function plugin(_ref3) {
|
|
85
87
|
var dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent;
|
|
86
|
-
return (0, _frozenEditor.default)(api === null || api === void 0 ? void 0 : api.contextIdentifier)(dispatchAnalyticsEvent, _inputTrackingConfig.inputTracking, undefined
|
|
88
|
+
return (0, _frozenEditor.default)(api === null || api === void 0 ? void 0 : api.contextIdentifier)(dispatchAnalyticsEvent, _inputTrackingConfig.inputTracking, undefined);
|
|
87
89
|
}
|
|
88
90
|
}, {
|
|
89
91
|
name: 'history',
|
|
@@ -106,12 +108,21 @@ var basePlugin = function basePlugin(_ref) {
|
|
|
106
108
|
}
|
|
107
109
|
});
|
|
108
110
|
if (options && options.allowScrollGutter) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_improved_scroll_gutter')) {
|
|
112
|
+
plugins.push({
|
|
113
|
+
name: 'scrollGutterPlugin',
|
|
114
|
+
plugin: function plugin() {
|
|
115
|
+
return (0, _next.default)(options.allowScrollGutter);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
} else {
|
|
119
|
+
plugins.push({
|
|
120
|
+
name: 'scrollGutterPlugin',
|
|
121
|
+
plugin: function plugin() {
|
|
122
|
+
return (0, _scrollGutter.default)(options.allowScrollGutter);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
115
126
|
}
|
|
116
127
|
plugins.push({
|
|
117
128
|
name: 'disableSpellcheckingPlugin',
|
|
@@ -10,7 +10,6 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
10
10
|
var _countNodes = require("@atlaskit/editor-common/count-nodes");
|
|
11
11
|
var _isPerformanceApiAvailable = require("@atlaskit/editor-common/is-performance-api-available");
|
|
12
12
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
13
|
-
var _ufo = require("@atlaskit/editor-common/ufo");
|
|
14
13
|
var _analytics2 = require("@atlaskit/editor-common/utils/analytics");
|
|
15
14
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
16
15
|
var _frozenEditor = require("../utils/frozen-editor");
|
|
@@ -47,7 +46,7 @@ var dispatchLongTaskEvent = function dispatchLongTaskEvent(contextIdentifierPlug
|
|
|
47
46
|
};
|
|
48
47
|
};
|
|
49
48
|
var _default = exports.default = function _default(contextIdentifierPlugin) {
|
|
50
|
-
return function (dispatchAnalyticsEvent, inputTracking, browserFreezeTracking
|
|
49
|
+
return function (dispatchAnalyticsEvent, inputTracking, browserFreezeTracking) {
|
|
51
50
|
var interactionType;
|
|
52
51
|
var inputLatencyTracker = null;
|
|
53
52
|
if (browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType) {
|
|
@@ -152,38 +151,15 @@ var _default = exports.default = function _default(contextIdentifierPlugin) {
|
|
|
152
151
|
if (!(0, _isPerformanceApiAvailable.isPerformanceObserverAvailable)()) {
|
|
153
152
|
return {};
|
|
154
153
|
}
|
|
155
|
-
var experienceStore = _ufo.ExperienceStore.getInstance(_view);
|
|
156
154
|
inputLatencyTracker = new _inputLatencyTracking.default({
|
|
157
155
|
samplingRate: samplingRate,
|
|
158
156
|
slowThreshold: slowThreshold,
|
|
159
157
|
normalThreshold: severityThresholdNormal,
|
|
160
158
|
degradedThreshold: severityThresholdDegraded,
|
|
161
|
-
onSampleStart: function onSampleStart() {
|
|
162
|
-
experienceStore === null || experienceStore === void 0 || experienceStore.start(_ufo.EditorExperience.typing);
|
|
163
|
-
},
|
|
164
|
-
onSampleEnd: function onSampleEnd(time, _ref2) {
|
|
165
|
-
var _contextIdentifierPlu4;
|
|
166
|
-
var isSlow = _ref2.isSlow,
|
|
167
|
-
severity = _ref2.severity;
|
|
168
|
-
var state = _view.state;
|
|
169
|
-
var nodesCount = getNodeCount(state);
|
|
170
|
-
if (isSlow) {
|
|
171
|
-
experienceStore === null || experienceStore === void 0 || experienceStore.addMetadata(_ufo.EditorExperience.typing, {
|
|
172
|
-
slowInput: true
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
experienceStore === null || experienceStore === void 0 || experienceStore.success(_ufo.EditorExperience.typing, _objectSpread(_objectSpread({
|
|
176
|
-
nodeSize: state.doc.nodeSize
|
|
177
|
-
}, nodesCount), {}, {
|
|
178
|
-
objectId: contextIdentifierPlugin === null || contextIdentifierPlugin === void 0 || (_contextIdentifierPlu4 = contextIdentifierPlugin.sharedState.currentState()) === null || _contextIdentifierPlu4 === void 0 || (_contextIdentifierPlu4 = _contextIdentifierPlu4.contextIdentifierProvider) === null || _contextIdentifierPlu4 === void 0 ? void 0 : _contextIdentifierPlu4.objectId,
|
|
179
|
-
time: time,
|
|
180
|
-
severity: shouldTrackSeverity ? severity : undefined
|
|
181
|
-
}));
|
|
182
|
-
},
|
|
183
159
|
dispatchSample: createDispatchSample(_analytics.ACTION.INPUT_PERF_SAMPLING, _view),
|
|
184
160
|
dispatchAverage: createDispatchAverage(_analytics.ACTION.INPUT_PERF_SAMPLING_AVG, _view),
|
|
185
161
|
onSlowInput: function onSlowInput(time) {
|
|
186
|
-
var
|
|
162
|
+
var _contextIdentifierPlu4;
|
|
187
163
|
var state = _view.state;
|
|
188
164
|
var nodesCount = getNodeCount(state);
|
|
189
165
|
dispatchAnalyticsEvent({
|
|
@@ -193,7 +169,7 @@ var _default = exports.default = function _default(contextIdentifierPlugin) {
|
|
|
193
169
|
time: time,
|
|
194
170
|
nodeSize: state.doc.nodeSize
|
|
195
171
|
}, nodesCount), {}, {
|
|
196
|
-
objectId: contextIdentifierPlugin === null || contextIdentifierPlugin === void 0 || (
|
|
172
|
+
objectId: contextIdentifierPlugin === null || contextIdentifierPlugin === void 0 || (_contextIdentifierPlu4 = contextIdentifierPlugin.sharedState.currentState()) === null || _contextIdentifierPlu4 === void 0 || (_contextIdentifierPlu4 = _contextIdentifierPlu4.contextIdentifierProvider) === null || _contextIdentifierPlu4 === void 0 ? void 0 : _contextIdentifierPlu4.objectId
|
|
197
173
|
}),
|
|
198
174
|
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
199
175
|
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getKeyboardHeight = exports.default = void 0;
|
|
7
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
|
+
var _pluginKey = require("./plugin-key");
|
|
9
|
+
var GUTTER_SIZE_IN_PX = 120;
|
|
10
|
+
var GUTTER_SELECTOR_NAME = 'editor-scroll-gutter';
|
|
11
|
+
var getKeyboardHeight = exports.getKeyboardHeight = function getKeyboardHeight(state) {
|
|
12
|
+
if (state) {
|
|
13
|
+
var scrollGutterPluginState = (0, _pluginKey.getScrollGutterPluginState)(state);
|
|
14
|
+
return scrollGutterPluginState ? scrollGutterPluginState.keyboardHeight : undefined;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a gutter element that can be added or removed from the DOM.
|
|
20
|
+
*/
|
|
21
|
+
function createGutter(gutterSize, parent) {
|
|
22
|
+
var gutter = document.createElement('div');
|
|
23
|
+
gutter.style.paddingBottom = "".concat(gutterSize, "px");
|
|
24
|
+
gutter.id = GUTTER_SELECTOR_NAME;
|
|
25
|
+
if (parent) {
|
|
26
|
+
parent.appendChild(gutter);
|
|
27
|
+
}
|
|
28
|
+
return function () {
|
|
29
|
+
return parent === null || parent === void 0 ? void 0 : parent.removeChild(gutter);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
var _default = exports.default = function _default() {
|
|
33
|
+
var pluginOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
34
|
+
var getScrollElement = pluginOptions.getScrollElement,
|
|
35
|
+
_pluginOptions$gutter = pluginOptions.gutterSize,
|
|
36
|
+
gutterSize = _pluginOptions$gutter === void 0 ? GUTTER_SIZE_IN_PX : _pluginOptions$gutter;
|
|
37
|
+
if (!getScrollElement) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
return new _safePlugin.SafePlugin({
|
|
41
|
+
key: _pluginKey.scrollGutterPluginKey,
|
|
42
|
+
state: {
|
|
43
|
+
init: function init() {
|
|
44
|
+
return {};
|
|
45
|
+
},
|
|
46
|
+
apply: function apply(tr, pluginState) {
|
|
47
|
+
if (tr.getMeta(_pluginKey.scrollGutterPluginKey)) {
|
|
48
|
+
return tr.getMeta(_pluginKey.scrollGutterPluginKey);
|
|
49
|
+
}
|
|
50
|
+
return pluginState;
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
props: {
|
|
54
|
+
// Determines the distance (in pixels) between the cursor and the end of the visible viewport at which point,
|
|
55
|
+
// when scrolling the cursor into view, scrolling takes place.
|
|
56
|
+
// Defaults to 0: https://prosemirror.net/docs/ref/#view.EditorProps.scrollThreshold
|
|
57
|
+
scrollThreshold: gutterSize,
|
|
58
|
+
// Determines the extra space (in pixels) that is left above or below the cursor when it is scrolled into view.
|
|
59
|
+
// Defaults to 5: https://prosemirror.net/docs/ref/#view.EditorProps.scrollMargin
|
|
60
|
+
scrollMargin: gutterSize
|
|
61
|
+
},
|
|
62
|
+
view: function view(_view) {
|
|
63
|
+
var _editorElement;
|
|
64
|
+
// Store references to avoid lookups on successive checks.
|
|
65
|
+
var scrollElement = getScrollElement(_view);
|
|
66
|
+
var editorElement = _view.dom instanceof HTMLElement ? _view.dom : null;
|
|
67
|
+
var editorParentElement = (_editorElement = editorElement) === null || _editorElement === void 0 ? void 0 : _editorElement.parentElement;
|
|
68
|
+
var cleanup = function cleanup() {};
|
|
69
|
+
if (editorParentElement && scrollElement) {
|
|
70
|
+
cleanup = createGutter(gutterSize, editorParentElement);
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
destroy: function destroy() {
|
|
74
|
+
cleanup();
|
|
75
|
+
editorParentElement = editorElement = null;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
};
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -2,6 +2,7 @@ import { doc, paragraph, text } from '@atlaskit/adf-schema';
|
|
|
2
2
|
import { keymap } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { baseKeymap } from '@atlaskit/editor-prosemirror/commands';
|
|
4
4
|
import { history } from '@atlaskit/editor-prosemirror/history';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
7
|
import { setKeyboardHeight } from './commands';
|
|
7
8
|
import disableSpellcheckingPlugin from './pm-plugins/disable-spell-checking';
|
|
@@ -11,6 +12,7 @@ import inlineCursorTargetPlugin from './pm-plugins/inline-cursor-target';
|
|
|
11
12
|
import { createLazyNodeViewDecorationPlugin } from './pm-plugins/lazy-node-view-decoration';
|
|
12
13
|
import newlinePreserveMarksPlugin from './pm-plugins/newline-preserve-marks';
|
|
13
14
|
import scrollGutter, { getKeyboardHeight } from './pm-plugins/scroll-gutter';
|
|
15
|
+
import scrollGutterNext from './pm-plugins/scroll-gutter/next';
|
|
14
16
|
import { inputTracking } from './utils/inputTrackingConfig';
|
|
15
17
|
const basePlugin = ({
|
|
16
18
|
config: options,
|
|
@@ -67,7 +69,7 @@ const basePlugin = ({
|
|
|
67
69
|
plugin: ({
|
|
68
70
|
dispatchAnalyticsEvent
|
|
69
71
|
}) => {
|
|
70
|
-
return frozenEditor(api === null || api === void 0 ? void 0 : api.contextIdentifier)(dispatchAnalyticsEvent, inputTracking, undefined
|
|
72
|
+
return frozenEditor(api === null || api === void 0 ? void 0 : api.contextIdentifier)(dispatchAnalyticsEvent, inputTracking, undefined);
|
|
71
73
|
}
|
|
72
74
|
}, {
|
|
73
75
|
name: 'history',
|
|
@@ -83,10 +85,17 @@ const basePlugin = ({
|
|
|
83
85
|
})
|
|
84
86
|
});
|
|
85
87
|
if (options && options.allowScrollGutter) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
if (fg('platform_editor_improved_scroll_gutter')) {
|
|
89
|
+
plugins.push({
|
|
90
|
+
name: 'scrollGutterPlugin',
|
|
91
|
+
plugin: () => scrollGutterNext(options.allowScrollGutter)
|
|
92
|
+
});
|
|
93
|
+
} else {
|
|
94
|
+
plugins.push({
|
|
95
|
+
name: 'scrollGutterPlugin',
|
|
96
|
+
plugin: () => scrollGutter(options.allowScrollGutter)
|
|
97
|
+
});
|
|
98
|
+
}
|
|
90
99
|
}
|
|
91
100
|
plugins.push({
|
|
92
101
|
name: 'disableSpellcheckingPlugin',
|
|
@@ -2,7 +2,6 @@ import { ACTION, ACTION_SUBJECT, BROWSER_FREEZE_INTERACTION_TYPE, EVENT_TYPE } f
|
|
|
2
2
|
import { countNodes } from '@atlaskit/editor-common/count-nodes';
|
|
3
3
|
import { isPerformanceAPIAvailable, isPerformanceObserverAvailable } from '@atlaskit/editor-common/is-performance-api-available';
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
|
-
import { EditorExperience, ExperienceStore } from '@atlaskit/editor-common/ufo';
|
|
6
5
|
import { getAnalyticsEventSeverity } from '@atlaskit/editor-common/utils/analytics';
|
|
7
6
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
8
7
|
import { setInteractionType } from '../utils/frozen-editor';
|
|
@@ -36,7 +35,7 @@ const dispatchLongTaskEvent = contextIdentifierPlugin => (dispatchAnalyticsEvent
|
|
|
36
35
|
eventType: EVENT_TYPE.OPERATIONAL
|
|
37
36
|
});
|
|
38
37
|
};
|
|
39
|
-
export default (contextIdentifierPlugin => (dispatchAnalyticsEvent, inputTracking, browserFreezeTracking
|
|
38
|
+
export default (contextIdentifierPlugin => (dispatchAnalyticsEvent, inputTracking, browserFreezeTracking) => {
|
|
40
39
|
let interactionType;
|
|
41
40
|
let inputLatencyTracker = null;
|
|
42
41
|
if (browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType) {
|
|
@@ -142,41 +141,15 @@ export default (contextIdentifierPlugin => (dispatchAnalyticsEvent, inputTrackin
|
|
|
142
141
|
if (!isPerformanceObserverAvailable()) {
|
|
143
142
|
return {};
|
|
144
143
|
}
|
|
145
|
-
const experienceStore = ExperienceStore.getInstance(view);
|
|
146
144
|
inputLatencyTracker = new InputLatencyTracker({
|
|
147
145
|
samplingRate,
|
|
148
146
|
slowThreshold,
|
|
149
147
|
normalThreshold: severityThresholdNormal,
|
|
150
148
|
degradedThreshold: severityThresholdDegraded,
|
|
151
|
-
onSampleStart: () => {
|
|
152
|
-
experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.start(EditorExperience.typing);
|
|
153
|
-
},
|
|
154
|
-
onSampleEnd: (time, {
|
|
155
|
-
isSlow,
|
|
156
|
-
severity
|
|
157
|
-
}) => {
|
|
158
|
-
var _contextIdentifierPlu7, _contextIdentifierPlu8;
|
|
159
|
-
const {
|
|
160
|
-
state
|
|
161
|
-
} = view;
|
|
162
|
-
const nodesCount = getNodeCount(state);
|
|
163
|
-
if (isSlow) {
|
|
164
|
-
experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.addMetadata(EditorExperience.typing, {
|
|
165
|
-
slowInput: true
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.success(EditorExperience.typing, {
|
|
169
|
-
nodeSize: state.doc.nodeSize,
|
|
170
|
-
...nodesCount,
|
|
171
|
-
objectId: contextIdentifierPlugin === null || contextIdentifierPlugin === void 0 ? void 0 : (_contextIdentifierPlu7 = contextIdentifierPlugin.sharedState.currentState()) === null || _contextIdentifierPlu7 === void 0 ? void 0 : (_contextIdentifierPlu8 = _contextIdentifierPlu7.contextIdentifierProvider) === null || _contextIdentifierPlu8 === void 0 ? void 0 : _contextIdentifierPlu8.objectId,
|
|
172
|
-
time,
|
|
173
|
-
severity: shouldTrackSeverity ? severity : undefined
|
|
174
|
-
});
|
|
175
|
-
},
|
|
176
149
|
dispatchSample: createDispatchSample(ACTION.INPUT_PERF_SAMPLING, view),
|
|
177
150
|
dispatchAverage: createDispatchAverage(ACTION.INPUT_PERF_SAMPLING_AVG, view),
|
|
178
151
|
onSlowInput: time => {
|
|
179
|
-
var
|
|
152
|
+
var _contextIdentifierPlu7, _contextIdentifierPlu8;
|
|
180
153
|
const {
|
|
181
154
|
state
|
|
182
155
|
} = view;
|
|
@@ -188,7 +161,7 @@ export default (contextIdentifierPlugin => (dispatchAnalyticsEvent, inputTrackin
|
|
|
188
161
|
time,
|
|
189
162
|
nodeSize: state.doc.nodeSize,
|
|
190
163
|
...nodesCount,
|
|
191
|
-
objectId: contextIdentifierPlugin === null || contextIdentifierPlugin === void 0 ? void 0 : (
|
|
164
|
+
objectId: contextIdentifierPlugin === null || contextIdentifierPlugin === void 0 ? void 0 : (_contextIdentifierPlu7 = contextIdentifierPlugin.sharedState.currentState()) === null || _contextIdentifierPlu7 === void 0 ? void 0 : (_contextIdentifierPlu8 = _contextIdentifierPlu7.contextIdentifierProvider) === null || _contextIdentifierPlu8 === void 0 ? void 0 : _contextIdentifierPlu8.objectId
|
|
192
165
|
},
|
|
193
166
|
eventType: EVENT_TYPE.OPERATIONAL
|
|
194
167
|
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { getScrollGutterPluginState, scrollGutterPluginKey } from './plugin-key';
|
|
3
|
+
const GUTTER_SIZE_IN_PX = 120;
|
|
4
|
+
const GUTTER_SELECTOR_NAME = 'editor-scroll-gutter';
|
|
5
|
+
export const getKeyboardHeight = state => {
|
|
6
|
+
if (state) {
|
|
7
|
+
const scrollGutterPluginState = getScrollGutterPluginState(state);
|
|
8
|
+
return scrollGutterPluginState ? scrollGutterPluginState.keyboardHeight : undefined;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Create a gutter element that can be added or removed from the DOM.
|
|
14
|
+
*/
|
|
15
|
+
function createGutter(gutterSize, parent) {
|
|
16
|
+
const gutter = document.createElement('div');
|
|
17
|
+
gutter.style.paddingBottom = `${gutterSize}px`;
|
|
18
|
+
gutter.id = GUTTER_SELECTOR_NAME;
|
|
19
|
+
if (parent) {
|
|
20
|
+
parent.appendChild(gutter);
|
|
21
|
+
}
|
|
22
|
+
return () => parent === null || parent === void 0 ? void 0 : parent.removeChild(gutter);
|
|
23
|
+
}
|
|
24
|
+
export default ((pluginOptions = {}) => {
|
|
25
|
+
const {
|
|
26
|
+
getScrollElement,
|
|
27
|
+
gutterSize = GUTTER_SIZE_IN_PX
|
|
28
|
+
} = pluginOptions;
|
|
29
|
+
if (!getScrollElement) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
return new SafePlugin({
|
|
33
|
+
key: scrollGutterPluginKey,
|
|
34
|
+
state: {
|
|
35
|
+
init: () => ({}),
|
|
36
|
+
apply: (tr, pluginState) => {
|
|
37
|
+
if (tr.getMeta(scrollGutterPluginKey)) {
|
|
38
|
+
return tr.getMeta(scrollGutterPluginKey);
|
|
39
|
+
}
|
|
40
|
+
return pluginState;
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
props: {
|
|
44
|
+
// Determines the distance (in pixels) between the cursor and the end of the visible viewport at which point,
|
|
45
|
+
// when scrolling the cursor into view, scrolling takes place.
|
|
46
|
+
// Defaults to 0: https://prosemirror.net/docs/ref/#view.EditorProps.scrollThreshold
|
|
47
|
+
scrollThreshold: gutterSize,
|
|
48
|
+
// Determines the extra space (in pixels) that is left above or below the cursor when it is scrolled into view.
|
|
49
|
+
// Defaults to 5: https://prosemirror.net/docs/ref/#view.EditorProps.scrollMargin
|
|
50
|
+
scrollMargin: gutterSize
|
|
51
|
+
},
|
|
52
|
+
view(view) {
|
|
53
|
+
var _editorElement;
|
|
54
|
+
// Store references to avoid lookups on successive checks.
|
|
55
|
+
const scrollElement = getScrollElement(view);
|
|
56
|
+
let editorElement = view.dom instanceof HTMLElement ? view.dom : null;
|
|
57
|
+
let editorParentElement = (_editorElement = editorElement) === null || _editorElement === void 0 ? void 0 : _editorElement.parentElement;
|
|
58
|
+
let cleanup = () => {};
|
|
59
|
+
if (editorParentElement && scrollElement) {
|
|
60
|
+
cleanup = createGutter(gutterSize, editorParentElement);
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
destroy() {
|
|
64
|
+
cleanup();
|
|
65
|
+
editorParentElement = editorElement = null;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
package/dist/esm/plugin.js
CHANGED
|
@@ -5,6 +5,7 @@ import { doc, paragraph, text } from '@atlaskit/adf-schema';
|
|
|
5
5
|
import { keymap } from '@atlaskit/editor-common/keymaps';
|
|
6
6
|
import { baseKeymap } from '@atlaskit/editor-prosemirror/commands';
|
|
7
7
|
import { history } from '@atlaskit/editor-prosemirror/history';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
10
|
import { setKeyboardHeight } from './commands';
|
|
10
11
|
import disableSpellcheckingPlugin from './pm-plugins/disable-spell-checking';
|
|
@@ -14,6 +15,7 @@ import inlineCursorTargetPlugin from './pm-plugins/inline-cursor-target';
|
|
|
14
15
|
import { createLazyNodeViewDecorationPlugin } from './pm-plugins/lazy-node-view-decoration';
|
|
15
16
|
import newlinePreserveMarksPlugin from './pm-plugins/newline-preserve-marks';
|
|
16
17
|
import scrollGutter, { getKeyboardHeight } from './pm-plugins/scroll-gutter';
|
|
18
|
+
import scrollGutterNext from './pm-plugins/scroll-gutter/next';
|
|
17
19
|
import { inputTracking } from './utils/inputTrackingConfig';
|
|
18
20
|
var basePlugin = function basePlugin(_ref) {
|
|
19
21
|
var _api$featureFlags;
|
|
@@ -73,7 +75,7 @@ var basePlugin = function basePlugin(_ref) {
|
|
|
73
75
|
name: 'frozenEditor',
|
|
74
76
|
plugin: function plugin(_ref3) {
|
|
75
77
|
var dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent;
|
|
76
|
-
return frozenEditor(api === null || api === void 0 ? void 0 : api.contextIdentifier)(dispatchAnalyticsEvent, inputTracking, undefined
|
|
78
|
+
return frozenEditor(api === null || api === void 0 ? void 0 : api.contextIdentifier)(dispatchAnalyticsEvent, inputTracking, undefined);
|
|
77
79
|
}
|
|
78
80
|
}, {
|
|
79
81
|
name: 'history',
|
|
@@ -96,12 +98,21 @@ var basePlugin = function basePlugin(_ref) {
|
|
|
96
98
|
}
|
|
97
99
|
});
|
|
98
100
|
if (options && options.allowScrollGutter) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
if (fg('platform_editor_improved_scroll_gutter')) {
|
|
102
|
+
plugins.push({
|
|
103
|
+
name: 'scrollGutterPlugin',
|
|
104
|
+
plugin: function plugin() {
|
|
105
|
+
return scrollGutterNext(options.allowScrollGutter);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
} else {
|
|
109
|
+
plugins.push({
|
|
110
|
+
name: 'scrollGutterPlugin',
|
|
111
|
+
plugin: function plugin() {
|
|
112
|
+
return scrollGutter(options.allowScrollGutter);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
105
116
|
}
|
|
106
117
|
plugins.push({
|
|
107
118
|
name: 'disableSpellcheckingPlugin',
|
|
@@ -5,7 +5,6 @@ import { ACTION, ACTION_SUBJECT, BROWSER_FREEZE_INTERACTION_TYPE, EVENT_TYPE } f
|
|
|
5
5
|
import { countNodes } from '@atlaskit/editor-common/count-nodes';
|
|
6
6
|
import { isPerformanceAPIAvailable, isPerformanceObserverAvailable } from '@atlaskit/editor-common/is-performance-api-available';
|
|
7
7
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
8
|
-
import { EditorExperience, ExperienceStore } from '@atlaskit/editor-common/ufo';
|
|
9
8
|
import { getAnalyticsEventSeverity } from '@atlaskit/editor-common/utils/analytics';
|
|
10
9
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
11
10
|
import { setInteractionType } from '../utils/frozen-editor';
|
|
@@ -40,7 +39,7 @@ var dispatchLongTaskEvent = function dispatchLongTaskEvent(contextIdentifierPlug
|
|
|
40
39
|
};
|
|
41
40
|
};
|
|
42
41
|
export default (function (contextIdentifierPlugin) {
|
|
43
|
-
return function (dispatchAnalyticsEvent, inputTracking, browserFreezeTracking
|
|
42
|
+
return function (dispatchAnalyticsEvent, inputTracking, browserFreezeTracking) {
|
|
44
43
|
var interactionType;
|
|
45
44
|
var inputLatencyTracker = null;
|
|
46
45
|
if (browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType) {
|
|
@@ -145,38 +144,15 @@ export default (function (contextIdentifierPlugin) {
|
|
|
145
144
|
if (!isPerformanceObserverAvailable()) {
|
|
146
145
|
return {};
|
|
147
146
|
}
|
|
148
|
-
var experienceStore = ExperienceStore.getInstance(_view);
|
|
149
147
|
inputLatencyTracker = new InputLatencyTracker({
|
|
150
148
|
samplingRate: samplingRate,
|
|
151
149
|
slowThreshold: slowThreshold,
|
|
152
150
|
normalThreshold: severityThresholdNormal,
|
|
153
151
|
degradedThreshold: severityThresholdDegraded,
|
|
154
|
-
onSampleStart: function onSampleStart() {
|
|
155
|
-
experienceStore === null || experienceStore === void 0 || experienceStore.start(EditorExperience.typing);
|
|
156
|
-
},
|
|
157
|
-
onSampleEnd: function onSampleEnd(time, _ref2) {
|
|
158
|
-
var _contextIdentifierPlu4;
|
|
159
|
-
var isSlow = _ref2.isSlow,
|
|
160
|
-
severity = _ref2.severity;
|
|
161
|
-
var state = _view.state;
|
|
162
|
-
var nodesCount = getNodeCount(state);
|
|
163
|
-
if (isSlow) {
|
|
164
|
-
experienceStore === null || experienceStore === void 0 || experienceStore.addMetadata(EditorExperience.typing, {
|
|
165
|
-
slowInput: true
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
experienceStore === null || experienceStore === void 0 || experienceStore.success(EditorExperience.typing, _objectSpread(_objectSpread({
|
|
169
|
-
nodeSize: state.doc.nodeSize
|
|
170
|
-
}, nodesCount), {}, {
|
|
171
|
-
objectId: contextIdentifierPlugin === null || contextIdentifierPlugin === void 0 || (_contextIdentifierPlu4 = contextIdentifierPlugin.sharedState.currentState()) === null || _contextIdentifierPlu4 === void 0 || (_contextIdentifierPlu4 = _contextIdentifierPlu4.contextIdentifierProvider) === null || _contextIdentifierPlu4 === void 0 ? void 0 : _contextIdentifierPlu4.objectId,
|
|
172
|
-
time: time,
|
|
173
|
-
severity: shouldTrackSeverity ? severity : undefined
|
|
174
|
-
}));
|
|
175
|
-
},
|
|
176
152
|
dispatchSample: createDispatchSample(ACTION.INPUT_PERF_SAMPLING, _view),
|
|
177
153
|
dispatchAverage: createDispatchAverage(ACTION.INPUT_PERF_SAMPLING_AVG, _view),
|
|
178
154
|
onSlowInput: function onSlowInput(time) {
|
|
179
|
-
var
|
|
155
|
+
var _contextIdentifierPlu4;
|
|
180
156
|
var state = _view.state;
|
|
181
157
|
var nodesCount = getNodeCount(state);
|
|
182
158
|
dispatchAnalyticsEvent({
|
|
@@ -186,7 +162,7 @@ export default (function (contextIdentifierPlugin) {
|
|
|
186
162
|
time: time,
|
|
187
163
|
nodeSize: state.doc.nodeSize
|
|
188
164
|
}, nodesCount), {}, {
|
|
189
|
-
objectId: contextIdentifierPlugin === null || contextIdentifierPlugin === void 0 || (
|
|
165
|
+
objectId: contextIdentifierPlugin === null || contextIdentifierPlugin === void 0 || (_contextIdentifierPlu4 = contextIdentifierPlugin.sharedState.currentState()) === null || _contextIdentifierPlu4 === void 0 || (_contextIdentifierPlu4 = _contextIdentifierPlu4.contextIdentifierProvider) === null || _contextIdentifierPlu4 === void 0 ? void 0 : _contextIdentifierPlu4.objectId
|
|
190
166
|
}),
|
|
191
167
|
eventType: EVENT_TYPE.OPERATIONAL
|
|
192
168
|
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { getScrollGutterPluginState, scrollGutterPluginKey } from './plugin-key';
|
|
3
|
+
var GUTTER_SIZE_IN_PX = 120;
|
|
4
|
+
var GUTTER_SELECTOR_NAME = 'editor-scroll-gutter';
|
|
5
|
+
export var getKeyboardHeight = function getKeyboardHeight(state) {
|
|
6
|
+
if (state) {
|
|
7
|
+
var scrollGutterPluginState = getScrollGutterPluginState(state);
|
|
8
|
+
return scrollGutterPluginState ? scrollGutterPluginState.keyboardHeight : undefined;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Create a gutter element that can be added or removed from the DOM.
|
|
14
|
+
*/
|
|
15
|
+
function createGutter(gutterSize, parent) {
|
|
16
|
+
var gutter = document.createElement('div');
|
|
17
|
+
gutter.style.paddingBottom = "".concat(gutterSize, "px");
|
|
18
|
+
gutter.id = GUTTER_SELECTOR_NAME;
|
|
19
|
+
if (parent) {
|
|
20
|
+
parent.appendChild(gutter);
|
|
21
|
+
}
|
|
22
|
+
return function () {
|
|
23
|
+
return parent === null || parent === void 0 ? void 0 : parent.removeChild(gutter);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export default (function () {
|
|
27
|
+
var pluginOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
28
|
+
var getScrollElement = pluginOptions.getScrollElement,
|
|
29
|
+
_pluginOptions$gutter = pluginOptions.gutterSize,
|
|
30
|
+
gutterSize = _pluginOptions$gutter === void 0 ? GUTTER_SIZE_IN_PX : _pluginOptions$gutter;
|
|
31
|
+
if (!getScrollElement) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
return new SafePlugin({
|
|
35
|
+
key: scrollGutterPluginKey,
|
|
36
|
+
state: {
|
|
37
|
+
init: function init() {
|
|
38
|
+
return {};
|
|
39
|
+
},
|
|
40
|
+
apply: function apply(tr, pluginState) {
|
|
41
|
+
if (tr.getMeta(scrollGutterPluginKey)) {
|
|
42
|
+
return tr.getMeta(scrollGutterPluginKey);
|
|
43
|
+
}
|
|
44
|
+
return pluginState;
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
props: {
|
|
48
|
+
// Determines the distance (in pixels) between the cursor and the end of the visible viewport at which point,
|
|
49
|
+
// when scrolling the cursor into view, scrolling takes place.
|
|
50
|
+
// Defaults to 0: https://prosemirror.net/docs/ref/#view.EditorProps.scrollThreshold
|
|
51
|
+
scrollThreshold: gutterSize,
|
|
52
|
+
// Determines the extra space (in pixels) that is left above or below the cursor when it is scrolled into view.
|
|
53
|
+
// Defaults to 5: https://prosemirror.net/docs/ref/#view.EditorProps.scrollMargin
|
|
54
|
+
scrollMargin: gutterSize
|
|
55
|
+
},
|
|
56
|
+
view: function view(_view) {
|
|
57
|
+
var _editorElement;
|
|
58
|
+
// Store references to avoid lookups on successive checks.
|
|
59
|
+
var scrollElement = getScrollElement(_view);
|
|
60
|
+
var editorElement = _view.dom instanceof HTMLElement ? _view.dom : null;
|
|
61
|
+
var editorParentElement = (_editorElement = editorElement) === null || _editorElement === void 0 ? void 0 : _editorElement.parentElement;
|
|
62
|
+
var cleanup = function cleanup() {};
|
|
63
|
+
if (editorParentElement && scrollElement) {
|
|
64
|
+
cleanup = createGutter(gutterSize, editorParentElement);
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
destroy: function destroy() {
|
|
68
|
+
cleanup();
|
|
69
|
+
editorParentElement = editorElement = null;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
});
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -9,5 +9,5 @@ export declare const NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
|
9
9
|
export declare const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
10
10
|
export declare const DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL = 100;
|
|
11
11
|
export declare const DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED = 500;
|
|
12
|
-
declare const _default: (contextIdentifierPlugin: ExtractInjectionAPI<BasePlugin>['contextIdentifier'] | undefined) => (dispatchAnalyticsEvent: DispatchAnalyticsEvent, inputTracking?: InputTracking, browserFreezeTracking?: BrowserFreezetracking
|
|
12
|
+
declare const _default: (contextIdentifierPlugin: ExtractInjectionAPI<BasePlugin>['contextIdentifier'] | undefined) => (dispatchAnalyticsEvent: DispatchAnalyticsEvent, inputTracking?: InputTracking, browserFreezeTracking?: BrowserFreezetracking) => SafePlugin<any>;
|
|
13
13
|
export default _default;
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
* @deprecated
|
|
10
|
+
*
|
|
11
|
+
* Whether to allow custom functionality to scroll to gutter element in
|
|
12
|
+
* plugin's handleScrollToSelection function
|
|
13
|
+
* Default is true
|
|
14
|
+
*/
|
|
15
|
+
allowCustomScrollHandler?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated
|
|
18
|
+
*
|
|
19
|
+
* Persist scroll gutter when the mobile appearance is COMPACT
|
|
20
|
+
* Default is false
|
|
21
|
+
*/
|
|
22
|
+
persistScrollGutter?: boolean;
|
|
23
|
+
gutterSize?: number;
|
|
24
|
+
};
|
|
25
|
+
declare const _default: (pluginOptions?: ScrollGutterPluginOptions) => SafePlugin<{}> | undefined;
|
|
26
|
+
export default _default;
|
|
@@ -9,5 +9,5 @@ export declare const NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
|
9
9
|
export declare const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
10
10
|
export declare const DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL = 100;
|
|
11
11
|
export declare const DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED = 500;
|
|
12
|
-
declare const _default: (contextIdentifierPlugin: ExtractInjectionAPI<BasePlugin>['contextIdentifier'] | undefined) => (dispatchAnalyticsEvent: DispatchAnalyticsEvent, inputTracking?: InputTracking, browserFreezeTracking?: BrowserFreezetracking
|
|
12
|
+
declare const _default: (contextIdentifierPlugin: ExtractInjectionAPI<BasePlugin>['contextIdentifier'] | undefined) => (dispatchAnalyticsEvent: DispatchAnalyticsEvent, inputTracking?: InputTracking, browserFreezeTracking?: BrowserFreezetracking) => SafePlugin<any>;
|
|
13
13
|
export default _default;
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
* @deprecated
|
|
10
|
+
*
|
|
11
|
+
* Whether to allow custom functionality to scroll to gutter element in
|
|
12
|
+
* plugin's handleScrollToSelection function
|
|
13
|
+
* Default is true
|
|
14
|
+
*/
|
|
15
|
+
allowCustomScrollHandler?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated
|
|
18
|
+
*
|
|
19
|
+
* Persist scroll gutter when the mobile appearance is COMPACT
|
|
20
|
+
* Default is false
|
|
21
|
+
*/
|
|
22
|
+
persistScrollGutter?: boolean;
|
|
23
|
+
gutterSize?: number;
|
|
24
|
+
};
|
|
25
|
+
declare const _default: (pluginOptions?: ScrollGutterPluginOptions) => SafePlugin<{}> | undefined;
|
|
26
|
+
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-base",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Base plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"atlassian": {
|
|
11
11
|
"team": "Editor: Lego",
|
|
12
12
|
"singleton": true,
|
|
13
|
-
"runReact18":
|
|
13
|
+
"runReact18": true
|
|
14
14
|
},
|
|
15
15
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
16
16
|
"main": "dist/cjs/index.js",
|
|
@@ -31,12 +31,13 @@
|
|
|
31
31
|
".": "./src/index.ts"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@atlaskit/adf-schema": "^42.
|
|
35
|
-
"@atlaskit/editor-common": "^
|
|
34
|
+
"@atlaskit/adf-schema": "^42.3.1",
|
|
35
|
+
"@atlaskit/editor-common": "^94.2.0",
|
|
36
36
|
"@atlaskit/editor-plugin-context-identifier": "^1.3.0",
|
|
37
37
|
"@atlaskit/editor-plugin-feature-flags": "^1.2.0",
|
|
38
38
|
"@atlaskit/editor-prosemirror": "6.0.0",
|
|
39
|
-
"@atlaskit/
|
|
39
|
+
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
40
|
+
"@atlaskit/tmp-editor-statsig": "^2.8.0",
|
|
40
41
|
"@babel/runtime": "^7.0.0"
|
|
41
42
|
},
|
|
42
43
|
"techstack": {
|
|
@@ -73,5 +74,10 @@
|
|
|
73
74
|
"no-unused-dependencies": {
|
|
74
75
|
"checkDevDependencies": true
|
|
75
76
|
}
|
|
77
|
+
},
|
|
78
|
+
"platform-feature-flags": {
|
|
79
|
+
"platform_editor_improved_scroll_gutter": {
|
|
80
|
+
"type": "boolean"
|
|
81
|
+
}
|
|
76
82
|
}
|
|
77
83
|
}
|