@atlaskit/editor-plugin-limited-mode 5.0.21 → 5.0.23
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 +15 -0
- package/README.md +42 -1
- package/dist/cjs/limitedModePlugin.js +8 -11
- package/dist/es2019/limitedModePlugin.js +8 -11
- package/dist/esm/limitedModePlugin.js +8 -11
- package/docs/0-intro.tsx +20 -1
- package/package.json +3 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-limited-mode
|
|
2
2
|
|
|
3
|
+
## 5.0.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`14803a836f641`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/14803a836f641) -
|
|
8
|
+
Update README.md and 0-intro.tsx
|
|
9
|
+
|
|
10
|
+
## 5.0.22
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`d1a0ee6dbcefd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d1a0ee6dbcefd) -
|
|
15
|
+
Clean up feature gate platform_editor_native_anchor_patch_2
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 5.0.21
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1 +1,42 @@
|
|
|
1
|
-
# Editor
|
|
1
|
+
# Editor Plugin Limited Mode
|
|
2
|
+
|
|
3
|
+
LimitedMode plugin for @atlaskit/editor-core
|
|
4
|
+
|
|
5
|
+
**Note:** This component is designed for internal Atlassian development.
|
|
6
|
+
External contributors will be able to use this component but will not be able to submit issues.
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
The Limited Mode plugin provides performance optimization for the Atlassian Editor by monitoring document size and automatically enabling limited mode when documents exceed configurable thresholds. This helps maintain editor performance with large documents by disabling certain resource-intensive features.
|
|
11
|
+
|
|
12
|
+
## Key features
|
|
13
|
+
|
|
14
|
+
- **Document size monitoring** - Tracks document size and node count to detect when thresholds are breached
|
|
15
|
+
- **Automatic threshold detection** - Activates limited mode based on document size, node count, or presence of legacy content macros
|
|
16
|
+
- **Configurable thresholds** - Supports experimentation-based threshold configuration via Statsig
|
|
17
|
+
- **Node anchor integration** - Integrates with the node anchor system to disable anchor tracking in limited mode
|
|
18
|
+
- **Shared state** - Exposes enabled state through plugin API for other plugins to react to limited mode changes
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
---
|
|
22
|
+
- **Install** - *yarn add @atlaskit/editor-plugin-limited-mode*
|
|
23
|
+
- **npm** - [@atlaskit/editor-plugin-limited-mode](https://www.npmjs.com/package/@atlaskit/editor-plugin-limited-mode)
|
|
24
|
+
- **Source** - [Bitbucket](https://bitbucket.org/atlassian/atlassian-frontend/src/master/packages/editor/editor-plugin-limited-mode)
|
|
25
|
+
- **Bundle** - [unpkg.com](https://unpkg.com/@atlaskit/editor-plugin-limited-mode/dist/)
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
---
|
|
29
|
+
**Internal use only**
|
|
30
|
+
|
|
31
|
+
@atlaskit/editor-plugin-limited-mode is intended for internal use by the @atlaskit/editor-core and as a plugin dependency of the Editor within your product.
|
|
32
|
+
|
|
33
|
+
Direct use of this component is not supported.
|
|
34
|
+
|
|
35
|
+
Please see [Atlaskit - Editor plugin limited mode](https://atlaskit.atlassian.com/packages/editor/editor-plugin-limited-mode) for documentation and examples for this package.
|
|
36
|
+
|
|
37
|
+
## Support
|
|
38
|
+
---
|
|
39
|
+
For internal Atlassian, visit the slack channel [#help-editor](https://atlassian.slack.com/archives/CFG3PSQ9E) for support or visit [go/editor-help](https://go/editor-help) to submit a bug.
|
|
40
|
+
## License
|
|
41
|
+
---
|
|
42
|
+
Please see [Atlassian Frontend - License](https://hello.atlassian.net/wiki/spaces/AF/pages/2589099144/Documentation#License) for more licensing information.
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.limitedModePlugin = void 0;
|
|
7
7
|
var _nodeAnchor = require("@atlaskit/editor-common/node-anchor");
|
|
8
8
|
var _usePluginStateEffect = require("@atlaskit/editor-common/use-plugin-state-effect");
|
|
9
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
9
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
11
10
|
var _main = require("./pm-plugins/main");
|
|
12
11
|
var limitedModePlugin = exports.limitedModePlugin = function limitedModePlugin(_ref) {
|
|
@@ -39,17 +38,15 @@ var limitedModePlugin = exports.limitedModePlugin = function limitedModePlugin(_
|
|
|
39
38
|
(0, _usePluginStateEffect.usePluginStateEffect)(api, ['limitedMode'], function (_ref3) {
|
|
40
39
|
var limitedModeState = _ref3.limitedModeState;
|
|
41
40
|
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// And nodeIdProvider to limited mode to prevent adding data-node-anchor on new nodes
|
|
41
|
+
var _limitedModeState$ena;
|
|
42
|
+
var isEnabled = (_limitedModeState$ena = limitedModeState === null || limitedModeState === void 0 ? void 0 : limitedModeState.enabled) !== null && _limitedModeState$ena !== void 0 ? _limitedModeState$ena : false;
|
|
43
|
+
var nodeIdProvider = (0, _nodeAnchor.getNodeIdProvider)(editorView);
|
|
44
|
+
// When limited mode is enabled first time,
|
|
45
|
+
// We need to remove all existing data-node-anchor attributes
|
|
46
|
+
// And nodeIdProvider to limited mode to prevent adding data-node-anchor on new nodes
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
48
|
+
if (isEnabled && nodeIdProvider && !nodeIdProvider.isLimitedMode()) {
|
|
49
|
+
nodeIdProvider.setLimitedMode();
|
|
53
50
|
}
|
|
54
51
|
}
|
|
55
52
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { getNodeIdProvider } from '@atlaskit/editor-common/node-anchor';
|
|
2
2
|
import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
4
|
import { createPlugin, limitedModePluginKey } from './pm-plugins/main';
|
|
6
5
|
export const limitedModePlugin = ({
|
|
@@ -36,17 +35,15 @@ export const limitedModePlugin = ({
|
|
|
36
35
|
limitedModeState
|
|
37
36
|
}) => {
|
|
38
37
|
if (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
// And nodeIdProvider to limited mode to prevent adding data-node-anchor on new nodes
|
|
38
|
+
var _limitedModeState$ena;
|
|
39
|
+
const isEnabled = (_limitedModeState$ena = limitedModeState === null || limitedModeState === void 0 ? void 0 : limitedModeState.enabled) !== null && _limitedModeState$ena !== void 0 ? _limitedModeState$ena : false;
|
|
40
|
+
const nodeIdProvider = getNodeIdProvider(editorView);
|
|
41
|
+
// When limited mode is enabled first time,
|
|
42
|
+
// We need to remove all existing data-node-anchor attributes
|
|
43
|
+
// And nodeIdProvider to limited mode to prevent adding data-node-anchor on new nodes
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
45
|
+
if (isEnabled && nodeIdProvider && !nodeIdProvider.isLimitedMode()) {
|
|
46
|
+
nodeIdProvider.setLimitedMode();
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
49
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { getNodeIdProvider } from '@atlaskit/editor-common/node-anchor';
|
|
2
2
|
import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
4
|
import { createPlugin, limitedModePluginKey } from './pm-plugins/main';
|
|
6
5
|
export var limitedModePlugin = function limitedModePlugin(_ref) {
|
|
@@ -33,17 +32,15 @@ export var limitedModePlugin = function limitedModePlugin(_ref) {
|
|
|
33
32
|
usePluginStateEffect(api, ['limitedMode'], function (_ref3) {
|
|
34
33
|
var limitedModeState = _ref3.limitedModeState;
|
|
35
34
|
if (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// And nodeIdProvider to limited mode to prevent adding data-node-anchor on new nodes
|
|
35
|
+
var _limitedModeState$ena;
|
|
36
|
+
var isEnabled = (_limitedModeState$ena = limitedModeState === null || limitedModeState === void 0 ? void 0 : limitedModeState.enabled) !== null && _limitedModeState$ena !== void 0 ? _limitedModeState$ena : false;
|
|
37
|
+
var nodeIdProvider = getNodeIdProvider(editorView);
|
|
38
|
+
// When limited mode is enabled first time,
|
|
39
|
+
// We need to remove all existing data-node-anchor attributes
|
|
40
|
+
// And nodeIdProvider to limited mode to prevent adding data-node-anchor on new nodes
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
42
|
+
if (isEnabled && nodeIdProvider && !nodeIdProvider.isLimitedMode()) {
|
|
43
|
+
nodeIdProvider.setLimitedMode();
|
|
47
44
|
}
|
|
48
45
|
}
|
|
49
46
|
});
|
package/docs/0-intro.tsx
CHANGED
|
@@ -31,7 +31,26 @@ The \`dependencies\`, \`configuration\`, \`state\`, \`actions\`, and \`commands\
|
|
|
31
31
|
below:
|
|
32
32
|
|
|
33
33
|
${code`
|
|
34
|
-
type
|
|
34
|
+
export type LimitedModePluginState = {
|
|
35
|
+
documentSizeBreachesThreshold: boolean;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type LimitedModePlugin = NextEditorPlugin<
|
|
39
|
+
'limitedMode',
|
|
40
|
+
{
|
|
41
|
+
pluginConfiguration: LimitedModePluginOptions | undefined;
|
|
42
|
+
sharedState: {
|
|
43
|
+
enabled: boolean;
|
|
44
|
+
limitedModePluginKey: PluginKey<LimitedModePluginState>;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
>;
|
|
48
|
+
|
|
49
|
+
export type LimitedModePluginOptions = {
|
|
50
|
+
contentId?: string;
|
|
51
|
+
killSwitchEnabled?: boolean;
|
|
52
|
+
showFlag?: (props: { close: string; description: React.ReactNode; title: string }) => void;
|
|
53
|
+
};
|
|
35
54
|
`}
|
|
36
55
|
|
|
37
56
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-limited-mode",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.23",
|
|
4
4
|
"description": "LimitedMode plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
32
32
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
33
|
-
"@atlaskit/tmp-editor-statsig": "^55.
|
|
33
|
+
"@atlaskit/tmp-editor-statsig": "^55.1.0",
|
|
34
34
|
"@babel/runtime": "^7.0.0",
|
|
35
35
|
"bind-event-listener": "^3.0.0",
|
|
36
36
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
@@ -78,9 +78,5 @@
|
|
|
78
78
|
]
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
|
-
"platform-feature-flags": {
|
|
82
|
-
"platform_editor_native_anchor_patch_2": {
|
|
83
|
-
"type": "boolean"
|
|
84
|
-
}
|
|
85
|
-
}
|
|
81
|
+
"platform-feature-flags": {}
|
|
86
82
|
}
|