@atlaskit/editor-plugin-base 0.2.1 → 0.2.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 (35) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/commands.js +2 -3
  3. package/dist/cjs/plugin.js +3 -5
  4. package/dist/cjs/pm-plugins/context-identifier.js +4 -7
  5. package/dist/cjs/pm-plugins/disable-spell-checking.js +2 -3
  6. package/dist/cjs/pm-plugins/filter-steps.js +2 -3
  7. package/dist/cjs/pm-plugins/fix-chrome-88-selection.js +3 -5
  8. package/dist/cjs/pm-plugins/frozen-editor.js +13 -20
  9. package/dist/cjs/pm-plugins/inline-cursor-target.js +3 -6
  10. package/dist/cjs/pm-plugins/newline-preserve-marks.js +3 -5
  11. package/dist/cjs/pm-plugins/scroll-gutter/index.js +3 -5
  12. package/dist/cjs/pm-plugins/scroll-gutter/plugin-key.js +3 -5
  13. package/dist/cjs/utils/frozen-editor.js +2 -3
  14. package/dist/cjs/utils/input-latency-tracking.js +7 -8
  15. package/dist/esm/plugin.js +1 -1
  16. package/dist/esm/pm-plugins/frozen-editor.js +5 -5
  17. package/dist/esm/utils/input-latency-tracking.js +5 -5
  18. package/package.json +5 -4
  19. package/tsconfig.dev.json +3 -0
  20. package/dist/types-ts4.5/commands.d.ts +0 -2
  21. package/dist/types-ts4.5/index.d.ts +0 -5
  22. package/dist/types-ts4.5/plugin.d.ts +0 -30
  23. package/dist/types-ts4.5/pm-plugins/context-identifier.d.ts +0 -12
  24. package/dist/types-ts4.5/pm-plugins/disable-spell-checking.d.ts +0 -4
  25. package/dist/types-ts4.5/pm-plugins/filter-steps.d.ts +0 -4
  26. package/dist/types-ts4.5/pm-plugins/fix-chrome-88-selection.d.ts +0 -5
  27. package/dist/types-ts4.5/pm-plugins/frozen-editor.d.ts +0 -12
  28. package/dist/types-ts4.5/pm-plugins/inline-cursor-target.d.ts +0 -17
  29. package/dist/types-ts4.5/pm-plugins/newline-preserve-marks.d.ts +0 -5
  30. package/dist/types-ts4.5/pm-plugins/scroll-gutter/index.d.ts +0 -22
  31. package/dist/types-ts4.5/pm-plugins/scroll-gutter/plugin-key.d.ts +0 -7
  32. package/dist/types-ts4.5/types.d.ts +0 -4
  33. package/dist/types-ts4.5/utils/frozen-editor.d.ts +0 -2
  34. package/dist/types-ts4.5/utils/input-latency-tracking.d.ts +0 -42
  35. package/tmp/api-report-tmp.d.ts +0 -61
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/editor-plugin-base
2
2
 
3
+ ## 0.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#40750](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40750) [`fc19a7b9edd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fc19a7b9edd) - [ED-19875] Extraction of Editor Core's Selection Plugin into independent package '@atlaskit/editor-plugin-selection'.
8
+ - Updated dependencies
9
+
3
10
  ## 0.2.1
4
11
 
5
12
  ### Patch Changes
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.setKeyboardHeight = void 0;
7
7
  var _pluginKey = require("./pm-plugins/scroll-gutter/plugin-key");
