@atlaskit/editor-core 187.8.7 → 187.8.10
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 +7 -0
- package/dist/cjs/index.js +0 -6
- package/dist/cjs/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
- package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +4 -4
- package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +5 -5
- package/dist/cjs/plugins/layout/pm-plugins/main.js +1 -1
- package/dist/cjs/plugins/list/actions/conversions.js +5 -5
- package/dist/cjs/plugins/list/actions/indent-list-items-selected.js +11 -11
- package/dist/cjs/plugins/list/actions/join-list-items-forward.js +6 -6
- package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +6 -7
- package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +3 -4
- package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +3 -4
- package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +2 -2
- package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +2 -2
- package/dist/cjs/plugins/list/actions/merge-lists.js +3 -3
- package/dist/cjs/plugins/list/actions/outdent-list-items-selected.js +11 -11
- package/dist/cjs/plugins/list/actions/wrap-and-join-lists.js +2 -2
- package/dist/cjs/plugins/list/commands/indent-list.js +6 -7
- package/dist/cjs/plugins/list/commands/index.js +8 -10
- package/dist/cjs/plugins/list/commands/join-list-item-forward.js +5 -5
- package/dist/cjs/plugins/list/commands/listBackspace.js +13 -14
- package/dist/cjs/plugins/list/commands/outdent-list.js +4 -3
- package/dist/cjs/plugins/list/pm-plugins/main.js +5 -6
- package/dist/cjs/plugins/list/utils/analytics.js +1 -35
- package/dist/cjs/plugins/list/utils/indentation.js +2 -20
- package/dist/cjs/plugins/list/utils/node.js +2 -106
- package/dist/cjs/plugins/list/utils/selection.js +3 -54
- package/dist/cjs/plugins/tasks-and-decisions/commands.js +2 -2
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +17 -18
- package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
- package/dist/cjs/utils/commands.js +3 -109
- package/dist/cjs/utils/document.js +1 -26
- package/dist/cjs/utils/index.js +0 -6
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
- package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +1 -1
- package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +1 -1
- package/dist/es2019/plugins/layout/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/list/actions/conversions.js +2 -2
- package/dist/es2019/plugins/list/actions/indent-list-items-selected.js +2 -2
- package/dist/es2019/plugins/list/actions/join-list-items-forward.js +1 -1
- package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +1 -2
- package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +2 -2
- package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +2 -2
- package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +1 -1
- package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +1 -1
- package/dist/es2019/plugins/list/actions/merge-lists.js +1 -1
- package/dist/es2019/plugins/list/actions/outdent-list-items-selected.js +3 -3
- package/dist/es2019/plugins/list/actions/wrap-and-join-lists.js +1 -1
- package/dist/es2019/plugins/list/commands/indent-list.js +3 -4
- package/dist/es2019/plugins/list/commands/index.js +4 -5
- package/dist/es2019/plugins/list/commands/join-list-item-forward.js +1 -1
- package/dist/es2019/plugins/list/commands/listBackspace.js +1 -2
- package/dist/es2019/plugins/list/commands/outdent-list.js +3 -2
- package/dist/es2019/plugins/list/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/list/utils/analytics.js +0 -36
- package/dist/es2019/plugins/list/utils/indentation.js +0 -18
- package/dist/es2019/plugins/list/utils/node.js +3 -89
- package/dist/es2019/plugins/list/utils/selection.js +1 -52
- package/dist/es2019/plugins/tasks-and-decisions/commands.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
- package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
- package/dist/es2019/utils/commands.js +2 -102
- package/dist/es2019/utils/document.js +1 -26
- package/dist/es2019/utils/index.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
- package/dist/esm/plugins/block-type/pm-plugins/keymap.js +1 -1
- package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +1 -1
- package/dist/esm/plugins/layout/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/list/actions/conversions.js +2 -2
- package/dist/esm/plugins/list/actions/indent-list-items-selected.js +2 -2
- package/dist/esm/plugins/list/actions/join-list-items-forward.js +1 -1
- package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +1 -2
- package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +2 -2
- package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +2 -2
- package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +1 -1
- package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +1 -1
- package/dist/esm/plugins/list/actions/merge-lists.js +1 -1
- package/dist/esm/plugins/list/actions/outdent-list-items-selected.js +3 -3
- package/dist/esm/plugins/list/actions/wrap-and-join-lists.js +1 -1
- package/dist/esm/plugins/list/commands/indent-list.js +3 -4
- package/dist/esm/plugins/list/commands/index.js +4 -5
- package/dist/esm/plugins/list/commands/join-list-item-forward.js +1 -1
- package/dist/esm/plugins/list/commands/listBackspace.js +1 -2
- package/dist/esm/plugins/list/commands/outdent-list.js +3 -2
- package/dist/esm/plugins/list/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/list/utils/analytics.js +0 -32
- package/dist/esm/plugins/list/utils/indentation.js +0 -17
- package/dist/esm/plugins/list/utils/node.js +3 -81
- package/dist/esm/plugins/list/utils/selection.js +3 -51
- package/dist/esm/plugins/tasks-and-decisions/commands.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
- package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
- package/dist/esm/utils/commands.js +2 -100
- package/dist/esm/utils/document.js +1 -26
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/plugins/list/actions/join-list-items-forward.d.ts +1 -1
- package/dist/types/plugins/list/commands/indent-list.d.ts +2 -1
- package/dist/types/plugins/list/commands/index.d.ts +2 -1
- package/dist/types/plugins/list/commands/join-list-item-forward.d.ts +1 -1
- package/dist/types/plugins/list/commands/listBackspace.d.ts +1 -1
- package/dist/types/plugins/list/commands/outdent-list.d.ts +2 -1
- package/dist/types/plugins/list/utils/analytics.d.ts +2 -4
- package/dist/types/plugins/list/utils/indentation.d.ts +0 -5
- package/dist/types/plugins/list/utils/node.d.ts +2 -17
- package/dist/types/plugins/list/utils/selection.d.ts +1 -12
- package/dist/types/utils/commands.d.ts +3 -32
- package/dist/types/utils/document.d.ts +0 -4
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/list/actions/join-list-items-forward.d.ts +1 -1
- package/dist/types-ts4.5/plugins/list/commands/indent-list.d.ts +2 -1
- package/dist/types-ts4.5/plugins/list/commands/index.d.ts +2 -1
- package/dist/types-ts4.5/plugins/list/commands/join-list-item-forward.d.ts +1 -1
- package/dist/types-ts4.5/plugins/list/commands/listBackspace.d.ts +1 -1
- package/dist/types-ts4.5/plugins/list/commands/outdent-list.d.ts +2 -1
- package/dist/types-ts4.5/plugins/list/utils/analytics.d.ts +2 -4
- package/dist/types-ts4.5/plugins/list/utils/indentation.d.ts +0 -5
- package/dist/types-ts4.5/plugins/list/utils/node.d.ts +2 -17
- package/dist/types-ts4.5/plugins/list/utils/selection.d.ts +1 -12
- package/dist/types-ts4.5/utils/commands.d.ts +3 -38
- package/dist/types-ts4.5/utils/document.d.ts +0 -4
- package/dist/types-ts4.5/utils/index.d.ts +1 -1
- package/package.json +2 -2
- package/report.api.md +0 -3
- package/tmp/api-report-tmp.d.ts +0 -3
- package/dist/cjs/plugins/list/utils/replace-content.js +0 -24
- package/dist/cjs/utils/prosemirror/autojoin.js +0 -68
- package/dist/es2019/plugins/list/utils/replace-content.js +0 -18
- package/dist/es2019/utils/prosemirror/autojoin.js +0 -57
- package/dist/esm/plugins/list/utils/replace-content.js +0 -17
- package/dist/esm/utils/prosemirror/autojoin.js +0 -63
- package/dist/types/plugins/list/utils/replace-content.d.ts +0 -8
- package/dist/types/utils/prosemirror/autojoin.d.ts +0 -13
- package/dist/types-ts4.5/plugins/list/utils/replace-content.d.ts +0 -8
- package/dist/types-ts4.5/utils/prosemirror/autojoin.d.ts +0 -13
|
@@ -5,22 +5,21 @@ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
|
5
5
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import * as baseCommand from '@atlaskit/editor-prosemirror/commands';
|
|
7
7
|
import { findPositionOfNodeBefore, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
8
|
-
import { hasVisibleContent } from '
|
|
9
|
-
import {
|
|
10
|
-
import { filterCommands as filter } from '@atlaskit/editor-common/utils';
|
|
8
|
+
import { filterCommand as filter, hasVisibleContent, isEmptySelectionAtStart } from '@atlaskit/editor-common/utils';
|
|
9
|
+
import { isFirstChildOfParent, findCutBefore } from '../../../utils/commands';
|
|
11
10
|
import { sanitiseMarksInSelection } from '../../../utils';
|
|
11
|
+
import { getCommonListAnalyticsAttributes } from '@atlaskit/editor-common/lists';
|
|
12
12
|
import { liftFollowingList, liftTextSelectionList, liftNodeSelectionList } from '../transforms';
|
|
13
13
|
import { GapCursorSelection } from '../../selection/gap-cursor-selection';
|
|
14
14
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
15
15
|
import { isInsideListItem, canJoinToPreviousListItem, selectionContainsList } from '../utils/selection';
|
|
16
|
-
import { getCommonListAnalyticsAttributes } from '../utils/analytics';
|
|
17
16
|
import { listBackspace } from './listBackspace';
|
|
18
17
|
import { joinListItemForward } from './join-list-item-forward';
|
|
19
18
|
import { convertListType } from '../actions/conversions';
|
|
20
19
|
import { wrapInListAndJoin } from '../actions/wrap-and-join-lists';
|
|
21
20
|
import { outdentList } from './outdent-list';
|
|
22
21
|
import { indentList } from './indent-list';
|
|
23
|
-
import { moveTargetIntoList } from '
|
|
22
|
+
import { moveTargetIntoList } from '@atlaskit/editor-common/lists';
|
|
24
23
|
export { outdentList, indentList };
|
|
25
24
|
export var enterKeyCommand = function enterKeyCommand(editorAnalyticsAPI) {
|
|
26
25
|
return function (featureFlags) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import { isEmptySelectionAtEnd, walkNextNode } from '
|
|
2
|
+
import { isEmptySelectionAtEnd, walkNextNode } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, DELETE_DIRECTION } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { calcJoinListScenario } from '../actions/join-list-items-forward';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
var _BACKSPACE_COMMANDS;
|
|
3
|
-
import { insertContentDeleteRange, isEmptySelectionAtStart, walkPrevNode } from '
|
|
3
|
+
import { insertContentDeleteRange, isEmptySelectionAtStart, walkPrevNode, isListNode, isParagraphNode } from '@atlaskit/editor-common/utils';
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, DELETE_DIRECTION, LIST_TEXT_SCENARIOS } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
6
|
-
import { isListNode, isParagraphNode } from '@atlaskit/editor-common/utils';
|
|
7
6
|
import { isPosInsideList, isPosInsideParagraph } from '../utils/selection';
|
|
8
7
|
//Cases below refer to the cases found in this document: https://product-fabric.atlassian.net/wiki/spaces/E/pages/1146954996/List+Backspace+and+Delete+Behaviour
|
|
9
8
|
//Case for two adjacent list items of the same indentation
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
import { getCommonListAnalyticsAttributes } from '@atlaskit/editor-common/lists';
|
|
4
5
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, OUTDENT_SCENARIOS } from '@atlaskit/editor-common/analytics';
|
|
5
6
|
import { isInsideListItem, isInsideTableCell } from '../utils/selection';
|
|
6
|
-
import { isBulletList } from '
|
|
7
|
+
import { isBulletList } from '@atlaskit/editor-common/utils';
|
|
7
8
|
import { findFirstParentListNode } from '../utils/find';
|
|
8
|
-
import {
|
|
9
|
+
import { getRestartListsAttributes } from '../utils/analytics';
|
|
9
10
|
import { outdentListItemsSelected as outdentListAction } from '../actions/outdent-list-items-selected';
|
|
10
11
|
import { closeHistory } from '@atlaskit/editor-prosemirror/history';
|
|
11
12
|
export var outdentList = function outdentList(editorAnalyticsAPI) {
|
|
@@ -6,7 +6,7 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
|
6
6
|
import { DecorationSet, Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
8
8
|
import { isWrappingPossible } from '../utils/selection';
|
|
9
|
-
import { isListNode } from '
|
|
9
|
+
import { isListNode } from '@atlaskit/editor-common/utils';
|
|
10
10
|
import { pluginFactory } from '../../../utils/plugin-state-factory';
|
|
11
11
|
import { setGapCursorSelection } from '../../../utils';
|
|
12
12
|
import { Side } from '@atlaskit/editor-common/selection';
|
|
@@ -1,38 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
import { isListItemNode, isListNode } from '@atlaskit/editor-common/utils';
|
|
5
|
-
import { getListItemAttributes } from './selection';
|
|
6
|
-
export var getCommonListAnalyticsAttributes = function getCommonListAnalyticsAttributes(state) {
|
|
7
|
-
var _state$selection = state.selection,
|
|
8
|
-
$from = _state$selection.$from,
|
|
9
|
-
$to = _state$selection.$to;
|
|
10
|
-
var fromAttrs = getListItemAttributes($from);
|
|
11
|
-
var toAttrs = getListItemAttributes($to);
|
|
12
|
-
return {
|
|
13
|
-
itemIndexAtSelectionStart: fromAttrs.itemIndex,
|
|
14
|
-
itemIndexAtSelectionEnd: toAttrs.itemIndex,
|
|
15
|
-
indentLevelAtSelectionStart: fromAttrs.indentLevel,
|
|
16
|
-
indentLevelAtSelectionEnd: toAttrs.indentLevel,
|
|
17
|
-
itemsInSelection: countListItemsInSelection(state)
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export var countListItemsInSelection = function countListItemsInSelection(state) {
|
|
21
|
-
var _state$selection2 = state.selection,
|
|
22
|
-
from = _state$selection2.from,
|
|
23
|
-
to = _state$selection2.to;
|
|
24
|
-
if (from === to) {
|
|
25
|
-
return 1;
|
|
26
|
-
}
|
|
27
|
-
var count = 0;
|
|
28
|
-
var listSlice = state.doc.cut(from, to);
|
|
29
|
-
listSlice.content.nodesBetween(0, listSlice.content.size, function (node, pos, parent, index) {
|
|
30
|
-
if (parent && isListItemNode(parent) && !isListNode(node) && index === 0) {
|
|
31
|
-
count++;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
return count;
|
|
35
|
-
};
|
|
36
4
|
export var RESTART_LISTS_ANALYTICS_KEY = 'restartListsAnalytics';
|
|
37
5
|
export var getRestartListsAttributes = function getRestartListsAttributes(tr) {
|
|
38
6
|
var _tr$getMeta;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { numberNestedLists } from './selection';
|
|
2
1
|
import { isListItemNode, isListNode } from '@atlaskit/editor-common/utils';
|
|
3
2
|
|
|
4
3
|
// This will return (depth - 1) for root list parent of a list.
|
|
@@ -14,20 +13,4 @@ export var getListLiftTarget = function getListLiftTarget(resPos) {
|
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
15
|
return target - 1;
|
|
17
|
-
};
|
|
18
|
-
export var hasValidListIndentationLevel = function hasValidListIndentationLevel(_ref) {
|
|
19
|
-
var tr = _ref.tr,
|
|
20
|
-
maxIndentation = _ref.maxIndentation;
|
|
21
|
-
var initialIndentationLevel = numberNestedLists(tr.selection.$from);
|
|
22
|
-
var currentIndentationLevel;
|
|
23
|
-
var currentPos = tr.selection.$to.pos;
|
|
24
|
-
do {
|
|
25
|
-
var resolvedPos = tr.doc.resolve(currentPos);
|
|
26
|
-
currentIndentationLevel = numberNestedLists(resolvedPos);
|
|
27
|
-
if (currentIndentationLevel > maxIndentation) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
currentPos++;
|
|
31
|
-
} while (currentIndentationLevel >= initialIndentationLevel);
|
|
32
|
-
return true;
|
|
33
16
|
};
|
|
@@ -1,88 +1,10 @@
|
|
|
1
1
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function isListNodeValidContent(node) {
|
|
2
|
+
import { isListItemNode } from '@atlaskit/editor-common/utils';
|
|
3
|
+
export function isListNodeValidContent(node) {
|
|
5
4
|
var bulletList = node.type.schema.nodes.bulletList;
|
|
6
5
|
if (!bulletList) {
|
|
7
6
|
return false;
|
|
8
7
|
}
|
|
9
8
|
var listFragment = Fragment.from(bulletList.createAndFill());
|
|
10
9
|
return !isListItemNode(node) && node.type.validContent(listFragment);
|
|
11
|
-
}
|
|
12
|
-
export var JoinDirection = /*#__PURE__*/function (JoinDirection) {
|
|
13
|
-
JoinDirection[JoinDirection["LEFT"] = 1] = "LEFT";
|
|
14
|
-
JoinDirection[JoinDirection["RIGHT"] = -1] = "RIGHT";
|
|
15
|
-
return JoinDirection;
|
|
16
|
-
}({});
|
|
17
|
-
export var joinSiblingLists = function joinSiblingLists(_ref) {
|
|
18
|
-
var tr = _ref.tr,
|
|
19
|
-
direction = _ref.direction,
|
|
20
|
-
forceListType = _ref.forceListType;
|
|
21
|
-
var result = {
|
|
22
|
-
orderedList: 0,
|
|
23
|
-
bulletList: 0
|
|
24
|
-
};
|
|
25
|
-
var doc = tr.doc,
|
|
26
|
-
_tr$selection = tr.selection,
|
|
27
|
-
$from = _tr$selection.$from,
|
|
28
|
-
$to = _tr$selection.$to,
|
|
29
|
-
selection = tr.selection;
|
|
30
|
-
var range = $from.blockRange($to, isListNodeValidContent);
|
|
31
|
-
if (!range) {
|
|
32
|
-
return result;
|
|
33
|
-
}
|
|
34
|
-
var rootListNode = doc.nodeAt(range.start);
|
|
35
|
-
var from = isListNode(rootListNode) ? range.start : 0;
|
|
36
|
-
var to = isListNode(rootListNode) ? range.end : tr.doc.content.size;
|
|
37
|
-
var joins = [];
|
|
38
|
-
doc.nodesBetween(from, to, function (node, pos, parent) {
|
|
39
|
-
var resolvedPos = doc.resolve(pos);
|
|
40
|
-
var nodeBefore = resolvedPos.nodeBefore,
|
|
41
|
-
nodeAfter = resolvedPos.nodeAfter;
|
|
42
|
-
if (!nodeBefore || !nodeAfter || !isListNode(nodeBefore) || !isListNode(nodeAfter)) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
var isNestedList = isListItemNode(parent);
|
|
46
|
-
if (!isNestedList && nodeBefore.type !== nodeAfter.type && !forceListType) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
var index = resolvedPos.index();
|
|
50
|
-
var positionPreviousNode = resolvedPos.posAtIndex(index - 1);
|
|
51
|
-
var positionCurrentNode = resolvedPos.posAtIndex(index);
|
|
52
|
-
|
|
53
|
-
// If the previous node is part of the selection, OR
|
|
54
|
-
// If the previous node is not part of the selection and the previous node has the same list type that we’re converting to
|
|
55
|
-
var joinBefore = positionPreviousNode >= from || nodeBefore.type === forceListType;
|
|
56
|
-
if (forceListType) {
|
|
57
|
-
if (joinBefore) {
|
|
58
|
-
tr.setNodeMarkup(positionPreviousNode, forceListType);
|
|
59
|
-
}
|
|
60
|
-
tr.setNodeMarkup(positionCurrentNode, forceListType);
|
|
61
|
-
}
|
|
62
|
-
if (isNestedList && nodeBefore.type !== nodeAfter.type) {
|
|
63
|
-
var nodeType = direction === JoinDirection.RIGHT ? nodeAfter.type : nodeBefore.type;
|
|
64
|
-
tr.setNodeMarkup(positionPreviousNode, nodeType);
|
|
65
|
-
}
|
|
66
|
-
if (joinBefore) {
|
|
67
|
-
joins.push(pos);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
if (selection.empty && rootListNode && isListNode(rootListNode)) {
|
|
71
|
-
var resolvedPos = doc.resolve(range.start + rootListNode.nodeSize);
|
|
72
|
-
var nodeBefore = resolvedPos.nodeBefore,
|
|
73
|
-
nodeAfter = resolvedPos.nodeAfter;
|
|
74
|
-
if (nodeBefore && nodeAfter && isListNode(nodeBefore) && isListNode(nodeAfter) && nodeAfter.type === nodeBefore.type) {
|
|
75
|
-
joins.push(resolvedPos.pos);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
for (var i = joins.length - 1; i >= 0; i--) {
|
|
79
|
-
var listNode = tr.doc.nodeAt(joins[i]);
|
|
80
|
-
var listName = listNode === null || listNode === void 0 ? void 0 : listNode.type.name;
|
|
81
|
-
if (listName && (listName === 'orderedList' || listName === 'bulletList')) {
|
|
82
|
-
var amount = result[listName] || 0;
|
|
83
|
-
result[listName] = amount + 1;
|
|
84
|
-
}
|
|
85
|
-
tr.join(joins[i]);
|
|
86
|
-
}
|
|
87
|
-
return result;
|
|
88
|
-
};
|
|
10
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { findWrapping } from '@atlaskit/editor-prosemirror/transform';
|
|
2
|
-
import {
|
|
3
|
-
import { findParentNodeClosestToPos, findParentNodeOfType, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
2
|
+
import { findParentNodeOfType, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
4
3
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
5
4
|
import { isListItemNode, isListNode, isParagraphNode } from '@atlaskit/editor-common/utils';
|
|
6
5
|
export var isPosInsideParagraph = function isPosInsideParagraph($pos) {
|
|
@@ -70,55 +69,8 @@ export var selectionContainsList = function selectionContainsList(tr) {
|
|
|
70
69
|
});
|
|
71
70
|
return foundListNode;
|
|
72
71
|
};
|
|
73
|
-
export var
|
|
74
|
-
var
|
|
75
|
-
for (var i = resolvedPos.depth - 1; i > 0; i--) {
|
|
76
|
-
var node = resolvedPos.node(i);
|
|
77
|
-
if (isListNode(node)) {
|
|
78
|
-
count += 1;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return count;
|
|
82
|
-
};
|
|
83
|
-
export var getListItemAttributes = function getListItemAttributes($pos) {
|
|
84
|
-
var indentLevel = numberNestedLists($pos) - 1;
|
|
85
|
-
var itemAtPos = findParentNodeClosestToPos($pos, isListItemNode);
|
|
86
|
-
|
|
87
|
-
// Get the index of the current item relative to parent (parent is at item depth - 1)
|
|
88
|
-
var itemIndex = $pos.index(itemAtPos ? itemAtPos.depth - 1 : undefined);
|
|
89
|
-
return {
|
|
90
|
-
indentLevel: indentLevel,
|
|
91
|
-
itemIndex: itemIndex
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
export var normalizeListItemsSelection = function normalizeListItemsSelection(_ref) {
|
|
95
|
-
var selection = _ref.selection,
|
|
96
|
-
doc = _ref.doc;
|
|
97
|
-
if (selection.empty) {
|
|
98
|
-
return selection;
|
|
99
|
-
}
|
|
100
|
-
var $from = selection.$from,
|
|
101
|
-
$to = selection.$to;
|
|
102
|
-
if (selection instanceof NodeSelection) {
|
|
103
|
-
var _head = resolvePositionToStartOfListItem($from);
|
|
104
|
-
return new TextSelection(_head, _head);
|
|
105
|
-
}
|
|
106
|
-
var head = resolvePositionToStartOfListItem($from);
|
|
107
|
-
var anchor = resolvePositionToEndOfListItem($to);
|
|
108
|
-
return new TextSelection(anchor, head);
|
|
109
|
-
};
|
|
110
|
-
var resolvePositionToStartOfListItem = function resolvePositionToStartOfListItem($pos) {
|
|
111
|
-
var fromRange = $pos.blockRange($pos, isListItemNode);
|
|
112
|
-
var fromPosition = fromRange && $pos.textOffset === 0 && fromRange.end - 1 === $pos.pos ? Selection.near($pos.doc.resolve(fromRange.end + 1), 1).$from : $pos;
|
|
113
|
-
return fromPosition;
|
|
114
|
-
};
|
|
115
|
-
var resolvePositionToEndOfListItem = function resolvePositionToEndOfListItem($pos) {
|
|
116
|
-
var toRange = $pos.blockRange($pos, isListItemNode);
|
|
117
|
-
var toPosition = toRange && $pos.textOffset === 0 && toRange.start + 1 === $pos.pos ? Selection.near($pos.doc.resolve(toRange.start - 1), -1).$to : $pos;
|
|
118
|
-
return toPosition;
|
|
119
|
-
};
|
|
120
|
-
export var createListNodeRange = function createListNodeRange(_ref2) {
|
|
121
|
-
var selection = _ref2.selection;
|
|
72
|
+
export var createListNodeRange = function createListNodeRange(_ref) {
|
|
73
|
+
var selection = _ref.selection;
|
|
122
74
|
var $from = selection.$from,
|
|
123
75
|
$to = selection.$to;
|
|
124
76
|
var range = $from.blockRange($to, isListNode);
|
|
@@ -6,7 +6,7 @@ import { uuid } from '@atlaskit/adf-schema';
|
|
|
6
6
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE, INPUT_METHOD, USER_CONTEXT } from '../analytics';
|
|
7
7
|
import { GapCursorSelection } from '../selection/gap-cursor-selection';
|
|
8
8
|
import { stateKey as taskDecisionStateKey } from './pm-plugins/plugin-key';
|
|
9
|
-
import { autoJoinTr } from '
|
|
9
|
+
import { autoJoinTr } from '@atlaskit/editor-common/utils';
|
|
10
10
|
var getContextData = function getContextData() {
|
|
11
11
|
var contextProvider = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
12
12
|
var objectId = contextProvider.objectId,
|
|
@@ -7,8 +7,7 @@ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
|
7
7
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
8
|
import { findParentNodeOfType, findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
9
9
|
import { uuid } from '@atlaskit/adf-schema';
|
|
10
|
-
import { isEmptySelectionAtStart, deleteEmptyParagraphAndMoveBlockUp, isEmptySelectionAtEnd } from '
|
|
11
|
-
import { filterCommands as filter } from '@atlaskit/editor-common/utils';
|
|
10
|
+
import { filterCommand as filter, isEmptySelectionAtStart, deleteEmptyParagraphAndMoveBlockUp, isEmptySelectionAtEnd } from '@atlaskit/editor-common/utils';
|
|
12
11
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INDENT_DIRECTION, INDENT_TYPE, INPUT_METHOD, withAnalytics } from '../../analytics';
|
|
13
12
|
import { insertTaskDecisionWithAnalytics } from '../commands';
|
|
14
13
|
import { joinAtCut, liftSelection, wrapSelectionInTaskList } from './commands';
|
|
@@ -2,9 +2,10 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
|
2
2
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import { shallowEqual } from '@atlaskit/editor-common/utils';
|
|
5
|
-
import {
|
|
5
|
+
import { isInsideListItem } from '../../list/utils/selection';
|
|
6
6
|
import { getCurrentIndentLevel as getTaskListIndentLevel, getTaskItemIndex, isInsideTask } from '../../tasks-and-decisions/pm-plugins/helpers';
|
|
7
7
|
import { isIndentationAllowed, MAX_INDENTATION_LEVEL } from '../../indentation/commands';
|
|
8
|
+
import { getListItemAttributes } from '@atlaskit/editor-common/lists';
|
|
8
9
|
export var pluginKey = new PluginKey('indentationButtonsPlugin');
|
|
9
10
|
function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndentation) {
|
|
10
11
|
var state = {
|
|
@@ -1,19 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
1
|
+
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
2
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
4
|
-
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
5
|
-
var isEmptySelectionAtStart = function isEmptySelectionAtStart(state) {
|
|
6
|
-
var _state$selection = state.selection,
|
|
7
|
-
empty = _state$selection.empty,
|
|
8
|
-
$from = _state$selection.$from;
|
|
9
|
-
return empty && ($from.parentOffset === 0 || state.selection instanceof GapCursorSelection);
|
|
10
|
-
};
|
|
11
|
-
var isEmptySelectionAtEnd = function isEmptySelectionAtEnd(state) {
|
|
12
|
-
var _state$selection2 = state.selection,
|
|
13
|
-
empty = _state$selection2.empty,
|
|
14
|
-
$from = _state$selection2.$from;
|
|
15
|
-
return empty && ($from.end() === $from.pos || state.selection instanceof GapCursorSelection);
|
|
16
|
-
};
|
|
17
3
|
var isFirstChildOfParent = function isFirstChildOfParent(state) {
|
|
18
4
|
var $from = state.selection.$from;
|
|
19
5
|
return $from.depth > 1 ? state.selection instanceof GapCursorSelection && $from.parentOffset === 0 || $from.index($from.depth - 1) === 0 : true;
|
|
@@ -68,44 +54,6 @@ var withScrollIntoView = function withScrollIntoView(command) {
|
|
|
68
54
|
}, view);
|
|
69
55
|
};
|
|
70
56
|
};
|
|
71
|
-
/**
|
|
72
|
-
* Walk forwards from a position until we encounter the (inside) start of
|
|
73
|
-
* the next node, or reach the end of the document.
|
|
74
|
-
*
|
|
75
|
-
* @param $startPos Position to start walking from.
|
|
76
|
-
*/
|
|
77
|
-
var walkNextNode = function walkNextNode($startPos) {
|
|
78
|
-
var $pos = $startPos;
|
|
79
|
-
|
|
80
|
-
// invariant 1: don't walk past the end of the document
|
|
81
|
-
// invariant 2: we are at the beginning or
|
|
82
|
-
// we haven't walked to the start of *any* node
|
|
83
|
-
// parentOffset includes textOffset.
|
|
84
|
-
while ($pos.pos < $pos.doc.nodeSize - 2 && ($pos.pos === $startPos.pos || $pos.parentOffset > 0)) {
|
|
85
|
-
$pos = $pos.doc.resolve($pos.pos + 1);
|
|
86
|
-
}
|
|
87
|
-
return {
|
|
88
|
-
$pos: $pos,
|
|
89
|
-
foundNode: $pos.pos < $pos.doc.nodeSize - 2
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Walk backwards from a position until we encounter the (inside) end of
|
|
95
|
-
* the previous node, or reach the start of the document.
|
|
96
|
-
*
|
|
97
|
-
* @param $startPos Position to start walking from.
|
|
98
|
-
*/
|
|
99
|
-
var walkPrevNode = function walkPrevNode($startPos) {
|
|
100
|
-
var $pos = $startPos;
|
|
101
|
-
while ($pos.pos > 0 && ($pos.pos === $startPos.pos || $pos.parentOffset < $pos.parent.nodeSize - 2)) {
|
|
102
|
-
$pos = $pos.doc.resolve($pos.pos - 1);
|
|
103
|
-
}
|
|
104
|
-
return {
|
|
105
|
-
$pos: $pos,
|
|
106
|
-
foundNode: $pos.pos > 0
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
57
|
|
|
110
58
|
/**
|
|
111
59
|
* Insert content, delete a range and create a new selection
|
|
@@ -117,21 +65,6 @@ var walkPrevNode = function walkPrevNode($startPos) {
|
|
|
117
65
|
* @param deletions the ranges to delete
|
|
118
66
|
*/
|
|
119
67
|
|
|
120
|
-
var insertContentDeleteRange = function insertContentDeleteRange(tr, getSelectionResolvedPos, insertions, deletions) {
|
|
121
|
-
insertions.forEach(function (contentInsert) {
|
|
122
|
-
var _contentInsert = _slicedToArray(contentInsert, 2),
|
|
123
|
-
content = _contentInsert[0],
|
|
124
|
-
pos = _contentInsert[1];
|
|
125
|
-
tr.insert(tr.mapping.map(pos), content);
|
|
126
|
-
});
|
|
127
|
-
deletions.forEach(function (deleteRange) {
|
|
128
|
-
var _deleteRange = _slicedToArray(deleteRange, 2),
|
|
129
|
-
firstPos = _deleteRange[0],
|
|
130
|
-
lastPos = _deleteRange[1];
|
|
131
|
-
tr.delete(tr.mapping.map(firstPos), tr.mapping.map(lastPos));
|
|
132
|
-
});
|
|
133
|
-
tr.setSelection(new TextSelection(getSelectionResolvedPos(tr)));
|
|
134
|
-
};
|
|
135
68
|
var selectNode = function selectNode(pos) {
|
|
136
69
|
return function (state, dispatch) {
|
|
137
70
|
if (dispatch) {
|
|
@@ -140,35 +73,4 @@ var selectNode = function selectNode(pos) {
|
|
|
140
73
|
return true;
|
|
141
74
|
};
|
|
142
75
|
};
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* If the selection is empty, is inside a paragraph node and `canNextNodeMoveUp` is true then delete current paragraph
|
|
146
|
-
* and move the node below it up. The selection will be retained, to be placed in the moved node.
|
|
147
|
-
*
|
|
148
|
-
* @param canNextNodeMoveUp check if node directly after the selection is able to be brought up to selection
|
|
149
|
-
* @returns PM Command
|
|
150
|
-
*/
|
|
151
|
-
var deleteEmptyParagraphAndMoveBlockUp = function deleteEmptyParagraphAndMoveBlockUp(canNextNodeMoveUp) {
|
|
152
|
-
return function (state, dispatch, view) {
|
|
153
|
-
var _state$selection3 = state.selection,
|
|
154
|
-
_state$selection3$$fr = _state$selection3.$from,
|
|
155
|
-
pos = _state$selection3$$fr.pos,
|
|
156
|
-
parent = _state$selection3$$fr.parent,
|
|
157
|
-
$head = _state$selection3.$head,
|
|
158
|
-
empty = _state$selection3.empty,
|
|
159
|
-
tr = state.tr,
|
|
160
|
-
doc = state.doc;
|
|
161
|
-
var _walkNextNode = walkNextNode($head),
|
|
162
|
-
$pos = _walkNextNode.$pos;
|
|
163
|
-
var nextPMNode = doc.nodeAt($pos.pos - 1);
|
|
164
|
-
if (empty && nextPMNode && canNextNodeMoveUp(nextPMNode) && isEmptyParagraph(parent) && view !== null && view !== void 0 && view.endOfTextblock('right')) {
|
|
165
|
-
tr.deleteRange(pos - 1, pos + 1);
|
|
166
|
-
if (dispatch) {
|
|
167
|
-
dispatch(tr);
|
|
168
|
-
}
|
|
169
|
-
return true;
|
|
170
|
-
}
|
|
171
|
-
return false;
|
|
172
|
-
};
|
|
173
|
-
};
|
|
174
|
-
export { isEmptySelectionAtStart, isEmptySelectionAtEnd, isFirstChildOfParent, isNthParentOfType, findCutBefore, withScrollIntoView, walkNextNode, walkPrevNode, insertContentDeleteRange, selectNode, deleteEmptyParagraphAndMoveBlockUp };
|
|
76
|
+
export { isFirstChildOfParent, isNthParentOfType, findCutBefore, withScrollIntoView, selectNode };
|
|
@@ -1,32 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
4
3
|
import { getBreakoutMode } from './node-width';
|
|
5
|
-
import { processRawValue, hasDocAsParent, getStepRange } from '@atlaskit/editor-common/utils';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Returns false if node contains only empty inline nodes and hardBreaks.
|
|
9
|
-
*/
|
|
10
|
-
export function hasVisibleContent(node) {
|
|
11
|
-
var isInlineNodeHasVisibleContent = function isInlineNodeHasVisibleContent(inlineNode) {
|
|
12
|
-
return inlineNode.isText ? !!inlineNode.textContent.trim() : inlineNode.type.name !== 'hardBreak';
|
|
13
|
-
};
|
|
14
|
-
if (node.isInline) {
|
|
15
|
-
return isInlineNodeHasVisibleContent(node);
|
|
16
|
-
} else if (node.isBlock && (node.isLeaf || node.isAtom)) {
|
|
17
|
-
return true;
|
|
18
|
-
} else if (!node.childCount) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
for (var _index = 0; _index < node.childCount; _index++) {
|
|
22
|
-
var child = node.child(_index);
|
|
23
|
-
var invisibleNodeTypes = ['paragraph', 'text', 'hardBreak'];
|
|
24
|
-
if (!invisibleNodeTypes.includes(child.type.name) || hasVisibleContent(child)) {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
4
|
+
import { processRawValue, hasDocAsParent, getStepRange, isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
30
5
|
|
|
31
6
|
/**
|
|
32
7
|
* Checks if a node has any content. Ignores node that only contain empty block nodes.
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { isNodeEmpty } from './document';
|
|
|
7
7
|
import { atTheBeginningOfDoc, atTheEndOfDoc } from './prosemirror/position';
|
|
8
8
|
import { isMediaNode } from '@atlaskit/editor-common/utils';
|
|
9
9
|
export { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
10
|
-
export {
|
|
10
|
+
export { isNodeEmpty, findFarthestParentNode, isSelectionEndOfParagraph, nodesBetweenChanged, getNodesCount } from './document';
|
|
11
11
|
export { sanitiseMarksInSelection } from './mark';
|
|
12
12
|
export { isParagraph, isText, isLinkMark } from './nodes';
|
|
13
13
|
export { setNodeSelection, setGapCursorSelection, setTextSelection } from './selection';
|
package/dist/esm/version.json
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export { historyPluginKey } from './plugins/history';
|
|
|
58
58
|
export { INPUT_METHOD, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, } from '@atlaskit/editor-common/analytics';
|
|
59
59
|
export type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
60
60
|
export { setKeyboardHeight, setMobilePaddingTop, setIsExpanded, } from './plugins/mobile-dimensions/commands';
|
|
61
|
-
export { setTextSelection, dedupe, getNodesCount, measurements
|
|
61
|
+
export { setTextSelection, dedupe, getNodesCount, measurements } from './utils';
|
|
62
62
|
export { getListCommands } from './utils/list-commands';
|
|
63
63
|
export { ReactEditorView, BaseReactEditorView } from './create-editor';
|
|
64
64
|
export { getDefaultPresetOptionsFromEditorProps } from './create-editor';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WalkNode } from '
|
|
1
|
+
import type { WalkNode } from '@atlaskit/editor-common/utils';
|
|
2
2
|
import { LIST_TEXT_SCENARIOS } from '../../analytics';
|
|
3
3
|
import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Command } from '../../../types';
|
|
2
|
-
import { EditorAnalyticsAPI
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
|
|
4
5
|
export declare const indentList: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: InputMethod) => Command;
|
|
5
6
|
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ResolvedPos, NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import type { Command } from '../../../types';
|
|
4
|
-
import {
|
|
4
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
5
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
6
|
import { outdentList } from './outdent-list';
|
|
6
7
|
import { indentList } from './indent-list';
|
|
7
8
|
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
1
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { Command } from '../../../types';
|
|
3
3
|
export declare const joinListItemForward: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WalkNode } from '
|
|
1
|
+
import type { WalkNode } from '@atlaskit/editor-common/utils';
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { LIST_TEXT_SCENARIOS } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { Command } from '../../../types';
|
|
2
|
-
import { INPUT_METHOD
|
|
3
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
5
|
type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
|
|
5
6
|
export declare const outdentList: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: InputMethod | undefined, featureFlags: FeatureFlags) => Command;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { RestartListsAttributesForListOutdented
|
|
3
|
-
export declare const getCommonListAnalyticsAttributes: (state: EditorState) => CommonListAnalyticsAttributes;
|
|
4
|
-
export declare const countListItemsInSelection: (state: EditorState) => number;
|
|
1
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
import type { RestartListsAttributesForListOutdented } from '@atlaskit/editor-common/analytics';
|
|
5
3
|
export declare const RESTART_LISTS_ANALYTICS_KEY = "restartListsAnalytics";
|
|
6
4
|
export declare const getRestartListsAttributes: (tr: Transaction) => RestartListsAttributesForListOutdented;
|
|
7
5
|
export declare const storeRestartListsAttributes: (tr: Transaction, attributes: RestartListsAttributesForListOutdented) => void;
|
|
@@ -1,7 +1,2 @@
|
|
|
1
1
|
import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
2
|
export declare const getListLiftTarget: (resPos: ResolvedPos) => number;
|
|
4
|
-
export declare const hasValidListIndentationLevel: ({ tr, maxIndentation, }: {
|
|
5
|
-
tr: Transaction;
|
|
6
|
-
maxIndentation: number;
|
|
7
|
-
}) => boolean;
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
export { isListNode, isListItemNode, isBulletList, isParagraphNode, } from '@atlaskit/editor-common/utils';
|
|
4
|
-
export declare enum JoinDirection {
|
|
5
|
-
LEFT = 1,
|
|
6
|
-
RIGHT = -1
|
|
7
|
-
}
|
|
8
|
-
type JoinSiblingListsProps = {
|
|
9
|
-
tr: Transaction;
|
|
10
|
-
direction?: JoinDirection;
|
|
11
|
-
forceListType?: NodeType;
|
|
12
|
-
};
|
|
13
|
-
type ListsJoined = {
|
|
14
|
-
orderedList: number;
|
|
15
|
-
bulletList: number;
|
|
16
|
-
};
|
|
17
|
-
export declare const joinSiblingLists: ({ tr, direction, forceListType, }: JoinSiblingListsProps) => ListsJoined;
|
|
1
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
export declare function isListNodeValidContent(node: PMNode): boolean;
|