@atlaskit/editor-plugin-collab-edit 1.1.5 → 1.1.7

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-collab-edit
2
2
 
3
+ ## 1.1.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#82658](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/82658) [`9302baf5248c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9302baf5248c) - Improve Custom Step registration
8
+
9
+ ## 1.1.6
10
+
11
+ ### Patch Changes
12
+
13
+ - [#82308](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/82308) [`26970b6663ae`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/26970b6663ae) - Register the custom prosemirror within the collab PM plugin
14
+
3
15
  ## 1.1.5
4
16
 
5
17
  ### Patch Changes
@@ -1,16 +1,56 @@
1
1
  "use strict";
2
2
 
3
+ var _typeof = require("@babel/runtime/helpers/typeof");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.createPlugin = void 0;
8
+ var adfCustomSteps = _interopRequireWildcard(require("@atlaskit/adf-schema/steps"));
9
+ var atlaskKitCustomSteps = _interopRequireWildcard(require("@atlaskit/custom-steps"));
7
10
  var _analytics = require("@atlaskit/editor-common/analytics");
8
11
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
12
+ var _transform = require("@atlaskit/editor-prosemirror/transform");
9
13
  var _analytics2 = require("../../analytics");
10
14
  var _initialize = require("../../events/initialize");
11
15
  var _pluginKey = require("./plugin-key");
12
16
  var _pluginState = require("./plugin-state");
17
+ 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); }
18
+ 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 && Object.prototype.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; }
19
+ // It is important to get all steps in that package
20
+
21
+ // It is important to get all steps in that package
22
+
23
+ var enforceCustomStepRegisters = function enforceCustomStepRegisters() {
24
+ var tryToRegisterStep = function tryToRegisterStep(obj) {
25
+ for (var _i = 0, _Object$values = Object.values(obj); _i < _Object$values.length; _i++) {
26
+ var _customStep$prototype;
27
+ var customStep = _Object$values[_i];
28
+ // I know this seems awful
29
+ // But unfortunate ProseMirror does not expose the jsonID property p
30
+ // @ts-expect-error
31
+ var id = customStep === null || customStep === void 0 || (_customStep$prototype = customStep.prototype) === null || _customStep$prototype === void 0 ? void 0 : _customStep$prototype.jsonID;
32
+ if (typeof id === 'string') {
33
+ try {
34
+ // We are trying to re-register the steps here
35
+ // in the normal flow, those custom step should be already registred
36
+ // So, it should throw an expeception
37
+ // @ts-expect-error
38
+ _transform.Step.jsonID(id, customStep);
39
+ } catch (e) {
40
+ // This mean the step was already registred.
41
+ // It is ok to ignore this exception.
42
+ }
43
+ }
44
+ }
45
+ };
46
+
47
+ // @ts-expect-error
48
+ tryToRegisterStep(atlaskKitCustomSteps);
49
+ // @ts-expect-error
50
+ tryToRegisterStep(adfCustomSteps);
51
+ };
13
52
  var createPlugin = exports.createPlugin = function createPlugin(dispatch, providerFactory, providerResolver, collabProviderCallback, options, featureFlags, pluginInjectionApi) {
53
+ enforceCustomStepRegisters();
14
54
  return new _safePlugin.SafePlugin({
15
55
  key: _pluginKey.pluginKey,
16
56
  state: {
@@ -1,10 +1,44 @@
1
+ // It is important to get all steps in that package
2
+ import * as adfCustomSteps from '@atlaskit/adf-schema/steps';
3
+ // It is important to get all steps in that package
4
+ import * as atlaskKitCustomSteps from '@atlaskit/custom-steps';
1
5
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
6
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
+ import { Step } from '@atlaskit/editor-prosemirror/transform';
3
8
  import { addSynchronyErrorAnalytics } from '../../analytics';
4
9
  import { initialize } from '../../events/initialize';
5
10
  import { pluginKey } from './plugin-key';
6
11
  import { PluginState } from './plugin-state';
12
+ const enforceCustomStepRegisters = () => {
13
+ const tryToRegisterStep = obj => {
14
+ for (let customStep of Object.values(obj)) {
15
+ var _customStep$prototype;
16
+ // I know this seems awful
17
+ // But unfortunate ProseMirror does not expose the jsonID property p
18
+ // @ts-expect-error
19
+ const id = customStep === null || customStep === void 0 ? void 0 : (_customStep$prototype = customStep.prototype) === null || _customStep$prototype === void 0 ? void 0 : _customStep$prototype.jsonID;
20
+ if (typeof id === 'string') {
21
+ try {
22
+ // We are trying to re-register the steps here
23
+ // in the normal flow, those custom step should be already registred
24
+ // So, it should throw an expeception
25
+ // @ts-expect-error
26
+ Step.jsonID(id, customStep);
27
+ } catch (e) {
28
+ // This mean the step was already registred.
29
+ // It is ok to ignore this exception.
30
+ }
31
+ }
32
+ }
33
+ };
34
+
35
+ // @ts-expect-error
36
+ tryToRegisterStep(atlaskKitCustomSteps);
37
+ // @ts-expect-error
38
+ tryToRegisterStep(adfCustomSteps);
39
+ };
7
40
  export const createPlugin = (dispatch, providerFactory, providerResolver, collabProviderCallback, options, featureFlags, pluginInjectionApi) => {
41
+ enforceCustomStepRegisters();
8
42
  return new SafePlugin({
9
43
  key: pluginKey,
10
44
  state: {
@@ -1,10 +1,45 @@
1
+ // It is important to get all steps in that package
2
+ import * as adfCustomSteps from '@atlaskit/adf-schema/steps';
3
+ // It is important to get all steps in that package
4
+ import * as atlaskKitCustomSteps from '@atlaskit/custom-steps';
1
5
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
6
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
+ import { Step } from '@atlaskit/editor-prosemirror/transform';
3
8
  import { addSynchronyErrorAnalytics } from '../../analytics';
4
9
  import { initialize } from '../../events/initialize';
5
10
  import { pluginKey } from './plugin-key';
6
11
  import { PluginState } from './plugin-state';
12
+ var enforceCustomStepRegisters = function enforceCustomStepRegisters() {
13
+ var tryToRegisterStep = function tryToRegisterStep(obj) {
14
+ for (var _i = 0, _Object$values = Object.values(obj); _i < _Object$values.length; _i++) {
15
+ var _customStep$prototype;
16
+ var customStep = _Object$values[_i];
17
+ // I know this seems awful
18
+ // But unfortunate ProseMirror does not expose the jsonID property p
19
+ // @ts-expect-error
20
+ var id = customStep === null || customStep === void 0 || (_customStep$prototype = customStep.prototype) === null || _customStep$prototype === void 0 ? void 0 : _customStep$prototype.jsonID;
21
+ if (typeof id === 'string') {
22
+ try {
23
+ // We are trying to re-register the steps here
24
+ // in the normal flow, those custom step should be already registred
25
+ // So, it should throw an expeception
26
+ // @ts-expect-error
27
+ Step.jsonID(id, customStep);
28
+ } catch (e) {
29
+ // This mean the step was already registred.
30
+ // It is ok to ignore this exception.
31
+ }
32
+ }
33
+ }
34
+ };
35
+
36
+ // @ts-expect-error
37
+ tryToRegisterStep(atlaskKitCustomSteps);
38
+ // @ts-expect-error
39
+ tryToRegisterStep(adfCustomSteps);
40
+ };
7
41
  export var createPlugin = function createPlugin(dispatch, providerFactory, providerResolver, collabProviderCallback, options, featureFlags, pluginInjectionApi) {
42
+ enforceCustomStepRegisters();
8
43
  return new SafePlugin({
9
44
  key: pluginKey,
10
45
  state: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-collab-edit",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "Collab Edit plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,9 @@
32
32
  ".": "./src/index.ts"
33
33
  },
34
34
  "dependencies": {
35
- "@atlaskit/editor-common": "^78.12.0",
35
+ "@atlaskit/adf-schema": "^35.6.0",
36
+ "@atlaskit/custom-steps": "^0.0.15",
37
+ "@atlaskit/editor-common": "^78.17.0",
36
38
  "@atlaskit/editor-plugin-analytics": "1.0.4",
37
39
  "@atlaskit/editor-plugin-feature-flags": "^1.0.0",
38
40
  "@atlaskit/editor-prosemirror": "3.0.0",
@@ -47,12 +49,11 @@
47
49
  "devDependencies": {
48
50
  "@af/integration-testing": "*",
49
51
  "@af/visual-regression": "*",
50
- "@atlaskit/adf-schema": "^35.6.0",
51
52
  "@atlaskit/editor-plugin-mentions": "^1.0.0",
52
- "@atlaskit/editor-plugin-text-formatting": "^1.2.0",
53
+ "@atlaskit/editor-plugin-text-formatting": "^1.3.0",
53
54
  "@atlaskit/editor-plugin-type-ahead": "^1.0.0",
54
55
  "@atlaskit/editor-plugin-unsupported-content": "^1.0.0",
55
- "@atlaskit/editor-test-helpers": "^18.19.0",
56
+ "@atlaskit/editor-test-helpers": "^18.20.0",
56
57
  "@atlaskit/ssr": "*",
57
58
  "@atlaskit/synchrony-test-helpers": "^2.3.0",
58
59
  "@atlaskit/util-data-test": "^17.9.0",
@@ -87,11 +88,9 @@
87
88
  "ui-components": [
88
89
  "lite-mode"
89
90
  ],
90
- "deprecation": [
91
- "no-deprecated-imports"
92
- ],
91
+ "deprecation": "no-deprecated-imports",
93
92
  "styling": [
94
- "static",
93
+ "emotion",
95
94
  "emotion"
96
95
  ],
97
96
  "imports": [