@atlaskit/editor-core 172.0.5 → 172.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/dist/cjs/create-editor/ReactEditorView.js +11 -2
- package/dist/cjs/create-editor/ReactEditorViewContext.js +15 -0
- package/dist/cjs/create-editor/create-plugins-list.js +2 -1
- package/dist/cjs/editor.js +7 -1
- package/dist/cjs/labs/next/mobile.js +5 -3
- package/dist/cjs/messages.js +5 -0
- package/dist/cjs/plugins/analytics/types/enums.js +1 -0
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +1 -1
- package/dist/cjs/plugins/card/nodeviews/inlineCard.js +8 -0
- package/dist/cjs/plugins/card/pm-plugins/doc.js +2 -26
- package/dist/cjs/plugins/card/toolbar.js +118 -86
- package/dist/cjs/plugins/code-block/nodeviews/code-block.js +9 -2
- package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +37 -1
- package/dist/cjs/plugins/code-block/toolbar.js +3 -1
- package/dist/cjs/plugins/code-block/ui/class-names.js +2 -0
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +4 -3
- package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +3 -1
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +42 -2
- package/dist/cjs/plugins/hyperlink/Toolbar.js +43 -8
- package/dist/cjs/plugins/media/commands/helpers.js +1 -8
- package/dist/cjs/plugins/media/index.js +1 -1
- package/dist/cjs/plugins/media/nodeviews/mediaNodeView/index.js +0 -10
- package/dist/cjs/plugins/media/nodeviews/mediaNodeView/media.js +2 -3
- package/dist/cjs/plugins/media/picker-facade.js +1 -0
- package/dist/cjs/plugins/media/pm-plugins/main.js +3 -13
- package/dist/cjs/plugins/paste/handlers.js +9 -20
- package/dist/cjs/plugins/paste/md.js +8 -2
- package/dist/cjs/plugins/paste/newline-md-plugin.js +67 -0
- package/dist/cjs/plugins/paste/paragraph-md-plugin.js +72 -0
- package/dist/cjs/plugins/table/commands/hover.js +4 -4
- package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/table/utils/decoration.js +53 -3
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -0
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +3 -2
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +78 -53
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +1 -1
- package/dist/cjs/ui/Addon/ClickAreaBlock/index.js +7 -2
- package/dist/cjs/ui/Addon/ClickAreaMobile/index.js +8 -2
- package/dist/cjs/ui/Appearance/Comment/Comment.js +13 -13
- package/dist/cjs/ui/Appearance/FullPage/FullPage.js +8 -7
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
- package/dist/cjs/ui/Appearance/Mobile.js +4 -2
- package/dist/cjs/ui/AppearanceComponents/Mobile.js +5 -4
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/DropdownMenu/index.js +5 -5
- package/dist/cjs/ui/with-outer-listeners.js +105 -50
- package/dist/cjs/utils/deprecation-warnings.js +4 -0
- package/dist/cjs/utils/linking-utils.js +40 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +11 -2
- package/dist/es2019/create-editor/ReactEditorViewContext.js +3 -0
- package/dist/es2019/create-editor/create-plugins-list.js +2 -1
- package/dist/es2019/editor.js +7 -1
- package/dist/es2019/labs/next/mobile.js +5 -3
- package/dist/es2019/messages.js +5 -0
- package/dist/es2019/plugins/analytics/types/enums.js +1 -0
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +1 -1
- package/dist/es2019/plugins/card/nodeviews/inlineCard.js +10 -0
- package/dist/es2019/plugins/card/pm-plugins/doc.js +1 -24
- package/dist/es2019/plugins/card/toolbar.js +114 -86
- package/dist/es2019/plugins/code-block/nodeviews/code-block.js +9 -2
- package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +40 -2
- package/dist/es2019/plugins/code-block/toolbar.js +2 -1
- package/dist/es2019/plugins/code-block/ui/class-names.js +2 -0
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +4 -3
- package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +3 -2
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +37 -0
- package/dist/es2019/plugins/hyperlink/Toolbar.js +40 -9
- package/dist/es2019/plugins/media/commands/helpers.js +0 -2
- package/dist/es2019/plugins/media/index.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaNodeView/index.js +0 -7
- package/dist/es2019/plugins/media/nodeviews/mediaNodeView/media.js +2 -3
- package/dist/es2019/plugins/media/picker-facade.js +1 -0
- package/dist/es2019/plugins/media/pm-plugins/main.js +3 -13
- package/dist/es2019/plugins/paste/handlers.js +7 -19
- package/dist/es2019/plugins/paste/md.js +6 -2
- package/dist/es2019/plugins/paste/newline-md-plugin.js +56 -0
- package/dist/es2019/plugins/paste/paragraph-md-plugin.js +61 -0
- package/dist/es2019/plugins/table/commands/hover.js +4 -4
- package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
- package/dist/es2019/plugins/table/ui/common-styles.js +39 -0
- package/dist/es2019/plugins/table/utils/decoration.js +60 -24
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -0
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +4 -3
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +78 -59
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +2 -2
- package/dist/es2019/ui/Addon/ClickAreaBlock/index.js +6 -2
- package/dist/es2019/ui/Addon/ClickAreaMobile/index.js +7 -2
- package/dist/es2019/ui/Appearance/Comment/Comment.js +12 -6
- package/dist/es2019/ui/Appearance/FullPage/FullPage.js +7 -2
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
- package/dist/es2019/ui/Appearance/Mobile.js +4 -2
- package/dist/es2019/ui/AppearanceComponents/Mobile.js +5 -4
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/DropdownMenu/index.js +10 -6
- package/dist/es2019/ui/with-outer-listeners.js +83 -33
- package/dist/es2019/utils/deprecation-warnings.js +4 -0
- package/dist/es2019/utils/linking-utils.js +37 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +11 -2
- package/dist/esm/create-editor/ReactEditorViewContext.js +3 -0
- package/dist/esm/create-editor/create-plugins-list.js +2 -1
- package/dist/esm/editor.js +7 -1
- package/dist/esm/labs/next/mobile.js +5 -3
- package/dist/esm/messages.js +5 -0
- package/dist/esm/plugins/analytics/types/enums.js +1 -0
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +1 -1
- package/dist/esm/plugins/card/nodeviews/inlineCard.js +9 -0
- package/dist/esm/plugins/card/pm-plugins/doc.js +1 -20
- package/dist/esm/plugins/card/toolbar.js +108 -83
- package/dist/esm/plugins/code-block/nodeviews/code-block.js +9 -2
- package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +37 -2
- package/dist/esm/plugins/code-block/toolbar.js +2 -1
- package/dist/esm/plugins/code-block/ui/class-names.js +2 -0
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +4 -3
- package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +3 -2
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +41 -2
- package/dist/esm/plugins/hyperlink/Toolbar.js +43 -10
- package/dist/esm/plugins/media/commands/helpers.js +0 -4
- package/dist/esm/plugins/media/index.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaNodeView/index.js +0 -8
- package/dist/esm/plugins/media/nodeviews/mediaNodeView/media.js +2 -3
- package/dist/esm/plugins/media/picker-facade.js +1 -0
- package/dist/esm/plugins/media/pm-plugins/main.js +3 -15
- package/dist/esm/plugins/paste/handlers.js +11 -22
- package/dist/esm/plugins/paste/md.js +6 -2
- package/dist/esm/plugins/paste/newline-md-plugin.js +58 -0
- package/dist/esm/plugins/paste/paragraph-md-plugin.js +63 -0
- package/dist/esm/plugins/table/commands/hover.js +4 -4
- package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
- package/dist/esm/plugins/table/ui/common-styles.js +1 -1
- package/dist/esm/plugins/table/utils/decoration.js +50 -3
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -0
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +4 -3
- package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +77 -51
- package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +2 -2
- package/dist/esm/ui/Addon/ClickAreaBlock/index.js +7 -2
- package/dist/esm/ui/Addon/ClickAreaMobile/index.js +8 -2
- package/dist/esm/ui/Appearance/Comment/Comment.js +12 -12
- package/dist/esm/ui/Appearance/FullPage/FullPage.js +7 -6
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
- package/dist/esm/ui/Appearance/Mobile.js +4 -2
- package/dist/esm/ui/AppearanceComponents/Mobile.js +5 -4
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/DropdownMenu/index.js +5 -5
- package/dist/esm/ui/with-outer-listeners.js +105 -51
- package/dist/esm/utils/deprecation-warnings.js +4 -0
- package/dist/esm/utils/linking-utils.js +37 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/ReactEditorView.d.ts +2 -0
- package/dist/types/create-editor/ReactEditorViewContext.d.ts +8 -0
- package/dist/types/messages.d.ts +5 -0
- package/dist/types/plugins/analytics/types/enums.d.ts +1 -0
- package/dist/types/plugins/analytics/types/events.d.ts +2 -2
- package/dist/types/plugins/analytics/types/link-tool-bar-events.d.ts +1 -0
- package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +3 -0
- package/dist/types/plugins/card/pm-plugins/doc.d.ts +1 -2
- package/dist/types/plugins/card/toolbar.d.ts +1 -0
- package/dist/types/plugins/code-block/pm-plugins/ide-ux.d.ts +4 -1
- package/dist/types/plugins/code-block/ui/class-names.d.ts +2 -0
- package/dist/types/plugins/hyperlink/types.d.ts +1 -0
- package/dist/types/plugins/media/commands/helpers.d.ts +0 -1
- package/dist/types/plugins/media/nodeviews/mediaNodeView/index.d.ts +0 -1
- package/dist/types/plugins/media/nodeviews/mediaNodeView/media.d.ts +0 -1
- package/dist/types/plugins/media/pm-plugins/main.d.ts +0 -2
- package/dist/types/plugins/media/pm-plugins/types.d.ts +0 -2
- package/dist/types/plugins/paste/newline-md-plugin.d.ts +2 -0
- package/dist/types/plugins/paste/paragraph-md-plugin.d.ts +2 -0
- package/dist/types/plugins/table/utils/decoration.d.ts +1 -1
- package/dist/types/types/editor-appearance-component.d.ts +1 -0
- package/dist/types/types/feature-flags.d.ts +9 -0
- package/dist/types/ui/Addon/ClickAreaBlock/index.d.ts +1 -0
- package/dist/types/ui/Addon/ClickAreaMobile/index.d.ts +1 -0
- package/dist/types/ui/Appearance/FullPage/FullPage.d.ts +1 -0
- package/dist/types/ui/Appearance/Mobile.d.ts +1 -1
- package/dist/types/ui/AppearanceComponents/Mobile.d.ts +2 -1
- package/dist/types/ui/Dropdown/index.d.ts +1 -1
- package/dist/types/ui/with-outer-listeners.d.ts +2 -1
- package/dist/types/utils/linking-utils.d.ts +1 -0
- package/package.json +30 -32
- package/dist/cjs/plugins/type-ahead/ui/DynamicHeightListItem.js +0 -77
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +0 -118
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-resize-observer.js +0 -70
- package/dist/es2019/plugins/type-ahead/ui/DynamicHeightListItem.js +0 -51
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +0 -97
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-resize-observer.js +0 -53
- package/dist/esm/plugins/type-ahead/ui/DynamicHeightListItem.js +0 -51
- package/dist/esm/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +0 -101
- package/dist/esm/plugins/type-ahead/ui/hooks/use-resize-observer.js +0 -48
- package/dist/types/plugins/type-ahead/ui/DynamicHeightListItem.d.ts +0 -21
- package/dist/types/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.d.ts +0 -25
- package/dist/types/plugins/type-ahead/ui/hooks/use-resize-observer.d.ts +0 -8
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import React, { useMemo,
|
|
2
|
+
import React, { useMemo, useRef, useCallback, useLayoutEffect, useState } from 'react';
|
|
3
3
|
import { jsx, css } from '@emotion/react';
|
|
4
4
|
import { MenuGroup } from '@atlaskit/menu';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { useDynamicListHeightCalculation } from './hooks/use-dynamic-list-height-calculation';
|
|
9
|
-
import { DynamicHeightListItem, SelectedIndexContext, ListItemActionsContext, UpdateListItemHeightContext } from './DynamicHeightListItem';
|
|
5
|
+
import { CellMeasurer, CellMeasurerCache } from 'react-virtualized/dist/commonjs/CellMeasurer';
|
|
6
|
+
import { List } from 'react-virtualized/dist/commonjs/List';
|
|
7
|
+
import { ICON_HEIGHT, ITEM_PADDING, TypeAheadListItem } from './TypeAheadListItem';
|
|
10
8
|
import { injectIntl } from 'react-intl-next';
|
|
11
9
|
import { typeAheadListMessages } from '../messages';
|
|
12
10
|
const LIST_ITEM_ESTIMATED_HEIGHT = ICON_HEIGHT + ITEM_PADDING * 2;
|
|
@@ -20,29 +18,18 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
|
|
|
20
18
|
fitHeight
|
|
21
19
|
}) => {
|
|
22
20
|
const listRef = useRef();
|
|
23
|
-
const redrawListAtIndex = useCallback(index => {
|
|
24
|
-
listRef.current.resetAfterIndex(index);
|
|
25
|
-
}, []);
|
|
26
21
|
const lastVisibleIndexes = useRef({
|
|
27
22
|
overscanStartIndex: 0,
|
|
28
23
|
overscanStopIndex: 0,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
const getFirstVisibleIndex = useCallback(() => {
|
|
33
|
-
return lastVisibleIndexes.current.overscanStartIndex;
|
|
34
|
-
}, []);
|
|
35
|
-
const {
|
|
36
|
-
getListItemHeight,
|
|
37
|
-
setListItemHeight,
|
|
38
|
-
renderedListHeight
|
|
39
|
-
} = useDynamicListHeightCalculation({
|
|
40
|
-
redrawListAtIndex,
|
|
41
|
-
getFirstVisibleIndex,
|
|
42
|
-
listLength: items.length,
|
|
43
|
-
listMaxHeight: fitHeight,
|
|
44
|
-
listItemEstimatedHeight: LIST_ITEM_ESTIMATED_HEIGHT
|
|
24
|
+
startIndex: 0,
|
|
25
|
+
stopIndex: 0
|
|
45
26
|
});
|
|
27
|
+
const estimatedHeight = items.length * LIST_ITEM_ESTIMATED_HEIGHT;
|
|
28
|
+
const [height, setHeight] = useState(Math.min(estimatedHeight, fitHeight));
|
|
29
|
+
const [cache, setCache] = useState(new CellMeasurerCache({
|
|
30
|
+
fixedWidth: true,
|
|
31
|
+
defaultHeight: LIST_ITEM_ESTIMATED_HEIGHT
|
|
32
|
+
}));
|
|
46
33
|
const onItemsRendered = useCallback(props => {
|
|
47
34
|
lastVisibleIndexes.current = props;
|
|
48
35
|
}, []);
|
|
@@ -72,66 +59,98 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
|
|
|
72
59
|
const {
|
|
73
60
|
current: indexes
|
|
74
61
|
} = lastVisibleIndexes;
|
|
75
|
-
const isSelectedItemVisible = selectedIndex >= indexes.
|
|
62
|
+
const isSelectedItemVisible = selectedIndex >= indexes.startIndex && selectedIndex <= indexes.stopIndex;
|
|
76
63
|
|
|
77
64
|
if (!isSelectedItemVisible) {
|
|
78
|
-
listRef.current.
|
|
65
|
+
listRef.current.scrollToRow(selectedIndex);
|
|
79
66
|
}
|
|
80
67
|
});
|
|
81
68
|
});
|
|
82
|
-
}, [selectedIndex]);
|
|
83
|
-
|
|
69
|
+
}, [selectedIndex, lastVisibleIndexes]);
|
|
70
|
+
useLayoutEffect(() => {
|
|
84
71
|
if (!listRef.current) {
|
|
85
72
|
return;
|
|
86
73
|
}
|
|
87
74
|
|
|
88
|
-
|
|
89
|
-
|
|
75
|
+
const {
|
|
76
|
+
current: indexes
|
|
77
|
+
} = lastVisibleIndexes;
|
|
78
|
+
const isSelectedItemVisible = selectedIndex >= indexes.startIndex && selectedIndex <= indexes.stopIndex;
|
|
79
|
+
|
|
80
|
+
if (!isSelectedItemVisible) {
|
|
81
|
+
listRef.current.scrollToRow(selectedIndex);
|
|
82
|
+
}
|
|
83
|
+
}, [selectedIndex, lastVisibleIndexes]);
|
|
90
84
|
useLayoutEffect(() => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
85
|
+
setCache(new CellMeasurerCache({
|
|
86
|
+
fixedWidth: true,
|
|
87
|
+
defaultHeight: LIST_ITEM_ESTIMATED_HEIGHT
|
|
88
|
+
}));
|
|
94
89
|
}, [items]);
|
|
90
|
+
useLayoutEffect(() => {
|
|
91
|
+
const height = Math.min(items.reduce((prevValue, currentValue, index) => {
|
|
92
|
+
return prevValue + cache.rowHeight({
|
|
93
|
+
index: index
|
|
94
|
+
});
|
|
95
|
+
}, 0), fitHeight);
|
|
96
|
+
setHeight(height);
|
|
97
|
+
}, [items, cache, fitHeight]);
|
|
98
|
+
|
|
99
|
+
const renderRow = ({
|
|
100
|
+
index,
|
|
101
|
+
key,
|
|
102
|
+
style,
|
|
103
|
+
parent
|
|
104
|
+
}) => {
|
|
105
|
+
return jsx(CellMeasurer, {
|
|
106
|
+
key: key,
|
|
107
|
+
cache: cache,
|
|
108
|
+
parent: parent,
|
|
109
|
+
columnIndex: 0,
|
|
110
|
+
rowIndex: index
|
|
111
|
+
}, jsx("div", {
|
|
112
|
+
style: style,
|
|
113
|
+
"data-index": index
|
|
114
|
+
}, jsx("div", {
|
|
115
|
+
"data-testid": `list-item-height-observed-${index}`
|
|
116
|
+
}, jsx(TypeAheadListItem, {
|
|
117
|
+
key: items[index].title,
|
|
118
|
+
item: items[index],
|
|
119
|
+
itemIndex: index,
|
|
120
|
+
selectedIndex: selectedIndex,
|
|
121
|
+
onItemClick: actions.onItemClick,
|
|
122
|
+
onItemHover: actions.onItemHover
|
|
123
|
+
}))));
|
|
124
|
+
};
|
|
95
125
|
|
|
96
126
|
if (!Array.isArray(items)) {
|
|
97
127
|
return null;
|
|
98
128
|
}
|
|
99
129
|
|
|
100
|
-
const estimatedHeight = items.length * LIST_ITEM_ESTIMATED_HEIGHT;
|
|
101
|
-
const height = Math.min(typeof renderedListHeight === 'number' ? renderedListHeight : estimatedHeight, fitHeight);
|
|
102
130
|
return jsx(MenuGroup, {
|
|
103
131
|
role: "listbox",
|
|
104
132
|
"aria-live": "polite",
|
|
105
133
|
"aria-label": intl.formatMessage(typeAheadListMessages.typeAheadResultLabel),
|
|
106
134
|
"aria-relevant": "additions removals"
|
|
107
|
-
}, jsx(ResizeObserverProvider, null, jsx(UpdateListItemHeightContext.Provider, {
|
|
108
|
-
value: setListItemHeight
|
|
109
|
-
}, jsx(ListItemActionsContext.Provider, {
|
|
110
|
-
value: actions
|
|
111
|
-
}, jsx(SelectedIndexContext.Provider, {
|
|
112
|
-
value: selectedIndex
|
|
113
135
|
}, jsx(List, {
|
|
114
|
-
|
|
136
|
+
rowRenderer: renderRow,
|
|
115
137
|
ref: listRef,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
onScroll: onScroll,
|
|
120
|
-
onItemsRendered: onItemsRendered,
|
|
121
|
-
itemSize: getListItemHeight,
|
|
138
|
+
rowCount: items.length,
|
|
139
|
+
rowHeight: cache.rowHeight,
|
|
140
|
+
onRowsRendered: onItemsRendered,
|
|
122
141
|
width: LIST_WIDTH,
|
|
142
|
+
onScroll: onScroll,
|
|
123
143
|
height: height,
|
|
124
|
-
|
|
144
|
+
overscanRowCount: 3,
|
|
125
145
|
css: css`
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}, DynamicHeightListItem))))));
|
|
146
|
+
button {
|
|
147
|
+
padding: 12px 12px 11px;
|
|
148
|
+
span:last-child span:last-child {
|
|
149
|
+
white-space: normal;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
`
|
|
153
|
+
}));
|
|
135
154
|
});
|
|
136
155
|
export const TypeAheadList = injectIntl(TypeAheadListComponent);
|
|
137
156
|
TypeAheadList.displayName = 'TypeAheadList';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useState, useLayoutEffect } from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import rafSchedule from 'raf-schd';
|
|
5
5
|
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
@@ -137,7 +137,7 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
|
|
|
137
137
|
return setFitHeight(minFitHeight);
|
|
138
138
|
}, [anchorElement, popupsMountPoint]);
|
|
139
139
|
const getFitHeightDebounced = rafSchedule(getFitHeight);
|
|
140
|
-
|
|
140
|
+
useLayoutEffect(() => {
|
|
141
141
|
const scrollableElement = popupsScrollableElement || findOverflowScrollParent(anchorElement);
|
|
142
142
|
getFitHeight();
|
|
143
143
|
window.addEventListener('resize', getFitHeightDebounced);
|
|
@@ -14,14 +14,18 @@ export default class ClickAreaBlock extends React.Component {
|
|
|
14
14
|
|
|
15
15
|
_defineProperty(this, "handleClick", event => {
|
|
16
16
|
const {
|
|
17
|
-
editorView: view
|
|
17
|
+
editorView: view,
|
|
18
|
+
editorDisabled
|
|
18
19
|
} = this.props;
|
|
19
20
|
|
|
20
21
|
if (!view) {
|
|
21
22
|
return;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
if (!editorDisabled) {
|
|
26
|
+
// if the editor is disabled -- we don't want to intercept any click events
|
|
27
|
+
clickAreaClickHandler(view, event);
|
|
28
|
+
}
|
|
25
29
|
});
|
|
26
30
|
}
|
|
27
31
|
|
|
@@ -40,14 +40,19 @@ export default class ClickAreaMobile extends React.Component {
|
|
|
40
40
|
|
|
41
41
|
_defineProperty(this, "handleClick", event => {
|
|
42
42
|
const {
|
|
43
|
-
editorView: view
|
|
43
|
+
editorView: view,
|
|
44
|
+
editorDisabled
|
|
44
45
|
} = this.props;
|
|
45
46
|
|
|
46
47
|
if (!view) {
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
if (!editorDisabled) {
|
|
52
|
+
// if the editor is disabled -- we don't want to intercept any click events
|
|
53
|
+
clickAreaClickHandler(view, event);
|
|
54
|
+
}
|
|
55
|
+
|
|
51
56
|
const scrollGutterClicked = event.clientY > view.dom.getBoundingClientRect().bottom; // Reset the default prosemirror scrollIntoView logic by
|
|
52
57
|
// clamping the scroll position to the bottom of the viewport.
|
|
53
58
|
|
|
@@ -80,14 +80,15 @@ const secondaryToolbarStyle = css`
|
|
|
80
80
|
`;
|
|
81
81
|
|
|
82
82
|
class Editor extends React.Component {
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
// Wrapper container for toolbar and content area
|
|
84
|
+
constructor(props) {
|
|
85
|
+
super(props);
|
|
85
86
|
|
|
86
87
|
_defineProperty(this, "appearance", 'comment');
|
|
87
88
|
|
|
88
89
|
_defineProperty(this, "containerElement", null);
|
|
89
90
|
|
|
90
|
-
_defineProperty(this, "
|
|
91
|
+
_defineProperty(this, "wrapperElementRef", /*#__PURE__*/React.createRef());
|
|
91
92
|
|
|
92
93
|
_defineProperty(this, "handleSave", () => {
|
|
93
94
|
if (this.props.editorView && this.props.onSave) {
|
|
@@ -137,7 +138,7 @@ class Editor extends React.Component {
|
|
|
137
138
|
min-height: ${minHeight}px;
|
|
138
139
|
`],
|
|
139
140
|
className: "akEditor",
|
|
140
|
-
ref:
|
|
141
|
+
ref: this.wrapperElementRef
|
|
141
142
|
}, jsx(MainToolbar, {
|
|
142
143
|
useStickyToolbar: useStickyToolbar
|
|
143
144
|
}, jsx(Toolbar, {
|
|
@@ -156,7 +157,8 @@ class Editor extends React.Component {
|
|
|
156
157
|
}), jsx("div", {
|
|
157
158
|
css: mainToolbarCustomComponentsSlotStyle
|
|
158
159
|
}, customPrimaryToolbarComponents)), jsx(ClickAreaBlock, {
|
|
159
|
-
editorView: editorView
|
|
160
|
+
editorView: editorView,
|
|
161
|
+
editorDisabled: disabled
|
|
160
162
|
}, jsx(WidthConsumer, null, ({
|
|
161
163
|
width
|
|
162
164
|
}) => {
|
|
@@ -181,7 +183,7 @@ class Editor extends React.Component {
|
|
|
181
183
|
popupsScrollableElement: popupsScrollableElement,
|
|
182
184
|
containerElement: this.containerElement,
|
|
183
185
|
disabled: !!disabled,
|
|
184
|
-
wrapperElement: this.
|
|
186
|
+
wrapperElement: this.wrapperElementRef.current
|
|
185
187
|
}), editorDOMElement);
|
|
186
188
|
})), jsx(WidthEmitter, {
|
|
187
189
|
editorView: editorView
|
|
@@ -203,6 +205,10 @@ class Editor extends React.Component {
|
|
|
203
205
|
}
|
|
204
206
|
}), customSecondaryToolbarComponents));
|
|
205
207
|
});
|
|
208
|
+
|
|
209
|
+
if (props.innerRef) {
|
|
210
|
+
this.wrapperElementRef = props.innerRef;
|
|
211
|
+
}
|
|
206
212
|
}
|
|
207
213
|
|
|
208
214
|
render() {
|
|
@@ -11,8 +11,9 @@ import { FullPageContentArea } from './FullPageContentArea';
|
|
|
11
11
|
import { FullPageToolbar } from './FullPageToolbar';
|
|
12
12
|
import { getFeatureFlags } from '../../../plugins/feature-flags-context';
|
|
13
13
|
export class FullPageEditor extends React.Component {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
// Wrapper container for toolbar and content area
|
|
15
|
+
constructor(props) {
|
|
16
|
+
super(props);
|
|
16
17
|
|
|
17
18
|
_defineProperty(this, "state", {
|
|
18
19
|
showKeyline: false
|
|
@@ -63,6 +64,10 @@ export class FullPageEditor extends React.Component {
|
|
|
63
64
|
_defineProperty(this, "handleResize", () => {
|
|
64
65
|
this.updateToolbarKeyline();
|
|
65
66
|
});
|
|
67
|
+
|
|
68
|
+
if (props.innerRef) {
|
|
69
|
+
this.wrapperElementRef = props.innerRef;
|
|
70
|
+
}
|
|
66
71
|
}
|
|
67
72
|
|
|
68
73
|
componentDidMount() {
|
|
@@ -25,7 +25,8 @@ const Content = /*#__PURE__*/React.memo(props => {
|
|
|
25
25
|
ref: props.scrollContainerRef,
|
|
26
26
|
className: "fabric-editor-popup-scroll-parent"
|
|
27
27
|
}, jsx(ClickAreaBlock, {
|
|
28
|
-
editorView: props.editorView
|
|
28
|
+
editorView: props.editorView,
|
|
29
|
+
editorDisabled: props.disabled
|
|
29
30
|
}, jsx("div", {
|
|
30
31
|
css: editorContentAreaStyle({
|
|
31
32
|
fullWidthMode,
|
|
@@ -5,12 +5,14 @@ export default function Mobile({
|
|
|
5
5
|
editorView,
|
|
6
6
|
maxHeight,
|
|
7
7
|
persistScrollGutter,
|
|
8
|
-
editorDOMElement
|
|
8
|
+
editorDOMElement,
|
|
9
|
+
disabled
|
|
9
10
|
}) {
|
|
10
11
|
return /*#__PURE__*/React.createElement(MobileAppearance, {
|
|
11
12
|
editorView: editorView || null,
|
|
12
13
|
maxHeight: maxHeight,
|
|
13
|
-
persistScrollGutter: persistScrollGutter
|
|
14
|
+
persistScrollGutter: persistScrollGutter,
|
|
15
|
+
editorDisabled: disabled
|
|
14
16
|
}, editorDOMElement, editorView && /*#__PURE__*/React.createElement(WidthEmitter, {
|
|
15
17
|
editorView: editorView
|
|
16
18
|
}));
|
|
@@ -25,9 +25,9 @@ const ContentArea = createEditorContentStyle();
|
|
|
25
25
|
ContentArea.displayName = 'ContentArea';
|
|
26
26
|
export function MobileAppearance({
|
|
27
27
|
editorView,
|
|
28
|
-
maxHeight,
|
|
29
28
|
persistScrollGutter,
|
|
30
|
-
children
|
|
29
|
+
children,
|
|
30
|
+
editorDisabled
|
|
31
31
|
}) {
|
|
32
32
|
const render = useCallback(({
|
|
33
33
|
maxContentSize,
|
|
@@ -71,11 +71,12 @@ export function MobileAppearance({
|
|
|
71
71
|
editorView: editorView || undefined,
|
|
72
72
|
minHeight: minHeight,
|
|
73
73
|
persistScrollGutter: persistScrollGutter,
|
|
74
|
-
isExpanded: currentIsExpanded
|
|
74
|
+
isExpanded: currentIsExpanded,
|
|
75
|
+
editorDisabled: editorDisabled
|
|
75
76
|
}, jsx(ContentArea, null, jsx("div", {
|
|
76
77
|
className: "ak-editor-content-area"
|
|
77
78
|
}, children)))));
|
|
78
|
-
}, [children, editorView, persistScrollGutter]);
|
|
79
|
+
}, [children, editorView, persistScrollGutter, editorDisabled]);
|
|
79
80
|
return jsx(WithPluginState, {
|
|
80
81
|
plugins: {
|
|
81
82
|
maxContentSize: maxContentSizePluginKey,
|
|
@@ -10,7 +10,7 @@ import { N0, DN50, DN600, N50A, N60A, N900 } from '@atlaskit/theme/colors';
|
|
|
10
10
|
import { themed } from '@atlaskit/theme/components';
|
|
11
11
|
import { token } from '@atlaskit/tokens';
|
|
12
12
|
const packageName = "@atlaskit/editor-core";
|
|
13
|
-
const packageVersion = "172.0
|
|
13
|
+
const packageVersion = "172.1.0";
|
|
14
14
|
const halfFocusRing = 1;
|
|
15
15
|
const dropOffset = `0, ${gridSize()}px`;
|
|
16
16
|
|
|
@@ -25,14 +25,12 @@ const buttonStyles = isActive => theme => {
|
|
|
25
25
|
/**
|
|
26
26
|
* Hack for item to imitate old dropdown-menu selected styles
|
|
27
27
|
*/
|
|
28
|
-
// TODO: https://product-fabric.atlassian.net/browse/DSP-4500
|
|
29
|
-
|
|
30
|
-
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
31
28
|
return css`
|
|
32
29
|
> span,
|
|
33
|
-
> span:hover
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
> span:hover,
|
|
31
|
+
> span:active {
|
|
32
|
+
background: ${token('color.background.selected', '#6c798f')};
|
|
33
|
+
color: ${token('color.text', '#fff')};
|
|
36
34
|
}
|
|
37
35
|
`;
|
|
38
36
|
} else {
|
|
@@ -45,6 +43,12 @@ const buttonStyles = isActive => theme => {
|
|
|
45
43
|
background-color: ${themed({
|
|
46
44
|
light: token('color.background.neutral.subtle.hovered', 'rgb(244, 245, 247)'),
|
|
47
45
|
dark: token('color.background.neutral.subtle.hovered', 'rgb(59, 71, 92)')
|
|
46
|
+
})(theme)};
|
|
47
|
+
}
|
|
48
|
+
> span:active[aria-disabled='false'] {
|
|
49
|
+
background-color: ${themed({
|
|
50
|
+
light: token('color.background.neutral.subtle.pressed', 'rgb(179, 212, 255)'),
|
|
51
|
+
dark: token('color.background.neutral.subtle.pressed', 'rgb(179, 212, 255)')
|
|
48
52
|
})(theme)};
|
|
49
53
|
}
|
|
50
54
|
> span[aria-disabled='true'] {
|
|
@@ -2,53 +2,103 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { PureComponent } from 'react';
|
|
4
4
|
import ReactDOM from 'react-dom';
|
|
5
|
-
|
|
6
|
-
return class WithOutsideClick extends PureComponent {
|
|
7
|
-
constructor(...args) {
|
|
8
|
-
super(...args);
|
|
5
|
+
import ReactEditorViewContext from '../create-editor/ReactEditorViewContext';
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
class WithOutsideClick extends PureComponent {
|
|
8
|
+
constructor(...args) {
|
|
9
|
+
super(...args);
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
});
|
|
11
|
+
_defineProperty(this, "handleClick", evt => {
|
|
12
|
+
if (!this.props.isActiveComponent) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
19
15
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.props.
|
|
16
|
+
const domNode = ReactDOM.findDOMNode(this); // eslint-disable-line react/no-find-dom-node
|
|
17
|
+
|
|
18
|
+
if (!domNode || evt.target instanceof Node && !domNode.contains(evt.target)) {
|
|
19
|
+
if (this.props.handleClickOutside) {
|
|
20
|
+
this.props.handleClickOutside(evt);
|
|
25
21
|
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
28
24
|
|
|
29
|
-
|
|
30
|
-
if (this.props.
|
|
31
|
-
|
|
25
|
+
_defineProperty(this, "handleKeydown", evt => {
|
|
26
|
+
if (!this.props.isActiveComponent) {
|
|
27
|
+
return;
|
|
32
28
|
}
|
|
33
29
|
|
|
34
|
-
if (this.props.handleEscapeKeydown) {
|
|
35
|
-
|
|
30
|
+
if (evt.code === 'Escape' && this.props.handleEscapeKeydown) {
|
|
31
|
+
var _this$props$editorVie;
|
|
32
|
+
|
|
33
|
+
evt.preventDefault();
|
|
34
|
+
evt.stopPropagation();
|
|
35
|
+
this.props.handleEscapeKeydown(evt);
|
|
36
|
+
|
|
37
|
+
if (!((_this$props$editorVie = this.props.editorView) !== null && _this$props$editorVie !== void 0 && _this$props$editorVie.hasFocus())) {
|
|
38
|
+
var _this$props$editorVie2;
|
|
39
|
+
|
|
40
|
+
(_this$props$editorVie2 = this.props.editorView) === null || _this$props$editorVie2 === void 0 ? void 0 : _this$props$editorVie2.focus();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return false;
|
|
44
|
+
} else if (evt.code === 'Enter' && this.props.handleEnterKeydown) {
|
|
45
|
+
this.props.handleEnterKeydown(evt);
|
|
36
46
|
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
componentDidMount() {
|
|
51
|
+
if (this.props.handleClickOutside) {
|
|
52
|
+
document.addEventListener('click', this.handleClick, false);
|
|
37
53
|
}
|
|
38
54
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
document.removeEventListener('click', this.handleClick, false);
|
|
42
|
-
}
|
|
55
|
+
if (this.props.handleEscapeKeydown) {
|
|
56
|
+
var _this$props$editorRef;
|
|
43
57
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
58
|
+
(((_this$props$editorRef = this.props.editorRef) === null || _this$props$editorRef === void 0 ? void 0 : _this$props$editorRef.current) || document).addEventListener('keydown', this.handleKeydown, false);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
componentWillUnmount() {
|
|
63
|
+
if (this.props.handleClickOutside) {
|
|
64
|
+
document.removeEventListener('click', this.handleClick, false);
|
|
47
65
|
}
|
|
48
66
|
|
|
49
|
-
|
|
50
|
-
|
|
67
|
+
if (this.props.handleEscapeKeydown) {
|
|
68
|
+
var _this$props$editorRef2;
|
|
69
|
+
|
|
70
|
+
(((_this$props$editorRef2 = this.props.editorRef) === null || _this$props$editorRef2 === void 0 ? void 0 : _this$props$editorRef2.current) || document).removeEventListener('keydown', this.handleKeydown, false);
|
|
51
71
|
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
render() {
|
|
75
|
+
return this.props.children;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
}
|
|
52
79
|
|
|
80
|
+
function hasIsOpen(props) {
|
|
81
|
+
return 'isOpen' in props;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export default function withOuterListeners(Component) {
|
|
85
|
+
return ({
|
|
86
|
+
handleClickOutside,
|
|
87
|
+
handleEnterKeydown,
|
|
88
|
+
handleEscapeKeydown,
|
|
89
|
+
...props
|
|
90
|
+
}) => {
|
|
91
|
+
const isActiveComponent = hasIsOpen(props) ? props.isOpen : true;
|
|
92
|
+
return /*#__PURE__*/React.createElement(ReactEditorViewContext.Consumer, null, ({
|
|
93
|
+
editorView,
|
|
94
|
+
editorRef
|
|
95
|
+
}) => /*#__PURE__*/React.createElement(WithOutsideClick, {
|
|
96
|
+
editorView: editorView,
|
|
97
|
+
editorRef: editorRef,
|
|
98
|
+
isActiveComponent: isActiveComponent,
|
|
99
|
+
handleClickOutside: handleClickOutside,
|
|
100
|
+
handleEnterKeydown: handleEnterKeydown,
|
|
101
|
+
handleEscapeKeydown: handleEscapeKeydown
|
|
102
|
+
}, /*#__PURE__*/React.createElement(Component, props)));
|
|
53
103
|
};
|
|
54
104
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { nextMajorVersion } from '../version-wrapper';
|
|
2
2
|
|
|
3
3
|
const deprecationWarnings = (className, props, deprecations) => {
|
|
4
|
+
if (process.env.NODE_ENV === 'production') {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
|
|
4
8
|
const nextVersion = nextMajorVersion();
|
|
5
9
|
|
|
6
10
|
for (const deprecation of deprecations) {
|
|
@@ -10,6 +10,31 @@ export const buildEditLinkPayload = type => {
|
|
|
10
10
|
eventType: EVENT_TYPE.UI
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
+
|
|
14
|
+
const mapLinkTypeToCardAppearance = type => {
|
|
15
|
+
switch (type) {
|
|
16
|
+
case ACTION_SUBJECT_ID.CARD_INLINE:
|
|
17
|
+
{
|
|
18
|
+
return 'inline';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
case ACTION_SUBJECT_ID.CARD_BLOCK:
|
|
22
|
+
{
|
|
23
|
+
return 'block';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
case ACTION_SUBJECT_ID.EMBEDS:
|
|
27
|
+
{
|
|
28
|
+
return 'embed';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
default:
|
|
32
|
+
{
|
|
33
|
+
return 'url';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
13
38
|
export const buildVisitedLinkPayload = type => {
|
|
14
39
|
return type === ACTION_SUBJECT_ID.HYPERLINK ? {
|
|
15
40
|
action: ACTION.VISITED,
|
|
@@ -29,6 +54,18 @@ export const buildVisitedLinkPayload = type => {
|
|
|
29
54
|
eventType: EVENT_TYPE.TRACK
|
|
30
55
|
};
|
|
31
56
|
};
|
|
57
|
+
export const buildOpenedSettingsPayload = type => {
|
|
58
|
+
return {
|
|
59
|
+
action: ACTION.CLICKED,
|
|
60
|
+
actionSubject: ACTION_SUBJECT.BUTTON,
|
|
61
|
+
actionSubjectId: ACTION_SUBJECT_ID.GOTO_SMART_LINK_SETTINGS,
|
|
62
|
+
attributes: {
|
|
63
|
+
inputMethod: INPUT_METHOD.TOOLBAR,
|
|
64
|
+
display: mapLinkTypeToCardAppearance(type)
|
|
65
|
+
},
|
|
66
|
+
eventType: EVENT_TYPE.UI
|
|
67
|
+
};
|
|
68
|
+
};
|
|
32
69
|
export const unlinkPayload = type => {
|
|
33
70
|
return {
|
|
34
71
|
action: ACTION.UNLINK,
|
package/dist/es2019/version.json
CHANGED