@atlaskit/editor-plugin-decorations 2.0.4 → 2.0.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.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/pm-plugins/main.js +19 -7
- package/dist/es2019/pm-plugins/main.js +18 -5
- package/dist/esm/pm-plugins/main.js +19 -7
- package/package.json +9 -3
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,7 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
|
8
8
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
9
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
10
10
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
12
|
var decorationStateKey = exports.decorationStateKey = new _state.PluginKey('decorationPlugin');
|
|
12
13
|
var ACTIONS = exports.ACTIONS = /*#__PURE__*/function (ACTIONS) {
|
|
13
14
|
ACTIONS[ACTIONS["DECORATION_ADD"] = 0] = "DECORATION_ADD";
|
|
@@ -16,11 +17,22 @@ var ACTIONS = exports.ACTIONS = /*#__PURE__*/function (ACTIONS) {
|
|
|
16
17
|
}({});
|
|
17
18
|
var removeDecoration = exports.removeDecoration = function removeDecoration(state, dispatch) {
|
|
18
19
|
var tr = state.tr;
|
|
19
|
-
if (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_remove_slow_table_transactions')) {
|
|
21
|
+
var _ref = decorationStateKey.getState(state),
|
|
22
|
+
decoration = _ref.decoration;
|
|
23
|
+
if (decoration && dispatch) {
|
|
24
|
+
dispatch(tr.setMeta(decorationStateKey, {
|
|
25
|
+
action: ACTIONS.DECORATION_REMOVE
|
|
26
|
+
}));
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
if (dispatch) {
|
|
31
|
+
dispatch(tr.setMeta(decorationStateKey, {
|
|
32
|
+
action: ACTIONS.DECORATION_REMOVE
|
|
33
|
+
}));
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
24
36
|
}
|
|
25
37
|
return false;
|
|
26
38
|
};
|
|
@@ -108,8 +120,8 @@ var _default = exports.default = function _default() {
|
|
|
108
120
|
props: {
|
|
109
121
|
decorations: function decorations(state) {
|
|
110
122
|
var doc = state.doc;
|
|
111
|
-
var
|
|
112
|
-
decoration =
|
|
123
|
+
var _ref2 = decorationStateKey.getState(state),
|
|
124
|
+
decoration = _ref2.decoration;
|
|
113
125
|
if (decoration) {
|
|
114
126
|
return _view.DecorationSet.create(doc, [decoration]);
|
|
115
127
|
}
|
|
@@ -2,6 +2,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import { NodeSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
4
4
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
export const decorationStateKey = new PluginKey('decorationPlugin');
|
|
6
7
|
export let ACTIONS = /*#__PURE__*/function (ACTIONS) {
|
|
7
8
|
ACTIONS[ACTIONS["DECORATION_ADD"] = 0] = "DECORATION_ADD";
|
|
@@ -12,11 +13,23 @@ export const removeDecoration = (state, dispatch) => {
|
|
|
12
13
|
const {
|
|
13
14
|
tr
|
|
14
15
|
} = state;
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
})
|
|
19
|
-
|
|
16
|
+
if (fg('platform_editor_remove_slow_table_transactions')) {
|
|
17
|
+
const {
|
|
18
|
+
decoration
|
|
19
|
+
} = decorationStateKey.getState(state);
|
|
20
|
+
if (decoration && dispatch) {
|
|
21
|
+
dispatch(tr.setMeta(decorationStateKey, {
|
|
22
|
+
action: ACTIONS.DECORATION_REMOVE
|
|
23
|
+
}));
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
} else {
|
|
27
|
+
if (dispatch) {
|
|
28
|
+
dispatch(tr.setMeta(decorationStateKey, {
|
|
29
|
+
action: ACTIONS.DECORATION_REMOVE
|
|
30
|
+
}));
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
20
33
|
}
|
|
21
34
|
return false;
|
|
22
35
|
};
|
|
@@ -2,6 +2,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import { NodeSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
4
4
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
export var decorationStateKey = new PluginKey('decorationPlugin');
|
|
6
7
|
export var ACTIONS = /*#__PURE__*/function (ACTIONS) {
|
|
7
8
|
ACTIONS[ACTIONS["DECORATION_ADD"] = 0] = "DECORATION_ADD";
|
|
@@ -10,11 +11,22 @@ export var ACTIONS = /*#__PURE__*/function (ACTIONS) {
|
|
|
10
11
|
}({});
|
|
11
12
|
export var removeDecoration = function removeDecoration(state, dispatch) {
|
|
12
13
|
var tr = state.tr;
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
if (fg('platform_editor_remove_slow_table_transactions')) {
|
|
15
|
+
var _ref = decorationStateKey.getState(state),
|
|
16
|
+
decoration = _ref.decoration;
|
|
17
|
+
if (decoration && dispatch) {
|
|
18
|
+
dispatch(tr.setMeta(decorationStateKey, {
|
|
19
|
+
action: ACTIONS.DECORATION_REMOVE
|
|
20
|
+
}));
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
} else {
|
|
24
|
+
if (dispatch) {
|
|
25
|
+
dispatch(tr.setMeta(decorationStateKey, {
|
|
26
|
+
action: ACTIONS.DECORATION_REMOVE
|
|
27
|
+
}));
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
18
30
|
}
|
|
19
31
|
return false;
|
|
20
32
|
};
|
|
@@ -102,8 +114,8 @@ export default (function () {
|
|
|
102
114
|
props: {
|
|
103
115
|
decorations: function decorations(state) {
|
|
104
116
|
var doc = state.doc;
|
|
105
|
-
var
|
|
106
|
-
decoration =
|
|
117
|
+
var _ref2 = decorationStateKey.getState(state),
|
|
118
|
+
decoration = _ref2.decoration;
|
|
107
119
|
if (decoration) {
|
|
108
120
|
return DecorationSet.create(doc, [decoration]);
|
|
109
121
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-decorations",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "Decorations plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -23,8 +23,9 @@
|
|
|
23
23
|
".": "./src/index.ts"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@atlaskit/editor-common": "^
|
|
26
|
+
"@atlaskit/editor-common": "^106.0.0",
|
|
27
27
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
28
|
+
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
28
29
|
"@babel/runtime": "^7.0.0"
|
|
29
30
|
},
|
|
30
31
|
"peerDependencies": {
|
|
@@ -32,7 +33,7 @@
|
|
|
32
33
|
"react-dom": "^18.2.0"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
|
-
"@atlaskit/editor-plugin-mentions": "^4.
|
|
36
|
+
"@atlaskit/editor-plugin-mentions": "^4.7.0",
|
|
36
37
|
"@testing-library/react": "^13.4.0",
|
|
37
38
|
"typescript": "~5.4.2",
|
|
38
39
|
"wait-for-expect": "^1.2.0"
|
|
@@ -69,5 +70,10 @@
|
|
|
69
70
|
"emotion"
|
|
70
71
|
]
|
|
71
72
|
}
|
|
73
|
+
},
|
|
74
|
+
"platform-feature-flags": {
|
|
75
|
+
"platform_editor_remove_slow_table_transactions": {
|
|
76
|
+
"type": "boolean"
|
|
77
|
+
}
|
|
72
78
|
}
|
|
73
79
|
}
|