@atlaskit/editor-plugin-base 0.3.4 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
2
1
  import type { BrowserFreezetracking, InputTracking, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import type { ContextIdentifierPlugin } from '@atlaskit/editor-plugin-context-identifier';
3
3
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
4
4
  import { setKeyboardHeight } from './commands';
5
5
  import type { ScrollGutterPluginOptions } from './pm-plugins/scroll-gutter';
@@ -11,13 +11,15 @@ export interface BasePluginOptions {
11
11
  ufo?: boolean;
12
12
  }
13
13
  export type BasePluginState = {
14
- contextIdentifier: ContextIdentifierProvider | undefined;
15
14
  /** Current height of keyboard (+ custom toolbar) in iOS app */
16
15
  keyboardHeight: number | undefined;
17
16
  };
18
17
  export type BasePlugin = NextEditorPlugin<'base', {
19
18
  pluginConfiguration: BasePluginOptions | undefined;
20
- dependencies: [OptionalPlugin<FeatureFlagsPlugin>];
19
+ dependencies: [
20
+ OptionalPlugin<FeatureFlagsPlugin>,
21
+ OptionalPlugin<ContextIdentifierPlugin>
22
+ ];
21
23
  sharedState: BasePluginState;
22
24
  actions: {
23
25
  setKeyboardHeight: typeof setKeyboardHeight;
@@ -1,12 +1,13 @@
1
1
  import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import type { BrowserFreezetracking, InputTracking } from '@atlaskit/editor-common/types';
3
+ import type { BrowserFreezetracking, ExtractInjectionAPI, InputTracking } from '@atlaskit/editor-common/types';
4
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
+ import type { BasePlugin } from '../index';
5
6
  export declare const frozenEditorPluginKey: PluginKey<any>;
6
7
  export declare const DEFAULT_FREEZE_THRESHOLD = 600;
7
8
  export declare const NORMAL_SEVERITY_THRESHOLD = 2000;
8
9
  export declare const DEGRADED_SEVERITY_THRESHOLD = 3000;
9
10
  export declare const DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL = 100;
10
11
  export declare const DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED = 500;
11
- declare const _default: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, inputTracking?: InputTracking, browserFreezeTracking?: BrowserFreezetracking, ufo?: boolean) => SafePlugin<any>;
12
+ declare const _default: (contextIdentifierPlugin: ExtractInjectionAPI<BasePlugin>['contextIdentifier'] | undefined) => (dispatchAnalyticsEvent: DispatchAnalyticsEvent, inputTracking?: InputTracking, browserFreezeTracking?: BrowserFreezetracking, ufo?: boolean) => SafePlugin<any>;
12
13
  export default _default;
@@ -1,5 +1,5 @@
1
- import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
2
1
  import type { BrowserFreezetracking, InputTracking, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import type { ContextIdentifierPlugin } from '@atlaskit/editor-plugin-context-identifier';
3
3
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
4
4
  import { setKeyboardHeight } from './commands';
5
5
  import type { ScrollGutterPluginOptions } from './pm-plugins/scroll-gutter';
@@ -11,14 +11,14 @@ export interface BasePluginOptions {
11
11
  ufo?: boolean;
12
12
  }
13
13
  export type BasePluginState = {
14
- contextIdentifier: ContextIdentifierProvider | undefined;
15
14
  /** Current height of keyboard (+ custom toolbar) in iOS app */
16
15
  keyboardHeight: number | undefined;
17
16
  };
18
17
  export type BasePlugin = NextEditorPlugin<'base', {
19
18
  pluginConfiguration: BasePluginOptions | undefined;
20
19
  dependencies: [
21
- OptionalPlugin<FeatureFlagsPlugin>
20
+ OptionalPlugin<FeatureFlagsPlugin>,
21
+ OptionalPlugin<ContextIdentifierPlugin>
22
22
  ];
23
23
  sharedState: BasePluginState;
24
24
  actions: {
@@ -1,12 +1,13 @@
1
1
  import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import type { BrowserFreezetracking, InputTracking } from '@atlaskit/editor-common/types';
3
+ import type { BrowserFreezetracking, ExtractInjectionAPI, InputTracking } from '@atlaskit/editor-common/types';
4
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
+ import type { BasePlugin } from '../index';
5
6
  export declare const frozenEditorPluginKey: PluginKey<any>;
6
7
  export declare const DEFAULT_FREEZE_THRESHOLD = 600;
7
8
  export declare const NORMAL_SEVERITY_THRESHOLD = 2000;
8
9
  export declare const DEGRADED_SEVERITY_THRESHOLD = 3000;
9
10
  export declare const DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL = 100;
10
11
  export declare const DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED = 500;
11
- declare const _default: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, inputTracking?: InputTracking, browserFreezeTracking?: BrowserFreezetracking, ufo?: boolean) => SafePlugin<any>;
12
+ declare const _default: (contextIdentifierPlugin: ExtractInjectionAPI<BasePlugin>['contextIdentifier'] | undefined) => (dispatchAnalyticsEvent: DispatchAnalyticsEvent, inputTracking?: InputTracking, browserFreezeTracking?: BrowserFreezetracking, ufo?: boolean) => SafePlugin<any>;
12
13
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-base",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "Base plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,8 +32,9 @@
32
32
  ".": "./src/index.ts"
33
33
  },
34
34
  "dependencies": {
35
- "@atlaskit/adf-schema": "^35.3.0",
36
- "@atlaskit/editor-common": "^77.0.0",
35
+ "@atlaskit/adf-schema": "^35.5.1",
36
+ "@atlaskit/editor-common": "^77.2.0",
37
+ "@atlaskit/editor-plugin-context-identifier": "^0.1.0",
37
38
  "@atlaskit/editor-plugin-feature-flags": "^1.0.1",
38
39
  "@atlaskit/editor-prosemirror": "1.1.0",
39
40
  "@babel/runtime": "^7.0.0"
@@ -41,10 +42,10 @@
41
42
  "devDependencies": {
42
43
  "@atlaskit/editor-plugin-analytics": "^0.4.0",
43
44
  "@atlaskit/editor-plugin-content-insertion": "^0.1.0",
44
- "@atlaskit/editor-plugin-emoji": "^1.0.0",
45
+ "@atlaskit/editor-plugin-emoji": "^1.1.0",
45
46
  "@atlaskit/editor-plugin-guideline": "^0.5.0",
46
47
  "@atlaskit/editor-plugin-selection": "^0.2.0",
47
- "@atlaskit/editor-plugin-table": "^7.0.0",
48
+ "@atlaskit/editor-plugin-table": "^7.2.0",
48
49
  "@atlaskit/editor-plugin-type-ahead": "^0.9.0",
49
50
  "@atlaskit/editor-plugin-width": "^0.2.0",
50
51
  "@atlaskit/util-data-test": "^17.8.0",
package/tsconfig.app.json CHANGED
@@ -35,6 +35,9 @@
35
35
  {
36
36
  "path": "../editor-common/tsconfig.app.json"
37
37
  },
38
+ {
39
+ "path": "../editor-plugin-context-identifier/tsconfig.app.json"
40
+ },
38
41
  {
39
42
  "path": "../editor-plugin-feature-flags/tsconfig.app.json"
40
43
  }
@@ -1,55 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.stateKey = exports.getContextIdentifier = exports.default = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
10
- var _state = require("@atlaskit/editor-prosemirror/state");
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
- 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 = exports.stateKey = new _state.PluginKey('contextIdentiferPlugin');
14
- var getContextIdentifier = exports.getContextIdentifier = function getContextIdentifier(state) {
15
- if (state) {
16
- var _stateKey$getState;
17
- return (_stateKey$getState = stateKey.getState(state)) === null || _stateKey$getState === void 0 ? void 0 : _stateKey$getState.contextIdentifierProvider;
18
- }
19
- };
20
- var _default = exports.default = function _default(dispatch, providerFactory) {
21
- return new _safePlugin.SafePlugin({
22
- key: stateKey,
23
- state: {
24
- init: function init() {
25
- return {};
26
- },
27
- apply: function apply(tr, pluginState) {
28
- if (tr.getMeta(stateKey)) {
29
- return tr.getMeta(stateKey);
30
- }
31
- return pluginState;
32
- }
33
- },
34
- view: function view(_view) {
35
- var providerPromiseHandler = function providerPromiseHandler(name, providerPromise) {
36
- if (providerPromise && name === 'contextIdentifierProvider') {
37
- providerPromise.then(function (provider) {
38
- var tr = _view.state.tr.setMeta(stateKey, {
39
- contextIdentifierProvider: _objectSpread({}, provider)
40
- });
41
- _view.dispatch(tr);
42
- });
43
- }
44
- };
45
- if (providerFactory) {
46
- providerFactory.subscribe('contextIdentifierProvider', providerPromiseHandler);
47
- }
48
- return {
49
- destroy: function destroy() {
50
- providerFactory && providerFactory.unsubscribe('contextIdentifierProvider', providerPromiseHandler);
51
- }
52
- };
53
- }
54
- });
55
- };
@@ -1,43 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- export const stateKey = new PluginKey('contextIdentiferPlugin');
4
- export const getContextIdentifier = state => {
5
- if (state) {
6
- var _stateKey$getState;
7
- return (_stateKey$getState = stateKey.getState(state)) === null || _stateKey$getState === void 0 ? void 0 : _stateKey$getState.contextIdentifierProvider;
8
- }
9
- };
10
- export default ((dispatch, providerFactory) => new SafePlugin({
11
- key: stateKey,
12
- state: {
13
- init: () => ({}),
14
- apply: (tr, pluginState) => {
15
- if (tr.getMeta(stateKey)) {
16
- return tr.getMeta(stateKey);
17
- }
18
- return pluginState;
19
- }
20
- },
21
- view: view => {
22
- const providerPromiseHandler = (name, providerPromise) => {
23
- if (providerPromise && name === 'contextIdentifierProvider') {
24
- providerPromise.then(provider => {
25
- const tr = view.state.tr.setMeta(stateKey, {
26
- contextIdentifierProvider: {
27
- ...provider
28
- }
29
- });
30
- view.dispatch(tr);
31
- });
32
- }
33
- };
34
- if (providerFactory) {
35
- providerFactory.subscribe('contextIdentifierProvider', providerPromiseHandler);
36
- }
37
- return {
38
- destroy: () => {
39
- providerFactory && providerFactory.unsubscribe('contextIdentifierProvider', providerPromiseHandler);
40
- }
41
- };
42
- }
43
- }));
@@ -1,48 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
- export var stateKey = new PluginKey('contextIdentiferPlugin');
7
- export var getContextIdentifier = function getContextIdentifier(state) {
8
- if (state) {
9
- var _stateKey$getState;
10
- return (_stateKey$getState = stateKey.getState(state)) === null || _stateKey$getState === void 0 ? void 0 : _stateKey$getState.contextIdentifierProvider;
11
- }
12
- };
13
- export default (function (dispatch, providerFactory) {
14
- return new SafePlugin({
15
- key: stateKey,
16
- state: {
17
- init: function init() {
18
- return {};
19
- },
20
- apply: function apply(tr, pluginState) {
21
- if (tr.getMeta(stateKey)) {
22
- return tr.getMeta(stateKey);
23
- }
24
- return pluginState;
25
- }
26
- },
27
- view: function view(_view) {
28
- var providerPromiseHandler = function providerPromiseHandler(name, providerPromise) {
29
- if (providerPromise && name === 'contextIdentifierProvider') {
30
- providerPromise.then(function (provider) {
31
- var tr = _view.state.tr.setMeta(stateKey, {
32
- contextIdentifierProvider: _objectSpread({}, provider)
33
- });
34
- _view.dispatch(tr);
35
- });
36
- }
37
- };
38
- if (providerFactory) {
39
- providerFactory.subscribe('contextIdentifierProvider', providerPromiseHandler);
40
- }
41
- return {
42
- destroy: function destroy() {
43
- providerFactory && providerFactory.unsubscribe('contextIdentifierProvider', providerPromiseHandler);
44
- }
45
- };
46
- }
47
- });
48
- });
@@ -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,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;