@atlaskit/editor-plugin-floating-toolbar 8.2.7 → 8.2.9

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,21 @@
1
1
  # @atlaskit/editor-plugin-floating-toolbar
2
2
 
3
+ ## 8.2.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [`4f5569bde5e64`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4f5569bde5e64) -
8
+ Add new 'dragHandleSelected' user intent, use this to control table toolbar when drag handle is
9
+ selected
10
+ - Updated dependencies
11
+
12
+ ## 8.2.8
13
+
14
+ ### Patch Changes
15
+
16
+ - [`c73240f29d437`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c73240f29d437) -
17
+ upgrade use of browser util
18
+
3
19
  ## 8.2.7
4
20
 
5
21
  ### Patch Changes
@@ -270,8 +270,16 @@ function ContentComponent(_ref5) {
270
270
  var selection = editorView.state.selection;
271
271
  var isCellSelection = '$anchorCell' in selection && !selection.empty;
272
272
  var isTextSelected = selection instanceof _state.TextSelection && !selection.empty;
273
- if (isTextSelected && config.className !== 'hyperlink-floating-toolbar' || isCellSelection) {
274
- return null;
273
+
274
+ // don't dismiss table toolbar when a cell selection is caused by clicking the drag handle (which has it's own userIntent)
275
+ if ((0, _platformFeatureFlags.fg)('platform_editor_toolbar_aifc_user_intent_fix')) {
276
+ if (isTextSelected && config.className !== 'hyperlink-floating-toolbar' || isCellSelection && (userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'default') {
277
+ return null;
278
+ }
279
+ } else {
280
+ if (isTextSelected && config.className !== 'hyperlink-floating-toolbar' || isCellSelection) {
281
+ return null;
282
+ }
275
283
  }
276
284
  }
277
285
  var items = config.items;
@@ -8,6 +8,7 @@ var _browser = require("@atlaskit/editor-common/browser");
8
8
  var _clipboard = require("@atlaskit/editor-common/clipboard");
9
9
  var _copyButton = require("@atlaskit/editor-common/copy-button");
10
10
  var _state = require("@atlaskit/editor-prosemirror/state");
11
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
11
12
  var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
12
13
  var copyNode = exports.copyNode = function copyNode(nodeType, editorAnalyticsApi, inputMethod) {
13
14
  return function (_ref) {
@@ -31,6 +32,7 @@ var copyNode = exports.copyNode = function copyNode(nodeType, editorAnalyticsApi
31
32
  } else {
32
33
  if (domNode) {
33
34
  var div = document.createElement('div');
35
+ var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
34
36
  div.appendChild(domNode);
35
37
 
36
38
  // if copying inline content
@@ -51,7 +53,7 @@ var copyNode = exports.copyNode = function copyNode(nodeType, editorAnalyticsApi
51
53
  }
52
54
  // ED-17083 safari seems have bugs for extension copy because exntension do not have a child text(innerText) and it will not recognized as html in clipboard, this could be merge into one if this extension fixed children issue or safari fix the copy bug
53
55
  // MEX-2528 safari has a bug related to the mediaSingle node with border or link. The image tag within the clipboard is not recognized as HTML when using the ClipboardItem API. To address this, we have to switch to ClipboardPolyfill
54
- if (_browser.browser.safari && tr.selection instanceof _state.NodeSelection && (tr.selection.node.type === schema.nodes.extension || tr.selection.node.type === schema.nodes.mediaSingle)) {
56
+ if (browser.safari && tr.selection instanceof _state.NodeSelection && (tr.selection.node.type === schema.nodes.extension || tr.selection.node.type === schema.nodes.mediaSingle)) {
55
57
  (0, _clipboard.copyHTMLToClipboardPolyfill)(div);
56
58
  } else {
57
59
  (0, _clipboard.copyHTMLToClipboard)(div);
@@ -262,8 +262,16 @@ export function ContentComponent({
262
262
  const selection = editorView.state.selection;
263
263
  const isCellSelection = '$anchorCell' in selection && !selection.empty;
264
264
  const isTextSelected = selection instanceof TextSelection && !selection.empty;
265
- if (isTextSelected && config.className !== 'hyperlink-floating-toolbar' || isCellSelection) {
266
- return null;
265
+
266
+ // don't dismiss table toolbar when a cell selection is caused by clicking the drag handle (which has it's own userIntent)
267
+ if (fg('platform_editor_toolbar_aifc_user_intent_fix')) {
268
+ if (isTextSelected && config.className !== 'hyperlink-floating-toolbar' || isCellSelection && (userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'default') {
269
+ return null;
270
+ }
271
+ } else {
272
+ if (isTextSelected && config.className !== 'hyperlink-floating-toolbar' || isCellSelection) {
273
+ return null;
274
+ }
267
275
  }
268
276
  }
269
277
  let {
@@ -1,7 +1,8 @@
1
- import { browser } from '@atlaskit/editor-common/browser';
1
+ import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
2
2
  import { copyHTMLToClipboard, copyHTMLToClipboardPolyfill, getNodeCopiedAnalyticsPayload } from '@atlaskit/editor-common/clipboard';
3
3
  import { copyDomNode, getSelectedNodeOrNodeParentByNodeType, toDOM } from '@atlaskit/editor-common/copy-button';
4
4
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
5
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
6
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
6
7
  export const copyNode = (nodeType, editorAnalyticsApi, inputMethod) => ({
7
8
  tr
@@ -25,6 +26,7 @@ export const copyNode = (nodeType, editorAnalyticsApi, inputMethod) => ({
25
26
  } else {
26
27
  if (domNode) {
27
28
  const div = document.createElement('div');
29
+ const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
28
30
  div.appendChild(domNode);
29
31
 
30
32
  // if copying inline content
@@ -261,8 +261,16 @@ export function ContentComponent(_ref5) {
261
261
  var selection = editorView.state.selection;
262
262
  var isCellSelection = '$anchorCell' in selection && !selection.empty;
263
263
  var isTextSelected = selection instanceof TextSelection && !selection.empty;
264
- if (isTextSelected && config.className !== 'hyperlink-floating-toolbar' || isCellSelection) {
265
- return null;
264
+
265
+ // don't dismiss table toolbar when a cell selection is caused by clicking the drag handle (which has it's own userIntent)
266
+ if (fg('platform_editor_toolbar_aifc_user_intent_fix')) {
267
+ if (isTextSelected && config.className !== 'hyperlink-floating-toolbar' || isCellSelection && (userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'default') {
268
+ return null;
269
+ }
270
+ } else {
271
+ if (isTextSelected && config.className !== 'hyperlink-floating-toolbar' || isCellSelection) {
272
+ return null;
273
+ }
266
274
  }
267
275
  }
268
276
  var items = config.items;
@@ -1,7 +1,8 @@
1
- import { browser } from '@atlaskit/editor-common/browser';
1
+ import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
2
2
  import { copyHTMLToClipboard, copyHTMLToClipboardPolyfill, getNodeCopiedAnalyticsPayload } from '@atlaskit/editor-common/clipboard';
3
3
  import { copyDomNode, getSelectedNodeOrNodeParentByNodeType, toDOM } from '@atlaskit/editor-common/copy-button';
4
4
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
5
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
6
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
6
7
  export var copyNode = function copyNode(nodeType, editorAnalyticsApi, inputMethod) {
7
8
  return function (_ref) {
@@ -25,6 +26,7 @@ export var copyNode = function copyNode(nodeType, editorAnalyticsApi, inputMetho
25
26
  } else {
26
27
  if (domNode) {
27
28
  var div = document.createElement('div');
29
+ var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
28
30
  div.appendChild(domNode);
29
31
 
30
32
  // if copying inline content
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-floating-toolbar",
3
- "version": "8.2.7",
3
+ "version": "8.2.9",
4
4
  "description": "Floating toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -45,9 +45,9 @@
45
45
  "@atlaskit/primitives": "^16.0.0",
46
46
  "@atlaskit/select": "^21.3.0",
47
47
  "@atlaskit/theme": "^21.0.0",
48
- "@atlaskit/tmp-editor-statsig": "^13.13.0",
48
+ "@atlaskit/tmp-editor-statsig": "^13.16.0",
49
49
  "@atlaskit/tokens": "^7.0.0",
50
- "@atlaskit/tooltip": "^20.5.0",
50
+ "@atlaskit/tooltip": "^20.6.0",
51
51
  "@babel/runtime": "^7.0.0",
52
52
  "@emotion/react": "^11.7.1",
53
53
  "bind-event-listener": "^3.0.0",
@@ -57,7 +57,7 @@
57
57
  "react-loadable": "^5.1.0"
58
58
  },
59
59
  "peerDependencies": {
60
- "@atlaskit/editor-common": "^110.14.0",
60
+ "@atlaskit/editor-common": "^110.15.0",
61
61
  "react": "^18.2.0",
62
62
  "react-dom": "^18.2.0"
63
63
  },
@@ -127,6 +127,9 @@
127
127
  },
128
128
  "platform_editor_update_modal_close_button": {
129
129
  "type": "boolean"
130
+ },
131
+ "platform_editor_toolbar_aifc_user_intent_fix": {
132
+ "type": "boolean"
130
133
  }
131
134
  }
132
135
  }