@atlaskit/editor-plugin-editor-disabled 7.0.1 → 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
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
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
|
+
|
|
3
11
|
## 7.0.1
|
|
4
12
|
|
|
5
13
|
### 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
|
|
@@ -119,12 +116,9 @@ var editorDisabledPlugin = exports.editorDisabledPlugin = function editorDisable
|
|
|
119
116
|
editorDisabled: false
|
|
120
117
|
};
|
|
121
118
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
return pluginState;
|
|
119
|
+
return {
|
|
120
|
+
editorDisabled: pluginState.disabledByPlugin || pluginState.editorDisabled
|
|
121
|
+
};
|
|
128
122
|
},
|
|
129
123
|
pmPlugins: function pmPlugins() {
|
|
130
124
|
return [{
|
|
@@ -139,10 +133,10 @@ var editorDisabledPlugin = exports.editorDisabledPlugin = function editorDisable
|
|
|
139
133
|
toggleDisabled: function toggleDisabled(disabled) {
|
|
140
134
|
return function (_ref4) {
|
|
141
135
|
var tr = _ref4.tr;
|
|
142
|
-
return
|
|
136
|
+
return tr.setMeta(pluginKey, {
|
|
143
137
|
action: _reducer.ACTION.TOGGLE_DISABLED,
|
|
144
138
|
disabled: disabled
|
|
145
|
-
})
|
|
139
|
+
});
|
|
146
140
|
};
|
|
147
141
|
}
|
|
148
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
|
|
@@ -113,12 +110,9 @@ export const editorDisabledPlugin = ({
|
|
|
113
110
|
editorDisabled: false
|
|
114
111
|
};
|
|
115
112
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
return pluginState;
|
|
113
|
+
return {
|
|
114
|
+
editorDisabled: pluginState.disabledByPlugin || pluginState.editorDisabled
|
|
115
|
+
};
|
|
122
116
|
},
|
|
123
117
|
pmPlugins: () => [{
|
|
124
118
|
name: 'editorDisabled',
|
|
@@ -130,10 +124,10 @@ export const editorDisabledPlugin = ({
|
|
|
130
124
|
toggleDisabled: disabled => ({
|
|
131
125
|
tr
|
|
132
126
|
}) => {
|
|
133
|
-
return
|
|
127
|
+
return tr.setMeta(pluginKey, {
|
|
134
128
|
action: ACTION.TOGGLE_DISABLED,
|
|
135
129
|
disabled
|
|
136
|
-
})
|
|
130
|
+
});
|
|
137
131
|
}
|
|
138
132
|
}
|
|
139
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
|
|
@@ -112,12 +109,9 @@ export var editorDisabledPlugin = function editorDisabledPlugin(_ref2) {
|
|
|
112
109
|
editorDisabled: false
|
|
113
110
|
};
|
|
114
111
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
return pluginState;
|
|
112
|
+
return {
|
|
113
|
+
editorDisabled: pluginState.disabledByPlugin || pluginState.editorDisabled
|
|
114
|
+
};
|
|
121
115
|
},
|
|
122
116
|
pmPlugins: function pmPlugins() {
|
|
123
117
|
return [{
|
|
@@ -132,10 +126,10 @@ export var editorDisabledPlugin = function editorDisabledPlugin(_ref2) {
|
|
|
132
126
|
toggleDisabled: function toggleDisabled(disabled) {
|
|
133
127
|
return function (_ref4) {
|
|
134
128
|
var tr = _ref4.tr;
|
|
135
|
-
return
|
|
129
|
+
return tr.setMeta(pluginKey, {
|
|
136
130
|
action: ACTION.TOGGLE_DISABLED,
|
|
137
131
|
disabled: disabled
|
|
138
|
-
})
|
|
132
|
+
});
|
|
139
133
|
};
|
|
140
134
|
}
|
|
141
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
|
},
|