@atlaskit/editor-plugin-insert-block 9.0.24 → 9.1.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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-plugin-insert-block
2
2
 
3
+ ## 9.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 9.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`73ebf54808245`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/73ebf54808245) -
14
+ [ux] Added featured sorting for whiteboard jira quick insert item to the insert menu
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
3
20
  ## 9.0.24
4
21
 
5
22
  ### Patch Changes
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.sortPrioritizedElements = exports.default = exports.DEFAULT_HEIGHT = void 0;
7
+ exports.sortFeaturedItems = exports.default = exports.DEFAULT_HEIGHT = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
@@ -32,15 +32,11 @@ var DEFAULT_HEIGHT = exports.DEFAULT_HEIGHT = 560;
32
32
  /**
33
33
  * Exported helper to allow testing of InsertMenu pinning logic.
34
34
  *
35
- * NOTE: this is *not* the ideal way to approach this. The quick insert plugin provides a
36
- * `getSuggestions` method that can be used to get suggestions. Once all experiments are cleaned up,
37
- * they should be unified through `pluginInjectionApi?.quickInsert?.actions.getSuggestions`.
38
- *
39
35
  * The `cc_fd_db_top_editor_toolbar` experiment adds new logic to sort elements by `priority`.
40
36
  * This newer implementation matches how the quick insert menu sorts elements.
41
37
  */
