@atlaskit/editor-plugin-insert-block 1.9.0 → 1.9.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 +15 -0
- package/dist/cjs/plugin.js +31 -23
- package/dist/es2019/plugin.js +33 -25
- package/dist/esm/plugin.js +31 -23
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-insert-block
|
|
2
2
|
|
|
3
|
+
## 1.9.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#131878](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/131878)
|
|
8
|
+
[`705fe39cae267`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/705fe39cae267) -
|
|
9
|
+
[ED-24597] Update to log `platform_editor_basic_text_transformations` exposure event only for
|
|
10
|
+
users meet all of 3 checks:
|
|
11
|
+
|
|
12
|
+
- Are enrolled to the experiment
|
|
13
|
+
- Have AI disabled
|
|
14
|
+
- Make top level text selection
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 1.9.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -13,6 +13,7 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
13
13
|
var _providerFactory = require("@atlaskit/editor-common/provider-factory");
|
|
14
14
|
var _types = require("@atlaskit/editor-common/types");
|
|
15
15
|
var _consts = require("@atlaskit/editor-plugin-block-type/consts");
|
|
16
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
16
17
|
var _switch = _interopRequireDefault(require("./assets/switch"));
|
|
17
18
|
var _ToolbarInsertBlock = _interopRequireDefault(require("./ui/ToolbarInsertBlock"));
|
|
18
19
|
var _transformOptions = require("./ui/transformOptions");
|
|
@@ -126,33 +127,40 @@ var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_
|
|
|
126
127
|
selectionToolbar: function selectionToolbar(state, intl) {
|
|
127
128
|
var _api$featureFlags;
|
|
128
129
|
var $from = state.selection.$from;
|
|
129
|
-
|
|
130
|
+
var isEligible =
|
|
131
|
+
// basicTextTransformations is used to present AI enablement status to avoid adding editor props
|
|
132
|
+
(api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 || (_api$featureFlags = _api$featureFlags.sharedState.currentState()) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.basicTextTransformations) && $from.depth === 1;
|
|
133
|
+
if (!isEligible) {
|
|
130
134
|
return;
|
|
131
135
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
136
|
+
if ((0, _experiments.editorExperiment)('basic-text-transformations', true, {
|
|
137
|
+
exposure: true
|
|
138
|
+
})) {
|
|
139
|
+
var formatMessage = intl.formatMessage;
|
|
140
|
+
var _options = (0, _transformOptions.transformationOptions)(api).map(function (option) {
|
|
141
|
+
var IconBefore = option.icon;
|
|
142
|
+
return {
|
|
143
|
+
title: formatMessage(option.title),
|
|
144
|
+
icon: /*#__PURE__*/_react.default.createElement(IconBefore, {
|
|
145
|
+
label: ""
|
|
146
|
+
}),
|
|
147
|
+
onClick: function onClick(state, dispatch) {
|
|
148
|
+
var _option$command;
|
|
149
|
+
(_option$command = option.command) === null || _option$command === void 0 || _option$command.call(option, _analytics.INPUT_METHOD.FLOATING_TB)(state, dispatch);
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
});
|
|
135
154
|
return {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
return true;
|
|
144
|
-
}
|
|
155
|
+
items: [{
|
|
156
|
+
type: 'dropdown',
|
|
157
|
+
title: formatMessage(_messages.toolbarInsertBlockMessages.turnInto),
|
|
158
|
+
iconBefore: _switch.default,
|
|
159
|
+
options: _options
|
|
160
|
+
}],
|
|
161
|
+
rank: -9
|
|
145
162
|
};
|
|
146
|
-
}
|
|
147
|
-
return {
|
|
148
|
-
items: [{
|
|
149
|
-
type: 'dropdown',
|
|
150
|
-
title: formatMessage(_messages.toolbarInsertBlockMessages.turnInto),
|
|
151
|
-
iconBefore: _switch.default,
|
|
152
|
-
options: options
|
|
153
|
-
}],
|
|
154
|
-
rank: -9
|
|
155
|
-
};
|
|
163
|
+
}
|
|
156
164
|
}
|
|
157
165
|
},
|
|
158
166
|
usePluginHook: function usePluginHook() {
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -5,6 +5,7 @@ import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/
|
|
|
5
5
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
6
6
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
7
7
|
import { BLOCK_QUOTE, CODE_BLOCK, PANEL } from '@atlaskit/editor-plugin-block-type/consts';
|
|
8
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
9
|
import SwitchIcon from './assets/switch';
|
|
9
10
|
import ToolbarInsertBlock from './ui/ToolbarInsertBlock';
|
|
10
11
|
import { transformationOptions } from './ui/transformOptions';
|
|
@@ -119,35 +120,42 @@ export const insertBlockPlugin = ({
|
|
|
119
120
|
$from
|
|
120
121
|
}
|
|
121
122
|
} = state;
|
|
122
|
-
|
|
123
|
+
const isEligible =
|
|
124
|
+
// basicTextTransformations is used to present AI enablement status to avoid adding editor props
|
|
125
|
+
(api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : (_api$featureFlags$sha = _api$featureFlags.sharedState.currentState()) === null || _api$featureFlags$sha === void 0 ? void 0 : _api$featureFlags$sha.basicTextTransformations) && $from.depth === 1;
|
|
126
|
+
if (!isEligible) {
|
|
123
127
|
return;
|
|
124
128
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
129
|
+
if (editorExperiment('basic-text-transformations', true, {
|
|
130
|
+
exposure: true
|
|
131
|
+
})) {
|
|
132
|
+
const {
|
|
133
|
+
formatMessage
|
|
134
|
+
} = intl;
|
|
135
|
+
const options = transformationOptions(api).map(option => {
|
|
136
|
+
const IconBefore = option.icon;
|
|
137
|
+
return {
|
|
138
|
+
title: formatMessage(option.title),
|
|
139
|
+
icon: /*#__PURE__*/React.createElement(IconBefore, {
|
|
140
|
+
label: ""
|
|
141
|
+
}),
|
|
142
|
+
onClick: (state, dispatch) => {
|
|
143
|
+
var _option$command;
|
|
144
|
+
(_option$command = option.command) === null || _option$command === void 0 ? void 0 : _option$command.call(option, INPUT_METHOD.FLOATING_TB)(state, dispatch);
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
});
|
|
130
149
|
return {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
return true;
|
|
139
|
-
}
|
|
150
|
+
items: [{
|
|
151
|
+
type: 'dropdown',
|
|
152
|
+
title: formatMessage(messages.turnInto),
|
|
153
|
+
iconBefore: SwitchIcon,
|
|
154
|
+
options
|
|
155
|
+
}],
|
|
156
|
+
rank: -9
|
|
140
157
|
};
|
|
141
|
-
}
|
|
142
|
-
return {
|
|
143
|
-
items: [{
|
|
144
|
-
type: 'dropdown',
|
|
145
|
-
title: formatMessage(messages.turnInto),
|
|
146
|
-
iconBefore: SwitchIcon,
|
|
147
|
-
options
|
|
148
|
-
}],
|
|
149
|
-
rank: -9
|
|
150
|
-
};
|
|
158
|
+
}
|
|
151
159
|
}
|
|
152
160
|
},
|
|
153
161
|
usePluginHook: () => {
|
package/dist/esm/plugin.js
CHANGED
|
@@ -5,6 +5,7 @@ import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/
|
|
|
5
5
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
6
6
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
7
7
|
import { BLOCK_QUOTE, CODE_BLOCK, PANEL } from '@atlaskit/editor-plugin-block-type/consts';
|
|
8
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
9
|
import SwitchIcon from './assets/switch';
|
|
9
10
|
import ToolbarInsertBlock from './ui/ToolbarInsertBlock';
|
|
10
11
|
import { transformationOptions } from './ui/transformOptions';
|
|
@@ -116,33 +117,40 @@ export var insertBlockPlugin = function insertBlockPlugin(_ref) {
|
|
|
116
117
|
selectionToolbar: function selectionToolbar(state, intl) {
|
|
117
118
|
var _api$featureFlags;
|
|
118
119
|
var $from = state.selection.$from;
|
|
119
|
-
|
|
120
|
+
var isEligible =
|
|
121
|
+
// basicTextTransformations is used to present AI enablement status to avoid adding editor props
|
|
122
|
+
(api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 || (_api$featureFlags = _api$featureFlags.sharedState.currentState()) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.basicTextTransformations) && $from.depth === 1;
|
|
123
|
+
if (!isEligible) {
|
|
120
124
|
return;
|
|
121
125
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
126
|
+
if (editorExperiment('basic-text-transformations', true, {
|
|
127
|
+
exposure: true
|
|
128
|
+
})) {
|
|
129
|
+
var formatMessage = intl.formatMessage;
|
|
130
|
+
var _options = transformationOptions(api).map(function (option) {
|
|
131
|
+
var IconBefore = option.icon;
|
|
132
|
+
return {
|
|
133
|
+
title: formatMessage(option.title),
|
|
134
|
+
icon: /*#__PURE__*/React.createElement(IconBefore, {
|
|
135
|
+
label: ""
|
|
136
|
+
}),
|
|
137
|
+
onClick: function onClick(state, dispatch) {
|
|
138
|
+
var _option$command;
|
|
139
|
+
(_option$command = option.command) === null || _option$command === void 0 || _option$command.call(option, INPUT_METHOD.FLOATING_TB)(state, dispatch);
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
});
|
|
125
144
|
return {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
return true;
|
|
134
|
-
}
|
|
145
|
+
items: [{
|
|
146
|
+
type: 'dropdown',
|
|
147
|
+
title: formatMessage(messages.turnInto),
|
|
148
|
+
iconBefore: SwitchIcon,
|
|
149
|
+
options: _options
|
|
150
|
+
}],
|
|
151
|
+
rank: -9
|
|
135
152
|
};
|
|
136
|
-
}
|
|
137
|
-
return {
|
|
138
|
-
items: [{
|
|
139
|
-
type: 'dropdown',
|
|
140
|
-
title: formatMessage(messages.turnInto),
|
|
141
|
-
iconBefore: SwitchIcon,
|
|
142
|
-
options: options
|
|
143
|
-
}],
|
|
144
|
-
rank: -9
|
|
145
|
-
};
|
|
153
|
+
}
|
|
146
154
|
}
|
|
147
155
|
},
|
|
148
156
|
usePluginHook: function usePluginHook() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-insert-block",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "Insert block plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
".": "./src/index.ts"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@atlaskit/editor-common": "^87.
|
|
36
|
+
"@atlaskit/editor-common": "^87.13.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^1.7.0",
|
|
38
38
|
"@atlaskit/editor-plugin-block-type": "^3.13.0",
|
|
39
39
|
"@atlaskit/editor-plugin-code-block": "^3.3.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@atlaskit/editor-plugin-image-upload": "^1.2.0",
|
|
47
47
|
"@atlaskit/editor-plugin-layout": "^1.7.0",
|
|
48
48
|
"@atlaskit/editor-plugin-media": "^1.29.0",
|
|
49
|
-
"@atlaskit/editor-plugin-mentions": "^2.
|
|
49
|
+
"@atlaskit/editor-plugin-mentions": "^2.4.0",
|
|
50
50
|
"@atlaskit/editor-plugin-panel": "^2.3.0",
|
|
51
51
|
"@atlaskit/editor-plugin-placeholder-text": "^1.7.0",
|
|
52
52
|
"@atlaskit/editor-plugin-primary-toolbar": "^2.0.0",
|
|
@@ -59,11 +59,12 @@
|
|
|
59
59
|
"@atlaskit/editor-prosemirror": "5.0.1",
|
|
60
60
|
"@atlaskit/editor-shared-styles": "^2.13.0",
|
|
61
61
|
"@atlaskit/emoji": "^67.7.0",
|
|
62
|
-
"@atlaskit/icon": "^22.
|
|
62
|
+
"@atlaskit/icon": "^22.14.0",
|
|
63
63
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
64
64
|
"@atlaskit/primitives": "^12.0.0",
|
|
65
65
|
"@atlaskit/theme": "^13.0.0",
|
|
66
|
-
"@atlaskit/
|
|
66
|
+
"@atlaskit/tmp-editor-statsig": "^1.2.0",
|
|
67
|
+
"@atlaskit/tokens": "^1.59.0",
|
|
67
68
|
"@babel/runtime": "^7.0.0",
|
|
68
69
|
"@emotion/react": "^11.7.1",
|
|
69
70
|
"bind-event-listener": "^3.0.0",
|