8
- var setKeyboardHeight = function setKeyboardHeight(keyboardHeight) {
8
+ var setKeyboardHeight = exports.setKeyboardHeight = function setKeyboardHeight(keyboardHeight) {
9
9
  return function (state, dispatch) {
10
10
  var tr = state.tr;
11
11
  tr.setMeta(_pluginKey.scrollGutterPluginKey, {
@@ -16,5 +16,4 @@ var setKeyboardHeight = function setKeyboardHeight(keyboardHeight) {
16
16
  }
17
17
  return true;
18
18
  };
19
- };
20
- exports.setKeyboardHeight = setKeyboardHeight;
19
+ };
@@ -27,13 +27,12 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
27
27
  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; }
28
28
  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) { (0, _defineProperty2.default)(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; }
29
29
  // Chrome >= 88
30
- var isChromeWithSelectionBug = _utils.browser.chrome && _utils.browser.chrome_version >= 88;
31
- exports.isChromeWithSelectionBug = isChromeWithSelectionBug;
30
+ var isChromeWithSelectionBug = exports.isChromeWithSelectionBug = _utils.browser.chrome && _utils.browser.chrome_version >= 88;
32
31
  var basePlugin = function basePlugin(_ref) {
33
32
  var _api$featureFlags;
34
33
  var options = _ref.config,
35
34
  api = _ref.api;
36
- var featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
35
+ var featureFlags = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
37
36
  return {
38
37
  name: 'base',
39
38
  getSharedState: function getSharedState(editorState) {
@@ -143,5 +142,4 @@ var basePlugin = function basePlugin(_ref) {
143
142
  }
144
143
  };
145
144
  };
146
- var _default = basePlugin;
147
- exports.default = _default;
145
+ var _default = exports.default = basePlugin;
@@ -10,16 +10,14 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
10
10
  var _state = require("@atlaskit/editor-prosemirror/state");
11
11
  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; }
12
12
  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) { (0, _defineProperty2.default)(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; }
13
- var stateKey = new _state.PluginKey('contextIdentiferPlugin');
14
- exports.stateKey = stateKey;
15
- var getContextIdentifier = function getContextIdentifier(state) {
13
+ var stateKey = exports.stateKey = new _state.PluginKey('contextIdentiferPlugin');
14
+ var getContextIdentifier = exports.getContextIdentifier = function getContextIdentifier(state) {
16
15
  if (state) {
17
16
  var _stateKey$getState;
18
17
  return (_stateKey$getState = stateKey.getState(state)) === null || _stateKey$getState === void 0 ? void 0 : _stateKey$getState.contextIdentifierProvider;
19
18
  }
20
19
  };
21
- exports.getContextIdentifier = getContextIdentifier;
22
- var _default = function _default(dispatch, providerFactory) {
20
+ var _default = exports.default = function _default(dispatch, providerFactory) {
23
21
  return new _safePlugin.SafePlugin({
24
22
  key: stateKey,
25
23
  state: {
@@ -54,5 +52,4 @@ var _default = function _default(dispatch, providerFactory) {
54
52
  };
55
53
  }
56
54
  });
57
- };
58
- exports.default = _default;
55
+ };
@@ -32,7 +32,7 @@ function getCurrentBrowserAndVersion() {
32
32
  }
33
33
  return undefined;
34
34
  }
35
- var _default = function _default(featureFlags) {
35
+ var _default = exports.default = function _default(featureFlags) {
36
36
  return new _safePlugin.SafePlugin({
37
37
  key: new _state.PluginKey('disableSpellchecking'),
38
38
  props: {
@@ -59,5 +59,4 @@ var _default = function _default(featureFlags) {
59
59
  }
60
60
  }
61
61
  });
62
- };
63
- exports.default = _default;
62
+ };
@@ -11,7 +11,7 @@ var hasInvalidSteps = function hasInvalidSteps(tr) {
11
11
  return step.from > step.to;
12
12
  });
13
13
  };
