@atlaskit/editor-core 185.2.5 → 185.2.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 185.2.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`1259df9a9ef`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1259df9a9ef) - converted some of block-type's analytics to use new EditorAnalyticsAPI
8
+
3
9
  ## 185.2.5
4
10
 
5
11
  ### Patch Changes
@@ -21,14 +21,14 @@ var _inputRule = _interopRequireDefault(require("./pm-plugins/input-rule"));
21
21
  var _ToolbarBlockType = _interopRequireDefault(require("./ui/ToolbarBlockType"));
22
22
  var _WithPluginState = _interopRequireDefault(require("../../ui/WithPluginState"));
23
23
  var _commands = require("./commands");
24
- var _analytics = require("../analytics");
24
+ var _analytics = require("@atlaskit/editor-common/analytics");
25
25
  var keymaps = _interopRequireWildcard(require("../../keymaps"));
26
26
  var _assets = require("../quick-insert/assets");
27
27
  var _messages = require("./messages");
28
28
  var _types = require("../../ui/Toolbar/types");
29
29
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
30
30
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
- var headingPluginOptions = function headingPluginOptions(_ref, isAllowed) {
31
+ var headingPluginOptions = function headingPluginOptions(_ref, isAllowed, editorAnalyticsApi) {
32
32
  var formatMessage = _ref.formatMessage;
33
33
  if (!isAllowed) {
34
34
  return [];
@@ -56,7 +56,7 @@ var headingPluginOptions = function headingPluginOptions(_ref, isAllowed) {
56
56
  var tr = insert(state.schema.nodes.heading.createChecked({
57
57
  level: level
58
58
  }));
59
- return (0, _analytics.addAnalytics)(state, tr, {
59
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
60
60
  action: _analytics.ACTION.FORMATTED,
61
61
  actionSubject: _analytics.ACTION_SUBJECT.TEXT,
62
62
  eventType: _analytics.EVENT_TYPE.TRACK,
@@ -65,12 +65,13 @@ var headingPluginOptions = function headingPluginOptions(_ref, isAllowed) {
65
65
  inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT,
66
66
  newHeadingLevel: level
67
67
  }
68
- });
68
+ })(tr);
69
+ return tr;
69
70
  }
70
71
  };
71
72
  });
72
73
  };
73
- var blockquotePluginOptions = function blockquotePluginOptions(_ref2, isAllowed) {
74
+ var blockquotePluginOptions = function blockquotePluginOptions(_ref2, isAllowed, editorAnalyticsApi) {
74
75
  var formatMessage = _ref2.formatMessage;
75
76
  if (!isAllowed) {
76
77
  return [];
@@ -86,7 +87,7 @@ var blockquotePluginOptions = function blockquotePluginOptions(_ref2, isAllowed)
86
87
  },
87
88
  action: function action(insert, state) {
88
89
  var tr = insert(state.schema.nodes.blockquote.createChecked({}, state.schema.nodes.paragraph.createChecked()));
89
- return (0, _analytics.addAnalytics)(state, tr, {
90
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
90
91
  action: _analytics.ACTION.FORMATTED,
91
92
  actionSubject: _analytics.ACTION_SUBJECT.TEXT,
92
93
  eventType: _analytics.EVENT_TYPE.TRACK,
@@ -94,11 +95,12 @@ var blockquotePluginOptions = function blockquotePluginOptions(_ref2, isAllowed)
94
95
  attributes: {
95
96
  inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
96
97
  }
97
- });
98
+ })(tr);
99
+ return tr;
98
100
  }
99
101
  }];
100
102
  };
101
- var blockTypePlugin = function blockTypePlugin(options) {
103
+ var blockTypePlugin = function blockTypePlugin(options, api) {
102
104
  return {
103
105
  name: 'blockType',
104
106
  nodes: function nodes() {
@@ -182,8 +184,9 @@ var blockTypePlugin = function blockTypePlugin(options) {
182
184
  },
183
185
  pluginsOptions: {
184
186
  quickInsert: function quickInsert(intl) {
187
+ var _api$dependencies$ana, _api$dependencies$ana2;
185
188
  var exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
186
- return [].concat((0, _toConsumableArray2.default)(blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1)), (0, _toConsumableArray2.default)(headingPluginOptions(intl, exclude.indexOf('heading') === -1)));
189
+ return [].concat((0, _toConsumableArray2.default)(blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions)), (0, _toConsumableArray2.default)(headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 ? void 0 : (_api$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.actions)));
187
190
  }
188
191
  }
189
192
  };
@@ -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.2.5";
9
+ var version = "185.2.7";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "185.2.5",
3
+ "version": "185.2.7",
4
4
  "sideEffects": false
5
5
  }
@@ -6,14 +6,14 @@ import inputRulePlugin from './pm-plugins/input-rule';
6
6
  import ToolbarBlockType from './ui/ToolbarBlockType';
