@atlaskit/editor-plugin-editor-disabled 7.0.0 → 7.0.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 +16 -0
- package/dist/cjs/editorDisabledPlugin.js +10 -17
- package/dist/es2019/editorDisabledPlugin.js +10 -17
- package/dist/esm/editorDisabledPlugin.js +10 -17
- package/package.json +2 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-editor-disabled
|
|
2
2
|
|
|
3
|
+
## 7.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5c3f8d87c2290`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5c3f8d87c2290) -
|
|
8
|
+
Cleanup general AIFC bug fix feature gate
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 7.0.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`7080196995b11`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7080196995b11) -
|
|
16
|
+
Cleaning up FG platform_editor_ai_generic_prep_for_aifc
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 7.0.0
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -10,7 +10,6 @@ var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
|
10
10
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
11
11
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
12
12
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
13
|
var _reducer = require("./pm-plugins/reducer");
|
|
15
14
|
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; }
|
|
16
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -48,10 +47,8 @@ function createPlugin(dispatch, options) {
|
|
|
48
47
|
apply: function apply(tr, pluginState) {
|
|
49
48
|
var meta = tr.getMeta(pluginKey);
|
|
50
49
|
if (meta) {
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
-
return (0, _reducer.reducer)(pluginState, meta);
|
|
54
|
-
}
|
|
50
|
+
if ('action' in meta) {
|
|
51
|
+
return (0, _reducer.reducer)(pluginState, meta);
|
|
55
52
|
}
|
|
56
53
|
return pluginState.editorDisabled !== meta.editorDisabled ? _objectSpread(_objectSpread({}, pluginState), meta) : pluginState;
|
|
57
54
|
}
|
|
@@ -62,14 +59,14 @@ function createPlugin(dispatch, options) {
|
|
|
62
59
|
// If we set to undefined it respects the previous value.
|
|
63
60
|
// Prosemirror doesn't have this typed correctly for this type of behaviour
|
|
64
61
|
// @ts-expect-error
|
|
65
|
-
editable:
|
|
62
|
+
editable: function editable(state) {
|
|
66
63
|
var _pluginKey$getState;
|
|
67
64
|
var _ref = (_pluginKey$getState = pluginKey.getState(state)) !== null && _pluginKey$getState !== void 0 ? _pluginKey$getState : {
|
|
68
65
|
disabledByPlugin: false
|
|
69
66
|
},
|
|
70
67
|
disabledByPlugin = _ref.disabledByPlugin;
|
|
71
68
|
return disabledByPlugin ? false : undefined;
|
|
72
|
-
}
|
|
69
|
+
}
|
|
73
70
|
},
|
|
74
71
|
view: function view(_view) {
|
|
75
72
|
// schedule on mount
|
|
@@ -104,8 +101,7 @@ function createPlugin(dispatch, options) {
|
|
|
104
101
|
*/
|
|
105
102
|
var editorDisabledPlugin = exports.editorDisabledPlugin = function editorDisabledPlugin(_ref2) {
|
|
106
103
|
var _ref2$config = _ref2.config,
|
|
107
|
-
options = _ref2$config === void 0 ? {} : _ref2$config
|
|
108
|
-
api = _ref2.api;
|
|
104
|
+
options = _ref2$config === void 0 ? {} : _ref2$config;
|
|
109
105
|
return {
|
|
110
106
|
name: 'editorDisabled',
|
|
111
107
|
getSharedState: function getSharedState(editorState) {
|
|
@@ -120,12 +116,9 @@ var editorDisabledPlugin = exports.editorDisabledPlugin = function editorDisable
|
|
|
120
116
|
editorDisabled: false
|
|
121
117
|
};
|
|
122
118
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
return pluginState;
|
|
119
|
+
return {
|
|
120
|
+
editorDisabled: pluginState.disabledByPlugin || pluginState.editorDisabled
|
|
121
|
+
};
|
|
129
122
|
},
|
|
130
123
|
pmPlugins: function pmPlugins() {
|
|
131
124
|
return [{
|
|
@@ -140,10 +133,10 @@ var editorDisabledPlugin = exports.editorDisabledPlugin = function editorDisable
|
|
|
140
133
|
toggleDisabled: function toggleDisabled(disabled) {
|
|
141
134
|
return function (_ref4) {
|
|
142
135
|
var tr = _ref4.tr;
|
|
143
|
-
return
|
|
136
|
+
return tr.setMeta(pluginKey, {
|
|
144
137
|
action: _reducer.ACTION.TOGGLE_DISABLED,
|
|
145
138
|
disabled: disabled
|
|
146
|
-
})
|
|
139
|
+
});
|
|
147
140
|
};
|
|
148
141
|
}
|
|
149
142
|
}
|
|
@@ -2,7 +2,6 @@ import rafSchedule from 'raf-schd';
|
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
import { pluginFactory } from '@atlaskit/editor-common/utils';
|
|
4
4
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { ACTION, reducer } from './pm-plugins/reducer';
|
|
7
6
|
export const pluginKey = new PluginKey('editorDisabledPlugin');
|
|
8
7
|
const {
|
|
@@ -39,10 +38,8 @@ function createPlugin(dispatch, options) {
|
|
|
39
38
|
apply: (tr, pluginState) => {
|
|
40
39
|
const meta = tr.getMeta(pluginKey);
|
|
41
40
|
if (meta) {
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
return reducer(pluginState, meta);
|
|
45
|
-
}
|
|
41
|
+
if ('action' in meta) {
|
|
42
|
+
return reducer(pluginState, meta);
|
|
46
43
|
}
|
|
47
44
|
return pluginState.editorDisabled !== meta.editorDisabled ? {
|
|
48
45
|
...pluginState,
|
|
@@ -56,7 +53,7 @@ function createPlugin(dispatch, options) {
|
|
|
56
53
|
// If we set to undefined it respects the previous value.
|
|
57
54
|
// Prosemirror doesn't have this typed correctly for this type of behaviour
|
|
58
55
|
// @ts-expect-error
|
|
59
|
-
editable:
|
|
56
|
+
editable: state => {
|
|
60
57
|
var _pluginKey$getState;
|
|
61
58
|
const {
|
|
62
59
|
disabledByPlugin
|
|
@@ -64,7 +61,7 @@ function createPlugin(dispatch, options) {
|
|
|
64
61
|
disabledByPlugin: false
|
|
65
62
|
};
|
|
66
63
|
return disabledByPlugin ? false : undefined;
|
|
67
|
-
}
|
|
64
|
+
}
|
|
68
65
|
},
|
|
69
66
|
view: view => {
|
|
70
67
|
// schedule on mount
|
|
@@ -98,8 +95,7 @@ function createPlugin(dispatch, options) {
|
|
|
98
95
|
* ```
|
|
99
96
|
*/
|
|
100
97
|
export const editorDisabledPlugin = ({
|
|
101
|
-
config: options = {}
|
|
102
|
-
api
|
|
98
|
+
config: options = {}
|
|
103
99
|
}) => ({
|
|
104
100
|
name: 'editorDisabled',
|
|
105
101
|
getSharedState(editorState) {
|
|
@@ -114,12 +110,9 @@ export const editorDisabledPlugin = ({
|
|
|
114
110
|
editorDisabled: false
|
|
115
111
|
};
|
|
116
112
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
return pluginState;
|
|
113
|
+
return {
|
|
114
|
+
editorDisabled: pluginState.disabledByPlugin || pluginState.editorDisabled
|
|
115
|
+
};
|
|
123
116
|
},
|
|
124
117
|
pmPlugins: () => [{
|
|
125
118
|
name: 'editorDisabled',
|
|
@@ -131,10 +124,10 @@ export const editorDisabledPlugin = ({
|
|
|
131
124
|
toggleDisabled: disabled => ({
|
|
132
125
|
tr
|
|
133
126
|
}) => {
|
|
134
|
-
return
|
|
127
|
+
return tr.setMeta(pluginKey, {
|
|
135
128
|
action: ACTION.TOGGLE_DISABLED,
|
|
136
129
|
disabled
|
|
137
|
-
})
|
|
130
|
+
});
|
|
138
131
|
}
|
|
139
132
|
}
|
|
140
133
|
});
|
|
@@ -5,7 +5,6 @@ import rafSchedule from 'raf-schd';
|
|
|
5
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
6
6
|
import { pluginFactory } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { ACTION, reducer } from './pm-plugins/reducer';
|
|
10
9
|
export var pluginKey = new PluginKey('editorDisabledPlugin');
|
|
11
10
|
var _pluginFactory = pluginFactory(pluginKey, reducer),
|
|
@@ -41,10 +40,8 @@ function createPlugin(dispatch, options) {
|
|
|
41
40
|
apply: function apply(tr, pluginState) {
|
|
42
41
|
var meta = tr.getMeta(pluginKey);
|
|
43
42
|
if (meta) {
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
return reducer(pluginState, meta);
|
|
47
|
-
}
|
|
43
|
+
if ('action' in meta) {
|
|
44
|
+
return reducer(pluginState, meta);
|
|
48
45
|
}
|
|
49
46
|
return pluginState.editorDisabled !== meta.editorDisabled ? _objectSpread(_objectSpread({}, pluginState), meta) : pluginState;
|
|
50
47
|
}
|
|
@@ -55,14 +52,14 @@ function createPlugin(dispatch, options) {
|
|
|
55
52
|
// If we set to undefined it respects the previous value.
|
|
56
53
|
// Prosemirror doesn't have this typed correctly for this type of behaviour
|
|
57
54
|
// @ts-expect-error
|
|
58
|
-
editable:
|
|
55
|
+
editable: function editable(state) {
|
|
59
56
|
var _pluginKey$getState;
|
|
60
57
|
var _ref = (_pluginKey$getState = pluginKey.getState(state)) !== null && _pluginKey$getState !== void 0 ? _pluginKey$getState : {
|
|
61
58
|
disabledByPlugin: false
|
|
62
59
|
},
|
|
63
60
|
disabledByPlugin = _ref.disabledByPlugin;
|
|
64
61
|
return disabledByPlugin ? false : undefined;
|
|
65
|
-
}
|
|
62
|
+
}
|
|
66
63
|
},
|
|
67
64
|
view: function view(_view) {
|
|
68
65
|
// schedule on mount
|
|
@@ -97,8 +94,7 @@ function createPlugin(dispatch, options) {
|
|
|
97
94
|
*/
|
|
98
95
|
export var editorDisabledPlugin = function editorDisabledPlugin(_ref2) {
|
|
99
96
|
var _ref2$config = _ref2.config,
|
|
100
|
-
options = _ref2$config === void 0 ? {} : _ref2$config
|
|
101
|
-
api = _ref2.api;
|
|
97
|
+
options = _ref2$config === void 0 ? {} : _ref2$config;
|
|
102
98
|
return {
|
|
103
99
|
name: 'editorDisabled',
|
|
104
100
|
getSharedState: function getSharedState(editorState) {
|
|
@@ -113,12 +109,9 @@ export var editorDisabledPlugin = function editorDisabledPlugin(_ref2) {
|
|
|
113
109
|
editorDisabled: false
|
|
114
110
|
};
|
|
115
111
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
return pluginState;
|
|
112
|
+
return {
|
|
113
|
+
editorDisabled: pluginState.disabledByPlugin || pluginState.editorDisabled
|
|
114
|
+
};
|
|
122
115
|
},
|
|
123
116
|
pmPlugins: function pmPlugins() {
|
|
124
117
|
return [{
|
|
@@ -133,10 +126,10 @@ export var editorDisabledPlugin = function editorDisabledPlugin(_ref2) {
|
|
|
133
126
|
toggleDisabled: function toggleDisabled(disabled) {
|
|
134
127
|
return function (_ref4) {
|
|
135
128
|
var tr = _ref4.tr;
|
|
136
|
-
return
|
|
129
|
+
return tr.setMeta(pluginKey, {
|
|
137
130
|
action: ACTION.TOGGLE_DISABLED,
|
|
138
131
|
disabled: disabled
|
|
139
|
-
})
|
|
132
|
+
});
|
|
140
133
|
};
|
|
141
134
|
}
|
|
142
135
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-editor-disabled",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.2",
|
|
4
4
|
"description": "Editor disabled plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -18,11 +18,6 @@
|
|
|
18
18
|
"types": "dist/types/index.d.ts",
|
|
19
19
|
"sideEffects": false,
|
|
20
20
|
"atlaskit:src": "src/index.ts",
|
|
21
|
-
"platform-feature-flags": {
|
|
22
|
-
"platform_editor_ai_generic_prep_for_aifc_2": {
|
|
23
|
-
"type": "boolean"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
21
|
"dependencies": {
|
|
27
22
|
"@atlaskit/editor-prosemirror": "^7.2.0",
|
|
28
23
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
@@ -30,7 +25,7 @@
|
|
|
30
25
|
"raf-schd": "^4.0.3"
|
|
31
26
|
},
|
|
32
27
|
"peerDependencies": {
|
|
33
|
-
"@atlaskit/editor-common": "^111.
|
|
28
|
+
"@atlaskit/editor-common": "^111.9.0",
|
|
34
29
|
"react": "^18.2.0",
|
|
35
30
|
"react-dom": "^18.2.0"
|
|
36
31
|
},
|