@atlaskit/editor-plugin-limited-mode 3.1.5 → 3.2.0
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 +17 -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/limitedModePlugin.js +19 -0
- package/dist/es2019/limitedModePlugin.js +21 -1
- package/dist/esm/limitedModePlugin.js +20 -1
- package/package.json +10 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-limited-mode
|
|
2
2
|
|
|
3
|
+
## 3.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`6668fda9b38d7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6668fda9b38d7) -
|
|
8
|
+
ED-29716 add limited mode support to native anchor
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 3.1.6
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 3.1.5
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
package/afm-jira/tsconfig.json
CHANGED
|
@@ -9,8 +9,11 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
var _bindEventListener = require("bind-event-listener");
|
|
10
10
|
var _reactIntlNext = require("react-intl-next");
|
|
11
11
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
12
|
+
var _nodeAnchor = require("@atlaskit/editor-common/node-anchor");
|
|
12
13
|
var _usePluginStateEffect = require("@atlaskit/editor-common/use-plugin-state-effect");
|
|
14
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
15
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
16
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
14
17
|
var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
|
|
15
18
|
var _main = require("./pm-plugins/main");
|
|
16
19
|
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); }
|
|
@@ -103,6 +106,22 @@ var limitedModePlugin = exports.limitedModePlugin = function limitedModePlugin(_
|
|
|
103
106
|
var isLimitedModeEnabled = (_limitedModeState$ena = limitedModeState === null || limitedModeState === void 0 ? void 0 : limitedModeState.enabled) !== null && _limitedModeState$ena !== void 0 ? _limitedModeState$ena : false;
|
|
104
107
|
checkAndShowFlag(isLimitedModeEnabled);
|
|
105
108
|
});
|
|
109
|
+
(0, _usePluginStateEffect.usePluginStateEffect)(api, ['limitedMode'], function (_ref4) {
|
|
110
|
+
var limitedModeState = _ref4.limitedModeState;
|
|
111
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
112
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_native_anchor_patch_2')) {
|
|
113
|
+
var _limitedModeState$ena2;
|
|
114
|
+
var isEnabled = (_limitedModeState$ena2 = limitedModeState === null || limitedModeState === void 0 ? void 0 : limitedModeState.enabled) !== null && _limitedModeState$ena2 !== void 0 ? _limitedModeState$ena2 : false;
|
|
115
|
+
var nodeIdProvider = (0, _nodeAnchor.getNodeIdProvider)(editorView);
|
|
116
|
+
// When limited mode is enabled first time,
|
|
117
|
+
// We need to remove all existing data-node-anchor attributes
|
|
118
|
+
// And nodeIdProvider to limited mode to prevent adding data-node-anchor on new nodes
|
|
119
|
+
if (isEnabled && nodeIdProvider && !nodeIdProvider.isLimitedMode()) {
|
|
120
|
+
nodeIdProvider.setLimitedMode();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
});
|
|
106
125
|
}
|
|
107
126
|
};
|
|
108
127
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useCallback, useEffect, useRef } from 'react';
|
|
2
2
|
import { bind } from 'bind-event-listener';
|
|
3
3
|
import { useIntl } from 'react-intl-next';
|
|
4
4
|
import { limitedModeMessages } from '@atlaskit/editor-common/messages';
|
|
5
|
+
import { getNodeIdProvider } from '@atlaskit/editor-common/node-anchor';
|
|
5
6
|
import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
8
|
import { Anchor } from '@atlaskit/primitives/compiled';
|
|
9
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
10
|
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
8
11
|
import { createPlugin, limitedModePluginKey } from './pm-plugins/main';
|
|
9
12
|
export const limitedModePlugin = ({
|
|
@@ -96,6 +99,23 @@ export const limitedModePlugin = ({
|
|
|
96
99
|
const isLimitedModeEnabled = (_limitedModeState$ena = limitedModeState === null || limitedModeState === void 0 ? void 0 : limitedModeState.enabled) !== null && _limitedModeState$ena !== void 0 ? _limitedModeState$ena : false;
|
|
97
100
|
checkAndShowFlag(isLimitedModeEnabled);
|
|
98
101
|
});
|
|
102
|
+
usePluginStateEffect(api, ['limitedMode'], ({
|
|
103
|
+
limitedModeState
|
|
104
|
+
}) => {
|
|
105
|
+
if (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
106
|
+
if (fg('platform_editor_native_anchor_patch_2')) {
|
|
107
|
+
var _limitedModeState$ena2;
|
|
108
|
+
const isEnabled = (_limitedModeState$ena2 = limitedModeState === null || limitedModeState === void 0 ? void 0 : limitedModeState.enabled) !== null && _limitedModeState$ena2 !== void 0 ? _limitedModeState$ena2 : false;
|
|
109
|
+
const nodeIdProvider = getNodeIdProvider(editorView);
|
|
110
|
+
// When limited mode is enabled first time,
|
|
111
|
+
// We need to remove all existing data-node-anchor attributes
|
|
112
|
+
// And nodeIdProvider to limited mode to prevent adding data-node-anchor on new nodes
|
|
113
|
+
if (isEnabled && nodeIdProvider && !nodeIdProvider.isLimitedMode()) {
|
|
114
|
+
nodeIdProvider.setLimitedMode();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
});
|
|
99
119
|
}
|
|
100
120
|
};
|
|
101
121
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useCallback, useEffect, useRef } from 'react';
|
|
2
2
|
import { bind } from 'bind-event-listener';
|
|
3
3
|
import { useIntl } from 'react-intl-next';
|
|
4
4
|
import { limitedModeMessages } from '@atlaskit/editor-common/messages';
|
|
5
|
+
import { getNodeIdProvider } from '@atlaskit/editor-common/node-anchor';
|
|
5
6
|
import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
8
|
import { Anchor } from '@atlaskit/primitives/compiled';
|
|
9
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
10
|
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
8
11
|
import { createPlugin, limitedModePluginKey } from './pm-plugins/main';
|
|
9
12
|
export var limitedModePlugin = function limitedModePlugin(_ref) {
|
|
@@ -95,6 +98,22 @@ export var limitedModePlugin = function limitedModePlugin(_ref) {
|
|
|
95
98
|
var isLimitedModeEnabled = (_limitedModeState$ena = limitedModeState === null || limitedModeState === void 0 ? void 0 : limitedModeState.enabled) !== null && _limitedModeState$ena !== void 0 ? _limitedModeState$ena : false;
|
|
96
99
|
checkAndShowFlag(isLimitedModeEnabled);
|
|
97
100
|
});
|
|
101
|
+
usePluginStateEffect(api, ['limitedMode'], function (_ref4) {
|
|
102
|
+
var limitedModeState = _ref4.limitedModeState;
|
|
103
|
+
if (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
104
|
+
if (fg('platform_editor_native_anchor_patch_2')) {
|
|
105
|
+
var _limitedModeState$ena2;
|
|
106
|
+
var isEnabled = (_limitedModeState$ena2 = limitedModeState === null || limitedModeState === void 0 ? void 0 : limitedModeState.enabled) !== null && _limitedModeState$ena2 !== void 0 ? _limitedModeState$ena2 : false;
|
|
107
|
+
var nodeIdProvider = getNodeIdProvider(editorView);
|
|
108
|
+
// When limited mode is enabled first time,
|
|
109
|
+
// We need to remove all existing data-node-anchor attributes
|
|
110
|
+
// And nodeIdProvider to limited mode to prevent adding data-node-anchor on new nodes
|
|
111
|
+
if (isEnabled && nodeIdProvider && !nodeIdProvider.isLimitedMode()) {
|
|
112
|
+
nodeIdProvider.setLimitedMode();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
});
|
|
98
117
|
}
|
|
99
118
|
};
|
|
100
119
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-limited-mode",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "LimitedMode plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,14 +29,15 @@
|
|
|
29
29
|
"atlaskit:src": "src/index.ts",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/editor-prosemirror": "^7.2.0",
|
|
32
|
-
"@atlaskit/
|
|
33
|
-
"@atlaskit/
|
|
32
|
+
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
33
|
+
"@atlaskit/primitives": "^17.0.0",
|
|
34
|
+
"@atlaskit/tmp-editor-statsig": "^16.2.0",
|
|
34
35
|
"@babel/runtime": "^7.0.0",
|
|
35
36
|
"bind-event-listener": "^3.0.0",
|
|
36
37
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
37
38
|
},
|
|
38
39
|
"peerDependencies": {
|
|
39
|
-
"@atlaskit/editor-common": "^110.
|
|
40
|
+
"@atlaskit/editor-common": "^110.49.0",
|
|
40
41
|
"react": "^18.2.0"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
@@ -77,5 +78,10 @@
|
|
|
77
78
|
"import-no-extraneous-disable-for-examples-and-docs"
|
|
78
79
|
]
|
|
79
80
|
}
|
|
81
|
+
},
|
|
82
|
+
"platform-feature-flags": {
|
|
83
|
+
"platform_editor_native_anchor_patch_2": {
|
|
84
|
+
"type": "boolean"
|
|
85
|
+
}
|
|
80
86
|
}
|
|
81
87
|
}
|