@atlaskit/editor-plugin-floating-toolbar 5.1.10 → 5.1.12

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,19 @@
1
1
  # @atlaskit/editor-plugin-floating-toolbar
2
2
 
3
+ ## 5.1.12
4
+
5
+ ### Patch Changes
6
+
7
+ - [`31fc6b9e10762`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/31fc6b9e10762) -
8
+ [ux] ED-28592 ED-28592:Add copy block menu item to block menu
9
+ - Updated dependencies
10
+
11
+ ## 5.1.11
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 5.1.10
4
18
 
5
19
  ### Patch Changes
@@ -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 _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
11
12
  var copyNode = exports.copyNode = function copyNode(nodeType, editorAnalyticsApi, inputMethod) {
12
13
  return function (_ref) {
13
14
  var tr = _ref.tr;
@@ -25,32 +26,36 @@ var copyNode = exports.copyNode = function copyNode(nodeType, editorAnalyticsApi
25
26
  var schema = tr.doc.type.schema;
26
27
  var copyToClipboardTr = tr;
27
28
  var domNode = (0, _copyButton.toDOM)(contentNodeWithPos.node, schema);
28
- if (domNode) {
29
- var div = document.createElement('div');
30
- div.appendChild(domNode);
29
+ if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
30
+ (0, _copyButton.copyDomNode)(domNode, contentNodeWithPos.node.type, tr.selection);
31
+ } else {
32
+ if (domNode) {
33
+ var div = document.createElement('div');
34
+ div.appendChild(domNode);
31
35
 
32
- // if copying inline content
33
- if (contentNodeWithPos.node.type.inlineContent) {
34
- // The "1 1" refers to the start and end depth of the slice
35
- // since we're copying the text inside a paragraph, it will always be 1 1
36
- // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
37
- // Ignored via go/ees005
38
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
39
- div.firstChild.setAttribute('data-pm-slice', '1 1 []');
40
- } else {
41
- // The "0 0" refers to the start and end depth of the slice
42
- // since we're copying the block node only, it will always be 0 0
43
- // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
44
- // Ignored via go/ees005
45
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
46
- div.firstChild.setAttribute('data-pm-slice', '0 0 []');
47
- }
48
- // 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
49
- // 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
50
- if (_browser.browser.safari && tr.selection instanceof _state.NodeSelection && (tr.selection.node.type === schema.nodes.extension || tr.selection.node.type === schema.nodes.mediaSingle)) {
51
- (0, _clipboard.copyHTMLToClipboardPolyfill)(div);
52
- } else {
53
- (0, _clipboard.copyHTMLToClipboard)(div);
36
+ // if copying inline content
37
+ if (contentNodeWithPos.node.type.inlineContent) {
38
+ // The "1 1" refers to the start and end depth of the slice
39
+ // since we're copying the text inside a paragraph, it will always be 1 1
40
+ // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
41
+ // Ignored via go/ees005
42
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
43
+ div.firstChild.setAttribute('data-pm-slice', '1 1 []');
44
+ } else {
45
+ // The "0 0" refers to the start and end depth of the slice
46
+ // since we're copying the block node only, it will always be 0 0
47
+ // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
48
+ // Ignored via go/ees005
49
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
50
+ div.firstChild.setAttribute('data-pm-slice', '0 0 []');
51
+ }
52
+ // 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
+ // 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)) {
55
+ (0, _clipboard.copyHTMLToClipboardPolyfill)(div);
56
+ } else {
57
+ (0, _clipboard.copyHTMLToClipboard)(div);
58
+ }
54
59
  }
55
60
  }
56
61
  if (editorAnalyticsApi) {
@@ -1,7 +1,8 @@
1
1
  import { browser } from '@atlaskit/editor-common/browser';
2
2
  import { copyHTMLToClipboard, copyHTMLToClipboardPolyfill, getNodeCopiedAnalyticsPayload } from '@atlaskit/editor-common/clipboard';
3
- import { getSelectedNodeOrNodeParentByNodeType, toDOM } from '@atlaskit/editor-common/copy-button';
3
+ import { copyDomNode, getSelectedNodeOrNodeParentByNodeType, toDOM } from '@atlaskit/editor-common/copy-button';
4
4
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
5
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
5
6
  export const copyNode = (nodeType, editorAnalyticsApi, inputMethod) => ({
6
7
  tr
7
8
  }) => {
@@ -19,32 +20,36 @@ export const copyNode = (nodeType, editorAnalyticsApi, inputMethod) => ({
19
20
  const schema = tr.doc.type.schema;
20
21
  const copyToClipboardTr = tr;
21
22
  const domNode = toDOM(contentNodeWithPos.node, schema);
22
- if (domNode) {
23
- const div = document.createElement('div');
24
- div.appendChild(domNode);
23
+ if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
24
+ copyDomNode(domNode, contentNodeWithPos.node.type, tr.selection);
25
+ } else {
26
+ if (domNode) {
27
+ const div = document.createElement('div');
28
+ div.appendChild(domNode);
25
29
 
26
- // if copying inline content
27
- if (contentNodeWithPos.node.type.inlineContent) {
28
- // The "1 1" refers to the start and end depth of the slice
29
- // since we're copying the text inside a paragraph, it will always be 1 1
30
- // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
31
- // Ignored via go/ees005
32
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
33
- div.firstChild.setAttribute('data-pm-slice', '1 1 []');
34
- } else {
35
- // The "0 0" refers to the start and end depth of the slice
36
- // since we're copying the block node only, it will always be 0 0
37
- // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
38
- // Ignored via go/ees005
39
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
40
- div.firstChild.setAttribute('data-pm-slice', '0 0 []');
41
- }
42
- // 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
43
- // 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
44
- if (browser.safari && tr.selection instanceof NodeSelection && (tr.selection.node.type === schema.nodes.extension || tr.selection.node.type === schema.nodes.mediaSingle)) {
45
- copyHTMLToClipboardPolyfill(div);
46
- } else {
47
- copyHTMLToClipboard(div);
30
+ // if copying inline content
31
+ if (contentNodeWithPos.node.type.inlineContent) {
32
+ // The "1 1" refers to the start and end depth of the slice
33
+ // since we're copying the text inside a paragraph, it will always be 1 1
34
+ // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
35
+ // Ignored via go/ees005
36
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
37
+ div.firstChild.setAttribute('data-pm-slice', '1 1 []');
38
+ } else {
39
+ // The "0 0" refers to the start and end depth of the slice
40
+ // since we're copying the block node only, it will always be 0 0
41
+ // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
42
+ // Ignored via go/ees005
43
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
44
+ div.firstChild.setAttribute('data-pm-slice', '0 0 []');
45
+ }
46
+ // 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
47
+ // 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
48
+ if (browser.safari && tr.selection instanceof NodeSelection && (tr.selection.node.type === schema.nodes.extension || tr.selection.node.type === schema.nodes.mediaSingle)) {
49
+ copyHTMLToClipboardPolyfill(div);
50
+ } else {
51
+ copyHTMLToClipboard(div);
52
+ }
48
53
  }
49
54
  }
50
55
  if (editorAnalyticsApi) {
@@ -1,7 +1,8 @@
1
1
  import { browser } from '@atlaskit/editor-common/browser';
2
2
  import { copyHTMLToClipboard, copyHTMLToClipboardPolyfill, getNodeCopiedAnalyticsPayload } from '@atlaskit/editor-common/clipboard';
3
- import { getSelectedNodeOrNodeParentByNodeType, toDOM } from '@atlaskit/editor-common/copy-button';
3
+ import { copyDomNode, getSelectedNodeOrNodeParentByNodeType, toDOM } from '@atlaskit/editor-common/copy-button';
4
4
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
5
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
5
6
  export var copyNode = function copyNode(nodeType, editorAnalyticsApi, inputMethod) {
6
7
  return function (_ref) {
7
8
  var tr = _ref.tr;
@@ -19,32 +20,36 @@ export var copyNode = function copyNode(nodeType, editorAnalyticsApi, inputMetho
19
20
  var schema = tr.doc.type.schema;
20
21
  var copyToClipboardTr = tr;
21
22
  var domNode = toDOM(contentNodeWithPos.node, schema);
22
- if (domNode) {
23
- var div = document.createElement('div');
24
- div.appendChild(domNode);
23
+ if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
24
+ copyDomNode(domNode, contentNodeWithPos.node.type, tr.selection);
25
+ } else {
26
+ if (domNode) {
27
+ var div = document.createElement('div');
28
+ div.appendChild(domNode);
25
29
 
26
- // if copying inline content
27
- if (contentNodeWithPos.node.type.inlineContent) {
28
- // The "1 1" refers to the start and end depth of the slice
29
- // since we're copying the text inside a paragraph, it will always be 1 1
30
- // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
31
- // Ignored via go/ees005
32
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
33
- div.firstChild.setAttribute('data-pm-slice', '1 1 []');
34
- } else {
35
- // The "0 0" refers to the start and end depth of the slice
36
- // since we're copying the block node only, it will always be 0 0
37
- // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
38
- // Ignored via go/ees005
39
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
40
- div.firstChild.setAttribute('data-pm-slice', '0 0 []');
41
- }
42
- // 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
43
- // 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
44
- if (browser.safari && tr.selection instanceof NodeSelection && (tr.selection.node.type === schema.nodes.extension || tr.selection.node.type === schema.nodes.mediaSingle)) {
45
- copyHTMLToClipboardPolyfill(div);
46
- } else {
47
- copyHTMLToClipboard(div);
30
+ // if copying inline content
31
+ if (contentNodeWithPos.node.type.inlineContent) {
32
+ // The "1 1" refers to the start and end depth of the slice
33
+ // since we're copying the text inside a paragraph, it will always be 1 1
34
+ // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
35
+ // Ignored via go/ees005
36
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
37
+ div.firstChild.setAttribute('data-pm-slice', '1 1 []');
38
+ } else {
39
+ // The "0 0" refers to the start and end depth of the slice
40
+ // since we're copying the block node only, it will always be 0 0
41
+ // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
42
+ // Ignored via go/ees005
43
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
44
+ div.firstChild.setAttribute('data-pm-slice', '0 0 []');
45
+ }
46
+ // 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
47
+ // 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
48
+ if (browser.safari && tr.selection instanceof NodeSelection && (tr.selection.node.type === schema.nodes.extension || tr.selection.node.type === schema.nodes.mediaSingle)) {
49
+ copyHTMLToClipboardPolyfill(div);
50
+ } else {
51
+ copyHTMLToClipboard(div);
52
+ }
48
53
  }
49
54
  }
50
55
  if (editorAnalyticsApi) {
@@ -1,6 +1,6 @@
1
1
  import { type INPUT_METHOD, type EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { NodeType } from '@atlaskit/editor-prosemirror/model';
3
- import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
+ import { type Transaction } from '@atlaskit/editor-prosemirror/state';
4
4
  export declare const copyNode: (nodeType: NodeType | Array<NodeType>, editorAnalyticsApi?: EditorAnalyticsAPI | undefined, inputMethod?: INPUT_METHOD) => ({ tr }: {
5
5
  tr: Transaction;
6
6
  }) => Transaction;
@@ -1,6 +1,6 @@
1
1
  import { type INPUT_METHOD, type EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { NodeType } from '@atlaskit/editor-prosemirror/model';
3
- import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
+ import { type Transaction } from '@atlaskit/editor-prosemirror/state';
4
4
  export declare const copyNode: (nodeType: NodeType | Array<NodeType>, editorAnalyticsApi?: EditorAnalyticsAPI | undefined, inputMethod?: INPUT_METHOD) => ({ tr }: {
5
5
  tr: Transaction;
6
6
  }) => Transaction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-floating-toolbar",
3
- "version": "5.1.10",
3
+ "version": "5.1.12",
4
4
  "description": "Floating toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,21 +34,21 @@
34
34
  "@atlaskit/editor-plugin-decorations": "^3.0.0",
35
35
  "@atlaskit/editor-plugin-editor-disabled": "^3.0.0",
36
36
  "@atlaskit/editor-plugin-editor-viewmode": "^5.0.0",
37
- "@atlaskit/editor-plugin-emoji": "^4.2.0",
37
+ "@atlaskit/editor-plugin-emoji": "^4.3.0",
38
38
  "@atlaskit/editor-plugin-extension": "^6.1.0",
39
39
  "@atlaskit/editor-plugin-interaction": "^5.0.0",
40
40
  "@atlaskit/editor-plugin-table": "^12.2.0",
41
41
  "@atlaskit/editor-plugin-user-intent": "^1.1.0",
42
42
  "@atlaskit/editor-prosemirror": "7.0.0",
43
- "@atlaskit/emoji": "^69.3.0",
44
- "@atlaskit/icon": "^27.12.0",
43
+ "@atlaskit/emoji": "^69.5.0",
44
+ "@atlaskit/icon": "^28.0.0",
45
45
  "@atlaskit/menu": "^8.3.0",
46
46
  "@atlaskit/modal-dialog": "^14.3.0",
47
47
  "@atlaskit/platform-feature-flags": "^1.1.0",
48
48
  "@atlaskit/primitives": "^14.11.0",
49
49
  "@atlaskit/select": "^21.2.0",
50
50
  "@atlaskit/theme": "^19.0.0",
51
- "@atlaskit/tmp-editor-statsig": "^10.0.0",
51
+ "@atlaskit/tmp-editor-statsig": "^11.3.0",
52
52
  "@atlaskit/tokens": "^6.0.0",
53
53
  "@atlaskit/tooltip": "^20.4.0",
54
54
  "@babel/runtime": "^7.0.0",
@@ -60,7 +60,7 @@
60
60
  "react-loadable": "^5.1.0"
61
61
  },
62
62
  "peerDependencies": {
63
- "@atlaskit/editor-common": "^107.25.0",
63
+ "@atlaskit/editor-common": "^107.26.0",
64
64
  "react": "^18.2.0",
65
65
  "react-dom": "^18.2.0"
66
66
  },