@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
|
@@ -15,32 +15,12 @@ exports.getChangedNodesIn = getChangedNodesIn;
|
|
|
15
15
|
exports.getChildBreakoutModes = getChildBreakoutModes;
|
|
16
16
|
exports.getNodesCount = getNodesCount;
|
|
17
17
|
exports.isInEmptyLine = isInEmptyLine;
|
|
18
|
-
exports.isNodeEmpty = isNodeEmpty;
|
|
19
18
|
exports.nodesBetweenChanged = nodesBetweenChanged;
|
|
20
19
|
exports.processRawFragmentValue = processRawFragmentValue;
|
|
21
20
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
22
21
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
23
22
|
var _nodeWidth = require("./node-width");
|
|
24
23
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
25
|
-
/**
|
|
26
|
-
* Checks if a node has any content. Ignores node that only contain empty block nodes.
|
|
27
|
-
*/
|
|
28
|
-
function isNodeEmpty(node) {
|
|
29
|
-
if (node && node.textContent) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
if (!node || !node.childCount || node.childCount === 1 && (0, _utils.isEmptyParagraph)(node.firstChild)) {
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
var block = [];
|
|
36
|
-
var nonBlock = [];
|
|
37
|
-
node.forEach(function (child) {
|
|
38
|
-
child.isInline ? nonBlock.push(child) : block.push(child);
|
|
39
|
-
});
|
|
40
|
-
return !nonBlock.length && !block.filter(function (childNode) {
|
|
41
|
-
return !!childNode.childCount && !(childNode.childCount === 1 && (0, _utils.isEmptyParagraph)(childNode.firstChild)) || childNode.isAtom;
|
|
42
|
-
}).length;
|
|
43
|
-
}
|
|
44
24
|
function isInEmptyLine(state) {
|
|
45
25
|
var selection = state.selection;
|
|
46
26
|
var _ref = selection,
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -75,12 +75,6 @@ Object.defineProperty(exports, "isLinkMark", {
|
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
exports.isMarkTypeAllowedInCurrentSelection = isMarkTypeAllowedInCurrentSelection;
|
|
78
|
-
Object.defineProperty(exports, "isNodeEmpty", {
|
|
79
|
-
enumerable: true,
|
|
80
|
-
get: function get() {
|
|
81
|
-
return _document.isNodeEmpty;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
78
|
Object.defineProperty(exports, "isParagraph", {
|
|
85
79
|
enumerable: true,
|
|
86
80
|
get: function get() {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "187.44.
|
|
9
|
+
var version = "187.44.6";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
@@ -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
|
const 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
|
};
|
|
@@ -8,7 +8,7 @@ import UiDropdown from '../../../ui/Dropdown';
|
|
|
8
8
|
import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
|
|
9
9
|
import DropdownMenu, { itemSpacing, menuItemDimensions } from './DropdownMenu';
|
|
10
10
|
const dropdownExpandContainer = css`
|
|
11
|
-
margin: 0px -4px;
|
|
11
|
+
margin: 0px ${"var(--ds-space-negative-050, -4px)"};
|
|
12
12
|
`;
|
|
13
13
|
const iconGroup = css`
|
|
14
14
|
display: flex;
|
|
@@ -97,7 +97,8 @@ export default class Dropdown extends Component {
|
|
|
97
97
|
buttonTestId,
|
|
98
98
|
dropdownWidth,
|
|
99
99
|
editorView,
|
|
100
|
-
dropdownListId
|
|
100
|
+
dropdownListId,
|
|
101
|
+
alignDropdownWithToolbar
|
|
101
102
|
} = this.props;
|
|
102
103
|
let trigger;
|
|
103
104
|
if (icon) {
|
|
@@ -152,7 +153,8 @@ export default class Dropdown extends Component {
|
|
|
152
153
|
fitHeight: fitHeight + fitTolerance,
|
|
153
154
|
trigger: trigger,
|
|
154
155
|
editorView: editorView,
|
|
155
|
-
dropdownListId: dropdownListId
|
|
156
|
+
dropdownListId: dropdownListId,
|
|
157
|
+
alignDropdownWithParentElement: alignDropdownWithToolbar
|
|
156
158
|
}, Array.isArray(options) ? this.renderArrayOptions(options) : options.render({
|
|
157
159
|
hide: this.hide,
|
|
158
160
|
dispatchCommand
|
|
@@ -116,7 +116,8 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
116
116
|
buttonTestId: item.testId,
|
|
117
117
|
editorView: editorView,
|
|
118
118
|
setDisableParentScroll: scrollable ? setDisableScroll : undefined,
|
|
119
|
-
dropdownListId: (item === null || item === void 0 ? void 0 : item.id) && `${item.id}-dropdownList
|
|
119
|
+
dropdownListId: (item === null || item === void 0 ? void 0 : item.id) && `${item.id}-dropdownList`,
|
|
120
|
+
alignDropdownWithToolbar: items.length === 1
|
|
120
121
|
});
|
|
121
122
|
case 'select':
|
|
122
123
|
if (item.selectType === 'list') {
|
|
@@ -23,7 +23,7 @@ import CaptionPlaceholder from '../ui/CaptionPlaceholder';
|
|
|
23
23
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
24
24
|
import { insertAndSelectCaptionFromMediaSinglePos } from '../commands/captions';
|
|
25
25
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
26
|
-
import { calcMediaSinglePixelWidth, MEDIA_SINGLE_GUTTER_SIZE, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH, getMaxWidthForNestedNode
|
|
26
|
+
import { calcMediaSinglePixelWidth, MEDIA_SINGLE_GUTTER_SIZE, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH, getMaxWidthForNestedNode } from '@atlaskit/editor-common/media-single';
|
|
27
27
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
28
28
|
export default class MediaSingleNode extends Component {
|
|
29
29
|
constructor(...args) {
|
|
@@ -201,6 +201,7 @@ export default class MediaSingleNode extends Component {
|
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
203
|
render() {
|
|
204
|
+
var _pluginInjectionApi$m;
|
|
204
205
|
const {
|
|
205
206
|
selected,
|
|
206
207
|
getPos,
|
|
@@ -257,8 +258,9 @@ export default class MediaSingleNode extends Component {
|
|
|
257
258
|
height = DEFAULT_IMAGE_HEIGHT;
|
|
258
259
|
}
|
|
259
260
|
const isSelected = selected();
|
|
261
|
+
const 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;
|
|
260
262
|
const contentWidthForLegacyExperience = getMaxWidthForNestedNode(view, getPos()) || lineLength;
|
|
261
|
-
const contentWidth =
|
|
263
|
+
const contentWidth = currentMaxWidth || lineLength;
|
|
262
264
|
const mediaSingleProps = {
|
|
263
265
|
layout,
|
|
264
266
|
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
|
|
@@ -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,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
|
const {
|
|
4
7
|
doc
|
|
@@ -38,8 +41,7 @@ const checkPositionNode = $pos => {
|
|
|
38
41
|
if (maybeNode.isAtom) {
|
|
39
42
|
return true;
|
|
40
43
|
}
|
|
41
|
-
|
|
42
|
-
return isParentEmpty && NodeSelection.isSelectable(maybeNode);
|
|
44
|
+
return isNodeContentEmpty(maybeNode) && NodeSelection.isSelectable(maybeNode);
|
|
43
45
|
};
|
|
44
46
|
function findNextSelectionPosition({
|
|
45
47
|
$targetHead,
|
|
@@ -57,7 +59,7 @@ function findNextSelectionPosition({
|
|
|
57
59
|
return null;
|
|
58
60
|
}
|
|
59
61
|
export const onCreateSelectionBetween = (view, $anchor, $head) => {
|
|
60
|
-
var _$head$parent;
|
|
62
|
+
var _$head$parent, _$head$parent2;
|
|
61
63
|
if ($anchor.pos === $head.pos) {
|
|
62
64
|
return null;
|
|
63
65
|
}
|
|
@@ -69,6 +71,11 @@ export const onCreateSelectionBetween = (view, $anchor, $head) => {
|
|
|
69
71
|
if ($head.depth === 1 && ((_$head$parent = $head.parent) === null || _$head$parent === void 0 ? void 0 : _$head$parent.type.name) === 'paragraph') {
|
|
70
72
|
return null;
|
|
71
73
|
}
|
|
74
|
+
|
|
75
|
+
// If head is at the beginning of a non-empty textblock, let ProseMirror handle the text selection
|
|
76
|
+
if ((_$head$parent2 = $head.parent) !== null && _$head$parent2 !== void 0 && _$head$parent2.isTextblock && !isNodeContentEmpty($head.parent) && $head.parentOffset === 0) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
72
79
|
const $nextHeadPosition = findNextSelectionPosition({
|
|
73
80
|
$targetHead: $head,
|
|
74
81
|
$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
|
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
|
};
|
|
@@ -19,7 +19,7 @@ import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
|
19
19
|
import UiDropdown from '../../../ui/Dropdown';
|
|
20
20
|
import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
|
|
21
21
|
import DropdownMenu, { itemSpacing, menuItemDimensions } from './DropdownMenu';
|
|
22
|
-
var dropdownExpandContainer = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin: 0px
|
|
22
|
+
var dropdownExpandContainer = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin: 0px ", ";\n"])), "var(--ds-space-negative-050, -4px)");
|
|
23
23
|
var iconGroup = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n"])));
|
|
24
24
|
var CompositeIcon = function CompositeIcon(_ref) {
|
|
25
25
|
var icon = _ref.icon;
|
|
@@ -112,7 +112,8 @@ var Dropdown = /*#__PURE__*/function (_Component) {
|
|
|
112
112
|
buttonTestId = _this$props2.buttonTestId,
|
|
113
113
|
dropdownWidth = _this$props2.dropdownWidth,
|
|
114
114
|
editorView = _this$props2.editorView,
|
|
115
|
-
dropdownListId = _this$props2.dropdownListId
|
|
115
|
+
dropdownListId = _this$props2.dropdownListId,
|
|
116
|
+
alignDropdownWithToolbar = _this$props2.alignDropdownWithToolbar;
|
|
116
117
|
var trigger;
|
|
117
118
|
if (icon) {
|
|
118
119
|
var TriggerIcon = hideExpandIcon ? icon : jsx(CompositeIcon, {
|
|
@@ -166,7 +167,8 @@ var Dropdown = /*#__PURE__*/function (_Component) {
|
|
|
166
167
|
fitHeight: fitHeight + fitTolerance,
|
|
167
168
|
trigger: trigger,
|
|
168
169
|
editorView: editorView,
|
|
169
|
-
dropdownListId: dropdownListId
|
|
170
|
+
dropdownListId: dropdownListId,
|
|
171
|
+
alignDropdownWithParentElement: alignDropdownWithToolbar
|
|
170
172
|
}, Array.isArray(options) ? this.renderArrayOptions(options) : options.render({
|
|
171
173
|
hide: this.hide,
|
|
172
174
|
dispatchCommand: dispatchCommand
|
|
@@ -139,7 +139,8 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
139
139
|
buttonTestId: item.testId,
|
|
140
140
|
editorView: editorView,
|
|
141
141
|
setDisableParentScroll: scrollable ? setDisableScroll : undefined,
|
|
142
|
-
dropdownListId: (item === null || item === void 0 ? void 0 : item.id) && "".concat(item.id, "-dropdownList")
|
|
142
|
+
dropdownListId: (item === null || item === void 0 ? void 0 : item.id) && "".concat(item.id, "-dropdownList"),
|
|
143
|
+
alignDropdownWithToolbar: items.length === 1
|
|
143
144
|
});
|
|
144
145
|
case 'select':
|
|
145
146
|
if (item.selectType === 'list') {
|
|
@@ -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({});
|