@atlaskit/editor-plugin-layout 2.6.1 → 2.7.1
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 +21 -0
- package/dist/cjs/layoutPlugin.js +34 -8
- package/dist/cjs/pm-plugins/actions.js +5 -3
- package/dist/cjs/ui/toolbar.js +4 -3
- package/dist/es2019/layoutPlugin.js +34 -8
- package/dist/es2019/pm-plugins/actions.js +5 -3
- package/dist/es2019/ui/toolbar.js +4 -3
- package/dist/esm/layoutPlugin.js +34 -8
- package/dist/esm/pm-plugins/actions.js +5 -3
- package/dist/esm/ui/toolbar.js +4 -3
- package/dist/types/pm-plugins/actions.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/actions.d.ts +2 -2
- package/package.json +10 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-layout
|
|
2
2
|
|
|
3
|
+
## 2.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#149482](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/149482)
|
|
8
|
+
[`1f1f73876c3c8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1f1f73876c3c8) -
|
|
9
|
+
ED-27860 Add analytics for copy and delete button in floating toolbars
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 2.7.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#146198](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/146198)
|
|
17
|
+
[`86a786e83342d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/86a786e83342d) -
|
|
18
|
+
ED-27730 update layout analytics to include layout column count
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
3
24
|
## 2.6.1
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/dist/cjs/layoutPlugin.js
CHANGED
|
@@ -13,6 +13,7 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
13
13
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
14
14
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
15
15
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
16
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
17
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
17
18
|
var _actions = require("./pm-plugins/actions");
|
|
18
19
|
var _main = _interopRequireDefault(require("./pm-plugins/main"));
|
|
@@ -102,14 +103,15 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
|
|
|
102
103
|
},
|
|
103
104
|
quickInsert: function quickInsert(_ref4) {
|
|
104
105
|
var formatMessage = _ref4.formatMessage;
|
|
105
|
-
var withInsertLayoutAnalytics = function withInsertLayoutAnalytics(tr) {
|
|
106
|
+
var withInsertLayoutAnalytics = function withInsertLayoutAnalytics(tr, columnCount) {
|
|
106
107
|
var _api$analytics2;
|
|
107
108
|
api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || (_api$analytics2 = _api$analytics2.actions) === null || _api$analytics2 === void 0 || _api$analytics2.attachAnalyticsEvent({
|
|
108
109
|
action: _analytics.ACTION.INSERTED,
|
|
109
110
|
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
110
111
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.LAYOUT,
|
|
111
112
|
attributes: {
|
|
112
|
-
inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
|
|
113
|
+
inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT,
|
|
114
|
+
columnCount: columnCount
|
|
113
115
|
},
|
|
114
116
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
115
117
|
})(tr);
|
|
@@ -126,7 +128,11 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
|
|
|
126
128
|
},
|
|
127
129
|
action: function action(insert, state, _source) {
|
|
128
130
|
var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 1));
|
|
129
|
-
|
|
131
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_column_count_analytics')) {
|
|
132
|
+
withInsertLayoutAnalytics(tr, 1);
|
|
133
|
+
} else {
|
|
134
|
+
withInsertLayoutAnalytics(tr);
|
|
135
|
+
}
|
|
130
136
|
selectIntoLayoutSection(tr);
|
|
131
137
|
return tr;
|
|
132
138
|
}
|
|
@@ -146,7 +152,11 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
|
|
|
146
152
|
},
|
|
147
153
|
action: function action(insert, state) {
|
|
148
154
|
var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 3));
|
|
149
|
-
|
|
155
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_column_count_analytics')) {
|
|
156
|
+
withInsertLayoutAnalytics(tr, 3);
|
|
157
|
+
} else {
|
|
158
|
+
withInsertLayoutAnalytics(tr);
|
|
159
|
+
}
|
|
150
160
|
selectIntoLayoutSection(tr);
|
|
151
161
|
return tr;
|
|
152
162
|
}
|
|
@@ -165,7 +175,11 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
|
|
|
165
175
|
},
|
|
166
176
|
action: function action(insert, state) {
|
|
167
177
|
var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 2));
|
|
168
|
-
|
|
178
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_column_count_analytics')) {
|
|
179
|
+
withInsertLayoutAnalytics(tr, 2);
|
|
180
|
+
} else {
|
|
181
|
+
withInsertLayoutAnalytics(tr);
|
|
182
|
+
}
|
|
169
183
|
selectIntoLayoutSection(tr);
|
|
170
184
|
return tr;
|
|
171
185
|
}
|
|
@@ -182,7 +196,11 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
|
|
|
182
196
|
},
|
|
183
197
|
action: function action(insert, state) {
|
|
184
198
|
var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 3));
|
|
185
|
-
|
|
199
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_column_count_analytics')) {
|
|
200
|
+
withInsertLayoutAnalytics(tr, 3);
|
|
201
|
+
} else {
|
|
202
|
+
withInsertLayoutAnalytics(tr);
|
|
203
|
+
}
|
|
186
204
|
selectIntoLayoutSection(tr);
|
|
187
205
|
return tr;
|
|
188
206
|
}
|
|
@@ -199,7 +217,11 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
|
|
|
199
217
|
},
|
|
200
218
|
action: function action(insert, state) {
|
|
201
219
|
var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 4));
|
|
202
|
-
|
|
220
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_column_count_analytics')) {
|
|
221
|
+
withInsertLayoutAnalytics(tr, 4);
|
|
222
|
+
} else {
|
|
223
|
+
withInsertLayoutAnalytics(tr);
|
|
224
|
+
}
|
|
203
225
|
selectIntoLayoutSection(tr);
|
|
204
226
|
return tr;
|
|
205
227
|
}
|
|
@@ -216,7 +238,11 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
|
|
|
216
238
|
},
|
|
217
239
|
action: function action(insert, state) {
|
|
218
240
|
var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 5));
|
|
219
|
-
|
|
241
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_column_count_analytics')) {
|
|
242
|
+
withInsertLayoutAnalytics(tr, 5);
|
|
243
|
+
} else {
|
|
244
|
+
withInsertLayoutAnalytics(tr);
|
|
245
|
+
}
|
|
220
246
|
selectIntoLayoutSection(tr);
|
|
221
247
|
return tr;
|
|
222
248
|
}
|
|
@@ -180,7 +180,8 @@ var insertLayoutColumnsWithAnalytics = exports.insertLayoutColumnsWithAnalytics
|
|
|
180
180
|
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
181
181
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.LAYOUT,
|
|
182
182
|
attributes: {
|
|
183
|
-
inputMethod: inputMethod
|
|
183
|
+
inputMethod: inputMethod,
|
|
184
|
+
columnCount: (0, _platformFeatureFlags.fg)('platform_editor_column_count_analytics') ? 2 : undefined
|
|
184
185
|
},
|
|
185
186
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
186
187
|
})(function (state, dispatch) {
|
|
@@ -469,7 +470,7 @@ var fixColumnStructure = exports.fixColumnStructure = function fixColumnStructur
|
|
|
469
470
|
}
|
|
470
471
|
return;
|
|
471
472
|
};
|
|
472
|
-
var deleteActiveLayoutNode = exports.deleteActiveLayoutNode = function deleteActiveLayoutNode(editorAnalyticsAPI) {
|
|
473
|
+
var deleteActiveLayoutNode = exports.deleteActiveLayoutNode = function deleteActiveLayoutNode(editorAnalyticsAPI, inputMethod) {
|
|
473
474
|
return function (state, dispatch) {
|
|
474
475
|
var _ref3 = _pluginKey.pluginKey.getState(state),
|
|
475
476
|
pos = _ref3.pos,
|
|
@@ -482,7 +483,8 @@ var deleteActiveLayoutNode = exports.deleteActiveLayoutNode = function deleteAct
|
|
|
482
483
|
action: _analytics.ACTION.DELETED,
|
|
483
484
|
actionSubject: _analytics.ACTION_SUBJECT.LAYOUT,
|
|
484
485
|
attributes: {
|
|
485
|
-
layout: formatLayoutName(selectedLayout)
|
|
486
|
+
layout: formatLayoutName(selectedLayout),
|
|
487
|
+
inputMethod: (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_analytics_2') ? inputMethod : undefined
|
|
486
488
|
},
|
|
487
489
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
488
490
|
})(tr);
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -9,6 +9,7 @@ exports.layoutToolbarTitle = exports.buildToolbar = void 0;
|
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
13
|
var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/messages"));
|
|
13
14
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
14
15
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
@@ -210,7 +211,7 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(state, intl, pos
|
|
|
210
211
|
icon: _deleteEditorRemove.default,
|
|
211
212
|
testId: _messages.default.remove.id,
|
|
212
213
|
title: intl.formatMessage(_messages.default.remove),
|
|
213
|
-
onClick: (0, _actions.deleteActiveLayoutNode)(editorAnalyticsAPI),
|
|
214
|
+
onClick: (0, _actions.deleteActiveLayoutNode)(editorAnalyticsAPI, _analytics.INPUT_METHOD.FLOATING_TB),
|
|
214
215
|
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
215
216
|
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
216
217
|
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
@@ -241,7 +242,7 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(state, intl, pos
|
|
|
241
242
|
onClick: function onClick() {
|
|
242
243
|
var _api$core, _api$floatingToolbar;
|
|
243
244
|
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute( // @ts-ignore
|
|
244
|
-
api === null || api === void 0 || (_api$floatingToolbar = api.floatingToolbar) === null || _api$floatingToolbar === void 0 ? void 0 : _api$floatingToolbar.commands.copyNode(nodeType));
|
|
245
|
+
api === null || api === void 0 || (_api$floatingToolbar = api.floatingToolbar) === null || _api$floatingToolbar === void 0 ? void 0 : _api$floatingToolbar.commands.copyNode(nodeType, _analytics.INPUT_METHOD.FLOATING_TB));
|
|
245
246
|
return true;
|
|
246
247
|
},
|
|
247
248
|
icon: /*#__PURE__*/_react.default.createElement(_copy.default, {
|
|
@@ -249,7 +250,7 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(state, intl, pos
|
|
|
249
250
|
})
|
|
250
251
|
}, hoverDecorationProps(nodeType, _editorSharedStyles.akEditorSelectedNodeClassName)), _objectSpread({
|
|
251
252
|
title: intl.formatMessage(_messages.default.delete),
|
|
252
|
-
onClick: (0, _actions.deleteActiveLayoutNode)(editorAnalyticsAPI),
|
|
253
|
+
onClick: (0, _actions.deleteActiveLayoutNode)(editorAnalyticsAPI, _analytics.INPUT_METHOD.FLOATING_TB),
|
|
253
254
|
icon: /*#__PURE__*/_react.default.createElement(_deleteEditorRemove.default, {
|
|
254
255
|
label: ""
|
|
255
256
|
})
|
|
@@ -6,6 +6,7 @@ import { layoutMessages, toolbarInsertBlockMessages as messages } from '@atlaski
|
|
|
6
6
|
import { IconFiveColumnLayout, IconFourColumnLayout, IconLayout, IconOneColumnLayout, IconThreeColumnLayout, IconTwoColumnLayout } from '@atlaskit/editor-common/quick-insert';
|
|
7
7
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
8
|
import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
11
|
import { createDefaultLayoutSection, createMultiColumnLayoutSection, insertLayoutColumnsWithAnalytics } from './pm-plugins/actions';
|
|
11
12
|
import { default as createLayoutPlugin } from './pm-plugins/main';
|
|
@@ -94,14 +95,15 @@ export const layoutPlugin = ({
|
|
|
94
95
|
quickInsert: ({
|
|
95
96
|
formatMessage
|
|
96
97
|
}) => {
|
|
97
|
-
const withInsertLayoutAnalytics = tr => {
|
|
98
|
+
const withInsertLayoutAnalytics = (tr, columnCount) => {
|
|
98
99
|
var _api$analytics2, _api$analytics2$actio;
|
|
99
100
|
api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : (_api$analytics2$actio = _api$analytics2.actions) === null || _api$analytics2$actio === void 0 ? void 0 : _api$analytics2$actio.attachAnalyticsEvent({
|
|
100
101
|
action: ACTION.INSERTED,
|
|
101
102
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
102
103
|
actionSubjectId: ACTION_SUBJECT_ID.LAYOUT,
|
|
103
104
|
attributes: {
|
|
104
|
-
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
105
|
+
inputMethod: INPUT_METHOD.QUICK_INSERT,
|
|
106
|
+
columnCount
|
|
105
107
|
},
|
|
106
108
|
eventType: EVENT_TYPE.TRACK
|
|
107
109
|
})(tr);
|
|
@@ -116,7 +118,11 @@ export const layoutPlugin = ({
|
|
|
116
118
|
icon: () => /*#__PURE__*/React.createElement(IconOneColumnLayout, null),
|
|
117
119
|
action(insert, state, _source) {
|
|
118
120
|
const tr = insert(createMultiColumnLayoutSection(state, 1));
|
|
119
|
-
|
|
121
|
+
if (fg('platform_editor_column_count_analytics')) {
|
|
122
|
+
withInsertLayoutAnalytics(tr, 1);
|
|
123
|
+
} else {
|
|
124
|
+
withInsertLayoutAnalytics(tr);
|
|
125
|
+
}
|
|
120
126
|
selectIntoLayoutSection(tr);
|
|
121
127
|
return tr;
|
|
122
128
|
}
|
|
@@ -134,7 +140,11 @@ export const layoutPlugin = ({
|
|
|
134
140
|
icon: () => /*#__PURE__*/React.createElement(IconThreeColumnLayout, null),
|
|
135
141
|
action(insert, state) {
|
|
136
142
|
const tr = insert(createMultiColumnLayoutSection(state, 3));
|
|
137
|
-
|
|
143
|
+
if (fg('platform_editor_column_count_analytics')) {
|
|
144
|
+
withInsertLayoutAnalytics(tr, 3);
|
|
145
|
+
} else {
|
|
146
|
+
withInsertLayoutAnalytics(tr);
|
|
147
|
+
}
|
|
138
148
|
selectIntoLayoutSection(tr);
|
|
139
149
|
return tr;
|
|
140
150
|
}
|
|
@@ -151,7 +161,11 @@ export const layoutPlugin = ({
|
|
|
151
161
|
icon: () => /*#__PURE__*/React.createElement(IconTwoColumnLayout, null),
|
|
152
162
|
action(insert, state) {
|
|
153
163
|
const tr = insert(createMultiColumnLayoutSection(state, 2));
|
|
154
|
-
|
|
164
|
+
if (fg('platform_editor_column_count_analytics')) {
|
|
165
|
+
withInsertLayoutAnalytics(tr, 2);
|
|
166
|
+
} else {
|
|
167
|
+
withInsertLayoutAnalytics(tr);
|
|
168
|
+
}
|
|
155
169
|
selectIntoLayoutSection(tr);
|
|
156
170
|
return tr;
|
|
157
171
|
}
|
|
@@ -166,7 +180,11 @@ export const layoutPlugin = ({
|
|
|
166
180
|
icon: () => /*#__PURE__*/React.createElement(IconThreeColumnLayout, null),
|
|
167
181
|
action(insert, state) {
|
|
168
182
|
const tr = insert(createMultiColumnLayoutSection(state, 3));
|
|
169
|
-
|
|
183
|
+
if (fg('platform_editor_column_count_analytics')) {
|
|
184
|
+
withInsertLayoutAnalytics(tr, 3);
|
|
185
|
+
} else {
|
|
186
|
+
withInsertLayoutAnalytics(tr);
|
|
187
|
+
}
|
|
170
188
|
selectIntoLayoutSection(tr);
|
|
171
189
|
return tr;
|
|
172
190
|
}
|
|
@@ -181,7 +199,11 @@ export const layoutPlugin = ({
|
|
|
181
199
|
icon: () => /*#__PURE__*/React.createElement(IconFourColumnLayout, null),
|
|
182
200
|
action(insert, state) {
|
|
183
201
|
const tr = insert(createMultiColumnLayoutSection(state, 4));
|
|
184
|
-
|
|
202
|
+
if (fg('platform_editor_column_count_analytics')) {
|
|
203
|
+
withInsertLayoutAnalytics(tr, 4);
|
|
204
|
+
} else {
|
|
205
|
+
withInsertLayoutAnalytics(tr);
|
|
206
|
+
}
|
|
185
207
|
selectIntoLayoutSection(tr);
|
|
186
208
|
return tr;
|
|
187
209
|
}
|
|
@@ -196,7 +218,11 @@ export const layoutPlugin = ({
|
|
|
196
218
|
icon: () => /*#__PURE__*/React.createElement(IconFiveColumnLayout, null),
|
|
197
219
|
action(insert, state) {
|
|
198
220
|
const tr = insert(createMultiColumnLayoutSection(state, 5));
|
|
199
|
-
|
|
221
|
+
if (fg('platform_editor_column_count_analytics')) {
|
|
222
|
+
withInsertLayoutAnalytics(tr, 5);
|
|
223
|
+
} else {
|
|
224
|
+
withInsertLayoutAnalytics(tr);
|
|
225
|
+
}
|
|
200
226
|
selectIntoLayoutSection(tr);
|
|
201
227
|
return tr;
|
|
202
228
|
}
|
|
@@ -161,7 +161,8 @@ export const insertLayoutColumnsWithAnalytics = editorAnalyticsAPI => inputMetho
|
|
|
161
161
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
162
162
|
actionSubjectId: ACTION_SUBJECT_ID.LAYOUT,
|
|
163
163
|
attributes: {
|
|
164
|
-
inputMethod
|
|
164
|
+
inputMethod,
|
|
165
|
+
columnCount: fg('platform_editor_column_count_analytics') ? 2 : undefined
|
|
165
166
|
},
|
|
166
167
|
eventType: EVENT_TYPE.TRACK
|
|
167
168
|
})((state, dispatch) => {
|
|
@@ -447,7 +448,7 @@ export const fixColumnStructure = state => {
|
|
|
447
448
|
}
|
|
448
449
|
return;
|
|
449
450
|
};
|
|
450
|
-
export const deleteActiveLayoutNode = editorAnalyticsAPI => (state, dispatch) => {
|
|
451
|
+
export const deleteActiveLayoutNode = (editorAnalyticsAPI, inputMethod) => (state, dispatch) => {
|
|
451
452
|
const {
|
|
452
453
|
pos,
|
|
453
454
|
selectedLayout
|
|
@@ -460,7 +461,8 @@ export const deleteActiveLayoutNode = editorAnalyticsAPI => (state, dispatch) =>
|
|
|
460
461
|
action: ACTION.DELETED,
|
|
461
462
|
actionSubject: ACTION_SUBJECT.LAYOUT,
|
|
462
463
|
attributes: {
|
|
463
|
-
layout: formatLayoutName(selectedLayout)
|
|
464
|
+
layout: formatLayoutName(selectedLayout),
|
|
465
|
+
inputMethod: fg('platform_editor_controls_patch_analytics_2') ? inputMethod : undefined
|
|
464
466
|
},
|
|
465
467
|
eventType: EVENT_TYPE.TRACK
|
|
466
468
|
})(tr);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import commonMessages, { layoutMessages, layoutMessages as toolbarMessages } from '@atlaskit/editor-common/messages';
|
|
3
4
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
4
5
|
import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
@@ -194,7 +195,7 @@ export const buildToolbar = (state, intl, pos, _allowBreakout, addSidebarLayouts
|
|
|
194
195
|
icon: DeleteIcon,
|
|
195
196
|
testId: commonMessages.remove.id,
|
|
196
197
|
title: intl.formatMessage(commonMessages.remove),
|
|
197
|
-
onClick: deleteActiveLayoutNode(editorAnalyticsAPI),
|
|
198
|
+
onClick: deleteActiveLayoutNode(editorAnalyticsAPI, INPUT_METHOD.FLOATING_TB),
|
|
198
199
|
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
199
200
|
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
200
201
|
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
@@ -223,7 +224,7 @@ export const buildToolbar = (state, intl, pos, _allowBreakout, addSidebarLayouts
|
|
|
223
224
|
onClick: () => {
|
|
224
225
|
var _api$core, _api$floatingToolbar;
|
|
225
226
|
api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute( // @ts-ignore
|
|
226
|
-
api === null || api === void 0 ? void 0 : (_api$floatingToolbar = api.floatingToolbar) === null || _api$floatingToolbar === void 0 ? void 0 : _api$floatingToolbar.commands.copyNode(nodeType));
|
|
227
|
+
api === null || api === void 0 ? void 0 : (_api$floatingToolbar = api.floatingToolbar) === null || _api$floatingToolbar === void 0 ? void 0 : _api$floatingToolbar.commands.copyNode(nodeType, INPUT_METHOD.FLOATING_TB));
|
|
227
228
|
return true;
|
|
228
229
|
},
|
|
229
230
|
icon: /*#__PURE__*/React.createElement(CopyIcon, {
|
|
@@ -232,7 +233,7 @@ export const buildToolbar = (state, intl, pos, _allowBreakout, addSidebarLayouts
|
|
|
232
233
|
...hoverDecorationProps(nodeType, akEditorSelectedNodeClassName)
|
|
233
234
|
}, {
|
|
234
235
|
title: intl.formatMessage(commonMessages.delete),
|
|
235
|
-
onClick: deleteActiveLayoutNode(editorAnalyticsAPI),
|
|
236
|
+
onClick: deleteActiveLayoutNode(editorAnalyticsAPI, INPUT_METHOD.FLOATING_TB),
|
|
236
237
|
icon: /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
237
238
|
label: ""
|
|
238
239
|
}),
|
package/dist/esm/layoutPlugin.js
CHANGED
|
@@ -6,6 +6,7 @@ import { layoutMessages, toolbarInsertBlockMessages as messages } from '@atlaski
|
|
|
6
6
|
import { IconFiveColumnLayout, IconFourColumnLayout, IconLayout, IconOneColumnLayout, IconThreeColumnLayout, IconTwoColumnLayout } from '@atlaskit/editor-common/quick-insert';
|
|
7
7
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
8
|
import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
11
|
import { createDefaultLayoutSection, createMultiColumnLayoutSection, insertLayoutColumnsWithAnalytics } from './pm-plugins/actions';
|
|
11
12
|
import { default as createLayoutPlugin } from './pm-plugins/main';
|
|
@@ -96,14 +97,15 @@ export var layoutPlugin = function layoutPlugin(_ref) {
|
|
|
96
97
|
},
|
|
97
98
|
quickInsert: function quickInsert(_ref4) {
|
|
98
99
|
var formatMessage = _ref4.formatMessage;
|
|
99
|
-
var withInsertLayoutAnalytics = function withInsertLayoutAnalytics(tr) {
|
|
100
|
+
var withInsertLayoutAnalytics = function withInsertLayoutAnalytics(tr, columnCount) {
|
|
100
101
|
var _api$analytics2;
|
|
101
102
|
api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || (_api$analytics2 = _api$analytics2.actions) === null || _api$analytics2 === void 0 || _api$analytics2.attachAnalyticsEvent({
|
|
102
103
|
action: ACTION.INSERTED,
|
|
103
104
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
104
105
|
actionSubjectId: ACTION_SUBJECT_ID.LAYOUT,
|
|
105
106
|
attributes: {
|
|
106
|
-
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
107
|
+
inputMethod: INPUT_METHOD.QUICK_INSERT,
|
|
108
|
+
columnCount: columnCount
|
|
107
109
|
},
|
|
108
110
|
eventType: EVENT_TYPE.TRACK
|
|
109
111
|
})(tr);
|
|
@@ -120,7 +122,11 @@ export var layoutPlugin = function layoutPlugin(_ref) {
|
|
|
120
122
|
},
|
|
121
123
|
action: function action(insert, state, _source) {
|
|
122
124
|
var tr = insert(createMultiColumnLayoutSection(state, 1));
|
|
123
|
-
|
|
125
|
+
if (fg('platform_editor_column_count_analytics')) {
|
|
126
|
+
withInsertLayoutAnalytics(tr, 1);
|
|
127
|
+
} else {
|
|
128
|
+
withInsertLayoutAnalytics(tr);
|
|
129
|
+
}
|
|
124
130
|
selectIntoLayoutSection(tr);
|
|
125
131
|
return tr;
|
|
126
132
|
}
|
|
@@ -140,7 +146,11 @@ export var layoutPlugin = function layoutPlugin(_ref) {
|
|
|
140
146
|
},
|
|
141
147
|
action: function action(insert, state) {
|
|
142
148
|
var tr = insert(createMultiColumnLayoutSection(state, 3));
|
|
143
|
-
|
|
149
|
+
if (fg('platform_editor_column_count_analytics')) {
|
|
150
|
+
withInsertLayoutAnalytics(tr, 3);
|
|
151
|
+
} else {
|
|
152
|
+
withInsertLayoutAnalytics(tr);
|
|
153
|
+
}
|
|
144
154
|
selectIntoLayoutSection(tr);
|
|
145
155
|
return tr;
|
|
146
156
|
}
|
|
@@ -159,7 +169,11 @@ export var layoutPlugin = function layoutPlugin(_ref) {
|
|
|
159
169
|
},
|
|
160
170
|
action: function action(insert, state) {
|
|
161
171
|
var tr = insert(createMultiColumnLayoutSection(state, 2));
|
|
162
|
-
|
|
172
|
+
if (fg('platform_editor_column_count_analytics')) {
|
|
173
|
+
withInsertLayoutAnalytics(tr, 2);
|
|
174
|
+
} else {
|
|
175
|
+
withInsertLayoutAnalytics(tr);
|
|
176
|
+
}
|
|
163
177
|
selectIntoLayoutSection(tr);
|
|
164
178
|
return tr;
|
|
165
179
|
}
|
|
@@ -176,7 +190,11 @@ export var layoutPlugin = function layoutPlugin(_ref) {
|
|
|
176
190
|
},
|
|
177
191
|
action: function action(insert, state) {
|
|
178
192
|
var tr = insert(createMultiColumnLayoutSection(state, 3));
|
|
179
|
-
|
|
193
|
+
if (fg('platform_editor_column_count_analytics')) {
|
|
194
|
+
withInsertLayoutAnalytics(tr, 3);
|
|
195
|
+
} else {
|
|
196
|
+
withInsertLayoutAnalytics(tr);
|
|
197
|
+
}
|
|
180
198
|
selectIntoLayoutSection(tr);
|
|
181
199
|
return tr;
|
|
182
200
|
}
|
|
@@ -193,7 +211,11 @@ export var layoutPlugin = function layoutPlugin(_ref) {
|
|
|
193
211
|
},
|
|
194
212
|
action: function action(insert, state) {
|
|
195
213
|
var tr = insert(createMultiColumnLayoutSection(state, 4));
|
|
196
|
-
|
|
214
|
+
if (fg('platform_editor_column_count_analytics')) {
|
|
215
|
+
withInsertLayoutAnalytics(tr, 4);
|
|
216
|
+
} else {
|
|
217
|
+
withInsertLayoutAnalytics(tr);
|
|
218
|
+
}
|
|
197
219
|
selectIntoLayoutSection(tr);
|
|
198
220
|
return tr;
|
|
199
221
|
}
|
|
@@ -210,7 +232,11 @@ export var layoutPlugin = function layoutPlugin(_ref) {
|
|
|
210
232
|
},
|
|
211
233
|
action: function action(insert, state) {
|
|
212
234
|
var tr = insert(createMultiColumnLayoutSection(state, 5));
|
|
213
|
-
|
|
235
|
+
if (fg('platform_editor_column_count_analytics')) {
|
|
236
|
+
withInsertLayoutAnalytics(tr, 5);
|
|
237
|
+
} else {
|
|
238
|
+
withInsertLayoutAnalytics(tr);
|
|
239
|
+
}
|
|
214
240
|
selectIntoLayoutSection(tr);
|
|
215
241
|
return tr;
|
|
216
242
|
}
|
|
@@ -171,7 +171,8 @@ export var insertLayoutColumnsWithAnalytics = function insertLayoutColumnsWithAn
|
|
|
171
171
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
172
172
|
actionSubjectId: ACTION_SUBJECT_ID.LAYOUT,
|
|
173
173
|
attributes: {
|
|
174
|
-
inputMethod: inputMethod
|
|
174
|
+
inputMethod: inputMethod,
|
|
175
|
+
columnCount: fg('platform_editor_column_count_analytics') ? 2 : undefined
|
|
175
176
|
},
|
|
176
177
|
eventType: EVENT_TYPE.TRACK
|
|
177
178
|
})(function (state, dispatch) {
|
|
@@ -460,7 +461,7 @@ export var fixColumnStructure = function fixColumnStructure(state) {
|
|
|
460
461
|
}
|
|
461
462
|
return;
|
|
462
463
|
};
|
|
463
|
-
export var deleteActiveLayoutNode = function deleteActiveLayoutNode(editorAnalyticsAPI) {
|
|
464
|
+
export var deleteActiveLayoutNode = function deleteActiveLayoutNode(editorAnalyticsAPI, inputMethod) {
|
|
464
465
|
return function (state, dispatch) {
|
|
465
466
|
var _ref3 = pluginKey.getState(state),
|
|
466
467
|
pos = _ref3.pos,
|
|
@@ -473,7 +474,8 @@ export var deleteActiveLayoutNode = function deleteActiveLayoutNode(editorAnalyt
|
|
|
473
474
|
action: ACTION.DELETED,
|
|
474
475
|
actionSubject: ACTION_SUBJECT.LAYOUT,
|
|
475
476
|
attributes: {
|
|
476
|
-
layout: formatLayoutName(selectedLayout)
|
|
477
|
+
layout: formatLayoutName(selectedLayout),
|
|
478
|
+
inputMethod: fg('platform_editor_controls_patch_analytics_2') ? inputMethod : undefined
|
|
477
479
|
},
|
|
478
480
|
eventType: EVENT_TYPE.TRACK
|
|
479
481
|
})(tr);
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -3,6 +3,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
import React from 'react';
|
|
6
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
7
|
import commonMessages, { layoutMessages, layoutMessages as toolbarMessages } from '@atlaskit/editor-common/messages';
|
|
7
8
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
8
9
|
import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
@@ -200,7 +201,7 @@ export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout
|
|
|
200
201
|
icon: DeleteIcon,
|
|
201
202
|
testId: commonMessages.remove.id,
|
|
202
203
|
title: intl.formatMessage(commonMessages.remove),
|
|
203
|
-
onClick: deleteActiveLayoutNode(editorAnalyticsAPI),
|
|
204
|
+
onClick: deleteActiveLayoutNode(editorAnalyticsAPI, INPUT_METHOD.FLOATING_TB),
|
|
204
205
|
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
205
206
|
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
206
207
|
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
@@ -231,7 +232,7 @@ export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout
|
|
|
231
232
|
onClick: function onClick() {
|
|
232
233
|
var _api$core, _api$floatingToolbar;
|
|
233
234
|
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute( // @ts-ignore
|
|
234
|
-
api === null || api === void 0 || (_api$floatingToolbar = api.floatingToolbar) === null || _api$floatingToolbar === void 0 ? void 0 : _api$floatingToolbar.commands.copyNode(nodeType));
|
|
235
|
+
api === null || api === void 0 || (_api$floatingToolbar = api.floatingToolbar) === null || _api$floatingToolbar === void 0 ? void 0 : _api$floatingToolbar.commands.copyNode(nodeType, INPUT_METHOD.FLOATING_TB));
|
|
235
236
|
return true;
|
|
236
237
|
},
|
|
237
238
|
icon: /*#__PURE__*/React.createElement(CopyIcon, {
|
|
@@ -239,7 +240,7 @@ export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout
|
|
|
239
240
|
})
|
|
240
241
|
}, hoverDecorationProps(nodeType, akEditorSelectedNodeClassName)), _objectSpread({
|
|
241
242
|
title: intl.formatMessage(commonMessages.delete),
|
|
242
|
-
onClick: deleteActiveLayoutNode(editorAnalyticsAPI),
|
|
243
|
+
onClick: deleteActiveLayoutNode(editorAnalyticsAPI, INPUT_METHOD.FLOATING_TB),
|
|
243
244
|
icon: /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
244
245
|
label: ""
|
|
245
246
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
1
|
+
import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { Command, TOOLBAR_MENU_TYPE } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -20,4 +20,4 @@ export declare function forceSectionToPresetLayout(state: EditorState, node: Nod
|
|
|
20
20
|
export declare const setPresetLayout: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (layout: PresetLayout) => Command;
|
|
21
21
|
export declare const fixColumnSizes: (changedTr: Transaction, state: EditorState) => Change | undefined;
|
|
22
22
|
export declare const fixColumnStructure: (state: EditorState) => Transaction | undefined;
|
|
23
|
-
export declare const deleteActiveLayoutNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
23
|
+
export declare const deleteActiveLayoutNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, inputMethod?: INPUT_METHOD.FLOATING_TB) => Command;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
1
|
+
import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { Command, TOOLBAR_MENU_TYPE } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -20,4 +20,4 @@ export declare function forceSectionToPresetLayout(state: EditorState, node: Nod
|
|
|
20
20
|
export declare const setPresetLayout: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (layout: PresetLayout) => Command;
|
|
21
21
|
export declare const fixColumnSizes: (changedTr: Transaction, state: EditorState) => Change | undefined;
|
|
22
22
|
export declare const fixColumnStructure: (state: EditorState) => Transaction | undefined;
|
|
23
|
-
export declare const deleteActiveLayoutNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
23
|
+
export declare const deleteActiveLayoutNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, inputMethod?: INPUT_METHOD.FLOATING_TB) => Command;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-layout",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"description": "Layout plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,18 +34,18 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
37
|
-
"@atlaskit/editor-common": "^
|
|
37
|
+
"@atlaskit/editor-common": "^104.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
39
39
|
"@atlaskit/editor-plugin-decorations": "^2.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
|
|
41
41
|
"@atlaskit/editor-plugin-guideline": "^2.0.0",
|
|
42
|
-
"@atlaskit/editor-plugin-selection": "^2.
|
|
42
|
+
"@atlaskit/editor-plugin-selection": "^2.2.0",
|
|
43
43
|
"@atlaskit/editor-plugin-width": "^3.0.0",
|
|
44
44
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
45
45
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
46
46
|
"@atlaskit/icon": "^25.6.0",
|
|
47
47
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
48
|
-
"@atlaskit/tmp-editor-statsig": "^4.
|
|
48
|
+
"@atlaskit/tmp-editor-statsig": "^4.16.0",
|
|
49
49
|
"@atlaskit/tokens": "^4.8.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
51
51
|
"@emotion/react": "^11.7.1"
|
|
@@ -104,6 +104,12 @@
|
|
|
104
104
|
},
|
|
105
105
|
"platform_editor_convert_multiple_columns_to_single": {
|
|
106
106
|
"type": "boolean"
|
|
107
|
+
},
|
|
108
|
+
"platform_editor_column_count_analytics": {
|
|
109
|
+
"type": "boolean"
|
|
110
|
+
},
|
|
111
|
+
"platform_editor_controls_patch_analytics_2": {
|
|
112
|
+
"type": "boolean"
|
|
107
113
|
}
|
|
108
114
|
}
|
|
109
115
|
}
|