@atlaskit/editor-plugin-code-block 8.0.11 → 8.0.12

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,13 @@
1
1
  # @atlaskit/editor-plugin-code-block
2
2
 
3
+ ## 8.0.12
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b6824e1dfce8e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b6824e1dfce8e) -
8
+ ED-29505 Add analytics for plain text code block inserted
9
+ - Updated dependencies
10
+
3
11
  ## 8.0.11
4
12
 
5
13
  ### Patch Changes
@@ -126,7 +126,7 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
126
126
  icon: function icon() {
127
127
  return /*#__PURE__*/_react.default.createElement(_quickInsert.IconCode, null);
128
128
  },
129
- action: function action(_insert, state) {
129
+ action: function action(_insert, state, source) {
130
130
  var _api$analytics3;
131
131
  var tr = (0, _editorCommands.createInsertCodeBlockTransaction)({
132
132
  state: state
@@ -136,7 +136,7 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
136
136
  actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
137
137
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.CODE_BLOCK,
138
138
  attributes: {
139
- inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
139
+ inputMethod: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_plain_text_support', 'isEnabled', true) ? source || _analytics.INPUT_METHOD.QUICK_INSERT : _analytics.INPUT_METHOD.QUICK_INSERT
140
140
  },
141
141
  eventType: _analytics.EVENT_TYPE.TRACK
142
142
  })(tr);
@@ -152,13 +152,24 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
152
152
  icon: function icon() {
153
153
  return /*#__PURE__*/_react.default.createElement(_quickInsert.IconCode, null);
154
154
  },
155
- action: function action(_insert, state) {
155
+ action: function action(_insert, state, source) {
156
+ var _api$analytics4;
156
157
  var tr = (0, _editorCommands.createInsertCodeBlockTransaction)({
157
158
  state: state,
158
159
  attributes: {
159
160
  language: 'text'
160
161
  }
161
162
  });
163
+ api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 || _api$analytics4.actions.attachAnalyticsEvent({
164
+ action: _analytics.ACTION.INSERTED,
165
+ actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
166
+ actionSubjectId: _analytics.ACTION_SUBJECT_ID.CODE_BLOCK,
167
+ attributes: {
168
+ inputMethod: source || _analytics.INPUT_METHOD.QUICK_INSERT,
169
+ language: 'text'
170
+ },
171
+ eventType: _analytics.EVENT_TYPE.TRACK
172
+ })(tr);
162
173
  return tr;
163
174
  }
164
175
  });
@@ -11,8 +11,6 @@ var _view = require("@atlaskit/editor-prosemirror/view");
11
11
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
12
  var _classNames = require("../ui/class-names");
13
13
  var _utils = require("./utils");
14
- /* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
15
-
16
14
  var DECORATION_WIDGET_TYPE = exports.DECORATION_WIDGET_TYPE = 'decorationWidgetType';
17
15
  var DECORATION_WRAPPED_BLOCK_NODE_TYPE = exports.DECORATION_WRAPPED_BLOCK_NODE_TYPE = 'decorationNodeType';
18
16
 
@@ -24,7 +24,7 @@ var _decorators = require("./decorators");
24
24
  var _pluginKey = require("./plugin-key");
25
25
  var _utils = require("./utils");
26
26
  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; }
27
- 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) { (0, _defineProperty2.default)(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; } /* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
27
+ 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) { (0, _defineProperty2.default)(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; }
28
28
  var createPlugin = exports.createPlugin = function createPlugin(_ref) {
29
29
  var _ref$useLongPressSele = _ref.useLongPressSelection,
30
30
  useLongPressSelection = _ref$useLongPressSele === void 0 ? false : _ref$useLongPressSele,
@@ -110,7 +110,7 @@ const codeBlockPlugin = ({
110
110
  priority: 700,
111
111
  keyshortcut: '```',
112
112
  icon: () => /*#__PURE__*/React.createElement(IconCode, null),
113
- action(_insert, state) {
113
+ action(_insert, state, source) {
114
114
  var _api$analytics3;
115
115
  const tr = createInsertCodeBlockTransaction({
116
116
  state
@@ -120,7 +120,7 @@ const codeBlockPlugin = ({
120
120
  actionSubject: ACTION_SUBJECT.DOCUMENT,
121
121
  actionSubjectId: ACTION_SUBJECT_ID.CODE_BLOCK,
122
122
  attributes: {
123
- inputMethod: INPUT_METHOD.QUICK_INSERT
123
+ inputMethod: expValEqualsNoExposure('platform_editor_plain_text_support', 'isEnabled', true) ? source || INPUT_METHOD.QUICK_INSERT : INPUT_METHOD.QUICK_INSERT
124
124
  },
125
125
  eventType: EVENT_TYPE.TRACK
126
126
  })(tr);
@@ -134,13 +134,24 @@ const codeBlockPlugin = ({
134
134
  description: formatMessage(blockTypeMessages.plainTextCodeblockDescription),
135
135
  keywords: ['plain text'],
136
136
  icon: () => /*#__PURE__*/React.createElement(IconCode, null),
137
- action(_insert, state) {
137
+ action(_insert, state, source) {
138
+ var _api$analytics4;
138
139
  const tr = createInsertCodeBlockTransaction({
139
140
  state,
140
141
  attributes: {
141
142
  language: 'text'
142
143
  }
143
144
  });
145
+ api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions.attachAnalyticsEvent({
146
+ action: ACTION.INSERTED,
147
+ actionSubject: ACTION_SUBJECT.DOCUMENT,
148
+ actionSubjectId: ACTION_SUBJECT_ID.CODE_BLOCK,
149
+ attributes: {
150
+ inputMethod: source || INPUT_METHOD.QUICK_INSERT,
151
+ language: 'text'
152
+ },
153
+ eventType: EVENT_TYPE.TRACK
154
+ })(tr);
144
155
  return tr;
145
156
  }
146
157
  });
@@ -1,5 +1,3 @@
1
- /* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
2
-
3
1
  import { isCodeBlockWordWrapEnabled } from '@atlaskit/editor-common/code-block';
4
2
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
5
3
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -1,5 +1,3 @@
1
- /* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
2
-
3
1
  import { browser } from '@atlaskit/editor-common/browser';
4
2
  import { updateCodeBlockWrappedStateNodeKeys } from '@atlaskit/editor-common/code-block';
5
3
  import { blockTypeMessages } from '@atlaskit/editor-common/messages';
@@ -119,7 +119,7 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
119
119
  icon: function icon() {
120
120
  return /*#__PURE__*/React.createElement(IconCode, null);
121
121
  },
122
- action: function action(_insert, state) {
122
+ action: function action(_insert, state, source) {
123
123
  var _api$analytics3;
124
124
  var tr = createInsertCodeBlockTransaction({
125
125
  state: state
@@ -129,7 +129,7 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
129
129
  actionSubject: ACTION_SUBJECT.DOCUMENT,
130
130
  actionSubjectId: ACTION_SUBJECT_ID.CODE_BLOCK,
131
131
  attributes: {
132
- inputMethod: INPUT_METHOD.QUICK_INSERT
132
+ inputMethod: expValEqualsNoExposure('platform_editor_plain_text_support', 'isEnabled', true) ? source || INPUT_METHOD.QUICK_INSERT : INPUT_METHOD.QUICK_INSERT
133
133
  },
134
134
  eventType: EVENT_TYPE.TRACK
135
135
  })(tr);
@@ -145,13 +145,24 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
145
145
  icon: function icon() {
146
146
  return /*#__PURE__*/React.createElement(IconCode, null);
147
147
  },
148
- action: function action(_insert, state) {
148
+ action: function action(_insert, state, source) {
149
+ var _api$analytics4;
149
150
  var tr = createInsertCodeBlockTransaction({
150
151
  state: state,
151
152
  attributes: {
152
153
  language: 'text'
153
154
  }
154
155
  });
156
+ api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 || _api$analytics4.actions.attachAnalyticsEvent({
157
+ action: ACTION.INSERTED,
158
+ actionSubject: ACTION_SUBJECT.DOCUMENT,
159
+ actionSubjectId: ACTION_SUBJECT_ID.CODE_BLOCK,
160
+ attributes: {
161
+ inputMethod: source || INPUT_METHOD.QUICK_INSERT,
162
+ language: 'text'
163
+ },
164
+ eventType: EVENT_TYPE.TRACK
165
+ })(tr);
155
166
  return tr;
156
167
  }
157
168
  });
@@ -1,6 +1,4 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- /* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
3
-
4
2
  import { isCodeBlockWordWrapEnabled } from '@atlaskit/editor-common/code-block';
5
3
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
6
4
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -1,8 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  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; }
3
3
  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; }
4
- /* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
5
-
6
4
  import { browser } from '@atlaskit/editor-common/browser';
7
5
  import { updateCodeBlockWrappedStateNodeKeys } from '@atlaskit/editor-common/code-block';
8
6
  import { blockTypeMessages } from '@atlaskit/editor-common/messages';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-block",
3
- "version": "8.0.11",
3
+ "version": "8.0.12",
4
4
  "description": "Code block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -37,17 +37,17 @@
37
37
  "@atlaskit/editor-plugin-editor-viewmode": "^8.0.0",
38
38
  "@atlaskit/editor-plugin-interaction": "^8.0.0",
39
39
  "@atlaskit/editor-plugin-selection": "^6.1.0",
40
- "@atlaskit/editor-plugin-toolbar": "^3.2.0",
40
+ "@atlaskit/editor-plugin-toolbar": "^3.3.0",
41
41
  "@atlaskit/editor-prosemirror": "7.0.0",
42
42
  "@atlaskit/editor-toolbar": "^0.15.0",
43
43
  "@atlaskit/icon": "^28.5.0",
44
44
  "@atlaskit/platform-feature-flags": "^1.1.0",
45
45
  "@atlaskit/prosemirror-input-rules": "^3.5.0",
46
- "@atlaskit/tmp-editor-statsig": "^13.9.0",
46
+ "@atlaskit/tmp-editor-statsig": "^13.10.0",
47
47
  "@babel/runtime": "^7.0.0"
48
48
  },
49
49
  "peerDependencies": {
50
- "@atlaskit/editor-common": "^110.10.0",
50
+ "@atlaskit/editor-common": "^110.12.0",
51
51
  "react": "^18.2.0",
52
52
  "react-intl-next": "npm:react-intl@^5.18.1"
53
53
  },