7
7
  import WithPluginState from '../../ui/WithPluginState';
8
8
  import { setBlockTypeWithAnalytics } from './commands';
9
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE, INPUT_METHOD } from '../analytics';
9
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
10
10
  import * as keymaps from '../../keymaps';
11
11
  import { IconHeading, IconQuote } from '../quick-insert/assets';
12
12
  import { messages } from './messages';
13
13
  import { ToolbarSize } from '../../ui/Toolbar/types';
14
14
  const headingPluginOptions = ({
15
15
  formatMessage
16
- }, isAllowed) => {
16
+ }, isAllowed, editorAnalyticsApi) => {
17
17
  if (!isAllowed) {
18
18
  return [];
19
19
  }
@@ -38,7 +38,7 @@ const headingPluginOptions = ({
38
38
  const tr = insert(state.schema.nodes.heading.createChecked({
39
39
  level
40
40
  }));
41
- return addAnalytics(state, tr, {
41
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
42
42
  action: ACTION.FORMATTED,
43
43
  actionSubject: ACTION_SUBJECT.TEXT,
44
44
  eventType: EVENT_TYPE.TRACK,
@@ -47,14 +47,15 @@ const headingPluginOptions = ({
47
47
  inputMethod: INPUT_METHOD.QUICK_INSERT,
48
48
  newHeadingLevel: level
49
49
  }
50
- });
50
+ })(tr);
51
+ return tr;
51
52
  }
52
53
  };
53
54
  });
54
55
  };
55
56
  const blockquotePluginOptions = ({
56
57
  formatMessage
57
- }, isAllowed) => {
58
+ }, isAllowed, editorAnalyticsApi) => {
58
59
  if (!isAllowed) {
59
60
  return [];
60
61
  }
@@ -67,7 +68,7 @@ const blockquotePluginOptions = ({
67
68
  icon: () => /*#__PURE__*/React.createElement(IconQuote, null),
68
69
  action(insert, state) {
69
70
  const tr = insert(state.schema.nodes.blockquote.createChecked({}, state.schema.nodes.paragraph.createChecked()));
70
- return addAnalytics(state, tr, {
71
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
71
72
  action: ACTION.FORMATTED,
72
73
  actionSubject: ACTION_SUBJECT.TEXT,
73
74
  eventType: EVENT_TYPE.TRACK,
@@ -75,11 +76,12 @@ const blockquotePluginOptions = ({
75
76
  attributes: {
76
77
  inputMethod: INPUT_METHOD.QUICK_INSERT
77
78
  }
78
- });
79
+ })(tr);
80
+ return tr;
79
81
  }
80
82
  }];
81
83
  };
82
- const blockTypePlugin = options => ({
84
+ const blockTypePlugin = (options, api) => ({
83
85
  name: 'blockType',
84
86
  nodes() {
85
87
  const nodes = [{
@@ -157,8 +159,9 @@ const blockTypePlugin = options => ({
157
159
  },
158
160
  pluginsOptions: {
159
161
  quickInsert: intl => {
162
+ var _api$dependencies$ana, _api$dependencies$ana2;
160
163
  const exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
161
- return [...blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1), ...headingPluginOptions(intl, exclude.indexOf('heading') === -1)];
164
+ return [...blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions), ...headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 ? void 0 : (_api$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.actions)];
162
165
  }
163
166
  }
164
167
  });
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "185.2.5";
2
+ export const version = "185.2.7";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "185.2.5",
3
+ "version": "185.2.7",
4
4
  "sideEffects": false
5
5
  }
@@ -7,12 +7,12 @@ import inputRulePlugin from './pm-plugins/input-rule';
7
7
  import ToolbarBlockType from './ui/ToolbarBlockType';
8
8
  import WithPluginState from '../../ui/WithPluginState';
9
9
  import { setBlockTypeWithAnalytics } from './commands';
10
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE, INPUT_METHOD } from '../analytics';
10
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
11
11
  import * as keymaps from '../../keymaps';
12
12
  import { IconHeading, IconQuote } from '../quick-insert/assets';
13
13
  import { messages } from './messages';
14
14
  import { ToolbarSize } from '../../ui/Toolbar/types';
15
- var headingPluginOptions = function headingPluginOptions(_ref, isAllowed) {
15
+ var headingPluginOptions = function headingPluginOptions(_ref, isAllowed, editorAnalyticsApi) {
16
16
  var formatMessage = _ref.formatMessage;
17
17
  if (!isAllowed) {
18
18
  return [];
@@ -40,7 +40,7 @@ var headingPluginOptions = function headingPluginOptions(_ref, isAllowed) {
40
40
  var tr = insert(state.schema.nodes.heading.createChecked({
41
41
  level: level
42
42
  }));
43
- return addAnalytics(state, tr, {
43
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
44
44
  action: ACTION.FORMATTED,
45
45
  actionSubject: ACTION_SUBJECT.TEXT,
46
46
  eventType: EVENT_TYPE.TRACK,
@@ -49,12 +49,13 @@ var headingPluginOptions = function headingPluginOptions(_ref, isAllowed) {
49
49
  inputMethod: INPUT_METHOD.QUICK_INSERT,
50
50
  newHeadingLevel: level
51
51
  }
52
- });
52
+ })(tr);
53
+ return tr;
53
54
  }
54
55
  };
55
56
  });
