@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 +14 -0
- package/dist/cjs/pm-plugins/commands.js +30 -25
- package/dist/es2019/pm-plugins/commands.js +31 -26
- package/dist/esm/pm-plugins/commands.js +31 -26
- package/dist/types/pm-plugins/commands.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/commands.d.ts +1 -1
- package/package.json +6 -6
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 (
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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 (
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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 (
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
|
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
|
|
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.
|
|
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.
|
|
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.
|
|
44
|
-
"@atlaskit/icon": "^
|
|
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": "^
|
|
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.
|
|
63
|
+
"@atlaskit/editor-common": "^107.26.0",
|
|
64
64
|
"react": "^18.2.0",
|
|
65
65
|
"react-dom": "^18.2.0"
|
|
66
66
|
},
|