42
- var sortPrioritizedElements = exports.sortPrioritizedElements = function sortPrioritizedElements(featuredItems, formatMessage) {
43
- if (['new-description', 'orig-description'].includes((0, _expVal.expVal)('cc_fd_db_top_editor_toolbar', 'cohort', 'control'))) {
38
+ var sortFeaturedItems = exports.sortFeaturedItems = function sortFeaturedItems(featuredItems, formatMessage) {
39
+ if (['new-description', 'orig-description'].includes((0, _expVal.expVal)('cc_fd_db_top_editor_toolbar', 'cohort', 'control')) || (0, _expVal.expValNoExposure)('cc_fd_wb_jira_quick_insert_experiment', 'isEnabled', false)) {
44
40
  // Sort by priority (lower first) on the concatenated list so items
45
41
  // with "priority" are at the top (e.g. Whiteboard before Database)
46
42
  return featuredItems.slice(0).sort(function (a, b) {
@@ -48,7 +44,7 @@ var sortPrioritizedElements = exports.sortPrioritizedElements = function sortPri
48
44
  });
49
45
  }
50
46
 
51
- // old logic sort whiteboards to top
47
+ // NOTE: this is *not* the ideal way to approach this. Old logic sort whiteboards to top
52
48
  var DIAGRAM_KEY = 'whiteboard-extension:create-diagram';
53
49
  var isDiagram = function isDiagram(item) {
54
50
  return item.key === DIAGRAM_KEY;
@@ -186,7 +182,7 @@ var InsertMenu = function InsertMenu(_ref) {
186
182
  })) !== null && _pluginInjectionApi$q4 !== void 0 ? _pluginInjectionApi$q4 : [];
187
183
  var unfilteredResult = quickInsertDropdownItems.concat(featuredQuickInsertSuggestions);
188
184
  // need to sort on the concatenated list so desired elements are at the top
189
- result = sortPrioritizedElements(unfilteredResult, formatMessage);
185
+ result = sortFeaturedItems(unfilteredResult, formatMessage);
190
186
  }
191
187
  setItemCount(result.length);
192
188
  return result;
@@ -16,27 +16,23 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
16
16
  import { messages, IconCode, IconDate, IconDecision, IconDivider, IconExpand, IconPanel, IconQuote, IconStatus } from '@atlaskit/editor-common/quick-insert';
17
17
  import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
18
18
  import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
19
- import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
19
+ import { expVal, expValNoExposure } from '@atlaskit/tmp-editor-statsig/expVal';
20
20
  export const DEFAULT_HEIGHT = 560;
21
21
 
22
22
  /**
23
23
  * Exported helper to allow testing of InsertMenu pinning logic.
24
24
  *
25
- * NOTE: this is *not* the ideal way to approach this. The quick insert plugin provides a
26
- * `getSuggestions` method that can be used to get suggestions. Once all experiments are cleaned up,
27
- * they should be unified through `pluginInjectionApi?.quickInsert?.actions.getSuggestions`.
28
- *
29
25
  * The `cc_fd_db_top_editor_toolbar` experiment adds new logic to sort elements by `priority`.
30
26
  * This newer implementation matches how the quick insert menu sorts elements.
31
27
  */
32
- export const sortPrioritizedElements = (featuredItems, formatMessage) => {
33
- if (['new-description', 'orig-description'].includes(expVal('cc_fd_db_top_editor_toolbar', 'cohort', 'control'))) {
28
+ export const sortFeaturedItems = (featuredItems, formatMessage) => {
29
+ if (['new-description', 'orig-description'].includes(expVal('cc_fd_db_top_editor_toolbar', 'cohort', 'control')) || expValNoExposure('cc_fd_wb_jira_quick_insert_experiment', 'isEnabled', false)) {
34
30
  // Sort by priority (lower first) on the concatenated list so items
35
31
  // with "priority" are at the top (e.g. Whiteboard before Database)
36
32
  return featuredItems.slice(0).sort((a, b) => (a.priority || Number.POSITIVE_INFINITY) - (b.priority || Number.POSITIVE_INFINITY));
37
33
  }
38
34
 
39
- // old logic sort whiteboards to top
35
+ // NOTE: this is *not* the ideal way to approach this. Old logic sort whiteboards to top
40
36
  const DIAGRAM_KEY = 'whiteboard-extension:create-diagram';
41
37
  const isDiagram = item => item.key === DIAGRAM_KEY;
42
38
  const featuredWhiteboardsPresent = featuredItems.some(isDiagram);
@@ -156,7 +152,7 @@ const InsertMenu = ({
156
152
  } : item)) !== null && _pluginInjectionApi$q5 !== void 0 ? _pluginInjectionApi$q5 : [];
157
153
  const unfilteredResult = quickInsertDropdownItems.concat(featuredQuickInsertSuggestions);
158
154
  // need to sort on the concatenated list so desired elements are at the top
159
- result = sortPrioritizedElements(unfilteredResult, formatMessage);
155
+ result = sortFeaturedItems(unfilteredResult, formatMessage);
160
156
  }
161
157
  setItemCount(result.length);
162
158
  return result;
@@ -23,21 +23,17 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
23
23
  import { messages, IconCode, IconDate, IconDecision, IconDivider, IconExpand, IconPanel, IconQuote, IconStatus } from '@atlaskit/editor-common/quick-insert';
24
24
  import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
25
25
  import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
26
- import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
26
+ import { expVal, expValNoExposure } from '@atlaskit/tmp-editor-statsig/expVal';
27
27
  export var DEFAULT_HEIGHT = 560;
28
28
 
29
29
  /**
30
30
  * Exported helper to allow testing of InsertMenu pinning logic.
31
31
  *
32
- * NOTE: this is *not* the ideal way to approach this. The quick insert plugin provides a
33
- * `getSuggestions` method that can be used to get suggestions. Once all experiments are cleaned up,
34
- * they should be unified through `pluginInjectionApi?.quickInsert?.actions.getSuggestions`.
35
- *
36
32
  * The `cc_fd_db_top_editor_toolbar` experiment adds new logic to sort elements by `priority`.
37
33
  * This newer implementation matches how the quick insert menu sorts elements.
38
34
  */
39
- export var sortPrioritizedElements = function sortPrioritizedElements(featuredItems, formatMessage) {
40
- if (['new-description', 'orig-description'].includes(expVal('cc_fd_db_top_editor_toolbar', 'cohort', 'control'))) {
35
+ export var sortFeaturedItems = function sortFeaturedItems(featuredItems, formatMessage) {
36
+ if (['new-description', 'orig-description'].includes(expVal('cc_fd_db_top_editor_toolbar', 'cohort', 'control')) || expValNoExposure('cc_fd_wb_jira_quick_insert_experiment', 'isEnabled', false)) {
41
37
  // Sort by priority (lower first) on the concatenated list so items
42
38
  // with "priority" are at the top (e.g. Whiteboard before Database)
43
39
  return featuredItems.slice(0).sort(function (a, b) {
@@ -45,7 +41,7 @@ export var sortPrioritizedElements = function sortPrioritizedElements(featuredIt
45
41
  });
46
42
  }
47
43
 
48
- // old logic sort whiteboards to top
44
+ // NOTE: this is *not* the ideal way to approach this. Old logic sort whiteboards to top
49
45
  var DIAGRAM_KEY = 'whiteboard-extension:create-diagram';
50
46
  var isDiagram = function isDiagram(item) {
51
47
  return item.key === DIAGRAM_KEY;
@@ -183,7 +179,7 @@ var InsertMenu = function InsertMenu(_ref) {
183
179
  })) !== null && _pluginInjectionApi$q4 !== void 0 ? _pluginInjectionApi$q4 : [];
184
180
  var unfilteredResult = quickInsertDropdownItems.concat(featuredQuickInsertSuggestions);
185
181
  // need to sort on the concatenated list so desired elements are at the top
186
- result = sortPrioritizedElements(unfilteredResult, formatMessage);
182
+ result = sortFeaturedItems(unfilteredResult, formatMessage);
187
183
  }
188
184
  setItemCount(result.length);
189
185
  return result;
@@ -6,13 +6,9 @@ export declare const DEFAULT_HEIGHT = 560;
6
6
  /**
7
7
  * Exported helper to allow testing of InsertMenu pinning logic.
8
8
  *
9
- * NOTE: this is *not* the ideal way to approach this. The quick insert plugin provides a
10
- * `getSuggestions` method that can be used to get suggestions. Once all experiments are cleaned up,
11
- * they should be unified through `pluginInjectionApi?.quickInsert?.actions.getSuggestions`.
12
- *
13
9
  * The `cc_fd_db_top_editor_toolbar` experiment adds new logic to sort elements by `priority`.
14
10
  * This newer implementation matches how the quick insert menu sorts elements.
15
11
  */
16
- export declare const sortPrioritizedElements: (featuredItems: QuickInsertItem[], formatMessage: (msg: MessageDescriptor) => string) => QuickInsertItem[];
12
+ export declare const sortFeaturedItems: (featuredItems: QuickInsertItem[], formatMessage: (msg: MessageDescriptor) => string) => QuickInsertItem[];
17
13
  declare const InsertMenu: ({ editorView, dropdownItems, showElementBrowserLink, onInsert, toggleVisiblity, pluginInjectionApi, }: InsertMenuProps) => jsx.JSX.Element;
18
14
  export default InsertMenu;
@@ -6,13 +6,9 @@ export declare const DEFAULT_HEIGHT = 560;
6
6
  /**
7
7
  * Exported helper to allow testing of InsertMenu pinning logic.
8
8
  *
9
- * NOTE: this is *not* the ideal way to approach this. The quick insert plugin provides a
10
- * `getSuggestions` method that can be used to get suggestions. Once all experiments are cleaned up,
11
- * they should be unified through `pluginInjectionApi?.quickInsert?.actions.getSuggestions`.
12
- *
13
9
  * The `cc_fd_db_top_editor_toolbar` experiment adds new logic to sort elements by `priority`.
14
10
  * This newer implementation matches how the quick insert menu sorts elements.
15
11
  */
16
- export declare const sortPrioritizedElements: (featuredItems: QuickInsertItem[], formatMessage: (msg: MessageDescriptor) => string) => QuickInsertItem[];
12
+ export declare const sortFeaturedItems: (featuredItems: QuickInsertItem[], formatMessage: (msg: MessageDescriptor) => string) => QuickInsertItem[];
17
13
  declare const InsertMenu: ({ editorView, dropdownItems, showElementBrowserLink, onInsert, toggleVisiblity, pluginInjectionApi, }: InsertMenuProps) => jsx.JSX.Element;
18
14
  export default InsertMenu;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-insert-block",
3
- "version": "9.0.24",
3
+ "version": "9.1.1",
4
4
  "description": "Insert block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -43,7 +43,7 @@
43
43
  "@atlaskit/editor-plugin-image-upload": "^8.0.0",
44
44
  "@atlaskit/editor-plugin-layout": "^8.1.0",
45
45
  "@atlaskit/editor-plugin-media": "^10.2.0",
46
- "@atlaskit/editor-plugin-media-insert": "^19.0.0",
46
+ "@atlaskit/editor-plugin-media-insert": "^20.0.0",
47
47
  "@atlaskit/editor-plugin-mentions": "^10.0.0",
48
48
  "@atlaskit/editor-plugin-metrics": "^9.0.0",
49
49
  "@atlaskit/editor-plugin-panel": "^10.0.0",
@@ -60,12 +60,12 @@
60
60
  "@atlaskit/editor-shared-styles": "^3.10.0",
61
61
  "@atlaskit/editor-toolbar": "^0.20.0",
62
62
  "@atlaskit/editor-toolbar-model": "^0.4.0",
63
- "@atlaskit/emoji": "^69.10.0",
63
+ "@atlaskit/emoji": "^69.11.0",
64
64
  "@atlaskit/icon": "^34.0.0",
65
65
  "@atlaskit/icon-lab": "^6.4.0",
66
66
  "@atlaskit/platform-feature-flags": "^1.1.0",
67
- "@atlaskit/tmp-editor-statsig": "^55.0.0",
68
- "@atlaskit/tokens": "^11.4.0",
67
+ "@atlaskit/tmp-editor-statsig": "^55.1.0",
68
+ "@atlaskit/tokens": "^12.0.0",
69
69
  "@babel/runtime": "^7.0.0",
70
70
  "@emotion/react": "^11.7.1",
71
71
  "bind-event-listener": "^3.0.0",