@atlaskit/editor-plugin-floating-toolbar 0.8.0 → 0.9.1

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,17 @@
1
1
  # @atlaskit/editor-plugin-floating-toolbar
2
2
 
3
+ ## 0.9.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 0.9.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#68824](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68824) [`2ce43bd09627`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2ce43bd09627) - [ux] When editor is in view mode, only show "Comment" floating toolbar item
14
+
3
15
  ## 0.8.0
4
16
 
5
17
  ### Minor Changes
@@ -206,10 +206,10 @@ function ContentComponent(_ref5) {
206
206
  }
207
207
  var config = configWithNodeInfo.config,
208
208
  node = configWithNodeInfo.node;
209
+ var items = config.items;
209
210
  var title = config.title,
210
211
  _config$getDomRef = config.getDomRef,
211
212
  getDomRef = _config$getDomRef === void 0 ? getDomRefFromSelection : _config$getDomRef,
212
- items = config.items,
213
213
  _config$align = config.align,
214
214
  align = _config$align === void 0 ? 'center' : _config$align,
215
215
  _config$className = config.className,
@@ -238,6 +238,18 @@ function ContentComponent(_ref5) {
238
238
  if (!targetRef || isEditorDisabled && !isInViewMode) {
239
239
  return null;
240
240
  }
241
+
242
+ // TODO: MODES-3950 Update this view mode specific logic once we refactor view mode.
243
+ // We should inverse the responsibility here: A blacklist for toolbar items in view mode, rather than this white list.
244
+ // Also consider moving this logic to the more specific toolbar plugins (media and selection).
245
+ var iterableItems = Array.isArray(items) ? items : [];
246
+ if (isInViewMode) {
247
+ // Typescript note: Not all toolbar item types have the `supportsViewMode` prop.
248
+ var toolbarItemViewModeProp = 'supportsViewMode';
249
+ items = iterableItems.filter(function (item) {
250
+ return toolbarItemViewModeProp in item && !!item[toolbarItemViewModeProp];
251
+ });
252
+ }
241
253
  var customPositionCalculation;
242
254
  var toolbarItems = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.copyButton) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.processCopyButtonItems(editorView.state)(Array.isArray(items) ? items : items(node), pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions.hoverDecoration);
