@atlaskit/editor-plugin-insert-block 8.3.3 → 8.4.0
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 +13 -0
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +24 -96
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +18 -83
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +23 -95
- package/dist/types/ui/ElementBrowser/InsertMenu.d.ts +1 -1
- package/dist/types-ts4.5/ui/ElementBrowser/InsertMenu.d.ts +1 -1
- package/package.json +2 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-insert-block
|
|
2
2
|
|
|
3
|
+
## 8.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`7b679117f4605`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7b679117f4605) -
|
|
8
|
+
[ux] Productionizes `confluence-whiteboards-quick-insert-eligible` and
|
|
9
|
+
`confluence-whiteboards-quick-insert-l10n-eligible` feature gates and
|
|
10
|
+
`confluence_whiteboards_quick_insert_localised` experiment. Ship "Diagram" variant.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 8.3.3
|
|
4
17
|
|
|
5
18
|
### 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.
|
|
7
|
+
exports.filterForPinWhiteboards = 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"));
|
|
@@ -20,10 +20,7 @@ var _hooks = require("@atlaskit/editor-common/hooks");
|
|
|
20
20
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
21
21
|
var _uiReact = require("@atlaskit/editor-common/ui-react");
|
|
22
22
|
var _editorPluginConnectivity = require("@atlaskit/editor-plugin-connectivity");
|
|
23
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
24
23
|
var _colors = require("@atlaskit/theme/colors");
|
|
25
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
26
|
-
var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
|
|
27
24
|
var _excluded = ["children"];
|
|
28
25
|
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; }
|
|
29
26
|
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; } /**
|
|
@@ -38,98 +35,29 @@ var DEFAULT_HEIGHT = exports.DEFAULT_HEIGHT = 560;
|
|
|
38
35
|
method that can be used to get suggestions -> once all experiments are cleaned up,
|
|
39
36
|
they should be unified through `pluginInjectionApi?.quickInsert?.actions.getSuggestions`
|
|
40
37
|
*/
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
var index = items.findIndex(function (item) {
|
|
58
|
-
return item.title === title;
|
|
59
|
-
});
|
|
60
|
-
var filteredList = items.filter(function (item) {
|
|
61
|
-
return ![DIAGRAM_TITLE, BLANK_TITLE].includes(item.title);
|
|
62
|
-
});
|
|
63
|
-
if (index === -1) {
|
|
64
|
-
return filteredList;
|
|
65
|
-
}
|
|
66
|
-
var featuredItem = _objectSpread({}, items[index]);
|
|
67
|
-
featuredItem.description = formatMessage(_quickInsert.messages.featuredWhiteboardDescription);
|
|
68
|
-
return [featuredItem].concat((0, _toConsumableArray2.default)(filteredList));
|
|
69
|
-
};
|
|
70
|
-
return pinWhiteboardActionToTop(featuredItems, DIAGRAM_TITLE);
|
|
71
|
-
} else {
|
|
72
|
-
if ((0, _platformFeatureFlags.fg)('confluence-whiteboards-quick-insert-l10n-eligible')) {
|
|
73
|
-
// Fire exposure for confluence_whiteboards_quick_insert_localised_aa
|
|
74
|
-
// https://switcheroo.atlassian.com/ui/gates/ccd80d32-28a1-4dcf-b3f9-dbdc02a046ff/key/confluence_whiteboards_quick_insert_localised_aa
|
|
75
|
-
(0, _expVal.expVal)('confluence_whiteboards_quick_insert_localised_aa', 'cohort', 'test_diagram');
|
|
76
|
-
|
|
77
|
-
/** BEGIN locale agnostic path */
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* EXTREMELY IMPORTANT: we must not drop diagram for those who already receive
|
|
81
|
-
* the 'insert diagram to the top' treatment.
|
|
82
|
-
*
|
|
83
|
-
* Our heuristic to check that this is only targeting users where they haven't
|
|
84
|
-
* gotten the experience, is if we _cannot_ find the blank board experience in
|
|
85
|
-
* the list, matching purely on title.
|
|
86
|
-
*
|
|
87
|
-
* e.g. `featuredWhiteboardsPresent` = false, given it matches on title.
|
|
88
|
-
*
|
|
89
|
-
* The side-effect of this, is that there's a small chance/edge case of users
|
|
90
|
-
* who toggle between locales, and receive different experiences.
|
|
91
|
-
*
|
|
92
|
-
* Hopefully we can make a call early on this experiment, and eliminate this
|
|
93
|
-
* code path.
|
|
94
|
-
*/
|
|
95
|
-
var WHITEBOARD_KEY = 'whiteboard-extension:create-whiteboard';
|
|
96
|
-
var DIAGRAM_KEY = 'whiteboard-extension:create-diagram';
|
|
97
|
-
var isBlank = function isBlank(item) {
|
|
98
|
-
return item.key === WHITEBOARD_KEY;
|
|
99
|
-
};
|
|
100
|
-
var isDiagram = function isDiagram(item) {
|
|
101
|
-
return item.key === DIAGRAM_KEY;
|
|
102
|
-
};
|
|
103
|
-
var hasBoth = featuredItems.some(isBlank) && featuredItems.some(isDiagram);
|
|
104
|
-
if (hasBoth) {
|
|
105
|
-
var pin = function pin(key) {
|
|
106
|
-
var idx = featuredItems.findIndex(function (item) {
|
|
107
|
-
return item.key === key;
|
|
108
|
-
});
|
|
109
|
-
var filtered = featuredItems.filter(function (item) {
|
|
110
|
-
return !isBlank(item) && !isDiagram(item);
|
|
111
|
-
});
|
|
112
|
-
if (idx === -1) {
|
|
113
|
-
return filtered;
|
|
114
|
-
}
|
|
115
|
-
var picked = _objectSpread(_objectSpread({}, featuredItems[idx]), {}, {
|
|
116
|
-
description: formatMessage(_quickInsert.messages.featuredWhiteboardDescription)
|
|
117
|
-
});
|
|
118
|
-
return [picked].concat((0, _toConsumableArray2.default)(filtered));
|
|
119
|
-
};
|
|
120
|
-
if ((0, _expValEquals.expValEquals)('confluence_whiteboards_quick_insert_localised', 'cohort', 'test_blank')) {
|
|
121
|
-
return pin(WHITEBOARD_KEY);
|
|
122
|
-
}
|
|
123
|
-
if ((0, _expValEquals.expValEquals)('confluence_whiteboards_quick_insert_localised', 'cohort', 'test_diagram')) {
|
|
124
|
-
return pin(DIAGRAM_KEY);
|
|
125
|
-
}
|
|
126
|
-
if ((0, _expValEquals.expValEquals)('confluence_whiteboards_quick_insert_localised', 'cohort', 'control')) {
|
|
127
|
-
return featuredItems;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
38
|
+
var filterForPinWhiteboards = exports.filterForPinWhiteboards = function filterForPinWhiteboards(featuredItems, formatMessage) {
|
|
39
|
+
var DIAGRAM_KEY = 'whiteboard-extension:create-diagram';
|
|
40
|
+
var isDiagram = function isDiagram(item) {
|
|
41
|
+
return item.key === DIAGRAM_KEY;
|
|
42
|
+
};
|
|
43
|
+
var featuredWhiteboardsPresent = featuredItems.some(isDiagram);
|
|
44
|
+
if (featuredWhiteboardsPresent) {
|
|
45
|
+
var pin = function pin(key) {
|
|
46
|
+
var idx = featuredItems.findIndex(function (item) {
|
|
47
|
+
return item.key === key;
|
|
48
|
+
});
|
|
49
|
+
var filtered = featuredItems.filter(function (item) {
|
|
50
|
+
return !isDiagram(item);
|
|
51
|
+
});
|
|
52
|
+
if (idx === -1) {
|
|
53
|
+
return filtered;
|
|
130
54
|
}
|
|
131
|
-
|
|
132
|
-
|
|
55
|
+
var picked = _objectSpread(_objectSpread({}, featuredItems[idx]), {}, {
|
|
56
|
+
description: formatMessage(_quickInsert.messages.featuredWhiteboardDescription)
|
|
57
|
+
});
|
|
58
|
+
return [picked].concat((0, _toConsumableArray2.default)(filtered));
|
|
59
|
+
};
|
|
60
|
+
return pin(DIAGRAM_KEY);
|
|
133
61
|
}
|
|
134
62
|
return featuredItems;
|
|
135
63
|
};
|
|
@@ -243,7 +171,7 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
243
171
|
})) !== null && _pluginInjectionApi$q4 !== void 0 ? _pluginInjectionApi$q4 : [];
|
|
244
172
|
var unfilteredResult = quickInsertDropdownItems.concat(featuredQuickInsertSuggestions);
|
|
245
173
|
// need to filter on the concatenated list so whiteboards are at the top
|
|
246
|
-
result =
|
|
174
|
+
result = filterForPinWhiteboards(unfilteredResult, formatMessage);
|
|
247
175
|
}
|
|
248
176
|
setItemCount(result.length);
|
|
249
177
|
return result;
|
|
@@ -16,10 +16,7 @@ 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 { fg } from '@atlaskit/platform-feature-flags';
|
|
20
19
|
import { N0, N30A, N60A } from '@atlaskit/theme/colors';
|
|
21
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
22
|
-
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
23
20
|
export const DEFAULT_HEIGHT = 560;
|
|
24
21
|
|
|
25
22
|
/**
|
|
@@ -28,86 +25,24 @@ export const DEFAULT_HEIGHT = 560;
|
|
|
28
25
|
method that can be used to get suggestions -> once all experiments are cleaned up,
|
|
29
26
|
they should be unified through `pluginInjectionApi?.quickInsert?.actions.getSuggestions`
|
|
30
27
|
*/
|
|
31
|
-
export const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (featuredWhiteboardsPresent) {
|
|
42
|
-
const pinWhiteboardActionToTop = (items, title) => {
|
|
43
|
-
// find the requested item by title, give it the appropriate description, and bring it to the top of the list
|
|
44
|
-
const index = items.findIndex(item => item.title === title);
|
|
45
|
-
const filteredList = items.filter(item => ![DIAGRAM_TITLE, BLANK_TITLE].includes(item.title));
|
|
46
|
-
if (index === -1) {
|
|
47
|
-
return filteredList;
|
|
48
|
-
}
|
|
49
|
-
const featuredItem = {
|
|
50
|
-
...items[index]
|
|
51
|
-
};
|
|
52
|
-
featuredItem.description = formatMessage(messages.featuredWhiteboardDescription);
|
|
53
|
-
return [featuredItem, ...filteredList];
|
|
54
|
-
};
|
|
55
|
-
return pinWhiteboardActionToTop(featuredItems, DIAGRAM_TITLE);
|
|
56
|
-
} else {
|
|
57
|
-
if (fg('confluence-whiteboards-quick-insert-l10n-eligible')) {
|
|
58
|
-
// Fire exposure for confluence_whiteboards_quick_insert_localised_aa
|
|
59
|
-
// https://switcheroo.atlassian.com/ui/gates/ccd80d32-28a1-4dcf-b3f9-dbdc02a046ff/key/confluence_whiteboards_quick_insert_localised_aa
|
|
60
|
-
expVal('confluence_whiteboards_quick_insert_localised_aa', 'cohort', 'test_diagram');
|
|
61
|
-
|
|
62
|
-
/** BEGIN locale agnostic path */
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* EXTREMELY IMPORTANT: we must not drop diagram for those who already receive
|
|
66
|
-
* the 'insert diagram to the top' treatment.
|
|
67
|
-
*
|
|
68
|
-
* Our heuristic to check that this is only targeting users where they haven't
|
|
69
|
-
* gotten the experience, is if we _cannot_ find the blank board experience in
|
|
70
|
-
* the list, matching purely on title.
|
|
71
|
-
*
|
|
72
|
-
* e.g. `featuredWhiteboardsPresent` = false, given it matches on title.
|
|
73
|
-
*
|
|
74
|
-
* The side-effect of this, is that there's a small chance/edge case of users
|
|
75
|
-
* who toggle between locales, and receive different experiences.
|
|
76
|
-
*
|
|
77
|
-
* Hopefully we can make a call early on this experiment, and eliminate this
|
|
78
|
-
* code path.
|
|
79
|
-
*/
|
|
80
|
-
const WHITEBOARD_KEY = 'whiteboard-extension:create-whiteboard';
|
|
81
|
-
const DIAGRAM_KEY = 'whiteboard-extension:create-diagram';
|
|
82
|
-
const isBlank = item => item.key === WHITEBOARD_KEY;
|
|
83
|
-
const isDiagram = item => item.key === DIAGRAM_KEY;
|
|
84
|
-
const hasBoth = featuredItems.some(isBlank) && featuredItems.some(isDiagram);
|
|
85
|
-
if (hasBoth) {
|
|
86
|
-
const pin = key => {
|
|
87
|
-
const idx = featuredItems.findIndex(item => item.key === key);
|
|
88
|
-
const filtered = featuredItems.filter(item => !isBlank(item) && !isDiagram(item));
|
|
89
|
-
if (idx === -1) {
|
|
90
|
-
return filtered;
|
|
91
|
-
}
|
|
92
|
-
const picked = {
|
|
93
|
-
...featuredItems[idx],
|
|
94
|
-
description: formatMessage(messages.featuredWhiteboardDescription)
|
|
95
|
-
};
|
|
96
|
-
return [picked, ...filtered];
|
|
97
|
-
};
|
|
98
|
-
if (expValEquals('confluence_whiteboards_quick_insert_localised', 'cohort', 'test_blank')) {
|
|
99
|
-
return pin(WHITEBOARD_KEY);
|
|
100
|
-
}
|
|
101
|
-
if (expValEquals('confluence_whiteboards_quick_insert_localised', 'cohort', 'test_diagram')) {
|
|
102
|
-
return pin(DIAGRAM_KEY);
|
|
103
|
-
}
|
|
104
|
-
if (expValEquals('confluence_whiteboards_quick_insert_localised', 'cohort', 'control')) {
|
|
105
|
-
return featuredItems;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
28
|
+
export const filterForPinWhiteboards = (featuredItems, formatMessage) => {
|
|
29
|
+
const DIAGRAM_KEY = 'whiteboard-extension:create-diagram';
|
|
30
|
+
const isDiagram = item => item.key === DIAGRAM_KEY;
|
|
31
|
+
const featuredWhiteboardsPresent = featuredItems.some(isDiagram);
|
|
32
|
+
if (featuredWhiteboardsPresent) {
|
|
33
|
+
const pin = key => {
|
|
34
|
+
const idx = featuredItems.findIndex(item => item.key === key);
|
|
35
|
+
const filtered = featuredItems.filter(item => !isDiagram(item));
|
|
36
|
+
if (idx === -1) {
|
|
37
|
+
return filtered;
|
|
108
38
|
}
|
|
109
|
-
|
|
110
|
-
|
|
39
|
+
const picked = {
|
|
40
|
+
...featuredItems[idx],
|
|
41
|
+
description: formatMessage(messages.featuredWhiteboardDescription)
|
|
42
|
+
};
|
|
43
|
+
return [picked, ...filtered];
|
|
44
|
+
};
|
|
45
|
+
return pin(DIAGRAM_KEY);
|
|
111
46
|
}
|
|
112
47
|
return featuredItems;
|
|
113
48
|
};
|
|
@@ -208,7 +143,7 @@ const InsertMenu = ({
|
|
|
208
143
|
} : item)) !== null && _pluginInjectionApi$q5 !== void 0 ? _pluginInjectionApi$q5 : [];
|
|
209
144
|
const unfilteredResult = quickInsertDropdownItems.concat(featuredQuickInsertSuggestions);
|
|
210
145
|
// need to filter on the concatenated list so whiteboards are at the top
|
|
211
|
-
result =
|
|
146
|
+
result = filterForPinWhiteboards(unfilteredResult, formatMessage);
|
|
212
147
|
}
|
|
213
148
|
setItemCount(result.length);
|
|
214
149
|
return result;
|
|
@@ -23,10 +23,7 @@ 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 { fg } from '@atlaskit/platform-feature-flags';
|
|
27
26
|
import { N0, N30A, N60A } from '@atlaskit/theme/colors';
|
|
28
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
29
|
-
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
30
27
|
export var DEFAULT_HEIGHT = 560;
|
|
31
28
|
|
|
32
29
|
/**
|
|
@@ -35,98 +32,29 @@ export var DEFAULT_HEIGHT = 560;
|
|
|
35
32
|
method that can be used to get suggestions -> once all experiments are cleaned up,
|
|
36
33
|
they should be unified through `pluginInjectionApi?.quickInsert?.actions.getSuggestions`
|
|
37
34
|
*/
|
|
38
|
-
export var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
var index = items.findIndex(function (item) {
|
|
55
|
-
return item.title === title;
|
|
56
|
-
});
|
|
57
|
-
var filteredList = items.filter(function (item) {
|
|
58
|
-
return ![DIAGRAM_TITLE, BLANK_TITLE].includes(item.title);
|
|
59
|
-
});
|
|
60
|
-
if (index === -1) {
|
|
61
|
-
return filteredList;
|
|
62
|
-
}
|
|
63
|
-
var featuredItem = _objectSpread({}, items[index]);
|
|
64
|
-
featuredItem.description = formatMessage(messages.featuredWhiteboardDescription);
|
|
65
|
-
return [featuredItem].concat(_toConsumableArray(filteredList));
|
|
66
|
-
};
|
|
67
|
-
return pinWhiteboardActionToTop(featuredItems, DIAGRAM_TITLE);
|
|
68
|
-
} else {
|
|
69
|
-
if (fg('confluence-whiteboards-quick-insert-l10n-eligible')) {
|
|
70
|
-
// Fire exposure for confluence_whiteboards_quick_insert_localised_aa
|
|
71
|
-
// https://switcheroo.atlassian.com/ui/gates/ccd80d32-28a1-4dcf-b3f9-dbdc02a046ff/key/confluence_whiteboards_quick_insert_localised_aa
|
|
72
|
-
expVal('confluence_whiteboards_quick_insert_localised_aa', 'cohort', 'test_diagram');
|
|
73
|
-
|
|
74
|
-
/** BEGIN locale agnostic path */
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* EXTREMELY IMPORTANT: we must not drop diagram for those who already receive
|
|
78
|
-
* the 'insert diagram to the top' treatment.
|
|
79
|
-
*
|
|
80
|
-
* Our heuristic to check that this is only targeting users where they haven't
|
|
81
|
-
* gotten the experience, is if we _cannot_ find the blank board experience in
|
|
82
|
-
* the list, matching purely on title.
|
|
83
|
-
*
|
|
84
|
-
* e.g. `featuredWhiteboardsPresent` = false, given it matches on title.
|
|
85
|
-
*
|
|
86
|
-
* The side-effect of this, is that there's a small chance/edge case of users
|
|
87
|
-
* who toggle between locales, and receive different experiences.
|
|
88
|
-
*
|
|
89
|
-
* Hopefully we can make a call early on this experiment, and eliminate this
|
|
90
|
-
* code path.
|
|
91
|
-
*/
|
|
92
|
-
var WHITEBOARD_KEY = 'whiteboard-extension:create-whiteboard';
|
|
93
|
-
var DIAGRAM_KEY = 'whiteboard-extension:create-diagram';
|
|
94
|
-
var isBlank = function isBlank(item) {
|
|
95
|
-
return item.key === WHITEBOARD_KEY;
|
|
96
|
-
};
|
|
97
|
-
var isDiagram = function isDiagram(item) {
|
|
98
|
-
return item.key === DIAGRAM_KEY;
|
|
99
|
-
};
|
|
100
|
-
var hasBoth = featuredItems.some(isBlank) && featuredItems.some(isDiagram);
|
|
101
|
-
if (hasBoth) {
|
|
102
|
-
var pin = function pin(key) {
|
|
103
|
-
var idx = featuredItems.findIndex(function (item) {
|
|
104
|
-
return item.key === key;
|
|
105
|
-
});
|
|
106
|
-
var filtered = featuredItems.filter(function (item) {
|
|
107
|
-
return !isBlank(item) && !isDiagram(item);
|
|
108
|
-
});
|
|
109
|
-
if (idx === -1) {
|
|
110
|
-
return filtered;
|
|
111
|
-
}
|
|
112
|
-
var picked = _objectSpread(_objectSpread({}, featuredItems[idx]), {}, {
|
|
113
|
-
description: formatMessage(messages.featuredWhiteboardDescription)
|
|
114
|
-
});
|
|
115
|
-
return [picked].concat(_toConsumableArray(filtered));
|
|
116
|
-
};
|
|
117
|
-
if (expValEquals('confluence_whiteboards_quick_insert_localised', 'cohort', 'test_blank')) {
|
|
118
|
-
return pin(WHITEBOARD_KEY);
|
|
119
|
-
}
|
|
120
|
-
if (expValEquals('confluence_whiteboards_quick_insert_localised', 'cohort', 'test_diagram')) {
|
|
121
|
-
return pin(DIAGRAM_KEY);
|
|
122
|
-
}
|
|
123
|
-
if (expValEquals('confluence_whiteboards_quick_insert_localised', 'cohort', 'control')) {
|
|
124
|
-
return featuredItems;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
35
|
+
export var filterForPinWhiteboards = function filterForPinWhiteboards(featuredItems, formatMessage) {
|
|
36
|
+
var DIAGRAM_KEY = 'whiteboard-extension:create-diagram';
|
|
37
|
+
var isDiagram = function isDiagram(item) {
|
|
38
|
+
return item.key === DIAGRAM_KEY;
|
|
39
|
+
};
|
|
40
|
+
var featuredWhiteboardsPresent = featuredItems.some(isDiagram);
|
|
41
|
+
if (featuredWhiteboardsPresent) {
|
|
42
|
+
var pin = function pin(key) {
|
|
43
|
+
var idx = featuredItems.findIndex(function (item) {
|
|
44
|
+
return item.key === key;
|
|
45
|
+
});
|
|
46
|
+
var filtered = featuredItems.filter(function (item) {
|
|
47
|
+
return !isDiagram(item);
|
|
48
|
+
});
|
|
49
|
+
if (idx === -1) {
|
|
50
|
+
return filtered;
|
|
127
51
|
}
|
|
128
|
-
|
|
129
|
-
|
|
52
|
+
var picked = _objectSpread(_objectSpread({}, featuredItems[idx]), {}, {
|
|
53
|
+
description: formatMessage(messages.featuredWhiteboardDescription)
|
|
54
|
+
});
|
|
55
|
+
return [picked].concat(_toConsumableArray(filtered));
|
|
56
|
+
};
|
|
57
|
+
return pin(DIAGRAM_KEY);
|
|
130
58
|
}
|
|
131
59
|
return featuredItems;
|
|
132
60
|
};
|
|
@@ -240,7 +168,7 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
240
168
|
})) !== null && _pluginInjectionApi$q4 !== void 0 ? _pluginInjectionApi$q4 : [];
|
|
241
169
|
var unfilteredResult = quickInsertDropdownItems.concat(featuredQuickInsertSuggestions);
|
|
242
170
|
// need to filter on the concatenated list so whiteboards are at the top
|
|
243
|
-
result =
|
|
171
|
+
result = filterForPinWhiteboards(unfilteredResult, formatMessage);
|
|
244
172
|
}
|
|
245
173
|
setItemCount(result.length);
|
|
246
174
|
return result;
|
|
@@ -9,6 +9,6 @@ export declare const DEFAULT_HEIGHT = 560;
|
|
|
9
9
|
method that can be used to get suggestions -> once all experiments are cleaned up,
|
|
10
10
|
they should be unified through `pluginInjectionApi?.quickInsert?.actions.getSuggestions`
|
|
11
11
|
*/
|
|
12
|
-
export declare const
|
|
12
|
+
export declare const filterForPinWhiteboards: (featuredItems: QuickInsertItem[], formatMessage: (msg: MessageDescriptor) => string) => QuickInsertItem[];
|
|
13
13
|
declare const InsertMenu: ({ editorView, dropdownItems, showElementBrowserLink, onInsert, toggleVisiblity, pluginInjectionApi, }: InsertMenuProps) => jsx.JSX.Element;
|
|
14
14
|
export default InsertMenu;
|
|
@@ -9,6 +9,6 @@ export declare const DEFAULT_HEIGHT = 560;
|
|
|
9
9
|
method that can be used to get suggestions -> once all experiments are cleaned up,
|
|
10
10
|
they should be unified through `pluginInjectionApi?.quickInsert?.actions.getSuggestions`
|
|
11
11
|
*/
|
|
12
|
-
export declare const
|
|
12
|
+
export declare const filterForPinWhiteboards: (featuredItems: QuickInsertItem[], formatMessage: (msg: MessageDescriptor) => string) => QuickInsertItem[];
|
|
13
13
|
declare const InsertMenu: ({ editorView, dropdownItems, showElementBrowserLink, onInsert, toggleVisiblity, pluginInjectionApi, }: InsertMenuProps) => jsx.JSX.Element;
|
|
14
14
|
export default InsertMenu;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-insert-block",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.0",
|
|
4
4
|
"description": "Insert block plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@atlaskit/icon-lab": "^5.15.0",
|
|
65
65
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
66
66
|
"@atlaskit/theme": "^21.0.0",
|
|
67
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
67
|
+
"@atlaskit/tmp-editor-statsig": "^21.0.0",
|
|
68
68
|
"@atlaskit/tokens": "^11.0.0",
|
|
69
69
|
"@babel/runtime": "^7.0.0",
|
|
70
70
|
"@emotion/react": "^11.7.1",
|
|
@@ -126,12 +126,6 @@
|
|
|
126
126
|
"platform_editor_ease_of_use_metrics": {
|
|
127
127
|
"type": "boolean"
|
|
128
128
|
},
|
|
129
|
-
"confluence-whiteboards-quick-insert-eligible": {
|
|
130
|
-
"type": "boolean"
|
|
131
|
-
},
|
|
132
|
-
"confluence-whiteboards-quick-insert-l10n-eligible": {
|
|
133
|
-
"type": "boolean"
|
|
134
|
-
},
|
|
135
129
|
"platform_editor_toolbar_aifc_undo_redo_confluence": {
|
|
136
130
|
"type": "boolean"
|
|
137
131
|
},
|