@atlaskit/editor-core 149.0.0 → 150.0.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 +41 -0
- package/dist/cjs/create-editor/create-plugins-list.js +2 -1
- package/dist/cjs/editor.js +1 -4
- 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/nodeviews/SelectionBasedNodeView.js +1 -2
- 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/card/nodeviews/embedCard.js +1 -3
- package/dist/cjs/plugins/expand/pm-plugins/keymap.js +2 -2
- package/dist/cjs/plugins/extension/actions.js +16 -16
- package/dist/cjs/plugins/extension/pm-plugins/main.js +4 -4
- 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/macro/actions.js +14 -14
- 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/paste/handlers.js +2 -2
- package/dist/cjs/plugins/selection/gap-cursor/actions.js +5 -6
- package/dist/cjs/plugins/selection/pm-plugins/selection-main.js +1 -3
- 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/commands/selection.js +24 -24
- 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 +17 -16
- 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/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
- package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +3 -7
- package/dist/cjs/plugins/text-formatting/pm-plugins/cursor.js +1 -4
- package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +5 -3
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +1 -3
- package/dist/cjs/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.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/ui/PanelTextInput/index.js +1 -3
- package/dist/cjs/utils/compare.js +7 -7
- package/dist/cjs/utils/index.js +7 -8
- package/dist/cjs/utils/rich-media-utils.js +2 -2
- 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/editor.js +1 -4
- 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/nodeviews/SelectionBasedNodeView.js +1 -2
- 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/card/nodeviews/embedCard.js +1 -3
- package/dist/es2019/plugins/expand/pm-plugins/keymap.js +2 -2
- package/dist/es2019/plugins/extension/actions.js +16 -16
- package/dist/es2019/plugins/extension/pm-plugins/main.js +4 -4
- 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/macro/actions.js +14 -14
- 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/paste/handlers.js +2 -2
- package/dist/es2019/plugins/selection/gap-cursor/actions.js +5 -6
- package/dist/es2019/plugins/selection/pm-plugins/selection-main.js +1 -3
- 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/commands/selection.js +25 -25
- 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 +14 -16
- 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/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
- package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +3 -7
- package/dist/es2019/plugins/text-formatting/pm-plugins/cursor.js +1 -4
- package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +5 -3
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +1 -2
- package/dist/es2019/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +1 -3
- 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/ui/ConfigPanel/transformers.js +9 -9
- package/dist/es2019/ui/PanelTextInput/index.js +1 -3
- package/dist/es2019/utils/compare.js +7 -7
- package/dist/es2019/utils/index.js +7 -8
- package/dist/es2019/utils/rich-media-utils.js +2 -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/editor.js +1 -4
- 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/nodeviews/SelectionBasedNodeView.js +1 -2
- 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/card/nodeviews/embedCard.js +1 -3
- package/dist/esm/plugins/expand/pm-plugins/keymap.js +2 -2
- package/dist/esm/plugins/extension/actions.js +16 -16
- package/dist/esm/plugins/extension/pm-plugins/main.js +4 -4
- 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/macro/actions.js +14 -14
- 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/paste/handlers.js +2 -2
- package/dist/esm/plugins/selection/gap-cursor/actions.js +5 -6
- package/dist/esm/plugins/selection/pm-plugins/selection-main.js +1 -3
- 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/commands/selection.js +24 -24
- 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 +15 -17
- 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/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
- package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +3 -7
- package/dist/esm/plugins/text-formatting/pm-plugins/cursor.js +1 -4
- package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +5 -3
- package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +1 -2
- package/dist/esm/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +1 -3
- 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/ui/PanelTextInput/index.js +1 -3
- package/dist/esm/utils/compare.js +7 -7
- package/dist/esm/utils/index.js +7 -8
- package/dist/esm/utils/rich-media-utils.js +2 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +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/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/floating-toolbar/ui/EditorRemoveEmojiIcon.d.ts +1 -0
- 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/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
|
@@ -48,6 +48,20 @@ describe('emoji-picker-button', () => {
|
|
|
48
48
|
|
|
49
49
|
expect(wrapper.find('Popup')).toHaveLength(1);
|
|
50
50
|
});
|
|
51
|
+
it('should close EmojiPicker popup after clicking outside', () => {
|
|
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
|
+
const emojiPicker = wrapper.find('EmojiPickerInternal').instance(); // calling click outside
|
|
57
|
+
|
|
58
|
+
act(() => {
|
|
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', () => {
|
|
52
66
|
// click the button
|
|
53
67
|
wrapper.find('button').simulate('click'); // make sure the popup and picker are shown
|
|
@@ -22,6 +22,7 @@ import { messages } from './messages';
|
|
|
22
22
|
import { createItems } from './create-items';
|
|
23
23
|
import { BlockInsertMenu } from './block-insert-menu';
|
|
24
24
|
import { insertHorizontalRule } from '../../../rule/commands';
|
|
25
|
+
import withOuterListeners from '../../../../ui/with-outer-listeners';
|
|
25
26
|
/**
|
|
26
27
|
* Checks if an element is detached (i.e. not in the current document)
|
|
27
28
|
*/
|
|
@@ -30,6 +31,8 @@ const isDetachedElement = el => !document.body.contains(el);
|
|
|
30
31
|
|
|
31
32
|
const noop = () => {};
|
|
32
33
|
|
|
34
|
+
const EmojiPickerWithListeners = withOuterListeners(AkEmojiPicker);
|
|
35
|
+
|
|
33
36
|
class ToolbarInsertBlock extends React.PureComponent {
|
|
34
37
|
constructor(...args) {
|
|
35
38
|
super(...args);
|
|
@@ -113,6 +116,20 @@ class ToolbarInsertBlock extends React.PureComponent {
|
|
|
113
116
|
});
|
|
114
117
|
});
|
|
115
118
|
|
|
119
|
+
_defineProperty(this, "handleEmojiPressEscape", () => {
|
|
120
|
+
this.toggleEmojiPicker(INPUT_METHOD.KEYBOARD);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
_defineProperty(this, "handleEmojiClickOutside", e => {
|
|
124
|
+
// Ignore click events for detached elements.
|
|
125
|
+
// Workaround for FS-1322 - where two onClicks fire - one when the upload button is
|
|
126
|
+
// still in the document, and one once it's detached. Does not always occur, and
|
|
127
|
+
// may be a side effect of a react render optimisation
|
|
128
|
+
if (e.target && !isDetachedElement(e.target)) {
|
|
129
|
+
this.toggleEmojiPicker(INPUT_METHOD.TOOLBAR);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
116
133
|
_defineProperty(this, "handleEmojiButtonRef", button => {
|
|
117
134
|
const ref = ReactDOM.findDOMNode(button);
|
|
118
135
|
|
|
@@ -137,27 +154,6 @@ class ToolbarInsertBlock extends React.PureComponent {
|
|
|
137
154
|
}
|
|
138
155
|
});
|
|
139
156
|
|
|
140
|
-
_defineProperty(this, "onPickerRef", ref => {
|
|
141
|
-
if (ref) {
|
|
142
|
-
document.addEventListener('click', this.handleClickOutside);
|
|
143
|
-
} else {
|
|
144
|
-
document.removeEventListener('click', this.handleClickOutside);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
this.pickerRef = ref;
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
_defineProperty(this, "handleClickOutside", e => {
|
|
151
|
-
const picker = this.pickerRef && ReactDOM.findDOMNode(this.pickerRef); // 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
|
-
|
|
156
|
-
if (!picker || e.target && !isDetachedElement(e.target) && !picker.contains(e.target)) {
|
|
157
|
-
this.toggleEmojiPicker();
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
|
|
161
157
|
_defineProperty(this, "toggleLinkPanel", inputMethod => {
|
|
162
158
|
const {
|
|
163
159
|
editorView
|
|
@@ -501,10 +497,11 @@ class ToolbarInsertBlock extends React.PureComponent {
|
|
|
501
497
|
mountTo: popupsMountPoint,
|
|
502
498
|
boundariesElement: popupsBoundariesElement,
|
|
503
499
|
scrollableElement: popupsScrollableElement
|
|
504
|
-
}, /*#__PURE__*/React.createElement(
|
|
500
|
+
}, /*#__PURE__*/React.createElement(EmojiPickerWithListeners, {
|
|
505
501
|
emojiProvider: emojiProvider,
|
|
506
502
|
onSelection: this.handleSelectedEmoji,
|
|
507
|
-
|
|
503
|
+
handleClickOutside: this.handleEmojiClickOutside,
|
|
504
|
+
handleEscapeKeydown: this.handleEmojiPressEscape
|
|
508
505
|
}));
|
|
509
506
|
}
|
|
510
507
|
|
|
@@ -7,11 +7,15 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../analyt
|
|
|
7
7
|
import { addAnalytics, withAnalytics } from '../analytics/utils';
|
|
8
8
|
import { LAYOUT_TYPE } from '../analytics/types/node-events';
|
|
9
9
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
10
|
+
export const ONE_COL_LAYOUTS = ['single'];
|
|
10
11
|
export const TWO_COL_LAYOUTS = ['two_equal', 'two_left_sidebar', 'two_right_sidebar'];
|
|
11
12
|
export const THREE_COL_LAYOUTS = ['three_equal', 'three_with_sidebars'];
|
|
12
13
|
|
|
13
14
|
const getWidthsForPreset = presetLayout => {
|
|
14
15
|
switch (presetLayout) {
|
|
16
|
+
case 'single':
|
|
17
|
+
return [100];
|
|
18
|
+
|
|
15
19
|
case 'two_equal':
|
|
16
20
|
return [50, 50];
|
|
17
21
|
|
|
@@ -38,6 +42,9 @@ export const getPresetLayout = section => {
|
|
|
38
42
|
const widths = mapChildren(section, column => column.attrs.width).join(',');
|
|
39
43
|
|
|
40
44
|
switch (widths) {
|
|
45
|
+
case '100':
|
|
46
|
+
return 'single';
|
|
47
|
+
|
|
41
48
|
case '33.33,33.33,33.33':
|
|
42
49
|
return 'three_equal';
|
|
43
50
|
|
|
@@ -92,6 +99,44 @@ export const insertLayoutColumnsWithAnalytics = inputMethod => withAnalytics({
|
|
|
92
99
|
},
|
|
93
100
|
eventType: EVENT_TYPE.TRACK
|
|
94
101
|
})(insertLayoutColumns);
|
|
102
|
+
/**
|
|
103
|
+
* Add a column to the right of existing layout
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
function addColumn(schema, pos) {
|
|
107
|
+
return tr => {
|
|
108
|
+
tr.replaceWith(tr.mapping.map(pos), tr.mapping.map(pos), schema.nodes.layoutColumn.createAndFill());
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function removeLastColumnInLayout(column, columnPos, insideRightEdgePos) {
|
|
113
|
+
return tr => {
|
|
114
|
+
if (isEmptyDocument(column)) {
|
|
115
|
+
tr.replaceRange(tr.mapping.map(columnPos - 1), tr.mapping.map(insideRightEdgePos), Slice.empty);
|
|
116
|
+
} else {
|
|
117
|
+
tr.replaceRange(tr.mapping.map(columnPos - 1), tr.mapping.map(columnPos + 1), Slice.empty);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const fromTwoColsToThree = addColumn;
|
|
123
|
+
const fromOneColToTwo = addColumn;
|
|
124
|
+
const fromTwoColsToOne = removeLastColumnInLayout;
|
|
125
|
+
const fromThreeColsToTwo = removeLastColumnInLayout;
|
|
126
|
+
|
|
127
|
+
const fromOneColToThree = (schema, pos) => {
|
|
128
|
+
return tr => {
|
|
129
|
+
addColumn(schema, pos)(tr);
|
|
130
|
+
addColumn(schema, pos)(tr);
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const fromThreeColstoOne = (node, tr, insideRightEdgePos) => {
|
|
135
|
+
const thirdColumn = node.content.child(2);
|
|
136
|
+
fromThreeColsToTwo(thirdColumn, insideRightEdgePos - thirdColumn.nodeSize, insideRightEdgePos)(tr);
|
|
137
|
+
const secondColumn = node.content.child(1);
|
|
138
|
+
fromTwoColsToOne(secondColumn, insideRightEdgePos - thirdColumn.nodeSize - secondColumn.nodeSize, insideRightEdgePos)(tr);
|
|
139
|
+
};
|
|
95
140
|
/**
|
|
96
141
|
* Handles switching from 2 -> 3 cols, or 3 -> 2 cols
|
|
97
142
|
* Switching from 2 -> 3 just adds a new one at the end
|
|
@@ -99,25 +144,28 @@ export const insertLayoutColumnsWithAnalytics = inputMethod => withAnalytics({
|
|
|
99
144
|
* removing it
|
|
100
145
|
*/
|
|
101
146
|
|
|
147
|
+
|
|
102
148
|
function forceColumnStructure(state, node, pos, presetLayout) {
|
|
103
149
|
const tr = state.tr;
|
|
104
150
|
const insideRightEdgeOfLayoutSection = pos + node.nodeSize - 1;
|
|
105
|
-
const numCols = node.childCount;
|
|
151
|
+
const numCols = node.childCount; // 3 columns -> 2 columns
|
|
106
152
|
|
|
107
153
|
if (TWO_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 3) {
|
|
108
154
|
const thirdColumn = node.content.child(2);
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
if (isEmptyDocument(thirdColumn)) {
|
|
112
|
-
tr.replaceRange( // end pos of second column
|
|
113
|
-
tr.mapping.map(thirdColumnPos - 1), tr.mapping.map(insideRightEdgeOfLayoutSection), Slice.empty);
|
|
114
|
-
} else {
|
|
115
|
-
tr.replaceRange( // end pos of second column
|
|
116
|
-
tr.mapping.map(thirdColumnPos - 1), // start pos of third column
|
|
117
|
-
tr.mapping.map(thirdColumnPos + 1), Slice.empty);
|
|
118
|
-
}
|
|
155
|
+
const columnPos = insideRightEdgeOfLayoutSection - thirdColumn.nodeSize;
|
|
156
|
+
fromThreeColsToTwo(thirdColumn, columnPos, insideRightEdgeOfLayoutSection)(tr); // 2 columns -> 3 columns
|
|
119
157
|
} else if (THREE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 2) {
|
|
120
|
-
|
|
158
|
+
fromTwoColsToThree(state.schema, insideRightEdgeOfLayoutSection)(tr); // 2 columns -> 1 column
|
|
159
|
+
} else if (ONE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 2) {
|
|
160
|
+
const secondColumn = node.content.child(1);
|
|
161
|
+
const columnPos = insideRightEdgeOfLayoutSection - secondColumn.nodeSize;
|
|
162
|
+
fromTwoColsToOne(secondColumn, columnPos, insideRightEdgeOfLayoutSection)(tr); // 3 columns -> 1 column
|
|
163
|
+
} else if (ONE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 3) {
|
|
164
|
+
fromThreeColstoOne(node, tr, insideRightEdgeOfLayoutSection); // 1 column -> 2 columns
|
|
165
|
+
} else if (TWO_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 1) {
|
|
166
|
+
fromOneColToTwo(state.schema, insideRightEdgeOfLayoutSection)(tr); // 1 column -> 3 columns
|
|
167
|
+
} else if (THREE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 1) {
|
|
168
|
+
fromOneColToThree(state.schema, insideRightEdgeOfLayoutSection)(tr);
|
|
121
169
|
}
|
|
122
170
|
|
|
123
171
|
return tr;
|
|
@@ -209,7 +257,7 @@ function getLayoutChange(node, pos, schema) {
|
|
|
209
257
|
return;
|
|
210
258
|
}
|
|
211
259
|
|
|
212
|
-
const presetLayout = node.childCount === 2 ? 'two_equal' : 'three_equal';
|
|
260
|
+
const presetLayout = node.childCount === 2 ? 'two_equal' : node.childCount === 3 ? 'three_equal' : 'single';
|
|
213
261
|
const fixedColumns = columnWidth(node, schema, getWidthsForPreset(presetLayout));
|
|
214
262
|
return {
|
|
215
263
|
from: pos + 1,
|
|
@@ -306,6 +354,9 @@ export const deleteActiveLayoutNode = (state, dispatch) => {
|
|
|
306
354
|
|
|
307
355
|
const formatLayoutName = layout => {
|
|
308
356
|
switch (layout) {
|
|
357
|
+
case 'single':
|
|
358
|
+
return LAYOUT_TYPE.SINGLE_COL;
|
|
359
|
+
|
|
309
360
|
case 'two_equal':
|
|
310
361
|
return LAYOUT_TYPE.TWO_COLS_EQUAL;
|
|
311
362
|
|
|
@@ -34,11 +34,12 @@ const layoutPlugin = (options = {}) => ({
|
|
|
34
34
|
const {
|
|
35
35
|
pos,
|
|
36
36
|
allowBreakout,
|
|
37
|
-
addSidebarLayouts
|
|
37
|
+
addSidebarLayouts,
|
|
38
|
+
allowSingleColumnLayout
|
|
38
39
|
} = pluginKey.getState(state);
|
|
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;
|
|
@@ -56,13 +56,15 @@ const getInitialPluginState = (options, state) => {
|
|
|
56
56
|
const maybeLayoutSection = findParentNodeOfType(state.schema.nodes.layoutSection)(state.selection);
|
|
57
57
|
const allowBreakout = options.allowBreakout || false;
|
|
58
58
|
const addSidebarLayouts = options.UNSAFE_addSidebarLayouts || false;
|
|
59
|
+
const allowSingleColumnLayout = options.UNSAFE_allowSingleColumnLayout || false;
|
|
59
60
|
const pos = maybeLayoutSection ? maybeLayoutSection.pos : null;
|
|
60
61
|
const selectedLayout = getSelectedLayout(maybeLayoutSection && maybeLayoutSection.node, DEFAULT_LAYOUT);
|
|
61
62
|
return {
|
|
62
63
|
pos,
|
|
63
64
|
allowBreakout,
|
|
64
65
|
addSidebarLayouts,
|
|
65
|
-
selectedLayout
|
|
66
|
+
selectedLayout,
|
|
67
|
+
allowSingleColumnLayout
|
|
66
68
|
};
|
|
67
69
|
};
|
|
68
70
|
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { defineMessages } from 'react-intl';
|
|
2
2
|
export const 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,4 +1,5 @@
|
|
|
1
1
|
import { findDomRefAtPos } from 'prosemirror-utils';
|
|
2
|
+
import EditorLayoutSingleIcon from '@atlaskit/icon/glyph/editor/layout-single';
|
|
2
3
|
import LayoutTwoEqualIcon from '@atlaskit/icon/glyph/editor/layout-two-equal';
|
|
3
4
|
import LayoutThreeEqualIcon from '@atlaskit/icon/glyph/editor/layout-three-equal';
|
|
4
5
|
import LayoutTwoLeftSidebarIcon from '@atlaskit/icon/glyph/editor/layout-two-left-sidebar';
|
|
@@ -20,6 +21,12 @@ const LAYOUT_TYPES = [{
|
|
|
20
21
|
title: toolbarMessages.threeColumns,
|
|
21
22
|
icon: LayoutThreeEqualIcon
|
|
22
23
|
}];
|
|
24
|
+
const LAYOUT_TYPES_WITH_SINGLE_COL = [{
|
|
25
|
+
id: 'editor.layout.singeLayout',
|
|
26
|
+
type: 'single',
|
|
27
|
+
title: toolbarMessages.singleColumn,
|
|
28
|
+
icon: EditorLayoutSingleIcon
|
|
29
|
+
}, ...LAYOUT_TYPES];
|
|
23
30
|
const SIDEBAR_LAYOUT_TYPES = [{
|
|
24
31
|
id: 'editor.layout.twoRightSidebar',
|
|
25
32
|
type: 'two_right_sidebar',
|
|
@@ -48,7 +55,7 @@ const buildLayoutButton = (intl, item, currentLayout) => ({
|
|
|
48
55
|
});
|
|
49
56
|
|
|
50
57
|
export const layoutToolbarTitle = 'Layout floating controls';
|
|
51
|
-
export const buildToolbar = (state, intl, pos, _allowBreakout, addSidebarLayouts) => {
|
|
58
|
+
export const buildToolbar = (state, intl, pos, _allowBreakout, addSidebarLayouts, allowSingleColumnLayout) => {
|
|
52
59
|
const node = state.doc.nodeAt(pos);
|
|
53
60
|
|
|
54
61
|
if (node) {
|
|
@@ -70,11 +77,12 @@ export const buildToolbar = (state, intl, pos, _allowBreakout, addSidebarLayouts
|
|
|
70
77
|
onFocus: hoverDecoration(nodeType, true),
|
|
71
78
|
onBlur: hoverDecoration(nodeType, false)
|
|
72
79
|
};
|
|
80
|
+
const layoutTypes = allowSingleColumnLayout ? LAYOUT_TYPES_WITH_SINGLE_COL : LAYOUT_TYPES;
|
|
73
81
|
return {
|
|
74
82
|
title: layoutToolbarTitle,
|
|
75
83
|
getDomRef: view => findDomRefAtPos(pos, view.domAtPos.bind(view)),
|
|
76
84
|
nodeType,
|
|
77
|
-
items: [...
|
|
85
|
+
items: [...layoutTypes.map(i => buildLayoutButton(intl, i, currentLayout)), ...(addSidebarLayouts ? SIDEBAR_LAYOUT_TYPES.map(i => buildLayoutButton(intl, i, currentLayout)) : []), separator, deleteButton]
|
|
78
86
|
};
|
|
79
87
|
}
|
|
80
88
|
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
2
2
|
import { DecorationSet, Decoration } from 'prosemirror-view';
|
|
3
3
|
import { findParentNodeOfType } from 'prosemirror-utils';
|
|
4
|
-
import { addAnalytics, ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../../analytics';
|
|
5
4
|
import { isWrappingPossible } from '../utils/selection';
|
|
6
|
-
import { isListNode
|
|
5
|
+
import { isListNode } from '../utils/node';
|
|
7
6
|
import { pluginFactory } from '../../../utils/plugin-state-factory';
|
|
8
|
-
import { findRootParentListNode } from '../utils/find';
|
|
9
7
|
const listPluginKey = new PluginKey('listPlugin');
|
|
10
8
|
export const pluginKey = listPluginKey;
|
|
11
9
|
const initialState = {
|
|
@@ -104,44 +102,6 @@ const createInitialState = state => {
|
|
|
104
102
|
export const createPlugin = eventDispatch => new Plugin({
|
|
105
103
|
state: createPluginState(eventDispatch, createInitialState),
|
|
106
104
|
key: listPluginKey,
|
|
107
|
-
|
|
108
|
-
appendTransaction(transactions, _oldState, newState) {
|
|
109
|
-
const lastTransaction = transactions[transactions.length - 1];
|
|
110
|
-
|
|
111
|
-
if (!lastTransaction.docChanged || !lastTransaction.selectionSet) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const tr = newState.tr;
|
|
116
|
-
const rootList = findRootParentListNode(tr.selection.$from);
|
|
117
|
-
|
|
118
|
-
if (!rootList) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const listsJoined = joinSiblingLists({
|
|
123
|
-
tr,
|
|
124
|
-
direction: JoinDirection.RIGHT
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
if (tr.docChanged) {
|
|
128
|
-
const {
|
|
129
|
-
orderedList: orderedListsJoined,
|
|
130
|
-
bulletList: bulletListsJoined
|
|
131
|
-
} = listsJoined;
|
|
132
|
-
addAnalytics(newState, tr, {
|
|
133
|
-
action: ACTION.FIXED,
|
|
134
|
-
actionSubject: ACTION_SUBJECT.LIST,
|
|
135
|
-
eventType: EVENT_TYPE.TRACK,
|
|
136
|
-
attributes: {
|
|
137
|
-
orderedListsJoined,
|
|
138
|
-
bulletListsJoined
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
return tr;
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
|
|
145
105
|
props: {
|
|
146
106
|
decorations(state) {
|
|
147
107
|
const {
|
|
@@ -52,20 +52,20 @@ export const insertMacroFromMacroBrowser = (macroProvider, macroNode, isEditing)
|
|
|
52
52
|
tr.setSelection(TextSelection.create(tr.doc, state.selection.anchor));
|
|
53
53
|
} // If any extension is currently selected
|
|
54
54
|
else if (findSelectedNodeOfType([extension, bodiedExtension, inlineExtension])(selection)) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
55
|
+
tr = replaceSelectedNode(node)(tr); // Replacing selected node doesn't update the selection. `selection.node` still returns the old node
|
|
56
|
+
|
|
57
|
+
tr.setSelection(NodeSelection.create(tr.doc, tr.mapping.map(state.selection.anchor)));
|
|
58
|
+
} // When we loose the selection. This usually happens when Synchrony resets or changes
|
|
59
|
+
// the selection when user is in the middle of updating an extension.
|
|
60
|
+
else if (extensionState.element) {
|
|
61
|
+
const pos = view.posAtDOM(extensionState.element, -1);
|
|
62
|
+
|
|
63
|
+
if (pos > -1) {
|
|
64
|
+
tr = tr.replaceWith(pos, pos + macroNode.nodeSize, node);
|
|
65
|
+
tr.setSelection(Selection.near(tr.doc.resolve(pos)));
|
|
66
|
+
targetSelectionSource = TARGET_SELECTION_SOURCE.HTML_ELEMENT;
|
|
67
|
+
}
|
|
68
|
+
} // Only scroll if we have anything to update, best to avoid surprise scroll
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
if (dispatch && tr.docChanged) {
|
|
@@ -69,7 +69,7 @@ export const buildTypeAheadInviteItemViewedPayload = (sessionId, contextIdentifi
|
|
|
69
69
|
userRole
|
|
70
70
|
});
|
|
71
71
|
};
|
|
72
|
-
export const buildTypeAheadInviteExposurePayload = (
|
|
72
|
+
export const buildTypeAheadInviteExposurePayload = (sessionId, contextIdentifierProvider, inviteExperimentCohort, userRole) => {
|
|
73
73
|
const {
|
|
74
74
|
containerId,
|
|
75
75
|
objectId,
|
|
@@ -77,8 +77,7 @@ export const buildTypeAheadInviteExposurePayload = (shouldEnableInvite, sessionI
|
|
|
77
77
|
} = contextIdentifierProvider || {};
|
|
78
78
|
return buildAnalyticsPayload('feature', 'exposed', OPERATIONAL_EVENT_TYPE, sessionId, {
|
|
79
79
|
flagKey: 'confluence.frontend.invite.from.mention',
|
|
80
|
-
value:
|
|
81
|
-
cohort: inviteExperimentCohort,
|
|
80
|
+
value: inviteExperimentCohort || 'not-enrolled',
|
|
82
81
|
containerId,
|
|
83
82
|
objectId,
|
|
84
83
|
childObjectId,
|
|
@@ -246,6 +246,15 @@ export const createTypeAheadConfig = ({
|
|
|
246
246
|
|
|
247
247
|
if (mentions.length === 0 && firstQueryWithoutResults === null) {
|
|
248
248
|
firstQueryWithoutResults = query;
|
|
249
|
+
} // Growth (El-dorado) experiment design hard requirement
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
if (mentionItems.length <= 2) {
|
|
253
|
+
const {
|
|
254
|
+
inviteExperimentCohort,
|
|
255
|
+
userRole
|
|
256
|
+
} = mentionProvider;
|
|
257
|
+
fireEvent(buildTypeAheadInviteExposurePayload(sessionId, contextIdentifierProvider, inviteExperimentCohort, userRole));
|
|
249
258
|
}
|
|
250
259
|
|
|
251
260
|
if (!mentionProvider.shouldEnableInvite || mentionItems.length > 2) {
|
|
@@ -272,21 +281,6 @@ export const createTypeAheadConfig = ({
|
|
|
272
281
|
|
|
273
282
|
onOpen: editorState => {
|
|
274
283
|
firstQueryWithoutResults = null;
|
|
275
|
-
const pluginState = getMentionPluginState(editorState);
|
|
276
|
-
|
|
277
|
-
if (!pluginState || !pluginState.mentionProvider) {
|
|
278
|
-
return null;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
const {
|
|
282
|
-
contextIdentifierProvider,
|
|
283
|
-
mentionProvider: {
|
|
284
|
-
shouldEnableInvite,
|
|
285
|
-
inviteExperimentCohort,
|
|
286
|
-
userRole
|
|
287
|
-
}
|
|
288
|
-
} = pluginState;
|
|
289
|
-
fireEvent(buildTypeAheadInviteExposurePayload(!!shouldEnableInvite, sessionId, contextIdentifierProvider, inviteExperimentCohort, userRole));
|
|
290
284
|
},
|
|
291
285
|
|
|
292
286
|
selectItem(state, item, insert, {
|
|
@@ -11,7 +11,7 @@ import { PanelType } from '@atlaskit/adf-schema';
|
|
|
11
11
|
import { PanelSharedCssClassName } from '@atlaskit/editor-common';
|
|
12
12
|
import { Emoji } from '@atlaskit/editor-common';
|
|
13
13
|
import { panelAttrsToDom } from '../utils';
|
|
14
|
-
|
|
14
|
+
import { akEditorCustomIconSize } from '@atlaskit/editor-shared-styles/consts';
|
|
15
15
|
export const panelIcons = {
|
|
16
16
|
info: InfoIcon,
|
|
17
17
|
success: SuccessIcon,
|
|
@@ -37,7 +37,7 @@ export const PanelIcon = props => {
|
|
|
37
37
|
shortName: panelIcon,
|
|
38
38
|
showTooltip: false,
|
|
39
39
|
allowTextFallback: false,
|
|
40
|
-
fitToHeight:
|
|
40
|
+
fitToHeight: akEditorCustomIconSize
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -64,8 +64,10 @@ class PanelNodeView {
|
|
|
64
64
|
|
|
65
65
|
if (!this.icon) {
|
|
66
66
|
return;
|
|
67
|
-
}
|
|
67
|
+
} // set contentEditable as false to be able to select the custom panels with keyboard
|
|
68
|
+
|
|
68
69
|
|
|
70
|
+
this.icon.contentEditable = 'false';
|
|
69
71
|
ReactDOM.render( /*#__PURE__*/React.createElement(PanelIcon, {
|
|
70
72
|
allowCustomPanel: pluginOptions.UNSAFE_allowCustomPanel,
|
|
71
73
|
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';
|
|
@@ -206,13 +206,15 @@ export const getToolbarItems = (formatMessage, panelNodeType, isCustomPanelEnabl
|
|
|
206
206
|
selected: activePanelType === PanelType.CUSTOM && !!activePanelIcon,
|
|
207
207
|
onChange: emojiShortName => changeEmoji(emojiShortName)
|
|
208
208
|
};
|
|
209
|
-
|
|
210
|
-
id: 'editor.panel.
|
|
209
|
+
const removeEmojiButton = {
|
|
210
|
+
id: 'editor.panel.removeEmoji',
|
|
211
211
|
type: 'button',
|
|
212
|
-
icon:
|
|
212
|
+
icon: RemoveEmojiIcon,
|
|
213
213
|
onClick: removeEmoji(),
|
|
214
|
-
title: formatMessage(commonMessages.
|
|
215
|
-
|
|
214
|
+
title: formatMessage(commonMessages.removeEmoji),
|
|
215
|
+
disabled: activePanelIcon ? false : true
|
|
216
|
+
};
|
|
217
|
+
items.push(emojiPicker, removeEmojiButton, {
|
|
216
218
|
type: 'separator'
|
|
217
219
|
}, colorPicker);
|
|
218
220
|
}
|
|
@@ -71,14 +71,14 @@ describe('getToolbarItems', () => {
|
|
|
71
71
|
color: '#ABF5D1'
|
|
72
72
|
}, true);
|
|
73
73
|
});
|
|
74
|
-
it(`should call changePanelType when clicked on
|
|
75
|
-
const
|
|
76
|
-
|
|
74
|
+
it(`should call changePanelType when clicked on remove emoji`, () => {
|
|
75
|
+
const removeEmojiButton = itemsWithCustomPanelEnabled.find(item => item.type === 'button' && item.id === 'editor.panel.removeEmoji');
|
|
76
|
+
removeEmojiButton.onClick(editorView.state);
|
|
77
77
|
expect(changePanelTypespy).toBeCalledWith(PanelType.CUSTOM, {
|
|
78
78
|
emoji: undefined
|
|
79
79
|
}, true);
|
|
80
80
|
});
|
|
81
|
-
it(`should not call changePanelType when clicked on
|
|
81
|
+
it(`should not call changePanelType when clicked on remove emoji when no emoji in panel`, () => {
|
|
82
82
|
const {
|
|
83
83
|
editorView
|
|
84
84
|
} = createEditor({
|
|
@@ -89,11 +89,21 @@ describe('getToolbarItems', () => {
|
|
|
89
89
|
providerFactory
|
|
90
90
|
});
|
|
91
91
|
const toolbarItems = getToolbarItems(dummyFormatMessage, defaultSchema.nodes.panel, true, providerFactory, PanelType.CUSTOM);
|
|
92
|
-
const
|
|
92
|
+
const removeEmojiButton = toolbarItems.find(item => item.type === 'button' && item.id === 'editor.panel.removeEmoji');
|
|
93
93
|
changePanelTypespy.mockClear();
|
|
94
|
-
|
|
94
|
+
removeEmojiButton.onClick(editorView.state);
|
|
95
95
|
expect(changePanelTypespy).not.toBeCalled();
|
|
96
96
|
});
|
|
97
|
+
it(`should have remove emoji button disabled when focus on panel without emoji`, () => {
|
|
98
|
+
const toolbarItems = getToolbarItems(dummyFormatMessage, defaultSchema.nodes.panel, true, providerFactory, PanelType.CUSTOM, '#ABF5D1', '');
|
|
99
|
+
const removeEmojiButton = toolbarItems.find(item => item.type === 'button' && item.id === 'editor.panel.removeEmoji');
|
|
100
|
+
expect(removeEmojiButton.disabled).toBe(true);
|
|
101
|
+
});
|
|
102
|
+
it(`should have remove emoji button enabled when focus on panel with emoji`, () => {
|
|
103
|
+
const toolbarItems = getToolbarItems(dummyFormatMessage, defaultSchema.nodes.panel, true, providerFactory, PanelType.CUSTOM, '#ABF5D1', ':smiley:');
|
|
104
|
+
const removeEmojiButton = toolbarItems.find(item => item.type === 'button' && item.id === 'editor.panel.removeEmoji');
|
|
105
|
+
expect(removeEmojiButton.disabled).toBe(false);
|
|
106
|
+
});
|
|
97
107
|
});
|
|
98
108
|
describe('analytics for custom panels', () => {
|
|
99
109
|
const createEditor = createProsemirrorEditorFactory();
|
|
@@ -151,10 +161,10 @@ describe('getToolbarItems', () => {
|
|
|
151
161
|
expect(createAnalyticsEvent).toHaveBeenCalledWith(payload);
|
|
152
162
|
});
|
|
153
163
|
it('Should trigger analytics when Icon is removed', () => {
|
|
154
|
-
const
|
|
164
|
+
const removeEmojiButton = itemsWithCustomPanelEnabled.find(item => item.type === 'button' && item.id === 'editor.panel.removeEmoji');
|
|
155
165
|
const emojiPickerConfig = itemsWithCustomPanelEnabled.find(item => item.type === 'select' && item.selectType === 'emoji');
|
|
156
166
|
emojiPickerConfig.onChange(':smiley:')(editorView.state, editorView.dispatch);
|
|
157
|
-
|
|
167
|
+
removeEmojiButton.onClick(editorView.state, editorView.dispatch);
|
|
158
168
|
const payload = {
|
|
159
169
|
action: ACTION.REMOVE_ICON,
|
|
160
170
|
actionSubject: ACTION_SUBJECT.PANEL,
|
|
@@ -65,8 +65,8 @@ export function handlePasteIntoTaskAndDecision(slice) {
|
|
|
65
65
|
|
|
66
66
|
if (selection instanceof TextSelection && Array.isArray(selectionMarks) && selectionMarks.length > 0 && hasOnlyNodesOfType(paragraph, text, emoji, mention, hardBreak)(slice) && (!codeMark.isInSet(selectionMarks) || textFormattingState.codeActive) // for codeMarks let's make sure mark is active
|
|
67
67
|
) {
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
filters.push(applyTextMarksToSlice(schema, selection.$head.marks()));
|
|
69
|
+
}
|
|
70
70
|
|
|
71
71
|
const transformedSlice = compose.apply(null, filters)(slice);
|
|
72
72
|
const tr = closeHistory(state.tr).replaceSelection(transformedSlice).scrollIntoView();
|
|
@@ -107,8 +107,7 @@ export const arrow = (dir, endOfTextblock) => (state, dispatch, view) => {
|
|
|
107
107
|
|
|
108
108
|
|
|
109
109
|
if (selection instanceof GapCursorSelection && // next node allow gap cursor position
|
|
110
|
-
isValidTargetNode(isBackward(dir) ? $pos.nodeBefore : $pos.nodeAfter) && (
|
|
111
|
-
isBackward(dir) && selection.side === Side.LEFT || isForward(dir) && selection.side === Side.RIGHT)) {
|
|
110
|
+
isValidTargetNode(isBackward(dir) ? $pos.nodeBefore : $pos.nodeAfter) && (isBackward(dir) && selection.side === Side.LEFT || isForward(dir) && selection.side === Side.RIGHT)) {
|
|
112
111
|
// reverse cursor position
|
|
113
112
|
if (dispatch) {
|
|
114
113
|
dispatch(tr.setSelection(new GapCursorSelection($pos, selection.side === Side.RIGHT ? Side.LEFT : Side.RIGHT)).scrollIntoView());
|
|
@@ -270,12 +269,12 @@ export const setSelectionTopLevelBlocks = (tr, event, editorRef, posAtCoords, ed
|
|
|
270
269
|
} // try to set text selection if the editor isnt focused
|
|
271
270
|
// if the editor is focused, we are most likely dragging a selection outside.
|
|
272
271
|
else if (editorFocused === false) {
|
|
273
|
-
|
|
272
|
+
const selectionTemp = Selection.findFrom($pos, cursorCoords.side === Side.LEFT ? 1 : -1, true);
|
|
274
273
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}
|
|
274
|
+
if (selectionTemp) {
|
|
275
|
+
tr.setSelection(selectionTemp);
|
|
278
276
|
}
|
|
277
|
+
}
|
|
279
278
|
};
|
|
280
279
|
export const setCursorForTopLevelBlocks = (event, editorRef, posAtCoords, editorFocused) => (state, dispatch) => {
|
|
281
280
|
const {
|
|
@@ -25,9 +25,7 @@ export const createPlugin = (dispatch, dispatchAnalyticsEvent, options = {}) =>
|
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
const analyticsPayload = getNodeSelectionAnalyticsPayload(state.selection) || getAllSelectionAnalyticsPayload(state.selection) || // We
|
|
29
|
-
// handled in mouseup handler below
|
|
30
|
-
!editorView.mouseDown && (getRangeSelectionAnalyticsPayload(state.selection, state.doc) || getCellSelectionAnalyticsPayload(state)); // We have to use dispatchAnalyticsEvent over any of the analytics plugin helpers
|
|
28
|
+
const analyticsPayload = getNodeSelectionAnalyticsPayload(state.selection) || getAllSelectionAnalyticsPayload(state.selection) || !editorView.mouseDown && (getRangeSelectionAnalyticsPayload(state.selection, state.doc) || getCellSelectionAnalyticsPayload(state)); // We have to use dispatchAnalyticsEvent over any of the analytics plugin helpers
|
|
31
29
|
// as there were several issues caused by the fact that adding analytics through
|
|
32
30
|
// the plugin adds a new step to the transaction
|
|
33
31
|
// This causes prosemirror to run through some different code paths, eg. attempting
|