@atlaskit/editor-plugin-show-diff 6.2.1 → 6.2.3
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 +13 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-jira/tsconfig.json +3 -0
- package/afm-products/tsconfig.json +3 -0
- package/dist/cjs/pm-plugins/enforceCustomStepRegisters.js +43 -0
- package/dist/cjs/pm-plugins/main.js +4 -0
- package/dist/es2019/pm-plugins/enforceCustomStepRegisters.js +32 -0
- package/dist/es2019/pm-plugins/main.js +4 -0
- package/dist/esm/pm-plugins/enforceCustomStepRegisters.js +33 -0
- package/dist/esm/pm-plugins/main.js +4 -0
- package/dist/types/pm-plugins/enforceCustomStepRegisters.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/enforceCustomStepRegisters.d.ts +1 -0
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-show-diff
|
|
2
2
|
|
|
3
|
+
## 6.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`c2b3bd8f1e4cb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c2b3bd8f1e4cb) -
|
|
8
|
+
Enforce custom step registers for show diff plugin for consistency.
|
|
9
|
+
|
|
10
|
+
## 6.2.2
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 6.2.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
package/afm-jira/tsconfig.json
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.enforceCustomStepRegisters = void 0;
|
|
8
|
+
var adfCustomSteps = _interopRequireWildcard(require("@atlaskit/adf-schema/steps"));
|
|
9
|
+
var atlaskKitCustomSteps = _interopRequireWildcard(require("@atlaskit/custom-steps"));
|
|
10
|
+
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
12
|
+
// It is important to get all steps in that package
|
|
13
|
+
// Ignored via go/ees005
|
|
14
|
+
// eslint-disable-next-line import/no-namespace
|
|
15
|
+
|
|
16
|
+
// It is important to get all steps in that package
|
|
17
|
+
// Ignored via go/ees005
|
|
18
|
+
// eslint-disable-next-line import/no-namespace
|
|
19
|
+
|
|
20
|
+
var enforceCustomStepRegisters = exports.enforceCustomStepRegisters = function enforceCustomStepRegisters() {
|
|
21
|
+
var tryToRegisterStep = function tryToRegisterStep(obj) {
|
|
22
|
+
for (var _i = 0, _Object$values = Object.values(obj); _i < _Object$values.length; _i++) {
|
|
23
|
+
var _customStep$prototype;
|
|
24
|
+
var customStep = _Object$values[_i];
|
|
25
|
+
// @ts-expect-error ProseMirror step classes expose jsonID on prototype.
|
|
26
|
+
var id = customStep === null || customStep === void 0 || (_customStep$prototype = customStep.prototype) === null || _customStep$prototype === void 0 ? void 0 : _customStep$prototype.jsonID;
|
|
27
|
+
if (typeof id === 'string') {
|
|
28
|
+
try {
|
|
29
|
+
// Re-register if needed; ignore if already registered.
|
|
30
|
+
// @ts-expect-error Step.jsonID expects a step constructor.
|
|
31
|
+
_transform.Step.jsonID(id, customStep);
|
|
32
|
+
} catch (_unused) {
|
|
33
|
+
// Step already registered.
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// @ts-expect-error Step modules export non-step symbols too.
|
|
40
|
+
tryToRegisterStep(atlaskKitCustomSteps);
|
|
41
|
+
// @ts-expect-error Step modules export non-step symbols too.
|
|
42
|
+
tryToRegisterStep(adfCustomSteps);
|
|
43
|
+
};
|
|
@@ -14,6 +14,7 @@ var _view = require("@atlaskit/editor-prosemirror/view");
|
|
|
14
14
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
15
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
16
16
|
var _calculateDiffDecorations = require("./calculateDiff/calculateDiffDecorations");
|
|
17
|
+
var _enforceCustomStepRegisters = require("./enforceCustomStepRegisters");
|
|
17
18
|
var _NodeViewSerializer = require("./NodeViewSerializer");
|
|
18
19
|
var _scrollToActiveDecoration = require("./scrollToActiveDecoration");
|
|
19
20
|
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; }
|
|
@@ -42,6 +43,9 @@ var getScrollableDecorations = exports.getScrollableDecorations = function getSc
|
|
|
42
43
|
});
|
|
43
44
|
};
|
|
44
45
|
var createPlugin = exports.createPlugin = function createPlugin(config, getIntl, api) {
|
|
46
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_show_diff_equality_fallback')) {
|
|
47
|
+
(0, _enforceCustomStepRegisters.enforceCustomStepRegisters)();
|
|
48
|
+
}
|
|
45
49
|
var nodeViewSerializer = new _NodeViewSerializer.NodeViewSerializer({});
|
|
46
50
|
var setNodeViewSerializer = function setNodeViewSerializer(editorView) {
|
|
47
51
|
nodeViewSerializer.init({
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// It is important to get all steps in that package
|
|
2
|
+
// Ignored via go/ees005
|
|
3
|
+
// eslint-disable-next-line import/no-namespace
|
|
4
|
+
import * as adfCustomSteps from '@atlaskit/adf-schema/steps';
|
|
5
|
+
// It is important to get all steps in that package
|
|
6
|
+
// Ignored via go/ees005
|
|
7
|
+
// eslint-disable-next-line import/no-namespace
|
|
8
|
+
import * as atlaskKitCustomSteps from '@atlaskit/custom-steps';
|
|
9
|
+
import { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
10
|
+
export const enforceCustomStepRegisters = () => {
|
|
11
|
+
const tryToRegisterStep = obj => {
|
|
12
|
+
for (const customStep of Object.values(obj)) {
|
|
13
|
+
var _customStep$prototype;
|
|
14
|
+
// @ts-expect-error ProseMirror step classes expose jsonID on prototype.
|
|
15
|
+
const id = customStep === null || customStep === void 0 ? void 0 : (_customStep$prototype = customStep.prototype) === null || _customStep$prototype === void 0 ? void 0 : _customStep$prototype.jsonID;
|
|
16
|
+
if (typeof id === 'string') {
|
|
17
|
+
try {
|
|
18
|
+
// Re-register if needed; ignore if already registered.
|
|
19
|
+
// @ts-expect-error Step.jsonID expects a step constructor.
|
|
20
|
+
Step.jsonID(id, customStep);
|
|
21
|
+
} catch {
|
|
22
|
+
// Step already registered.
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// @ts-expect-error Step modules export non-step symbols too.
|
|
29
|
+
tryToRegisterStep(atlaskKitCustomSteps);
|
|
30
|
+
// @ts-expect-error Step modules export non-step symbols too.
|
|
31
|
+
tryToRegisterStep(adfCustomSteps);
|
|
32
|
+
};
|
|
@@ -6,6 +6,7 @@ import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
8
|
import { calculateDiffDecorations } from './calculateDiff/calculateDiffDecorations';
|
|
9
|
+
import { enforceCustomStepRegisters } from './enforceCustomStepRegisters';
|
|
9
10
|
import { NodeViewSerializer } from './NodeViewSerializer';
|
|
10
11
|
import { scrollToActiveDecoration } from './scrollToActiveDecoration';
|
|
11
12
|
export const showDiffPluginKey = new PluginKey('showDiffPlugin');
|
|
@@ -30,6 +31,9 @@ export const getScrollableDecorations = set => {
|
|
|
30
31
|
}).sort((a, b) => a.from === b.from ? a.to - b.to : a.from - b.from);
|
|
31
32
|
};
|
|
32
33
|
export const createPlugin = (config, getIntl, api) => {
|
|
34
|
+
if (fg('platform_editor_show_diff_equality_fallback')) {
|
|
35
|
+
enforceCustomStepRegisters();
|
|
36
|
+
}
|
|
33
37
|
const nodeViewSerializer = new NodeViewSerializer({});
|
|
34
38
|
const setNodeViewSerializer = editorView => {
|
|
35
39
|
nodeViewSerializer.init({
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// It is important to get all steps in that package
|
|
2
|
+
// Ignored via go/ees005
|
|
3
|
+
// eslint-disable-next-line import/no-namespace
|
|
4
|
+
import * as adfCustomSteps from '@atlaskit/adf-schema/steps';
|
|
5
|
+
// It is important to get all steps in that package
|
|
6
|
+
// Ignored via go/ees005
|
|
7
|
+
// eslint-disable-next-line import/no-namespace
|
|
8
|
+
import * as atlaskKitCustomSteps from '@atlaskit/custom-steps';
|
|
9
|
+
import { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
10
|
+
export var enforceCustomStepRegisters = function enforceCustomStepRegisters() {
|
|
11
|
+
var tryToRegisterStep = function tryToRegisterStep(obj) {
|
|
12
|
+
for (var _i = 0, _Object$values = Object.values(obj); _i < _Object$values.length; _i++) {
|
|
13
|
+
var _customStep$prototype;
|
|
14
|
+
var customStep = _Object$values[_i];
|
|
15
|
+
// @ts-expect-error ProseMirror step classes expose jsonID on prototype.
|
|
16
|
+
var id = customStep === null || customStep === void 0 || (_customStep$prototype = customStep.prototype) === null || _customStep$prototype === void 0 ? void 0 : _customStep$prototype.jsonID;
|
|
17
|
+
if (typeof id === 'string') {
|
|
18
|
+
try {
|
|
19
|
+
// Re-register if needed; ignore if already registered.
|
|
20
|
+
// @ts-expect-error Step.jsonID expects a step constructor.
|
|
21
|
+
Step.jsonID(id, customStep);
|
|
22
|
+
} catch (_unused) {
|
|
23
|
+
// Step already registered.
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// @ts-expect-error Step modules export non-step symbols too.
|
|
30
|
+
tryToRegisterStep(atlaskKitCustomSteps);
|
|
31
|
+
// @ts-expect-error Step modules export non-step symbols too.
|
|
32
|
+
tryToRegisterStep(adfCustomSteps);
|
|
33
|
+
};
|
|
@@ -9,6 +9,7 @@ import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
11
|
import { calculateDiffDecorations } from './calculateDiff/calculateDiffDecorations';
|
|
12
|
+
import { enforceCustomStepRegisters } from './enforceCustomStepRegisters';
|
|
12
13
|
import { NodeViewSerializer } from './NodeViewSerializer';
|
|
13
14
|
import { scrollToActiveDecoration } from './scrollToActiveDecoration';
|
|
14
15
|
export var showDiffPluginKey = new PluginKey('showDiffPlugin');
|
|
@@ -35,6 +36,9 @@ export var getScrollableDecorations = function getScrollableDecorations(set) {
|
|
|
35
36
|
});
|
|
36
37
|
};
|
|
37
38
|
export var createPlugin = function createPlugin(config, getIntl, api) {
|
|
39
|
+
if (fg('platform_editor_show_diff_equality_fallback')) {
|
|
40
|
+
enforceCustomStepRegisters();
|
|
41
|
+
}
|
|
38
42
|
var nodeViewSerializer = new NodeViewSerializer({});
|
|
39
43
|
var setNodeViewSerializer = function setNodeViewSerializer(editorView) {
|
|
40
44
|
nodeViewSerializer.init({
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const enforceCustomStepRegisters: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const enforceCustomStepRegisters: () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-show-diff",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.3",
|
|
4
4
|
"description": "ShowDiff plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,12 +29,13 @@
|
|
|
29
29
|
"atlaskit:src": "src/index.ts",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/adf-schema": "^52.4.0",
|
|
32
|
+
"@atlaskit/custom-steps": "^0.16.0",
|
|
32
33
|
"@atlaskit/editor-plugin-analytics": "^8.0.0",
|
|
33
34
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
34
35
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
35
36
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
36
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
37
|
-
"@atlaskit/tokens": "^11.
|
|
37
|
+
"@atlaskit/tmp-editor-statsig": "^47.0.0",
|
|
38
|
+
"@atlaskit/tokens": "^11.3.0",
|
|
38
39
|
"@babel/runtime": "^7.0.0",
|
|
39
40
|
"lodash": "^4.17.21",
|
|
40
41
|
"memoize-one": "^6.0.0",
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
"@atlassian/content-reconciliation": "^0.1.3506"
|
|
46
47
|
},
|
|
47
48
|
"peerDependencies": {
|
|
48
|
-
"@atlaskit/editor-common": "^112.
|
|
49
|
+
"@atlaskit/editor-common": "^112.10.0",
|
|
49
50
|
"react": "^18.2.0"
|
|
50
51
|
},
|
|
51
52
|
"techstack": {
|