@atlaskit/editor-plugin-copy-button 1.1.4 → 1.1.6
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/.eslintrc.js +12 -12
- package/CHANGELOG.md +51 -37
- package/LICENSE.md +6 -8
- package/dist/cjs/pm-plugins/main.js +58 -16
- package/dist/es2019/pm-plugins/main.js +54 -14
- package/dist/esm/pm-plugins/main.js +56 -16
- package/dist/types/pm-plugins/main.d.ts +8 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +8 -0
- package/package.json +5 -7
- package/report.api.md +21 -24
package/.eslintrc.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
rules: {
|
|
3
|
+
'@typescript-eslint/no-duplicate-imports': 'error',
|
|
4
|
+
'@typescript-eslint/no-explicit-any': 'error',
|
|
5
|
+
},
|
|
6
|
+
overrides: [
|
|
7
|
+
{
|
|
8
|
+
files: ['**/__tests__/**/*.{js,ts,tsx}', '**/examples/**/*.{js,ts,tsx}'],
|
|
9
|
+
rules: {
|
|
10
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
14
|
};
|
package/CHANGELOG.md
CHANGED
|
@@ -1,127 +1,141 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-copy-button
|
|
2
2
|
|
|
3
|
+
## 1.1.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#103294](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/103294)
|
|
8
|
+
[`4853ec31c00b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4853ec31c00b) -
|
|
9
|
+
fixed a bug with copy button
|
|
10
|
+
|
|
11
|
+
## 1.1.5
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 1.1.4
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
6
20
|
|
|
7
|
-
-
|
|
21
|
+
- Updated dependencies
|
|
8
22
|
|
|
9
23
|
## 1.1.3
|
|
10
24
|
|
|
11
25
|
### Patch Changes
|
|
12
26
|
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
-
|
|
27
|
+
- [#99954](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99954)
|
|
28
|
+
[`0d119c672ce2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0d119c672ce2) -
|
|
29
|
+
[ED-23345] Clean up showCopyButton check which enabled the copy button only if the copy button
|
|
30
|
+
plugin was enabled. This is now in the universal and default presets so will always be enabled.
|
|
31
|
+
- Updated dependencies
|
|
18
32
|
|
|
19
33
|
## 1.1.2
|
|
20
34
|
|
|
21
35
|
### Patch Changes
|
|
22
36
|
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
37
|
+
- [#97698](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/97698)
|
|
38
|
+
[`1c7b378c0d3b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1c7b378c0d3b) -
|
|
39
|
+
[HOT-108999] We had an incident where the cursor jumps back a character in table headers for any
|
|
40
|
+
language triggering composition on an empty line.This was fixed in a patch bump of
|
|
41
|
+
prosemirror-view. https://github.com/ProseMirror/prosemirror-view/compare/1.33.4...1.33.5
|
|
28
42
|
|
|
29
43
|
## 1.1.1
|
|
30
44
|
|
|
31
45
|
### Patch Changes
|
|
32
46
|
|
|
33
|
-
-
|
|
47
|
+
- Updated dependencies
|
|
34
48
|
|
|
35
49
|
## 1.1.0
|
|
36
50
|
|
|
37
51
|
### Minor Changes
|
|
38
52
|
|
|
39
|
-
-
|
|
40
|
-
|
|
41
|
-
|
|
53
|
+
- [#91934](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91934)
|
|
54
|
+
[`b76a78c6a199`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b76a78c6a199) -
|
|
55
|
+
bumped editor-prosemirror version to 4.0.0
|
|
42
56
|
|
|
43
57
|
### Patch Changes
|
|
44
58
|
|
|
45
|
-
-
|
|
59
|
+
- Updated dependencies
|
|
46
60
|
|
|
47
61
|
## 1.0.8
|
|
48
62
|
|
|
49
63
|
### Patch Changes
|
|
50
64
|
|
|
51
|
-
-
|
|
52
|
-
|
|
53
|
-
|
|
65
|
+
- [#83116](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83116)
|
|
66
|
+
[`8d4e99057fe0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8d4e99057fe0) -
|
|
67
|
+
Upgrade Typescript from `4.9.5` to `5.4.2`
|
|
54
68
|
|
|
55
69
|
## 1.0.7
|
|
56
70
|
|
|
57
71
|
### Patch Changes
|
|
58
72
|
|
|
59
|
-
-
|
|
73
|
+
- Updated dependencies
|
|
60
74
|
|
|
61
75
|
## 1.0.6
|
|
62
76
|
|
|
63
77
|
### Patch Changes
|
|
64
78
|
|
|
65
|
-
-
|
|
79
|
+
- Updated dependencies
|
|
66
80
|
|
|
67
81
|
## 1.0.5
|
|
68
82
|
|
|
69
83
|
### Patch Changes
|
|
70
84
|
|
|
71
|
-
-
|
|
72
|
-
|
|
73
|
-
|
|
85
|
+
- [#68572](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68572)
|
|
86
|
+
[`15d407fe5143`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/15d407fe5143) -
|
|
87
|
+
Upgrading @atlaskit/editor-prosemirror dependency
|
|
74
88
|
|
|
75
89
|
## 1.0.4
|
|
76
90
|
|
|
77
91
|
### Patch Changes
|
|
78
92
|
|
|
79
|
-
-
|
|
93
|
+
- Updated dependencies
|
|
80
94
|
|
|
81
95
|
## 1.0.3
|
|
82
96
|
|
|
83
97
|
### Patch Changes
|
|
84
98
|
|
|
85
|
-
-
|
|
99
|
+
- Updated dependencies
|
|
86
100
|
|
|
87
101
|
## 1.0.2
|
|
88
102
|
|
|
89
103
|
### Patch Changes
|
|
90
104
|
|
|
91
|
-
-
|
|
105
|
+
- Updated dependencies
|
|
92
106
|
|
|
93
107
|
## 1.0.1
|
|
94
108
|
|
|
95
109
|
### Patch Changes
|
|
96
110
|
|
|
97
|
-
-
|
|
111
|
+
- Updated dependencies
|
|
98
112
|
|
|
99
113
|
## 1.0.0
|
|
100
114
|
|
|
101
115
|
### Major Changes
|
|
102
116
|
|
|
103
|
-
-
|
|
104
|
-
|
|
105
|
-
|
|
117
|
+
- [#41021](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41021)
|
|
118
|
+
[`79abfef6196`](https://bitbucket.org/atlassian/atlassian-frontend/commits/79abfef6196) - ED-20299
|
|
119
|
+
remove unnecessary entry points in editor-plugin-copy-button and refactor
|
|
106
120
|
|
|
107
121
|
### Patch Changes
|
|
108
122
|
|
|
109
|
-
-
|
|
123
|
+
- Updated dependencies
|
|
110
124
|
|
|
111
125
|
## 0.2.1
|
|
112
126
|
|
|
113
127
|
### Patch Changes
|
|
114
128
|
|
|
115
|
-
-
|
|
129
|
+
- Updated dependencies
|
|
116
130
|
|
|
117
131
|
## 0.2.0
|
|
118
132
|
|
|
119
133
|
### Minor Changes
|
|
120
134
|
|
|
121
|
-
-
|
|
122
|
-
|
|
123
|
-
|
|
135
|
+
- [#40092](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40092)
|
|
136
|
+
[`9f2365fabcc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9f2365fabcc) -
|
|
137
|
+
ED-19617 - Initial creation of editor-plugin-copy-button package
|
|
124
138
|
|
|
125
139
|
### Patch Changes
|
|
126
140
|
|
|
127
|
-
-
|
|
141
|
+
- Updated dependencies
|
package/LICENSE.md
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
Copyright 2023 Atlassian Pty Ltd
|
|
2
2
|
|
|
3
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
|
|
5
|
-
You may obtain a copy of the License at
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
|
|
4
|
+
compliance with the License. You may obtain a copy of the License at
|
|
6
5
|
|
|
7
6
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
7
|
|
|
9
|
-
Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
distributed
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
limitations under the License.
|
|
8
|
+
Unless required by applicable law or agreed to in writing, software distributed under the License is
|
|
9
|
+
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
10
|
+
implied. See the License for the specific language governing permissions and limitations under the
|
|
11
|
+
License.
|
|
@@ -1,32 +1,74 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.copyButtonPlugin = copyButtonPlugin;
|
|
7
8
|
exports.default = void 0;
|
|
9
|
+
exports.getMarkSelectionHelper = getMarkSelectionHelper;
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
8
11
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
9
12
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
10
13
|
var _pluginKey = require("./plugin-key");
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
|
+
function getMarkSelectionHelper(_ref) {
|
|
17
|
+
var $pos = _ref.$pos,
|
|
18
|
+
markType = _ref.markType;
|
|
19
|
+
var hasMark = $pos.doc.rangeHasMark($pos.pos, Math.min($pos.pos + 1, $pos.doc.nodeSize), markType);
|
|
20
|
+
if (!hasMark) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
if ($pos.parent.childCount === 1) {
|
|
24
|
+
var nodePosition = $pos.pos;
|
|
25
|
+
var maybeNode = $pos.doc.nodeAt(nodePosition);
|
|
26
|
+
if (!maybeNode || !maybeNode.isText) {
|
|
27
|
+
return false;
|
|
21
28
|
}
|
|
29
|
+
var start = $pos.pos - $pos.parentOffset;
|
|
30
|
+
var end = start + maybeNode.nodeSize;
|
|
31
|
+
return {
|
|
32
|
+
start: start,
|
|
33
|
+
end: end
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if ($pos.parent.childCount > 1) {
|
|
37
|
+
var _start = $pos.pos - $pos.textOffset;
|
|
38
|
+
var maybeTextNode = $pos.doc.nodeAt(_start);
|
|
39
|
+
if (!maybeTextNode || !maybeTextNode.isText) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
var _end = _start + maybeTextNode.nodeSize;
|
|
43
|
+
return {
|
|
44
|
+
start: _start,
|
|
45
|
+
end: _end
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
function getMarkSelectionDecorationStartAndEnd(_ref2) {
|
|
51
|
+
var markType = _ref2.markType,
|
|
52
|
+
transaction = _ref2.transaction;
|
|
53
|
+
var anchorPositions = getMarkSelectionHelper({
|
|
54
|
+
$pos: transaction.selection.$anchor,
|
|
55
|
+
markType: markType
|
|
22
56
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
57
|
+
if (anchorPositions) {
|
|
58
|
+
return _objectSpread(_objectSpread({}, anchorPositions), {}, {
|
|
59
|
+
markType: markType
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
var headPositions = getMarkSelectionHelper({
|
|
63
|
+
$pos: transaction.selection.$head,
|
|
28
64
|
markType: markType
|
|
29
|
-
};
|
|
65
|
+
});
|
|
66
|
+
if (headPositions) {
|
|
67
|
+
return _objectSpread(_objectSpread({}, headPositions), {}, {
|
|
68
|
+
markType: markType
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return undefined;
|
|
30
72
|
}
|
|
31
73
|
function copyButtonPlugin() {
|
|
32
74
|
return new _safePlugin.SafePlugin({
|
|
@@ -1,26 +1,66 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import { copyButtonPluginKey } from './plugin-key';
|
|
4
|
+
export function getMarkSelectionHelper({
|
|
5
|
+
$pos,
|
|
6
|
+
markType
|
|
7
|
+
}) {
|
|
8
|
+
const hasMark = $pos.doc.rangeHasMark($pos.pos, Math.min($pos.pos + 1, $pos.doc.nodeSize), markType);
|
|
9
|
+
if (!hasMark) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
if ($pos.parent.childCount === 1) {
|
|
13
|
+
const nodePosition = $pos.pos;
|
|
14
|
+
const maybeNode = $pos.doc.nodeAt(nodePosition);
|
|
15
|
+
if (!maybeNode || !maybeNode.isText) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
const start = $pos.pos - $pos.parentOffset;
|
|
19
|
+
const end = start + maybeNode.nodeSize;
|
|
20
|
+
return {
|
|
21
|
+
start,
|
|
22
|
+
end
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
if ($pos.parent.childCount > 1) {
|
|
26
|
+
const start = $pos.pos - $pos.textOffset;
|
|
27
|
+
const maybeTextNode = $pos.doc.nodeAt(start);
|
|
28
|
+
if (!maybeTextNode || !maybeTextNode.isText) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
const end = start + maybeTextNode.nodeSize;
|
|
32
|
+
return {
|
|
33
|
+
start,
|
|
34
|
+
end
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
4
39
|
function getMarkSelectionDecorationStartAndEnd({
|
|
5
40
|
markType,
|
|
6
41
|
transaction
|
|
7
42
|
}) {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
let textNodeOffset = 0;
|
|
12
|
-
headResolvedPos.parent.forEach((_node, nodeOffset, index) => {
|
|
13
|
-
if (index === textNodeIndex) {
|
|
14
|
-
textNodeOffset = nodeOffset;
|
|
15
|
-
}
|
|
43
|
+
const anchorPositions = getMarkSelectionHelper({
|
|
44
|
+
$pos: transaction.selection.$anchor,
|
|
45
|
+
markType
|
|
16
46
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
47
|
+
if (anchorPositions) {
|
|
48
|
+
return {
|
|
49
|
+
...anchorPositions,
|
|
50
|
+
markType
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const headPositions = getMarkSelectionHelper({
|
|
54
|
+
$pos: transaction.selection.$head,
|
|
22
55
|
markType
|
|
23
|
-
};
|
|
56
|
+
});
|
|
57
|
+
if (headPositions) {
|
|
58
|
+
return {
|
|
59
|
+
...headPositions,
|
|
60
|
+
markType
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return undefined;
|
|
24
64
|
}
|
|
25
65
|
export function copyButtonPlugin() {
|
|
26
66
|
return new SafePlugin({
|
|
@@ -1,25 +1,65 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
5
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
6
|
import { copyButtonPluginKey } from './plugin-key';
|
|
4
|
-
function
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
export function getMarkSelectionHelper(_ref) {
|
|
8
|
+
var $pos = _ref.$pos,
|
|
9
|
+
markType = _ref.markType;
|
|
10
|
+
var hasMark = $pos.doc.rangeHasMark($pos.pos, Math.min($pos.pos + 1, $pos.doc.nodeSize), markType);
|
|
11
|
+
if (!hasMark) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
if ($pos.parent.childCount === 1) {
|
|
15
|
+
var nodePosition = $pos.pos;
|
|
16
|
+
var maybeNode = $pos.doc.nodeAt(nodePosition);
|
|
17
|
+
if (!maybeNode || !maybeNode.isText) {
|
|
18
|
+
return false;
|
|
14
19
|
}
|
|
20
|
+
var start = $pos.pos - $pos.parentOffset;
|
|
21
|
+
var end = start + maybeNode.nodeSize;
|
|
22
|
+
return {
|
|
23
|
+
start: start,
|
|
24
|
+
end: end
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
if ($pos.parent.childCount > 1) {
|
|
28
|
+
var _start = $pos.pos - $pos.textOffset;
|
|
29
|
+
var maybeTextNode = $pos.doc.nodeAt(_start);
|
|
30
|
+
if (!maybeTextNode || !maybeTextNode.isText) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
var _end = _start + maybeTextNode.nodeSize;
|
|
34
|
+
return {
|
|
35
|
+
start: _start,
|
|
36
|
+
end: _end
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
function getMarkSelectionDecorationStartAndEnd(_ref2) {
|
|
42
|
+
var markType = _ref2.markType,
|
|
43
|
+
transaction = _ref2.transaction;
|
|
44
|
+
var anchorPositions = getMarkSelectionHelper({
|
|
45
|
+
$pos: transaction.selection.$anchor,
|
|
46
|
+
markType: markType
|
|
15
47
|
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
48
|
+
if (anchorPositions) {
|
|
49
|
+
return _objectSpread(_objectSpread({}, anchorPositions), {}, {
|
|
50
|
+
markType: markType
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
var headPositions = getMarkSelectionHelper({
|
|
54
|
+
$pos: transaction.selection.$head,
|
|
21
55
|
markType: markType
|
|
22
|
-
};
|
|
56
|
+
});
|
|
57
|
+
if (headPositions) {
|
|
58
|
+
return _objectSpread(_objectSpread({}, headPositions), {}, {
|
|
59
|
+
markType: markType
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return undefined;
|
|
23
63
|
}
|
|
24
64
|
export function copyButtonPlugin() {
|
|
25
65
|
return new SafePlugin({
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import type { MarkType, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
2
3
|
import type { CopyButtonPluginState } from '../types';
|
|
4
|
+
export declare function getMarkSelectionHelper({ $pos, markType, }: {
|
|
5
|
+
$pos: ResolvedPos;
|
|
6
|
+
markType: MarkType;
|
|
7
|
+
}): false | {
|
|
8
|
+
start: number;
|
|
9
|
+
end: number;
|
|
10
|
+
};
|
|
3
11
|
export declare function copyButtonPlugin(): SafePlugin<CopyButtonPluginState>;
|
|
4
12
|
export default copyButtonPlugin;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import type { MarkType, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
2
3
|
import type { CopyButtonPluginState } from '../types';
|
|
4
|
+
export declare function getMarkSelectionHelper({ $pos, markType, }: {
|
|
5
|
+
$pos: ResolvedPos;
|
|
6
|
+
markType: MarkType;
|
|
7
|
+
}): false | {
|
|
8
|
+
start: number;
|
|
9
|
+
end: number;
|
|
10
|
+
};
|
|
3
11
|
export declare function copyButtonPlugin(): SafePlugin<CopyButtonPluginState>;
|
|
4
12
|
export default copyButtonPlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-copy-button",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "editor-plugin-copy-button for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
".": "./src/index.ts"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@atlaskit/editor-common": "^
|
|
36
|
-
"@atlaskit/editor-plugin-analytics": "^1.
|
|
35
|
+
"@atlaskit/editor-common": "^81.1.0",
|
|
36
|
+
"@atlaskit/editor-plugin-analytics": "^1.2.0",
|
|
37
37
|
"@atlaskit/editor-plugin-decorations": "^1.1.0",
|
|
38
38
|
"@atlaskit/editor-prosemirror": "4.0.1",
|
|
39
|
-
"@atlaskit/icon": "^22.
|
|
39
|
+
"@atlaskit/icon": "^22.3.0",
|
|
40
40
|
"@babel/runtime": "^7.0.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@atlaskit/analytics-next": "^9.3.0",
|
|
47
|
-
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
48
47
|
"@testing-library/react": "^12.1.5",
|
|
49
48
|
"react-dom": "^16.8.0",
|
|
50
49
|
"typescript": "~5.4.2"
|
|
@@ -81,6 +80,5 @@
|
|
|
81
80
|
"import-no-extraneous-disable-for-examples-and-docs"
|
|
82
81
|
]
|
|
83
82
|
}
|
|
84
|
-
}
|
|
85
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
83
|
+
}
|
|
86
84
|
}
|
package/report.api.md
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
## API Report File for "@atlaskit/editor-plugin-copy-button"
|
|
4
4
|
|
|
5
|
-
> Do not edit this file. This report is auto-generated using
|
|
5
|
+
> Do not edit this file. This report is auto-generated using
|
|
6
|
+
> [API Extractor](https://api-extractor.com/).
|
|
6
7
|
> [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
7
8
|
|
|
8
9
|
### Table of contents
|
|
@@ -26,13 +27,13 @@ import type { OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
|
26
27
|
|
|
27
28
|
// @public (undocumented)
|
|
28
29
|
export type CopyButtonPlugin = NextEditorPlugin<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
'copyButton',
|
|
31
|
+
{
|
|
32
|
+
dependencies: [OptionalPlugin<AnalyticsPlugin>];
|
|
33
|
+
actions: {
|
|
34
|
+
processCopyButtonItems: typeof processCopyButtonItemsWithAnalytics;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
36
37
|
>;
|
|
37
38
|
|
|
38
39
|
// @public (undocumented)
|
|
@@ -40,26 +41,22 @@ export const copyButtonPlugin: CopyButtonPlugin;
|
|
|
40
41
|
|
|
41
42
|
// @public (undocumented)
|
|
42
43
|
export type CopyButtonPluginState = {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
copied: boolean;
|
|
45
|
+
markSelection?: {
|
|
46
|
+
start: number;
|
|
47
|
+
end: number;
|
|
48
|
+
markType: MarkType;
|
|
49
|
+
};
|
|
49
50
|
};
|
|
50
51
|
|
|
51
52
|
// @public (undocumented)
|
|
52
53
|
const processCopyButtonItemsWithAnalytics: (
|
|
53
|
-
|
|
54
|
+
state: EditorState,
|
|
54
55
|
) => (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
add: boolean,
|
|
60
|
-
className?: string | undefined,
|
|
61
|
-
) => Command)
|
|
62
|
-
| undefined,
|
|
56
|
+
items: FloatingToolbarItem<Command>[],
|
|
57
|
+
hoverDecoration:
|
|
58
|
+
| ((nodeType: NodeType | NodeType[], add: boolean, className?: string | undefined) => Command)
|
|
59
|
+
| undefined,
|
|
63
60
|
) => FloatingToolbarItem<Command>[];
|
|
64
61
|
|
|
65
62
|
// (No @packageDocumentation comment for this package)
|
|
@@ -73,7 +70,7 @@ const processCopyButtonItemsWithAnalytics: (
|
|
|
73
70
|
|
|
74
71
|
```json
|
|
75
72
|
{
|
|
76
|
-
|
|
73
|
+
"react": "^16.8.0"
|
|
77
74
|
}
|
|
78
75
|
```
|
|
79
76
|
|