@atlaskit/editor-core 187.44.3 → 187.44.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 +16 -0
- package/dist/cjs/plugins/expand/pm-plugins/keymap.js +2 -2
- package/dist/cjs/plugins/floating-toolbar/ui/Dropdown.js +5 -3
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +2 -1
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +3 -1
- package/dist/cjs/plugins/media/pm-plugins/keymap-media-single.js +2 -2
- package/dist/cjs/plugins/media/pm-plugins/main.js +1 -2
- package/dist/cjs/plugins/media/toolbar/index.js +2 -2
- package/dist/cjs/plugins/media/ui/CaptionPlaceholder/index.js +4 -5
- package/dist/cjs/plugins/media/utils/media-common.js +7 -8
- package/dist/cjs/plugins/media/utils/media-files.js +6 -6
- package/dist/cjs/plugins/media/utils/media-single.js +2 -2
- package/dist/cjs/plugins/placeholder-text/index.js +1 -1
- package/dist/cjs/plugins/selection/commands.js +2 -3
- package/dist/cjs/plugins/selection/gap-cursor/actions.js +10 -11
- package/dist/cjs/plugins/selection/gap-cursor/utils.js +3 -3
- package/dist/cjs/plugins/selection/plugin-factory.js +5 -5
- package/dist/cjs/plugins/selection/pm-plugins/events/create-selection-between.js +10 -3
- package/dist/cjs/plugins/selection/pm-plugins/keymap.js +1 -1
- package/dist/cjs/plugins/selection/utils.js +1 -2
- package/dist/cjs/utils/commands.js +2 -22
- package/dist/cjs/utils/document.js +0 -20
- package/dist/cjs/utils/index.js +0 -6
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/expand/pm-plugins/keymap.js +1 -1
- package/dist/es2019/plugins/floating-toolbar/ui/Dropdown.js +5 -3
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +2 -1
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +4 -2
- package/dist/es2019/plugins/media/pm-plugins/keymap-media-single.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/main.js +1 -2
- package/dist/es2019/plugins/media/toolbar/index.js +3 -3
- package/dist/es2019/plugins/media/ui/CaptionPlaceholder/index.js +2 -2
- package/dist/es2019/plugins/media/utils/media-common.js +1 -2
- package/dist/es2019/plugins/media/utils/media-files.js +1 -1
- package/dist/es2019/plugins/media/utils/media-single.js +1 -1
- package/dist/es2019/plugins/placeholder-text/index.js +1 -1
- package/dist/es2019/plugins/selection/commands.js +1 -2
- package/dist/es2019/plugins/selection/gap-cursor/actions.js +2 -4
- package/dist/es2019/plugins/selection/gap-cursor/utils.js +2 -2
- package/dist/es2019/plugins/selection/plugin-factory.js +1 -1
- package/dist/es2019/plugins/selection/pm-plugins/events/create-selection-between.js +10 -3
- package/dist/es2019/plugins/selection/pm-plugins/keymap.js +1 -1
- package/dist/es2019/plugins/selection/utils.js +1 -3
- package/dist/es2019/utils/commands.js +1 -19
- package/dist/es2019/utils/document.js +0 -18
- package/dist/es2019/utils/index.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/expand/pm-plugins/keymap.js +1 -1
- package/dist/esm/plugins/floating-toolbar/ui/Dropdown.js +5 -3
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +2 -1
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +4 -2
- package/dist/esm/plugins/media/pm-plugins/keymap-media-single.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/main.js +1 -2
- package/dist/esm/plugins/media/toolbar/index.js +3 -3
- package/dist/esm/plugins/media/ui/CaptionPlaceholder/index.js +2 -2
- package/dist/esm/plugins/media/utils/media-common.js +1 -2
- package/dist/esm/plugins/media/utils/media-files.js +1 -1
- package/dist/esm/plugins/media/utils/media-single.js +1 -1
- package/dist/esm/plugins/placeholder-text/index.js +1 -1
- package/dist/esm/plugins/selection/commands.js +1 -2
- package/dist/esm/plugins/selection/gap-cursor/actions.js +2 -4
- package/dist/esm/plugins/selection/gap-cursor/utils.js +2 -2
- package/dist/esm/plugins/selection/plugin-factory.js +1 -1
- package/dist/esm/plugins/selection/pm-plugins/events/create-selection-between.js +10 -3
- package/dist/esm/plugins/selection/pm-plugins/keymap.js +1 -1
- package/dist/esm/plugins/selection/utils.js +1 -3
- package/dist/esm/utils/commands.js +1 -21
- package/dist/esm/utils/document.js +0 -20
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/floating-toolbar/ui/Dropdown.d.ts +1 -0
- package/dist/types/plugins/media/ui/CaptionPlaceholder/index.d.ts +0 -1
- package/dist/types/plugins/media/utils/media-files.d.ts +1 -2
- package/dist/types/plugins/selection/commands.d.ts +2 -2
- package/dist/types/plugins/selection/gap-cursor/actions.d.ts +1 -1
- package/dist/types/plugins/selection/pm-plugins/selection-main.d.ts +1 -1
- package/dist/types/utils/commands.d.ts +2 -12
- package/dist/types/utils/document.d.ts +0 -4
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/Dropdown.d.ts +1 -0
- package/dist/types-ts4.5/plugins/media/ui/CaptionPlaceholder/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/media/utils/media-files.d.ts +1 -2
- package/dist/types-ts4.5/plugins/selection/commands.d.ts +2 -2
- package/dist/types-ts4.5/plugins/selection/gap-cursor/actions.d.ts +1 -1
- package/dist/types-ts4.5/plugins/selection/pm-plugins/selection-main.d.ts +1 -1
- package/dist/types-ts4.5/utils/commands.d.ts +2 -12
- 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/dist/cjs/utils/prosemirror/position.js +0 -42
- package/dist/cjs/utils/table.js +0 -28
- package/dist/es2019/utils/prosemirror/position.js +0 -1
- package/dist/es2019/utils/table.js +0 -22
- package/dist/esm/utils/prosemirror/position.js +0 -1
- package/dist/esm/utils/table.js +0 -22
- package/dist/types/utils/prosemirror/position.d.ts +0 -1
- package/dist/types/utils/table.d.ts +0 -2
- package/dist/types-ts4.5/utils/prosemirror/position.d.ts +0 -1
- package/dist/types-ts4.5/utils/table.d.ts +0 -2
|
@@ -11,7 +11,7 @@ import { mapSlice } from '../../../utils/slice';
|
|
|
11
11
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
12
12
|
import { safeInsert, shouldSplitSelectedNodeOnNodeInsertion } from '@atlaskit/editor-common/insert';
|
|
13
13
|
import { isImage } from './is-image';
|
|
14
|
-
import { atTheBeginningOfBlock } from '
|
|
14
|
+
import { atTheBeginningOfBlock } from '@atlaskit/editor-common/selection';
|
|
15
15
|
import { getRandomHex } from '@atlaskit/media-common';
|
|
16
16
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
17
17
|
var getInsertMediaAnalytics = function getInsertMediaAnalytics(inputMethod, fileExtension) {
|
|
@@ -4,7 +4,7 @@ import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state
|
|
|
4
4
|
import { placeholder } from '@atlaskit/adf-schema';
|
|
5
5
|
import MediaServicesTextIcon from '@atlaskit/icon/glyph/media-services/text';
|
|
6
6
|
import WithPluginState from '../../ui/WithPluginState';
|
|
7
|
-
import { isNodeEmpty } from '
|
|
7
|
+
import { isNodeEmpty } from '@atlaskit/editor-common/utils';
|
|
8
8
|
import { FakeTextCursorSelection } from '../fake-text-cursor/cursor';
|
|
9
9
|
import PlaceholderFloatingToolbar from './ui/PlaceholderFloatingToolbar';
|
|
10
10
|
import { hidePlaceholderFloatingToolbar, insertPlaceholderTextAtSelection } from './actions';
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { NodeSelection, TextSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { GapCursorSelection, Side } from './gap-cursor-selection';
|
|
3
3
|
import { isIgnored as isIgnoredByGapCursor } from '../selection/gap-cursor/utils/is-ignored';
|
|
4
|
-
import { isNodeEmpty } from '
|
|
5
|
-
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
4
|
+
import { isNodeEmpty, isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
6
5
|
import { SelectionActionTypes } from './actions';
|
|
7
6
|
import { createCommand, getPluginState } from './plugin-factory';
|
|
8
7
|
import { isSelectableContainerNode, isSelectionAtEndOfParentNode, findSelectableContainerParent, isSelectionAtStartOfParentNode, findSelectableContainerBefore, findSelectableContainerAfter, findFirstChildNodeToSelect, findLastChildNodeToSelect } from './utils';
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { findDomRefAtPos, findPositionOfNodeBefore, removeNodeBefore } from '@atlaskit/editor-prosemirror/utils';
|
|
3
|
-
import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
|
|
4
3
|
import { Direction, isBackward, isForward } from './direction';
|
|
5
4
|
import { GapCursorSelection, Side } from './selection';
|
|
6
5
|
import { isTextBlockNearPos } from './utils';
|
|
7
6
|
import { isValidTargetNode } from './utils/is-valid-target-node';
|
|
8
|
-
import { atTheBeginningOfDoc, atTheEndOfDoc } from '
|
|
7
|
+
import { atTheBeginningOfDoc, atTheEndOfDoc } from '@atlaskit/editor-common/selection';
|
|
9
8
|
import { gapCursorPluginKey } from '../pm-plugins/gap-cursor-plugin-key';
|
|
10
|
-
import { isPositionNearTableRow } from '
|
|
11
|
-
import { isMediaNode, isNodeBeforeMediaNode } from '@atlaskit/editor-common/utils';
|
|
9
|
+
import { ZERO_WIDTH_SPACE, isMediaNode, isNodeBeforeMediaNode, isPositionNearTableRow } from '@atlaskit/editor-common/utils';
|
|
12
10
|
export var shouldSkipGapCursor = function shouldSkipGapCursor(direction, state, $pos) {
|
|
13
11
|
var _$pos$nodeBefore;
|
|
14
12
|
var doc = state.doc,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TableSharedCssClassName, UnsupportedSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
2
2
|
import { Side } from './selection';
|
|
3
|
-
import { CAPTION_PLACEHOLDER_ID } from '
|
|
3
|
+
import { CAPTION_PLACEHOLDER_ID } from '@atlaskit/editor-common/media-single';
|
|
4
4
|
export var isLeftCursor = function isLeftCursor(side) {
|
|
5
5
|
return side === Side.LEFT;
|
|
6
6
|
};
|
|
@@ -113,7 +113,7 @@ export var isIgnoredClick = function isIgnoredClick(elem) {
|
|
|
113
113
|
return false;
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
-
/*
|
|
116
|
+
/*
|
|
117
117
|
Calculates custom style for breakout mode
|
|
118
118
|
Mainly to handle table width to include the numbered column width as well
|
|
119
119
|
*/
|
|
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
7
|
-
import { pluginFactory } from '
|
|
7
|
+
import { pluginFactory } from '@atlaskit/editor-common/utils';
|
|
8
8
|
import { reducer } from './reducer';
|
|
9
9
|
import { selectionPluginKey } from './types';
|
|
10
10
|
import { getDecorations, isSelectableContainerNode } from './utils';
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
function isNodeContentEmpty(maybeNode) {
|
|
3
|
+
return (maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.content.size) === 0 || (maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.textContent) === '';
|
|
4
|
+
}
|
|
2
5
|
function findEmptySelectableParentNodePosition($pos, isValidPosition) {
|
|
3
6
|
var doc = $pos.doc;
|
|
4
7
|
if ($pos.pos + 1 > doc.content.size) {
|
|
@@ -36,8 +39,7 @@ var checkPositionNode = function checkPositionNode($pos) {
|
|
|
36
39
|
if (maybeNode.isAtom) {
|
|
37
40
|
return true;
|
|
38
41
|
}
|
|
39
|
-
|
|
40
|
-
return isParentEmpty && NodeSelection.isSelectable(maybeNode);
|
|
42
|
+
return isNodeContentEmpty(maybeNode) && NodeSelection.isSelectable(maybeNode);
|
|
41
43
|
};
|
|
42
44
|
function findNextSelectionPosition(_ref) {
|
|
43
45
|
var $targetHead = _ref.$targetHead,
|
|
@@ -54,7 +56,7 @@ function findNextSelectionPosition(_ref) {
|
|
|
54
56
|
return null;
|
|
55
57
|
}
|
|
56
58
|
export var onCreateSelectionBetween = function onCreateSelectionBetween(view, $anchor, $head) {
|
|
57
|
-
var _$head$parent;
|
|
59
|
+
var _$head$parent, _$head$parent2;
|
|
58
60
|
if ($anchor.pos === $head.pos) {
|
|
59
61
|
return null;
|
|
60
62
|
}
|
|
@@ -66,6 +68,11 @@ export var onCreateSelectionBetween = function onCreateSelectionBetween(view, $a
|
|
|
66
68
|
if ($head.depth === 1 && ((_$head$parent = $head.parent) === null || _$head$parent === void 0 ? void 0 : _$head$parent.type.name) === 'paragraph') {
|
|
67
69
|
return null;
|
|
68
70
|
}
|
|
71
|
+
|
|
72
|
+
// If head is at the beginning of a non-empty textblock, let ProseMirror handle the text selection
|
|
73
|
+
if ((_$head$parent2 = $head.parent) !== null && _$head$parent2 !== void 0 && _$head$parent2.isTextblock && !isNodeContentEmpty($head.parent) && $head.parentOffset === 0) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
69
76
|
var $nextHeadPosition = findNextSelectionPosition({
|
|
70
77
|
$targetHead: $head,
|
|
71
78
|
$anchor: $anchor,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
|
-
import { bindKeymapWithCommand, moveRight, moveLeft } from '
|
|
2
|
+
import { bindKeymapWithCommand, moveRight, moveLeft } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { arrowRight, arrowLeft } from '../commands';
|
|
4
4
|
function keymapPlugin() {
|
|
5
5
|
var list = {};
|
|
@@ -2,12 +2,10 @@ import { NodeSelection, TextSelection, Selection, AllSelection } from '@atlaskit
|
|
|
2
2
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import { flatten, findParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
4
4
|
import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
5
|
-
import { isSelectionAtStartOfNode, isSelectionAtEndOfNode } from '@atlaskit/editor-common/selection';
|
|
6
|
-
import { selectNode } from '../../utils/commands';
|
|
5
|
+
import { isSelectionAtStartOfNode, isSelectionAtEndOfNode, getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, selectNode } from '@atlaskit/editor-common/selection';
|
|
7
6
|
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
8
7
|
import { isIgnored as isIgnoredByGapCursor } from '../selection/gap-cursor/utils/is-ignored';
|
|
9
8
|
import { selectionPluginKey } from './types';
|
|
10
|
-
import { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload } from '@atlaskit/editor-common/selection';
|
|
11
9
|
export function createSelectionClickHandler(nodes, isValidTarget, options) {
|
|
12
10
|
return function handleClickOn(view, pos, node, nodePos, event, direct) {
|
|
13
11
|
if (options.useLongPressSelection) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
1
|
/**
|
|
3
2
|
* Creates a filter that checks if the node at a given number of parents above the current
|
|
4
3
|
* selection is of the correct node type.
|
|
@@ -24,23 +23,4 @@ var withScrollIntoView = function withScrollIntoView(command) {
|
|
|
24
23
|
}, view);
|
|
25
24
|
};
|
|
26
25
|
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Insert content, delete a range and create a new selection
|
|
30
|
-
* This function automatically handles the mapping of positions for insertion and deletion.
|
|
31
|
-
* The new selection is handled as a function since it may not always be necessary to resolve a position to the transactions mapping
|
|
32
|
-
*
|
|
33
|
-
* @param getSelectionResolvedPos get the resolved position to create a new selection
|
|
34
|
-
* @param insertions content to insert at the specified position
|
|
35
|
-
* @param deletions the ranges to delete
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
var selectNode = function selectNode(pos) {
|
|
39
|
-
return function (state, dispatch) {
|
|
40
|
-
if (dispatch) {
|
|
41
|
-
dispatch(state.tr.setSelection(new NodeSelection(state.doc.resolve(pos))));
|
|
42
|
-
}
|
|
43
|
-
return true;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
export { isNthParentOfType, withScrollIntoView, selectNode };
|
|
26
|
+
export { isNthParentOfType, withScrollIntoView };
|
|
@@ -3,26 +3,6 @@ import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
|
3
3
|
import { getBreakoutMode } from './node-width';
|
|
4
4
|
import { processRawValue, hasDocAsParent, getStepRange, isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
5
5
|
export { findFarthestParentNode } from '@atlaskit/editor-common/utils';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Checks if a node has any content. Ignores node that only contain empty block nodes.
|
|
9
|
-
*/
|
|
10
|
-
export function isNodeEmpty(node) {
|
|
11
|
-
if (node && node.textContent) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
if (!node || !node.childCount || node.childCount === 1 && isEmptyParagraph(node.firstChild)) {
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
var block = [];
|
|
18
|
-
var nonBlock = [];
|
|
19
|
-
node.forEach(function (child) {
|
|
20
|
-
child.isInline ? nonBlock.push(child) : block.push(child);
|
|
21
|
-
});
|
|
22
|
-
return !nonBlock.length && !block.filter(function (childNode) {
|
|
23
|
-
return !!childNode.childCount && !(childNode.childCount === 1 && isEmptyParagraph(childNode.firstChild)) || childNode.isAtom;
|
|
24
|
-
}).length;
|
|
25
|
-
}
|
|
26
6
|
export function isInEmptyLine(state) {
|
|
27
7
|
var selection = state.selection;
|
|
28
8
|
var _ref = selection,
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { FakeTextCursorSelection } from '../plugins/fake-text-cursor/cursor';
|
|
|
4
4
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
export { isEmptyNode, isSelectionInsideLastNodeInDocument, checkNodeDown, insideTableCell, isInListItem } from '@atlaskit/editor-common/utils';
|
|
6
6
|
export { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
7
|
-
export {
|
|
7
|
+
export { findFarthestParentNode, nodesBetweenChanged, getNodesCount } from './document';
|
|
8
8
|
export { isParagraph, isText, isLinkMark } from './nodes';
|
|
9
9
|
export { setNodeSelection, setTextSelection } from './selection';
|
|
10
10
|
export { default as measurements } from './performance/measure-enum';
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import type { MediaState } from '../types';
|
|
4
|
-
import type { InputMethodInsertMedia } from '@atlaskit/editor-common/analytics';
|
|
5
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import type { InputMethodInsertMedia, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
6
5
|
export interface Range {
|
|
7
6
|
start: number;
|
|
8
7
|
end: number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type { Command } from '
|
|
3
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
4
4
|
import { RelativeSelectionPos } from './types';
|
|
5
|
-
export declare const setSelectionRelativeToNode: (selectionRelativeToNode?: RelativeSelectionPos, selection?: Selection | null) =>
|
|
5
|
+
export declare const setSelectionRelativeToNode: (selectionRelativeToNode?: RelativeSelectionPos, selection?: Selection | null) => Command;
|
|
6
6
|
export declare const arrowRight: Command;
|
|
7
7
|
export declare const arrowLeft: Command;
|
|
8
8
|
export declare const setSelectionInsideAtNodeEnd: (selectionRelativeToNode: RelativeSelectionPos, node: PmNode, from: number, to: number) => Command;
|
|
@@ -2,7 +2,7 @@ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/stat
|
|
|
2
2
|
import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { Direction } from './direction';
|
|
4
4
|
import { Side } from './selection';
|
|
5
|
-
import type { Command } from '
|
|
5
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
6
6
|
export type DirectionString = 'up' | 'down' | 'left' | 'right' | 'forward' | 'backward';
|
|
7
7
|
export declare const shouldSkipGapCursor: (direction: Direction, state: EditorState, $pos: ResolvedPos) => boolean;
|
|
8
8
|
export declare const arrow: (dir: Direction, endOfTextblock?: ((dir: DirectionString, state?: EditorState) => boolean) | undefined) => Command;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { Dispatch } from '../../../event-dispatcher';
|
|
4
|
-
import type { DispatchAnalyticsEvent } from '
|
|
4
|
+
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import type { SelectionPluginOptions, SelectionPluginState } from '../types';
|
|
6
6
|
export declare const getInitialState: (state: EditorState) => SelectionPluginState;
|
|
7
7
|
export declare const createPlugin: (dispatch: Dispatch, dispatchAnalyticsEvent: DispatchAnalyticsEvent, options?: SelectionPluginOptions) => SafePlugin<SelectionPluginState>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import type {
|
|
3
|
+
import type { HigherOrderCommand } from '@atlaskit/editor-common/types';
|
|
4
4
|
/**
|
|
5
5
|
* Creates a filter that checks if the node at a given number of parents above the current
|
|
6
6
|
* selection is of the correct node type.
|
|
@@ -11,14 +11,4 @@ import type { Command, HigherOrderCommand } from '@atlaskit/editor-common/types'
|
|
|
11
11
|
*/
|
|
12
12
|
declare const isNthParentOfType: (nodeType: string, depthAway: number) => (state: EditorState, view?: EditorView) => boolean;
|
|
13
13
|
declare const withScrollIntoView: HigherOrderCommand;
|
|
14
|
-
|
|
15
|
-
* Insert content, delete a range and create a new selection
|
|
16
|
-
* This function automatically handles the mapping of positions for insertion and deletion.
|
|
17
|
-
* The new selection is handled as a function since it may not always be necessary to resolve a position to the transactions mapping
|
|
18
|
-
*
|
|
19
|
-
* @param getSelectionResolvedPos get the resolved position to create a new selection
|
|
20
|
-
* @param insertions content to insert at the specified position
|
|
21
|
-
* @param deletions the ranges to delete
|
|
22
|
-
*/
|
|
23
|
-
declare const selectNode: (pos: number) => Command;
|
|
24
|
-
export { isNthParentOfType, withScrollIntoView, selectNode };
|
|
14
|
+
export { isNthParentOfType, withScrollIntoView };
|
|
@@ -6,10 +6,6 @@ import type { Transformer, ReplaceRawValue } from '@atlaskit/editor-common/types
|
|
|
6
6
|
import type { DispatchAnalyticsEvent } from '../plugins/analytics/types/dispatch-analytics-event';
|
|
7
7
|
import type { BreakoutMarkAttrs } from '@atlaskit/adf-schema';
|
|
8
8
|
export { findFarthestParentNode } from '@atlaskit/editor-common/utils';
|
|
9
|
-
/**
|
|
10
|
-
* Checks if a node has any content. Ignores node that only contain empty block nodes.
|
|
11
|
-
*/
|
|
12
|
-
export declare function isNodeEmpty(node?: Node): boolean;
|
|
13
9
|
export declare function isInEmptyLine(state: EditorState): boolean;
|
|
14
10
|
export declare function processRawFragmentValue(schema: Schema, value?: ReplaceRawValue[], providerFactory?: ProviderFactory, sanitizePrivateContent?: boolean, contentTransformer?: Transformer<string>, dispatchAnalyticsEvent?: DispatchAnalyticsEvent): Fragment | undefined;
|
|
15
11
|
export type ChangedFn = (node: Node, pos: number, parent: Node | null, index: number) => boolean | void;
|
|
@@ -3,7 +3,7 @@ import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state'
|
|
|
3
3
|
import type { JSONDocNode, JSONNode } from '@atlaskit/editor-json-transformer';
|
|
4
4
|
export { isEmptyNode, isSelectionInsideLastNodeInDocument, checkNodeDown, insideTableCell, isInListItem, } from '@atlaskit/editor-common/utils';
|
|
5
5
|
export { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
6
|
-
export {
|
|
6
|
+
export { findFarthestParentNode, nodesBetweenChanged, getNodesCount, } from './document';
|
|
7
7
|
export { isParagraph, isText, isLinkMark } from './nodes';
|
|
8
8
|
export { setNodeSelection, setTextSelection } from './selection';
|
|
9
9
|
export type { JSONDocNode };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import type { MediaState } from '../types';
|
|
4
|
-
import type { InputMethodInsertMedia } from '@atlaskit/editor-common/analytics';
|
|
5
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import type { InputMethodInsertMedia, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
6
5
|
export interface Range {
|
|
7
6
|
start: number;
|
|
8
7
|
end: number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type { Command } from '
|
|
3
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
4
4
|
import { RelativeSelectionPos } from './types';
|
|
5
|
-
export declare const setSelectionRelativeToNode: (selectionRelativeToNode?: RelativeSelectionPos, selection?: Selection | null) =>
|
|
5
|
+
export declare const setSelectionRelativeToNode: (selectionRelativeToNode?: RelativeSelectionPos, selection?: Selection | null) => Command;
|
|
6
6
|
export declare const arrowRight: Command;
|
|
7
7
|
export declare const arrowLeft: Command;
|
|
8
8
|
export declare const setSelectionInsideAtNodeEnd: (selectionRelativeToNode: RelativeSelectionPos, node: PmNode, from: number, to: number) => Command;
|
|
@@ -2,7 +2,7 @@ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/stat
|
|
|
2
2
|
import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { Direction } from './direction';
|
|
4
4
|
import { Side } from './selection';
|
|
5
|
-
import type { Command } from '
|
|
5
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
6
6
|
export type DirectionString = 'up' | 'down' | 'left' | 'right' | 'forward' | 'backward';
|
|
7
7
|
export declare const shouldSkipGapCursor: (direction: Direction, state: EditorState, $pos: ResolvedPos) => boolean;
|
|
8
8
|
export declare const arrow: (dir: Direction, endOfTextblock?: ((dir: DirectionString, state?: EditorState) => boolean) | undefined) => Command;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { Dispatch } from '../../../event-dispatcher';
|
|
4
|
-
import type { DispatchAnalyticsEvent } from '
|
|
4
|
+
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import type { SelectionPluginOptions, SelectionPluginState } from '../types';
|
|
6
6
|
export declare const getInitialState: (state: EditorState) => SelectionPluginState;
|
|
7
7
|
export declare const createPlugin: (dispatch: Dispatch, dispatchAnalyticsEvent: DispatchAnalyticsEvent, options?: SelectionPluginOptions) => SafePlugin<SelectionPluginState>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import type {
|
|
3
|
+
import type { HigherOrderCommand } from '@atlaskit/editor-common/types';
|
|
4
4
|
/**
|
|
5
5
|
* Creates a filter that checks if the node at a given number of parents above the current
|
|
6
6
|
* selection is of the correct node type.
|
|
@@ -11,14 +11,4 @@ import type { Command, HigherOrderCommand } from '@atlaskit/editor-common/types'
|
|
|
11
11
|
*/
|
|
12
12
|
declare const isNthParentOfType: (nodeType: string, depthAway: number) => (state: EditorState, view?: EditorView) => boolean;
|
|
13
13
|
declare const withScrollIntoView: HigherOrderCommand;
|
|
14
|
-
|
|
15
|
-
* Insert content, delete a range and create a new selection
|
|
16
|
-
* This function automatically handles the mapping of positions for insertion and deletion.
|
|
17
|
-
* The new selection is handled as a function since it may not always be necessary to resolve a position to the transactions mapping
|
|
18
|
-
*
|
|
19
|
-
* @param getSelectionResolvedPos get the resolved position to create a new selection
|
|
20
|
-
* @param insertions content to insert at the specified position
|
|
21
|
-
* @param deletions the ranges to delete
|
|
22
|
-
*/
|
|
23
|
-
declare const selectNode: (pos: number) => Command;
|
|
24
|
-
export { isNthParentOfType, withScrollIntoView, selectNode };
|
|
14
|
+
export { isNthParentOfType, withScrollIntoView };
|
|
@@ -6,10 +6,6 @@ import type { Transformer, ReplaceRawValue } from '@atlaskit/editor-common/types
|
|
|
6
6
|
import type { DispatchAnalyticsEvent } from '../plugins/analytics/types/dispatch-analytics-event';
|
|
7
7
|
import type { BreakoutMarkAttrs } from '@atlaskit/adf-schema';
|
|
8
8
|
export { findFarthestParentNode } from '@atlaskit/editor-common/utils';
|
|
9
|
-
/**
|
|
10
|
-
* Checks if a node has any content. Ignores node that only contain empty block nodes.
|
|
11
|
-
*/
|
|
12
|
-
export declare function isNodeEmpty(node?: Node): boolean;
|
|
13
9
|
export declare function isInEmptyLine(state: EditorState): boolean;
|
|
14
10
|
export declare function processRawFragmentValue(schema: Schema, value?: ReplaceRawValue[], providerFactory?: ProviderFactory, sanitizePrivateContent?: boolean, contentTransformer?: Transformer<string>, dispatchAnalyticsEvent?: DispatchAnalyticsEvent): Fragment | undefined;
|
|
15
11
|
export type ChangedFn = (node: Node, pos: number, parent: Node | null, index: number) => boolean | void;
|
|
@@ -3,7 +3,7 @@ import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state'
|
|
|
3
3
|
import type { JSONDocNode, JSONNode } from '@atlaskit/editor-json-transformer';
|
|
4
4
|
export { isEmptyNode, isSelectionInsideLastNodeInDocument, checkNodeDown, insideTableCell, isInListItem, } from '@atlaskit/editor-common/utils';
|
|
5
5
|
export { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
6
|
-
export {
|
|
6
|
+
export { findFarthestParentNode, nodesBetweenChanged, getNodesCount, } from './document';
|
|
7
7
|
export { isParagraph, isText, isLinkMark } from './nodes';
|
|
8
8
|
export { setNodeSelection, setTextSelection } from './selection';
|
|
9
9
|
export type { JSONDocNode };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "187.44.
|
|
3
|
+
"version": "187.44.6",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@atlaskit/code": "^14.6.0",
|
|
56
56
|
"@atlaskit/date": "^0.10.0",
|
|
57
57
|
"@atlaskit/datetime-picker": "^12.10.0",
|
|
58
|
-
"@atlaskit/editor-common": "^75.
|
|
58
|
+
"@atlaskit/editor-common": "^75.4.0",
|
|
59
59
|
"@atlaskit/editor-json-transformer": "^8.10.0",
|
|
60
60
|
"@atlaskit/editor-markdown-transformer": "^5.2.5",
|
|
61
61
|
"@atlaskit/editor-palette": "1.5.1",
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "atTheBeginningOfBlock", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _selection.atTheBeginningOfBlock;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "atTheBeginningOfDoc", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _selection.atTheBeginningOfDoc;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "atTheEndOfBlock", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function get() {
|
|
21
|
-
return _selection.atTheEndOfBlock;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "atTheEndOfDoc", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _selection.atTheEndOfDoc;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "endPositionOfParent", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function get() {
|
|
33
|
-
return _selection.endPositionOfParent;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "startPositionOfParent", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function get() {
|
|
39
|
-
return _selection.startPositionOfParent;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
var _selection = require("@atlaskit/editor-common/selection");
|
package/dist/cjs/utils/table.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isPositionNearTableRow = isPositionNearTableRow;
|
|
7
|
-
/*
|
|
8
|
-
isPositionNearTableRow()
|
|
9
|
-
Returns true when a sibling node, or any of the parent's sibling
|
|
10
|
-
nodes are a tableRow
|
|
11
|
-
*/
|
|
12
|
-
function isPositionNearTableRow(pos, schema, direction) {
|
|
13
|
-
if (!schema.nodes.tableRow) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
var doc = pos.doc;
|
|
17
|
-
var resolved = pos;
|
|
18
|
-
var sibling = direction === 'before' ? 'nodeBefore' : 'nodeAfter';
|
|
19
|
-
while (resolved.depth > 0) {
|
|
20
|
-
var _resolved$sibling;
|
|
21
|
-
var siblingType = (_resolved$sibling = resolved[sibling]) === null || _resolved$sibling === void 0 ? void 0 : _resolved$sibling.type;
|
|
22
|
-
if (siblingType === schema.nodes.tableRow) {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
resolved = doc.resolve(resolved[direction]());
|
|
26
|
-
}
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { atTheBeginningOfBlock, atTheBeginningOfDoc, atTheEndOfBlock, atTheEndOfDoc, endPositionOfParent, startPositionOfParent } from '@atlaskit/editor-common/selection';
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
isPositionNearTableRow()
|
|
3
|
-
Returns true when a sibling node, or any of the parent's sibling
|
|
4
|
-
nodes are a tableRow
|
|
5
|
-
*/
|
|
6
|
-
export function isPositionNearTableRow(pos, schema, direction) {
|
|
7
|
-
if (!schema.nodes.tableRow) {
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
let doc = pos.doc;
|
|
11
|
-
let resolved = pos;
|
|
12
|
-
const sibling = direction === 'before' ? 'nodeBefore' : 'nodeAfter';
|
|
13
|
-
while (resolved.depth > 0) {
|
|
14
|
-
var _resolved$sibling;
|
|
15
|
-
const siblingType = (_resolved$sibling = resolved[sibling]) === null || _resolved$sibling === void 0 ? void 0 : _resolved$sibling.type;
|
|
16
|
-
if (siblingType === schema.nodes.tableRow) {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
resolved = doc.resolve(resolved[direction]());
|
|
20
|
-
}
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { atTheBeginningOfBlock, atTheBeginningOfDoc, atTheEndOfBlock, atTheEndOfDoc, endPositionOfParent, startPositionOfParent } from '@atlaskit/editor-common/selection';
|
package/dist/esm/utils/table.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
isPositionNearTableRow()
|
|
3
|
-
Returns true when a sibling node, or any of the parent's sibling
|
|
4
|
-
nodes are a tableRow
|
|
5
|
-
*/
|
|
6
|
-
export function isPositionNearTableRow(pos, schema, direction) {
|
|
7
|
-
if (!schema.nodes.tableRow) {
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
var doc = pos.doc;
|
|
11
|
-
var resolved = pos;
|
|
12
|
-
var sibling = direction === 'before' ? 'nodeBefore' : 'nodeAfter';
|
|
13
|
-
while (resolved.depth > 0) {
|
|
14
|
-
var _resolved$sibling;
|
|
15
|
-
var siblingType = (_resolved$sibling = resolved[sibling]) === null || _resolved$sibling === void 0 ? void 0 : _resolved$sibling.type;
|
|
16
|
-
if (siblingType === schema.nodes.tableRow) {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
resolved = doc.resolve(resolved[direction]());
|
|
20
|
-
}
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { atTheBeginningOfBlock, atTheBeginningOfDoc, atTheEndOfBlock, atTheEndOfDoc, endPositionOfParent, startPositionOfParent, } from '@atlaskit/editor-common/selection';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { atTheBeginningOfBlock, atTheBeginningOfDoc, atTheEndOfBlock, atTheEndOfDoc, endPositionOfParent, startPositionOfParent, } from '@atlaskit/editor-common/selection';
|