14
- var _default = function _default(dispatchAnalyticsEvent) {
14
+ var _default = exports.default = function _default(dispatchAnalyticsEvent) {
15
15
  return new _safePlugin.SafePlugin({
16
16
  filterTransaction: function filterTransaction(transaction) {
17
17
  if (hasInvalidSteps(transaction)) {
@@ -30,5 +30,4 @@ var _default = function _default(dispatchAnalyticsEvent) {
30
30
  return true;
31
31
  }
32
32
  });
33
- };
34
- exports.default = _default;
33
+ };
@@ -10,9 +10,8 @@ var _utils = require("@atlaskit/editor-prosemirror/utils");
10
10
  function isDivHTMLElement(elm) {
11
11
  return elm.tagName.toLowerCase() === 'div';
12
12
  }
13
- var fixChromeSelectionKey = new _state.PluginKey('fixChromeSelectionPlugin');
14
- exports.fixChromeSelectionKey = fixChromeSelectionKey;
15
- var _default = function _default() {
13
+ var fixChromeSelectionKey = exports.fixChromeSelectionKey = new _state.PluginKey('fixChromeSelectionPlugin');
14
+ var _default = exports.default = function _default() {
16
15
  return new _safePlugin.SafePlugin({
17
16
  key: fixChromeSelectionKey,
18
17
  props: {
@@ -30,5 +29,4 @@ var _default = function _default() {
30
29
  }
31
30
  }
32
31
  });
33
- };
34
- exports.default = _default;
32
+ };
@@ -16,21 +16,15 @@ var _inputLatencyTracking = _interopRequireDefault(require("../utils/input-laten
16
16
  var _contextIdentifier = require("./context-identifier");
17
17
  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; }
18
18
  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) { (0, _defineProperty2.default)(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; }
19
- var frozenEditorPluginKey = new _state.PluginKey('frozenEditor');
20
- exports.frozenEditorPluginKey = frozenEditorPluginKey;
19
+ var frozenEditorPluginKey = exports.frozenEditorPluginKey = new _state.PluginKey('frozenEditor');
21
20
  var DEFAULT_KEYSTROKE_SAMPLING_LIMIT = 100;
22
21
  var DEFAULT_SLOW_THRESHOLD = 300;
23
- var DEFAULT_FREEZE_THRESHOLD = 600;
24
- exports.DEFAULT_FREEZE_THRESHOLD = DEFAULT_FREEZE_THRESHOLD;
25
- var NORMAL_SEVERITY_THRESHOLD = 2000;
26
- exports.NORMAL_SEVERITY_THRESHOLD = NORMAL_SEVERITY_THRESHOLD;
27
- var DEGRADED_SEVERITY_THRESHOLD = 3000;
28
- exports.DEGRADED_SEVERITY_THRESHOLD = DEGRADED_SEVERITY_THRESHOLD;
22
+ var DEFAULT_FREEZE_THRESHOLD = exports.DEFAULT_FREEZE_THRESHOLD = 600;
23
+ var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
24
+ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
29
25
  var DEFAULT_TRACK_SEVERITY_ENABLED = false;
30
- var DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL = 100;
31
- exports.DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL = DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL;
32
- var DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED = 500;
33
- exports.DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED = DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED;
26
+ var DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL = exports.DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL = 100;
27
+ var DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED = exports.DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED = 500;
34
28
  var dispatchLongTaskEvent = function dispatchLongTaskEvent(dispatchAnalyticsEvent, view, time, getNodeCount, interactionType, severity) {
35
29
  var _getContextIdentifier;
36
30
  var state = view.state;
@@ -49,7 +43,7 @@ var dispatchLongTaskEvent = function dispatchLongTaskEvent(dispatchAnalyticsEven
49
43
  eventType: _analytics.EVENT_TYPE.OPERATIONAL
50
44
  });
51
45
  };
52
- var _default = function _default(dispatchAnalyticsEvent, inputTracking, browserFreezeTracking, ufo) {
46
+ var _default = exports.default = function _default(dispatchAnalyticsEvent, inputTracking, browserFreezeTracking, ufo) {
53
47
  var interactionType;
54
48
  var inputLatencyTracker = null;
55
49
  var inputLatencySingleKeyTracker = null;
@@ -174,7 +168,7 @@ var _default = function _default(dispatchAnalyticsEvent, inputTracking, browserF
174
168
  normalThreshold: severityThresholdNormal,
175
169
  degradedThreshold: severityThresholdDegraded,
176
170
  onSampleStart: function onSampleStart() {
177
- experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.start(_ufo.EditorExperience.typing);
171
+ experienceStore === null || experienceStore === void 0 || experienceStore.start(_ufo.EditorExperience.typing);
178
172
  },
179
173
  onSampleEnd: function onSampleEnd(time, _ref2) {
180
174
  var _getContextIdentifier4;
@@ -183,11 +177,11 @@ var _default = function _default(dispatchAnalyticsEvent, inputTracking, browserF
183
177
  var state = _view.state;
184
178
  var nodesCount = getNodeCount(state);
185
179
  if (isSlow) {
186
- experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.addMetadata(_ufo.EditorExperience.typing, {
180
+ experienceStore === null || experienceStore === void 0 || experienceStore.addMetadata(_ufo.EditorExperience.typing, {
187
181
  slowInput: true
188
182
  });
189
183
  }
190
- experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.success(_ufo.EditorExperience.typing, _objectSpread(_objectSpread({
184
+ experienceStore === null || experienceStore === void 0 || experienceStore.success(_ufo.EditorExperience.typing, _objectSpread(_objectSpread({
191
185
  nodeSize: state.doc.nodeSize
192
186
  }, nodesCount), {}, {
193
187
  objectId: (_getContextIdentifier4 = (0, _contextIdentifier.getContextIdentifier)(state)) === null || _getContextIdentifier4 === void 0 ? void 0 : _getContextIdentifier4.objectId,
@@ -255,11 +249,10 @@ var _default = function _default(dispatchAnalyticsEvent, inputTracking, browserF
255
249
  return {
256
250
  destroy: function destroy() {
257
251
  var _inputLatencyTracker;
258
- (_inputLatencyTracker = inputLatencyTracker) === null || _inputLatencyTracker === void 0 ? void 0 : _inputLatencyTracker.flush();
259
- observer === null || observer === void 0 ? void 0 : observer.disconnect();
252
+ (_inputLatencyTracker = inputLatencyTracker) === null || _inputLatencyTracker === void 0 || _inputLatencyTracker.flush();
253
+ observer === null || observer === void 0 || observer.disconnect();
260
254
  }
261
255
  };
262
256
  }
263
257
  });
264
- };
265
- exports.default = _default;
258
+ };
@@ -8,13 +8,11 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
8
  var _utils = require("@atlaskit/editor-common/utils");
9
9
  var _state = require("@atlaskit/editor-prosemirror/state");
10
10
  var _view = require("@atlaskit/editor-prosemirror/view");
11
- var inlineCursorTargetStateKey = new _state.PluginKey('inlineCursorTargetPlugin');
12
- exports.inlineCursorTargetStateKey = inlineCursorTargetStateKey;
13
- var isInlineNodeView = function isInlineNodeView(node) {
11
+ var inlineCursorTargetStateKey = exports.inlineCursorTargetStateKey = new _state.PluginKey('inlineCursorTargetPlugin');
12
+ var isInlineNodeView = exports.isInlineNodeView = function isInlineNodeView(node) {
14
13
  return node && node.type.isInline && !node.type.isText;
15
14
  };
16
- exports.isInlineNodeView = isInlineNodeView;
17
- var _default = function _default() {
15
+ var _default = exports.default = function _default() {
18
16
  return new _safePlugin.SafePlugin({
19
17
  key: inlineCursorTargetStateKey,
20
18
  state: {
@@ -149,7 +147,6 @@ var _default = function _default() {
149
147
  }
150
148
  });
151
149
  };
152
- exports.default = _default;
153
150
  function cursorTargetHasValidDecorations(cursorTarget) {
154
151
  if (!cursorTarget ||
155
152
  // Decorations can end up as null when the decorations prop is
@@ -8,8 +8,7 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
8
  var _utils = require("@atlaskit/editor-common/utils");
9
9
  var _keymap = require("@atlaskit/editor-prosemirror/keymap");
10
10
  var _state = require("@atlaskit/editor-prosemirror/state");
11
- var newlinePreserveMarksKey = new _state.PluginKey('newlinePreserveMarksPlugin');
12
- exports.newlinePreserveMarksKey = newlinePreserveMarksKey;
11
+ var newlinePreserveMarksKey = exports.newlinePreserveMarksKey = new _state.PluginKey('newlinePreserveMarksPlugin');
13
12
  var isSelectionAligned = function isSelectionAligned(state) {
14
13
  return !!state.selection.$to.parent.marks.find(function (m) {
15
14
  return m.type === state.schema.marks.alignment;
@@ -21,7 +20,7 @@ var splitBlockPreservingMarks = function splitBlockPreservingMarks(state, dispat
21
20
  }
22
21
  return true;
23
22
  };
24
- var _default = function _default() {
23
+ var _default = exports.default = function _default() {
25
24
  return new _safePlugin.SafePlugin({
26
25
  key: newlinePreserveMarksKey,
27
26
  props: {
@@ -30,5 +29,4 @@ var _default = function _default() {
30
29
  })
31
30
  }
32
31
  });
33
- };
34
- exports.default = _default;
32
+ };
@@ -7,13 +7,12 @@ exports.getKeyboardHeight = exports.default = void 0;
7
7
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
8
  var _utils = require("@atlaskit/editor-common/utils");
9
9
  var _pluginKey = require("./plugin-key");
10
- var getKeyboardHeight = function getKeyboardHeight(state) {
10
+ var getKeyboardHeight = exports.getKeyboardHeight = function getKeyboardHeight(state) {
11
11
  if (state) {
12
12
  var scrollGutterPluginState = (0, _pluginKey.getScrollGutterPluginState)(state);
13
13
  return scrollGutterPluginState ? scrollGutterPluginState.keyboardHeight : undefined;
14
14
  }
15
15
  };
16
- exports.getKeyboardHeight = getKeyboardHeight;
17
16
  var MIN_TAP_SIZE_IN_PX = 40;
18
17
  function supportsIntersectionObserver() {
19
18
  if (typeof window !== 'undefined' && 'IntersectionObserver' in window && 'IntersectionObserverEntry' in window && 'intersectionRatio' in
@@ -147,7 +146,7 @@ function scrollToGutterElement(scrollContainer, gutterElement, gutterSize) {
147
146
  // Mark scrolling as handled so that other plugin's don't override our position.
148
147
  return true;
149
148
  }
150
- var _default = function _default() {
149
+ var _default = exports.default = function _default() {
151
150
  var pluginOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
152
151
  var getScrollElement = pluginOptions.getScrollElement,
153
152
  allowCustomScrollHandler = pluginOptions.allowCustomScrollHandler,
@@ -260,5 +259,4 @@ var _default = function _default() {
260
259
  };
261
260
  })
262
261
  });
263
- };
264
- exports.default = _default;
262
+ };
@@ -5,11 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.scrollGutterPluginKey = exports.getScrollGutterPluginState = void 0;
7
7
  var _state = require("@atlaskit/editor-prosemirror/state");
8
- var scrollGutterPluginKey = new _state.PluginKey('scrollGutter');
9
- exports.scrollGutterPluginKey = scrollGutterPluginKey;
10
- var getScrollGutterPluginState = function getScrollGutterPluginState(state) {
8
+ var scrollGutterPluginKey = exports.scrollGutterPluginKey = new _state.PluginKey('scrollGutter');
9
+ var getScrollGutterPluginState = exports.getScrollGutterPluginState = function getScrollGutterPluginState(state) {
11
10
  if (state) {
12
11
  return scrollGutterPluginKey.getState(state);
13
12
  }
14
- };
15
- exports.getScrollGutterPluginState = getScrollGutterPluginState;
13
+ };
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.setInteractionType = void 0;
7
7
  /** Allows the possibility of overriding interaction type values in unit tests via jest.mock or spyOn. */
8
- var setInteractionType = function setInteractionType(value) {
8
+ var setInteractionType = exports.setInteractionType = function setInteractionType(value) {
9
9
  return value;
10
- };
11
- exports.setInteractionType = setInteractionType;
10
+ };
@@ -9,7 +9,7 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
  var _utils = require("@atlaskit/editor-common/utils");
12
- var InputLatencyTracker = /*#__PURE__*/function () {
12
+ var InputLatencyTracker = exports.default = /*#__PURE__*/function () {
13
13
  function InputLatencyTracker(_ref) {
14
14
  var samplingRate = _ref.samplingRate,
15
15
  slowThreshold = _ref.slowThreshold,
@@ -40,7 +40,7 @@ var InputLatencyTracker = /*#__PURE__*/function () {
40
40
  var currentStart = performance.now();
41
41
  if (this.samples.length + 1 === this.samplingRate) {
42
42
  var _this$onSampleStart;
43
- (_this$onSampleStart = this.onSampleStart) === null || _this$onSampleStart === void 0 ? void 0 : _this$onSampleStart.call(this);
43
+ (_this$onSampleStart = this.onSampleStart) === null || _this$onSampleStart === void 0 || _this$onSampleStart.call(this);
44
44
  }
45
45
  var end = function end() {
46
46
  if (currentStart === null) {
@@ -51,13 +51,13 @@ var InputLatencyTracker = /*#__PURE__*/function () {
51
51
  _this.push(time);
52
52
  if (time > _this.slowThreshold) {
53
53
  var _this$onSlowInput;
54
- (_this$onSlowInput = _this.onSlowInput) === null || _this$onSlowInput === void 0 ? void 0 : _this$onSlowInput.call(_this, time);
54
+ (_this$onSlowInput = _this.onSlowInput) === null || _this$onSlowInput === void 0 || _this$onSlowInput.call(_this, time);
55
55
  isSlow = true;
56
56
  }
57
57
  if (_this.samples.length === _this.samplingRate) {
58
58
  var _this$onSampleEnd;
59
59
  _this.flush();
60
- (_this$onSampleEnd = _this.onSampleEnd) === null || _this$onSampleEnd === void 0 ? void 0 : _this$onSampleEnd.call(_this, time, {
60
+ (_this$onSampleEnd = _this.onSampleEnd) === null || _this$onSampleEnd === void 0 || _this$onSampleEnd.call(_this, time, {
61
61
  isSlow: isSlow,
62
62
  severity: _this.severity(time)
63
63
  });
@@ -79,10 +79,10 @@ var InputLatencyTracker = /*#__PURE__*/function () {
79
79
  key: "dispatch",
80
80
  value: function dispatch() {
81
81
  var _this$dispatchSample, _this$dispatchAverage;
82
- (_this$dispatchSample = this.dispatchSample) === null || _this$dispatchSample === void 0 ? void 0 : _this$dispatchSample.call(this, this.getLast(), this.severity(this.getLast()));
82
+ (_this$dispatchSample = this.dispatchSample) === null || _this$dispatchSample === void 0 || _this$dispatchSample.call(this, this.getLast(), this.severity(this.getLast()));
83
83
  // cache
84
84
  var median = this.getMedian();
85
- (_this$dispatchAverage = this.dispatchAverage) === null || _this$dispatchAverage === void 0 ? void 0 : _this$dispatchAverage.call(this, {
85
+ (_this$dispatchAverage = this.dispatchAverage) === null || _this$dispatchAverage === void 0 || _this$dispatchAverage.call(this, {
86
86
  mean: this.getMean(),
87
87
  median: median,
88
88
  sampleSize: this.samples.length
@@ -130,5 +130,4 @@ var InputLatencyTracker = /*#__PURE__*/function () {
130
130
  }
131
131
  }]);
132
132
  return InputLatencyTracker;
133
- }();
134
- exports.default = InputLatencyTracker;
133
+ }();
@@ -22,7 +22,7 @@ var basePlugin = function basePlugin(_ref) {
22
22
  var _api$featureFlags;
23
23
  var options = _ref.config,
24
24
  api = _ref.api;
25
- var featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
25
+ var featureFlags = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
26
26
  return {
27
27
  name: 'base',
28
28
  getSharedState: function getSharedState(editorState) {
@@ -161,7 +161,7 @@ export default (function (dispatchAnalyticsEvent, inputTracking, browserFreezeTr
161
161
  normalThreshold: severityThresholdNormal,
162
162
  degradedThreshold: severityThresholdDegraded,
163
163
  onSampleStart: function onSampleStart() {
164
- experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.start(EditorExperience.typing);
164
+ experienceStore === null || experienceStore === void 0 || experienceStore.start(EditorExperience.typing);
165
165
  },
166
166
  onSampleEnd: function onSampleEnd(time, _ref2) {
167
167
  var _getContextIdentifier4;
@@ -170,11 +170,11 @@ export default (function (dispatchAnalyticsEvent, inputTracking, browserFreezeTr
170
170
  var state = _view.state;
171
171
  var nodesCount = getNodeCount(state);
172
172
  if (isSlow) {
173
- experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.addMetadata(EditorExperience.typing, {
173
+ experienceStore === null || experienceStore === void 0 || experienceStore.addMetadata(EditorExperience.typing, {
174
174
  slowInput: true
175
175
  });
176
176
  }
177
- experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.success(EditorExperience.typing, _objectSpread(_objectSpread({
177
+ experienceStore === null || experienceStore === void 0 || experienceStore.success(EditorExperience.typing, _objectSpread(_objectSpread({
178
178
  nodeSize: state.doc.nodeSize
179
179
  }, nodesCount), {}, {
180
180
  objectId: (_getContextIdentifier4 = getContextIdentifier(state)) === null || _getContextIdentifier4 === void 0 ? void 0 : _getContextIdentifier4.objectId,
@@ -242,8 +242,8 @@ export default (function (dispatchAnalyticsEvent, inputTracking, browserFreezeTr
242
242
  return {
243
243
  destroy: function destroy() {
244
244
  var _inputLatencyTracker;
245
- (_inputLatencyTracker = inputLatencyTracker) === null || _inputLatencyTracker === void 0 ? void 0 : _inputLatencyTracker.flush();
246
- observer === null || observer === void 0 ? void 0 : observer.disconnect();
245
+ (_inputLatencyTracker = inputLatencyTracker) === null || _inputLatencyTracker === void 0 || _inputLatencyTracker.flush();
246
+ observer === null || observer === void 0 || observer.disconnect();
247
247
  }
248
248
  };
249
249
  }
@@ -33,7 +33,7 @@ var InputLatencyTracker = /*#__PURE__*/function () {
33
33
  var currentStart = performance.now();
34
34
  if (this.samples.length + 1 === this.samplingRate) {
35
35
  var _this$onSampleStart;
36
- (_this$onSampleStart = this.onSampleStart) === null || _this$onSampleStart === void 0 ? void 0 : _this$onSampleStart.call(this);
36
+ (_this$onSampleStart = this.onSampleStart) === null || _this$onSampleStart === void 0 || _this$onSampleStart.call(this);
37
37
  }
38
38
  var end = function end() {
39
39
  if (currentStart === null) {
@@ -44,13 +44,13 @@ var InputLatencyTracker = /*#__PURE__*/function () {
44
44
  _this.push(time);
45
45
  if (time > _this.slowThreshold) {
46
46
  var _this$onSlowInput;
47
- (_this$onSlowInput = _this.onSlowInput) === null || _this$onSlowInput === void 0 ? void 0 : _this$onSlowInput.call(_this, time);
47
+ (_this$onSlowInput = _this.onSlowInput) === null || _this$onSlowInput === void 0 || _this$onSlowInput.call(_this, time);
48
48
  isSlow = true;
49
49
  }
50
50
  if (_this.samples.length === _this.samplingRate) {
51
51
  var _this$onSampleEnd;
52
52
  _this.flush();
53
- (_this$onSampleEnd = _this.onSampleEnd) === null || _this$onSampleEnd === void 0 ? void 0 : _this$onSampleEnd.call(_this, time, {
53
+ (_this$onSampleEnd = _this.onSampleEnd) === null || _this$onSampleEnd === void 0 || _this$onSampleEnd.call(_this, time, {
54
54
  isSlow: isSlow,
55
55
  severity: _this.severity(time)
56
56
  });
@@ -72,10 +72,10 @@ var InputLatencyTracker = /*#__PURE__*/function () {
72
72
  key: "dispatch",
73
73
  value: function dispatch() {
74
74
  var _this$dispatchSample, _this$dispatchAverage;
75
- (_this$dispatchSample = this.dispatchSample) === null || _this$dispatchSample === void 0 ? void 0 : _this$dispatchSample.call(this, this.getLast(), this.severity(this.getLast()));
75
+ (_this$dispatchSample = this.dispatchSample) === null || _this$dispatchSample === void 0 || _this$dispatchSample.call(this, this.getLast(), this.severity(this.getLast()));
76
76
  // cache
77
77
  var median = this.getMedian();
78
- (_this$dispatchAverage = this.dispatchAverage) === null || _this$dispatchAverage === void 0 ? void 0 : _this$dispatchAverage.call(this, {
78
+ (_this$dispatchAverage = this.dispatchAverage) === null || _this$dispatchAverage === void 0 || _this$dispatchAverage.call(this, {
79
79
  mean: this.getMean(),
80
80
  median: median,
81
81
  sampleSize: this.samples.length
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-base",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Base plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^32.0.0",
35
- "@atlaskit/editor-common": "^76.1.0",
35
+ "@atlaskit/editor-common": "^76.8.0",
36
36
  "@atlaskit/editor-plugin-feature-flags": "^1.0.1",
37
37
  "@atlaskit/editor-prosemirror": "1.1.0",
38
38
  "@atlaskit/platform-feature-flags": "^0.2.0",
@@ -41,9 +41,10 @@
41
41
  "devDependencies": {
42
42
  "@atlaskit/editor-plugin-analytics": "^0.2.0",
43
43
  "@atlaskit/editor-plugin-content-insertion": "^0.1.0",
44
- "@atlaskit/editor-plugin-emoji": "^0.3.0",
44
+ "@atlaskit/editor-plugin-emoji": "^0.4.0",
45
45
  "@atlaskit/editor-plugin-guideline": "^0.5.0",
46
- "@atlaskit/editor-plugin-table": "^4.0.0",
46
+ "@atlaskit/editor-plugin-selection": "^0.1.0",
47
+ "@atlaskit/editor-plugin-table": "^5.0.0",
47
48
  "@atlaskit/editor-plugin-width": "^0.2.0",
48
49
  "@atlaskit/util-data-test": "^17.8.0",
49
50
  "@atlaskit/webdriver-runner": "*",
package/tsconfig.dev.json CHANGED
@@ -59,6 +59,9 @@
59
59
  {
60
60
  "path": "../editor-plugin-guideline/tsconfig.app.json"
61
61
  },
62
+ {
63
+ "path": "../editor-plugin-selection/tsconfig.app.json"
64
+ },
62
65
  {
63
66
  "path": "../editor-plugin-table/tsconfig.app.json"
64
67
  },
@@ -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, BasePluginOptions, BasePluginState } from './plugin';
3
- import type { ScrollGutterPluginOptions } from './pm-plugins/scroll-gutter';
4
- export { basePlugin };
5
- export type { BasePlugin, BasePluginState, BasePluginOptions, ScrollGutterPluginOptions, };
@@ -1,30 +0,0 @@
1
- import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
2
- import type { BrowserFreezetracking, InputTracking, NextEditorPlugin } from '@atlaskit/editor-common/types';
3
- import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
4
- import { setKeyboardHeight } from './commands';
5
- import type { ScrollGutterPluginOptions } from './pm-plugins/scroll-gutter';
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
- actions: {
25
- setKeyboardHeight: typeof setKeyboardHeight;
26
- };
27
- }>;
28
- export declare const isChromeWithSelectionBug: any;
29
- declare const basePlugin: BasePlugin;
30
- export default basePlugin;
@@ -1,12 +0,0 @@
1
- import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
2
- import type { ContextIdentifierProvider, ProviderFactory } 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
- export declare const stateKey: PluginKey<any>;
7
- export interface PluginState {
8
- contextIdentifierProvider?: ContextIdentifierProvider;
9
- }
10
- export declare const getContextIdentifier: (state?: EditorState) => ContextIdentifierProvider | undefined;
11
- declare const _default: (dispatch: Dispatch, providerFactory?: ProviderFactory) => SafePlugin<{}>;
12
- 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 type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
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 type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import type { BrowserFreezetracking, InputTracking } from '@atlaskit/editor-common/types';
4
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
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 { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { Node } from '@atlaskit/editor-prosemirror/model';
3
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
- import { Decoration } from '@atlaskit/editor-prosemirror/view';
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,4 +0,0 @@
1
- import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
2
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- export type CommandDispatch = (tr: Transaction) => void;
4
- export type Command = (state: EditorState, dispatch?: CommandDispatch, view?: EditorView) => boolean;
@@ -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,61 +0,0 @@
1
- ## API Report File for "@atlaskit/editor-plugin-base"
2
-
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
-
5
- ```ts
6
-
7
- import type { BrowserFreezetracking } from '@atlaskit/editor-common/types';
8
- import type { Command } from '@atlaskit/editor-common/types';
9
- import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
10
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
11
- import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
12
- import type { InputTracking } from '@atlaskit/editor-common/types';
13
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
14
-
15
- // @public (undocumented)
16
- export type BasePlugin = NextEditorPlugin<'base', {
17
- pluginConfiguration: BasePluginOptions | undefined;
18
- dependencies: [FeatureFlagsPlugin];
19
- sharedState: BasePluginState;
20
- actions: {
21
- setKeyboardHeight: typeof setKeyboardHeight;
22
- };
23
- }>;
24
-
25
- // @public (undocumented)
26
- export const basePlugin: BasePlugin;
27
-
28
- // @public (undocumented)
29
- export interface BasePluginOptions {
30
- // (undocumented)
31
- allowInlineCursorTarget?: boolean;
32
- // (undocumented)
33
- allowScrollGutter?: ScrollGutterPluginOptions;
34
- // (undocumented)
35
- browserFreezeTracking?: BrowserFreezetracking;
36
- // (undocumented)
37
- inputTracking?: InputTracking;
38
- // (undocumented)
39
- ufo?: boolean;
40
- }
41
-
42
- // @public (undocumented)
43
- export type BasePluginState = {
44
- contextIdentifier: ContextIdentifierProvider | undefined;
45
- keyboardHeight: number | undefined;
46
- };
47
-
48
- // @public (undocumented)
49
- export type ScrollGutterPluginOptions = {
50
- getScrollElement?: (view: EditorView) => HTMLElement | null;
51
- allowCustomScrollHandler?: boolean;
52
- persistScrollGutter?: boolean;
53
- gutterSize?: number;
54
- };
55
-
56
- // @public (undocumented)
57
- const setKeyboardHeight: (keyboardHeight: number) => Command;
58
-
59
- // (No @packageDocumentation comment for this package)
60
-
61
- ```