@atlaskit/editor-common 119.11.0 → 119.13.0
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 +134 -0
- package/dist/cjs/clipboard/index.js +33 -1
- package/dist/cjs/copy-button/index.js +44 -31
- package/dist/cjs/extensibility/Extension/InlineExtension/index.js +21 -1
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/preset/plugin-injection-api.js +0 -6
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/clipboard/index.js +32 -0
- package/dist/es2019/copy-button/index.js +46 -32
- package/dist/es2019/extensibility/Extension/InlineExtension/index.js +21 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/preset/plugin-injection-api.js +0 -6
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/clipboard/index.js +32 -0
- package/dist/esm/copy-button/index.js +46 -32
- package/dist/esm/extensibility/Extension/InlineExtension/index.js +21 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/preset/plugin-injection-api.js +0 -6
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/analytics/types/contextual-typeahead-events.d.ts +11 -3
- package/dist/types/clipboard/index.d.ts +1 -0
- package/dist/types/collab/index.d.ts +1 -0
- package/dist/types/copy-button/index.d.ts +3 -1
- package/dist/types/preset/plugin-injection-api.d.ts +0 -1
- package/package.json +16 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,139 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 119.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`027dc05ee4e0d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/027dc05ee4e0d) -
|
|
8
|
+
Suggest inline-code identifiers the session has seen, for hosts that opt in with the new
|
|
9
|
+
`harvestInlineCode` plugin option — which Rovo Chat now does.
|
|
10
|
+
|
|
11
|
+
A term like `ml-studio` cannot be suggested today whatever the session does with it:
|
|
12
|
+
`incrementSessionFreq` only touches trie nodes that already exist, so a word the shipped
|
|
13
|
+
vocabulary does not hold is silently discarded. The new harvester collects backticked spans from
|
|
14
|
+
ingested reply and page text and code-marked spans from the live document, drops anything with
|
|
15
|
+
internal whitespace, over 50 characters, not starting with a letter, or already served by L2/L3,
|
|
16
|
+
and holds the result to 200 surfaces with the least-mentioned evicted first.
|
|
17
|
+
|
|
18
|
+
A harvested surface has no frequency, no vector and no canonical token ids, so what stands in for
|
|
19
|
+
a score is where it is allowed to speak. It is offered only where the scored path has finished and
|
|
20
|
+
recorded that no vocabulary reaches the prefix at all — not when the 100ms budget expires, since
|
|
21
|
+
that means the ranker was still working. It asks for four typed characters rather than three,
|
|
22
|
+
respects the post-accept cooldown and the no-repeat check, and on accept rewrites the typed prefix
|
|
23
|
+
in the surface's own casing and marks it as code, because casing is load-bearing in code and being
|
|
24
|
+
marked as code is what authorized the suggestion. The stored mark is dropped straight after, since
|
|
25
|
+
the backtick input rule never ran and nothing else would close the span. It reports itself as a
|
|
26
|
+
new `harvest` value on `CompletionSource`, so its views and acceptances cannot move the headline
|
|
27
|
+
rate unattributed.
|
|
28
|
+
|
|
29
|
+
The harvester is a separate chunk, requested on first focus and only for a host that opted in, so
|
|
30
|
+
a host that has not stays exactly as it was and never downloads it. What it holds is readable at
|
|
31
|
+
any time with `__atlCtcDebug__.harvest()`, or `__atlCtcDebug__.harvest('ml-s')` to ask what a
|
|
32
|
+
prefix would be offered.
|
|
33
|
+
|
|
34
|
+
Both the harvested set and the L1 session boosts are now dropped when the session they describe
|
|
35
|
+
ends. A host whose editor does not last as long as what it is writing about can say so with the
|
|
36
|
+
new `contextScopeKey` on the context it returns: when the key changes, both stores are emptied and
|
|
37
|
+
the context reported with the new key is ingested as if it were the first, so anything still
|
|
38
|
+
current is primed again. The key is tracked beside the data it guards rather than per editor,
|
|
39
|
+
because a host may answer a navigation by replacing the editor instead of keeping it — read from a
|
|
40
|
+
new editor alone, every scope looks like the first one, while the previous scope's terms carry on
|
|
41
|
+
in the state they share. Teardown clears both stores as well, once the last editor has gone:
|
|
42
|
+
Confluence mounts several, and closing one reply must not wipe what the others primed.
|
|
43
|
+
`resetSessionBoosts` is exported for the same purpose, and `__atlCtcDebug__.session()` now lists
|
|
44
|
+
100 boosted words rather than 50.
|
|
45
|
+
|
|
46
|
+
Because those stores are shared, an editor that reported no scope is put back in the same tick an
|
|
47
|
+
eviction empties them, from the context it is already holding rather than a second read. A comment
|
|
48
|
+
box under a chat panel that switched conversation never asked to lose its page, and without this
|
|
49
|
+
it could not get it back either: the record of what an editor has ingested is per editor, so its
|
|
50
|
+
own page would read as already seen from then on. An editor that did report a scope is left alone,
|
|
51
|
+
since the scope being dropped may be its own — a page transition mounts the editor arriving before
|
|
52
|
+
tearing down the one leaving.
|
|
53
|
+
|
|
54
|
+
A context read requested while another is still open is now deferred until that one settles, where
|
|
55
|
+
before it was dropped. A scope change reaches the plugin as a context read, and a host that pushes
|
|
56
|
+
its context has no other channel to raise one on, so a read refused mid-navigation was an eviction
|
|
57
|
+
that never happened.
|
|
58
|
+
|
|
59
|
+
On the Rovo Chat side, chat messages now reach autocomplete through `extractCodeAwareTextFromAdf`,
|
|
60
|
+
the same extractor the page already uses. Assistant replies keep their backticks by arriving as
|
|
61
|
+
markdown, but a user's own inline code arrives as ADF and was being flattened by
|
|
62
|
+
`extractPlainTextFromAdf`, which drops the `code` mark — the only thing distinguishing an
|
|
63
|
+
identifier from a word. The L1 boost is unaffected, since its tokenizer strips backticks as
|
|
64
|
+
boundary punctuation. Each context read is stamped with the conversation and the page the body in
|
|
65
|
+
it came from, and the stamp is reported even when there is nothing else to report: arriving at an
|
|
66
|
+
empty new chat is exactly when the previous one's terms most need dropping.
|
|
67
|
+
|
|
68
|
+
The page in that stamp is taken from the body rather than from where the host says the reader is,
|
|
69
|
+
and a host that publishes the page it is on has its empty answer read as "no page" rather than as
|
|
70
|
+
no answer. Confluence in-app navigation is why: it clears the page it was holding immediately, but
|
|
71
|
+
the content id the chat reads can lag it by a long way and sometimes never arrives, and a body
|
|
72
|
+
accepted only when the two agree is a page that is never read at all. Attributing a body to the
|
|
73
|
+
page it came from cannot offer one page's text under another's, which is what agreement was being
|
|
74
|
+
required for.
|
|
75
|
+
|
|
76
|
+
A body published by an editor is no longer attributed to a page it was already attributed
|
|
77
|
+
elsewhere for. The published document carries no page id, so the page has to come from where the
|
|
78
|
+
reader is, and that is the same answer whether the editor has just published or the store is still
|
|
79
|
+
holding the document from the page before. Two live docs in a row is where it showed: arriving at
|
|
80
|
+
the second turns editor publishing back on and asks again, while the first one's body is the only
|
|
81
|
+
one there is.
|
|
82
|
+
|
|
83
|
+
Dropping the boosts when the last editor goes is limited to hosts that scope their context, which
|
|
84
|
+
are the ones asking for their learning to end with the conversation. A host that sends no scope
|
|
85
|
+
has boosts belonging to the page it is on, and a comment box closes far more often than that page
|
|
86
|
+
changes.
|
|
87
|
+
|
|
88
|
+
A host that cannot answer a page read now reports it, once per chat input, as an operational
|
|
89
|
+
event. The read still succeeds without a page, which is the right thing for a keystroke to do and
|
|
90
|
+
also the reason the failure is otherwise invisible: the editor's own monitoring only sees reads
|
|
91
|
+
that reject, and the symptom of this one — no page context on viewed pages — looks the same as a
|
|
92
|
+
page with nothing worth learning in it.
|
|
93
|
+
|
|
94
|
+
Dropping the session boosts now reads an index of the nodes that were boosted rather than walking
|
|
95
|
+
the whole word trie for them, since it runs on every page change rather than only at teardown:
|
|
96
|
+
about 10ms of main thread on a large tenant vocabulary, twice per navigation, for a few hundred
|
|
97
|
+
words.
|
|
98
|
+
|
|
99
|
+
Both the option and the extraction carry the same
|
|
100
|
+
`platform_editor_ai_autocomplete_rovo_chat_editor` decision the rest of the chat's autocomplete
|
|
101
|
+
wiring does. With the experiment off no context is collected and the harvester chunk is never
|
|
102
|
+
requested.
|
|
103
|
+
|
|
104
|
+
- [`9a3a071d7fcce`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9a3a071d7fcce) -
|
|
105
|
+
Fix Safari synced block copying when `platform_editor_blocks_patch_9` is enabled.
|
|
106
|
+
`copyDomNodeWithResult` exposes synchronous Patch 9 failures while `copyDomNode` retains its
|
|
107
|
+
existing void API.
|
|
108
|
+
|
|
109
|
+
### Patch Changes
|
|
110
|
+
|
|
111
|
+
- [`954ba0525450d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/954ba0525450d) -
|
|
112
|
+
Clean up the Markdown-mode-only `platform_editor_reconfigure_reconcile_plugin_api` feature gate.
|
|
113
|
+
- Updated dependencies
|
|
114
|
+
|
|
115
|
+
## 119.12.0
|
|
116
|
+
|
|
117
|
+
### Minor Changes
|
|
118
|
+
|
|
119
|
+
- [`80b19d6c0649f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/80b19d6c0649f) -
|
|
120
|
+
Preserve agent type metadata in collaboration presence participants behind
|
|
121
|
+
`platform_move_presence_agents`.
|
|
122
|
+
- [`a20b9032800d1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a20b9032800d1) -
|
|
123
|
+
[ux] Improve inline skill mentions under `rovo_skill_tag_label_wrapping`.
|
|
124
|
+
|
|
125
|
+
With the gate enabled:
|
|
126
|
+
- Long labels wrap as part of the surrounding text flow.
|
|
127
|
+
- The slash and icon stay with the first line of the label.
|
|
128
|
+
- Prompt text can continue after the skill tag's final line.
|
|
129
|
+
- A missing `slashCommand` falls back to the skill name.
|
|
130
|
+
|
|
131
|
+
With the gate disabled, existing editor wrapper styling and empty-slug behavior are preserved.
|
|
132
|
+
|
|
133
|
+
### Patch Changes
|
|
134
|
+
|
|
135
|
+
- Updated dependencies
|
|
136
|
+
|
|
3
137
|
## 119.11.0
|
|
4
138
|
|
|
5
139
|
### Minor Changes
|
|
@@ -5,13 +5,15 @@ var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.getNodeCopiedAnalyticsPayload = exports.getAnalyticsPayload = exports.copyToClipboard = exports.copyHTMLToClipboardPolyfill = exports.copyHTMLToClipboard = void 0;
|
|
8
|
+
exports.getNodeCopiedAnalyticsPayload = exports.getAnalyticsPayload = exports.copyToClipboard = exports.copyHTMLToClipboardSynchronously = exports.copyHTMLToClipboardPolyfill = exports.copyHTMLToClipboard = void 0;
|
|
9
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
12
12
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
13
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
14
|
+
var _bindEventListener = require("bind-event-listener");
|
|
14
15
|
var clipboard = _interopRequireWildcard(require("clipboard-polyfill"));
|
|
16
|
+
var _browserApis = require("@atlaskit/browser-apis");
|
|
15
17
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
16
18
|
var _analytics = require("../analytics");
|
|
17
19
|
var _selection = require("../selection");
|
|
@@ -173,6 +175,36 @@ var copyHTMLToClipboardPolyfill = exports.copyHTMLToClipboardPolyfill = /*#__PUR
|
|
|
173
175
|
};
|
|
174
176
|
}();
|
|
175
177
|
|
|
178
|
+
// Safari can revoke transient user activation before asynchronous clipboard writes complete.
|
|
179
|
+
// Keep this helper synchronous so callers can invoke it directly from a click handler.
|
|
180
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
181
|
+
var copyHTMLToClipboardSynchronously = exports.copyHTMLToClipboardSynchronously = function copyHTMLToClipboardSynchronously(elementToCopy, plainTextToCopy) {
|
|
182
|
+
var document = (0, _browserApis.getDocument)();
|
|
183
|
+
if (!document) {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
var didWriteClipboardData = false;
|
|
187
|
+
var unbind = (0, _bindEventListener.bind)(document, {
|
|
188
|
+
type: 'copy',
|
|
189
|
+
listener: function listener(event) {
|
|
190
|
+
if (!event.clipboardData) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
event.preventDefault();
|
|
194
|
+
event.clipboardData.setData('text/html', elementToCopy.innerHTML);
|
|
195
|
+
event.clipboardData.setData('text/plain', plainTextToCopy || elementToCopy.innerText);
|
|
196
|
+
didWriteClipboardData = true;
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
try {
|
|
200
|
+
return document.execCommand('copy') && didWriteClipboardData;
|
|
201
|
+
} catch (_unused) {
|
|
202
|
+
return false;
|
|
203
|
+
} finally {
|
|
204
|
+
unbind();
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
|
|
176
208
|
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
177
209
|
var getAnalyticsPayload = exports.getAnalyticsPayload = function getAnalyticsPayload(state, action) {
|
|
178
210
|
var selection = state.selection,
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.copyDomNode = void 0;
|
|
6
|
+
exports.copyDomNodeWithResult = exports.copyDomNode = void 0;
|
|
7
7
|
exports.getSelectedNodeOrNodeParentByNodeType = getSelectedNodeOrNodeParentByNodeType;
|
|
8
8
|
exports.toDOM = void 0;
|
|
9
9
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
10
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
11
11
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
12
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
12
13
|
var _clipboard = require("../clipboard");
|
|
13
14
|
var _browser = require("../utils/browser");
|
|
14
15
|
function getSelectedNodeOrNodeParentByNodeType(_ref) {
|
|
@@ -25,37 +26,49 @@ function getSelectedNodeOrNodeParentByNodeType(_ref) {
|
|
|
25
26
|
var toDOM = exports.toDOM = function toDOM(node, schema) {
|
|
26
27
|
return _model.DOMSerializer.fromSchema(schema).serializeNode(node);
|
|
27
28
|
};
|
|
28
|
-
|
|
29
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
30
29
|
var copyDomNode = exports.copyDomNode = function copyDomNode(domNode, nodeType, selection) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
copyDomNodeWithResult(domNode, nodeType, selection);
|
|
31
|
+
};
|
|
32
|
+
var copyDomNodeWithResult = exports.copyDomNodeWithResult = function copyDomNodeWithResult(domNode, nodeType, selection) {
|
|
33
|
+
if (!domNode) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
var div = document.createElement('div');
|
|
37
|
+
div.appendChild(domNode);
|
|
38
|
+
var schema = selection.$from.doc.type.schema;
|
|
39
|
+
var browser = (0, _browser.getBrowserInfo)();
|
|
36
40
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
(0, _clipboard.
|
|
41
|
+
// if copying inline content
|
|
42
|
+
if (nodeType.inlineContent) {
|
|
43
|
+
// The "1 1" refers to the start and end depth of the slice
|
|
44
|
+
// since we're copying the text inside a paragraph, it will always be 1 1
|
|
45
|
+
// https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
|
|
46
|
+
// Ignored via go/ees005
|
|
47
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
48
|
+
div.firstChild.setAttribute('data-pm-slice', '1 1 []');
|
|
49
|
+
} else {
|
|
50
|
+
// The "0 0" refers to the start and end depth of the slice
|
|
51
|
+
// since we're copying the block node only, it will always be 0 0
|
|
52
|
+
// https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
|
|
53
|
+
// Ignored via go/ees005
|
|
54
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
55
|
+
div.firstChild.setAttribute('data-pm-slice', '0 0 []');
|
|
56
|
+
}
|
|
57
|
+
var isSyncedBlock = nodeType.name === 'syncBlock' || nodeType.name === 'bodiedSyncBlock';
|
|
58
|
+
if (browser.safari && isSyncedBlock) {
|
|
59
|
+
// clipboard-polyfill/native-first clipboard.write only reaches DOM fallback after rejection; Safari can
|
|
60
|
+
// resolve native writes without retaining synced-block HTML, so Patch 9 forces copy-event/execCommand while click activation is live.
|
|
61
|
+
if ((0, _fg.fg)('platform_editor_blocks_patch_9')) {
|
|
62
|
+
return (0, _clipboard.copyHTMLToClipboardSynchronously)(div);
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
|
-
|
|
65
|
+
|
|
66
|
+
// Safari's ClipboardItem API may not preserve HTML for extension nodes or mediaSingle nodes.
|
|
67
|
+
if (browser.safari && selection instanceof _state.NodeSelection && (selection.node.type === schema.nodes.extension || selection.node.type === schema.nodes.mediaSingle)) {
|
|
68
|
+
(0, _clipboard.copyHTMLToClipboardPolyfill)(div);
|
|
69
|
+
} else {
|
|
70
|
+
(0, _clipboard.copyHTMLToClipboard)(div);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
@@ -10,6 +10,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _react2 = require("@emotion/react");
|
|
11
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
12
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
13
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
13
14
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
14
15
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
15
16
|
var _hooks = require("../../../hooks");
|
|
@@ -36,6 +37,24 @@ var inlineWrapperStyles = (0, _react2.css)({
|
|
|
36
37
|
maxWidth: '100%'
|
|
37
38
|
}
|
|
38
39
|
});
|
|
40
|
+
var flowingInlineWrapperStyles = (0, _react2.css)({
|
|
41
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- The child marker lets an inline extension opt into text-flow layout without coupling editor-common to the skill feature gate.
|
|
42
|
+
'&:has([data-inline-extension-layout="flow"])': {
|
|
43
|
+
background: 'transparent',
|
|
44
|
+
boxShadow: 'none',
|
|
45
|
+
display: 'inline',
|
|
46
|
+
margin: 0,
|
|
47
|
+
verticalAlign: 'baseline'
|
|
48
|
+
},
|
|
49
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- The legacy wrapper decorations must be removed only when its child opts into text-flow layout.
|
|
50
|
+
'&:has([data-inline-extension-layout="flow"])::after, &:has([data-inline-extension-layout="flow"])::before': {
|
|
51
|
+
display: 'none'
|
|
52
|
+
},
|
|
53
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- The legacy overlay must be hidden only when its child opts into text-flow layout.
|
|
54
|
+
'&:has([data-inline-extension-layout="flow"]) > .extension-overlay': {
|
|
55
|
+
display: 'none'
|
|
56
|
+
}
|
|
57
|
+
});
|
|
39
58
|
var hoverStyles = (0, _react2.css)({
|
|
40
59
|
'&:hover': {
|
|
41
60
|
boxShadow: "0 0 0 1px ".concat("var(--ds-border-input, #8C8F97)")
|
|
@@ -68,6 +87,7 @@ var InlineExtension = function InlineExtension(props) {
|
|
|
68
87
|
isLivePageViewMode = props.isLivePageViewMode;
|
|
69
88
|
var _ref3 = macroInteractionDesignFeatureFlags || {},
|
|
70
89
|
showMacroInteractionDesignUpdates = _ref3.showMacroInteractionDesignUpdates;
|
|
90
|
+
var shouldUseFlowingInlineWrapper = (0, _fg.fg)('rovo_skill_tag_label_wrapping');
|
|
71
91
|
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['width'], function (states) {
|
|
72
92
|
var _states$widthState;
|
|
73
93
|
return {
|
|
@@ -107,7 +127,7 @@ var InlineExtension = function InlineExtension(props) {
|
|
|
107
127
|
"data-testid": "inline-extension-wrapper",
|
|
108
128
|
css: [
|
|
109
129
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
110
|
-
_styles2.wrapperStyle, inlineWrapperStyles, showMacroInteractionDesignUpdates && !isLivePageViewMode && hoverStyles]
|
|
130
|
+
_styles2.wrapperStyle, inlineWrapperStyles, showMacroInteractionDesignUpdates && !isLivePageViewMode && hoverStyles, shouldUseFlowingInlineWrapper && flowingInlineWrapperStyles]
|
|
111
131
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
112
132
|
,
|
|
113
133
|
className: classNames,
|
|
@@ -28,7 +28,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
28
28
|
var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
29
29
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
30
30
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
31
|
-
var packageVersion = "119.
|
|
31
|
+
var packageVersion = "119.12.0";
|
|
32
32
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
33
33
|
// Remove URL as it has UGC
|
|
34
34
|
// Ignored via go/ees007
|
|
@@ -309,12 +309,6 @@ var EditorPluginInjectionAPI = exports.EditorPluginInjectionAPI = /*#__PURE__*/f
|
|
|
309
309
|
fireAnalyticsEvent = _ref6.fireAnalyticsEvent,
|
|
310
310
|
appearance = _ref6.appearance;
|
|
311
311
|
(0, _classCallCheck2.default)(this, EditorPluginInjectionAPI);
|
|
312
|
-
// Internal helper for preset reconfiguration. Some consumers memoize plugin
|
|
313
|
-
// APIs by the top-level proxy identity, so callers must invalidate that proxy
|
|
314
|
-
// when the registered plugin set changes.
|
|
315
|
-
(0, _defineProperty2.default)(this, "invalidateAPI", function () {
|
|
316
|
-
editorAPICache.delete(_this2);
|
|
317
|
-
});
|
|
318
312
|
(0, _defineProperty2.default)(this, "onEditorViewUpdated", function (_ref7) {
|
|
319
313
|
var newEditorState = _ref7.newEditorState,
|
|
320
314
|
oldEditorState = _ref7.oldEditorState;
|
|
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
24
24
|
* @jsx jsx
|
|
25
25
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
26
26
|
var packageName = "@atlaskit/editor-common";
|
|
27
|
-
var packageVersion = "119.
|
|
27
|
+
var packageVersion = "119.12.0";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var fadeIn = (0, _react2.keyframes)({
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { bind } from 'bind-event-listener';
|
|
1
2
|
// Ignored via go/ees005
|
|
2
3
|
// eslint-disable-next-line import/no-namespace
|
|
3
4
|
import * as clipboard from 'clipboard-polyfill';
|
|
5
|
+
import { getDocument } from '@atlaskit/browser-apis';
|
|
4
6
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
7
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../analytics';
|
|
6
8
|
import { getAllSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, getNodeSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload } from '../selection';
|
|
@@ -78,6 +80,36 @@ export const copyHTMLToClipboardPolyfill = async (elementToCopy, plainTextToCopy
|
|
|
78
80
|
await clipboard.write([dt]);
|
|
79
81
|
};
|
|
80
82
|
|
|
83
|
+
// Safari can revoke transient user activation before asynchronous clipboard writes complete.
|
|
84
|
+
// Keep this helper synchronous so callers can invoke it directly from a click handler.
|
|
85
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
86
|
+
export const copyHTMLToClipboardSynchronously = (elementToCopy, plainTextToCopy) => {
|
|
87
|
+
const document = getDocument();
|
|
88
|
+
if (!document) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
let didWriteClipboardData = false;
|
|
92
|
+
const unbind = bind(document, {
|
|
93
|
+
type: 'copy',
|
|
94
|
+
listener: event => {
|
|
95
|
+
if (!event.clipboardData) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
event.preventDefault();
|
|
99
|
+
event.clipboardData.setData('text/html', elementToCopy.innerHTML);
|
|
100
|
+
event.clipboardData.setData('text/plain', plainTextToCopy || elementToCopy.innerText);
|
|
101
|
+
didWriteClipboardData = true;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
try {
|
|
105
|
+
return document.execCommand('copy') && didWriteClipboardData;
|
|
106
|
+
} catch {
|
|
107
|
+
return false;
|
|
108
|
+
} finally {
|
|
109
|
+
unbind();
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
81
113
|
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
82
114
|
export const getAnalyticsPayload = (state, action) => {
|
|
83
115
|
const {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
-
import {
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
5
|
+
import { copyHTMLToClipboard, copyHTMLToClipboardPolyfill, copyHTMLToClipboardSynchronously } from '../clipboard';
|
|
5
6
|
import { getBrowserInfo } from '../utils/browser';
|
|
6
7
|
export function getSelectedNodeOrNodeParentByNodeType({
|
|
7
8
|
nodeType,
|
|
@@ -18,37 +19,50 @@ export function getSelectedNodeOrNodeParentByNodeType({
|
|
|
18
19
|
export const toDOM = (node, schema) => {
|
|
19
20
|
return DOMSerializer.fromSchema(schema).serializeNode(node);
|
|
20
21
|
};
|
|
22
|
+
const copyDomNode = (domNode, nodeType, selection) => {
|
|
23
|
+
copyDomNodeWithResult(domNode, nodeType, selection);
|
|
24
|
+
};
|
|
25
|
+
const copyDomNodeWithResult = (domNode, nodeType, selection) => {
|
|
26
|
+
if (!domNode) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const div = document.createElement('div');
|
|
30
|
+
div.appendChild(domNode);
|
|
31
|
+
const schema = selection.$from.doc.type.schema;
|
|
32
|
+
const browser = getBrowserInfo();
|
|
21
33
|
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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 && selection instanceof NodeSelection && (selection.node.type === schema.nodes.extension || selection.node.type === schema.nodes.mediaSingle)) {
|
|
49
|
-
copyHTMLToClipboardPolyfill(div);
|
|
50
|
-
} else {
|
|
51
|
-
copyHTMLToClipboard(div);
|
|
34
|
+
// if copying inline content
|
|
35
|
+
if (nodeType.inlineContent) {
|
|
36
|
+
// The "1 1" refers to the start and end depth of the slice
|
|
37
|
+
// since we're copying the text inside a paragraph, it will always be 1 1
|
|
38
|
+
// https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
|
|
39
|
+
// Ignored via go/ees005
|
|
40
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
41
|
+
div.firstChild.setAttribute('data-pm-slice', '1 1 []');
|
|
42
|
+
} else {
|
|
43
|
+
// The "0 0" refers to the start and end depth of the slice
|
|
44
|
+
// since we're copying the block node only, it will always be 0 0
|
|
45
|
+
// https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
|
|
46
|
+
// Ignored via go/ees005
|
|
47
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
48
|
+
div.firstChild.setAttribute('data-pm-slice', '0 0 []');
|
|
49
|
+
}
|
|
50
|
+
const isSyncedBlock = nodeType.name === 'syncBlock' || nodeType.name === 'bodiedSyncBlock';
|
|
51
|
+
if (browser.safari && isSyncedBlock) {
|
|
52
|
+
// clipboard-polyfill/native-first clipboard.write only reaches DOM fallback after rejection; Safari can
|
|
53
|
+
// resolve native writes without retaining synced-block HTML, so Patch 9 forces copy-event/execCommand while click activation is live.
|
|
54
|
+
if (fg('platform_editor_blocks_patch_9')) {
|
|
55
|
+
return copyHTMLToClipboardSynchronously(div);
|
|
52
56
|
}
|
|
53
57
|
}
|
|
54
|
-
|
|
58
|
+
|
|
59
|
+
// Safari's ClipboardItem API may not preserve HTML for extension nodes or mediaSingle nodes.
|
|
60
|
+
if (browser.safari && selection instanceof NodeSelection && (selection.node.type === schema.nodes.extension || selection.node.type === schema.nodes.mediaSingle)) {
|
|
61
|
+
copyHTMLToClipboardPolyfill(div);
|
|
62
|
+
} else {
|
|
63
|
+
copyHTMLToClipboard(div);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
68
|
+
export { copyDomNode, copyDomNodeWithResult };
|
|
@@ -8,6 +8,7 @@ import React, { Fragment, useMemo } from 'react';
|
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import classnames from 'classnames';
|
|
10
10
|
import { akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
11
12
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
13
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
13
14
|
import { useSharedPluginStateWithSelector } from '../../../hooks';
|
|
@@ -26,6 +27,24 @@ const inlineWrapperStyles = css({
|
|
|
26
27
|
maxWidth: '100%'
|
|
27
28
|
}
|
|
28
29
|
});
|
|
30
|
+
const flowingInlineWrapperStyles = css({
|
|
31
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- The child marker lets an inline extension opt into text-flow layout without coupling editor-common to the skill feature gate.
|
|
32
|
+
'&:has([data-inline-extension-layout="flow"])': {
|
|
33
|
+
background: 'transparent',
|
|
34
|
+
boxShadow: 'none',
|
|
35
|
+
display: 'inline',
|
|
36
|
+
margin: 0,
|
|
37
|
+
verticalAlign: 'baseline'
|
|
38
|
+
},
|
|
39
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- The legacy wrapper decorations must be removed only when its child opts into text-flow layout.
|
|
40
|
+
'&:has([data-inline-extension-layout="flow"])::after, &:has([data-inline-extension-layout="flow"])::before': {
|
|
41
|
+
display: 'none'
|
|
42
|
+
},
|
|
43
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- The legacy overlay must be hidden only when its child opts into text-flow layout.
|
|
44
|
+
'&:has([data-inline-extension-layout="flow"]) > .extension-overlay': {
|
|
45
|
+
display: 'none'
|
|
46
|
+
}
|
|
47
|
+
});
|
|
29
48
|
const hoverStyles = css({
|
|
30
49
|
'&:hover': {
|
|
31
50
|
boxShadow: `0 0 0 1px ${"var(--ds-border-input, #8C8F97)"}`
|
|
@@ -61,6 +80,7 @@ const InlineExtension = props => {
|
|
|
61
80
|
const {
|
|
62
81
|
showMacroInteractionDesignUpdates
|
|
63
82
|
} = macroInteractionDesignFeatureFlags || {};
|
|
83
|
+
const shouldUseFlowingInlineWrapper = fg('rovo_skill_tag_label_wrapping');
|
|
64
84
|
const {
|
|
65
85
|
width
|
|
66
86
|
} = useSharedPluginStateWithSelector(pluginInjectionApi, ['width'], states => {
|
|
@@ -101,7 +121,7 @@ const InlineExtension = props => {
|
|
|
101
121
|
"data-testid": "inline-extension-wrapper",
|
|
102
122
|
css: [
|
|
103
123
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
104
|
-
wrapperStyle, inlineWrapperStyles, showMacroInteractionDesignUpdates && !isLivePageViewMode && hoverStyles]
|
|
124
|
+
wrapperStyle, inlineWrapperStyles, showMacroInteractionDesignUpdates && !isLivePageViewMode && hoverStyles, shouldUseFlowingInlineWrapper && flowingInlineWrapperStyles]
|
|
105
125
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
106
126
|
,
|
|
107
127
|
className: classNames,
|
|
@@ -14,7 +14,7 @@ const NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
14
14
|
const RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
15
15
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
16
16
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
17
|
-
const packageVersion = "119.
|
|
17
|
+
const packageVersion = "119.12.0";
|
|
18
18
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
19
19
|
// Remove URL as it has UGC
|
|
20
20
|
// Ignored via go/ees007
|
|
@@ -224,12 +224,6 @@ export class EditorPluginInjectionAPI {
|
|
|
224
224
|
fireAnalyticsEvent,
|
|
225
225
|
appearance
|
|
226
226
|
}) {
|
|
227
|
-
// Internal helper for preset reconfiguration. Some consumers memoize plugin
|
|
228
|
-
// APIs by the top-level proxy identity, so callers must invalidate that proxy
|
|
229
|
-
// when the registered plugin set changes.
|
|
230
|
-
_defineProperty(this, "invalidateAPI", () => {
|
|
231
|
-
editorAPICache.delete(this);
|
|
232
|
-
});
|
|
233
227
|
_defineProperty(this, "onEditorViewUpdated", ({
|
|
234
228
|
newEditorState,
|
|
235
229
|
oldEditorState
|
|
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import Layer from '../Layer';
|
|
16
16
|
const packageName = "@atlaskit/editor-common";
|
|
17
|
-
const packageVersion = "119.
|
|
17
|
+
const packageVersion = "119.12.0";
|
|
18
18
|
const halfFocusRing = 1;
|
|
19
19
|
const dropOffset = '0, 8';
|
|
20
20
|
const fadeIn = keyframes({
|
|
@@ -5,9 +5,11 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
5
5
|
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; }
|
|
6
6
|
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; }
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
|
+
import { bind } from 'bind-event-listener';
|
|
8
9
|
// Ignored via go/ees005
|
|
9
10
|
// eslint-disable-next-line import/no-namespace
|
|
10
11
|
import * as clipboard from 'clipboard-polyfill';
|
|
12
|
+
import { getDocument } from '@atlaskit/browser-apis';
|
|
11
13
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
12
14
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../analytics';
|
|
13
15
|
import { getAllSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, getNodeSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload } from '../selection';
|
|
@@ -165,6 +167,36 @@ export var copyHTMLToClipboardPolyfill = /*#__PURE__*/function () {
|
|
|
165
167
|
};
|
|
166
168
|
}();
|
|
167
169
|
|
|
170
|
+
// Safari can revoke transient user activation before asynchronous clipboard writes complete.
|
|
171
|
+
// Keep this helper synchronous so callers can invoke it directly from a click handler.
|
|
172
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
173
|
+
export var copyHTMLToClipboardSynchronously = function copyHTMLToClipboardSynchronously(elementToCopy, plainTextToCopy) {
|
|
174
|
+
var document = getDocument();
|
|
175
|
+
if (!document) {
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
var didWriteClipboardData = false;
|
|
179
|
+
var unbind = bind(document, {
|
|
180
|
+
type: 'copy',
|
|
181
|
+
listener: function listener(event) {
|
|
182
|
+
if (!event.clipboardData) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
event.preventDefault();
|
|
186
|
+
event.clipboardData.setData('text/html', elementToCopy.innerHTML);
|
|
187
|
+
event.clipboardData.setData('text/plain', plainTextToCopy || elementToCopy.innerText);
|
|
188
|
+
didWriteClipboardData = true;
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
try {
|
|
192
|
+
return document.execCommand('copy') && didWriteClipboardData;
|
|
193
|
+
} catch (_unused) {
|
|
194
|
+
return false;
|
|
195
|
+
} finally {
|
|
196
|
+
unbind();
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
|
|
168
200
|
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
169
201
|
export var getAnalyticsPayload = function getAnalyticsPayload(state, action) {
|
|
170
202
|
var selection = state.selection,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
-
import {
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
5
|
+
import { copyHTMLToClipboard, copyHTMLToClipboardPolyfill, copyHTMLToClipboardSynchronously } from '../clipboard';
|
|
5
6
|
import { getBrowserInfo } from '../utils/browser';
|
|
6
7
|
export function getSelectedNodeOrNodeParentByNodeType(_ref) {
|
|
7
8
|
var nodeType = _ref.nodeType,
|
|
@@ -17,37 +18,50 @@ export function getSelectedNodeOrNodeParentByNodeType(_ref) {
|
|
|
17
18
|
export var toDOM = function toDOM(node, schema) {
|
|
18
19
|
return DOMSerializer.fromSchema(schema).serializeNode(node);
|
|
19
20
|
};
|
|
21
|
+
var copyDomNode = function copyDomNode(domNode, nodeType, selection) {
|
|
22
|
+
copyDomNodeWithResult(domNode, nodeType, selection);
|
|
23
|
+
};
|
|
24
|
+
var copyDomNodeWithResult = function copyDomNodeWithResult(domNode, nodeType, selection) {
|
|
25
|
+
if (!domNode) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
var div = document.createElement('div');
|
|
29
|
+
div.appendChild(domNode);
|
|
30
|
+
var schema = selection.$from.doc.type.schema;
|
|
31
|
+
var browser = getBrowserInfo();
|
|
20
32
|
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
div.firstChild.setAttribute('data-pm-slice', '0 0 []');
|
|
44
|
-
}
|
|
45
|
-
// 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
|
|
46
|
-
// 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
|
|
47
|
-
if (browser.safari && selection instanceof NodeSelection && (selection.node.type === schema.nodes.extension || selection.node.type === schema.nodes.mediaSingle)) {
|
|
48
|
-
copyHTMLToClipboardPolyfill(div);
|
|
49
|
-
} else {
|
|
50
|
-
copyHTMLToClipboard(div);
|
|
33
|
+
// if copying inline content
|
|
34
|
+
if (nodeType.inlineContent) {
|
|
35
|
+
// The "1 1" refers to the start and end depth of the slice
|
|
36
|
+
// since we're copying the text inside a paragraph, it will always be 1 1
|
|
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', '1 1 []');
|
|
41
|
+
} else {
|
|
42
|
+
// The "0 0" refers to the start and end depth of the slice
|
|
43
|
+
// since we're copying the block node only, it will always be 0 0
|
|
44
|
+
// https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
|
|
45
|
+
// Ignored via go/ees005
|
|
46
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
47
|
+
div.firstChild.setAttribute('data-pm-slice', '0 0 []');
|
|
48
|
+
}
|
|
49
|
+
var isSyncedBlock = nodeType.name === 'syncBlock' || nodeType.name === 'bodiedSyncBlock';
|
|
50
|
+
if (browser.safari && isSyncedBlock) {
|
|
51
|
+
// clipboard-polyfill/native-first clipboard.write only reaches DOM fallback after rejection; Safari can
|
|
52
|
+
// resolve native writes without retaining synced-block HTML, so Patch 9 forces copy-event/execCommand while click activation is live.
|
|
53
|
+
if (fg('platform_editor_blocks_patch_9')) {
|
|
54
|
+
return copyHTMLToClipboardSynchronously(div);
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
|
-
|
|
57
|
+
|
|
58
|
+
// Safari's ClipboardItem API may not preserve HTML for extension nodes or mediaSingle nodes.
|
|
59
|
+
if (browser.safari && selection instanceof NodeSelection && (selection.node.type === schema.nodes.extension || selection.node.type === schema.nodes.mediaSingle)) {
|
|
60
|
+
copyHTMLToClipboardPolyfill(div);
|
|
61
|
+
} else {
|
|
62
|
+
copyHTMLToClipboard(div);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
67
|
+
export { copyDomNode, copyDomNodeWithResult };
|
|
@@ -8,6 +8,7 @@ import React, { Fragment, useMemo } from 'react';
|
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import classnames from 'classnames';
|
|
10
10
|
import { akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
11
12
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
13
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
13
14
|
import { useSharedPluginStateWithSelector } from '../../../hooks';
|
|
@@ -26,6 +27,24 @@ var inlineWrapperStyles = css({
|
|
|
26
27
|
maxWidth: '100%'
|
|
27
28
|
}
|
|
28
29
|
});
|
|
30
|
+
var flowingInlineWrapperStyles = css({
|
|
31
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- The child marker lets an inline extension opt into text-flow layout without coupling editor-common to the skill feature gate.
|
|
32
|
+
'&:has([data-inline-extension-layout="flow"])': {
|
|
33
|
+
background: 'transparent',
|
|
34
|
+
boxShadow: 'none',
|
|
35
|
+
display: 'inline',
|
|
36
|
+
margin: 0,
|
|
37
|
+
verticalAlign: 'baseline'
|
|
38
|
+
},
|
|
39
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- The legacy wrapper decorations must be removed only when its child opts into text-flow layout.
|
|
40
|
+
'&:has([data-inline-extension-layout="flow"])::after, &:has([data-inline-extension-layout="flow"])::before': {
|
|
41
|
+
display: 'none'
|
|
42
|
+
},
|
|
43
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- The legacy overlay must be hidden only when its child opts into text-flow layout.
|
|
44
|
+
'&:has([data-inline-extension-layout="flow"]) > .extension-overlay': {
|
|
45
|
+
display: 'none'
|
|
46
|
+
}
|
|
47
|
+
});
|
|
29
48
|
var hoverStyles = css({
|
|
30
49
|
'&:hover': {
|
|
31
50
|
boxShadow: "0 0 0 1px ".concat("var(--ds-border-input, #8C8F97)")
|
|
@@ -58,6 +77,7 @@ var InlineExtension = function InlineExtension(props) {
|
|
|
58
77
|
isLivePageViewMode = props.isLivePageViewMode;
|
|
59
78
|
var _ref3 = macroInteractionDesignFeatureFlags || {},
|
|
60
79
|
showMacroInteractionDesignUpdates = _ref3.showMacroInteractionDesignUpdates;
|
|
80
|
+
var shouldUseFlowingInlineWrapper = fg('rovo_skill_tag_label_wrapping');
|
|
61
81
|
var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['width'], function (states) {
|
|
62
82
|
var _states$widthState;
|
|
63
83
|
return {
|
|
@@ -97,7 +117,7 @@ var InlineExtension = function InlineExtension(props) {
|
|
|
97
117
|
"data-testid": "inline-extension-wrapper",
|
|
98
118
|
css: [
|
|
99
119
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
100
|
-
wrapperStyle, inlineWrapperStyles, showMacroInteractionDesignUpdates && !isLivePageViewMode && hoverStyles]
|
|
120
|
+
wrapperStyle, inlineWrapperStyles, showMacroInteractionDesignUpdates && !isLivePageViewMode && hoverStyles, shouldUseFlowingInlineWrapper && flowingInlineWrapperStyles]
|
|
101
121
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
102
122
|
,
|
|
103
123
|
className: classNames,
|
|
@@ -20,7 +20,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
20
20
|
var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
21
21
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
22
22
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
23
|
-
var packageVersion = "119.
|
|
23
|
+
var packageVersion = "119.12.0";
|
|
24
24
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
25
25
|
// Remove URL as it has UGC
|
|
26
26
|
// Ignored via go/ees007
|
|
@@ -295,12 +295,6 @@ export var EditorPluginInjectionAPI = /*#__PURE__*/function () {
|
|
|
295
295
|
fireAnalyticsEvent = _ref6.fireAnalyticsEvent,
|
|
296
296
|
appearance = _ref6.appearance;
|
|
297
297
|
_classCallCheck(this, EditorPluginInjectionAPI);
|
|
298
|
-
// Internal helper for preset reconfiguration. Some consumers memoize plugin
|
|
299
|
-
// APIs by the top-level proxy identity, so callers must invalidate that proxy
|
|
300
|
-
// when the registered plugin set changes.
|
|
301
|
-
_defineProperty(this, "invalidateAPI", function () {
|
|
302
|
-
editorAPICache.delete(_this2);
|
|
303
|
-
});
|
|
304
298
|
_defineProperty(this, "onEditorViewUpdated", function (_ref7) {
|
|
305
299
|
var newEditorState = _ref7.newEditorState,
|
|
306
300
|
oldEditorState = _ref7.oldEditorState;
|
|
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
22
|
import Layer from '../Layer';
|
|
23
23
|
var packageName = "@atlaskit/editor-common";
|
|
24
|
-
var packageVersion = "119.
|
|
24
|
+
var packageVersion = "119.12.0";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var fadeIn = keyframes({
|
|
@@ -7,7 +7,15 @@ export type CompletionSource =
|
|
|
7
7
|
/** Server slow-lane API provided the context vector and LM logits. */
|
|
8
8
|
| 'server'
|
|
9
9
|
/** On-device WebGPU/MLC model provided the context vector and LM logits. */
|
|
10
|
-
| 'localLlm'
|
|
10
|
+
| 'localLlm'
|
|
11
|
+
/**
|
|
12
|
+
* An inline-code surface harvested from the session, offered only after the
|
|
13
|
+
* scored path finished with no vocabulary for the prefix. Reported separately
|
|
14
|
+
* because it is authorized by being marked as code rather than by model
|
|
15
|
+
* evidence, and would otherwise move the headline acceptance rate with no way
|
|
16
|
+
* to attribute the change.
|
|
17
|
+
*/
|
|
18
|
+
| 'harvest';
|
|
11
19
|
type ContextualTypeaheadViewedAttributes = {
|
|
12
20
|
completionSource: CompletionSource;
|
|
13
21
|
surface: string;
|
|
@@ -61,10 +69,10 @@ type ContextualTypeaheadLocalModelLoadFailedAttributes = {
|
|
|
61
69
|
modelId: string;
|
|
62
70
|
/** Coarse, controlled failure category — never free-form. */
|
|
63
71
|
reason: 'webgpu_unavailable' | 'webgpu_no_adapter' | 'missing_shader_f16' | 'insufficient_memory' | 'model_download_failed' | 'module_load_failed' | 'init_failed';
|
|
64
|
-
/** Product/editor surface where autocomplete is running. */
|
|
65
|
-
surface: string;
|
|
66
72
|
/** Whether the GPU supports the shader-f16 feature the model requires. */
|
|
67
73
|
shaderF16Supported?: boolean;
|
|
74
|
+
/** Product/editor surface where autocomplete is running. */
|
|
75
|
+
surface: string;
|
|
68
76
|
/** Whether navigator.gpu exists at all. */
|
|
69
77
|
webgpuAvailable?: boolean;
|
|
70
78
|
};
|
|
@@ -5,5 +5,6 @@ import { ACTION } from '../analytics';
|
|
|
5
5
|
export declare const copyToClipboard: (textToCopy: string) => Promise<void>;
|
|
6
6
|
export declare const copyHTMLToClipboard: (elementToCopy: HTMLElement, plainTextToCopy?: string) => Promise<void>;
|
|
7
7
|
export declare const copyHTMLToClipboardPolyfill: (elementToCopy: HTMLElement, plainTextToCopy?: string) => Promise<void>;
|
|
8
|
+
export declare const copyHTMLToClipboardSynchronously: (elementToCopy: HTMLElement, plainTextToCopy?: string) => boolean;
|
|
8
9
|
export declare const getAnalyticsPayload: (state: EditorState, action: ACTION.CUT | ACTION.COPIED) => AnalyticsEventPayload | undefined;
|
|
9
10
|
export declare const getNodeCopiedAnalyticsPayload: (node: PMNode, inputMethod?: INPUT_METHOD) => AnalyticsEventPayload;
|
|
@@ -6,4 +6,6 @@ export declare function getSelectedNodeOrNodeParentByNodeType({ nodeType, select
|
|
|
6
6
|
selection: Transaction['selection'];
|
|
7
7
|
}): ContentNodeWithPos | undefined;
|
|
8
8
|
export declare const toDOM: (node: PMNode, schema: Schema) => Node;
|
|
9
|
-
|
|
9
|
+
declare const copyDomNode: (domNode: Node, nodeType: NodeType, selection: Selection) => void;
|
|
10
|
+
declare const copyDomNodeWithResult: (domNode: Node, nodeType: NodeType, selection: Selection) => boolean | undefined;
|
|
11
|
+
export { copyDomNode, copyDomNodeWithResult };
|
|
@@ -58,7 +58,6 @@ export declare class EditorPluginInjectionAPI implements PluginInjectionAPIDefin
|
|
|
58
58
|
}>;
|
|
59
59
|
private createAPI;
|
|
60
60
|
api(): GenericAPIWithCore;
|
|
61
|
-
invalidateAPI: () => void;
|
|
62
61
|
onEditorViewUpdated: ({ newEditorState, oldEditorState }: EditorStateDiff) => void;
|
|
63
62
|
onEditorPluginInitialized: (plugin: NextEditorPluginInitializedType) => void;
|
|
64
63
|
retainPlugins: (keptPluginNames: ReadonlySet<string>) => string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "119.
|
|
3
|
+
"version": "119.13.0",
|
|
4
4
|
"description": "A package that contains common classes and components for editor and renderer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@atlaskit/css": "^1.0.0",
|
|
43
43
|
"@atlaskit/custom-steps": "^1.0.0",
|
|
44
44
|
"@atlaskit/dropdown-menu": "^18.1.0",
|
|
45
|
-
"@atlaskit/editor-json-transformer": "^9.
|
|
45
|
+
"@atlaskit/editor-json-transformer": "^9.6.0",
|
|
46
46
|
"@atlaskit/editor-palette": "^3.4.0",
|
|
47
47
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
48
48
|
"@atlaskit/editor-shared-styles": "^4.0.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@atlaskit/feature-gate-js-client": "^6.0.0",
|
|
55
55
|
"@atlaskit/icon": "^37.4.0",
|
|
56
56
|
"@atlaskit/link": "^5.0.0",
|
|
57
|
-
"@atlaskit/link-datasource": "^6.
|
|
57
|
+
"@atlaskit/link-datasource": "^6.5.0",
|
|
58
58
|
"@atlaskit/link-picker": "^6.4.0",
|
|
59
59
|
"@atlaskit/media-card": "^81.6.0",
|
|
60
60
|
"@atlaskit/media-client": "^37.4.0",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"@atlaskit/task-decision": "^21.8.0",
|
|
85
85
|
"@atlaskit/teams-app-config": "^2.2.0",
|
|
86
86
|
"@atlaskit/textfield": "^10.0.0",
|
|
87
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
87
|
+
"@atlaskit/tmp-editor-statsig": "^156.0.0",
|
|
88
88
|
"@atlaskit/tokens": "^16.7.0",
|
|
89
89
|
"@atlaskit/tooltip": "^24.1.0",
|
|
90
90
|
"@atlaskit/width-detector": "^7.0.0",
|
|
@@ -165,10 +165,22 @@
|
|
|
165
165
|
}
|
|
166
166
|
},
|
|
167
167
|
"platform-feature-flags": {
|
|
168
|
+
"platform_editor_blocks_patch_7": {
|
|
169
|
+
"type": "boolean",
|
|
170
|
+
"referenceOnly": true
|
|
171
|
+
},
|
|
172
|
+
"platform_editor_blocks_patch_9": {
|
|
173
|
+
"type": "boolean",
|
|
174
|
+
"referenceOnly": true
|
|
175
|
+
},
|
|
168
176
|
"platform_editor_adf_validator_stage0": {
|
|
169
177
|
"type": "boolean",
|
|
170
178
|
"referenceOnly": true
|
|
171
179
|
},
|
|
180
|
+
"rovo_skill_tag_label_wrapping": {
|
|
181
|
+
"type": "boolean",
|
|
182
|
+
"referenceOnly": true
|
|
183
|
+
},
|
|
172
184
|
"platform_editor_use_new_experiments_api": {
|
|
173
185
|
"type": "boolean"
|
|
174
186
|
},
|