56
57
  };
57
- var blockquotePluginOptions = function blockquotePluginOptions(_ref2, isAllowed) {
58
+ var blockquotePluginOptions = function blockquotePluginOptions(_ref2, isAllowed, editorAnalyticsApi) {
58
59
  var formatMessage = _ref2.formatMessage;
59
60
  if (!isAllowed) {
60
61
  return [];
@@ -70,7 +71,7 @@ var blockquotePluginOptions = function blockquotePluginOptions(_ref2, isAllowed)
70
71
  },
71
72
  action: function action(insert, state) {
72
73
  var tr = insert(state.schema.nodes.blockquote.createChecked({}, state.schema.nodes.paragraph.createChecked()));
73
- return addAnalytics(state, tr, {
74
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
74
75
  action: ACTION.FORMATTED,
75
76
  actionSubject: ACTION_SUBJECT.TEXT,
76
77
  eventType: EVENT_TYPE.TRACK,
@@ -78,11 +79,12 @@ var blockquotePluginOptions = function blockquotePluginOptions(_ref2, isAllowed)
78
79
  attributes: {
79
80
  inputMethod: INPUT_METHOD.QUICK_INSERT
80
81
  }
81
- });
82
+ })(tr);
83
+ return tr;
82
84
  }
83
85
  }];
84
86
  };
85
- var blockTypePlugin = function blockTypePlugin(options) {
87
+ var blockTypePlugin = function blockTypePlugin(options, api) {
86
88
  return {
87
89
  name: 'blockType',
88
90
  nodes: function nodes() {
@@ -166,8 +168,9 @@ var blockTypePlugin = function blockTypePlugin(options) {
166
168
  },
167
169
  pluginsOptions: {
168
170
  quickInsert: function quickInsert(intl) {
171
+ var _api$dependencies$ana, _api$dependencies$ana2;
169
172
  var exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
170
- return [].concat(_toConsumableArray(blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1)), _toConsumableArray(headingPluginOptions(intl, exclude.indexOf('heading') === -1)));
173
+ return [].concat(_toConsumableArray(blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions)), _toConsumableArray(headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 ? void 0 : (_api$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.actions)));
171
174
  }
172
175
  }
173
176
  };
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "185.2.5";
2
+ export var version = "185.2.7";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "185.2.5",
3
+ "version": "185.2.7",
4
4
  "sideEffects": false
5
5
  }
@@ -1,7 +1,9 @@
1
- import { NextEditorPlugin } from '@atlaskit/editor-common/types';
1
+ import { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import { BlockTypePluginOptions } from './types';
3
+ import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
4
  declare const blockTypePlugin: NextEditorPlugin<'blockType', {
4
5
  pluginConfiguration: BlockTypePluginOptions | undefined;
6
+ dependencies: [OptionalPlugin<typeof analyticsPlugin>];
5
7
  }>;
6
8
  export default blockTypePlugin;
7
9
  export { pluginKey } from './pm-plugins/main';
@@ -1,7 +1,11 @@
1
- import { NextEditorPlugin } from '@atlaskit/editor-common/types';
1
+ import { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import { BlockTypePluginOptions } from './types';
3
+ import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
4
  declare const blockTypePlugin: NextEditorPlugin<'blockType', {
4
5
  pluginConfiguration: BlockTypePluginOptions | undefined;
6
+ dependencies: [
7
+ OptionalPlugin<typeof analyticsPlugin>
8
+ ];
5
9
  }>;
6
10
  export default blockTypePlugin;
7
11
  export { pluginKey } from './pm-plugins/main';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "185.2.5",
3
+ "version": "185.2.7",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -73,7 +73,7 @@
73
73
  "@atlaskit/locale": "^2.5.0",
74
74
  "@atlaskit/logo": "^13.14.0",
75
75
  "@atlaskit/media-card": "^76.0.0",
76
- "@atlaskit/media-client": "^23.0.0",
76
+ "@atlaskit/media-client": "^23.1.0",
77
77
  "@atlaskit/media-common": "^7.0.0",
78
78
  "@atlaskit/media-filmstrip": "^47.0.0",
79
79
  "@atlaskit/media-picker": "^66.0.0",