@atlaskit/editor-plugin-ufo 3.0.0 → 3.1.1
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/afm-cc/tsconfig.json +3 -0
- package/afm-jira/tsconfig.json +3 -0
- package/afm-post-office/tsconfig.json +3 -0
- package/dist/cjs/pm-plugins/traceUFOInteractionOnFirstInteraction.js +48 -0
- package/dist/cjs/ufoPlugin.js +15 -13
- package/dist/es2019/pm-plugins/traceUFOInteractionOnFirstInteraction.js +38 -0
- package/dist/es2019/ufoPlugin.js +15 -13
- package/dist/esm/pm-plugins/traceUFOInteractionOnFirstInteraction.js +40 -0
- package/dist/esm/ufoPlugin.js +15 -13
- package/dist/types/pm-plugins/traceUFOInteractionOnFirstInteraction.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/traceUFOInteractionOnFirstInteraction.d.ts +2 -0
- package/package.json +5 -5
- package/src/pm-plugins/traceUFOInteractionOnFirstInteraction.ts +59 -0
- package/src/ufoPlugin.tsx +15 -7
- package/tsconfig.app.json +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-ufo
|
|
2
2
|
|
|
3
|
+
## 3.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 3.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#183937](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/183937)
|
|
14
|
+
[`5826fd37730ab`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5826fd37730ab) -
|
|
15
|
+
Triggers traceUFOInteraction on first editor interaction to avoid vc90 blindspots
|
|
16
|
+
|
|
3
17
|
## 3.0.0
|
|
4
18
|
|
|
5
19
|
### Major Changes
|
package/afm-cc/tsconfig.json
CHANGED
package/afm-jira/tsconfig.json
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.traceUFOInteractionOnFirstInteraction = void 0;
|
|
8
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
9
|
+
var _interactionMetrics = require("@atlaskit/react-ufo/interaction-metrics");
|
|
10
|
+
var _traceInteraction = _interopRequireDefault(require("@atlaskit/react-ufo/trace-interaction"));
|
|
11
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
12
|
+
/* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
|
|
13
|
+
|
|
14
|
+
var traceUFOInteractionOnFirstInteraction = exports.traceUFOInteractionOnFirstInteraction = function traceUFOInteractionOnFirstInteraction() {
|
|
15
|
+
var aborted = false;
|
|
16
|
+
function abortIfNotAborted(event) {
|
|
17
|
+
if (aborted) {
|
|
18
|
+
// opt out of additional logic if already aborted
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
var activeInteraction = (0, _interactionMetrics.getActiveInteraction)();
|
|
22
|
+
if (activeInteraction && ['edit-page', 'live-edit'].includes(activeInteraction.ufoName)) {
|
|
23
|
+
(0, _traceInteraction.default)('new_interaction', event);
|
|
24
|
+
}
|
|
25
|
+
aborted = true;
|
|
26
|
+
}
|
|
27
|
+
return new _safePlugin.SafePlugin({
|
|
28
|
+
props: {
|
|
29
|
+
handleDOMEvents: {
|
|
30
|
+
mouseover: function mouseover(_view, event) {
|
|
31
|
+
if ((0, _expValEquals.expValEquals)('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'only_mousedown_event')) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
abortIfNotAborted(event);
|
|
35
|
+
},
|
|
36
|
+
mouseenter: function mouseenter(_view, event) {
|
|
37
|
+
if ((0, _expValEquals.expValEquals)('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'only_mousedown_event')) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
abortIfNotAborted(event);
|
|
41
|
+
},
|
|
42
|
+
mousedown: function mousedown(_view, event) {
|
|
43
|
+
return abortIfNotAborted(event);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
};
|
package/dist/cjs/ufoPlugin.js
CHANGED
|
@@ -4,23 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ufoPlugin = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
8
|
+
var _traceUFOInteractionOnFirstInteraction = require("./pm-plugins/traceUFOInteractionOnFirstInteraction");
|
|
9
9
|
var ufoPlugin = exports.ufoPlugin = function ufoPlugin() {
|
|
10
10
|
return {
|
|
11
11
|
name: 'ufo',
|
|
12
12
|
pmPlugins: function pmPlugins() {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
var _process;
|
|
14
|
+
var isSSR = Boolean((_process = process) === null || _process === void 0 || (_process = _process.env) === null || _process === void 0 ? void 0 : _process.REACT_SSR);
|
|
15
|
+
if (isSSR) {
|
|
16
|
+
// This plugin is not needed in SSR environments - and uses apis which are not available in SSR internally
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
if ((0, _expValEquals.expValEquals)('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'control')) {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
return [{
|
|
23
|
+
name: 'traceUFOInteractionOnFirstInteraction',
|
|
24
|
+
plugin: _traceUFOInteractionOnFirstInteraction.traceUFOInteractionOnFirstInteraction
|
|
25
|
+
}];
|
|
24
26
|
}
|
|
25
27
|
};
|
|
26
28
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import { getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
|
|
4
|
+
import traceUFOInteraction from '@atlaskit/react-ufo/trace-interaction';
|
|
5
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
|
+
export const traceUFOInteractionOnFirstInteraction = () => {
|
|
7
|
+
let aborted = false;
|
|
8
|
+
function abortIfNotAborted(event) {
|
|
9
|
+
if (aborted) {
|
|
10
|
+
// opt out of additional logic if already aborted
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const activeInteraction = getActiveInteraction();
|
|
14
|
+
if (activeInteraction && ['edit-page', 'live-edit'].includes(activeInteraction.ufoName)) {
|
|
15
|
+
traceUFOInteraction('new_interaction', event);
|
|
16
|
+
}
|
|
17
|
+
aborted = true;
|
|
18
|
+
}
|
|
19
|
+
return new SafePlugin({
|
|
20
|
+
props: {
|
|
21
|
+
handleDOMEvents: {
|
|
22
|
+
mouseover: (_view, event) => {
|
|
23
|
+
if (expValEquals('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'only_mousedown_event')) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
abortIfNotAborted(event);
|
|
27
|
+
},
|
|
28
|
+
mouseenter: (_view, event) => {
|
|
29
|
+
if (expValEquals('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'only_mousedown_event')) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
abortIfNotAborted(event);
|
|
33
|
+
},
|
|
34
|
+
mousedown: (_view, event) => abortIfNotAborted(event)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
};
|
package/dist/es2019/ufoPlugin.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
|
+
import { traceUFOInteractionOnFirstInteraction } from './pm-plugins/traceUFOInteractionOnFirstInteraction';
|
|
3
3
|
export const ufoPlugin = () => ({
|
|
4
4
|
name: 'ufo',
|
|
5
5
|
pmPlugins() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
var _process, _process$env;
|
|
7
|
+
const isSSR = Boolean((_process = process) === null || _process === void 0 ? void 0 : (_process$env = _process.env) === null || _process$env === void 0 ? void 0 : _process$env.REACT_SSR);
|
|
8
|
+
if (isSSR) {
|
|
9
|
+
// This plugin is not needed in SSR environments - and uses apis which are not available in SSR internally
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
if (expValEquals('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'control')) {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
return [{
|
|
16
|
+
name: 'traceUFOInteractionOnFirstInteraction',
|
|
17
|
+
plugin: traceUFOInteractionOnFirstInteraction
|
|
18
|
+
}];
|
|
17
19
|
}
|
|
18
20
|
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import { getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
|
|
4
|
+
import traceUFOInteraction from '@atlaskit/react-ufo/trace-interaction';
|
|
5
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
|
+
export var traceUFOInteractionOnFirstInteraction = function traceUFOInteractionOnFirstInteraction() {
|
|
7
|
+
var aborted = false;
|
|
8
|
+
function abortIfNotAborted(event) {
|
|
9
|
+
if (aborted) {
|
|
10
|
+
// opt out of additional logic if already aborted
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
var activeInteraction = getActiveInteraction();
|
|
14
|
+
if (activeInteraction && ['edit-page', 'live-edit'].includes(activeInteraction.ufoName)) {
|
|
15
|
+
traceUFOInteraction('new_interaction', event);
|
|
16
|
+
}
|
|
17
|
+
aborted = true;
|
|
18
|
+
}
|
|
19
|
+
return new SafePlugin({
|
|
20
|
+
props: {
|
|
21
|
+
handleDOMEvents: {
|
|
22
|
+
mouseover: function mouseover(_view, event) {
|
|
23
|
+
if (expValEquals('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'only_mousedown_event')) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
abortIfNotAborted(event);
|
|
27
|
+
},
|
|
28
|
+
mouseenter: function mouseenter(_view, event) {
|
|
29
|
+
if (expValEquals('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'only_mousedown_event')) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
abortIfNotAborted(event);
|
|
33
|
+
},
|
|
34
|
+
mousedown: function mousedown(_view, event) {
|
|
35
|
+
return abortIfNotAborted(event);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
};
|
package/dist/esm/ufoPlugin.js
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
|
+
import { traceUFOInteractionOnFirstInteraction } from './pm-plugins/traceUFOInteractionOnFirstInteraction';
|
|
3
3
|
export var ufoPlugin = function ufoPlugin() {
|
|
4
4
|
return {
|
|
5
5
|
name: 'ufo',
|
|
6
6
|
pmPlugins: function pmPlugins() {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
var _process;
|
|
8
|
+
var isSSR = Boolean((_process = process) === null || _process === void 0 || (_process = _process.env) === null || _process === void 0 ? void 0 : _process.REACT_SSR);
|
|
9
|
+
if (isSSR) {
|
|
10
|
+
// This plugin is not needed in SSR environments - and uses apis which are not available in SSR internally
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
if (expValEquals('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'control')) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
return [{
|
|
17
|
+
name: 'traceUFOInteractionOnFirstInteraction',
|
|
18
|
+
plugin: traceUFOInteractionOnFirstInteraction
|
|
19
|
+
}];
|
|
18
20
|
}
|
|
19
21
|
};
|
|
20
22
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-ufo",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "Ufo plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,11 +33,12 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
35
35
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
36
|
-
"@atlaskit/react-ufo": "^
|
|
36
|
+
"@atlaskit/react-ufo": "^4.0.0",
|
|
37
|
+
"@atlaskit/tmp-editor-statsig": "^9.6.0",
|
|
37
38
|
"@babel/runtime": "^7.0.0"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
|
-
"@atlaskit/editor-common": "^107.
|
|
41
|
+
"@atlaskit/editor-common": "^107.8.0",
|
|
41
42
|
"react": "^18.2.0"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
@@ -78,6 +79,5 @@
|
|
|
78
79
|
"import-no-extraneous-disable-for-examples-and-docs"
|
|
79
80
|
]
|
|
80
81
|
}
|
|
81
|
-
}
|
|
82
|
-
"platform-feature-flags": {}
|
|
82
|
+
}
|
|
83
83
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import { type EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import { getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
|
|
5
|
+
import traceUFOInteraction from '@atlaskit/react-ufo/trace-interaction';
|
|
6
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
|
+
|
|
8
|
+
export const traceUFOInteractionOnFirstInteraction = () => {
|
|
9
|
+
let aborted = false;
|
|
10
|
+
|
|
11
|
+
function abortIfNotAborted(event: Event) {
|
|
12
|
+
if (aborted) {
|
|
13
|
+
// opt out of additional logic if already aborted
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const activeInteraction = getActiveInteraction();
|
|
18
|
+
|
|
19
|
+
if (activeInteraction && ['edit-page', 'live-edit'].includes(activeInteraction.ufoName)) {
|
|
20
|
+
traceUFOInteraction('new_interaction', event);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
aborted = true;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return new SafePlugin({
|
|
27
|
+
props: {
|
|
28
|
+
handleDOMEvents: {
|
|
29
|
+
mouseover: (_view: EditorView, event: Event) => {
|
|
30
|
+
if (
|
|
31
|
+
expValEquals(
|
|
32
|
+
'cc_editor_interactions_trigger_traceufointeraction',
|
|
33
|
+
'cohort',
|
|
34
|
+
'only_mousedown_event',
|
|
35
|
+
)
|
|
36
|
+
) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
abortIfNotAborted(event);
|
|
41
|
+
},
|
|
42
|
+
mouseenter: (_view: EditorView, event: Event) => {
|
|
43
|
+
if (
|
|
44
|
+
expValEquals(
|
|
45
|
+
'cc_editor_interactions_trigger_traceufointeraction',
|
|
46
|
+
'cohort',
|
|
47
|
+
'only_mousedown_event',
|
|
48
|
+
)
|
|
49
|
+
) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
abortIfNotAborted(event);
|
|
54
|
+
},
|
|
55
|
+
mousedown: (_view: EditorView, event: Event) => abortIfNotAborted(event),
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
};
|
package/src/ufoPlugin.tsx
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
|
+
|
|
3
|
+
import { traceUFOInteractionOnFirstInteraction } from './pm-plugins/traceUFOInteractionOnFirstInteraction';
|
|
2
4
|
import type { UfoPlugin } from './ufoPluginType';
|
|
3
5
|
|
|
4
6
|
export const ufoPlugin: UfoPlugin = () => ({
|
|
5
7
|
name: 'ufo',
|
|
6
8
|
|
|
7
9
|
pmPlugins() {
|
|
8
|
-
|
|
10
|
+
const isSSR = Boolean(process?.env?.REACT_SSR);
|
|
11
|
+
|
|
12
|
+
if (isSSR) {
|
|
13
|
+
// This plugin is not needed in SSR environments - and uses apis which are not available in SSR internally
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (expValEquals('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'control')) {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
9
20
|
|
|
10
|
-
// This experimental plugin has been abandoned as per ED-27989
|
|
11
|
-
/*
|
|
12
21
|
return [
|
|
13
22
|
{
|
|
14
|
-
name: '
|
|
15
|
-
plugin:
|
|
23
|
+
name: 'traceUFOInteractionOnFirstInteraction',
|
|
24
|
+
plugin: traceUFOInteractionOnFirstInteraction,
|
|
16
25
|
},
|
|
17
26
|
];
|
|
18
|
-
*/
|
|
19
27
|
},
|
|
20
28
|
});
|