@atlaskit/editor-core 187.44.3 → 187.44.4
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 +8 -0
- package/dist/cjs/plugins/expand/pm-plugins/keymap.js +2 -2
- 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/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/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/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/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/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/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/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
|
@@ -20,11 +20,10 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
20
20
|
import { isInEmptyLine } from '../../../utils/document';
|
|
21
21
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
22
22
|
import { isInListItem } from '../../../utils';
|
|
23
|
-
import { CAPTION_PLACEHOLDER_ID } from '../ui/CaptionPlaceholder';
|
|
24
23
|
import { RawIntlProvider } from 'react-intl-next';
|
|
25
24
|
import { MediaTaskManager } from './mediaTaskManager';
|
|
26
25
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
27
|
-
import { getMaxWidthForNestedNodeNext } from '@atlaskit/editor-common/media-single';
|
|
26
|
+
import { getMaxWidthForNestedNodeNext, CAPTION_PLACEHOLDER_ID } from '@atlaskit/editor-common/media-single';
|
|
28
27
|
export { stateKey } from './plugin-key';
|
|
29
28
|
export const MEDIA_CONTENT_WRAP_CLASS_NAME = 'media-content-wrap';
|
|
30
29
|
export const MEDIA_PLUGIN_IS_RESIZING_KEY = 'mediaSinglePlugin.isResizing';
|
|
@@ -26,7 +26,7 @@ import ImageBorderItem from '../ui/ImageBorder';
|
|
|
26
26
|
import { currentMediaNodeBorderMark } from '../utils/current-media-node';
|
|
27
27
|
import { shouldShowImageBorder } from './imageBorder';
|
|
28
28
|
import { PixelEntry, FullWidthDisplay } from '../ui/PixelEntry';
|
|
29
|
-
import { DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, calcMinWidth
|
|
29
|
+
import { DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, calcMinWidth } from '@atlaskit/editor-common/media-single';
|
|
30
30
|
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
31
31
|
const remove = (state, dispatch) => {
|
|
32
32
|
if (dispatch) {
|
|
@@ -266,7 +266,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
266
266
|
type: 'custom',
|
|
267
267
|
fallback: [],
|
|
268
268
|
render: editorView => {
|
|
269
|
-
var _widthPlugin$sharedSt2;
|
|
269
|
+
var _widthPlugin$sharedSt2, _pluginInjectionApi$m;
|
|
270
270
|
if (!editorView || !selectedMediaSingleNode) {
|
|
271
271
|
return null;
|
|
272
272
|
}
|
|
@@ -288,7 +288,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
288
288
|
width: mediaWidth,
|
|
289
289
|
height: mediaHeight
|
|
290
290
|
} = selectedMediaNode.attrs;
|
|
291
|
-
const maxWidthForNestedNode =
|
|
291
|
+
const maxWidthForNestedNode = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$m = pluginInjectionApi.media.sharedState.currentState()) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.currentMaxWidth;
|
|
292
292
|
const maxWidth = maxWidthForNestedNode || akEditorFullWidthLayoutWidth;
|
|
293
293
|
const isVideoFile = isVideo(selectedMediaNode.attrs.__fileMimeType);
|
|
294
294
|
const minWidth = calcMinWidth(isVideoFile, maxWidthForNestedNode || contentWidth);
|
|
@@ -4,14 +4,14 @@ import { css, jsx } from '@emotion/react';
|
|
|
4
4
|
import { FormattedMessage } from 'react-intl-next';
|
|
5
5
|
import { N200 } from '@atlaskit/theme/colors';
|
|
6
6
|
import { messages } from './messages';
|
|
7
|
+
import { CAPTION_PLACEHOLDER_ID } from '@atlaskit/editor-common/media-single';
|
|
7
8
|
const placeholder = css`
|
|
8
9
|
color: ${`var(--ds-text-subtlest, ${N200})`};
|
|
9
10
|
width: 100%;
|
|
10
11
|
text-align: center;
|
|
11
|
-
margin-top: 8px !important;
|
|
12
|
+
margin-top: ${"var(--ds-space-100, 8px)"} !important;
|
|
12
13
|
display: block;
|
|
13
14
|
`;
|
|
14
|
-
export const CAPTION_PLACEHOLDER_ID = 'caption-placeholder';
|
|
15
15
|
export default /*#__PURE__*/React.forwardRef(({
|
|
16
16
|
onClick
|
|
17
17
|
}, ref) => {
|
|
@@ -6,8 +6,7 @@ import { isTemporary } from '../../../utils';
|
|
|
6
6
|
import { mapSlice } from '../../../utils/slice';
|
|
7
7
|
import { walkUpTreeUntil, removeNestedEmptyEls, unwrap } from '../../../utils/dom';
|
|
8
8
|
import { isImage } from './is-image';
|
|
9
|
-
import { atTheBeginningOfBlock, atTheBeginningOfDoc, atTheEndOfBlock, endPositionOfParent, startPositionOfParent } from '
|
|
10
|
-
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
9
|
+
import { atTheBeginningOfBlock, atTheBeginningOfDoc, atTheEndOfBlock, endPositionOfParent, startPositionOfParent, GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
11
10
|
import { isMediaBlobUrl } from '@atlaskit/media-client';
|
|
12
11
|
export const isMediaBlobUrlFromAttrs = attrs => {
|
|
13
12
|
return !!(attrs && attrs.type === 'external' && isMediaBlobUrl(attrs.url));
|
|
@@ -3,7 +3,7 @@ import { setNodeSelection, setTextSelection, insideTableCell, isInListItem, find
|
|
|
3
3
|
import { isInLayoutColumn, isSupportedInParent } from '@atlaskit/editor-common/utils';
|
|
4
4
|
import { posOfPrecedingMediaGroup, posOfMediaGroupNearby, posOfParentMediaGroup, isSelectionNonMediaBlockNode, isInsidePotentialEmptyParagraph, copyOptionalAttrsFromMediaState } from './media-common';
|
|
5
5
|
import { canInsert, safeInsert, hasParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
6
|
-
import { atTheBeginningOfBlock, atTheEndOfBlock, atTheEndOfDoc, endPositionOfParent, startPositionOfParent } from '
|
|
6
|
+
import { atTheBeginningOfBlock, atTheEndOfBlock, atTheEndOfDoc, endPositionOfParent, startPositionOfParent } from '@atlaskit/editor-common/selection';
|
|
7
7
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
8
8
|
export const canInsertMediaInline = state => {
|
|
9
9
|
const node = state.schema.nodes.mediaInline.create({});
|
|
@@ -8,7 +8,7 @@ import { mapSlice } from '../../../utils/slice';
|
|
|
8
8
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
9
9
|
import { safeInsert, shouldSplitSelectedNodeOnNodeInsertion } from '@atlaskit/editor-common/insert';
|
|
10
10
|
import { isImage } from './is-image';
|
|
11
|
-
import { atTheBeginningOfBlock } from '
|
|
11
|
+
import { atTheBeginningOfBlock } from '@atlaskit/editor-common/selection';
|
|
12
12
|
import { getRandomHex } from '@atlaskit/media-common';
|
|
13
13
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
14
14
|
const 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 const shouldSkipGapCursor = (direction, state, $pos) => {
|
|
13
11
|
var _$pos$nodeBefore;
|
|
14
12
|
const {
|
|
@@ -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 const isLeftCursor = side => side === Side.LEFT;
|
|
5
5
|
export function getMediaNearPos(doc, $pos, schema, dir = -1) {
|
|
6
6
|
let $currentPos = $pos;
|
|
@@ -109,7 +109,7 @@ export const isIgnoredClick = elem => {
|
|
|
109
109
|
return false;
|
|
110
110
|
};
|
|
111
111
|
|
|
112
|
-
/*
|
|
112
|
+
/*
|
|
113
113
|
Calculates custom style for breakout mode
|
|
114
114
|
Mainly to handle table width to include the numbered column width as well
|
|
115
115
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
4
|
-
import { pluginFactory } from '
|
|
4
|
+
import { pluginFactory } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { reducer } from './reducer';
|
|
6
6
|
import { selectionPluginKey } from './types';
|
|
7
7
|
import { getDecorations, isSelectableContainerNode } from './utils';
|
|
@@ -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
|
const 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.
|
|
@@ -22,21 +21,4 @@ const withScrollIntoView = command => (state, dispatch, view) => command(state,
|
|
|
22
21
|
dispatch(tr);
|
|
23
22
|
}
|
|
24
23
|
}, view);
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Insert content, delete a range and create a new selection
|
|
28
|
-
* This function automatically handles the mapping of positions for insertion and deletion.
|
|
29
|
-
* The new selection is handled as a function since it may not always be necessary to resolve a position to the transactions mapping
|
|
30
|
-
*
|
|
31
|
-
* @param getSelectionResolvedPos get the resolved position to create a new selection
|
|
32
|
-
* @param insertions content to insert at the specified position
|
|
33
|
-
* @param deletions the ranges to delete
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
const selectNode = pos => (state, dispatch) => {
|
|
37
|
-
if (dispatch) {
|
|
38
|
-
dispatch(state.tr.setSelection(new NodeSelection(state.doc.resolve(pos))));
|
|
39
|
-
}
|
|
40
|
-
return true;
|
|
41
|
-
};
|
|
42
|
-
export { isNthParentOfType, withScrollIntoView, selectNode };
|
|
24
|
+
export { isNthParentOfType, withScrollIntoView };
|
|
@@ -2,24 +2,6 @@ import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
|
2
2
|
import { getBreakoutMode } from './node-width';
|
|
3
3
|
import { processRawValue, hasDocAsParent, getStepRange, isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
4
4
|
export { findFarthestParentNode } from '@atlaskit/editor-common/utils';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Checks if a node has any content. Ignores node that only contain empty block nodes.
|
|
8
|
-
*/
|
|
9
|
-
export function isNodeEmpty(node) {
|
|
10
|
-
if (node && node.textContent) {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
if (!node || !node.childCount || node.childCount === 1 && isEmptyParagraph(node.firstChild)) {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
const block = [];
|
|
17
|
-
const nonBlock = [];
|
|
18
|
-
node.forEach(child => {
|
|
19
|
-
child.isInline ? nonBlock.push(child) : block.push(child);
|
|
20
|
-
});
|
|
21
|
-
return !nonBlock.length && !block.filter(childNode => !!childNode.childCount && !(childNode.childCount === 1 && isEmptyParagraph(childNode.firstChild)) || childNode.isAtom).length;
|
|
22
|
-
}
|
|
23
5
|
export function isInEmptyLine(state) {
|
|
24
6
|
const {
|
|
25
7
|
selection
|
|
@@ -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';
|
|
@@ -8,7 +8,7 @@ import { expandClassNames } from '../ui/class-names';
|
|
|
8
8
|
import { deleteExpand, focusTitle } from '../commands';
|
|
9
9
|
import { getPluginState as getSelectionPluginState } from '../../selection/plugin-factory';
|
|
10
10
|
import { RelativeSelectionPos } from '../../selection/types';
|
|
11
|
-
import { isPositionNearTableRow } from '
|
|
11
|
+
import { isPositionNearTableRow } from '@atlaskit/editor-common/utils';
|
|
12
12
|
var isExpandNode = function isExpandNode(node) {
|
|
13
13
|
return (node === null || node === void 0 ? void 0 : node.type.name) === 'expand' || (node === null || node === void 0 ? void 0 : node.type.name) === 'nestedExpand';
|
|
14
14
|
};
|
|
@@ -36,7 +36,7 @@ import CaptionPlaceholder from '../ui/CaptionPlaceholder';
|
|
|
36
36
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
37
37
|
import { insertAndSelectCaptionFromMediaSinglePos } from '../commands/captions';
|
|
38
38
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
39
|
-
import { calcMediaSinglePixelWidth, MEDIA_SINGLE_GUTTER_SIZE, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH, getMaxWidthForNestedNode
|
|
39
|
+
import { calcMediaSinglePixelWidth, MEDIA_SINGLE_GUTTER_SIZE, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH, getMaxWidthForNestedNode } from '@atlaskit/editor-common/media-single';
|
|
40
40
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
41
41
|
var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
42
42
|
_inherits(MediaSingleNode, _Component);
|
|
@@ -294,6 +294,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
294
294
|
}, {
|
|
295
295
|
key: "render",
|
|
296
296
|
value: function render() {
|
|
297
|
+
var _pluginInjectionApi$m;
|
|
297
298
|
var _this$props2 = this.props,
|
|
298
299
|
selected = _this$props2.selected,
|
|
299
300
|
getPos = _this$props2.getPos,
|
|
@@ -341,8 +342,9 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
341
342
|
height = DEFAULT_IMAGE_HEIGHT;
|
|
342
343
|
}
|
|
343
344
|
var isSelected = selected();
|
|
345
|
+
var currentMaxWidth = isSelected ? pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$m = pluginInjectionApi.media.sharedState.currentState()) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.currentMaxWidth : undefined;
|
|
344
346
|
var contentWidthForLegacyExperience = getMaxWidthForNestedNode(view, getPos()) || lineLength;
|
|
345
|
-
var contentWidth =
|
|
347
|
+
var contentWidth = currentMaxWidth || lineLength;
|
|
346
348
|
var mediaSingleProps = {
|
|
347
349
|
layout: layout,
|
|
348
350
|
width: width,
|
|
@@ -3,7 +3,7 @@ import { bindKeymapWithCommand, backspace } from '@atlaskit/editor-common/keymap
|
|
|
3
3
|
import { isEmptyNode, isSelectionInsideLastNodeInDocument } from '../../../utils';
|
|
4
4
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { selectNodeBackward } from '@atlaskit/editor-prosemirror/commands';
|
|
6
|
-
import { atTheEndOfDoc } from '
|
|
6
|
+
import { atTheEndOfDoc } from '@atlaskit/editor-common/selection';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Check if is an empty selection at the start of the node
|
|
@@ -29,11 +29,10 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
29
29
|
import { isInEmptyLine } from '../../../utils/document';
|
|
30
30
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
31
31
|
import { isInListItem } from '../../../utils';
|
|
32
|
-
import { CAPTION_PLACEHOLDER_ID } from '../ui/CaptionPlaceholder';
|
|
33
32
|
import { RawIntlProvider } from 'react-intl-next';
|
|
34
33
|
import { MediaTaskManager } from './mediaTaskManager';
|
|
35
34
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
36
|
-
import { getMaxWidthForNestedNodeNext } from '@atlaskit/editor-common/media-single';
|
|
35
|
+
import { getMaxWidthForNestedNodeNext, CAPTION_PLACEHOLDER_ID } from '@atlaskit/editor-common/media-single';
|
|
37
36
|
export { stateKey } from './plugin-key';
|
|
38
37
|
export var MEDIA_CONTENT_WRAP_CLASS_NAME = 'media-content-wrap';
|
|
39
38
|
export var MEDIA_PLUGIN_IS_RESIZING_KEY = 'mediaSinglePlugin.isResizing';
|
|
@@ -30,7 +30,7 @@ import ImageBorderItem from '../ui/ImageBorder';
|
|
|
30
30
|
import { currentMediaNodeBorderMark } from '../utils/current-media-node';
|
|
31
31
|
import { shouldShowImageBorder } from './imageBorder';
|
|
32
32
|
import { PixelEntry, FullWidthDisplay } from '../ui/PixelEntry';
|
|
33
|
-
import { DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, calcMinWidth
|
|
33
|
+
import { DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, calcMinWidth } from '@atlaskit/editor-common/media-single';
|
|
34
34
|
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
35
35
|
var remove = function remove(state, dispatch) {
|
|
36
36
|
if (dispatch) {
|
|
@@ -259,7 +259,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
259
259
|
type: 'custom',
|
|
260
260
|
fallback: [],
|
|
261
261
|
render: function render(editorView) {
|
|
262
|
-
var _widthPlugin$sharedSt2;
|
|
262
|
+
var _widthPlugin$sharedSt2, _pluginInjectionApi$m;
|
|
263
263
|
if (!editorView || !selectedMediaSingleNode) {
|
|
264
264
|
return null;
|
|
265
265
|
}
|
|
@@ -277,7 +277,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
277
277
|
var _selectedMediaNode$at = selectedMediaNode.attrs,
|
|
278
278
|
mediaWidth = _selectedMediaNode$at.width,
|
|
279
279
|
mediaHeight = _selectedMediaNode$at.height;
|
|
280
|
-
var maxWidthForNestedNode =
|
|
280
|
+
var maxWidthForNestedNode = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$m = pluginInjectionApi.media.sharedState.currentState()) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.currentMaxWidth;
|
|
281
281
|
var maxWidth = maxWidthForNestedNode || akEditorFullWidthLayoutWidth;
|
|
282
282
|
var isVideoFile = isVideo(selectedMediaNode.attrs.__fileMimeType);
|
|
283
283
|
var minWidth = calcMinWidth(isVideoFile, maxWidthForNestedNode || contentWidth);
|
|
@@ -6,8 +6,8 @@ import { css, jsx } from '@emotion/react';
|
|
|
6
6
|
import { FormattedMessage } from 'react-intl-next';
|
|
7
7
|
import { N200 } from '@atlaskit/theme/colors';
|
|
8
8
|
import { messages } from './messages';
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
import { CAPTION_PLACEHOLDER_ID } from '@atlaskit/editor-common/media-single';
|
|
10
|
+
var placeholder = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n width: 100%;\n text-align: center;\n margin-top: ", " !important;\n display: block;\n"])), "var(--ds-text-subtlest, ".concat(N200, ")"), "var(--ds-space-100, 8px)");
|
|
11
11
|
export default /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
12
12
|
var onClick = _ref.onClick;
|
|
13
13
|
return jsx("span", {
|
|
@@ -6,8 +6,7 @@ import { isTemporary } from '../../../utils';
|
|
|
6
6
|
import { mapSlice } from '../../../utils/slice';
|
|
7
7
|
import { walkUpTreeUntil, removeNestedEmptyEls, unwrap } from '../../../utils/dom';
|
|
8
8
|
import { isImage } from './is-image';
|
|
9
|
-
import { atTheBeginningOfBlock, atTheBeginningOfDoc, atTheEndOfBlock, endPositionOfParent, startPositionOfParent } from '
|
|
10
|
-
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
9
|
+
import { atTheBeginningOfBlock, atTheBeginningOfDoc, atTheEndOfBlock, endPositionOfParent, startPositionOfParent, GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
11
10
|
import { isMediaBlobUrl } from '@atlaskit/media-client';
|
|
12
11
|
export var isMediaBlobUrlFromAttrs = function isMediaBlobUrlFromAttrs(attrs) {
|
|
13
12
|
return !!(attrs && attrs.type === 'external' && isMediaBlobUrl(attrs.url));
|
|
@@ -3,7 +3,7 @@ import { setNodeSelection, setTextSelection, insideTableCell, isInListItem, find
|
|
|
3
3
|
import { isInLayoutColumn, isSupportedInParent } from '@atlaskit/editor-common/utils';
|
|
4
4
|
import { posOfPrecedingMediaGroup, posOfMediaGroupNearby, posOfParentMediaGroup, isSelectionNonMediaBlockNode, isInsidePotentialEmptyParagraph, copyOptionalAttrsFromMediaState } from './media-common';
|
|
5
5
|
import { canInsert, safeInsert, hasParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
6
|
-
import { atTheBeginningOfBlock, atTheEndOfBlock, atTheEndOfDoc, endPositionOfParent, startPositionOfParent } from '
|
|
6
|
+
import { atTheBeginningOfBlock, atTheEndOfBlock, atTheEndOfDoc, endPositionOfParent, startPositionOfParent } from '@atlaskit/editor-common/selection';
|
|
7
7
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
8
8
|
export var canInsertMediaInline = function canInsertMediaInline(state) {
|
|
9
9
|
var node = state.schema.nodes.mediaInline.create({});
|
|
@@ -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,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;
|