243
255
  if (onPositionCalculated) {
@@ -198,10 +198,12 @@ function ContentComponent({
198
198
  config,
199
199
  node
200
200
  } = configWithNodeInfo;
201
+ let {
202
+ items
203
+ } = config;
201
204
  const {
202
205
  title,
203
206
  getDomRef = getDomRefFromSelection,
204
- items,
205
207
  align = 'center',
206
208
  className = '',
207
209
  height,
@@ -226,6 +228,16 @@ function ContentComponent({
226
228
  if (!targetRef || isEditorDisabled && !isInViewMode) {
227
229
  return null;
228
230
  }
231
+
232
+ // TODO: MODES-3950 Update this view mode specific logic once we refactor view mode.
233
+ // We should inverse the responsibility here: A blacklist for toolbar items in view mode, rather than this white list.
234
+ // Also consider moving this logic to the more specific toolbar plugins (media and selection).
235
+ const iterableItems = Array.isArray(items) ? items : [];
236
+ if (isInViewMode) {
237
+ // Typescript note: Not all toolbar item types have the `supportsViewMode` prop.
238
+ const toolbarItemViewModeProp = 'supportsViewMode';
239
+ items = iterableItems.filter(item => toolbarItemViewModeProp in item && !!item[toolbarItemViewModeProp]);
240
+ }
229
241
  let customPositionCalculation;
230
242
  const toolbarItems = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.copyButton) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.processCopyButtonItems(editorView.state)(Array.isArray(items) ? items : items(node), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions.hoverDecoration);
231
243
  if (onPositionCalculated) {
@@ -197,10 +197,10 @@ function ContentComponent(_ref5) {
197
197
  }
198
198
  var config = configWithNodeInfo.config,
199
199
  node = configWithNodeInfo.node;
200
+ var items = config.items;
200
201
  var title = config.title,
201
202
  _config$getDomRef = config.getDomRef,
202
203
  getDomRef = _config$getDomRef === void 0 ? getDomRefFromSelection : _config$getDomRef,
203
- items = config.items,
204
204
  _config$align = config.align,
205
205
  align = _config$align === void 0 ? 'center' : _config$align,
206
206
  _config$className = config.className,
@@ -229,6 +229,18 @@ function ContentComponent(_ref5) {
229
229
  if (!targetRef || isEditorDisabled && !isInViewMode) {
230
230
  return null;
231
231
  }
232
+
233
+ // TODO: MODES-3950 Update this view mode specific logic once we refactor view mode.
234
+ // We should inverse the responsibility here: A blacklist for toolbar items in view mode, rather than this white list.
235
+ // Also consider moving this logic to the more specific toolbar plugins (media and selection).
236
+ var iterableItems = Array.isArray(items) ? items : [];
237
+ if (isInViewMode) {
238
+ // Typescript note: Not all toolbar item types have the `supportsViewMode` prop.
239
+ var toolbarItemViewModeProp = 'supportsViewMode';
240
+ items = iterableItems.filter(function (item) {
241
+ return toolbarItemViewModeProp in item && !!item[toolbarItemViewModeProp];
242
+ });
243
+ }
232
244
  var customPositionCalculation;
233
245
  var toolbarItems = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.copyButton) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.processCopyButtonItems(editorView.state)(Array.isArray(items) ? items : items(node), pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions.hoverDecoration);
234
246
  if (onPositionCalculated) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-floating-toolbar",
3
- "version": "0.8.0",
3
+ "version": "0.9.1",
4
4
  "description": "Floating toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -28,16 +28,16 @@
28
28
  "@atlaskit/adf-utils": "^19.0.0",
29
29
  "@atlaskit/button": "^17.2.0",
30
30
  "@atlaskit/checkbox": "^13.0.0",
31
- "@atlaskit/editor-common": "^77.0.0",
31
+ "@atlaskit/editor-common": "^77.1.0",
32
32
  "@atlaskit/editor-palette": "1.5.2",
33
33
  "@atlaskit/editor-plugin-context-panel": "^0.2.0",
34
34
  "@atlaskit/editor-plugin-copy-button": "^1.0.0",
35
35
  "@atlaskit/editor-plugin-decorations": "^0.2.0",
36
36
  "@atlaskit/editor-plugin-editor-disabled": "^0.2.0",
37
37
  "@atlaskit/editor-plugin-editor-viewmode": "^0.1.0",
38
- "@atlaskit/editor-plugin-extension": "^0.6.0",
38
+ "@atlaskit/editor-plugin-extension": "^0.7.0",
39
39
  "@atlaskit/editor-plugin-feature-flags": "^1.0.0",
40
- "@atlaskit/editor-plugin-table": "^7.0.0",
40
+ "@atlaskit/editor-plugin-table": "^7.1.0",
41
41
  "@atlaskit/editor-prosemirror": "1.1.0",
42
42
  "@atlaskit/emoji": "^67.6.0",
43
43
  "@atlaskit/icon": "^22.0.0",
@@ -45,7 +45,7 @@
45
45
  "@atlaskit/modal-dialog": "^12.10.0",
46
46
  "@atlaskit/select": "^17.0.3",
47
47
  "@atlaskit/theme": "^12.6.0",
48
- "@atlaskit/tokens": "^1.34.0",
48
+ "@atlaskit/tokens": "^1.35.0",
49
49
  "@atlaskit/tooltip": "^18.1.0",
50
50
  "@babel/runtime": "^7.0.0",
51
51
  "@emotion/react": "^11.7.1",