@atlaskit/editor-plugin-type-ahead 19.0.10 → 19.1.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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-type-ahead
2
2
 
3
+ ## 19.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`b51cc398d7701`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b51cc398d7701) -
8
+ Add the opt-in @mention availability predicate used by the gated Home Search mode, so Search
9
+ preserves existing Chat mentions as inactive content while preventing new mention typeahead and
10
+ `/mention` slash-menu insertion. The `editor-disable-feature` feature gate enables that predicate
11
+ for Home Search.
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 19.0.10
4
18
 
5
19
  ### Patch Changes
@@ -20,13 +20,15 @@ var open = function open(_ref) {
20
20
  if (!handler) {
21
21
  return false;
22
22
  }
23
- var tr = state.tr;
24
- (0, _openTypeaheadAtCursor.openTypeAheadAtCursor)({
23
+ var tr = (0, _openTypeaheadAtCursor.openTypeAheadAtCursor)({
25
24
  triggerHandler: handler,
26
25
  inputMethod: inputMethod
27
26
  })({
28
- tr: tr
27
+ tr: state.tr
29
28
  });
29
+ if (!tr) {
30
+ return false;
31
+ }
30
32
  editorView.dispatch(tr);
31
33
  return true;
32
34
  };
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.openTypeAheadAtCursor = exports.openTypeAhead = void 0;
7
7
  var _selection = require("@atlaskit/editor-common/selection");
8
8
  var _state = require("@atlaskit/editor-prosemirror/state");
9
+ var _fg = require("@atlaskit/platform-feature-flags/fg");
9
10
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
10
11
  var _actions = require("../actions");
11
12
  var _key = require("../key");
@@ -32,7 +33,11 @@ var openTypeAheadAtCursor = exports.openTypeAheadAtCursor = function openTypeAhe
32
33
  query = _ref.query,
33
34
  removePrefixTriggerOnCancel = _ref.removePrefixTriggerOnCancel;
34
35
  return function (_ref2) {
36
+ var _triggerHandler$canOp;
35
37
  var tr = _ref2.tr;
38
+ if (((_triggerHandler$canOp = triggerHandler.canOpen) === null || _triggerHandler$canOp === void 0 ? void 0 : _triggerHandler$canOp.call(triggerHandler)) === false && (0, _fg.fg)('editor-disable-feature')) {
39
+ return null;
40
+ }
36
41
  openTypeAhead({
37
42
  triggerHandler: triggerHandler,
38
43
  inputMethod: inputMethod,
@@ -34,19 +34,9 @@ var _ContentComponent = require("./ui/ContentComponent");
34
34
 
35
35
  var createOpenAtTransaction = function createOpenAtTransaction(props) {
36
36
  return function (tr) {
37
- var triggerHandler = props.triggerHandler,
38
- inputMethod = props.inputMethod,
39
- query = props.query,
40
- removePrefixTriggerOnCancel = props.removePrefixTriggerOnCancel;
41
- (0, _openTypeaheadAtCursor.openTypeAheadAtCursor)({
42
- triggerHandler: triggerHandler,
43
- inputMethod: inputMethod,
44
- query: query,
45
- removePrefixTriggerOnCancel: removePrefixTriggerOnCancel
46
- })({
37
+ return (0, _openTypeaheadAtCursor.openTypeAheadAtCursor)(props)({
47
38
  tr: tr
48
- });
49
- return true;
39
+ }) !== null;
50
40
  };
51
41
  };
52
42
  var createOpenTypeAhead = function createOpenTypeAhead(editorViewRef) {
@@ -56,7 +46,9 @@ var createOpenTypeAhead = function createOpenTypeAhead(editorViewRef) {
56
46
  }
57
47
  var view = editorViewRef.current;
58
48
  var tr = view.state.tr;
59
- createOpenAtTransaction(props)(tr);
49
+ if (!createOpenAtTransaction(props)(tr)) {
50
+ return false;
51
+ }
60
52
  view.dispatch(tr);
61
53
  return true;
62
54
  };
@@ -15,15 +15,15 @@ const open = ({
15
15
  if (!handler) {
16
16
  return false;
17
17
  }
18
- const {
19
- tr
20
- } = state;
21
- openTypeAheadAtCursor({
18
+ const tr = openTypeAheadAtCursor({
22
19
  triggerHandler: handler,
23
20
  inputMethod
24
21
  })({
25
- tr
22
+ tr: state.tr
26
23
  });
24
+ if (!tr) {
25
+ return false;
26
+ }
27
27
  editorView.dispatch(tr);
28
28
  return true;
29
29
  };
@@ -1,5 +1,6 @@
1
1
  import { GapCursorSelection } from '@atlaskit/editor-common/selection';
2
2
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
3
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
3
4
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
5
  import { ACTIONS } from '../actions';
5
6
  import { pluginKey } from '../key';
@@ -28,6 +29,10 @@ export const openTypeAheadAtCursor = ({
28
29
  }) => ({
29
30
  tr
30
31
  }) => {
32
+ var _triggerHandler$canOp;
33
+ if (((_triggerHandler$canOp = triggerHandler.canOpen) === null || _triggerHandler$canOp === void 0 ? void 0 : _triggerHandler$canOp.call(triggerHandler)) === false && fg('editor-disable-feature')) {
34
+ return null;
35
+ }
31
36
  openTypeAhead({
32
37
  triggerHandler,
33
38
  inputMethod,
@@ -25,21 +25,9 @@ import { StatsModifier } from './pm-plugins/stats-modifier';
25
25
  import { findHandler, getPluginState, getTypeAheadHandler, getTypeAheadQuery, isTypeAheadAllowed, isTypeAheadOpen } from './pm-plugins/utils';
26
26
  import { ContentComponent } from './ui/ContentComponent';
27
27
  const createOpenAtTransaction = props => tr => {
28
- const {
29
- triggerHandler,
30
- inputMethod,
31
- query,
32
- removePrefixTriggerOnCancel
33
- } = props;
34
- openTypeAheadAtCursor({
35
- triggerHandler,
36
- inputMethod,
37
- query,
38
- removePrefixTriggerOnCancel
39
- })({
28
+ return openTypeAheadAtCursor(props)({
40
29
  tr
41
- });
42
- return true;
30
+ }) !== null;
43
31
  };
44
32
  const createOpenTypeAhead = editorViewRef => props => {
45
33
  if (!editorViewRef.current) {
@@ -51,7 +39,9 @@ const createOpenTypeAhead = editorViewRef => props => {
51
39
  const {
52
40
  tr
53
41
  } = view.state;
54
- createOpenAtTransaction(props)(tr);
42
+ if (!createOpenAtTransaction(props)(tr)) {
43
+ return false;
44
+ }
55
45
  view.dispatch(tr);
56
46
  return true;
57
47
  };
@@ -14,13 +14,15 @@ var open = function open(_ref) {
14
14
  if (!handler) {
15
15
  return false;
16
16
  }
17
- var tr = state.tr;
18
- openTypeAheadAtCursor({
17
+ var tr = openTypeAheadAtCursor({
19
18
  triggerHandler: handler,
20
19
  inputMethod: inputMethod
21
20
  })({
22
- tr: tr
21
+ tr: state.tr
23
22
  });
23
+ if (!tr) {
24
+ return false;
25
+ }
24
26
  editorView.dispatch(tr);
25
27
  return true;
26
28
  };
@@ -1,5 +1,6 @@
1
1
  import { GapCursorSelection } from '@atlaskit/editor-common/selection';
2
2
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
3
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
3
4
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
5
  import { ACTIONS } from '../actions';
5
6
  import { pluginKey } from '../key';
@@ -26,7 +27,11 @@ export var openTypeAheadAtCursor = function openTypeAheadAtCursor(_ref) {
26
27
  query = _ref.query,
27
28
  removePrefixTriggerOnCancel = _ref.removePrefixTriggerOnCancel;
28
29
  return function (_ref2) {
30
+ var _triggerHandler$canOp;
29
31
  var tr = _ref2.tr;
32
+ if (((_triggerHandler$canOp = triggerHandler.canOpen) === null || _triggerHandler$canOp === void 0 ? void 0 : _triggerHandler$canOp.call(triggerHandler)) === false && fg('editor-disable-feature')) {
33
+ return null;
34
+ }
30
35
  openTypeAhead({
31
36
  triggerHandler: triggerHandler,
32
37
  inputMethod: inputMethod,
@@ -26,19 +26,9 @@ import { findHandler, getPluginState, getTypeAheadHandler, getTypeAheadQuery, is
26
26
  import { ContentComponent } from './ui/ContentComponent';
27
27
  var createOpenAtTransaction = function createOpenAtTransaction(props) {
28
28
  return function (tr) {
29
- var triggerHandler = props.triggerHandler,
30
- inputMethod = props.inputMethod,
31
- query = props.query,
32
- removePrefixTriggerOnCancel = props.removePrefixTriggerOnCancel;
33
- openTypeAheadAtCursor({
34
- triggerHandler: triggerHandler,
35
- inputMethod: inputMethod,
36
- query: query,
37
- removePrefixTriggerOnCancel: removePrefixTriggerOnCancel
38
- })({
29
+ return openTypeAheadAtCursor(props)({
39
30
  tr: tr
40
- });
41
- return true;
31
+ }) !== null;
42
32
  };
43
33
  };
44
34
  var createOpenTypeAhead = function createOpenTypeAhead(editorViewRef) {
@@ -48,7 +38,9 @@ var createOpenTypeAhead = function createOpenTypeAhead(editorViewRef) {
48
38
  }
49
39
  var view = editorViewRef.current;
50
40
  var tr = view.state.tr;
51
- createOpenAtTransaction(props)(tr);
41
+ if (!createOpenAtTransaction(props)(tr)) {
42
+ return false;
43
+ }
52
44
  view.dispatch(tr);
53
45
  return true;
54
46
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-type-ahead",
3
- "version": "19.0.10",
3
+ "version": "19.1.0",
4
4
  "description": "Type-ahead plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -54,7 +54,7 @@
54
54
  "w3c-keyname": "^2.1.8"
55
55
  },
56
56
  "peerDependencies": {
57
- "@atlaskit/editor-common": "^122.10.0",
57
+ "@atlaskit/editor-common": "^122.11.0",
58
58
  "react": "^18.2.0 || ^19.2.0",
59
59
  "react-dom": "^18.2.0 || ^19.2.0",
60
60
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
@@ -69,6 +69,10 @@
69
69
  "wait-for-expect": "^1.2.0"
70
70
  },
71
71
  "platform-feature-flags": {
72
+ "editor-disable-feature": {
73
+ "type": "boolean",
74
+ "referenceOnly": true
75
+ },
72
76
  "platform_editor_ease_of_use_metrics": {
73
77
  "type": "boolean"
74
78
  },