@atlaskit/editor-plugin-type-ahead 17.1.4 → 17.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 +12 -0
- package/dist/cjs/pm-plugins/commands/insert-type-ahead-item.js +11 -11
- package/dist/cjs/pm-plugins/main.js +2 -2
- package/dist/cjs/pm-plugins/reducer.js +8 -8
- package/dist/cjs/typeAheadPlugin.js +2 -2
- package/dist/es2019/pm-plugins/commands/insert-type-ahead-item.js +1 -1
- package/dist/es2019/pm-plugins/main.js +1 -1
- package/dist/es2019/pm-plugins/reducer.js +1 -1
- package/dist/es2019/typeAheadPlugin.js +1 -1
- package/dist/esm/pm-plugins/commands/insert-type-ahead-item.js +1 -1
- package/dist/esm/pm-plugins/main.js +1 -1
- package/dist/esm/pm-plugins/reducer.js +1 -1
- package/dist/esm/typeAheadPlugin.js +1 -1
- package/dist/types/pm-plugins/reducer.d.ts +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.performTypeAheadSelection = exports.insertTypeAheadItem = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var _typeAhead = require("@atlaskit/adf-schema/steps/type-ahead");
|
|
10
|
+
var _typeAhead2 = require("@atlaskit/editor-common/type-ahead");
|
|
11
11
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
12
12
|
var _closeHistory = require("@atlaskit/prosemirror-history/closeHistory");
|
|
13
13
|
var _actions = require("../actions");
|
|
@@ -77,12 +77,12 @@ var createInsertCallback = function createInsertCallback(_ref2) {
|
|
|
77
77
|
return tr;
|
|
78
78
|
}
|
|
79
79
|
var config = {
|
|
80
|
-
stage:
|
|
80
|
+
stage: _typeAhead.InsertTypeAheadStages.INSERTING_ITEM,
|
|
81
81
|
query: query,
|
|
82
82
|
selectedIndex: selectedIndex,
|
|
83
83
|
trigger: handler.trigger
|
|
84
84
|
};
|
|
85
|
-
tr.step(new
|
|
85
|
+
tr.step(new _typeAhead.InsertTypeAheadStep(config));
|
|
86
86
|
return tr;
|
|
87
87
|
};
|
|
88
88
|
};
|
|
@@ -99,12 +99,12 @@ var createDeleteRawTextCallback = function createDeleteRawTextCallback(_ref3) {
|
|
|
99
99
|
if (!wasInsertedBySpace) {
|
|
100
100
|
tr.delete(position.start, position.end);
|
|
101
101
|
var config = {
|
|
102
|
-
stage:
|
|
102
|
+
stage: _typeAhead.InsertTypeAheadStages.DELETING_RAW_QUERY,
|
|
103
103
|
selectedIndex: selectedIndex,
|
|
104
104
|
query: query,
|
|
105
105
|
trigger: trigger
|
|
106
106
|
};
|
|
107
|
-
tr.step(new
|
|
107
|
+
tr.step(new _typeAhead.InsertTypeAheadStep(config));
|
|
108
108
|
}
|
|
109
109
|
tr.setMeta(_key.pluginKey, {
|
|
110
110
|
action: _actions.ACTIONS.INSERT_ITEM,
|
|
@@ -134,14 +134,14 @@ var insertTypeAheadItem = exports.insertTypeAheadItem = function insertTypeAhead
|
|
|
134
134
|
var tr = view.state.tr;
|
|
135
135
|
var trigger = handler.trigger;
|
|
136
136
|
var text = "".concat(trigger).concat(query);
|
|
137
|
-
if (mode ===
|
|
137
|
+
if (mode === _typeAhead2.SelectItemMode.SPACE) {
|
|
138
138
|
text = text.trim().concat(' ');
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
// We want to always persist selectedIndex as -1 upon selecting an item from typeahead
|
|
142
142
|
// in order to retain exist focus behaviour when undoing
|
|
143
143
|
var selectedIndex = -1;
|
|
144
|
-
var wasInsertedBySpace = mode ===
|
|
144
|
+
var wasInsertedBySpace = mode === _typeAhead2.SelectItemMode.SPACE;
|
|
145
145
|
var textStartPosition = tr.selection.from;
|
|
146
146
|
var insertItem = function insertItem(newEditorSate) {
|
|
147
147
|
var insertCallback = createInsertCallback({
|
|
@@ -224,11 +224,11 @@ var executeTypeAheadSelection = function executeTypeAheadSelection(view) {
|
|
|
224
224
|
var tr = view.state.tr;
|
|
225
225
|
var trigger = handler.trigger;
|
|
226
226
|
var text = "".concat(trigger).concat(query);
|
|
227
|
-
if (mode ===
|
|
227
|
+
if (mode === _typeAhead2.SelectItemMode.SPACE) {
|
|
228
228
|
text = text.trim().concat(' ');
|
|
229
229
|
}
|
|
230
230
|
var selectedIndex = -1;
|
|
231
|
-
var wasInsertedBySpace = mode ===
|
|
231
|
+
var wasInsertedBySpace = mode === _typeAhead2.SelectItemMode.SPACE;
|
|
232
232
|
var textStartPosition = tr.selection.from;
|
|
233
233
|
var insertItem = function insertItem(newEditorState) {
|
|
234
234
|
var insertCallback = createInsertCallback({
|
|
@@ -286,7 +286,7 @@ var performTypeAheadSelection = exports.performTypeAheadSelection = function per
|
|
|
286
286
|
query = _ref6.query;
|
|
287
287
|
executeTypeAheadSelection(view)({
|
|
288
288
|
handler: handler,
|
|
289
|
-
mode:
|
|
289
|
+
mode: _typeAhead2.SelectItemMode.SELECTED,
|
|
290
290
|
query: query,
|
|
291
291
|
sourceListItem: [],
|
|
292
292
|
selectItem: function selectItem(_state, insert) {
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createPlugin = createPlugin;
|
|
7
|
-
var
|
|
7
|
+
var _typeAhead = require("@atlaskit/adf-schema/steps/type-ahead");
|
|
8
8
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
9
9
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
10
10
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
@@ -23,7 +23,7 @@ var _reducer = require("./reducer");
|
|
|
23
23
|
var ASCII_CHAR_REGEX = /^[\x00-\x7F]$/;
|
|
24
24
|
var hasValidTypeAheadStep = function hasValidTypeAheadStep(tr) {
|
|
25
25
|
var steps = tr.steps.filter(function (step) {
|
|
26
|
-
return step instanceof
|
|
26
|
+
return step instanceof _typeAhead.InsertTypeAheadStep;
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
// There are some cases, like collab rebase, where the steps are re-applied
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.createReducer = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var
|
|
9
|
+
var _typeAhead = require("@atlaskit/adf-schema/steps/type-ahead");
|
|
10
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
11
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
12
12
|
var _insm = require("@atlaskit/insm");
|
|
@@ -16,19 +16,19 @@ var _utils = require("./utils");
|
|
|
16
16
|
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; }
|
|
17
17
|
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; }
|
|
18
18
|
var shouldForceOpen = function shouldForceOpen(step) {
|
|
19
|
-
if (!(step instanceof
|
|
19
|
+
if (!(step instanceof _typeAhead.InsertTypeAheadStep)) {
|
|
20
20
|
return false;
|
|
21
21
|
}
|
|
22
|
-
var isDeletionRawQueryOperation = step.isInsertionStep() && step.stage ===
|
|
23
|
-
var isUndoingInsertionItem = step.isUndoingStep() && step.stage ===
|
|
22
|
+
var isDeletionRawQueryOperation = step.isInsertionStep() && step.stage === _typeAhead.InsertTypeAheadStages.DELETING_RAW_QUERY;
|
|
23
|
+
var isUndoingInsertionItem = step.isUndoingStep() && step.stage === _typeAhead.InsertTypeAheadStages.INSERTING_ITEM;
|
|
24
24
|
return isDeletionRawQueryOperation || isUndoingInsertionItem;
|
|
25
25
|
};
|
|
26
26
|
var shouldForceClose = function shouldForceClose(step) {
|
|
27
|
-
if (!(step instanceof
|
|
27
|
+
if (!(step instanceof _typeAhead.InsertTypeAheadStep)) {
|
|
28
28
|
return false;
|
|
29
29
|
}
|
|
30
|
-
var isInsertingItem = step.isInsertionStep() && step.stage ===
|
|
31
|
-
var isUndoingDeletionRawQuery = step.isUndoingStep() && step.stage ===
|
|
30
|
+
var isInsertingItem = step.isInsertionStep() && step.stage === _typeAhead.InsertTypeAheadStages.INSERTING_ITEM;
|
|
31
|
+
var isUndoingDeletionRawQuery = step.isUndoingStep() && step.stage === _typeAhead.InsertTypeAheadStages.DELETING_RAW_QUERY;
|
|
32
32
|
return isInsertingItem || isUndoingDeletionRawQuery;
|
|
33
33
|
};
|
|
34
34
|
var applySectionTitleUpdates = function applySectionTitleUpdates(_ref) {
|
|
@@ -45,7 +45,7 @@ var applySectionTitleUpdates = function applySectionTitleUpdates(_ref) {
|
|
|
45
45
|
};
|
|
46
46
|
var createFindHandler = function createFindHandler(typeAheadHandlers) {
|
|
47
47
|
return function (step) {
|
|
48
|
-
if (!(step instanceof
|
|
48
|
+
if (!(step instanceof _typeAhead.InsertTypeAheadStep)) {
|
|
49
49
|
return null;
|
|
50
50
|
}
|
|
51
51
|
var handler = typeAheadHandlers.find(function (h) {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.typeAheadPlugin = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var
|
|
9
|
+
var _typeAheadQuery = require("@atlaskit/adf-schema/type-ahead-query");
|
|
10
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
11
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
12
12
|
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
@@ -155,7 +155,7 @@ var typeAheadPlugin = exports.typeAheadPlugin = function typeAheadPlugin(_ref) {
|
|
|
155
155
|
// All documents with typeahead marks will be loaded normally
|
|
156
156
|
return [{
|
|
157
157
|
name: 'typeAheadQuery',
|
|
158
|
-
mark:
|
|
158
|
+
mark: _typeAheadQuery.typeAheadQuery
|
|
159
159
|
}];
|
|
160
160
|
},
|
|
161
161
|
pmPlugins: function pmPlugins() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InsertTypeAheadStages, InsertTypeAheadStep } from '@atlaskit/adf-schema/steps';
|
|
1
|
+
import { InsertTypeAheadStages, InsertTypeAheadStep } from '@atlaskit/adf-schema/steps/type-ahead';
|
|
2
2
|
import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
3
3
|
import { Fragment, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import { closeHistory } from '@atlaskit/prosemirror-history/closeHistory';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InsertTypeAheadStep } from '@atlaskit/adf-schema/steps';
|
|
1
|
+
import { InsertTypeAheadStep } from '@atlaskit/adf-schema/steps/type-ahead';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import { closest } from '@atlaskit/editor-common/utils';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InsertTypeAheadStages, InsertTypeAheadStep } from '@atlaskit/adf-schema/steps';
|
|
1
|
+
import { InsertTypeAheadStages, InsertTypeAheadStep } from '@atlaskit/adf-schema/steps/type-ahead';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
4
|
import { insm } from '@atlaskit/insm';
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { typeAheadQuery } from '@atlaskit/adf-schema';
|
|
10
|
+
import { typeAheadQuery } from '@atlaskit/adf-schema/type-ahead-query';
|
|
11
11
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
12
12
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
13
13
|
import { SelectItemMode, TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
import { InsertTypeAheadStages, InsertTypeAheadStep } from '@atlaskit/adf-schema/steps';
|
|
2
|
+
import { InsertTypeAheadStages, InsertTypeAheadStep } from '@atlaskit/adf-schema/steps/type-ahead';
|
|
3
3
|
import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
4
4
|
import { Fragment, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import { closeHistory } from '@atlaskit/prosemirror-history/closeHistory';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InsertTypeAheadStep } from '@atlaskit/adf-schema/steps';
|
|
1
|
+
import { InsertTypeAheadStep } from '@atlaskit/adf-schema/steps/type-ahead';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import { closest } from '@atlaskit/editor-common/utils';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
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
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; }
|
|
4
|
-
import { InsertTypeAheadStages, InsertTypeAheadStep } from '@atlaskit/adf-schema/steps';
|
|
4
|
+
import { InsertTypeAheadStages, InsertTypeAheadStep } from '@atlaskit/adf-schema/steps/type-ahead';
|
|
5
5
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import { insm } from '@atlaskit/insm';
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { typeAheadQuery } from '@atlaskit/adf-schema';
|
|
10
|
+
import { typeAheadQuery } from '@atlaskit/adf-schema/type-ahead-query';
|
|
11
11
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
12
12
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
13
13
|
import { SelectItemMode, TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InsertTypeAheadStep } from '@atlaskit/adf-schema/steps';
|
|
1
|
+
import { InsertTypeAheadStep } from '@atlaskit/adf-schema/steps/type-ahead';
|
|
2
2
|
import type { ReadonlyTransaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { CreateTypeAheadDecorations, PopupMountPointReference, RemoveTypeAheadDecorations, TypeAheadHandler, TypeAheadPluginState } from '../types';
|
|
4
4
|
export type ReducerOptions = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-type-ahead",
|
|
3
|
-
"version": "17.1.
|
|
3
|
+
"version": "17.1.6",
|
|
4
4
|
"description": "Type-ahead plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@atlaskit/primitives": "^22.5.0",
|
|
42
42
|
"@atlaskit/prosemirror-history": "^1.2.0",
|
|
43
43
|
"@atlaskit/prosemirror-input-rules": "^4.1.0",
|
|
44
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
44
|
+
"@atlaskit/tmp-editor-statsig": "^173.0.0",
|
|
45
45
|
"@atlaskit/tokens": "^16.11.0",
|
|
46
46
|
"@atlaskit/visually-hidden": "^4.4.0",
|
|
47
47
|
"@babel/runtime": "^7.0.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"w3c-keyname": "^2.1.8"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@atlaskit/editor-common": "^120.
|
|
56
|
+
"@atlaskit/editor-common": "^120.11.0",
|
|
57
57
|
"react": "^18.2.0 || ^19.2.0",
|
|
58
58
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
59
59
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|