@atlaskit/editor-plugin-caption 1.1.2 → 1.1.4
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 +107 -37
- package/dist/cjs/nodeviews/index.js +37 -6
- package/dist/es2019/nodeviews/index.js +28 -3
- package/dist/esm/nodeviews/index.js +37 -6
- package/dist/types/nodeviews/index.d.ts +7 -2
- package/dist/types/types.d.ts +6 -2
- package/dist/types-ts4.5/nodeviews/index.d.ts +7 -2
- package/dist/types-ts4.5/types.d.ts +4 -2
- package/package.json +12 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,192 +1,262 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-caption
|
|
2
2
|
|
|
3
|
+
## 1.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#96237](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/96237)
|
|
8
|
+
[`0401e7b5a88e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0401e7b5a88e) -
|
|
9
|
+
[ED-23102] Bump ADF schema to version 35.12.2
|
|
10
|
+
|
|
11
|
+
## 1.1.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#94413](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/94413)
|
|
16
|
+
[`6fa79788f5a8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6fa79788f5a8) -
|
|
17
|
+
Disallow editing of Media caption in live view mode
|
|
18
|
+
|
|
3
19
|
## 1.1.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
6
22
|
|
|
7
|
-
-
|
|
23
|
+
- [#94901](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/94901)
|
|
24
|
+
[`da964fcdc828`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/da964fcdc828) -
|
|
25
|
+
[ED-23097] Bump ADF schema to version 35.12.1
|
|
8
26
|
|
|
9
27
|
## 1.1.1
|
|
10
28
|
|
|
11
29
|
### Patch Changes
|
|
12
30
|
|
|
13
|
-
-
|
|
31
|
+
- [#93689](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/93689)
|
|
32
|
+
[`5ba5d2b4a9ac`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5ba5d2b4a9ac) -
|
|
33
|
+
Updating adf-schema version to 35.10.0
|
|
14
34
|
|
|
15
35
|
## 1.1.0
|
|
16
36
|
|
|
17
37
|
### Minor Changes
|
|
18
38
|
|
|
19
|
-
-
|
|
39
|
+
- [#91934](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91934)
|
|
40
|
+
[`b76a78c6a199`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b76a78c6a199) -
|
|
41
|
+
bumped editor-prosemirror version to 4.0.0
|
|
20
42
|
|
|
21
43
|
### Patch Changes
|
|
22
44
|
|
|
23
|
-
-
|
|
45
|
+
- Updated dependencies
|
|
24
46
|
|
|
25
47
|
## 1.0.7
|
|
26
48
|
|
|
27
49
|
### Patch Changes
|
|
28
50
|
|
|
29
|
-
-
|
|
51
|
+
- [#92426](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/92426)
|
|
52
|
+
[`32c76c7c225c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/32c76c7c225c) -
|
|
53
|
+
Bump adf-schema to 35.9.2 to support table alignment options
|
|
30
54
|
|
|
31
55
|
## 1.0.6
|
|
32
56
|
|
|
33
57
|
### Patch Changes
|
|
34
58
|
|
|
35
|
-
-
|
|
36
|
-
-
|
|
59
|
+
- [#91106](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91106)
|
|
60
|
+
[`b6ffa30186b9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b6ffa30186b9) -
|
|
61
|
+
Bump ADF-schema package to version 35.0.0
|
|
62
|
+
- Updated dependencies
|
|
37
63
|
|
|
38
64
|
## 1.0.5
|
|
39
65
|
|
|
40
66
|
### Patch Changes
|
|
41
67
|
|
|
42
|
-
-
|
|
68
|
+
- [#86724](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/86724)
|
|
69
|
+
[`718a9aa2424d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/718a9aa2424d) -
|
|
70
|
+
[ED-22607] Remove references to maxFrames for multi bodied extensions and bump adf-schema from
|
|
71
|
+
35.7.0 to 35.8.0
|
|
43
72
|
|
|
44
73
|
## 1.0.4
|
|
45
74
|
|
|
46
75
|
### Patch Changes
|
|
47
76
|
|
|
48
|
-
-
|
|
77
|
+
- [#81777](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/81777)
|
|
78
|
+
[`c6d7a5378751`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c6d7a5378751) -
|
|
79
|
+
Bump adf-schema to 35.7.0
|
|
49
80
|
|
|
50
81
|
## 1.0.3
|
|
51
82
|
|
|
52
83
|
### Patch Changes
|
|
53
84
|
|
|
54
|
-
-
|
|
85
|
+
- [#80679](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80679)
|
|
86
|
+
[`104eb9443b7e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/104eb9443b7e) -
|
|
87
|
+
ED-22553 Updating adf-schema version to 35.6.0
|
|
55
88
|
|
|
56
89
|
## 1.0.2
|
|
57
90
|
|
|
58
91
|
### Patch Changes
|
|
59
92
|
|
|
60
|
-
-
|
|
61
|
-
-
|
|
93
|
+
- [#78224](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/78224)
|
|
94
|
+
[`6b4c9dd4ad34`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6b4c9dd4ad34) -
|
|
95
|
+
ED-22219: adf-schema updated to 35.5.2
|
|
96
|
+
- Updated dependencies
|
|
62
97
|
|
|
63
98
|
## 1.0.1
|
|
64
99
|
|
|
65
100
|
### Patch Changes
|
|
66
101
|
|
|
67
|
-
-
|
|
102
|
+
- Updated dependencies
|
|
68
103
|
|
|
69
104
|
## 1.0.0
|
|
70
105
|
|
|
71
106
|
### Major Changes
|
|
72
107
|
|
|
73
|
-
-
|
|
108
|
+
- [#72386](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/72386)
|
|
109
|
+
[`0c52b0be40c1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0c52b0be40c1) -
|
|
110
|
+
This changeset exists to bump all editor plugins that currently don't have a major version. This
|
|
111
|
+
is to address an issue with Jira plugin consumption.
|
|
74
112
|
|
|
75
113
|
### Patch Changes
|
|
76
114
|
|
|
77
|
-
-
|
|
115
|
+
- Updated dependencies
|
|
78
116
|
|
|
79
117
|
## 0.2.16
|
|
80
118
|
|
|
81
119
|
### Patch Changes
|
|
82
120
|
|
|
83
|
-
-
|
|
121
|
+
- [#68572](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68572)
|
|
122
|
+
[`15d407fe5143`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/15d407fe5143) -
|
|
123
|
+
Upgrading @atlaskit/editor-prosemirror dependency
|
|
84
124
|
|
|
85
125
|
## 0.2.15
|
|
86
126
|
|
|
87
127
|
### Patch Changes
|
|
88
128
|
|
|
89
|
-
-
|
|
129
|
+
- [#70152](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/70152)
|
|
130
|
+
[`53ed3673df28`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/53ed3673df28) -
|
|
131
|
+
Updating adf-schema version to 35.5.1
|
|
90
132
|
|
|
91
133
|
## 0.2.14
|
|
92
134
|
|
|
93
135
|
### Patch Changes
|
|
94
136
|
|
|
95
|
-
-
|
|
137
|
+
- Updated dependencies
|
|
96
138
|
|
|
97
139
|
## 0.2.13
|
|
98
140
|
|
|
99
141
|
### Patch Changes
|
|
100
142
|
|
|
101
|
-
-
|
|
102
|
-
-
|
|
143
|
+
- [#65031](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/65031)
|
|
144
|
+
[`a00094111b5a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a00094111b5a) -
|
|
145
|
+
ED-21609 Update adf-schema to 35.3.0
|
|
146
|
+
- Updated dependencies
|
|
103
147
|
|
|
104
148
|
## 0.2.12
|
|
105
149
|
|
|
106
150
|
### Patch Changes
|
|
107
151
|
|
|
108
|
-
-
|
|
152
|
+
- [#62165](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/62165)
|
|
153
|
+
[`b44ac0968d79`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b44ac0968d79) -
|
|
154
|
+
[ED-21562] Bump @atlaskit/adf-schema to 35.2.0 for border mark update
|
|
109
155
|
|
|
110
156
|
## 0.2.11
|
|
111
157
|
|
|
112
158
|
### Patch Changes
|
|
113
159
|
|
|
114
|
-
-
|
|
160
|
+
- [#60808](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/60808)
|
|
161
|
+
[`f509a21be124`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f509a21be124) -
|
|
162
|
+
ED-21506: @atlaskit/adf-schema upgraded to 35.1.1 to support renderer for MBE
|
|
115
163
|
|
|
116
164
|
## 0.2.10
|
|
117
165
|
|
|
118
166
|
### Patch Changes
|
|
119
167
|
|
|
120
|
-
-
|
|
168
|
+
- [#58246](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/58246)
|
|
169
|
+
[`a381b2599716`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a381b2599716) -
|
|
170
|
+
ED-21371 Update adf-schema to 35.1.0
|
|
121
171
|
|
|
122
172
|
## 0.2.9
|
|
123
173
|
|
|
124
174
|
### Patch Changes
|
|
125
175
|
|
|
126
|
-
-
|
|
176
|
+
- Updated dependencies
|
|
127
177
|
|
|
128
178
|
## 0.2.8
|
|
129
179
|
|
|
130
180
|
### Patch Changes
|
|
131
181
|
|
|
132
|
-
-
|
|
182
|
+
- [#59147](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/59147)
|
|
183
|
+
[`f12e489f23b0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f12e489f23b0) -
|
|
184
|
+
Re-build and deploy packages to NPM to resolve React/Compiled not found error (HOT-106483).
|
|
133
185
|
|
|
134
186
|
## 0.2.7
|
|
135
187
|
|
|
136
188
|
### Patch Changes
|
|
137
189
|
|
|
138
|
-
-
|
|
190
|
+
- [#58763](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/58763)
|
|
191
|
+
[`0fdbd64522bf`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0fdbd64522bf) -
|
|
192
|
+
update ADF schema
|
|
139
193
|
|
|
140
194
|
## 0.2.6
|
|
141
195
|
|
|
142
196
|
### Patch Changes
|
|
143
197
|
|
|
144
|
-
-
|
|
198
|
+
- [#56790](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/56790)
|
|
199
|
+
[`ff577a7969d4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ff577a7969d4) -
|
|
200
|
+
ED-21266: Updated @atlaskit/adf-schema to 34.0.1
|
|
145
201
|
|
|
146
202
|
## 0.2.5
|
|
147
203
|
|
|
148
204
|
### Patch Changes
|
|
149
205
|
|
|
150
|
-
-
|
|
206
|
+
- [#43417](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43417)
|
|
207
|
+
[`3f3c17f0273`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3f3c17f0273) -
|
|
208
|
+
ED-20971 Upgrade adf-schema package to ^34.0.0
|
|
151
209
|
|
|
152
210
|
## 0.2.4
|
|
153
211
|
|
|
154
212
|
### Patch Changes
|
|
155
213
|
|
|
156
|
-
-
|
|
157
|
-
-
|
|
214
|
+
- [#43379](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43379)
|
|
215
|
+
[`482c025520d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/482c025520d) -
|
|
216
|
+
ED-20763 Upgrade ADF schema version to 33.2.3 for MBE nodes.
|
|
217
|
+
- Updated dependencies
|
|
158
218
|
|
|
159
219
|
## 0.2.3
|
|
160
220
|
|
|
161
221
|
### Patch Changes
|
|
162
222
|
|
|
163
|
-
-
|
|
223
|
+
- Updated dependencies
|
|
164
224
|
|
|
165
225
|
## 0.2.2
|
|
166
226
|
|
|
167
227
|
### Patch Changes
|
|
168
228
|
|
|
169
|
-
-
|
|
229
|
+
- [#41343](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41343)
|
|
230
|
+
[`243143e8007`](https://bitbucket.org/atlassian/atlassian-frontend/commits/243143e8007) -
|
|
231
|
+
Improved media single performance by preventing unnecessary updates to collab service on every
|
|
232
|
+
component update
|
|
170
233
|
|
|
171
234
|
## 0.2.1
|
|
172
235
|
|
|
173
236
|
### Patch Changes
|
|
174
237
|
|
|
175
|
-
-
|
|
176
|
-
-
|
|
238
|
+
- [#40750](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40750)
|
|
239
|
+
[`fc19a7b9edd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fc19a7b9edd) -
|
|
240
|
+
[ED-19875] Extraction of Editor Core's Selection Plugin into independent package
|
|
241
|
+
'@atlaskit/editor-plugin-selection'.
|
|
242
|
+
- Updated dependencies
|
|
177
243
|
|
|
178
244
|
## 0.2.0
|
|
179
245
|
|
|
180
246
|
### Minor Changes
|
|
181
247
|
|
|
182
|
-
-
|
|
248
|
+
- [#41239](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41239)
|
|
249
|
+
[`7d70b962986`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7d70b962986) -
|
|
250
|
+
Extract Caption Plugin from Editor Core
|
|
183
251
|
|
|
184
252
|
## 0.1.0
|
|
185
253
|
|
|
186
254
|
### Minor Changes
|
|
187
255
|
|
|
188
|
-
-
|
|
256
|
+
- [#41217](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41217)
|
|
257
|
+
[`288b7a988c7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/288b7a988c7) -
|
|
258
|
+
Caption Plugin Scaffolding
|
|
189
259
|
|
|
190
260
|
### Patch Changes
|
|
191
261
|
|
|
192
|
-
-
|
|
262
|
+
- Updated dependencies
|
|
@@ -16,19 +16,25 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
16
16
|
var _react = _interopRequireDefault(require("react"));
|
|
17
17
|
var _selectionBasedNodeView = require("@atlaskit/editor-common/selection-based-node-view");
|
|
18
18
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
19
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
20
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
20
21
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
21
22
|
var CaptionNodeView = exports.CaptionNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
22
23
|
(0, _inherits2.default)(CaptionNodeView, _SelectionBasedNodeVi);
|
|
23
24
|
var _super = _createSuper(CaptionNodeView);
|
|
24
|
-
function CaptionNodeView() {
|
|
25
|
+
function CaptionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent) {
|
|
25
26
|
var _this;
|
|
27
|
+
var hasContext = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
|
|
28
|
+
var viewShouldUpdate = arguments.length > 8 ? arguments[8] : undefined;
|
|
29
|
+
var hasIntlContext = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
|
|
30
|
+
var pluginInjectionApi = arguments.length > 10 ? arguments[10] : undefined;
|
|
26
31
|
(0, _classCallCheck2.default)(this, CaptionNodeView);
|
|
27
|
-
|
|
28
|
-
args[_key] = arguments[_key];
|
|
29
|
-
}
|
|
30
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
32
|
+
_this = _super.call(this, node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, hasContext, viewShouldUpdate, hasIntlContext);
|
|
31
33
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "selected", _this.insideSelection());
|
|
34
|
+
_this.pluginInjectionApi = pluginInjectionApi;
|
|
35
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.live-view.disable-editing-in-view-mode_fi1rx')) {
|
|
36
|
+
_this.handleEditorDisabledChanged();
|
|
37
|
+
}
|
|
32
38
|
return _this;
|
|
33
39
|
}
|
|
34
40
|
(0, _createClass2.default)(CaptionNodeView, [{
|
|
@@ -45,10 +51,27 @@ var CaptionNodeView = exports.CaptionNodeView = /*#__PURE__*/function (_Selectio
|
|
|
45
51
|
// setting a className prevents PM/Chrome mutation observer from
|
|
46
52
|
// incorrectly deleting nodes
|
|
47
53
|
dom.className = 'caption-wrapper';
|
|
54
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.live-view.disable-editing-in-view-mode_fi1rx')) {
|
|
55
|
+
var _this$pluginInjection;
|
|
56
|
+
dom.setAttribute('contenteditable', (_this$pluginInjection = this.pluginInjectionApi) !== null && _this$pluginInjection !== void 0 && (_this$pluginInjection = _this$pluginInjection.editorDisabled) !== null && _this$pluginInjection !== void 0 && (_this$pluginInjection = _this$pluginInjection.sharedState.currentState()) !== null && _this$pluginInjection !== void 0 && _this$pluginInjection.editorDisabled ? 'false' : 'true');
|
|
57
|
+
}
|
|
48
58
|
return {
|
|
49
59
|
dom: dom
|
|
50
60
|
};
|
|
51
61
|
}
|
|
62
|
+
}, {
|
|
63
|
+
key: "handleEditorDisabledChanged",
|
|
64
|
+
value: function handleEditorDisabledChanged() {
|
|
65
|
+
var _this$pluginInjection2,
|
|
66
|
+
_this2 = this;
|
|
67
|
+
if ((_this$pluginInjection2 = this.pluginInjectionApi) !== null && _this$pluginInjection2 !== void 0 && _this$pluginInjection2.editorDisabled) {
|
|
68
|
+
this.cleanupEditorDisabledListener = this.pluginInjectionApi.editorDisabled.sharedState.onChange(function (sharedState) {
|
|
69
|
+
if (_this2.contentDOM) {
|
|
70
|
+
_this2.contentDOM.setAttribute('contenteditable', sharedState.nextSharedState.editorDisabled ? 'false' : 'true');
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
52
75
|
}, {
|
|
53
76
|
key: "render",
|
|
54
77
|
value: function render(_props, forwardRef) {
|
|
@@ -70,12 +93,20 @@ var CaptionNodeView = exports.CaptionNodeView = /*#__PURE__*/function (_Selectio
|
|
|
70
93
|
this.selected = newSelected;
|
|
71
94
|
return selectedStateChange;
|
|
72
95
|
}
|
|
96
|
+
}, {
|
|
97
|
+
key: "destroy",
|
|
98
|
+
value: function destroy() {
|
|
99
|
+
if (this.cleanupEditorDisabledListener) {
|
|
100
|
+
this.cleanupEditorDisabledListener();
|
|
101
|
+
}
|
|
102
|
+
this.cleanupEditorDisabledListener = undefined;
|
|
103
|
+
}
|
|
73
104
|
}]);
|
|
74
105
|
return CaptionNodeView;
|
|
75
106
|
}(_selectionBasedNodeView.SelectionBasedNodeView);
|
|
76
107
|
function captionNodeView(portalProviderAPI, eventDispatcher, pluginInjectionApi) {
|
|
77
108
|
return function (node, view, getPos) {
|
|
78
109
|
var hasIntlContext = true;
|
|
79
|
-
return new CaptionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {}, undefined, undefined, undefined, hasIntlContext).init();
|
|
110
|
+
return new CaptionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {}, undefined, undefined, undefined, hasIntlContext, pluginInjectionApi).init();
|
|
80
111
|
};
|
|
81
112
|
}
|
|
@@ -2,10 +2,15 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
|
|
4
4
|
import { Caption } from '@atlaskit/editor-common/ui';
|
|
5
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
export class CaptionNodeView extends SelectionBasedNodeView {
|
|
6
|
-
constructor(
|
|
7
|
-
super(
|
|
7
|
+
constructor(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, hasContext = false, viewShouldUpdate, hasIntlContext = false, pluginInjectionApi) {
|
|
8
|
+
super(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, hasContext, viewShouldUpdate, hasIntlContext);
|
|
8
9
|
_defineProperty(this, "selected", this.insideSelection());
|
|
10
|
+
this.pluginInjectionApi = pluginInjectionApi;
|
|
11
|
+
if (getBooleanFF('platform.editor.live-view.disable-editing-in-view-mode_fi1rx')) {
|
|
12
|
+
this.handleEditorDisabledChanged();
|
|
13
|
+
}
|
|
9
14
|
}
|
|
10
15
|
createDomRef() {
|
|
11
16
|
const domRef = document.createElement('figcaption');
|
|
@@ -17,10 +22,24 @@ export class CaptionNodeView extends SelectionBasedNodeView {
|
|
|
17
22
|
// setting a className prevents PM/Chrome mutation observer from
|
|
18
23
|
// incorrectly deleting nodes
|
|
19
24
|
dom.className = 'caption-wrapper';
|
|
25
|
+
if (getBooleanFF('platform.editor.live-view.disable-editing-in-view-mode_fi1rx')) {
|
|
26
|
+
var _this$pluginInjection, _this$pluginInjection2, _this$pluginInjection3;
|
|
27
|
+
dom.setAttribute('contenteditable', (_this$pluginInjection = this.pluginInjectionApi) !== null && _this$pluginInjection !== void 0 && (_this$pluginInjection2 = _this$pluginInjection.editorDisabled) !== null && _this$pluginInjection2 !== void 0 && (_this$pluginInjection3 = _this$pluginInjection2.sharedState.currentState()) !== null && _this$pluginInjection3 !== void 0 && _this$pluginInjection3.editorDisabled ? 'false' : 'true');
|
|
28
|
+
}
|
|
20
29
|
return {
|
|
21
30
|
dom
|
|
22
31
|
};
|
|
23
32
|
}
|
|
33
|
+
handleEditorDisabledChanged() {
|
|
34
|
+
var _this$pluginInjection4;
|
|
35
|
+
if ((_this$pluginInjection4 = this.pluginInjectionApi) !== null && _this$pluginInjection4 !== void 0 && _this$pluginInjection4.editorDisabled) {
|
|
36
|
+
this.cleanupEditorDisabledListener = this.pluginInjectionApi.editorDisabled.sharedState.onChange(sharedState => {
|
|
37
|
+
if (this.contentDOM) {
|
|
38
|
+
this.contentDOM.setAttribute('contenteditable', sharedState.nextSharedState.editorDisabled ? 'false' : 'true');
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
24
43
|
render(_props, forwardRef) {
|
|
25
44
|
return /*#__PURE__*/React.createElement(Caption, {
|
|
26
45
|
selected: this.insideSelection(),
|
|
@@ -38,10 +57,16 @@ export class CaptionNodeView extends SelectionBasedNodeView {
|
|
|
38
57
|
this.selected = newSelected;
|
|
39
58
|
return selectedStateChange;
|
|
40
59
|
}
|
|
60
|
+
destroy() {
|
|
61
|
+
if (this.cleanupEditorDisabledListener) {
|
|
62
|
+
this.cleanupEditorDisabledListener();
|
|
63
|
+
}
|
|
64
|
+
this.cleanupEditorDisabledListener = undefined;
|
|
65
|
+
}
|
|
41
66
|
}
|
|
42
67
|
export default function captionNodeView(portalProviderAPI, eventDispatcher, pluginInjectionApi) {
|
|
43
68
|
return (node, view, getPos) => {
|
|
44
69
|
const hasIntlContext = true;
|
|
45
|
-
return new CaptionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {}, undefined, undefined, undefined, hasIntlContext).init();
|
|
70
|
+
return new CaptionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {}, undefined, undefined, undefined, hasIntlContext, pluginInjectionApi).init();
|
|
46
71
|
};
|
|
47
72
|
}
|
|
@@ -10,17 +10,23 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
|
|
12
12
|
import { Caption } from '@atlaskit/editor-common/ui';
|
|
13
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
13
14
|
export var CaptionNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
14
15
|
_inherits(CaptionNodeView, _SelectionBasedNodeVi);
|
|
15
16
|
var _super = _createSuper(CaptionNodeView);
|
|
16
|
-
function CaptionNodeView() {
|
|
17
|
+
function CaptionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent) {
|
|
17
18
|
var _this;
|
|
19
|
+
var hasContext = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
|
|
20
|
+
var viewShouldUpdate = arguments.length > 8 ? arguments[8] : undefined;
|
|
21
|
+
var hasIntlContext = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
|
|
22
|
+
var pluginInjectionApi = arguments.length > 10 ? arguments[10] : undefined;
|
|
18
23
|
_classCallCheck(this, CaptionNodeView);
|
|
19
|
-
|
|
20
|
-
args[_key] = arguments[_key];
|
|
21
|
-
}
|
|
22
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
24
|
+
_this = _super.call(this, node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, hasContext, viewShouldUpdate, hasIntlContext);
|
|
23
25
|
_defineProperty(_assertThisInitialized(_this), "selected", _this.insideSelection());
|
|
26
|
+
_this.pluginInjectionApi = pluginInjectionApi;
|
|
27
|
+
if (getBooleanFF('platform.editor.live-view.disable-editing-in-view-mode_fi1rx')) {
|
|
28
|
+
_this.handleEditorDisabledChanged();
|
|
29
|
+
}
|
|
24
30
|
return _this;
|
|
25
31
|
}
|
|
26
32
|
_createClass(CaptionNodeView, [{
|
|
@@ -37,10 +43,27 @@ export var CaptionNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
37
43
|
// setting a className prevents PM/Chrome mutation observer from
|
|
38
44
|
// incorrectly deleting nodes
|
|
39
45
|
dom.className = 'caption-wrapper';
|
|
46
|
+
if (getBooleanFF('platform.editor.live-view.disable-editing-in-view-mode_fi1rx')) {
|
|
47
|
+
var _this$pluginInjection;
|
|
48
|
+
dom.setAttribute('contenteditable', (_this$pluginInjection = this.pluginInjectionApi) !== null && _this$pluginInjection !== void 0 && (_this$pluginInjection = _this$pluginInjection.editorDisabled) !== null && _this$pluginInjection !== void 0 && (_this$pluginInjection = _this$pluginInjection.sharedState.currentState()) !== null && _this$pluginInjection !== void 0 && _this$pluginInjection.editorDisabled ? 'false' : 'true');
|
|
49
|
+
}
|
|
40
50
|
return {
|
|
41
51
|
dom: dom
|
|
42
52
|
};
|
|
43
53
|
}
|
|
54
|
+
}, {
|
|
55
|
+
key: "handleEditorDisabledChanged",
|
|
56
|
+
value: function handleEditorDisabledChanged() {
|
|
57
|
+
var _this$pluginInjection2,
|
|
58
|
+
_this2 = this;
|
|
59
|
+
if ((_this$pluginInjection2 = this.pluginInjectionApi) !== null && _this$pluginInjection2 !== void 0 && _this$pluginInjection2.editorDisabled) {
|
|
60
|
+
this.cleanupEditorDisabledListener = this.pluginInjectionApi.editorDisabled.sharedState.onChange(function (sharedState) {
|
|
61
|
+
if (_this2.contentDOM) {
|
|
62
|
+
_this2.contentDOM.setAttribute('contenteditable', sharedState.nextSharedState.editorDisabled ? 'false' : 'true');
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
44
67
|
}, {
|
|
45
68
|
key: "render",
|
|
46
69
|
value: function render(_props, forwardRef) {
|
|
@@ -62,12 +85,20 @@ export var CaptionNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
62
85
|
this.selected = newSelected;
|
|
63
86
|
return selectedStateChange;
|
|
64
87
|
}
|
|
88
|
+
}, {
|
|
89
|
+
key: "destroy",
|
|
90
|
+
value: function destroy() {
|
|
91
|
+
if (this.cleanupEditorDisabledListener) {
|
|
92
|
+
this.cleanupEditorDisabledListener();
|
|
93
|
+
}
|
|
94
|
+
this.cleanupEditorDisabledListener = undefined;
|
|
95
|
+
}
|
|
65
96
|
}]);
|
|
66
97
|
return CaptionNodeView;
|
|
67
98
|
}(SelectionBasedNodeView);
|
|
68
99
|
export default function captionNodeView(portalProviderAPI, eventDispatcher, pluginInjectionApi) {
|
|
69
100
|
return function (node, view, getPos) {
|
|
70
101
|
var hasIntlContext = true;
|
|
71
|
-
return new CaptionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {}, undefined, undefined, undefined, hasIntlContext).init();
|
|
102
|
+
return new CaptionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {}, undefined, undefined, undefined, hasIntlContext, pluginInjectionApi).init();
|
|
72
103
|
};
|
|
73
104
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
3
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
4
|
-
import type { ForwardRef } from '@atlaskit/editor-common/react-node-view';
|
|
4
|
+
import type { ForwardRef, ReactComponentProps, shouldUpdate } from '@atlaskit/editor-common/react-node-view';
|
|
5
5
|
import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
|
|
6
6
|
import type { ExtractInjectionAPI, getPosHandler } from '@atlaskit/editor-common/types';
|
|
7
7
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -9,11 +9,16 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
|
9
9
|
import type { CaptionPlugin } from '../types';
|
|
10
10
|
export declare class CaptionNodeView extends SelectionBasedNodeView {
|
|
11
11
|
private selected;
|
|
12
|
+
private cleanupEditorDisabledListener?;
|
|
13
|
+
pluginInjectionApi?: ExtractInjectionAPI<CaptionPlugin>;
|
|
14
|
+
constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps: ReactComponentProps, reactComponent?: React.ComponentType<React.PropsWithChildren<unknown>>, hasContext?: boolean, viewShouldUpdate?: shouldUpdate, hasIntlContext?: boolean, pluginInjectionApi?: ExtractInjectionAPI<CaptionPlugin>);
|
|
12
15
|
createDomRef(): HTMLElement;
|
|
13
16
|
getContentDOM(): {
|
|
14
17
|
dom: HTMLDivElement;
|
|
15
18
|
};
|
|
19
|
+
handleEditorDisabledChanged(): void;
|
|
16
20
|
render(_props: never, forwardRef: ForwardRef): JSX.Element;
|
|
17
21
|
viewShouldUpdate(nextNode: PMNode): boolean;
|
|
22
|
+
destroy(): void;
|
|
18
23
|
}
|
|
19
24
|
export default function captionNodeView(portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginInjectionApi: ExtractInjectionAPI<CaptionPlugin> | undefined): (node: PMNode, view: EditorView, getPos: getPosHandler) => CaptionNodeView;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
1
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
3
4
|
export type CaptionPlugin = NextEditorPlugin<'caption', {
|
|
4
|
-
dependencies: [
|
|
5
|
+
dependencies: [
|
|
6
|
+
typeof analyticsPlugin,
|
|
7
|
+
OptionalPlugin<EditorDisabledPlugin>
|
|
8
|
+
];
|
|
5
9
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
3
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
4
|
-
import type { ForwardRef } from '@atlaskit/editor-common/react-node-view';
|
|
4
|
+
import type { ForwardRef, ReactComponentProps, shouldUpdate } from '@atlaskit/editor-common/react-node-view';
|
|
5
5
|
import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
|
|
6
6
|
import type { ExtractInjectionAPI, getPosHandler } from '@atlaskit/editor-common/types';
|
|
7
7
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -9,11 +9,16 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
|
9
9
|
import type { CaptionPlugin } from '../types';
|
|
10
10
|
export declare class CaptionNodeView extends SelectionBasedNodeView {
|
|
11
11
|
private selected;
|
|
12
|
+
private cleanupEditorDisabledListener?;
|
|
13
|
+
pluginInjectionApi?: ExtractInjectionAPI<CaptionPlugin>;
|
|
14
|
+
constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps: ReactComponentProps, reactComponent?: React.ComponentType<React.PropsWithChildren<unknown>>, hasContext?: boolean, viewShouldUpdate?: shouldUpdate, hasIntlContext?: boolean, pluginInjectionApi?: ExtractInjectionAPI<CaptionPlugin>);
|
|
12
15
|
createDomRef(): HTMLElement;
|
|
13
16
|
getContentDOM(): {
|
|
14
17
|
dom: HTMLDivElement;
|
|
15
18
|
};
|
|
19
|
+
handleEditorDisabledChanged(): void;
|
|
16
20
|
render(_props: never, forwardRef: ForwardRef): JSX.Element;
|
|
17
21
|
viewShouldUpdate(nextNode: PMNode): boolean;
|
|
22
|
+
destroy(): void;
|
|
18
23
|
}
|
|
19
24
|
export default function captionNodeView(portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginInjectionApi: ExtractInjectionAPI<CaptionPlugin> | undefined): (node: PMNode, view: EditorView, getPos: getPosHandler) => CaptionNodeView;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
1
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
3
4
|
export type CaptionPlugin = NextEditorPlugin<'caption', {
|
|
4
5
|
dependencies: [
|
|
5
|
-
typeof analyticsPlugin
|
|
6
|
+
typeof analyticsPlugin,
|
|
7
|
+
OptionalPlugin<EditorDisabledPlugin>
|
|
6
8
|
];
|
|
7
9
|
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-caption",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Caption plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,16 +32,17 @@
|
|
|
32
32
|
".": "./src/index.ts"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@atlaskit/adf-schema": "^35.12.
|
|
36
|
-
"@atlaskit/editor-common": "^78.
|
|
35
|
+
"@atlaskit/adf-schema": "^35.12.2",
|
|
36
|
+
"@atlaskit/editor-common": "^78.37.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^1.1.0",
|
|
38
|
+
"@atlaskit/editor-plugin-editor-disabled": "^1.1.0",
|
|
38
39
|
"@atlaskit/editor-prosemirror": "4.0.0",
|
|
40
|
+
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
39
41
|
"@babel/runtime": "^7.0.0"
|
|
40
42
|
},
|
|
41
43
|
"devDependencies": {
|
|
42
44
|
"@atlaskit/editor-plugin-copy-button": "^1.1.0",
|
|
43
45
|
"@atlaskit/editor-plugin-decorations": "^1.1.0",
|
|
44
|
-
"@atlaskit/editor-plugin-editor-disabled": "^1.1.0",
|
|
45
46
|
"@atlaskit/editor-plugin-feature-flags": "^1.1.0",
|
|
46
47
|
"@atlaskit/editor-plugin-floating-toolbar": "^1.4.0",
|
|
47
48
|
"@atlaskit/editor-plugin-focus": "^1.2.0",
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
"@atlaskit/editor-plugin-guideline": "^1.1.0",
|
|
50
51
|
"@atlaskit/editor-plugin-selection": "^1.2.0",
|
|
51
52
|
"@atlaskit/editor-plugin-width": "^1.1.0",
|
|
52
|
-
"@atlaskit/renderer": "^109.
|
|
53
|
+
"@atlaskit/renderer": "^109.23.0",
|
|
53
54
|
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0"
|
|
54
55
|
},
|
|
55
56
|
"peerDependencies": {
|
|
@@ -85,5 +86,10 @@
|
|
|
85
86
|
]
|
|
86
87
|
}
|
|
87
88
|
},
|
|
88
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
89
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0",
|
|
90
|
+
"platform-feature-flags": {
|
|
91
|
+
"platform.editor.live-view.disable-editing-in-view-mode_fi1rx": {
|
|
92
|
+
"type": "boolean"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
89
95
|
}
|