@atlaskit/editor-core 185.16.5 → 185.16.7
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 +12 -0
- package/dist/cjs/plugins/expand/commands.js +15 -12
- package/dist/cjs/plugins/expand/nodeviews/index.js +4 -1
- package/dist/cjs/plugins/media/utils/analytics.js +32 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/expand/commands.js +13 -14
- package/dist/es2019/plugins/expand/nodeviews/index.js +4 -1
- package/dist/es2019/plugins/media/utils/analytics.js +27 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/expand/commands.js +16 -13
- package/dist/esm/plugins/expand/nodeviews/index.js +4 -1
- package/dist/esm/plugins/media/utils/analytics.js +25 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/expand/commands.d.ts +1 -1
- package/dist/types/plugins/media/utils/analytics.d.ts +2 -0
- package/dist/types-ts4.5/plugins/expand/commands.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/utils/analytics.d.ts +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 185.16.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`1d3e0468d4c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1d3e0468d4c) - Adds a new analytics event to be implemented later
|
|
8
|
+
|
|
9
|
+
## 185.16.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`1901ebeafcb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1901ebeafcb) - [ux] Fix expand title selection bug
|
|
14
|
+
|
|
3
15
|
## 185.16.5
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -143,7 +143,7 @@ var focusTitle = function focusTitle(pos) {
|
|
|
143
143
|
var dom = editorView.domAtPos(pos);
|
|
144
144
|
var expandWrapper = dom.node.parentElement;
|
|
145
145
|
if (expandWrapper) {
|
|
146
|
-
setSelectionInsideExpand(state, dispatch, editorView);
|
|
146
|
+
setSelectionInsideExpand(pos)(state, dispatch, editorView);
|
|
147
147
|
var input = expandWrapper.querySelector('input');
|
|
148
148
|
if (input) {
|
|
149
149
|
input.focus();
|
|
@@ -157,16 +157,19 @@ var focusTitle = function focusTitle(pos) {
|
|
|
157
157
|
|
|
158
158
|
// Used to clear any node or cell selection when expand title is focused
|
|
159
159
|
exports.focusTitle = focusTitle;
|
|
160
|
-
var setSelectionInsideExpand = function setSelectionInsideExpand(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
160
|
+
var setSelectionInsideExpand = function setSelectionInsideExpand(expandPos) {
|
|
161
|
+
return function (state, dispatch, editorView) {
|
|
162
|
+
if (editorView) {
|
|
163
|
+
if (!editorView.hasFocus()) {
|
|
164
|
+
editorView.focus();
|
|
165
|
+
}
|
|
166
|
+
var sel = _prosemirrorState.Selection.findFrom(editorView.state.doc.resolve(expandPos), 1, true);
|
|
167
|
+
if (sel && dispatch) {
|
|
168
|
+
dispatch(editorView.state.tr.setSelection(sel));
|
|
169
|
+
}
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
172
|
+
return false;
|
|
173
|
+
};
|
|
171
174
|
};
|
|
172
175
|
exports.setSelectionInsideExpand = setSelectionInsideExpand;
|
|
@@ -72,7 +72,10 @@ var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
72
72
|
state = _this$view.state,
|
|
73
73
|
dispatch = _this$view.dispatch;
|
|
74
74
|
(0, _commands2.setSelectionRelativeToNode)(_types.RelativeSelectionPos.Start)(state, dispatch);
|
|
75
|
-
|
|
75
|
+
var pos = _this.getPos();
|
|
76
|
+
if (typeof pos === 'number') {
|
|
77
|
+
(0, _commands.setSelectionInsideExpand)(pos)(state, dispatch, _this.view);
|
|
78
|
+
}
|
|
76
79
|
_this.input.focus();
|
|
77
80
|
}
|
|
78
81
|
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getMediaResizeAnalyticsEvent = void 0;
|
|
7
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
8
|
+
var getMediaResizeAnalyticsEvent = function getMediaResizeAnalyticsEvent(type, attributes) {
|
|
9
|
+
if (!attributes) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
var size = attributes.size,
|
|
13
|
+
widthType = attributes.widthType,
|
|
14
|
+
layout = attributes.layout,
|
|
15
|
+
snapType = attributes.snapType,
|
|
16
|
+
parentNode = attributes.parentNode;
|
|
17
|
+
var actionSubject = type === 'embed' ? _analytics.ACTION_SUBJECT.EMBEDS : _analytics.ACTION_SUBJECT.MEDIA_SINGLE;
|
|
18
|
+
return {
|
|
19
|
+
action: _analytics.ACTION.EDITED,
|
|
20
|
+
actionSubject: actionSubject,
|
|
21
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.RESIZED,
|
|
22
|
+
attributes: {
|
|
23
|
+
size: size,
|
|
24
|
+
layout: layout,
|
|
25
|
+
widthType: widthType,
|
|
26
|
+
snapType: snapType,
|
|
27
|
+
parentNode: parentNode
|
|
28
|
+
},
|
|
29
|
+
eventType: _analytics.EVENT_TYPE.UI
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
exports.getMediaResizeAnalyticsEvent = getMediaResizeAnalyticsEvent;
|
|
@@ -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 = "185.16.
|
|
9
|
+
var version = "185.16.7";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Selection } from 'prosemirror-state';
|
|
2
2
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
3
3
|
import { addAnalytics, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, INPUT_METHOD, EVENT_TYPE, PLATFORMS, MODE } from '../analytics';
|
|
4
4
|
import { GapCursorSelection, Side } from '../selection/gap-cursor-selection';
|
|
@@ -120,7 +120,7 @@ export const focusTitle = pos => (state, dispatch, editorView) => {
|
|
|
120
120
|
const dom = editorView.domAtPos(pos);
|
|
121
121
|
const expandWrapper = dom.node.parentElement;
|
|
122
122
|
if (expandWrapper) {
|
|
123
|
-
setSelectionInsideExpand(state, dispatch, editorView);
|
|
123
|
+
setSelectionInsideExpand(pos)(state, dispatch, editorView);
|
|
124
124
|
const input = expandWrapper.querySelector('input');
|
|
125
125
|
if (input) {
|
|
126
126
|
input.focus();
|
|
@@ -132,17 +132,16 @@ export const focusTitle = pos => (state, dispatch, editorView) => {
|
|
|
132
132
|
};
|
|
133
133
|
|
|
134
134
|
// Used to clear any node or cell selection when expand title is focused
|
|
135
|
-
export const setSelectionInsideExpand = (state, dispatch, editorView) => {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
dispatch(tr.setSelection(TextSelection.create(doc, selection.from)));
|
|
135
|
+
export const setSelectionInsideExpand = expandPos => (state, dispatch, editorView) => {
|
|
136
|
+
if (editorView) {
|
|
137
|
+
if (!editorView.hasFocus()) {
|
|
138
|
+
editorView.focus();
|
|
139
|
+
}
|
|
140
|
+
const sel = Selection.findFrom(editorView.state.doc.resolve(expandPos), 1, true);
|
|
141
|
+
if (sel && dispatch) {
|
|
142
|
+
dispatch(editorView.state.tr.setSelection(sel));
|
|
143
|
+
}
|
|
144
|
+
return true;
|
|
146
145
|
}
|
|
147
|
-
return
|
|
146
|
+
return false;
|
|
148
147
|
};
|
|
@@ -59,7 +59,10 @@ export class ExpandNodeView {
|
|
|
59
59
|
dispatch
|
|
60
60
|
} = this.view;
|
|
61
61
|
setSelectionRelativeToNode(RelativeSelectionPos.Start)(state, dispatch);
|
|
62
|
-
|
|
62
|
+
const pos = this.getPos();
|
|
63
|
+
if (typeof pos === 'number') {
|
|
64
|
+
setSelectionInsideExpand(pos)(state, dispatch, this.view);
|
|
65
|
+
}
|
|
63
66
|
this.input.focus();
|
|
64
67
|
}
|
|
65
68
|
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
export const getMediaResizeAnalyticsEvent = (type, attributes) => {
|
|
3
|
+
if (!attributes) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
const {
|
|
7
|
+
size,
|
|
8
|
+
widthType,
|
|
9
|
+
layout,
|
|
10
|
+
snapType,
|
|
11
|
+
parentNode
|
|
12
|
+
} = attributes;
|
|
13
|
+
const actionSubject = type === 'embed' ? ACTION_SUBJECT.EMBEDS : ACTION_SUBJECT.MEDIA_SINGLE;
|
|
14
|
+
return {
|
|
15
|
+
action: ACTION.EDITED,
|
|
16
|
+
actionSubject,
|
|
17
|
+
actionSubjectId: ACTION_SUBJECT_ID.RESIZED,
|
|
18
|
+
attributes: {
|
|
19
|
+
size,
|
|
20
|
+
layout,
|
|
21
|
+
widthType,
|
|
22
|
+
snapType,
|
|
23
|
+
parentNode
|
|
24
|
+
},
|
|
25
|
+
eventType: EVENT_TYPE.UI
|
|
26
|
+
};
|
|
27
|
+
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
import {
|
|
4
|
+
import { Selection } from 'prosemirror-state';
|
|
5
5
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
6
6
|
import { addAnalytics, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, INPUT_METHOD, EVENT_TYPE, PLATFORMS, MODE } from '../analytics';
|
|
7
7
|
import { GapCursorSelection, Side } from '../selection/gap-cursor-selection';
|
|
@@ -129,7 +129,7 @@ export var focusTitle = function focusTitle(pos) {
|
|
|
129
129
|
var dom = editorView.domAtPos(pos);
|
|
130
130
|
var expandWrapper = dom.node.parentElement;
|
|
131
131
|
if (expandWrapper) {
|
|
132
|
-
setSelectionInsideExpand(state, dispatch, editorView);
|
|
132
|
+
setSelectionInsideExpand(pos)(state, dispatch, editorView);
|
|
133
133
|
var input = expandWrapper.querySelector('input');
|
|
134
134
|
if (input) {
|
|
135
135
|
input.focus();
|
|
@@ -142,15 +142,18 @@ export var focusTitle = function focusTitle(pos) {
|
|
|
142
142
|
};
|
|
143
143
|
|
|
144
144
|
// Used to clear any node or cell selection when expand title is focused
|
|
145
|
-
export var setSelectionInsideExpand = function setSelectionInsideExpand(
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
145
|
+
export var setSelectionInsideExpand = function setSelectionInsideExpand(expandPos) {
|
|
146
|
+
return function (state, dispatch, editorView) {
|
|
147
|
+
if (editorView) {
|
|
148
|
+
if (!editorView.hasFocus()) {
|
|
149
|
+
editorView.focus();
|
|
150
|
+
}
|
|
151
|
+
var sel = Selection.findFrom(editorView.state.doc.resolve(expandPos), 1, true);
|
|
152
|
+
if (sel && dispatch) {
|
|
153
|
+
dispatch(editorView.state.tr.setSelection(sel));
|
|
154
|
+
}
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
return false;
|
|
158
|
+
};
|
|
156
159
|
};
|
|
@@ -64,7 +64,10 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
64
64
|
state = _this$view.state,
|
|
65
65
|
dispatch = _this$view.dispatch;
|
|
66
66
|
setSelectionRelativeToNode(RelativeSelectionPos.Start)(state, dispatch);
|
|
67
|
-
|
|
67
|
+
var pos = _this.getPos();
|
|
68
|
+
if (typeof pos === 'number') {
|
|
69
|
+
setSelectionInsideExpand(pos)(state, dispatch, _this.view);
|
|
70
|
+
}
|
|
68
71
|
_this.input.focus();
|
|
69
72
|
}
|
|
70
73
|
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
export var getMediaResizeAnalyticsEvent = function getMediaResizeAnalyticsEvent(type, attributes) {
|
|
3
|
+
if (!attributes) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
var size = attributes.size,
|
|
7
|
+
widthType = attributes.widthType,
|
|
8
|
+
layout = attributes.layout,
|
|
9
|
+
snapType = attributes.snapType,
|
|
10
|
+
parentNode = attributes.parentNode;
|
|
11
|
+
var actionSubject = type === 'embed' ? ACTION_SUBJECT.EMBEDS : ACTION_SUBJECT.MEDIA_SINGLE;
|
|
12
|
+
return {
|
|
13
|
+
action: ACTION.EDITED,
|
|
14
|
+
actionSubject: actionSubject,
|
|
15
|
+
actionSubjectId: ACTION_SUBJECT_ID.RESIZED,
|
|
16
|
+
attributes: {
|
|
17
|
+
size: size,
|
|
18
|
+
layout: layout,
|
|
19
|
+
widthType: widthType,
|
|
20
|
+
snapType: snapType,
|
|
21
|
+
parentNode: parentNode
|
|
22
|
+
},
|
|
23
|
+
eventType: EVENT_TYPE.UI
|
|
24
|
+
};
|
|
25
|
+
};
|
package/dist/esm/version.json
CHANGED
|
@@ -9,4 +9,4 @@ export declare const toggleExpandExpanded: (pos: number, nodeType: NodeType) =>
|
|
|
9
9
|
export declare const createExpandNode: (state: EditorState) => PMNode | null;
|
|
10
10
|
export declare const insertExpand: Command;
|
|
11
11
|
export declare const focusTitle: (pos: number) => Command;
|
|
12
|
-
export declare const setSelectionInsideExpand: Command;
|
|
12
|
+
export declare const setSelectionInsideExpand: (expandPos: number) => Command;
|
|
@@ -9,4 +9,4 @@ export declare const toggleExpandExpanded: (pos: number, nodeType: NodeType) =>
|
|
|
9
9
|
export declare const createExpandNode: (state: EditorState) => PMNode | null;
|
|
10
10
|
export declare const insertExpand: Command;
|
|
11
11
|
export declare const focusTitle: (pos: number) => Command;
|
|
12
|
-
export declare const setSelectionInsideExpand: Command;
|
|
12
|
+
export declare const setSelectionInsideExpand: (expandPos: number) => Command;
|