@atlaskit/editor-core 149.0.1 → 150.0.2
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 +41 -0
- package/dist/cjs/create-editor/create-plugins-list.js +2 -1
- package/dist/cjs/i18n/cs.js +18 -2
- package/dist/cjs/i18n/da.js +18 -2
- package/dist/cjs/i18n/de.js +18 -2
- package/dist/cjs/i18n/es.js +13 -2
- package/dist/cjs/i18n/et.js +0 -1
- package/dist/cjs/i18n/fi.js +13 -2
- package/dist/cjs/i18n/fr.js +13 -2
- package/dist/cjs/i18n/hu.js +14 -3
- package/dist/cjs/i18n/it.js +18 -2
- package/dist/cjs/i18n/ja.js +13 -2
- package/dist/cjs/i18n/ko.js +13 -2
- package/dist/cjs/i18n/nb.js +13 -2
- package/dist/cjs/i18n/nl.js +18 -2
- package/dist/cjs/i18n/pl.js +16 -2
- package/dist/cjs/i18n/pt_BR.js +14 -3
- package/dist/cjs/i18n/pt_PT.js +0 -1
- package/dist/cjs/i18n/ru.js +13 -2
- package/dist/cjs/i18n/sk.js +0 -1
- package/dist/cjs/i18n/sv.js +18 -2
- package/dist/cjs/i18n/th.js +18 -2
- package/dist/cjs/i18n/tr.js +16 -2
- package/dist/cjs/i18n/uk.js +18 -2
- package/dist/cjs/i18n/vi.js +13 -2
- package/dist/cjs/i18n/zh.js +18 -2
- package/dist/cjs/i18n/zh_TW.js +18 -2
- package/dist/cjs/messages.js +4 -4
- package/dist/cjs/plugins/analytics/types/enums.js +0 -1
- package/dist/cjs/plugins/analytics/types/node-events.js +1 -0
- package/dist/cjs/plugins/collab-edit/ui/to-avatar.js +4 -8
- package/dist/cjs/plugins/floating-toolbar/ui/{EditorHideEmojiIcon.js → EditorRemoveEmojiIcon.js} +2 -2
- package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +5 -2
- package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +14 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +19 -22
- package/dist/cjs/plugins/layout/actions.js +70 -16
- package/dist/cjs/plugins/layout/index.js +3 -2
- package/dist/cjs/plugins/layout/pm-plugins/main.js +3 -1
- package/dist/cjs/plugins/layout/toolbar-messages.js +5 -0
- package/dist/cjs/plugins/layout/toolbar.js +11 -2
- package/dist/cjs/plugins/list/pm-plugins/main.js +0 -38
- package/dist/cjs/plugins/mentions/analytics.js +2 -3
- package/dist/cjs/plugins/mentions/type-ahead/index.js +7 -12
- package/dist/cjs/plugins/panel/nodeviews/panel.js +7 -3
- package/dist/cjs/plugins/panel/toolbar.js +8 -6
- package/dist/cjs/plugins/panel/toolbar.test.js +25 -11
- package/dist/cjs/plugins/table/commands/insert.js +25 -10
- package/dist/cjs/plugins/table/commands/misc.js +3 -3
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +5 -4
- package/dist/cjs/plugins/table/nodeviews/tableCell.js +20 -6
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +3 -1
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +1 -0
- package/dist/cjs/plugins/table/toolbar.js +4 -4
- package/dist/cjs/plugins/table/transforms/column-width.js +72 -12
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +1 -1
- package/dist/cjs/plugins/table/utils/table.js +17 -2
- package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +3 -7
- package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +1 -3
- package/dist/cjs/ui/ColorPickerButton/index.js +5 -2
- package/dist/cjs/ui/ColorPickerButton/index.test.js +16 -0
- package/dist/cjs/ui/ConfigPanel/Fields/Expand.js +2 -4
- package/dist/cjs/ui/ConfigPanel/Fields/Fieldset.js +1 -3
- package/dist/cjs/ui/ConfigPanel/NestedForms/RemovableField.js +1 -3
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/create-plugins-list.js +2 -1
- package/dist/es2019/i18n/cs.js +18 -2
- package/dist/es2019/i18n/da.js +18 -2
- package/dist/es2019/i18n/de.js +18 -2
- package/dist/es2019/i18n/es.js +13 -2
- package/dist/es2019/i18n/et.js +0 -1
- package/dist/es2019/i18n/fi.js +13 -2
- package/dist/es2019/i18n/fr.js +13 -2
- package/dist/es2019/i18n/hu.js +14 -3
- package/dist/es2019/i18n/it.js +18 -2
- package/dist/es2019/i18n/ja.js +13 -2
- package/dist/es2019/i18n/ko.js +13 -2
- package/dist/es2019/i18n/nb.js +13 -2
- package/dist/es2019/i18n/nl.js +18 -2
- package/dist/es2019/i18n/pl.js +16 -2
- package/dist/es2019/i18n/pt_BR.js +14 -3
- package/dist/es2019/i18n/pt_PT.js +0 -1
- package/dist/es2019/i18n/ru.js +13 -2
- package/dist/es2019/i18n/sk.js +0 -1
- package/dist/es2019/i18n/sv.js +18 -2
- package/dist/es2019/i18n/th.js +18 -2
- package/dist/es2019/i18n/tr.js +16 -2
- package/dist/es2019/i18n/uk.js +18 -2
- package/dist/es2019/i18n/vi.js +13 -2
- package/dist/es2019/i18n/zh.js +18 -2
- package/dist/es2019/i18n/zh_TW.js +18 -2
- package/dist/es2019/messages.js +4 -4
- package/dist/es2019/plugins/analytics/types/enums.js +0 -1
- package/dist/es2019/plugins/analytics/types/node-events.js +1 -0
- package/dist/es2019/plugins/collab-edit/ui/to-avatar.js +2 -6
- package/dist/es2019/plugins/floating-toolbar/ui/{EditorHideEmojiIcon.js → EditorRemoveEmojiIcon.js} +1 -1
- package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +5 -3
- package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +14 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +20 -23
- package/dist/es2019/plugins/layout/actions.js +64 -13
- package/dist/es2019/plugins/layout/index.js +3 -2
- package/dist/es2019/plugins/layout/pm-plugins/main.js +3 -1
- package/dist/es2019/plugins/layout/toolbar-messages.js +5 -0
- package/dist/es2019/plugins/layout/toolbar.js +10 -2
- package/dist/es2019/plugins/list/pm-plugins/main.js +1 -41
- package/dist/es2019/plugins/mentions/analytics.js +2 -3
- package/dist/es2019/plugins/mentions/type-ahead/index.js +9 -15
- package/dist/es2019/plugins/panel/nodeviews/panel.js +5 -3
- package/dist/es2019/plugins/panel/toolbar.js +8 -6
- package/dist/es2019/plugins/panel/toolbar.test.js +18 -8
- package/dist/es2019/plugins/table/commands/insert.js +27 -12
- package/dist/es2019/plugins/table/commands/misc.js +3 -3
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +5 -4
- package/dist/es2019/plugins/table/nodeviews/tableCell.js +19 -6
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +1 -2
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +1 -1
- package/dist/es2019/plugins/table/toolbar.js +4 -4
- package/dist/es2019/plugins/table/transforms/column-width.js +62 -11
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +1 -1
- package/dist/es2019/plugins/table/utils/table.js +7 -1
- package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +3 -7
- package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +1 -2
- package/dist/es2019/ui/ColorPickerButton/index.js +6 -3
- package/dist/es2019/ui/ColorPickerButton/index.test.js +15 -0
- package/dist/es2019/ui/ConfigPanel/Fields/Expand.js +3 -4
- package/dist/es2019/ui/ConfigPanel/Fields/Fieldset.js +2 -3
- package/dist/es2019/ui/ConfigPanel/NestedForms/RemovableField.js +1 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/create-plugins-list.js +2 -1
- package/dist/esm/i18n/cs.js +18 -2
- package/dist/esm/i18n/da.js +18 -2
- package/dist/esm/i18n/de.js +18 -2
- package/dist/esm/i18n/es.js +13 -2
- package/dist/esm/i18n/et.js +0 -1
- package/dist/esm/i18n/fi.js +13 -2
- package/dist/esm/i18n/fr.js +13 -2
- package/dist/esm/i18n/hu.js +14 -3
- package/dist/esm/i18n/it.js +18 -2
- package/dist/esm/i18n/ja.js +13 -2
- package/dist/esm/i18n/ko.js +13 -2
- package/dist/esm/i18n/nb.js +13 -2
- package/dist/esm/i18n/nl.js +18 -2
- package/dist/esm/i18n/pl.js +16 -2
- package/dist/esm/i18n/pt_BR.js +14 -3
- package/dist/esm/i18n/pt_PT.js +0 -1
- package/dist/esm/i18n/ru.js +13 -2
- package/dist/esm/i18n/sk.js +0 -1
- package/dist/esm/i18n/sv.js +18 -2
- package/dist/esm/i18n/th.js +18 -2
- package/dist/esm/i18n/tr.js +16 -2
- package/dist/esm/i18n/uk.js +18 -2
- package/dist/esm/i18n/vi.js +13 -2
- package/dist/esm/i18n/zh.js +18 -2
- package/dist/esm/i18n/zh_TW.js +18 -2
- package/dist/esm/messages.js +4 -4
- package/dist/esm/plugins/analytics/types/enums.js +0 -1
- package/dist/esm/plugins/analytics/types/node-events.js +1 -0
- package/dist/esm/plugins/collab-edit/ui/to-avatar.js +4 -8
- package/dist/esm/plugins/floating-toolbar/ui/{EditorHideEmojiIcon.js → EditorRemoveEmojiIcon.js} +1 -1
- package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +6 -3
- package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +14 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +20 -23
- package/dist/esm/plugins/layout/actions.js +66 -13
- package/dist/esm/plugins/layout/index.js +3 -2
- package/dist/esm/plugins/layout/pm-plugins/main.js +3 -1
- package/dist/esm/plugins/layout/toolbar-messages.js +5 -0
- package/dist/esm/plugins/layout/toolbar.js +10 -2
- package/dist/esm/plugins/list/pm-plugins/main.js +1 -37
- package/dist/esm/plugins/mentions/analytics.js +2 -3
- package/dist/esm/plugins/mentions/type-ahead/index.js +7 -12
- package/dist/esm/plugins/panel/nodeviews/panel.js +5 -3
- package/dist/esm/plugins/panel/toolbar.js +8 -6
- package/dist/esm/plugins/panel/toolbar.test.js +25 -11
- package/dist/esm/plugins/table/commands/insert.js +26 -11
- package/dist/esm/plugins/table/commands/misc.js +3 -3
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +5 -4
- package/dist/esm/plugins/table/nodeviews/tableCell.js +21 -7
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +1 -2
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +1 -1
- package/dist/esm/plugins/table/toolbar.js +4 -4
- package/dist/esm/plugins/table/transforms/column-width.js +62 -10
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
- package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +1 -1
- package/dist/esm/plugins/table/utils/table.js +9 -0
- package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +3 -7
- package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
- package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +1 -2
- package/dist/esm/ui/ColorPickerButton/index.js +6 -3
- package/dist/esm/ui/ColorPickerButton/index.test.js +15 -0
- package/dist/esm/ui/ConfigPanel/Fields/Expand.js +2 -3
- package/dist/esm/ui/ConfigPanel/Fields/Fieldset.js +1 -2
- package/dist/esm/ui/ConfigPanel/NestedForms/RemovableField.js +1 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/editor.d.ts +1 -1
- package/dist/types/i18n/cs.d.ts +16 -0
- package/dist/types/i18n/da.d.ts +16 -0
- package/dist/types/i18n/de.d.ts +16 -0
- package/dist/types/i18n/es.d.ts +11 -0
- package/dist/types/i18n/et.d.ts +0 -1
- package/dist/types/i18n/fi.d.ts +11 -0
- package/dist/types/i18n/fr.d.ts +11 -0
- package/dist/types/i18n/hu.d.ts +11 -0
- package/dist/types/i18n/it.d.ts +16 -0
- package/dist/types/i18n/ja.d.ts +11 -0
- package/dist/types/i18n/ko.d.ts +11 -0
- package/dist/types/i18n/nb.d.ts +11 -0
- package/dist/types/i18n/nl.d.ts +16 -0
- package/dist/types/i18n/pl.d.ts +14 -0
- package/dist/types/i18n/pt_BR.d.ts +11 -0
- package/dist/types/i18n/pt_PT.d.ts +0 -1
- package/dist/types/i18n/ru.d.ts +11 -0
- package/dist/types/i18n/sk.d.ts +0 -1
- package/dist/types/i18n/sv.d.ts +16 -0
- package/dist/types/i18n/th.d.ts +16 -0
- package/dist/types/i18n/tr.d.ts +14 -0
- package/dist/types/i18n/uk.d.ts +16 -0
- package/dist/types/i18n/vi.d.ts +11 -0
- package/dist/types/i18n/zh.d.ts +16 -0
- package/dist/types/i18n/zh_TW.d.ts +16 -0
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/plugins/analytics/analytics-queue.d.ts +1 -1
- package/dist/types/plugins/analytics/types/enums.d.ts +0 -1
- package/dist/types/plugins/analytics/types/general-events.d.ts +1 -1
- package/dist/types/plugins/analytics/types/list-events.d.ts +1 -5
- package/dist/types/plugins/analytics/types/node-events.d.ts +1 -0
- package/dist/types/plugins/collab-edit/ui/to-avatar.d.ts +1 -1
- package/dist/types/plugins/extension/ui/Extension/ExtensionComponent.d.ts +2 -2
- package/dist/types/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +1 -1
- package/dist/types/plugins/layout/actions.d.ts +1 -0
- package/dist/types/plugins/layout/pm-plugins/types.d.ts +1 -0
- package/dist/types/plugins/layout/toolbar-messages.d.ts +5 -0
- package/dist/types/plugins/layout/toolbar.d.ts +1 -1
- package/dist/types/plugins/layout/types.d.ts +2 -1
- package/dist/types/plugins/mentions/analytics.d.ts +1 -1
- package/dist/types/plugins/quick-insert/index.d.ts +1 -1
- package/dist/types/plugins/table/nodeviews/tableCell.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +2 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +1 -0
- package/dist/types/plugins/table/transforms/column-width.d.ts +10 -0
- package/dist/types/plugins/table/utils/table.d.ts +2 -0
- package/dist/types/ui/ConfigPanel/Fields/Expand.d.ts +1 -1
- package/package.json +22 -22
- package/dist/types/plugins/floating-toolbar/ui/EditorHideEmojiIcon.d.ts +0 -1
package/dist/esm/messages.js
CHANGED
|
@@ -89,10 +89,10 @@ export default defineMessages({
|
|
|
89
89
|
defaultMessage: 'Remove',
|
|
90
90
|
description: 'Delete the element (image, panel, table, etc.) from your document'
|
|
91
91
|
},
|
|
92
|
-
|
|
93
|
-
id: 'fabric.editor.
|
|
94
|
-
defaultMessage: '
|
|
95
|
-
description: '
|
|
92
|
+
removeEmoji: {
|
|
93
|
+
id: 'fabric.editor.removeEmoji',
|
|
94
|
+
defaultMessage: 'Remove emoji',
|
|
95
|
+
description: 'Remove the emoji panel icon from custom panel'
|
|
96
96
|
},
|
|
97
97
|
visit: {
|
|
98
98
|
id: 'fabric.editor.visit',
|
|
@@ -90,7 +90,6 @@ export var ACTION;
|
|
|
90
90
|
ACTION["VIEWED"] = "viewed";
|
|
91
91
|
ACTION["VISITED"] = "visited";
|
|
92
92
|
ACTION["WITH_PLUGIN_STATE_CALLED"] = "withPluginStateCalled";
|
|
93
|
-
ACTION["FIXED"] = "fixed";
|
|
94
93
|
ACTION["RENDERED"] = "rendered";
|
|
95
94
|
ACTION["ON_EDITOR_READY_CALLBACK"] = "onEditorReadyCallback";
|
|
96
95
|
ACTION["ON_CHANGE_CALLBACK"] = "onChangeCalled";
|
|
@@ -15,16 +15,12 @@ var toAvatar = function toAvatar(participant) {
|
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
export default memoizeOne(toAvatar, function participantEquals(_ref, _ref2) {
|
|
19
19
|
var _ref3 = _slicedToArray(_ref, 1),
|
|
20
|
-
|
|
20
|
+
a = _ref3[0];
|
|
21
21
|
|
|
22
22
|
var _ref4 = _slicedToArray(_ref2, 1),
|
|
23
|
-
|
|
23
|
+
b = _ref4[0];
|
|
24
24
|
|
|
25
|
-
var a = aRaw;
|
|
26
|
-
var b = bRaw;
|
|
27
25
|
return a.name === b.name && a.avatar === b.avatar && a.sessionId === b.sessionId;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export default memoizeOne(toAvatar, participantEquals);
|
|
26
|
+
});
|
|
@@ -6,7 +6,7 @@ var _templateObject;
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import Button from '@atlaskit/button';
|
|
9
|
-
import { Popup, WithProviders } from '@atlaskit/editor-common';
|
|
9
|
+
import { Popup, withOuterListeners, WithProviders } from '@atlaskit/editor-common';
|
|
10
10
|
import { EmojiPicker } from '@atlaskit/emoji';
|
|
11
11
|
import Tooltip from '@atlaskit/tooltip';
|
|
12
12
|
import EditorEmojiAddIcon from './EditorEmojiAddIcon'; // helps adjusts position of popup
|
|
@@ -20,6 +20,8 @@ export var EmojiPickerButton = function EmojiPickerButton(props) {
|
|
|
20
20
|
isPopupOpen = _React$useState2[0],
|
|
21
21
|
setIsPopupOpen = _React$useState2[1];
|
|
22
22
|
|
|
23
|
+
var EmojiPickerWithListener = withOuterListeners(EmojiPicker);
|
|
24
|
+
|
|
23
25
|
var togglePopup = function togglePopup() {
|
|
24
26
|
setIsPopupOpen(!isPopupOpen);
|
|
25
27
|
};
|
|
@@ -34,10 +36,11 @@ export var EmojiPickerButton = function EmojiPickerButton(props) {
|
|
|
34
36
|
return null;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
return /*#__PURE__*/React.createElement(
|
|
39
|
+
return /*#__PURE__*/React.createElement(EmojiPickerWithListener, {
|
|
38
40
|
emojiProvider: providers.emojiProvider,
|
|
39
41
|
onSelection: updateEmoji,
|
|
40
|
-
onPickerRef: function onPickerRef() {}
|
|
42
|
+
onPickerRef: function onPickerRef() {},
|
|
43
|
+
handleClickOutside: togglePopup
|
|
41
44
|
});
|
|
42
45
|
};
|
|
43
46
|
|
|
@@ -48,6 +48,20 @@ describe('emoji-picker-button', function () {
|
|
|
48
48
|
|
|
49
49
|
expect(wrapper.find('Popup')).toHaveLength(1);
|
|
50
50
|
});
|
|
51
|
+
it('should close EmojiPicker popup after clicking outside', function () {
|
|
52
|
+
// clicking on the button to open the popup
|
|
53
|
+
wrapper.find('button').simulate('click'); // make sure the popup and picker are shown
|
|
54
|
+
|
|
55
|
+
expect(wrapper.find('Popup')).toHaveLength(1);
|
|
56
|
+
var emojiPicker = wrapper.find('EmojiPickerInternal').instance(); // calling click outside
|
|
57
|
+
|
|
58
|
+
act(function () {
|
|
59
|
+
emojiPicker.props.handleClickOutside();
|
|
60
|
+
});
|
|
61
|
+
wrapper.update(); // make sure popup is hidden
|
|
62
|
+
|
|
63
|
+
expect(wrapper.find('Popup')).toHaveLength(0);
|
|
64
|
+
});
|
|
51
65
|
it('should hide popup and call onChange after selecting an emoji', function () {
|
|
52
66
|
// click the button
|
|
53
67
|
wrapper.find('button').simulate('click'); // make sure the popup and picker are shown
|
|
@@ -38,6 +38,7 @@ import { messages } from './messages';
|
|
|
38
38
|
import { createItems } from './create-items';
|
|
39
39
|
import { BlockInsertMenu } from './block-insert-menu';
|
|
40
40
|
import { insertHorizontalRule } from '../../../rule/commands';
|
|
41
|
+
import withOuterListeners from '../../../../ui/with-outer-listeners';
|
|
41
42
|
/**
|
|
42
43
|
* Checks if an element is detached (i.e. not in the current document)
|
|
43
44
|
*/
|
|
@@ -48,6 +49,8 @@ var isDetachedElement = function isDetachedElement(el) {
|
|
|
48
49
|
|
|
49
50
|
var noop = function noop() {};
|
|
50
51
|
|
|
52
|
+
var EmojiPickerWithListeners = withOuterListeners(AkEmojiPicker);
|
|
53
|
+
|
|
51
54
|
var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
52
55
|
_inherits(ToolbarInsertBlock, _React$PureComponent);
|
|
53
56
|
|
|
@@ -140,6 +143,20 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
140
143
|
});
|
|
141
144
|
});
|
|
142
145
|
|
|
146
|
+
_defineProperty(_assertThisInitialized(_this), "handleEmojiPressEscape", function () {
|
|
147
|
+
_this.toggleEmojiPicker(INPUT_METHOD.KEYBOARD);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
_defineProperty(_assertThisInitialized(_this), "handleEmojiClickOutside", function (e) {
|
|
151
|
+
// Ignore click events for detached elements.
|
|
152
|
+
// Workaround for FS-1322 - where two onClicks fire - one when the upload button is
|
|
153
|
+
// still in the document, and one once it's detached. Does not always occur, and
|
|
154
|
+
// may be a side effect of a react render optimisation
|
|
155
|
+
if (e.target && !isDetachedElement(e.target)) {
|
|
156
|
+
_this.toggleEmojiPicker(INPUT_METHOD.TOOLBAR);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
|
|
143
160
|
_defineProperty(_assertThisInitialized(_this), "handleEmojiButtonRef", function (button) {
|
|
144
161
|
var ref = ReactDOM.findDOMNode(button);
|
|
145
162
|
|
|
@@ -164,27 +181,6 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
164
181
|
}
|
|
165
182
|
});
|
|
166
183
|
|
|
167
|
-
_defineProperty(_assertThisInitialized(_this), "onPickerRef", function (ref) {
|
|
168
|
-
if (ref) {
|
|
169
|
-
document.addEventListener('click', _this.handleClickOutside);
|
|
170
|
-
} else {
|
|
171
|
-
document.removeEventListener('click', _this.handleClickOutside);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
_this.pickerRef = ref;
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
_defineProperty(_assertThisInitialized(_this), "handleClickOutside", function (e) {
|
|
178
|
-
var picker = _this.pickerRef && ReactDOM.findDOMNode(_this.pickerRef); // Ignore click events for detached elements.
|
|
179
|
-
// Workaround for FS-1322 - where two onClicks fire - one when the upload button is
|
|
180
|
-
// still in the document, and one once it's detached. Does not always occur, and
|
|
181
|
-
// may be a side effect of a react render optimisation
|
|
182
|
-
|
|
183
|
-
if (!picker || e.target && !isDetachedElement(e.target) && !picker.contains(e.target)) {
|
|
184
|
-
_this.toggleEmojiPicker();
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
|
|
188
184
|
_defineProperty(_assertThisInitialized(_this), "toggleLinkPanel", function (inputMethod) {
|
|
189
185
|
var editorView = _this.props.editorView;
|
|
190
186
|
showLinkToolbar(inputMethod)(editorView.state, editorView.dispatch);
|
|
@@ -489,10 +485,11 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
489
485
|
mountTo: popupsMountPoint,
|
|
490
486
|
boundariesElement: popupsBoundariesElement,
|
|
491
487
|
scrollableElement: popupsScrollableElement
|
|
492
|
-
}, /*#__PURE__*/React.createElement(
|
|
488
|
+
}, /*#__PURE__*/React.createElement(EmojiPickerWithListeners, {
|
|
493
489
|
emojiProvider: emojiProvider,
|
|
494
490
|
onSelection: this.handleSelectedEmoji,
|
|
495
|
-
|
|
491
|
+
handleClickOutside: this.handleEmojiClickOutside,
|
|
492
|
+
handleEscapeKeydown: this.handleEmojiPressEscape
|
|
496
493
|
}));
|
|
497
494
|
}
|
|
498
495
|
}, {
|
|
@@ -13,11 +13,15 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../analyt
|
|
|
13
13
|
import { addAnalytics, withAnalytics } from '../analytics/utils';
|
|
14
14
|
import { LAYOUT_TYPE } from '../analytics/types/node-events';
|
|
15
15
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
16
|
+
export var ONE_COL_LAYOUTS = ['single'];
|
|
16
17
|
export var TWO_COL_LAYOUTS = ['two_equal', 'two_left_sidebar', 'two_right_sidebar'];
|
|
17
18
|
export var THREE_COL_LAYOUTS = ['three_equal', 'three_with_sidebars'];
|
|
18
19
|
|
|
19
20
|
var getWidthsForPreset = function getWidthsForPreset(presetLayout) {
|
|
20
21
|
switch (presetLayout) {
|
|
22
|
+
case 'single':
|
|
23
|
+
return [100];
|
|
24
|
+
|
|
21
25
|
case 'two_equal':
|
|
22
26
|
return [50, 50];
|
|
23
27
|
|
|
@@ -46,6 +50,9 @@ export var getPresetLayout = function getPresetLayout(section) {
|
|
|
46
50
|
}).join(',');
|
|
47
51
|
|
|
48
52
|
switch (widths) {
|
|
53
|
+
case '100':
|
|
54
|
+
return 'single';
|
|
55
|
+
|
|
49
56
|
case '33.33,33.33,33.33':
|
|
50
57
|
return 'three_equal';
|
|
51
58
|
|
|
@@ -101,6 +108,44 @@ export var insertLayoutColumnsWithAnalytics = function insertLayoutColumnsWithAn
|
|
|
101
108
|
eventType: EVENT_TYPE.TRACK
|
|
102
109
|
})(insertLayoutColumns);
|
|
103
110
|
};
|
|
111
|
+
/**
|
|
112
|
+
* Add a column to the right of existing layout
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
function addColumn(schema, pos) {
|
|
116
|
+
return function (tr) {
|
|
117
|
+
tr.replaceWith(tr.mapping.map(pos), tr.mapping.map(pos), schema.nodes.layoutColumn.createAndFill());
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function removeLastColumnInLayout(column, columnPos, insideRightEdgePos) {
|
|
122
|
+
return function (tr) {
|
|
123
|
+
if (isEmptyDocument(column)) {
|
|
124
|
+
tr.replaceRange(tr.mapping.map(columnPos - 1), tr.mapping.map(insideRightEdgePos), Slice.empty);
|
|
125
|
+
} else {
|
|
126
|
+
tr.replaceRange(tr.mapping.map(columnPos - 1), tr.mapping.map(columnPos + 1), Slice.empty);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
var fromTwoColsToThree = addColumn;
|
|
132
|
+
var fromOneColToTwo = addColumn;
|
|
133
|
+
var fromTwoColsToOne = removeLastColumnInLayout;
|
|
134
|
+
var fromThreeColsToTwo = removeLastColumnInLayout;
|
|
135
|
+
|
|
136
|
+
var fromOneColToThree = function fromOneColToThree(schema, pos) {
|
|
137
|
+
return function (tr) {
|
|
138
|
+
addColumn(schema, pos)(tr);
|
|
139
|
+
addColumn(schema, pos)(tr);
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
var fromThreeColstoOne = function fromThreeColstoOne(node, tr, insideRightEdgePos) {
|
|
144
|
+
var thirdColumn = node.content.child(2);
|
|
145
|
+
fromThreeColsToTwo(thirdColumn, insideRightEdgePos - thirdColumn.nodeSize, insideRightEdgePos)(tr);
|
|
146
|
+
var secondColumn = node.content.child(1);
|
|
147
|
+
fromTwoColsToOne(secondColumn, insideRightEdgePos - thirdColumn.nodeSize - secondColumn.nodeSize, insideRightEdgePos)(tr);
|
|
148
|
+
};
|
|
104
149
|
/**
|
|
105
150
|
* Handles switching from 2 -> 3 cols, or 3 -> 2 cols
|
|
106
151
|
* Switching from 2 -> 3 just adds a new one at the end
|
|
@@ -108,25 +153,30 @@ export var insertLayoutColumnsWithAnalytics = function insertLayoutColumnsWithAn
|
|
|
108
153
|
* removing it
|
|
109
154
|
*/
|
|
110
155
|
|
|
156
|
+
|
|
111
157
|
function forceColumnStructure(state, node, pos, presetLayout) {
|
|
112
158
|
var tr = state.tr;
|
|
113
159
|
var insideRightEdgeOfLayoutSection = pos + node.nodeSize - 1;
|
|
114
|
-
var numCols = node.childCount;
|
|
160
|
+
var numCols = node.childCount; // 3 columns -> 2 columns
|
|
115
161
|
|
|
116
162
|
if (TWO_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 3) {
|
|
117
163
|
var thirdColumn = node.content.child(2);
|
|
118
|
-
var
|
|
119
|
-
|
|
120
|
-
if (isEmptyDocument(thirdColumn)) {
|
|
121
|
-
tr.replaceRange( // end pos of second column
|
|
122
|
-
tr.mapping.map(thirdColumnPos - 1), tr.mapping.map(insideRightEdgeOfLayoutSection), Slice.empty);
|
|
123
|
-
} else {
|
|
124
|
-
tr.replaceRange( // end pos of second column
|
|
125
|
-
tr.mapping.map(thirdColumnPos - 1), // start pos of third column
|
|
126
|
-
tr.mapping.map(thirdColumnPos + 1), Slice.empty);
|
|
127
|
-
}
|
|
164
|
+
var columnPos = insideRightEdgeOfLayoutSection - thirdColumn.nodeSize;
|
|
165
|
+
fromThreeColsToTwo(thirdColumn, columnPos, insideRightEdgeOfLayoutSection)(tr); // 2 columns -> 3 columns
|
|
128
166
|
} else if (THREE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 2) {
|
|
129
|
-
|
|
167
|
+
fromTwoColsToThree(state.schema, insideRightEdgeOfLayoutSection)(tr); // 2 columns -> 1 column
|
|
168
|
+
} else if (ONE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 2) {
|
|
169
|
+
var secondColumn = node.content.child(1);
|
|
170
|
+
|
|
171
|
+
var _columnPos = insideRightEdgeOfLayoutSection - secondColumn.nodeSize;
|
|
172
|
+
|
|
173
|
+
fromTwoColsToOne(secondColumn, _columnPos, insideRightEdgeOfLayoutSection)(tr); // 3 columns -> 1 column
|
|
174
|
+
} else if (ONE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 3) {
|
|
175
|
+
fromThreeColstoOne(node, tr, insideRightEdgeOfLayoutSection); // 1 column -> 2 columns
|
|
176
|
+
} else if (TWO_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 1) {
|
|
177
|
+
fromOneColToTwo(state.schema, insideRightEdgeOfLayoutSection)(tr); // 1 column -> 3 columns
|
|
178
|
+
} else if (THREE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 1) {
|
|
179
|
+
fromOneColToThree(state.schema, insideRightEdgeOfLayoutSection)(tr);
|
|
130
180
|
}
|
|
131
181
|
|
|
132
182
|
return tr;
|
|
@@ -219,7 +269,7 @@ function getLayoutChange(node, pos, schema) {
|
|
|
219
269
|
return;
|
|
220
270
|
}
|
|
221
271
|
|
|
222
|
-
var presetLayout = node.childCount === 2 ? 'two_equal' : 'three_equal';
|
|
272
|
+
var presetLayout = node.childCount === 2 ? 'two_equal' : node.childCount === 3 ? 'three_equal' : 'single';
|
|
223
273
|
var fixedColumns = columnWidth(node, schema, getWidthsForPreset(presetLayout));
|
|
224
274
|
return {
|
|
225
275
|
from: pos + 1,
|
|
@@ -312,6 +362,9 @@ export var deleteActiveLayoutNode = function deleteActiveLayoutNode(state, dispa
|
|
|
312
362
|
|
|
313
363
|
var formatLayoutName = function formatLayoutName(layout) {
|
|
314
364
|
switch (layout) {
|
|
365
|
+
case 'single':
|
|
366
|
+
return LAYOUT_TYPE.SINGLE_COL;
|
|
367
|
+
|
|
315
368
|
case 'two_equal':
|
|
316
369
|
return LAYOUT_TYPE.TWO_COLS_EQUAL;
|
|
317
370
|
|
|
@@ -35,10 +35,11 @@ var layoutPlugin = function layoutPlugin() {
|
|
|
35
35
|
var _ref = pluginKey.getState(state),
|
|
36
36
|
pos = _ref.pos,
|
|
37
37
|
allowBreakout = _ref.allowBreakout,
|
|
38
|
-
addSidebarLayouts = _ref.addSidebarLayouts
|
|
38
|
+
addSidebarLayouts = _ref.addSidebarLayouts,
|
|
39
|
+
allowSingleColumnLayout = _ref.allowSingleColumnLayout;
|
|
39
40
|
|
|
40
41
|
if (pos !== null) {
|
|
41
|
-
return buildToolbar(state, intl, pos, allowBreakout, addSidebarLayouts);
|
|
42
|
+
return buildToolbar(state, intl, pos, allowBreakout, addSidebarLayouts, allowSingleColumnLayout);
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
return undefined;
|
|
@@ -57,13 +57,15 @@ var getInitialPluginState = function getInitialPluginState(options, state) {
|
|
|
57
57
|
var maybeLayoutSection = findParentNodeOfType(state.schema.nodes.layoutSection)(state.selection);
|
|
58
58
|
var allowBreakout = options.allowBreakout || false;
|
|
59
59
|
var addSidebarLayouts = options.UNSAFE_addSidebarLayouts || false;
|
|
60
|
+
var allowSingleColumnLayout = options.UNSAFE_allowSingleColumnLayout || false;
|
|
60
61
|
var pos = maybeLayoutSection ? maybeLayoutSection.pos : null;
|
|
61
62
|
var selectedLayout = getSelectedLayout(maybeLayoutSection && maybeLayoutSection.node, DEFAULT_LAYOUT);
|
|
62
63
|
return {
|
|
63
64
|
pos: pos,
|
|
64
65
|
allowBreakout: allowBreakout,
|
|
65
66
|
addSidebarLayouts: addSidebarLayouts,
|
|
66
|
-
selectedLayout: selectedLayout
|
|
67
|
+
selectedLayout: selectedLayout,
|
|
68
|
+
allowSingleColumnLayout: allowSingleColumnLayout
|
|
67
69
|
};
|
|
68
70
|
};
|
|
69
71
|
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { defineMessages } from 'react-intl';
|
|
2
2
|
export var toolbarMessages = defineMessages({
|
|
3
|
+
singleColumn: {
|
|
4
|
+
id: 'fabric.editor.single',
|
|
5
|
+
defaultMessage: 'Single column',
|
|
6
|
+
description: 'Layout with one single column'
|
|
7
|
+
},
|
|
3
8
|
twoColumns: {
|
|
4
9
|
id: 'fabric.editor.twoColumns',
|
|
5
10
|
defaultMessage: 'Two columns',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { findDomRefAtPos } from 'prosemirror-utils';
|
|
3
|
+
import EditorLayoutSingleIcon from '@atlaskit/icon/glyph/editor/layout-single';
|
|
3
4
|
import LayoutTwoEqualIcon from '@atlaskit/icon/glyph/editor/layout-two-equal';
|
|
4
5
|
import LayoutThreeEqualIcon from '@atlaskit/icon/glyph/editor/layout-three-equal';
|
|
5
6
|
import LayoutTwoLeftSidebarIcon from '@atlaskit/icon/glyph/editor/layout-two-left-sidebar';
|
|
@@ -21,6 +22,12 @@ var LAYOUT_TYPES = [{
|
|
|
21
22
|
title: toolbarMessages.threeColumns,
|
|
22
23
|
icon: LayoutThreeEqualIcon
|
|
23
24
|
}];
|
|
25
|
+
var LAYOUT_TYPES_WITH_SINGLE_COL = [{
|
|
26
|
+
id: 'editor.layout.singeLayout',
|
|
27
|
+
type: 'single',
|
|
28
|
+
title: toolbarMessages.singleColumn,
|
|
29
|
+
icon: EditorLayoutSingleIcon
|
|
30
|
+
}].concat(LAYOUT_TYPES);
|
|
24
31
|
var SIDEBAR_LAYOUT_TYPES = [{
|
|
25
32
|
id: 'editor.layout.twoRightSidebar',
|
|
26
33
|
type: 'two_right_sidebar',
|
|
@@ -51,7 +58,7 @@ var buildLayoutButton = function buildLayoutButton(intl, item, currentLayout) {
|
|
|
51
58
|
};
|
|
52
59
|
|
|
53
60
|
export var layoutToolbarTitle = 'Layout floating controls';
|
|
54
|
-
export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSidebarLayouts) {
|
|
61
|
+
export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSidebarLayouts, allowSingleColumnLayout) {
|
|
55
62
|
var node = state.doc.nodeAt(pos);
|
|
56
63
|
|
|
57
64
|
if (node) {
|
|
@@ -73,13 +80,14 @@ export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout
|
|
|
73
80
|
onFocus: hoverDecoration(nodeType, true),
|
|
74
81
|
onBlur: hoverDecoration(nodeType, false)
|
|
75
82
|
};
|
|
83
|
+
var layoutTypes = allowSingleColumnLayout ? LAYOUT_TYPES_WITH_SINGLE_COL : LAYOUT_TYPES;
|
|
76
84
|
return {
|
|
77
85
|
title: layoutToolbarTitle,
|
|
78
86
|
getDomRef: function getDomRef(view) {
|
|
79
87
|
return findDomRefAtPos(pos, view.domAtPos.bind(view));
|
|
80
88
|
},
|
|
81
89
|
nodeType: nodeType,
|
|
82
|
-
items: [].concat(_toConsumableArray(
|
|
90
|
+
items: [].concat(_toConsumableArray(layoutTypes.map(function (i) {
|
|
83
91
|
return buildLayoutButton(intl, i, currentLayout);
|
|
84
92
|
})), _toConsumableArray(addSidebarLayouts ? SIDEBAR_LAYOUT_TYPES.map(function (i) {
|
|
85
93
|
return buildLayoutButton(intl, i, currentLayout);
|
|
@@ -7,11 +7,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
7
7
|
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
8
8
|
import { DecorationSet, Decoration } from 'prosemirror-view';
|
|
9
9
|
import { findParentNodeOfType } from 'prosemirror-utils';
|
|
10
|
-
import { addAnalytics, ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../../analytics';
|
|
11
10
|
import { isWrappingPossible } from '../utils/selection';
|
|
12
|
-
import { isListNode
|
|
11
|
+
import { isListNode } from '../utils/node';
|
|
13
12
|
import { pluginFactory } from '../../../utils/plugin-state-factory';
|
|
14
|
-
import { findRootParentListNode } from '../utils/find';
|
|
15
13
|
var listPluginKey = new PluginKey('listPlugin');
|
|
16
14
|
export var pluginKey = listPluginKey;
|
|
17
15
|
var initialState = {
|
|
@@ -112,40 +110,6 @@ export var createPlugin = function createPlugin(eventDispatch) {
|
|
|
112
110
|
return new Plugin({
|
|
113
111
|
state: createPluginState(eventDispatch, createInitialState),
|
|
114
112
|
key: listPluginKey,
|
|
115
|
-
appendTransaction: function appendTransaction(transactions, _oldState, newState) {
|
|
116
|
-
var lastTransaction = transactions[transactions.length - 1];
|
|
117
|
-
|
|
118
|
-
if (!lastTransaction.docChanged || !lastTransaction.selectionSet) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
var tr = newState.tr;
|
|
123
|
-
var rootList = findRootParentListNode(tr.selection.$from);
|
|
124
|
-
|
|
125
|
-
if (!rootList) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
var listsJoined = joinSiblingLists({
|
|
130
|
-
tr: tr,
|
|
131
|
-
direction: JoinDirection.RIGHT
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
if (tr.docChanged) {
|
|
135
|
-
var orderedListsJoined = listsJoined.orderedList,
|
|
136
|
-
bulletListsJoined = listsJoined.bulletList;
|
|
137
|
-
addAnalytics(newState, tr, {
|
|
138
|
-
action: ACTION.FIXED,
|
|
139
|
-
actionSubject: ACTION_SUBJECT.LIST,
|
|
140
|
-
eventType: EVENT_TYPE.TRACK,
|
|
141
|
-
attributes: {
|
|
142
|
-
orderedListsJoined: orderedListsJoined,
|
|
143
|
-
bulletListsJoined: bulletListsJoined
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
return tr;
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
113
|
props: {
|
|
150
114
|
decorations: function decorations(state) {
|
|
151
115
|
var _getPluginState = getPluginState(state),
|
|
@@ -81,7 +81,7 @@ export var buildTypeAheadInviteItemViewedPayload = function buildTypeAheadInvite
|
|
|
81
81
|
userRole: userRole
|
|
82
82
|
});
|
|
83
83
|
};
|
|
84
|
-
export var buildTypeAheadInviteExposurePayload = function buildTypeAheadInviteExposurePayload(
|
|
84
|
+
export var buildTypeAheadInviteExposurePayload = function buildTypeAheadInviteExposurePayload(sessionId, contextIdentifierProvider, inviteExperimentCohort, userRole) {
|
|
85
85
|
var _ref2 = contextIdentifierProvider || {},
|
|
86
86
|
containerId = _ref2.containerId,
|
|
87
87
|
objectId = _ref2.objectId,
|
|
@@ -89,8 +89,7 @@ export var buildTypeAheadInviteExposurePayload = function buildTypeAheadInviteEx
|
|
|
89
89
|
|
|
90
90
|
return buildAnalyticsPayload('feature', 'exposed', OPERATIONAL_EVENT_TYPE, sessionId, {
|
|
91
91
|
flagKey: 'confluence.frontend.invite.from.mention',
|
|
92
|
-
value:
|
|
93
|
-
cohort: inviteExperimentCohort,
|
|
92
|
+
value: inviteExperimentCohort || 'not-enrolled',
|
|
94
93
|
containerId: containerId,
|
|
95
94
|
objectId: objectId,
|
|
96
95
|
childObjectId: childObjectId,
|
|
@@ -261,6 +261,13 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
261
261
|
|
|
262
262
|
if (mentions.length === 0 && firstQueryWithoutResults === null) {
|
|
263
263
|
firstQueryWithoutResults = query;
|
|
264
|
+
} // Growth (El-dorado) experiment design hard requirement
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
if (mentionItems.length <= 2) {
|
|
268
|
+
var inviteExperimentCohort = mentionProvider.inviteExperimentCohort,
|
|
269
|
+
userRole = mentionProvider.userRole;
|
|
270
|
+
fireEvent(buildTypeAheadInviteExposurePayload(sessionId, contextIdentifierProvider, inviteExperimentCohort, userRole));
|
|
264
271
|
}
|
|
265
272
|
|
|
266
273
|
if (!mentionProvider.shouldEnableInvite || mentionItems.length > 2) {
|
|
@@ -286,18 +293,6 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
286
293
|
},
|
|
287
294
|
onOpen: function onOpen(editorState) {
|
|
288
295
|
firstQueryWithoutResults = null;
|
|
289
|
-
var pluginState = getMentionPluginState(editorState);
|
|
290
|
-
|
|
291
|
-
if (!pluginState || !pluginState.mentionProvider) {
|
|
292
|
-
return null;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
var contextIdentifierProvider = pluginState.contextIdentifierProvider,
|
|
296
|
-
_pluginState$mentionP = pluginState.mentionProvider,
|
|
297
|
-
shouldEnableInvite = _pluginState$mentionP.shouldEnableInvite,
|
|
298
|
-
inviteExperimentCohort = _pluginState$mentionP.inviteExperimentCohort,
|
|
299
|
-
userRole = _pluginState$mentionP.userRole;
|
|
300
|
-
fireEvent(buildTypeAheadInviteExposurePayload(!!shouldEnableInvite, sessionId, contextIdentifierProvider, inviteExperimentCohort, userRole));
|
|
301
296
|
},
|
|
302
297
|
selectItem: function selectItem(state, item, insert, _ref8) {
|
|
303
298
|
var mode = _ref8.mode,
|
|
@@ -13,7 +13,7 @@ import { PanelType } from '@atlaskit/adf-schema';
|
|
|
13
13
|
import { PanelSharedCssClassName } from '@atlaskit/editor-common';
|
|
14
14
|
import { Emoji } from '@atlaskit/editor-common';
|
|
15
15
|
import { panelAttrsToDom } from '../utils';
|
|
16
|
-
|
|
16
|
+
import { akEditorCustomIconSize } from '@atlaskit/editor-shared-styles/consts';
|
|
17
17
|
export var panelIcons = {
|
|
18
18
|
info: InfoIcon,
|
|
19
19
|
success: SuccessIcon,
|
|
@@ -36,7 +36,7 @@ export var PanelIcon = function PanelIcon(props) {
|
|
|
36
36
|
shortName: panelIcon,
|
|
37
37
|
showTooltip: false,
|
|
38
38
|
allowTextFallback: false,
|
|
39
|
-
fitToHeight:
|
|
39
|
+
fitToHeight: akEditorCustomIconSize
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -66,8 +66,10 @@ var PanelNodeView = /*#__PURE__*/function () {
|
|
|
66
66
|
|
|
67
67
|
if (!this.icon) {
|
|
68
68
|
return;
|
|
69
|
-
}
|
|
69
|
+
} // set contentEditable as false to be able to select the custom panels with keyboard
|
|
70
|
+
|
|
70
71
|
|
|
72
|
+
this.icon.contentEditable = 'false';
|
|
71
73
|
ReactDOM.render( /*#__PURE__*/React.createElement(PanelIcon, {
|
|
72
74
|
allowCustomPanel: pluginOptions.UNSAFE_allowCustomPanel,
|
|
73
75
|
panelAttributes: node.attrs,
|
|
@@ -5,7 +5,7 @@ import NoteIcon from '@atlaskit/icon/glyph/editor/note';
|
|
|
5
5
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
6
6
|
import WarningIcon from '@atlaskit/icon/glyph/editor/warning';
|
|
7
7
|
import ErrorIcon from '@atlaskit/icon/glyph/editor/error';
|
|
8
|
-
import
|
|
8
|
+
import RemoveEmojiIcon from '../floating-toolbar/ui/EditorRemoveEmojiIcon';
|
|
9
9
|
import commonMessages from '../../messages';
|
|
10
10
|
import { removePanel, changePanelType } from './actions';
|
|
11
11
|
import { hoverDecoration } from '../base/pm-plugins/decoration';
|
|
@@ -218,13 +218,15 @@ export var getToolbarItems = function getToolbarItems(formatMessage, panelNodeTy
|
|
|
218
218
|
return changeEmoji(emojiShortName);
|
|
219
219
|
}
|
|
220
220
|
};
|
|
221
|
-
|
|
222
|
-
id: 'editor.panel.
|
|
221
|
+
var removeEmojiButton = {
|
|
222
|
+
id: 'editor.panel.removeEmoji',
|
|
223
223
|
type: 'button',
|
|
224
|
-
icon:
|
|
224
|
+
icon: RemoveEmojiIcon,
|
|
225
225
|
onClick: removeEmoji(),
|
|
226
|
-
title: formatMessage(commonMessages.
|
|
227
|
-
|
|
226
|
+
title: formatMessage(commonMessages.removeEmoji),
|
|
227
|
+
disabled: activePanelIcon ? false : true
|
|
228
|
+
};
|
|
229
|
+
items.push(emojiPicker, removeEmojiButton, {
|
|
228
230
|
type: 'separator'
|
|
229
231
|
}, colorPicker);
|
|
230
232
|
}
|
|
@@ -80,16 +80,16 @@ describe('getToolbarItems', function () {
|
|
|
80
80
|
color: '#ABF5D1'
|
|
81
81
|
}, true);
|
|
82
82
|
});
|
|
83
|
-
it("should call changePanelType when clicked on
|
|
84
|
-
var
|
|
85
|
-
return item.type === 'button' && item.id === 'editor.panel.
|
|
83
|
+
it("should call changePanelType when clicked on remove emoji", function () {
|
|
84
|
+
var removeEmojiButton = itemsWithCustomPanelEnabled.find(function (item) {
|
|
85
|
+
return item.type === 'button' && item.id === 'editor.panel.removeEmoji';
|
|
86
86
|
});
|
|
87
|
-
|
|
87
|
+
removeEmojiButton.onClick(editorView.state);
|
|
88
88
|
expect(changePanelTypespy).toBeCalledWith(PanelType.CUSTOM, {
|
|
89
89
|
emoji: undefined
|
|
90
90
|
}, true);
|
|
91
91
|
});
|
|
92
|
-
it("should not call changePanelType when clicked on
|
|
92
|
+
it("should not call changePanelType when clicked on remove emoji when no emoji in panel", function () {
|
|
93
93
|
var _createEditor2 = createEditor({
|
|
94
94
|
doc: doc(panel({
|
|
95
95
|
panelType: 'custom'
|
|
@@ -100,13 +100,27 @@ describe('getToolbarItems', function () {
|
|
|
100
100
|
editorView = _createEditor2.editorView;
|
|
101
101
|
|
|
102
102
|
var toolbarItems = getToolbarItems(dummyFormatMessage, defaultSchema.nodes.panel, true, providerFactory, PanelType.CUSTOM);
|
|
103
|
-
var
|
|
104
|
-
return item.type === 'button' && item.id === 'editor.panel.
|
|
103
|
+
var removeEmojiButton = toolbarItems.find(function (item) {
|
|
104
|
+
return item.type === 'button' && item.id === 'editor.panel.removeEmoji';
|
|
105
105
|
});
|
|
106
106
|
changePanelTypespy.mockClear();
|
|
107
|
-
|
|
107
|
+
removeEmojiButton.onClick(editorView.state);
|
|
108
108
|
expect(changePanelTypespy).not.toBeCalled();
|
|
109
109
|
});
|
|
110
|
+
it("should have remove emoji button disabled when focus on panel without emoji", function () {
|
|
111
|
+
var toolbarItems = getToolbarItems(dummyFormatMessage, defaultSchema.nodes.panel, true, providerFactory, PanelType.CUSTOM, '#ABF5D1', '');
|
|
112
|
+
var removeEmojiButton = toolbarItems.find(function (item) {
|
|
113
|
+
return item.type === 'button' && item.id === 'editor.panel.removeEmoji';
|
|
114
|
+
});
|
|
115
|
+
expect(removeEmojiButton.disabled).toBe(true);
|
|
116
|
+
});
|
|
117
|
+
it("should have remove emoji button enabled when focus on panel with emoji", function () {
|
|
118
|
+
var toolbarItems = getToolbarItems(dummyFormatMessage, defaultSchema.nodes.panel, true, providerFactory, PanelType.CUSTOM, '#ABF5D1', ':smiley:');
|
|
119
|
+
var removeEmojiButton = toolbarItems.find(function (item) {
|
|
120
|
+
return item.type === 'button' && item.id === 'editor.panel.removeEmoji';
|
|
121
|
+
});
|
|
122
|
+
expect(removeEmojiButton.disabled).toBe(false);
|
|
123
|
+
});
|
|
110
124
|
});
|
|
111
125
|
describe('analytics for custom panels', function () {
|
|
112
126
|
var createEditor = createProsemirrorEditorFactory();
|
|
@@ -169,14 +183,14 @@ describe('getToolbarItems', function () {
|
|
|
169
183
|
expect(createAnalyticsEvent).toHaveBeenCalledWith(payload);
|
|
170
184
|
});
|
|
171
185
|
it('Should trigger analytics when Icon is removed', function () {
|
|
172
|
-
var
|
|
173
|
-
return item.type === 'button' && item.id === 'editor.panel.
|
|
186
|
+
var removeEmojiButton = itemsWithCustomPanelEnabled.find(function (item) {
|
|
187
|
+
return item.type === 'button' && item.id === 'editor.panel.removeEmoji';
|
|
174
188
|
});
|
|
175
189
|
var emojiPickerConfig = itemsWithCustomPanelEnabled.find(function (item) {
|
|
176
190
|
return item.type === 'select' && item.selectType === 'emoji';
|
|
177
191
|
});
|
|
178
192
|
emojiPickerConfig.onChange(':smiley:')(editorView.state, editorView.dispatch);
|
|
179
|
-
|
|
193
|
+
removeEmojiButton.onClick(editorView.state, editorView.dispatch);
|
|
180
194
|
var payload = {
|
|
181
195
|
action: ACTION.REMOVE_ICON,
|
|
182
196
|
actionSubject: ACTION_SUBJECT.PANEL,
|