@atlaskit/editor-plugin-type-ahead 1.10.3 → 1.10.5
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 +17 -0
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/{api.js → pm-plugins/api.js} +2 -2
- package/dist/cjs/{transforms → pm-plugins/commands}/close-type-ahead.js +2 -2
- package/dist/cjs/{commands → pm-plugins/commands}/insert-type-ahead-item.js +4 -4
- package/dist/cjs/{transforms → pm-plugins/commands}/open-typeahead-at-cursor.js +2 -2
- package/dist/cjs/{commands → pm-plugins/commands}/update-list-items.js +2 -2
- package/dist/cjs/{commands → pm-plugins/commands}/update-query.js +2 -2
- package/dist/cjs/{commands → pm-plugins/commands}/update-selected-index.js +2 -2
- package/dist/cjs/pm-plugins/decorations.js +4 -4
- package/dist/cjs/pm-plugins/input-rules.js +1 -1
- package/dist/cjs/pm-plugins/insert-item-plugin.js +2 -2
- package/dist/cjs/pm-plugins/isInsertionTransaction.js +18 -0
- package/dist/cjs/pm-plugins/main.js +3 -3
- package/dist/cjs/pm-plugins/reducer.js +1 -1
- package/dist/cjs/pm-plugins/utils.js +120 -9
- package/dist/cjs/{plugin.js → typeAheadPlugin.js} +5 -5
- package/dist/cjs/types/index.js +5 -0
- package/dist/cjs/ui/InputQuery.js +2 -2
- package/dist/cjs/ui/TypeAheadList.js +3 -3
- package/dist/cjs/ui/TypeAheadMenu.js +1 -1
- package/dist/cjs/ui/TypeAheadPopup.js +1 -1
- package/dist/cjs/ui/WrapperTypeAhead.js +2 -2
- package/dist/cjs/ui/hooks/use-item-insert.js +4 -4
- package/dist/cjs/ui/hooks/use-load-items.js +1 -1
- package/dist/cjs/ui/hooks/use-on-force-select.js +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/{api.js → pm-plugins/api.js} +2 -2
- package/dist/es2019/{transforms → pm-plugins/commands}/close-type-ahead.js +2 -2
- package/dist/es2019/{commands → pm-plugins/commands}/insert-type-ahead-item.js +4 -4
- package/dist/es2019/{transforms → pm-plugins/commands}/open-typeahead-at-cursor.js +2 -2
- package/dist/es2019/{commands → pm-plugins/commands}/update-list-items.js +2 -2
- package/dist/es2019/{commands → pm-plugins/commands}/update-query.js +2 -2
- package/dist/es2019/{commands → pm-plugins/commands}/update-selected-index.js +2 -2
- package/dist/es2019/pm-plugins/decorations.js +4 -4
- package/dist/es2019/pm-plugins/input-rules.js +1 -1
- package/dist/es2019/pm-plugins/insert-item-plugin.js +1 -1
- package/dist/es2019/pm-plugins/isInsertionTransaction.js +12 -0
- package/dist/es2019/pm-plugins/main.js +2 -2
- package/dist/es2019/pm-plugins/reducer.js +1 -1
- package/dist/es2019/pm-plugins/utils.js +122 -9
- package/dist/es2019/{plugin.js → typeAheadPlugin.js} +5 -5
- package/dist/es2019/ui/InputQuery.js +2 -2
- package/dist/es2019/ui/TypeAheadList.js +3 -3
- package/dist/es2019/ui/TypeAheadMenu.js +1 -1
- package/dist/es2019/ui/TypeAheadPopup.js +1 -1
- package/dist/es2019/ui/WrapperTypeAhead.js +2 -2
- package/dist/es2019/ui/hooks/use-item-insert.js +4 -4
- package/dist/es2019/ui/hooks/use-load-items.js +1 -1
- package/dist/es2019/ui/hooks/use-on-force-select.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/{api.js → pm-plugins/api.js} +2 -2
- package/dist/esm/{transforms → pm-plugins/commands}/close-type-ahead.js +2 -2
- package/dist/esm/{commands → pm-plugins/commands}/insert-type-ahead-item.js +4 -4
- package/dist/esm/{transforms → pm-plugins/commands}/open-typeahead-at-cursor.js +2 -2
- package/dist/esm/{commands → pm-plugins/commands}/update-list-items.js +2 -2
- package/dist/esm/{commands → pm-plugins/commands}/update-query.js +2 -2
- package/dist/esm/{commands → pm-plugins/commands}/update-selected-index.js +2 -2
- package/dist/esm/pm-plugins/decorations.js +4 -4
- package/dist/esm/pm-plugins/input-rules.js +1 -1
- package/dist/esm/pm-plugins/insert-item-plugin.js +1 -1
- package/dist/esm/pm-plugins/isInsertionTransaction.js +12 -0
- package/dist/esm/pm-plugins/main.js +2 -2
- package/dist/esm/pm-plugins/reducer.js +1 -1
- package/dist/esm/pm-plugins/utils.js +120 -9
- package/dist/esm/{plugin.js → typeAheadPlugin.js} +5 -5
- package/dist/esm/typeAheadPluginType.js +1 -0
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/ui/InputQuery.js +2 -2
- package/dist/esm/ui/TypeAheadList.js +3 -3
- package/dist/esm/ui/TypeAheadMenu.js +1 -1
- package/dist/esm/ui/TypeAheadPopup.js +1 -1
- package/dist/esm/ui/WrapperTypeAhead.js +2 -2
- package/dist/esm/ui/hooks/use-item-insert.js +4 -4
- package/dist/esm/ui/hooks/use-load-items.js +1 -1
- package/dist/esm/ui/hooks/use-on-force-select.js +1 -1
- package/dist/types/index.d.ts +3 -2
- package/dist/{types-ts4.5 → types/pm-plugins}/api.d.ts +1 -1
- package/dist/{types-ts4.5 → types/pm-plugins}/commands/insert-type-ahead-item.d.ts +1 -1
- package/dist/types/{transforms → pm-plugins/commands}/open-typeahead-at-cursor.d.ts +1 -1
- package/dist/types/{commands → pm-plugins/commands}/update-list-items.d.ts +1 -1
- package/dist/types/pm-plugins/isInsertionTransaction.d.ts +4 -0
- package/dist/types/{stats-modifier.d.ts → pm-plugins/stats-modifier.d.ts} +1 -1
- package/dist/types/pm-plugins/utils.d.ts +27 -4
- package/dist/types/{plugin.d.ts → typeAheadPlugin.d.ts} +1 -1
- package/dist/types/typeAheadPluginType.d.ts +41 -0
- package/dist/{types-ts4.5/types.d.ts → types/types/index.d.ts} +2 -41
- package/dist/types/ui/ContentComponent.d.ts +2 -1
- package/dist/types/ui/InputQuery.d.ts +1 -1
- package/dist/types/ui/TypeAheadMenu.d.ts +2 -1
- package/dist/types/ui/TypeAheadPopup.d.ts +3 -2
- package/dist/types-ts4.5/index.d.ts +3 -2
- package/dist/{types → types-ts4.5/pm-plugins}/api.d.ts +1 -1
- package/dist/{types → types-ts4.5/pm-plugins}/commands/insert-type-ahead-item.d.ts +1 -1
- package/dist/types-ts4.5/{transforms → pm-plugins/commands}/open-typeahead-at-cursor.d.ts +1 -1
- package/dist/types-ts4.5/{commands → pm-plugins/commands}/update-list-items.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/isInsertionTransaction.d.ts +4 -0
- package/dist/types-ts4.5/{stats-modifier.d.ts → pm-plugins/stats-modifier.d.ts} +1 -1
- package/dist/types-ts4.5/pm-plugins/utils.d.ts +27 -4
- package/dist/types-ts4.5/{plugin.d.ts → typeAheadPlugin.d.ts} +1 -1
- package/dist/types-ts4.5/typeAheadPluginType.d.ts +44 -0
- package/dist/{types/types.d.ts → types-ts4.5/types/index.d.ts} +2 -38
- package/dist/types-ts4.5/ui/ContentComponent.d.ts +2 -1
- package/dist/types-ts4.5/ui/InputQuery.d.ts +1 -1
- package/dist/types-ts4.5/ui/TypeAheadMenu.d.ts +2 -1
- package/dist/types-ts4.5/ui/TypeAheadPopup.d.ts +3 -2
- package/package.json +8 -5
- package/dist/cjs/utils.js +0 -129
- package/dist/es2019/utils.js +0 -125
- package/dist/esm/utils.js +0 -123
- package/dist/types/utils.d.ts +0 -27
- package/dist/types-ts4.5/utils.d.ts +0 -27
- /package/dist/cjs/{insert-utils.js → pm-plugins/commands/insert-utils.js} +0 -0
- /package/dist/cjs/{transforms → pm-plugins/commands}/set-selection-before-query.js +0 -0
- /package/dist/cjs/{constants.js → pm-plugins/constants.js} +0 -0
- /package/dist/cjs/{stats-modifier.js → pm-plugins/stats-modifier.js} +0 -0
- /package/dist/cjs/{types.js → typeAheadPluginType.js} +0 -0
- /package/dist/es2019/{insert-utils.js → pm-plugins/commands/insert-utils.js} +0 -0
- /package/dist/es2019/{transforms → pm-plugins/commands}/set-selection-before-query.js +0 -0
- /package/dist/es2019/{constants.js → pm-plugins/constants.js} +0 -0
- /package/dist/es2019/{stats-modifier.js → pm-plugins/stats-modifier.js} +0 -0
- /package/dist/es2019/{types.js → typeAheadPluginType.js} +0 -0
- /package/dist/{esm/types.js → es2019/types/index.js} +0 -0
- /package/dist/esm/{insert-utils.js → pm-plugins/commands/insert-utils.js} +0 -0
- /package/dist/esm/{transforms → pm-plugins/commands}/set-selection-before-query.js +0 -0
- /package/dist/esm/{constants.js → pm-plugins/constants.js} +0 -0
- /package/dist/esm/{stats-modifier.js → pm-plugins/stats-modifier.js} +0 -0
- /package/dist/types/{transforms → pm-plugins/commands}/close-type-ahead.d.ts +0 -0
- /package/dist/types/{insert-utils.d.ts → pm-plugins/commands/insert-utils.d.ts} +0 -0
- /package/dist/types/{transforms → pm-plugins/commands}/set-selection-before-query.d.ts +0 -0
- /package/dist/types/{commands → pm-plugins/commands}/update-query.d.ts +0 -0
- /package/dist/types/{commands → pm-plugins/commands}/update-selected-index.d.ts +0 -0
- /package/dist/types/{constants.d.ts → pm-plugins/constants.d.ts} +0 -0
- /package/dist/types-ts4.5/{transforms → pm-plugins/commands}/close-type-ahead.d.ts +0 -0
- /package/dist/types-ts4.5/{insert-utils.d.ts → pm-plugins/commands/insert-utils.d.ts} +0 -0
- /package/dist/types-ts4.5/{transforms → pm-plugins/commands}/set-selection-before-query.d.ts +0 -0
- /package/dist/types-ts4.5/{commands → pm-plugins/commands}/update-query.d.ts +0 -0
- /package/dist/types-ts4.5/{commands → pm-plugins/commands}/update-selected-index.d.ts +0 -0
- /package/dist/types-ts4.5/{constants.d.ts → pm-plugins/constants.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-type-ahead
|
|
2
2
|
|
|
3
|
+
## 1.10.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#159777](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/159777)
|
|
8
|
+
[`e708d0a9e4b36`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e708d0a9e4b36) -
|
|
9
|
+
Refactoring plugins to meet folder standards.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 1.10.4
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#159176](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/159176)
|
|
17
|
+
[`8f1d77592a9dc`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8f1d77592a9dc) -
|
|
18
|
+
Bump adf-schema to 44.2.0
|
|
19
|
+
|
|
3
20
|
## 1.10.3
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
Object.defineProperty(exports, "typeAheadPlugin", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function get() {
|
|
9
|
-
return
|
|
9
|
+
return _typeAheadPlugin.typeAheadPlugin;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
var
|
|
12
|
+
var _typeAheadPlugin = require("./typeAheadPlugin");
|
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.createTypeAheadTools = void 0;
|
|
7
7
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
8
8
|
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
9
|
+
var _closeTypeAhead = require("./commands/close-type-ahead");
|
|
9
10
|
var _insertTypeAheadItem = require("./commands/insert-type-ahead-item");
|
|
11
|
+
var _openTypeaheadAtCursor = require("./commands/open-typeahead-at-cursor");
|
|
10
12
|
var _updateQuery = require("./commands/update-query");
|
|
11
|
-
var _closeTypeAhead = require("./transforms/close-type-ahead");
|
|
12
|
-
var _openTypeaheadAtCursor = require("./transforms/open-typeahead-at-cursor");
|
|
13
13
|
var _utils = require("./utils");
|
|
14
14
|
var open = function open(_ref) {
|
|
15
15
|
var editorView = _ref.editorView;
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.closeTypeAhead = void 0;
|
|
7
|
-
var _actions = require("../
|
|
8
|
-
var _key = require("../
|
|
7
|
+
var _actions = require("../actions");
|
|
8
|
+
var _key = require("../key");
|
|
9
9
|
var closeTypeAhead = exports.closeTypeAhead = function closeTypeAhead(tr) {
|
|
10
10
|
return tr.setMeta(_key.pluginKey, {
|
|
11
11
|
action: _actions.ACTIONS.CLOSE_TYPE_AHEAD
|
|
@@ -11,12 +11,12 @@ var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
|
11
11
|
var _history = require("@atlaskit/editor-prosemirror/history");
|
|
12
12
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
13
13
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var _key = require("../pm-plugins/key");
|
|
14
|
+
var _actions = require("../actions");
|
|
15
|
+
var _key = require("../key");
|
|
17
16
|
var _statsModifier = require("../stats-modifier");
|
|
18
|
-
var _closeTypeAhead = require("../transforms/close-type-ahead");
|
|
19
17
|
var _utils2 = require("../utils");
|
|
18
|
+
var _closeTypeAhead = require("./close-type-ahead");
|
|
19
|
+
var _insertUtils = require("./insert-utils");
|
|
20
20
|
var validateNode = function validateNode(_ref) {
|
|
21
21
|
var schema = _ref.schema,
|
|
22
22
|
maybeNode = _ref.maybeNode;
|
|
@@ -6,8 +6,8 @@ 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 _actions = require("../
|
|
10
|
-
var _key = require("../
|
|
9
|
+
var _actions = require("../actions");
|
|
10
|
+
var _key = require("../key");
|
|
11
11
|
var openTypeAhead = exports.openTypeAhead = function openTypeAhead(props) {
|
|
12
12
|
return function (tr) {
|
|
13
13
|
var triggerHandler = props.triggerHandler,
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.updateListItem = void 0;
|
|
7
|
-
var _actions = require("../
|
|
8
|
-
var _key = require("../
|
|
7
|
+
var _actions = require("../actions");
|
|
8
|
+
var _key = require("../key");
|
|
9
9
|
var updateListItem = exports.updateListItem = function updateListItem(items) {
|
|
10
10
|
return function (state, dispatch) {
|
|
11
11
|
var tr = state.tr;
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.updateQuery = void 0;
|
|
7
|
-
var _actions = require("../
|
|
8
|
-
var _key = require("../
|
|
7
|
+
var _actions = require("../actions");
|
|
8
|
+
var _key = require("../key");
|
|
9
9
|
var updateQuery = exports.updateQuery = function updateQuery(query) {
|
|
10
10
|
return function (state, dispatch) {
|
|
11
11
|
var pluginState = _key.pluginKey.getState(state);
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.updateSelectedIndex = void 0;
|
|
7
|
-
var _actions = require("../
|
|
8
|
-
var _key = require("../
|
|
7
|
+
var _actions = require("../actions");
|
|
8
|
+
var _key = require("../key");
|
|
9
9
|
var updateSelectedIndex = exports.updateSelectedIndex = function updateSelectedIndex(selectedIndex) {
|
|
10
10
|
return function (state, dispatch) {
|
|
11
11
|
var pluginState = _key.pluginKey.getState(state);
|
|
@@ -14,11 +14,11 @@ var _history = require("@atlaskit/editor-prosemirror/history");
|
|
|
14
14
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
15
15
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
16
16
|
var _colors = require("@atlaskit/theme/colors");
|
|
17
|
-
var _constants = require("../constants");
|
|
18
|
-
var _statsModifier = require("../stats-modifier");
|
|
19
|
-
var _closeTypeAhead = require("../transforms/close-type-ahead");
|
|
20
17
|
var _WrapperTypeAhead = require("../ui/WrapperTypeAhead");
|
|
21
|
-
var
|
|
18
|
+
var _closeTypeAhead = require("./commands/close-type-ahead");
|
|
19
|
+
var _constants = require("./constants");
|
|
20
|
+
var _statsModifier = require("./stats-modifier");
|
|
21
|
+
var _utils = require("./utils");
|
|
22
22
|
var factoryDecorations = exports.factoryDecorations = function factoryDecorations(_ref) {
|
|
23
23
|
var intl = _ref.intl,
|
|
24
24
|
popupMountRef = _ref.popupMountRef;
|
|
@@ -9,7 +9,7 @@ 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");
|
|
11
11
|
var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
|
|
12
|
-
var _openTypeaheadAtCursor = require("../
|
|
12
|
+
var _openTypeaheadAtCursor = require("../pm-plugins/commands/open-typeahead-at-cursor");
|
|
13
13
|
function inputRulePlugin(schema, typeAheads, featureFlags) {
|
|
14
14
|
if (!typeAheads || typeAheads.length === 0) {
|
|
15
15
|
return;
|
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.createPlugin = createPlugin;
|
|
7
7
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
8
|
var _actions = require("./actions");
|
|
9
|
-
var
|
|
9
|
+
var _isInsertionTransaction = require("./isInsertionTransaction");
|
|
10
10
|
function createPlugin() {
|
|
11
11
|
return new _safePlugin.SafePlugin({
|
|
12
12
|
appendTransaction: function appendTransaction(transactions, _oldState, newState) {
|
|
13
|
-
var insertItemCallback = (0,
|
|
13
|
+
var insertItemCallback = (0, _isInsertionTransaction.isInsertionTransaction)(transactions, _actions.ACTIONS.INSERT_ITEM);
|
|
14
14
|
if (insertItemCallback) {
|
|
15
15
|
var tr = insertItemCallback(newState);
|
|
16
16
|
if (tr) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isInsertionTransaction = void 0;
|
|
7
|
+
var _key = require("./key");
|
|
8
|
+
var isInsertionTransaction = exports.isInsertionTransaction = function isInsertionTransaction(transactions, action) {
|
|
9
|
+
var _tr$getMeta2;
|
|
10
|
+
var tr = transactions.find(function (tr) {
|
|
11
|
+
var _tr$getMeta;
|
|
12
|
+
return ((_tr$getMeta = tr.getMeta(_key.pluginKey)) === null || _tr$getMeta === void 0 ? void 0 : _tr$getMeta.action) === action;
|
|
13
|
+
});
|
|
14
|
+
if (!tr) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return (_tr$getMeta2 = tr.getMeta(_key.pluginKey)) === null || _tr$getMeta2 === void 0 ? void 0 : _tr$getMeta2.params;
|
|
18
|
+
};
|
|
@@ -8,12 +8,12 @@ var _steps = require("@atlaskit/adf-schema/steps");
|
|
|
8
8
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
9
9
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
10
10
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
11
|
-
var _constants = require("../constants");
|
|
12
11
|
var _actions = require("./actions");
|
|
12
|
+
var _constants = require("./constants");
|
|
13
13
|
var _decorations = require("./decorations");
|
|
14
|
+
var _isInsertionTransaction = require("./isInsertionTransaction");
|
|
14
15
|
var _key = require("./key");
|
|
15
16
|
var _reducer = require("./reducer");
|
|
16
|
-
var _utils2 = require("./utils");
|
|
17
17
|
var hasValidTypeAheadStep = function hasValidTypeAheadStep(tr) {
|
|
18
18
|
var steps = tr.steps.filter(function (step) {
|
|
19
19
|
return step instanceof _steps.InsertTypeAheadStep;
|
|
@@ -69,7 +69,7 @@ function createPlugin(_ref) {
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
appendTransaction: function appendTransaction(transactions, _oldState, newState) {
|
|
72
|
-
var insertItemCallback = (0,
|
|
72
|
+
var insertItemCallback = (0, _isInsertionTransaction.isInsertionTransaction)(transactions, _actions.ACTIONS.INSERT_RAW_QUERY);
|
|
73
73
|
if (insertItemCallback) {
|
|
74
74
|
var tr = insertItemCallback(newState);
|
|
75
75
|
if (tr) {
|
|
@@ -9,9 +9,9 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _steps = require("@atlaskit/adf-schema/steps");
|
|
10
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
11
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
12
|
-
var _utils = require("../utils");
|
|
13
12
|
var _actions = require("./actions");
|
|
14
13
|
var _key = require("./key");
|
|
14
|
+
var _utils = require("./utils");
|
|
15
15
|
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; }
|
|
16
16
|
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; }
|
|
17
17
|
var shouldForceOpen = function shouldForceOpen(step) {
|
|
@@ -3,16 +3,127 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.moveSelectedIndex = exports.isTypeAheadOpen = exports.isTypeAheadHandler = exports.isTypeAheadAllowed = exports.getTypeAheadQuery = exports.getTypeAheadListAriaLabels = exports.getTypeAheadHandler = exports.getPluginState = exports.findHandlerByTrigger = exports.findHandler = void 0;
|
|
7
|
+
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
8
|
+
var _updateSelectedIndex = require("./commands/update-selected-index");
|
|
7
9
|
var _key = require("./key");
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
var _statsModifier = require("./stats-modifier");
|
|
11
|
+
var isTypeAheadHandler = exports.isTypeAheadHandler = function isTypeAheadHandler(handler) {
|
|
12
|
+
return handler && Object.values(_typeAhead.TypeAheadAvailableNodes).includes(handler.id) && typeof handler.trigger === 'string' && typeof handler.selectItem === 'function' && typeof handler.getItems === 'function';
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** Is a typeahead plugin open? */
|
|
16
|
+
var isTypeAheadOpen = exports.isTypeAheadOpen = function isTypeAheadOpen(editorState) {
|
|
17
|
+
var _typeAheadPluginKey$g;
|
|
18
|
+
return !!(_key.pluginKey !== null && _key.pluginKey !== void 0 && (_typeAheadPluginKey$g = _key.pluginKey.getState(editorState)) !== null && _typeAheadPluginKey$g !== void 0 && (_typeAheadPluginKey$g = _typeAheadPluginKey$g.decorationSet) !== null && _typeAheadPluginKey$g !== void 0 && _typeAheadPluginKey$g.find().length);
|
|
19
|
+
};
|
|
20
|
+
var getPluginState = exports.getPluginState = function getPluginState(editorState) {
|
|
21
|
+
return _key.pluginKey.getState(editorState);
|
|
22
|
+
};
|
|
23
|
+
var getTypeAheadHandler = exports.getTypeAheadHandler = function getTypeAheadHandler(editorState) {
|
|
24
|
+
var _typeAheadPluginKey$g2;
|
|
25
|
+
return (_typeAheadPluginKey$g2 = _key.pluginKey.getState(editorState)) === null || _typeAheadPluginKey$g2 === void 0 ? void 0 : _typeAheadPluginKey$g2.triggerHandler;
|
|
26
|
+
};
|
|
27
|
+
var getTypeAheadQuery = exports.getTypeAheadQuery = function getTypeAheadQuery(editorState) {
|
|
28
|
+
var _typeAheadPluginKey$g3;
|
|
29
|
+
return (_typeAheadPluginKey$g3 = _key.pluginKey.getState(editorState)) === null || _typeAheadPluginKey$g3 === void 0 ? void 0 : _typeAheadPluginKey$g3.query;
|
|
30
|
+
};
|
|
31
|
+
var isTypeAheadAllowed = exports.isTypeAheadAllowed = function isTypeAheadAllowed(state) {
|
|
32
|
+
var isOpen = isTypeAheadOpen(state);
|
|
33
|
+
// if the TypeAhead is open
|
|
34
|
+
// we should not allow it
|
|
35
|
+
return !isOpen;
|
|
36
|
+
};
|
|
37
|
+
var findHandler = exports.findHandler = function findHandler(id, state) {
|
|
38
|
+
var pluginState = _key.pluginKey.getState(state);
|
|
39
|
+
if (!pluginState || !pluginState.typeAheadHandlers || pluginState.typeAheadHandlers.length === 0) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
var typeAheadHandlers = pluginState.typeAheadHandlers;
|
|
43
|
+
return typeAheadHandlers.find(function (h) {
|
|
44
|
+
return h.id === id;
|
|
45
|
+
}) || null;
|
|
46
|
+
};
|
|
47
|
+
var findHandlerByTrigger = exports.findHandlerByTrigger = function findHandlerByTrigger(_ref) {
|
|
48
|
+
var trigger = _ref.trigger,
|
|
49
|
+
editorState = _ref.editorState;
|
|
50
|
+
var pluginState = _key.pluginKey.getState(editorState);
|
|
51
|
+
if (!pluginState || !pluginState.typeAheadHandlers || pluginState.typeAheadHandlers.length === 0) {
|
|
15
52
|
return null;
|
|
16
53
|
}
|
|
17
|
-
|
|
54
|
+
var typeAheadHandlers = pluginState.typeAheadHandlers;
|
|
55
|
+
return typeAheadHandlers.find(function (h) {
|
|
56
|
+
return h.trigger === trigger;
|
|
57
|
+
}) || null;
|
|
58
|
+
};
|
|
59
|
+
var moveSelectedIndex = exports.moveSelectedIndex = function moveSelectedIndex(_ref2) {
|
|
60
|
+
var editorView = _ref2.editorView,
|
|
61
|
+
direction = _ref2.direction;
|
|
62
|
+
return function () {
|
|
63
|
+
var typeAheadState = getPluginState(editorView.state);
|
|
64
|
+
if (!typeAheadState) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
var selectedIndex = typeAheadState.selectedIndex,
|
|
68
|
+
items = typeAheadState.items;
|
|
69
|
+
var stats = typeAheadState.stats instanceof _statsModifier.StatsModifier ? typeAheadState.stats : new _statsModifier.StatsModifier();
|
|
70
|
+
var nextIndex;
|
|
71
|
+
if (direction === 'next') {
|
|
72
|
+
stats.increaseArrowDown();
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* See: https://product-fabric.atlassian.net/browse/ED-17200
|
|
76
|
+
* `selectedIndex` is forced to -1 now to not immediately focus the typeahead
|
|
77
|
+
* and only do so when there is explicit logic to focus into the typeahead
|
|
78
|
+
* options.
|
|
79
|
+
*
|
|
80
|
+
* This check for "set index to 1 when -1"
|
|
81
|
+
* - is a temporary workaround to get back the previous behaviour without
|
|
82
|
+
* entirely reverting the a11y improvements
|
|
83
|
+
*
|
|
84
|
+
*/
|
|
85
|
+
if (selectedIndex === -1 && items.length > 1) {
|
|
86
|
+
nextIndex = 1;
|
|
87
|
+
} else {
|
|
88
|
+
nextIndex = selectedIndex >= items.length - 1 ? 0 : selectedIndex + 1;
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
stats.increaseArrowUp();
|
|
92
|
+
nextIndex = selectedIndex <= 0 ? items.length - 1 : selectedIndex - 1;
|
|
93
|
+
}
|
|
94
|
+
(0, _updateSelectedIndex.updateSelectedIndex)(nextIndex)(editorView.state, editorView.dispatch);
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
var getTypeAheadListAriaLabels = exports.getTypeAheadListAriaLabels = function getTypeAheadListAriaLabels(trigger, intl, item) {
|
|
98
|
+
var _item$mention, _item$mention2, _item$emoji, _item$emoji2, _item$emoji3;
|
|
99
|
+
switch (trigger) {
|
|
100
|
+
case '@':
|
|
101
|
+
return {
|
|
102
|
+
popupAriaLabel: intl.formatMessage(_typeAhead.typeAheadListMessages.mentionPopupLabel),
|
|
103
|
+
listItemAriaLabel: intl.formatMessage(_typeAhead.typeAheadListMessages.metionListItemLabel, {
|
|
104
|
+
name: (item === null || item === void 0 || (_item$mention = item.mention) === null || _item$mention === void 0 ? void 0 : _item$mention.name) || '',
|
|
105
|
+
shortName: (item === null || item === void 0 || (_item$mention2 = item.mention) === null || _item$mention2 === void 0 ? void 0 : _item$mention2.mentionName) || ''
|
|
106
|
+
})
|
|
107
|
+
};
|
|
108
|
+
case '/':
|
|
109
|
+
return {
|
|
110
|
+
popupAriaLabel: intl.formatMessage(_typeAhead.typeAheadListMessages.quickInsertPopupLabel),
|
|
111
|
+
listItemAriaLabel: intl.formatMessage(_typeAhead.typeAheadListMessages.emojiListItemLabel, {
|
|
112
|
+
name: (item === null || item === void 0 ? void 0 : item.title) || '',
|
|
113
|
+
shortcut: (item === null || item === void 0 || (_item$emoji = item.emoji) === null || _item$emoji === void 0 ? void 0 : _item$emoji.shortName) || ''
|
|
114
|
+
})
|
|
115
|
+
};
|
|
116
|
+
case ':':
|
|
117
|
+
return {
|
|
118
|
+
popupAriaLabel: intl.formatMessage(_typeAhead.typeAheadListMessages.emojiPopupLabel),
|
|
119
|
+
listItemAriaLabel: intl.formatMessage(_typeAhead.typeAheadListMessages.emojiListItemLabel, {
|
|
120
|
+
name: (item === null || item === void 0 || (_item$emoji2 = item.emoji) === null || _item$emoji2 === void 0 ? void 0 : _item$emoji2.name) || '',
|
|
121
|
+
shortcut: (item === null || item === void 0 || (_item$emoji3 = item.emoji) === null || _item$emoji3 === void 0 ? void 0 : _item$emoji3.shortName) || ''
|
|
122
|
+
})
|
|
123
|
+
};
|
|
124
|
+
default:
|
|
125
|
+
return {
|
|
126
|
+
popupAriaLabel: intl.formatMessage(_typeAhead.typeAheadListMessages.typeAheadPopupLabel)
|
|
127
|
+
};
|
|
128
|
+
}
|
|
18
129
|
};
|
|
@@ -11,16 +11,16 @@ 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");
|
|
13
13
|
var _view2 = require("@atlaskit/editor-prosemirror/view");
|
|
14
|
-
var
|
|
14
|
+
var _closeTypeAhead = require("./pm-plugins/commands/close-type-ahead");
|
|
15
|
+
var _insertTypeAheadItem = require("./pm-plugins/commands/insert-type-ahead-item");
|
|
16
|
+
var _openTypeaheadAtCursor = require("./pm-plugins/commands/open-typeahead-at-cursor");
|
|
15
17
|
var _inputRules = require("./pm-plugins/input-rules");
|
|
16
18
|
var _insertItemPlugin = require("./pm-plugins/insert-item-plugin");
|
|
17
19
|
var _key = require("./pm-plugins/key");
|
|
18
20
|
var _main = require("./pm-plugins/main");
|
|
19
|
-
var _statsModifier = require("./stats-modifier");
|
|
20
|
-
var
|
|
21
|
-
var _openTypeaheadAtCursor = require("./transforms/open-typeahead-at-cursor");
|
|
21
|
+
var _statsModifier = require("./pm-plugins/stats-modifier");
|
|
22
|
+
var _utils = require("./pm-plugins/utils");
|
|
22
23
|
var _ContentComponent = require("./ui/ContentComponent");
|
|
23
|
-
var _utils = require("./utils");
|
|
24
24
|
/**
|
|
25
25
|
*
|
|
26
26
|
* Revamped typeahead using decorations instead of the `typeAheadQuery` mark
|
|
@@ -14,8 +14,8 @@ var _w3cKeyname = require("w3c-keyname");
|
|
|
14
14
|
var _browser = require("@atlaskit/editor-common/browser");
|
|
15
15
|
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
16
16
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
17
|
-
var _constants = require("../constants");
|
|
18
|
-
var _utils = require("../utils");
|
|
17
|
+
var _constants = require("../pm-plugins/constants");
|
|
18
|
+
var _utils = require("../pm-plugins/utils");
|
|
19
19
|
var _AssistiveText = require("./AssistiveText");
|
|
20
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
21
21
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -14,9 +14,9 @@ var _CellMeasurer = require("react-virtualized/dist/commonjs/CellMeasurer");
|
|
|
14
14
|
var _List = require("react-virtualized/dist/commonjs/List");
|
|
15
15
|
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
16
16
|
var _menu = require("@atlaskit/menu");
|
|
17
|
-
var _updateSelectedIndex = require("../commands/update-selected-index");
|
|
18
|
-
var _constants = require("../constants");
|
|
19
|
-
var _utils = require("../utils");
|
|
17
|
+
var _updateSelectedIndex = require("../pm-plugins/commands/update-selected-index");
|
|
18
|
+
var _constants = require("../pm-plugins/constants");
|
|
19
|
+
var _utils = require("../pm-plugins/utils");
|
|
20
20
|
var _AssistiveText = require("./AssistiveText");
|
|
21
21
|
var _TypeAheadListItem = require("./TypeAheadListItem");
|
|
22
22
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -8,7 +8,7 @@ exports.TypeAheadMenu = void 0;
|
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
11
|
-
var _updateSelectedIndex = require("../commands/update-selected-index");
|
|
11
|
+
var _updateSelectedIndex = require("../pm-plugins/commands/update-selected-index");
|
|
12
12
|
var _useItemInsert3 = require("./hooks/use-item-insert");
|
|
13
13
|
var _TypeAheadPopup = require("./TypeAheadPopup");
|
|
14
14
|
var TypeAheadMenu = exports.TypeAheadMenu = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
@@ -16,7 +16,7 @@ var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
|
16
16
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
17
17
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
18
18
|
var _colors = require("@atlaskit/theme/colors");
|
|
19
|
-
var _constants = require("../constants");
|
|
19
|
+
var _constants = require("../pm-plugins/constants");
|
|
20
20
|
var _TypeAheadList = require("./TypeAheadList");
|
|
21
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
22
22
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -9,8 +9,8 @@ exports.WrapperTypeAhead = void 0;
|
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
12
|
-
var _updateQuery = require("../commands/update-query");
|
|
13
|
-
var _utils = require("../utils");
|
|
12
|
+
var _updateQuery = require("../pm-plugins/commands/update-query");
|
|
13
|
+
var _utils = require("../pm-plugins/utils");
|
|
14
14
|
var _useItemInsert3 = require("./hooks/use-item-insert");
|
|
15
15
|
var _useLoadItems = require("./hooks/use-load-items");
|
|
16
16
|
var _useOnForceSelect = require("./hooks/use-on-force-select");
|
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useItemInsert = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
9
|
+
var _closeTypeAhead = require("../../pm-plugins/commands/close-type-ahead");
|
|
10
|
+
var _insertTypeAheadItem = require("../../pm-plugins/commands/insert-type-ahead-item");
|
|
11
|
+
var _setSelectionBeforeQuery = require("../../pm-plugins/commands/set-selection-before-query");
|
|
12
|
+
var _constants = require("../../pm-plugins/constants");
|
|
13
13
|
var insertRawQuery = function insertRawQuery(_ref) {
|
|
14
14
|
var view = _ref.view,
|
|
15
15
|
setSelectionAt = _ref.setSelectionAt,
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.useLoadItems = void 0;
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _react = require("react");
|
|
10
|
-
var _updateListItems = require("../../commands/update-list-items");
|
|
10
|
+
var _updateListItems = require("../../pm-plugins/commands/update-list-items");
|
|
11
11
|
var EMPTY_LIST_ITEM = [];
|
|
12
12
|
var useLoadItems = exports.useLoadItems = function useLoadItems(triggerHandler, editorView, query) {
|
|
13
13
|
var _useState = (0, _react.useState)(EMPTY_LIST_ITEM),
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useOnForceSelect = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
9
|
-
var _insertTypeAheadItem = require("../../commands/insert-type-ahead-item");
|
|
9
|
+
var _insertTypeAheadItem = require("../../pm-plugins/commands/insert-type-ahead-item");
|
|
10
10
|
var useOnForceSelect = exports.useOnForceSelect = function useOnForceSelect(_ref) {
|
|
11
11
|
var triggerHandler = _ref.triggerHandler,
|
|
12
12
|
items = _ref.items,
|
package/dist/es2019/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { typeAheadPlugin } from './
|
|
1
|
+
export { typeAheadPlugin } from './typeAheadPlugin';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { SelectItemMode, TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
|
|
3
|
+
import { closeTypeAhead } from './commands/close-type-ahead';
|
|
3
4
|
import { insertTypeAheadItem } from './commands/insert-type-ahead-item';
|
|
5
|
+
import { openTypeAheadAtCursor } from './commands/open-typeahead-at-cursor';
|
|
4
6
|
import { updateQuery } from './commands/update-query';
|
|
5
|
-
import { closeTypeAhead } from './transforms/close-type-ahead';
|
|
6
|
-
import { openTypeAheadAtCursor } from './transforms/open-typeahead-at-cursor';
|
|
7
7
|
import { findHandler, getTypeAheadHandler, getTypeAheadQuery, isTypeAheadOpen } from './utils';
|
|
8
8
|
const open = ({
|
|
9
9
|
editorView
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ACTIONS } from '../
|
|
2
|
-
import { pluginKey } from '../
|
|
1
|
+
import { ACTIONS } from '../actions';
|
|
2
|
+
import { pluginKey } from '../key';
|
|
3
3
|
export const closeTypeAhead = tr => {
|
|
4
4
|
return tr.setMeta(pluginKey, {
|
|
5
5
|
action: ACTIONS.CLOSE_TYPE_AHEAD
|
|
@@ -3,12 +3,12 @@ import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
|
3
3
|
import { closeHistory } from '@atlaskit/editor-prosemirror/history';
|
|
4
4
|
import { Fragment, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { pluginKey } from '../pm-plugins/key';
|
|
6
|
+
import { ACTIONS } from '../actions';
|
|
7
|
+
import { pluginKey } from '../key';
|
|
9
8
|
import { StatsModifier } from '../stats-modifier';
|
|
10
|
-
import { closeTypeAhead } from '../transforms/close-type-ahead';
|
|
11
9
|
import { getPluginState } from '../utils';
|
|
10
|
+
import { closeTypeAhead } from './close-type-ahead';
|
|
11
|
+
import { insertBlockNode, insertInlineNodeOrFragment } from './insert-utils';
|
|
12
12
|
const validateNode = ({
|
|
13
13
|
schema,
|
|
14
14
|
maybeNode
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
2
2
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { ACTIONS } from '../
|
|
4
|
-
import { pluginKey } from '../
|
|
3
|
+
import { ACTIONS } from '../actions';
|
|
4
|
+
import { pluginKey } from '../key';
|
|
5
5
|
export const openTypeAhead = props => tr => {
|
|
6
6
|
const {
|
|
7
7
|
triggerHandler,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ACTIONS } from '../
|
|
2
|
-
import { pluginKey as typeAheadPluginKey } from '../
|
|
1
|
+
import { ACTIONS } from '../actions';
|
|
2
|
+
import { pluginKey as typeAheadPluginKey } from '../key';
|
|
3
3
|
export const updateListItem = items => {
|
|
4
4
|
return (state, dispatch) => {
|
|
5
5
|
const tr = state.tr;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ACTIONS } from '../
|
|
2
|
-
import { pluginKey as typeAheadPluginKey } from '../
|
|
1
|
+
import { ACTIONS } from '../actions';
|
|
2
|
+
import { pluginKey as typeAheadPluginKey } from '../key';
|
|
3
3
|
export const updateQuery = query => {
|
|
4
4
|
return (state, dispatch) => {
|
|
5
5
|
const pluginState = typeAheadPluginKey.getState(state);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ACTIONS } from '../
|
|
2
|
-
import { pluginKey as typeAheadPluginKey } from '../
|
|
1
|
+
import { ACTIONS } from '../actions';
|
|
2
|
+
import { pluginKey as typeAheadPluginKey } from '../key';
|
|
3
3
|
export const updateSelectedIndex = selectedIndex => {
|
|
4
4
|
return (state, dispatch) => {
|
|
5
5
|
const pluginState = typeAheadPluginKey.getState(state);
|
|
@@ -7,11 +7,11 @@ import { redo, undo } from '@atlaskit/editor-prosemirror/history';
|
|
|
7
7
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
8
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
9
9
|
import { B400 } from '@atlaskit/theme/colors';
|
|
10
|
-
import { TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE, TYPE_AHEAD_DECORATION_KEY } from '../constants';
|
|
11
|
-
import { StatsModifier } from '../stats-modifier';
|
|
12
|
-
import { closeTypeAhead } from '../transforms/close-type-ahead';
|
|
13
10
|
import { WrapperTypeAhead } from '../ui/WrapperTypeAhead';
|
|
14
|
-
import {
|
|
11
|
+
import { closeTypeAhead } from './commands/close-type-ahead';
|
|
12
|
+
import { TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE, TYPE_AHEAD_DECORATION_KEY } from './constants';
|
|
13
|
+
import { StatsModifier } from './stats-modifier';
|
|
14
|
+
import { getTypeAheadQuery } from './utils';
|
|
15
15
|
export const factoryDecorations = ({
|
|
16
16
|
intl,
|
|
17
17
|
popupMountRef
|
|
@@ -2,7 +2,7 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
import { createRule } from '@atlaskit/editor-common/utils';
|
|
4
4
|
import { createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
|
|
5
|
-
import { openTypeAheadAtCursor } from '../
|
|
5
|
+
import { openTypeAheadAtCursor } from '../pm-plugins/commands/open-typeahead-at-cursor';
|
|
6
6
|
export function inputRulePlugin(schema, typeAheads, featureFlags) {
|
|
7
7
|
if (!typeAheads || typeAheads.length === 0) {
|
|
8
8
|
return;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { ACTIONS } from './actions';
|
|
3
|
-
import { isInsertionTransaction } from './
|
|
3
|
+
import { isInsertionTransaction } from './isInsertionTransaction';
|
|
4
4
|
export function createPlugin() {
|
|
5
5
|
return new SafePlugin({
|
|
6
6
|
appendTransaction(transactions, _oldState, newState) {
|