@atlaskit/editor-plugin-limited-mode 3.1.0 → 3.1.2
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/afm-jira/tsconfig.json +1 -1
- package/dist/cjs/limitedModePlugin.js +1 -0
- package/dist/cjs/pm-plugins/main.js +12 -0
- package/dist/es2019/limitedModePlugin.js +1 -0
- package/dist/es2019/pm-plugins/main.js +13 -0
- package/dist/esm/limitedModePlugin.js +1 -0
- package/dist/esm/pm-plugins/main.js +12 -0
- package/package.json +4 -4
- package/afm-post-office/tsconfig.json +0 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-limited-mode
|
|
2
2
|
|
|
3
|
+
## 3.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 3.1.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`4d676bbdb3ce6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4d676bbdb3ce6) -
|
|
14
|
+
ts-ignore added temporarily to unblock local consumption for help-center, will be removed once
|
|
15
|
+
project refs are setup
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 3.1.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
package/afm-jira/tsconfig.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"extends": "../../../../tsconfig.entry-points.jira.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"target": "es5",
|
|
5
|
-
"outDir": "../../../../../tsDist/@atlaskit__editor-plugin-limited-mode/app",
|
|
5
|
+
"outDir": "../../../../../jira/tsDist/@atlaskit__editor-plugin-limited-mode/app",
|
|
6
6
|
"rootDir": "../",
|
|
7
7
|
"composite": true
|
|
8
8
|
},
|
|
@@ -54,6 +54,7 @@ var limitedModePlugin = exports.limitedModePlugin = function limitedModePlugin(_
|
|
|
54
54
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
55
55
|
}, [options.contentId]);
|
|
56
56
|
var checkAndShowFlag = (0, _react.useCallback)(function (isLimitedModeEnabled) {
|
|
57
|
+
// @ts-expect-error - true is not allowed as a default value
|
|
57
58
|
if (!((0, _expVal.expVal)('cc_editor_limited_mode', 'flagEnabled', true) === true)) {
|
|
58
59
|
// Disable the flag behavior entirely if the flag is off
|
|
59
60
|
return;
|
|
@@ -15,16 +15,22 @@ var limitedModePluginKey = exports.limitedModePluginKey = new _state.PluginKey('
|
|
|
15
15
|
var createPlugin = exports.createPlugin = function createPlugin() {
|
|
16
16
|
return new _safePlugin.SafePlugin({
|
|
17
17
|
key: limitedModePluginKey,
|
|
18
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
19
|
+
|
|
18
20
|
view: function view(_view) {
|
|
19
21
|
return {};
|
|
20
22
|
},
|
|
21
23
|
state: {
|
|
24
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
22
25
|
init: function init(config, editorState) {
|
|
26
|
+
// @ts-expect-error - true is not allowed as a default value
|
|
23
27
|
if ((0, _expVal.expVal)('cc_editor_limited_mode_include_lcm', 'isEnabled', true)) {
|
|
24
28
|
// calculates the size of the doc, where when there are legacy content macros, the content
|
|
25
29
|
// is stored in the attrs.
|
|
26
30
|
// This is essentiall doc.nod
|
|
27
31
|
var customDocSize = editorState.doc.nodeSize;
|
|
32
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
33
|
+
|
|
28
34
|
editorState.doc.descendants(function (node) {
|
|
29
35
|
var _node$attrs;
|
|
30
36
|
if (((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.extensionKey) === 'legacy-content') {
|
|
@@ -46,17 +52,23 @@ var createPlugin = exports.createPlugin = function createPlugin() {
|
|
|
46
52
|
};
|
|
47
53
|
}
|
|
48
54
|
},
|
|
55
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
56
|
+
|
|
49
57
|
apply: function apply(tr, currentPluginState) {
|
|
50
58
|
// Don't check the document size if we're already in limited mode.
|
|
51
59
|
// We ALWAYS want to re-check the document size if we're replacing the document (e.g. live-to-live page navigation).
|
|
52
60
|
if (currentPluginState.documentSizeBreachesThreshold && !tr.getMeta('replaceDocument')) {
|
|
53
61
|
return currentPluginState;
|
|
54
62
|
}
|
|
63
|
+
|
|
64
|
+
// @ts-expect-error - true is not allowed as a default value
|
|
55
65
|
if ((0, _expVal.expVal)('cc_editor_limited_mode_include_lcm', 'isEnabled', true)) {
|
|
56
66
|
// calculates the size of the doc, where when there are legacy content macros, the content
|
|
57
67
|
// is stored in the attrs.
|
|
58
68
|
// This is essentiall doc.nod
|
|
59
69
|
var customDocSize = tr.doc.nodeSize;
|
|
70
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
71
|
+
|
|
60
72
|
tr.doc.descendants(function (node) {
|
|
61
73
|
var _node$attrs3;
|
|
62
74
|
if (((_node$attrs3 = node.attrs) === null || _node$attrs3 === void 0 ? void 0 : _node$attrs3.extensionKey) === 'legacy-content') {
|
|
@@ -48,6 +48,7 @@ export const limitedModePlugin = ({
|
|
|
48
48
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
49
49
|
}, [options.contentId]);
|
|
50
50
|
const checkAndShowFlag = useCallback(isLimitedModeEnabled => {
|
|
51
|
+
// @ts-expect-error - true is not allowed as a default value
|
|
51
52
|
if (!(expVal('cc_editor_limited_mode', 'flagEnabled', true) === true)) {
|
|
52
53
|
// Disable the flag behavior entirely if the flag is off
|
|
53
54
|
return;
|
|
@@ -5,16 +5,23 @@ export const limitedModePluginKey = new PluginKey('limitedModePlugin');
|
|
|
5
5
|
export const createPlugin = () => {
|
|
6
6
|
return new SafePlugin({
|
|
7
7
|
key: limitedModePluginKey,
|
|
8
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
9
|
+
|
|
8
10
|
view: _view => {
|
|
9
11
|
return {};
|
|
10
12
|
},
|
|
11
13
|
state: {
|
|
14
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
15
|
+
|
|
12
16
|
init(config, editorState) {
|
|
17
|
+
// @ts-expect-error - true is not allowed as a default value
|
|
13
18
|
if (expVal('cc_editor_limited_mode_include_lcm', 'isEnabled', true)) {
|
|
14
19
|
// calculates the size of the doc, where when there are legacy content macros, the content
|
|
15
20
|
// is stored in the attrs.
|
|
16
21
|
// This is essentiall doc.nod
|
|
17
22
|
let customDocSize = editorState.doc.nodeSize;
|
|
23
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
24
|
+
|
|
18
25
|
editorState.doc.descendants(node => {
|
|
19
26
|
var _node$attrs;
|
|
20
27
|
if (((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.extensionKey) === 'legacy-content') {
|
|
@@ -36,17 +43,23 @@ export const createPlugin = () => {
|
|
|
36
43
|
};
|
|
37
44
|
}
|
|
38
45
|
},
|
|
46
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
47
|
+
|
|
39
48
|
apply: (tr, currentPluginState) => {
|
|
40
49
|
// Don't check the document size if we're already in limited mode.
|
|
41
50
|
// We ALWAYS want to re-check the document size if we're replacing the document (e.g. live-to-live page navigation).
|
|
42
51
|
if (currentPluginState.documentSizeBreachesThreshold && !tr.getMeta('replaceDocument')) {
|
|
43
52
|
return currentPluginState;
|
|
44
53
|
}
|
|
54
|
+
|
|
55
|
+
// @ts-expect-error - true is not allowed as a default value
|
|
45
56
|
if (expVal('cc_editor_limited_mode_include_lcm', 'isEnabled', true)) {
|
|
46
57
|
// calculates the size of the doc, where when there are legacy content macros, the content
|
|
47
58
|
// is stored in the attrs.
|
|
48
59
|
// This is essentiall doc.nod
|
|
49
60
|
let customDocSize = tr.doc.nodeSize;
|
|
61
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
62
|
+
|
|
50
63
|
tr.doc.descendants(node => {
|
|
51
64
|
var _node$attrs3;
|
|
52
65
|
if (((_node$attrs3 = node.attrs) === null || _node$attrs3 === void 0 ? void 0 : _node$attrs3.extensionKey) === 'legacy-content') {
|
|
@@ -46,6 +46,7 @@ export var limitedModePlugin = function limitedModePlugin(_ref) {
|
|
|
46
46
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
47
47
|
}, [options.contentId]);
|
|
48
48
|
var checkAndShowFlag = useCallback(function (isLimitedModeEnabled) {
|
|
49
|
+
// @ts-expect-error - true is not allowed as a default value
|
|
49
50
|
if (!(expVal('cc_editor_limited_mode', 'flagEnabled', true) === true)) {
|
|
50
51
|
// Disable the flag behavior entirely if the flag is off
|
|
51
52
|
return;
|
|
@@ -8,16 +8,22 @@ export var limitedModePluginKey = new PluginKey('limitedModePlugin');
|
|
|
8
8
|
export var createPlugin = function createPlugin() {
|
|
9
9
|
return new SafePlugin({
|
|
10
10
|
key: limitedModePluginKey,
|
|
11
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
12
|
+
|
|
11
13
|
view: function view(_view) {
|
|
12
14
|
return {};
|
|
13
15
|
},
|
|
14
16
|
state: {
|
|
17
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
15
18
|
init: function init(config, editorState) {
|
|
19
|
+
// @ts-expect-error - true is not allowed as a default value
|
|
16
20
|
if (expVal('cc_editor_limited_mode_include_lcm', 'isEnabled', true)) {
|
|
17
21
|
// calculates the size of the doc, where when there are legacy content macros, the content
|
|
18
22
|
// is stored in the attrs.
|
|
19
23
|
// This is essentiall doc.nod
|
|
20
24
|
var customDocSize = editorState.doc.nodeSize;
|
|
25
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
26
|
+
|
|
21
27
|
editorState.doc.descendants(function (node) {
|
|
22
28
|
var _node$attrs;
|
|
23
29
|
if (((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.extensionKey) === 'legacy-content') {
|
|
@@ -39,17 +45,23 @@ export var createPlugin = function createPlugin() {
|
|
|
39
45
|
};
|
|
40
46
|
}
|
|
41
47
|
},
|
|
48
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
49
|
+
|
|
42
50
|
apply: function apply(tr, currentPluginState) {
|
|
43
51
|
// Don't check the document size if we're already in limited mode.
|
|
44
52
|
// We ALWAYS want to re-check the document size if we're replacing the document (e.g. live-to-live page navigation).
|
|
45
53
|
if (currentPluginState.documentSizeBreachesThreshold && !tr.getMeta('replaceDocument')) {
|
|
46
54
|
return currentPluginState;
|
|
47
55
|
}
|
|
56
|
+
|
|
57
|
+
// @ts-expect-error - true is not allowed as a default value
|
|
48
58
|
if (expVal('cc_editor_limited_mode_include_lcm', 'isEnabled', true)) {
|
|
49
59
|
// calculates the size of the doc, where when there are legacy content macros, the content
|
|
50
60
|
// is stored in the attrs.
|
|
51
61
|
// This is essentiall doc.nod
|
|
52
62
|
var customDocSize = tr.doc.nodeSize;
|
|
63
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
64
|
+
|
|
53
65
|
tr.doc.descendants(function (node) {
|
|
54
66
|
var _node$attrs3;
|
|
55
67
|
if (((_node$attrs3 = node.attrs) === null || _node$attrs3 === void 0 ? void 0 : _node$attrs3.extensionKey) === 'legacy-content') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-limited-mode",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "LimitedMode plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"atlaskit:src": "src/index.ts",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
32
|
-
"@atlaskit/primitives": "^16.
|
|
33
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
32
|
+
"@atlaskit/primitives": "^16.4.0",
|
|
33
|
+
"@atlaskit/tmp-editor-statsig": "^14.0.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"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@atlaskit/editor-common": "^110.
|
|
39
|
+
"@atlaskit/editor-common": "^110.36.0",
|
|
40
40
|
"react": "^18.2.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.entry-points.post-office.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"outDir": "../../../../../post-office/tsDist/@atlaskit__editor-plugin-limited-mode/app",
|
|
6
|
-
"rootDir": "../",
|
|
7
|
-
"composite": true
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"../src/**/*.ts",
|
|
11
|
-
"../src/**/*.tsx"
|
|
12
|
-
],
|
|
13
|
-
"exclude": [
|
|
14
|
-
"../src/**/__tests__/*",
|
|
15
|
-
"../src/**/*.test.*",
|
|
16
|
-
"../src/**/test.*",
|
|
17
|
-
"../src/**/examples.*"
|
|
18
|
-
],
|
|
19
|
-
"references": [
|
|
20
|
-
{
|
|
21
|
-
"path": "../../../design-system/primitives/afm-post-office/tsconfig.json"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"path": "../../tmp-editor-statsig/afm-post-office/tsconfig.json"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"path": "../../editor-common/afm-post-office/tsconfig.json"
|
|
28
|
-
}
|
|
29
|
-
]
|
|
30
|
-
}
|