@atlaskit/editor-core 187.8.13 → 187.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/plugins/emoji/commands/insert-emoji.js +31 -28
- package/dist/cjs/plugins/emoji/index.js +4 -3
- package/dist/cjs/plugins/emoji/pm-plugins/ascii-input-rules.js +23 -18
- package/dist/cjs/plugins/extension/pm-plugins/main.js +54 -9
- package/dist/cjs/plugins/floating-toolbar/index.js +1 -3
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +1 -1
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +33 -23
- package/dist/cjs/plugins/media/toolbar/index.js +16 -2
- package/dist/cjs/plugins/media/toolbar/utils.js +7 -2
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +574 -0
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/guidelines.js +117 -0
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.js +15 -0
- package/dist/cjs/plugins/selection/pm-plugins/events/keydown.js +61 -25
- package/dist/cjs/ui/Resizer/ResizeLabel/index.js +20 -0
- package/dist/cjs/ui/Resizer/ResizeLabel/styles.js +17 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/emoji/commands/insert-emoji.js +5 -5
- package/dist/es2019/plugins/emoji/index.js +6 -3
- package/dist/es2019/plugins/emoji/pm-plugins/ascii-input-rules.js +14 -11
- package/dist/es2019/plugins/extension/pm-plugins/main.js +50 -0
- package/dist/es2019/plugins/floating-toolbar/index.js +1 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +34 -23
- package/dist/es2019/plugins/media/toolbar/index.js +19 -3
- package/dist/es2019/plugins/media/toolbar/utils.js +7 -1
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +493 -0
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/guidelines.js +108 -0
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.js +8 -0
- package/dist/es2019/plugins/selection/pm-plugins/events/keydown.js +60 -24
- package/dist/es2019/ui/Resizer/ResizeLabel/index.js +12 -0
- package/dist/es2019/ui/Resizer/ResizeLabel/styles.js +25 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/emoji/commands/insert-emoji.js +29 -27
- package/dist/esm/plugins/emoji/index.js +4 -3
- package/dist/esm/plugins/emoji/pm-plugins/ascii-input-rules.js +23 -18
- package/dist/esm/plugins/extension/pm-plugins/main.js +45 -0
- package/dist/esm/plugins/floating-toolbar/index.js +1 -3
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +33 -23
- package/dist/esm/plugins/media/toolbar/index.js +17 -3
- package/dist/esm/plugins/media/toolbar/utils.js +5 -1
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +564 -0
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/guidelines.js +108 -0
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.js +8 -0
- package/dist/esm/plugins/selection/pm-plugins/events/keydown.js +62 -25
- package/dist/esm/ui/Resizer/ResizeLabel/index.js +12 -0
- package/dist/esm/ui/Resizer/ResizeLabel/styles.js +7 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/labs/next/presets/universal.d.ts +1 -2
- package/dist/types/plugins/emoji/commands/insert-emoji.d.ts +2 -2
- package/dist/types/plugins/emoji/pm-plugins/ascii-input-rules.d.ts +3 -2
- package/dist/types/plugins/extension/pm-plugins/main.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/index.d.ts +3 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/index.d.ts +1 -0
- package/dist/types/plugins/media/index.d.ts +2 -0
- package/dist/types/plugins/media/nodeviews/styles.d.ts +1 -1
- package/dist/types/plugins/media/pm-plugins/main.d.ts +1 -1
- package/dist/types/plugins/media/toolbar/utils.d.ts +1 -0
- package/dist/types/plugins/media/types.d.ts +1 -0
- package/dist/types/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +61 -0
- package/dist/types/plugins/media/ui/ResizableMediaSingle/guidelines.d.ts +4 -0
- package/dist/types/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.d.ts +7 -0
- package/dist/types/plugins/media/ui/ResizableMediaSingle/types.d.ts +1 -0
- package/dist/types/ui/Resizer/ResizeLabel/index.d.ts +8 -0
- package/dist/types/ui/Resizer/ResizeLabel/styles.d.ts +3 -0
- package/dist/types-ts4.5/labs/next/presets/universal.d.ts +1 -2
- package/dist/types-ts4.5/plugins/emoji/commands/insert-emoji.d.ts +2 -2
- package/dist/types-ts4.5/plugins/emoji/pm-plugins/ascii-input-rules.d.ts +3 -2
- package/dist/types-ts4.5/plugins/extension/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/index.d.ts +1 -0
- package/dist/types-ts4.5/plugins/media/index.d.ts +2 -0
- package/dist/types-ts4.5/plugins/media/nodeviews/styles.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/toolbar/utils.d.ts +1 -0
- package/dist/types-ts4.5/plugins/media/types.d.ts +1 -0
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +61 -0
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/guidelines.d.ts +4 -0
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.d.ts +7 -0
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/types.d.ts +1 -0
- package/dist/types-ts4.5/ui/Resizer/ResizeLabel/index.d.ts +8 -0
- package/dist/types-ts4.5/ui/Resizer/ResizeLabel/styles.d.ts +3 -0
- package/package.json +2 -2
- package/report.api.md +7 -4
- package/tmp/api-report-tmp.d.ts +5 -1
|
@@ -1,36 +1,68 @@
|
|
|
1
1
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* The way expand was built, no browser reconize selection on it.
|
|
5
|
+
* For instance, when a selection going to a "collapsed" expand
|
|
6
|
+
* the browser will try to send the cursor to inside the expand content (wrong),
|
|
7
|
+
* this behavior is caused because the expand content is never true hidden
|
|
8
|
+
* we just set the height to 1px.
|
|
9
|
+
*
|
|
10
|
+
* So, we need to capture a possible selection event
|
|
11
|
+
* when a collapsed exxpand is the next node in the common depth.
|
|
12
|
+
* If that is true, we create a new TextSelection and stop the event bubble
|
|
13
|
+
*/
|
|
2
14
|
const isCollpasedExpand = node => {
|
|
3
15
|
return Boolean(node && ['expand', 'nestedExpand'].includes(node.type.name) && !node.attrs.__expanded);
|
|
4
16
|
};
|
|
5
|
-
|
|
6
|
-
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* ED-18072 - Cannot shift + arrow past bodied extension if it is not empty
|
|
20
|
+
*/
|
|
21
|
+
const isBodiedExtension = node => {
|
|
22
|
+
return Boolean(node && ['bodiedExtension'].includes(node.type.name));
|
|
23
|
+
};
|
|
24
|
+
const isProblematicNode = node => {
|
|
25
|
+
return isCollpasedExpand(node) || isBodiedExtension(node);
|
|
26
|
+
};
|
|
27
|
+
const findFixedProblematicNodePosition = (doc, $head, direction) => {
|
|
28
|
+
if ($head.pos === 0 || $head.depth === 0) {
|
|
7
29
|
return null;
|
|
8
30
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
31
|
+
if (direction === 'up') {
|
|
32
|
+
const pos = $head.before();
|
|
33
|
+
const $posResolved = $head.doc.resolve(pos);
|
|
34
|
+
const maybeProblematicNode = $posResolved.nodeBefore;
|
|
35
|
+
if (maybeProblematicNode && isProblematicNode(maybeProblematicNode)) {
|
|
36
|
+
const nodeSize = maybeProblematicNode.nodeSize;
|
|
37
|
+
const nodeStartPosition = pos - nodeSize;
|
|
38
|
+
|
|
39
|
+
// ($head.pos - 1) will correspond to (nodeStartPosition + nodeSize) when we are at the start of the text node
|
|
40
|
+
const isAtEndOfProblematicNode = $head.pos - 1 === nodeStartPosition + nodeSize;
|
|
41
|
+
if (isAtEndOfProblematicNode) {
|
|
42
|
+
const startPosNode = Math.max(nodeStartPosition, 0);
|
|
43
|
+
const $startPosNode = $head.doc.resolve(Math.min(startPosNode, $head.doc.content.size));
|
|
44
|
+
return $startPosNode;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (direction === 'down') {
|
|
49
|
+
const pos = $head.after();
|
|
50
|
+
const maybeProblematicNode = doc.nodeAt(pos);
|
|
51
|
+
if (maybeProblematicNode && isProblematicNode(maybeProblematicNode) && $head.pos + 1 === pos) {
|
|
52
|
+
const nodeSize = maybeProblematicNode.nodeSize;
|
|
53
|
+
const nodePosition = pos + nodeSize;
|
|
54
|
+
const startPosNode = Math.max(nodePosition, 0);
|
|
55
|
+
const $startPosNode = $head.doc.resolve(Math.min(startPosNode, $head.doc.content.size));
|
|
56
|
+
return $startPosNode;
|
|
57
|
+
}
|
|
18
58
|
}
|
|
19
59
|
return null;
|
|
20
60
|
};
|
|
21
61
|
export const onKeydown = (view, event) => {
|
|
22
62
|
/*
|
|
23
|
-
* This workaround is needed for some specific
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* For instance, when a selection going to a "collapsed" expand
|
|
27
|
-
* the browser will try to send the cursor to inside the expand content (wrong),
|
|
28
|
-
* this behavior is caused because the expand content is never true hidden
|
|
29
|
-
* we just set the height to 1px.
|
|
30
|
-
*
|
|
31
|
-
* So, we need to capture a possible selection event
|
|
32
|
-
* when a collapsed exxpand is the next node in the common depth.
|
|
33
|
-
* If that is true, we create a new TextSelection and stop the event bubble
|
|
63
|
+
* This workaround is needed for some specific situations.
|
|
64
|
+
* - expand collapse
|
|
65
|
+
* - bodied extension
|
|
34
66
|
*/
|
|
35
67
|
if (!(event instanceof KeyboardEvent)) {
|
|
36
68
|
return false;
|
|
@@ -42,6 +74,7 @@ export const onKeydown = (view, event) => {
|
|
|
42
74
|
return false;
|
|
43
75
|
}
|
|
44
76
|
const {
|
|
77
|
+
doc,
|
|
45
78
|
selection: {
|
|
46
79
|
$head,
|
|
47
80
|
$anchor
|
|
@@ -51,9 +84,12 @@ export const onKeydown = (view, event) => {
|
|
|
51
84
|
return false;
|
|
52
85
|
}
|
|
53
86
|
const direction = ['ArrowLeft', 'ArrowUp', 'Home'].includes(event.key) ? 'up' : 'down';
|
|
54
|
-
const $fixedProblematicNodePosition = findFixedProblematicNodePosition($head, direction);
|
|
87
|
+
const $fixedProblematicNodePosition = findFixedProblematicNodePosition(doc, $head, direction);
|
|
55
88
|
if ($fixedProblematicNodePosition) {
|
|
56
|
-
|
|
89
|
+
// an offset is used here so that left arrow selects the first character before the node (consistent with arrow right)
|
|
90
|
+
const headOffset = event.key === 'ArrowLeft' ? -1 : 0;
|
|
91
|
+
const head = $fixedProblematicNodePosition.pos + headOffset;
|
|
92
|
+
const forcedTextSelection = TextSelection.create(view.state.doc, $anchor.pos, head);
|
|
57
93
|
const tr = view.state.tr;
|
|
58
94
|
tr.setSelection(forcedTextSelection);
|
|
59
95
|
view.dispatch(tr);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import { wrapper, text, smallText } from './styles';
|
|
4
|
+
const ResizeLabelBreakoutWidth = 110;
|
|
5
|
+
const ResizeLabel = props => {
|
|
6
|
+
return jsx("div", {
|
|
7
|
+
css: wrapper
|
|
8
|
+
}, jsx("span", {
|
|
9
|
+
css: [text, props.containerWidth < ResizeLabelBreakoutWidth && smallText]
|
|
10
|
+
}, props.label));
|
|
11
|
+
};
|
|
12
|
+
export default ResizeLabel;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
import { B300 } from '@atlaskit/theme/colors';
|
|
3
|
+
export const wrapper = css`
|
|
4
|
+
font-size: ${"var(--ds-font-size-100, 14px)"};
|
|
5
|
+
width: 100%;
|
|
6
|
+
text-align: center;
|
|
7
|
+
position: absolute;
|
|
8
|
+
transform: translateY(-125%);
|
|
9
|
+
top: 0;
|
|
10
|
+
`;
|
|
11
|
+
export const text = css`
|
|
12
|
+
display: inline-block;
|
|
13
|
+
border-radius: 6px;
|
|
14
|
+
min-width: 75px;
|
|
15
|
+
background-color: ${`var(--ds-text-accent-blue, ${B300})`};
|
|
16
|
+
color: ${"var(--ds-text-inverse, white)"};
|
|
17
|
+
padding: ${"var(--ds-space-050, 4px)"} ${"var(--ds-space-200, 16px)"};
|
|
18
|
+
letter-spacing: 0.5px;
|
|
19
|
+
`;
|
|
20
|
+
export const smallText = css`
|
|
21
|
+
letter-spacing: -0.5px;
|
|
22
|
+
font-size: ${"var(--ds-font-size-050, 8px)"};
|
|
23
|
+
min-width: 27px;
|
|
24
|
+
padding: ${"var(--ds-space-0, 0px)"} ${"var(--ds-space-025, 2px)"};
|
|
25
|
+
`;
|
package/dist/es2019/version.json
CHANGED
|
@@ -4,33 +4,35 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
-
import {
|
|
8
|
-
export function insertEmoji(
|
|
9
|
-
return function (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
7
|
+
import { EVENT_TYPE, ACTION_SUBJECT_ID, ACTION_SUBJECT, ACTION } from '@atlaskit/editor-common/analytics';
|
|
8
|
+
export var insertEmoji = function insertEmoji(editorAnalyticsAPI) {
|
|
9
|
+
return function (emojiId, inputMethod) {
|
|
10
|
+
return function (state, dispatch) {
|
|
11
|
+
var emoji = state.schema.nodes.emoji;
|
|
12
|
+
if (emoji && emojiId) {
|
|
13
|
+
var node = emoji.createChecked(_objectSpread(_objectSpread({}, emojiId), {}, {
|
|
14
|
+
text: emojiId.fallback || emojiId.shortName
|
|
15
|
+
}));
|
|
16
|
+
var textNode = state.schema.text(' ');
|
|
17
|
+
if (dispatch) {
|
|
18
|
+
var fragment = Fragment.fromArray([node, textNode]);
|
|
19
|
+
var tr = safeInsert(fragment)(state.tr);
|
|
20
|
+
if (inputMethod) {
|
|
21
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
22
|
+
action: ACTION.INSERTED,
|
|
23
|
+
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
24
|
+
actionSubjectId: ACTION_SUBJECT_ID.EMOJI,
|
|
25
|
+
attributes: {
|
|
26
|
+
inputMethod: inputMethod
|
|
27
|
+
},
|
|
28
|
+
eventType: EVENT_TYPE.TRACK
|
|
29
|
+
})(tr);
|
|
30
|
+
}
|
|
31
|
+
dispatch(tr.setSelection(Selection.near(tr.doc.resolve(state.selection.$from.pos + fragment.size))));
|
|
29
32
|
}
|
|
30
|
-
|
|
33
|
+
return true;
|
|
31
34
|
}
|
|
32
|
-
return
|
|
33
|
-
}
|
|
34
|
-
return false;
|
|
35
|
+
return false;
|
|
36
|
+
};
|
|
35
37
|
};
|
|
36
|
-
}
|
|
38
|
+
};
|
|
@@ -174,10 +174,11 @@ var emojiPlugin = function emojiPlugin(options, api) {
|
|
|
174
174
|
}, {
|
|
175
175
|
name: 'emojiAsciiInputRule',
|
|
176
176
|
plugin: function plugin(_ref6) {
|
|
177
|
+
var _api$dependencies$ana8;
|
|
177
178
|
var schema = _ref6.schema,
|
|
178
179
|
providerFactory = _ref6.providerFactory,
|
|
179
180
|
featureFlags = _ref6.featureFlags;
|
|
180
|
-
return asciiInputRulePlugin(schema, providerFactory, featureFlags);
|
|
181
|
+
return asciiInputRulePlugin(schema, providerFactory, featureFlags, api === null || api === void 0 ? void 0 : (_api$dependencies$ana8 = api.dependencies.analytics) === null || _api$dependencies$ana8 === void 0 ? void 0 : _api$dependencies$ana8.actions);
|
|
181
182
|
}
|
|
182
183
|
}];
|
|
183
184
|
},
|
|
@@ -194,13 +195,13 @@ var emojiPlugin = function emojiPlugin(options, api) {
|
|
|
194
195
|
return /*#__PURE__*/React.createElement(IconEmoji, null);
|
|
195
196
|
},
|
|
196
197
|
action: function action(insert, state) {
|
|
197
|
-
var _api$dependencies$
|
|
198
|
+
var _api$dependencies$ana9;
|
|
198
199
|
var tr = insert(undefined);
|
|
199
200
|
openTypeAheadAtCursor({
|
|
200
201
|
triggerHandler: typeAhead,
|
|
201
202
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
202
203
|
})(tr);
|
|
203
|
-
api === null || api === void 0 ? void 0 : (_api$dependencies$
|
|
204
|
+
api === null || api === void 0 ? void 0 : (_api$dependencies$ana9 = api.dependencies.analytics) === null || _api$dependencies$ana9 === void 0 ? void 0 : _api$dependencies$ana9.actions.attachAnalyticsEvent({
|
|
204
205
|
action: ACTION.INVOKED,
|
|
205
206
|
actionSubject: ACTION_SUBJECT.TYPEAHEAD,
|
|
206
207
|
actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_EMOJI,
|
|
@@ -10,12 +10,12 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
10
10
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
11
11
|
import { createRule, createPlugin } from '@atlaskit/prosemirror-input-rules';
|
|
12
12
|
import { leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
|
|
13
|
-
import {
|
|
13
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, INPUT_METHOD, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
14
14
|
var matcher;
|
|
15
|
-
export function inputRulePlugin(schema, providerFactory, featureFlags) {
|
|
15
|
+
export function inputRulePlugin(schema, providerFactory, featureFlags, editorAnalyticsAPI) {
|
|
16
16
|
if (schema.nodes.emoji && providerFactory) {
|
|
17
17
|
initMatcher(providerFactory);
|
|
18
|
-
var asciiEmojiRule = createRule(AsciiEmojiMatcher.REGEX, inputRuleHandler);
|
|
18
|
+
var asciiEmojiRule = createRule(AsciiEmojiMatcher.REGEX, inputRuleHandler(editorAnalyticsAPI));
|
|
19
19
|
return createPlugin('emoji', [asciiEmojiRule]);
|
|
20
20
|
}
|
|
21
21
|
return;
|
|
@@ -33,17 +33,19 @@ function initMatcher(providerFactory) {
|
|
|
33
33
|
};
|
|
34
34
|
providerFactory.subscribe('emojiProvider', handleProvider);
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
var inputRuleHandler = function inputRuleHandler(editorAnalyticsAPI) {
|
|
37
|
+
return function (state, matchParts, start, end) {
|
|
38
|
+
if (!matcher) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
var match = matcher.match(matchParts);
|
|
42
|
+
if (match) {
|
|
43
|
+
var transactionCreator = new AsciiEmojiTransactionCreator(state, match, start, end, editorAnalyticsAPI);
|
|
44
|
+
return transactionCreator.create();
|
|
45
|
+
}
|
|
38
46
|
return null;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (match) {
|
|
42
|
-
var transactionCreator = new AsciiEmojiTransactionCreator(state, match, start, end);
|
|
43
|
-
return transactionCreator.create();
|
|
44
|
-
}
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
+
};
|
|
48
|
+
};
|
|
47
49
|
var REGEX_LEADING_CAPTURE_INDEX = 1;
|
|
48
50
|
var REGEX_EMOJI_LEADING_PARENTHESES = 2;
|
|
49
51
|
var REGEX_EMOJI_ASCII_CAPTURE_INDEX = 3;
|
|
@@ -142,18 +144,20 @@ var RecordingAsciiEmojiMatcher = /*#__PURE__*/function (_AsciiEmojiMatcher) {
|
|
|
142
144
|
return RecordingAsciiEmojiMatcher;
|
|
143
145
|
}(AsciiEmojiMatcher);
|
|
144
146
|
var AsciiEmojiTransactionCreator = /*#__PURE__*/function () {
|
|
145
|
-
function AsciiEmojiTransactionCreator(state, match, start, end) {
|
|
147
|
+
function AsciiEmojiTransactionCreator(state, match, start, end, editorAnalyticsAPI) {
|
|
146
148
|
_classCallCheck(this, AsciiEmojiTransactionCreator);
|
|
147
149
|
this.state = state;
|
|
148
150
|
this.match = match;
|
|
149
151
|
this.start = start;
|
|
150
152
|
this.end = end;
|
|
153
|
+
this.editorAnalyticsAPI = editorAnalyticsAPI;
|
|
151
154
|
}
|
|
152
155
|
_createClass(AsciiEmojiTransactionCreator, [{
|
|
153
156
|
key: "create",
|
|
154
157
|
value: function create() {
|
|
158
|
+
var _this$editorAnalytics;
|
|
155
159
|
var tr = this.state.tr.replaceWith(this.from, this.to, this.createNodes());
|
|
156
|
-
|
|
160
|
+
(_this$editorAnalytics = this.editorAnalyticsAPI) === null || _this$editorAnalytics === void 0 ? void 0 : _this$editorAnalytics.attachAnalyticsEvent({
|
|
157
161
|
action: ACTION.INSERTED,
|
|
158
162
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
159
163
|
actionSubjectId: ACTION_SUBJECT_ID.EMOJI,
|
|
@@ -161,7 +165,8 @@ var AsciiEmojiTransactionCreator = /*#__PURE__*/function () {
|
|
|
161
165
|
inputMethod: INPUT_METHOD.ASCII
|
|
162
166
|
},
|
|
163
167
|
eventType: EVENT_TYPE.TRACK
|
|
164
|
-
});
|
|
168
|
+
})(tr);
|
|
169
|
+
return tr;
|
|
165
170
|
}
|
|
166
171
|
}, {
|
|
167
172
|
key: "from",
|
|
@@ -212,8 +217,8 @@ var AsciiEmojiTransactionCreator = /*#__PURE__*/function () {
|
|
|
212
217
|
return AsciiEmojiTransactionCreator;
|
|
213
218
|
}();
|
|
214
219
|
export var stateKey = new PluginKey('asciiEmojiPlugin');
|
|
215
|
-
var plugins = function plugins(schema, providerFactory, featureFlags) {
|
|
216
|
-
return [inputRulePlugin(schema, providerFactory, featureFlags)].filter(function (plugin) {
|
|
220
|
+
var plugins = function plugins(schema, providerFactory, featureFlags, editorAnalyticsAPI) {
|
|
221
|
+
return [inputRulePlugin(schema, providerFactory, featureFlags, editorAnalyticsAPI)].filter(function (plugin) {
|
|
217
222
|
return !!plugin;
|
|
218
223
|
});
|
|
219
224
|
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
import { TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
+
import { findParentNodeOfTypeClosestToPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
4
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
|
+
import { isSelectionAtStartOfNode, isSelectionAtEndOfNode } from '@atlaskit/editor-common/selection';
|
|
5
8
|
import { createSelectionClickHandler } from '../../selection/utils';
|
|
6
9
|
import ExtensionNodeView from '../nodeviews/extension';
|
|
7
10
|
import { updateState, clearEditingContext } from '../commands';
|
|
@@ -234,6 +237,48 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
|
|
|
234
237
|
},
|
|
235
238
|
key: pluginKey,
|
|
236
239
|
props: {
|
|
240
|
+
handleDOMEvents: {
|
|
241
|
+
/**
|
|
242
|
+
* ED-18072 - Cannot shift + arrow past bodied extension if it is not empty.
|
|
243
|
+
* This code is to handle the case where the selection starts inside or on the node and the user is trying to shift + arrow.
|
|
244
|
+
* For other part of the solution see code in: packages/editor/editor-core/src/plugins/selection/pm-plugins/events/keydown.ts
|
|
245
|
+
*/
|
|
246
|
+
keydown: function keydown(view, event) {
|
|
247
|
+
if (event instanceof KeyboardEvent && event.shiftKey && ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(event.key)) {
|
|
248
|
+
var _view$state = view.state,
|
|
249
|
+
schema = _view$state.schema,
|
|
250
|
+
selection = _view$state.selection,
|
|
251
|
+
$head = _view$state.selection.$head,
|
|
252
|
+
doc = _view$state.doc,
|
|
253
|
+
tr = _view$state.tr;
|
|
254
|
+
var bodiedExtension = schema.nodes.bodiedExtension;
|
|
255
|
+
if (selection instanceof TextSelection || selection instanceof NodeSelection) {
|
|
256
|
+
var maybeBodiedExtension = selection instanceof TextSelection ? findParentNodeOfTypeClosestToPos($head, bodiedExtension) : findSelectedNodeOfType(bodiedExtension)(selection);
|
|
257
|
+
if (maybeBodiedExtension) {
|
|
258
|
+
var end = maybeBodiedExtension.pos + maybeBodiedExtension.node.nodeSize;
|
|
259
|
+
if (event.key === 'ArrowUp' || event.key === 'ArrowLeft' && isSelectionAtStartOfNode($head, maybeBodiedExtension)) {
|
|
260
|
+
var anchor = end + 1;
|
|
261
|
+
|
|
262
|
+
// an offset is used here so that left arrow selects the first character before the node (consistent with arrow right)
|
|
263
|
+
var headOffset = event.key === 'ArrowLeft' ? -1 : 0;
|
|
264
|
+
var head = maybeBodiedExtension.pos + headOffset;
|
|
265
|
+
var newSelection = TextSelection.create(doc, Math.max(anchor, selection.anchor), head);
|
|
266
|
+
view.dispatch(tr.setSelection(newSelection));
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
if (event.key === 'ArrowDown' || event.key === 'ArrowRight' && isSelectionAtEndOfNode($head, maybeBodiedExtension)) {
|
|
270
|
+
var _anchor = maybeBodiedExtension.pos - 1;
|
|
271
|
+
var _head = end + 1;
|
|
272
|
+
var _newSelection = TextSelection.create(doc, Math.min(_anchor, selection.anchor), _head);
|
|
273
|
+
view.dispatch(tr.setSelection(_newSelection));
|
|
274
|
+
return true;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
},
|
|
237
282
|
nodeViews: {
|
|
238
283
|
// WARNING: referentiality-plugin also creates these nodeviews
|
|
239
284
|
extension: ExtensionNodeView(portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi),
|
|
@@ -323,9 +323,7 @@ function floatingToolbarPluginFactory(options) {
|
|
|
323
323
|
return relevantConfig;
|
|
324
324
|
};
|
|
325
325
|
var apply = function apply(tr, pluginState) {
|
|
326
|
-
var newPluginState = {
|
|
327
|
-
getConfigWithNodeInfo: getConfigWithNodeInfo
|
|
328
|
-
};
|
|
326
|
+
var newPluginState = _objectSpread({}, pluginState);
|
|
329
327
|
dispatch(pluginKey, newPluginState);
|
|
330
328
|
return newPluginState;
|
|
331
329
|
};
|
|
@@ -283,7 +283,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
283
283
|
});
|
|
284
284
|
_defineProperty(_assertThisInitialized(_this), "handleSelectedEmoji", function (emojiId) {
|
|
285
285
|
_this.props.editorView.focus();
|
|
286
|
-
insertEmoji(emojiId, INPUT_METHOD.PICKER)(_this.props.editorView.state, _this.props.editorView.dispatch);
|
|
286
|
+
insertEmoji(_this.editorAnalyticsAPI)(emojiId, INPUT_METHOD.PICKER)(_this.props.editorView.state, _this.props.editorView.dispatch);
|
|
287
287
|
_this.toggleEmojiPicker();
|
|
288
288
|
return true;
|
|
289
289
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _get from "@babel/runtime/helpers/get";
|
|
2
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
3
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
@@ -21,6 +20,7 @@ import { MediaSingle, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaski
|
|
|
21
20
|
import { browser, floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
|
|
22
21
|
import { isNodeSelectedOrInRange } from '../../../utils/nodes';
|
|
23
22
|
import { setNodeSelection, setTextSelection } from '../../../utils';
|
|
23
|
+
import ResizableMediaSingleNext from '../ui/ResizableMediaSingle/ResizableMediaSingleNext';
|
|
24
24
|
import ResizableMediaSingle from '../ui/ResizableMediaSingle';
|
|
25
25
|
import { MEDIA_CONTENT_WRAP_CLASS_NAME } from '../pm-plugins/main';
|
|
26
26
|
import { MediaNodeUpdater } from './mediaNodeUpdater';
|
|
@@ -35,6 +35,8 @@ import CaptionPlaceholder from '../ui/CaptionPlaceholder';
|
|
|
35
35
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
36
36
|
import { insertAndSelectCaptionFromMediaSinglePos } from '../commands/captions';
|
|
37
37
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
38
|
+
import { getMediaSinglePixelWidth } from '@atlaskit/editor-common/media-single';
|
|
39
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
38
40
|
var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
39
41
|
_inherits(MediaSingleNode, _Component);
|
|
40
42
|
var _super = _createSuper(MediaSingleNode);
|
|
@@ -199,7 +201,8 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
199
201
|
}
|
|
200
202
|
var tr = state.tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, _this.props.node.attrs), {}, {
|
|
201
203
|
layout: layout,
|
|
202
|
-
width: width
|
|
204
|
+
width: width,
|
|
205
|
+
widthType: 'pixel'
|
|
203
206
|
}));
|
|
204
207
|
tr.setMeta('scrollIntoView', false);
|
|
205
208
|
/**
|
|
@@ -311,12 +314,19 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
311
314
|
mediaOptions = _this$props2.mediaOptions,
|
|
312
315
|
fullWidthMode = _this$props2.fullWidthMode,
|
|
313
316
|
state = _this$props2.view.state,
|
|
314
|
-
view = _this$props2.view
|
|
317
|
+
view = _this$props2.view,
|
|
318
|
+
pluginInjectionApi = _this$props2.pluginInjectionApi,
|
|
319
|
+
containerWidth = _this$props2.width,
|
|
320
|
+
lineLength = _this$props2.lineLength,
|
|
321
|
+
dispatchAnalyticsEvent = _this$props2.dispatchAnalyticsEvent;
|
|
315
322
|
var _ref4 = node.attrs,
|
|
316
323
|
layout = _ref4.layout,
|
|
317
|
-
|
|
324
|
+
widthType = _ref4.widthType,
|
|
325
|
+
mediaSingleWidthAttribute = _ref4.width;
|
|
318
326
|
var childNode = node.firstChild;
|
|
319
327
|
var attrs = childNode.attrs;
|
|
328
|
+
|
|
329
|
+
// original width and height of child media node (scaled)
|
|
320
330
|
var width = attrs.width,
|
|
321
331
|
height = attrs.height;
|
|
322
332
|
if (attrs.type === 'external') {
|
|
@@ -343,16 +353,29 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
343
353
|
width = DEFAULT_IMAGE_WIDTH;
|
|
344
354
|
height = DEFAULT_IMAGE_HEIGHT;
|
|
345
355
|
}
|
|
356
|
+
var isSelected = selected();
|
|
346
357
|
var mediaSingleProps = {
|
|
347
358
|
layout: layout,
|
|
348
359
|
width: width,
|
|
349
360
|
height: height,
|
|
350
|
-
containerWidth:
|
|
351
|
-
lineLength: this.
|
|
352
|
-
pctWidth:
|
|
361
|
+
containerWidth: containerWidth,
|
|
362
|
+
lineLength: this.getLineLength(view, getPos()) || lineLength,
|
|
363
|
+
pctWidth: mediaSingleWidthAttribute,
|
|
353
364
|
fullWidthMode: fullWidthMode,
|
|
354
|
-
hasFallbackContainer: false
|
|
365
|
+
hasFallbackContainer: false,
|
|
366
|
+
mediaSingleWidth: mediaSingleWidthAttribute && getMediaSinglePixelWidth(mediaSingleWidthAttribute, lineLength, widthType)
|
|
355
367
|
};
|
|
368
|
+
var ResizableMediaSingleProps = _objectSpread({
|
|
369
|
+
view: view,
|
|
370
|
+
getPos: getPos,
|
|
371
|
+
updateSize: this.updateSize,
|
|
372
|
+
gridSize: 12,
|
|
373
|
+
viewMediaClientConfig: this.state.viewMediaClientConfig,
|
|
374
|
+
allowBreakoutSnapPoints: mediaOptions && mediaOptions.allowBreakoutSnapPoints,
|
|
375
|
+
selected: isSelected,
|
|
376
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
377
|
+
pluginInjectionApi: pluginInjectionApi
|
|
378
|
+
}, mediaSingleProps);
|
|
356
379
|
var canResize = !!this.props.mediaOptions.allowResizing;
|
|
357
380
|
if (!this.props.mediaOptions.allowResizingInTables) {
|
|
358
381
|
// If resizing not allowed in tables, check parents for tables
|
|
@@ -364,12 +387,10 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
364
387
|
canResize = canResize && !disabledNode;
|
|
365
388
|
}
|
|
366
389
|
}
|
|
367
|
-
var lineLength = this.getLineLength(view, getPos()) || this.props.lineLength;
|
|
368
|
-
var isSelected = selected();
|
|
369
390
|
var shouldShowPlaceholder = getMediaFeatureFlag('captions', mediaOptions.featureFlags) && node.childCount !== 2 && isSelected && state.selection instanceof NodeSelection;
|
|
370
391
|
var MediaChildren = jsx("figure", {
|
|
371
392
|
ref: this.mediaSingleWrapperRef,
|
|
372
|
-
css: figureWrapper,
|
|
393
|
+
css: [figureWrapper],
|
|
373
394
|
className: MediaSingleNodeSelector,
|
|
374
395
|
onClick: this.onMediaSingleClicked
|
|
375
396
|
}, jsx("div", {
|
|
@@ -378,18 +399,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
378
399
|
ref: this.captionPlaceHolderRef,
|
|
379
400
|
onClick: this.clickPlaceholder
|
|
380
401
|
}));
|
|
381
|
-
return canResize ? jsx(ResizableMediaSingle,
|
|
382
|
-
lineLength: lineLength,
|
|
383
|
-
view: this.props.view,
|
|
384
|
-
getPos: getPos,
|
|
385
|
-
updateSize: this.updateSize,
|
|
386
|
-
gridSize: 12,
|
|
387
|
-
viewMediaClientConfig: this.state.viewMediaClientConfig,
|
|
388
|
-
allowBreakoutSnapPoints: mediaOptions && mediaOptions.allowBreakoutSnapPoints,
|
|
389
|
-
selected: isSelected,
|
|
390
|
-
dispatchAnalyticsEvent: this.props.dispatchAnalyticsEvent,
|
|
391
|
-
pluginInjectionApi: this.props.pluginInjectionApi
|
|
392
|
-
}), MediaChildren) : jsx(MediaSingle, mediaSingleProps, MediaChildren);
|
|
402
|
+
return canResize ? getBooleanFF('platform.editor.media.extended-resize-experience') ? jsx(ResizableMediaSingleNext, ResizableMediaSingleProps, MediaChildren) : jsx(ResizableMediaSingle, ResizableMediaSingleProps, MediaChildren) : jsx(MediaSingle, mediaSingleProps, MediaChildren);
|
|
393
403
|
}
|
|
394
404
|
}]);
|
|
395
405
|
return MediaSingleNode;
|
|
@@ -20,8 +20,9 @@ import { LinkToolbarAppearance } from './linking-toolbar-appearance';
|
|
|
20
20
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
21
21
|
import { messages } from '@atlaskit/media-ui';
|
|
22
22
|
import { cardMessages } from '@atlaskit/editor-common/messages';
|
|
23
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
23
24
|
import { FilePreviewItem } from './filePreviewItem';
|
|
24
|
-
import { downloadMedia, removeMediaGroupNode } from './utils';
|
|
25
|
+
import { downloadMedia, getSelectedMediaSingle, removeMediaGroupNode } from './utils';
|
|
25
26
|
import { changeInlineToMediaCard, changeMediaCardToInline, removeInlineCard, setBorderMark, toggleBorderMark } from './commands';
|
|
26
27
|
import { MediaInlineNodeSelector, MediaSingleNodeSelector } from '../nodeviews/styles';
|
|
27
28
|
import ImageBorderItem from '../ui/ImageBorder';
|
|
@@ -225,7 +226,20 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
225
226
|
}
|
|
226
227
|
if (allowAdvancedToolBarOptions) {
|
|
227
228
|
var _pluginInjectionApi$d;
|
|
228
|
-
var
|
|
229
|
+
var widthPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.width;
|
|
230
|
+
var isChangingLayoutDisabled = false;
|
|
231
|
+
if (getBooleanFF('platform.editor.media.extended-resize-experience')) {
|
|
232
|
+
var _widthPlugin$sharedSt;
|
|
233
|
+
var contentWidth = widthPlugin === null || widthPlugin === void 0 ? void 0 : (_widthPlugin$sharedSt = widthPlugin.sharedState.currentState()) === null || _widthPlugin$sharedSt === void 0 ? void 0 : _widthPlugin$sharedSt.lineLength;
|
|
234
|
+
var selectedNode = getSelectedMediaSingle(state);
|
|
235
|
+
if (selectedNode && contentWidth) {
|
|
236
|
+
var width = selectedNode.node.attrs.width;
|
|
237
|
+
if (width >= contentWidth) {
|
|
238
|
+
isChangingLayoutDisabled = true;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
var layoutButtons = buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, widthPlugin, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions, allowResizing, allowResizingInTables, true, true, isChangingLayoutDisabled);
|
|
229
243
|
toolbarButtons = [].concat(_toConsumableArray(toolbarButtons), _toConsumableArray(layoutButtons));
|
|
230
244
|
if (layoutButtons.length) {
|
|
231
245
|
toolbarButtons.push({
|
|
@@ -327,7 +341,7 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
327
341
|
var mediaLinkingState = getMediaLinkingState(state);
|
|
328
342
|
var _ref2 = (_pluginInjectionApi$d4 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d4 !== void 0 ? _pluginInjectionApi$d4 : {},
|
|
329
343
|
hoverDecoration = _ref2.hoverDecoration;
|
|
330
|
-
if (!mediaPluginState) {
|
|
344
|
+
if (!mediaPluginState || mediaPluginState.isResizing) {
|
|
331
345
|
return;
|
|
332
346
|
}
|
|
333
347
|
var nodeType = allowMediaInline ? [mediaInline, mediaSingle, media] : [mediaSingle];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { getMediaClient } from '@atlaskit/media-client';
|
|
4
|
-
import { findParentNodeOfType, removeParentNodeOfType, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
+
import { findParentNodeOfType, removeParentNodeOfType, removeSelectedNode, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
export var getSelectedMediaContainerNodeAttrs = function getSelectedMediaContainerNodeAttrs(mediaPluginState) {
|
|
6
6
|
var selectedNode = mediaPluginState.selectedMediaContainerNode();
|
|
7
7
|
if (selectedNode && selectedNode.attrs) {
|
|
@@ -58,4 +58,8 @@ export var removeMediaGroupNode = function removeMediaGroupNode(state) {
|
|
|
58
58
|
tr = removeSelectedNode(tr);
|
|
59
59
|
}
|
|
60
60
|
return tr;
|
|
61
|
+
};
|
|
62
|
+
export var getSelectedMediaSingle = function getSelectedMediaSingle(state) {
|
|
63
|
+
var mediaSingle = state.schema.nodes.mediaSingle;
|
|
64
|
+
return findSelectedNodeOfType(mediaSingle)(state.selection) || findParentNodeOfType(mediaSingle)(state.selection);
|
|
61
65
|
};
|