@atlaskit/editor-plugin-quick-insert 7.1.4 → 7.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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-quick-insert
2
2
 
3
+ ## 7.1.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 7.1.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [`7bed98c6b4881`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7bed98c6b4881) -
14
+ ED-29747 Fix menu open experience tracking
15
+ - Updated dependencies
16
+
3
17
  ## 7.1.4
4
18
 
5
19
  ### Patch Changes
@@ -11,6 +11,7 @@ var _experiences = require("@atlaskit/editor-common/experiences");
11
11
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
12
12
  var _state = require("@atlaskit/editor-prosemirror/state");
13
13
  var pluginKey = new _state.PluginKey('quickInsertOpenExperience');
14
+ var TIMEOUT_DURATION = 1000;
14
15
  var START_METHOD = {
15
16
  QUICK_INSERT_BUTTON: 'quickInsertButton',
16
17
  TYPEAHEAD: 'typeahead'
@@ -32,6 +33,7 @@ var getQuickInsertOpenExperiencePlugin = exports.getQuickInsertOpenExperiencePlu
32
33
  dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
33
34
  var targetEl;
34
35
  var editorViewEl;
36
+ var mouseDownPos;
35
37
  var getTarget = function getTarget() {
36
38
  if (!targetEl) {
37
39
  targetEl = refs.popupsMountPoint || refs.wrapperElement || (0, _experiences.getPopupContainerFromEditorView)(editorViewEl);
@@ -42,7 +44,7 @@ var getQuickInsertOpenExperiencePlugin = exports.getQuickInsertOpenExperiencePlu
42
44
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.QUICK_INSERT,
43
45
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
44
46
  checks: [new _experiences.ExperienceCheckTimeout({
45
- durationMs: 500
47
+ durationMs: TIMEOUT_DURATION
46
48
  }), new _experiences.ExperienceCheckDomMutation({
47
49
  onDomMutation: function onDomMutation(_ref2) {
48
50
  var mutations = _ref2.mutations;
@@ -66,17 +68,27 @@ var getQuickInsertOpenExperiencePlugin = exports.getQuickInsertOpenExperiencePlu
66
68
  key: pluginKey,
67
69
  props: {
68
70
  handleDOMEvents: {
69
- click: function click(_view, event) {
71
+ mousedown: function mousedown(_view, event) {
70
72
  if (isTargetQuickInsertButton(event.target)) {
73
+ mouseDownPos = {
74
+ x: event.clientX,
75
+ y: event.clientY
76
+ };
77
+ }
78
+ },
79
+ mouseup: function mouseup(_view, event) {
80
+ if (mouseDownPos && isTargetQuickInsertButton(event.target) && event.clientX === mouseDownPos.x && event.clientY === mouseDownPos.y) {
71
81
  experience.start({
72
82
  method: START_METHOD.QUICK_INSERT_BUTTON
73
83
  });
74
84
  }
85
+ mouseDownPos = undefined;
75
86
  },
76
87
  beforeinput: function beforeinput(view, event) {
77
- if (isQuickInsertTrigger(event) && isSelectionWhichSupportsTypeahead(view)) {
88
+ if (isQuickInsertTrigger(event) && isSelectionWhichSupportsTypeahead(view) && !isQuickInsertMenuWithinNode(getTarget())) {
78
89
  experience.start({
79
- method: START_METHOD.TYPEAHEAD
90
+ method: START_METHOD.TYPEAHEAD,
91
+ forceRestart: true
80
92
  });
81
93
  }
82
94
  },
@@ -3,6 +3,7 @@ import { containsPopupWithNestedElement, Experience, EXPERIENCE_ID, ExperienceCh
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
5
  const pluginKey = new PluginKey('quickInsertOpenExperience');
6
+ const TIMEOUT_DURATION = 1000;
6
7
  const START_METHOD = {
7
8
  QUICK_INSERT_BUTTON: 'quickInsertButton',
8
9
  TYPEAHEAD: 'typeahead'
@@ -25,6 +26,7 @@ export const getQuickInsertOpenExperiencePlugin = ({
25
26
  }) => {
26
27
  let targetEl;
27
28
  let editorViewEl;
29
+ let mouseDownPos;
28
30
  const getTarget = () => {
29
31
  if (!targetEl) {
30
32
  targetEl = refs.popupsMountPoint || refs.wrapperElement || getPopupContainerFromEditorView(editorViewEl);
@@ -35,7 +37,7 @@ export const getQuickInsertOpenExperiencePlugin = ({
35
37
  actionSubjectId: ACTION_SUBJECT_ID.QUICK_INSERT,
36
38
  dispatchAnalyticsEvent,
37
39
  checks: [new ExperienceCheckTimeout({
38
- durationMs: 500
40
+ durationMs: TIMEOUT_DURATION
39
41
  }), new ExperienceCheckDomMutation({
40
42
  onDomMutation: ({
41
43
  mutations
@@ -58,17 +60,27 @@ export const getQuickInsertOpenExperiencePlugin = ({
58
60
  key: pluginKey,
59
61
  props: {
60
62
  handleDOMEvents: {
61
- click: (_view, event) => {
63
+ mousedown: (_view, event) => {
62
64
  if (isTargetQuickInsertButton(event.target)) {
65
+ mouseDownPos = {
66
+ x: event.clientX,
67
+ y: event.clientY
68
+ };
69
+ }
70
+ },
71
+ mouseup: (_view, event) => {
72
+ if (mouseDownPos && isTargetQuickInsertButton(event.target) && event.clientX === mouseDownPos.x && event.clientY === mouseDownPos.y) {
63
73
  experience.start({
64
74
  method: START_METHOD.QUICK_INSERT_BUTTON
65
75
  });
66
76
  }
77
+ mouseDownPos = undefined;
67
78
  },
68
79
  beforeinput: (view, event) => {
69
- if (isQuickInsertTrigger(event) && isSelectionWhichSupportsTypeahead(view)) {
80
+ if (isQuickInsertTrigger(event) && isSelectionWhichSupportsTypeahead(view) && !isQuickInsertMenuWithinNode(getTarget())) {
70
81
  experience.start({
71
- method: START_METHOD.TYPEAHEAD
82
+ method: START_METHOD.TYPEAHEAD,
83
+ forceRestart: true
72
84
  });
73
85
  }
74
86
  },
@@ -4,6 +4,7 @@ import { containsPopupWithNestedElement, Experience, EXPERIENCE_ID, ExperienceCh
4
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
5
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
6
  var pluginKey = new PluginKey('quickInsertOpenExperience');
7
+ var TIMEOUT_DURATION = 1000;
7
8
  var START_METHOD = {
8
9
  QUICK_INSERT_BUTTON: 'quickInsertButton',
9
10
  TYPEAHEAD: 'typeahead'
@@ -25,6 +26,7 @@ export var getQuickInsertOpenExperiencePlugin = function getQuickInsertOpenExper
25
26
  dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
26
27
  var targetEl;
27
28
  var editorViewEl;
29
+ var mouseDownPos;
28
30
  var getTarget = function getTarget() {
29
31
  if (!targetEl) {
30
32
  targetEl = refs.popupsMountPoint || refs.wrapperElement || getPopupContainerFromEditorView(editorViewEl);
@@ -35,7 +37,7 @@ export var getQuickInsertOpenExperiencePlugin = function getQuickInsertOpenExper
35
37
  actionSubjectId: ACTION_SUBJECT_ID.QUICK_INSERT,
36
38
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
37
39
  checks: [new ExperienceCheckTimeout({
38
- durationMs: 500
40
+ durationMs: TIMEOUT_DURATION
39
41
  }), new ExperienceCheckDomMutation({
40
42
  onDomMutation: function onDomMutation(_ref2) {
41
43
  var mutations = _ref2.mutations;
@@ -59,17 +61,27 @@ export var getQuickInsertOpenExperiencePlugin = function getQuickInsertOpenExper
59
61
  key: pluginKey,
60
62
  props: {
61
63
  handleDOMEvents: {
62
- click: function click(_view, event) {
64
+ mousedown: function mousedown(_view, event) {
63
65
  if (isTargetQuickInsertButton(event.target)) {
66
+ mouseDownPos = {
67
+ x: event.clientX,
68
+ y: event.clientY
69
+ };
70
+ }
71
+ },
72
+ mouseup: function mouseup(_view, event) {
73
+ if (mouseDownPos && isTargetQuickInsertButton(event.target) && event.clientX === mouseDownPos.x && event.clientY === mouseDownPos.y) {
64
74
  experience.start({
65
75
  method: START_METHOD.QUICK_INSERT_BUTTON
66
76
  });
67
77
  }
78
+ mouseDownPos = undefined;
68
79
  },
69
80
  beforeinput: function beforeinput(view, event) {
70
- if (isQuickInsertTrigger(event) && isSelectionWhichSupportsTypeahead(view)) {
81
+ if (isQuickInsertTrigger(event) && isSelectionWhichSupportsTypeahead(view) && !isQuickInsertMenuWithinNode(getTarget())) {
71
82
  experience.start({
72
- method: START_METHOD.TYPEAHEAD
83
+ method: START_METHOD.TYPEAHEAD,
84
+ forceRestart: true
73
85
  });
74
86
  }
75
87
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-quick-insert",
3
- "version": "7.1.4",
3
+ "version": "7.1.6",
4
4
  "description": "Quick insert plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -39,13 +39,13 @@
39
39
  "@atlaskit/modal-dialog": "^14.10.0",
40
40
  "@atlaskit/platform-feature-flags": "^1.1.0",
41
41
  "@atlaskit/theme": "^21.0.0",
42
- "@atlaskit/tmp-editor-statsig": "^17.0.0",
43
- "@atlaskit/tokens": "^10.1.0",
42
+ "@atlaskit/tmp-editor-statsig": "^17.10.0",
43
+ "@atlaskit/tokens": "^11.0.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "@emotion/react": "^11.7.1"
46
46
  },
47
47
  "peerDependencies": {
48
- "@atlaskit/editor-common": "^111.9.0",
48
+ "@atlaskit/editor-common": "^111.11.0",
49
49
  "react": "^18.2.0",
50
50
  "react-dom": "^18.2.0",
51
51
  "react-intl-next": "npm:react-intl@^5.18.1"