@atlaskit/editor-core 172.3.2 → 173.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 +52 -0
- package/dist/cjs/index.js +0 -6
- package/dist/cjs/plugins/base/index.js +8 -0
- package/dist/cjs/plugins/base/pm-plugins/composition.js +60 -0
- package/dist/cjs/plugins/breakout/index.js +5 -4
- package/dist/cjs/plugins/breakout/ui/LayoutButton.js +1 -3
- package/dist/cjs/plugins/card/pm-plugins/doc.js +8 -1
- package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +2 -36
- package/dist/cjs/plugins/collab-edit/plugin-state.js +16 -9
- package/dist/cjs/plugins/collab-edit/utils.js +16 -2
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +24 -22
- package/dist/cjs/plugins/floating-toolbar/ui/Dropdown.js +20 -15
- package/dist/cjs/plugins/floating-toolbar/ui/DropdownMenu.js +8 -5
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +3 -3
- package/dist/cjs/plugins/paste/actions.js +13 -0
- package/dist/cjs/plugins/paste/commands.js +44 -0
- package/dist/cjs/plugins/paste/handlers.js +48 -7
- package/dist/cjs/plugins/paste/index.js +3 -2
- package/dist/cjs/plugins/paste/pm-plugins/main.js +34 -9
- package/dist/cjs/plugins/paste/pm-plugins/plugin-factory.js +62 -0
- package/dist/cjs/plugins/paste/reducer.js +47 -0
- package/dist/cjs/plugins/paste/types.js +5 -0
- package/dist/cjs/plugins/placeholder/index.js +3 -1
- package/dist/cjs/plugins/placeholder-text/index.js +9 -3
- package/dist/cjs/plugins/status/ui/statusPicker.js +4 -1
- package/dist/cjs/plugins/table/commands-with-analytics.js +59 -52
- package/dist/cjs/plugins/table/index.js +53 -36
- package/dist/cjs/plugins/table/toolbar.js +136 -20
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
- package/dist/cjs/plugins/tasks-and-decisions/commands.js +1 -16
- package/dist/cjs/plugins/type-ahead/constants.js +3 -1
- package/dist/cjs/plugins/type-ahead/messages.js +16 -1
- package/dist/cjs/plugins/type-ahead/pm-plugins/main.js +1 -1
- package/dist/cjs/plugins/type-ahead/pm-plugins/reducer.js +2 -2
- package/dist/cjs/plugins/type-ahead/ui/AssistiveText.js +143 -0
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +59 -11
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +156 -31
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadListItem.js +55 -29
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +3 -3
- package/dist/cjs/plugins/type-ahead/ui/WrapperTypeAhead.js +5 -2
- package/dist/cjs/plugins/type-ahead/utils.js +1 -1
- package/dist/cjs/ui/MediaAndEmbedsToolbar/index.js +8 -0
- package/dist/cjs/ui/PortalProvider/PortalProviderThemesProvider.js +2 -6
- package/dist/cjs/ui/PortalProvider/index.js +26 -32
- package/dist/cjs/utils/index.js +8 -1
- package/dist/cjs/utils/selection.js +6 -8
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/plugins/base/index.js +5 -0
- package/dist/es2019/plugins/base/pm-plugins/composition.js +45 -0
- package/dist/es2019/plugins/breakout/index.js +5 -4
- package/dist/es2019/plugins/breakout/ui/LayoutButton.js +1 -3
- package/dist/es2019/plugins/card/pm-plugins/doc.js +10 -1
- package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +3 -40
- package/dist/es2019/plugins/collab-edit/plugin-state.js +9 -3
- package/dist/es2019/plugins/collab-edit/utils.js +17 -3
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +24 -22
- package/dist/es2019/plugins/floating-toolbar/ui/Dropdown.js +15 -7
- package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +9 -5
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +3 -3
- package/dist/es2019/plugins/paste/actions.js +6 -0
- package/dist/es2019/plugins/paste/commands.js +27 -0
- package/dist/es2019/plugins/paste/handlers.js +50 -8
- package/dist/es2019/plugins/paste/index.js +3 -2
- package/dist/es2019/plugins/paste/pm-plugins/main.js +29 -6
- package/dist/es2019/plugins/paste/pm-plugins/plugin-factory.js +33 -0
- package/dist/es2019/plugins/paste/reducer.js +24 -0
- package/dist/es2019/plugins/paste/types.js +1 -0
- package/dist/es2019/plugins/placeholder/index.js +2 -1
- package/dist/es2019/plugins/placeholder-text/index.js +13 -3
- package/dist/es2019/plugins/status/ui/statusPicker.js +5 -1
- package/dist/es2019/plugins/table/commands-with-analytics.js +6 -3
- package/dist/es2019/plugins/table/index.js +22 -4
- package/dist/es2019/plugins/table/toolbar.js +118 -14
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
- package/dist/es2019/plugins/tasks-and-decisions/commands.js +0 -9
- package/dist/es2019/plugins/type-ahead/constants.js +1 -0
- package/dist/es2019/plugins/type-ahead/messages.js +16 -1
- package/dist/es2019/plugins/type-ahead/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/type-ahead/pm-plugins/reducer.js +2 -2
- package/dist/es2019/plugins/type-ahead/ui/AssistiveText.js +95 -0
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +49 -12
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +143 -29
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +64 -31
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +3 -3
- package/dist/es2019/plugins/type-ahead/ui/WrapperTypeAhead.js +5 -2
- package/dist/es2019/plugins/type-ahead/utils.js +1 -1
- package/dist/es2019/ui/MediaAndEmbedsToolbar/index.js +17 -0
- package/dist/es2019/ui/PortalProvider/PortalProviderThemesProvider.js +2 -5
- package/dist/es2019/ui/PortalProvider/index.js +5 -8
- package/dist/es2019/utils/index.js +6 -0
- package/dist/es2019/utils/selection.js +1 -9
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/plugins/base/index.js +7 -0
- package/dist/esm/plugins/base/pm-plugins/composition.js +45 -0
- package/dist/esm/plugins/breakout/index.js +5 -4
- package/dist/esm/plugins/breakout/ui/LayoutButton.js +1 -3
- package/dist/esm/plugins/card/pm-plugins/doc.js +8 -1
- package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +3 -37
- package/dist/esm/plugins/collab-edit/plugin-state.js +9 -3
- package/dist/esm/plugins/collab-edit/utils.js +17 -3
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +24 -22
- package/dist/esm/plugins/floating-toolbar/ui/Dropdown.js +20 -15
- package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +8 -5
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +3 -3
- package/dist/esm/plugins/paste/actions.js +6 -0
- package/dist/esm/plugins/paste/commands.js +31 -0
- package/dist/esm/plugins/paste/handlers.js +46 -8
- package/dist/esm/plugins/paste/index.js +3 -2
- package/dist/esm/plugins/paste/pm-plugins/main.js +27 -6
- package/dist/esm/plugins/paste/pm-plugins/plugin-factory.js +46 -0
- package/dist/esm/plugins/paste/reducer.js +34 -0
- package/dist/esm/plugins/paste/types.js +1 -0
- package/dist/esm/plugins/placeholder/index.js +2 -1
- package/dist/esm/plugins/placeholder-text/index.js +9 -3
- package/dist/esm/plugins/status/ui/statusPicker.js +4 -1
- package/dist/esm/plugins/table/commands-with-analytics.js +56 -49
- package/dist/esm/plugins/table/index.js +54 -37
- package/dist/esm/plugins/table/toolbar.js +124 -15
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
- package/dist/esm/plugins/tasks-and-decisions/commands.js +0 -12
- package/dist/esm/plugins/type-ahead/constants.js +1 -0
- package/dist/esm/plugins/type-ahead/messages.js +16 -1
- package/dist/esm/plugins/type-ahead/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/type-ahead/pm-plugins/reducer.js +2 -2
- package/dist/esm/plugins/type-ahead/ui/AssistiveText.js +129 -0
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +56 -12
- package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +151 -32
- package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +54 -31
- package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +3 -3
- package/dist/esm/plugins/type-ahead/ui/WrapperTypeAhead.js +5 -2
- package/dist/esm/plugins/type-ahead/utils.js +1 -1
- package/dist/esm/ui/MediaAndEmbedsToolbar/index.js +7 -0
- package/dist/esm/ui/PortalProvider/PortalProviderThemesProvider.js +2 -5
- package/dist/esm/ui/PortalProvider/index.js +26 -35
- package/dist/esm/utils/index.js +4 -0
- package/dist/esm/utils/selection.js +1 -7
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/plugins/base/pm-plugins/composition.d.ts +8 -0
- package/dist/types/plugins/code-block/pm-plugins/ide-ux.d.ts +1 -4
- package/dist/types/plugins/floating-toolbar/ui/Dropdown.d.ts +2 -0
- package/dist/types/plugins/floating-toolbar/ui/DropdownMenu.d.ts +1 -0
- package/dist/types/plugins/paste/actions.d.ts +15 -0
- package/dist/types/plugins/paste/commands.d.ts +16 -0
- package/dist/types/plugins/paste/handlers.d.ts +1 -1
- package/dist/types/plugins/paste/pm-plugins/main.d.ts +3 -3
- package/dist/types/plugins/paste/pm-plugins/plugin-factory.d.ts +3 -0
- package/dist/types/plugins/paste/reducer.d.ts +3 -0
- package/dist/types/plugins/paste/types.d.ts +6 -0
- package/dist/types/plugins/table/commands-with-analytics.d.ts +5 -5
- package/dist/types/plugins/tasks-and-decisions/commands.d.ts +0 -2
- package/dist/types/plugins/type-ahead/constants.d.ts +1 -0
- package/dist/types/plugins/type-ahead/messages.d.ts +15 -0
- package/dist/types/plugins/type-ahead/ui/AssistiveText.d.ts +33 -0
- package/dist/types/plugins/type-ahead/ui/InputQuery.d.ts +3 -0
- package/dist/types/plugins/type-ahead/ui/TypeAheadList.d.ts +6 -3
- package/dist/types/plugins/type-ahead/ui/TypeAheadListItem.d.ts +2 -2
- package/dist/types/plugins/type-ahead/ui/TypeAheadPopup.d.ts +1 -1
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/selection.d.ts +1 -2
- package/dist/types-ts4.0/index.d.ts +1 -1
- package/dist/types-ts4.0/plugins/base/pm-plugins/composition.d.ts +8 -0
- package/dist/types-ts4.0/plugins/code-block/pm-plugins/ide-ux.d.ts +1 -4
- package/dist/types-ts4.0/plugins/floating-toolbar/ui/Dropdown.d.ts +2 -0
- package/dist/types-ts4.0/plugins/floating-toolbar/ui/DropdownMenu.d.ts +1 -0
- package/dist/types-ts4.0/plugins/paste/actions.d.ts +15 -0
- package/dist/types-ts4.0/plugins/paste/commands.d.ts +16 -0
- package/dist/types-ts4.0/plugins/paste/handlers.d.ts +1 -1
- package/dist/types-ts4.0/plugins/paste/pm-plugins/main.d.ts +3 -3
- package/dist/types-ts4.0/plugins/paste/pm-plugins/plugin-factory.d.ts +3 -0
- package/dist/types-ts4.0/plugins/paste/reducer.d.ts +3 -0
- package/dist/types-ts4.0/plugins/paste/types.d.ts +6 -0
- package/dist/types-ts4.0/plugins/table/commands-with-analytics.d.ts +5 -5
- package/dist/types-ts4.0/plugins/tasks-and-decisions/commands.d.ts +0 -2
- package/dist/types-ts4.0/plugins/type-ahead/constants.d.ts +1 -0
- package/dist/types-ts4.0/plugins/type-ahead/messages.d.ts +15 -0
- package/dist/types-ts4.0/plugins/type-ahead/ui/AssistiveText.d.ts +33 -0
- package/dist/types-ts4.0/plugins/type-ahead/ui/InputQuery.d.ts +3 -0
- package/dist/types-ts4.0/plugins/type-ahead/ui/TypeAheadList.d.ts +6 -3
- package/dist/types-ts4.0/plugins/type-ahead/ui/TypeAheadListItem.d.ts +2 -2
- package/dist/types-ts4.0/plugins/type-ahead/ui/TypeAheadPopup.d.ts +1 -1
- package/dist/types-ts4.0/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
- package/dist/types-ts4.0/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.0/utils/index.d.ts +1 -0
- package/dist/types-ts4.0/utils/selection.d.ts +1 -2
- package/package.json +30 -31
- package/report.api.md +161 -49
|
@@ -33,7 +33,7 @@ var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
|
33
33
|
|
|
34
34
|
var _tokens = require("@atlaskit/tokens");
|
|
35
35
|
|
|
36
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
36
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
37
37
|
|
|
38
38
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
39
39
|
|
|
@@ -57,9 +57,23 @@ var itemText = function itemText(theme) {
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
var itemAfter = (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n flex: 0 0 auto;\n"])));
|
|
60
|
-
var
|
|
61
|
-
|
|
60
|
+
var customRenderItemDivStyle = (0, _react2.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n overflow: hidden;\n &:hover {\n background-color: ", ";\n }\n &:focus {\n box-shadow: inset 0px 0px 0px 2px ", ";\n outline: none;\n }\n"])), (0, _tokens.token)('color.background.selected', _colors.N30), (0, _tokens.token)('color.border.focused', _colors.B100));
|
|
61
|
+
/**
|
|
62
|
+
* This CSS emulates the desired behaviour with :focus-visible for firefox.
|
|
63
|
+
* Firefox unfortunately does not register keyboard focus if user mouseDown and drag a typeahead item
|
|
64
|
+
* resulting in focus-visible style not drawn.
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
var selectionFrame = {
|
|
68
|
+
'& > button:focus': {
|
|
69
|
+
boxShadow: "inset 0px 0px 0px 2px ".concat((0, _tokens.token)('color.border.focused', _colors.B100)),
|
|
70
|
+
outline: 'none',
|
|
71
|
+
'&:active': {
|
|
72
|
+
boxShadow: 'none'
|
|
73
|
+
}
|
|
74
|
+
}
|
|
62
75
|
};
|
|
76
|
+
var selectedStyle = (0, _react2.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n background-color: ", ";\n"])), (0, _tokens.token)('color.background.selected', _colors.N30));
|
|
63
77
|
|
|
64
78
|
var FallbackIcon = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
65
79
|
var label = _ref.label;
|
|
@@ -70,31 +84,16 @@ var noop = function noop() {};
|
|
|
70
84
|
|
|
71
85
|
var TypeAheadListItem = function TypeAheadListItem(_ref2) {
|
|
72
86
|
var item = _ref2.item,
|
|
87
|
+
itemsLength = _ref2.itemsLength,
|
|
73
88
|
selectedIndex = _ref2.selectedIndex,
|
|
74
|
-
onItemHover = _ref2.onItemHover,
|
|
75
89
|
onItemClick = _ref2.onItemClick,
|
|
76
90
|
itemIndex = _ref2.itemIndex;
|
|
77
|
-
var isSelected = itemIndex === selectedIndex; // It's possible for onMouseMove to be called multiple times in quick
|
|
78
|
-
// succession because the mousemove event can fire very rapidly. This
|
|
79
|
-
// provides an additional safety net to prevent that.
|
|
80
|
-
|
|
81
|
-
var mouseMoveCalled = (0, _react.useRef)(false);
|
|
82
|
-
var onMouseMove = (0, _react.useCallback)(function () {
|
|
83
|
-
if (isSelected || mouseMoveCalled.current) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
91
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}, [item, itemIndex, onItemHover, isSelected]);
|
|
93
|
-
(0, _react.useLayoutEffect)(function () {
|
|
94
|
-
if (!isSelected) {
|
|
95
|
-
mouseMoveCalled.current = false;
|
|
96
|
-
}
|
|
97
|
-
}, [isSelected]);
|
|
92
|
+
/**
|
|
93
|
+
* To select and highlight the first Item when no item is selected
|
|
94
|
+
* However selectedIndex remains -1, So that user does not skip the first item when down arrow key is used from typeahead query(inputQuery.tsx)
|
|
95
|
+
*/
|
|
96
|
+
var isSelected = itemIndex === selectedIndex || selectedIndex === -1 && itemIndex === 0;
|
|
98
97
|
var icon = item.icon,
|
|
99
98
|
title = item.title,
|
|
100
99
|
customRenderItem = item.render;
|
|
@@ -108,39 +107,66 @@ var TypeAheadListItem = function TypeAheadListItem(_ref2) {
|
|
|
108
107
|
var insertSelectedItem = (0, _react.useCallback)(function () {
|
|
109
108
|
onItemClick(_typeAhead.SelectItemMode.SELECTED, itemIndex);
|
|
110
109
|
}, [onItemClick, itemIndex]);
|
|
110
|
+
|
|
111
|
+
var customItemRef = /*#__PURE__*/_react.default.createRef();
|
|
112
|
+
|
|
113
|
+
var buttonItemRef = /*#__PURE__*/_react.default.createRef();
|
|
114
|
+
|
|
115
|
+
var shouldUpdateFocus = selectedIndex === itemIndex;
|
|
116
|
+
(0, _react.useLayoutEffect)(function () {
|
|
117
|
+
if (shouldUpdateFocus) {
|
|
118
|
+
var _customItemRef$curren;
|
|
119
|
+
|
|
120
|
+
customItemRef === null || customItemRef === void 0 ? void 0 : (_customItemRef$curren = customItemRef.current) === null || _customItemRef$curren === void 0 ? void 0 : _customItemRef$curren.focus();
|
|
121
|
+
}
|
|
122
|
+
}, [customItemRef, shouldUpdateFocus]);
|
|
123
|
+
(0, _react.useLayoutEffect)(function () {
|
|
124
|
+
if (shouldUpdateFocus) {
|
|
125
|
+
var _buttonItemRef$curren;
|
|
126
|
+
|
|
127
|
+
buttonItemRef === null || buttonItemRef === void 0 ? void 0 : (_buttonItemRef$curren = buttonItemRef.current) === null || _buttonItemRef$curren === void 0 ? void 0 : _buttonItemRef$curren.focus();
|
|
128
|
+
}
|
|
129
|
+
}, [buttonItemRef, shouldUpdateFocus]);
|
|
111
130
|
var customItem = (0, _react.useMemo)(function () {
|
|
112
131
|
if (!customRenderItem) {
|
|
113
132
|
return null;
|
|
114
133
|
}
|
|
115
134
|
|
|
116
135
|
var Comp = customRenderItem;
|
|
136
|
+
var listItemClasses = [customRenderItemDivStyle, isSelected && selectedStyle];
|
|
117
137
|
return (0, _react2.jsx)("div", {
|
|
118
138
|
"aria-selected": isSelected,
|
|
119
139
|
"aria-label": title,
|
|
120
140
|
role: "option",
|
|
141
|
+
"aria-setsize": itemsLength,
|
|
121
142
|
tabIndex: 0,
|
|
122
|
-
|
|
123
|
-
|
|
143
|
+
css: listItemClasses,
|
|
144
|
+
className: "ak-typeahead-item ".concat(isSelected ? 'typeahead-selected-item' : '') //CSS classes added for test cases purpose
|
|
145
|
+
,
|
|
146
|
+
ref: customItemRef
|
|
124
147
|
}, (0, _react2.jsx)(Comp, {
|
|
125
148
|
onClick: insertSelectedItem,
|
|
126
|
-
isSelected: isSelected
|
|
149
|
+
isSelected: false //The selection styles are handled in the parent div instead. Hence isSelected is made false always.
|
|
150
|
+
,
|
|
127
151
|
onHover: noop
|
|
128
152
|
}));
|
|
129
|
-
}, [customRenderItem, insertSelectedItem,
|
|
153
|
+
}, [customRenderItem, insertSelectedItem, isSelected, title, customItemRef, itemsLength]);
|
|
130
154
|
|
|
131
155
|
if (customItem) {
|
|
132
156
|
return customItem;
|
|
133
157
|
}
|
|
134
158
|
|
|
135
159
|
return (0, _react2.jsx)("span", {
|
|
136
|
-
|
|
160
|
+
css: selectionFrame
|
|
137
161
|
}, (0, _react2.jsx)(_menu.ButtonItem, {
|
|
138
162
|
onClick: insertSelectedItem,
|
|
139
163
|
iconBefore: elementIcon,
|
|
140
164
|
isSelected: isSelected,
|
|
141
165
|
"aria-selected": isSelected,
|
|
142
166
|
"aria-label": item.title,
|
|
167
|
+
"aria-setsize": itemsLength,
|
|
143
168
|
role: "option",
|
|
169
|
+
ref: buttonItemRef,
|
|
144
170
|
description: item.description
|
|
145
171
|
}, (0, _react2.jsx)("div", {
|
|
146
172
|
css: itemBody
|
|
@@ -69,7 +69,6 @@ var TypeAheadPopup = /*#__PURE__*/_react.default.memo(function (props) {
|
|
|
69
69
|
popupsScrollableElement = props.popupsScrollableElement,
|
|
70
70
|
items = props.items,
|
|
71
71
|
selectedIndex = props.selectedIndex,
|
|
72
|
-
setSelectedItem = props.setSelectedItem,
|
|
73
72
|
onItemInsert = props.onItemInsert,
|
|
74
73
|
fireAnalyticsCallback = props.fireAnalyticsCallback,
|
|
75
74
|
isEmptyQuery = props.isEmptyQuery;
|
|
@@ -203,9 +202,10 @@ var TypeAheadPopup = /*#__PURE__*/_react.default.memo(function (props) {
|
|
|
203
202
|
}), (0, _react2.jsx)(_TypeAheadList.TypeAheadList, {
|
|
204
203
|
items: items,
|
|
205
204
|
selectedIndex: selectedIndex,
|
|
206
|
-
onItemHover: setSelectedItem,
|
|
207
205
|
onItemClick: onItemInsert,
|
|
208
|
-
fitHeight: fitHeight
|
|
206
|
+
fitHeight: fitHeight,
|
|
207
|
+
editorView: editorView,
|
|
208
|
+
decorationElement: anchorElement
|
|
209
209
|
})));
|
|
210
210
|
});
|
|
211
211
|
|
|
@@ -144,8 +144,11 @@ var WrapperTypeAhead = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
144
144
|
cancel: cancel,
|
|
145
145
|
forceFocus: shouldFocusCursorInsideQuery,
|
|
146
146
|
onUndoRedo: onUndoRedo,
|
|
147
|
-
reopenQuery: reopenQuery
|
|
147
|
+
reopenQuery: reopenQuery,
|
|
148
|
+
editorView: editorView,
|
|
149
|
+
items: items
|
|
148
150
|
});
|
|
149
151
|
});
|
|
150
152
|
|
|
151
|
-
exports.WrapperTypeAhead = WrapperTypeAhead;
|
|
153
|
+
exports.WrapperTypeAhead = WrapperTypeAhead;
|
|
154
|
+
WrapperTypeAhead.displayName = 'WrapperTypeAhead';
|
|
@@ -128,7 +128,7 @@ var moveSelectedIndex = function moveSelectedIndex(_ref2) {
|
|
|
128
128
|
var selectedIndex = typeAheadState.selectedIndex,
|
|
129
129
|
items = typeAheadState.items;
|
|
130
130
|
var stats = typeAheadState.stats instanceof _statsModifier.StatsModifier ? typeAheadState.stats : new _statsModifier.StatsModifier();
|
|
131
|
-
var nextIndex
|
|
131
|
+
var nextIndex;
|
|
132
132
|
|
|
133
133
|
if (direction === 'next') {
|
|
134
134
|
stats.increaseArrowDown();
|
|
@@ -41,6 +41,8 @@ var _analytics = require("../../plugins/analytics");
|
|
|
41
41
|
|
|
42
42
|
var _toolbarMessages = require("./toolbar-messages");
|
|
43
43
|
|
|
44
|
+
var _utils2 = require("../../utils");
|
|
45
|
+
|
|
44
46
|
var alignmentIcons = [{
|
|
45
47
|
id: 'editor.media.alignLeft',
|
|
46
48
|
value: 'align-start',
|
|
@@ -114,6 +116,12 @@ var makeAlign = function makeAlign(layout, nodeType) {
|
|
|
114
116
|
// setNodeMarkup is called
|
|
115
117
|
|
|
116
118
|
tr.setSelection(_prosemirrorState.NodeSelection.create(tr.doc, state.selection.from));
|
|
119
|
+
var paragraph = tr.doc.type.schema.nodes.paragraph; // see https://product-fabric.atlassian.net/browse/ED-15518 insert a new paragraph when an embedded card is wrapped left or right
|
|
120
|
+
|
|
121
|
+
if (layout.startsWith('wrap') && paragraph && !tr.doc.nodeAt(state.selection.to) && ((0, _utils2.insideTable)(state) || (0, _utils2.isInLayoutColumn)(state))) {
|
|
122
|
+
tr.insert(state.selection.to, paragraph.createAndFill());
|
|
123
|
+
}
|
|
124
|
+
|
|
117
125
|
dispatch((0, _utils.addAnalytics)(state, tr, {
|
|
118
126
|
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
119
127
|
action: _analytics.ACTION.SELECTED,
|
|
@@ -17,8 +17,6 @@ var _constants = require("@atlaskit/theme/constants");
|
|
|
17
17
|
|
|
18
18
|
var _react2 = require("@emotion/react");
|
|
19
19
|
|
|
20
|
-
var _styledComponents = require("styled-components");
|
|
21
|
-
|
|
22
20
|
function PortalProviderThemeProviders(props) {
|
|
23
21
|
var children = props.children,
|
|
24
22
|
mode = props.mode;
|
|
@@ -47,11 +45,9 @@ function PortalProviderThemeProviders(props) {
|
|
|
47
45
|
};
|
|
48
46
|
}, [mode]);
|
|
49
47
|
|
|
50
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
51
|
-
theme: styledComponentsAndEmotionTheme
|
|
52
|
-
}, /*#__PURE__*/_react.default.createElement(_react2.ThemeProvider, {
|
|
48
|
+
return /*#__PURE__*/_react.default.createElement(_react2.ThemeProvider, {
|
|
53
49
|
theme: styledComponentsAndEmotionTheme
|
|
54
50
|
}, /*#__PURE__*/_react.default.createElement(_components.default.Provider, {
|
|
55
51
|
value: atlaskitTheme
|
|
56
|
-
}, children))
|
|
52
|
+
}, children));
|
|
57
53
|
}
|
|
@@ -71,8 +71,6 @@ var PortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
|
|
|
71
71
|
(0, _createClass2.default)(PortalProviderAPI, [{
|
|
72
72
|
key: "render",
|
|
73
73
|
value: function render(children, container) {
|
|
74
|
-
var _this2 = this;
|
|
75
|
-
|
|
76
74
|
var hasAnalyticsContext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
77
75
|
var hasIntlContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
78
76
|
this.portals.set(container, {
|
|
@@ -81,13 +79,11 @@ var PortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
|
|
|
81
79
|
hasIntlContext: hasIntlContext
|
|
82
80
|
});
|
|
83
81
|
|
|
84
|
-
var childrenWithThemeProviders =
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}, children());
|
|
88
|
-
};
|
|
82
|
+
var childrenWithThemeProviders = /*#__PURE__*/_react.default.createElement(_PortalProviderThemesProvider.PortalProviderThemeProviders, {
|
|
83
|
+
mode: this.themeMode
|
|
84
|
+
}, children());
|
|
89
85
|
|
|
90
|
-
var wrappedChildren = this.useAnalyticsContext ? /*#__PURE__*/_react.default.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders
|
|
86
|
+
var wrappedChildren = this.useAnalyticsContext ? /*#__PURE__*/_react.default.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders) : childrenWithThemeProviders;
|
|
91
87
|
|
|
92
88
|
if (hasIntlContext) {
|
|
93
89
|
wrappedChildren = /*#__PURE__*/_react.default.createElement(_reactIntlNext.RawIntlProvider, {
|
|
@@ -103,36 +99,34 @@ var PortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
|
|
|
103
99
|
}, {
|
|
104
100
|
key: "forceUpdate",
|
|
105
101
|
value: function forceUpdate(_ref) {
|
|
106
|
-
var
|
|
102
|
+
var _this2 = this;
|
|
107
103
|
|
|
108
104
|
var intl = _ref.intl,
|
|
109
105
|
themeMode = _ref.themeMode;
|
|
110
106
|
this.intl = intl;
|
|
111
107
|
this.themeMode = themeMode;
|
|
112
108
|
this.portals.forEach(function (portal, container) {
|
|
113
|
-
if (!portal.hasAnalyticsContext && !
|
|
109
|
+
if (!portal.hasAnalyticsContext && !_this2.useAnalyticsContext && !portal.hasIntlContext) {
|
|
114
110
|
return;
|
|
115
111
|
}
|
|
116
112
|
|
|
117
113
|
var wrappedChildren = portal.children();
|
|
118
114
|
|
|
119
|
-
var childrenWithThemeProviders =
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}, wrappedChildren);
|
|
123
|
-
};
|
|
115
|
+
var childrenWithThemeProviders = /*#__PURE__*/_react.default.createElement(_PortalProviderThemesProvider.PortalProviderThemeProviders, {
|
|
116
|
+
mode: themeMode
|
|
117
|
+
}, wrappedChildren);
|
|
124
118
|
|
|
125
|
-
if (portal.hasAnalyticsContext &&
|
|
126
|
-
wrappedChildren = /*#__PURE__*/_react.default.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders
|
|
119
|
+
if (portal.hasAnalyticsContext && _this2.useAnalyticsContext) {
|
|
120
|
+
wrappedChildren = /*#__PURE__*/_react.default.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders);
|
|
127
121
|
}
|
|
128
122
|
|
|
129
123
|
if (portal.hasIntlContext) {
|
|
130
124
|
wrappedChildren = /*#__PURE__*/_react.default.createElement(_reactIntlNext.RawIntlProvider, {
|
|
131
|
-
value:
|
|
132
|
-
}, childrenWithThemeProviders
|
|
125
|
+
value: _this2.intl
|
|
126
|
+
}, childrenWithThemeProviders);
|
|
133
127
|
}
|
|
134
128
|
|
|
135
|
-
(0, _reactDom.unstable_renderSubtreeIntoContainer)(
|
|
129
|
+
(0, _reactDom.unstable_renderSubtreeIntoContainer)(_this2.context, wrappedChildren, container);
|
|
136
130
|
});
|
|
137
131
|
}
|
|
138
132
|
}, {
|
|
@@ -179,12 +173,12 @@ var BasePortalProvider = /*#__PURE__*/function (_React$Component) {
|
|
|
179
173
|
var _super2 = _createSuper(BasePortalProvider);
|
|
180
174
|
|
|
181
175
|
function BasePortalProvider(props) {
|
|
182
|
-
var
|
|
176
|
+
var _this3;
|
|
183
177
|
|
|
184
178
|
(0, _classCallCheck2.default)(this, BasePortalProvider);
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
return
|
|
179
|
+
_this3 = _super2.call(this, props);
|
|
180
|
+
_this3.portalProviderAPI = new PortalProviderAPI(props.intl, props.onAnalyticsEvent, props.useAnalyticsContext, props.themeMode);
|
|
181
|
+
return _this3;
|
|
188
182
|
}
|
|
189
183
|
|
|
190
184
|
(0, _createClass2.default)(BasePortalProvider, [{
|
|
@@ -228,21 +222,21 @@ var PortalRenderer = /*#__PURE__*/function (_React$Component2) {
|
|
|
228
222
|
var _super3 = _createSuper(PortalRenderer);
|
|
229
223
|
|
|
230
224
|
function PortalRenderer(props) {
|
|
231
|
-
var
|
|
225
|
+
var _this4;
|
|
232
226
|
|
|
233
227
|
(0, _classCallCheck2.default)(this, PortalRenderer);
|
|
234
|
-
|
|
235
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(
|
|
236
|
-
return
|
|
228
|
+
_this4 = _super3.call(this, props);
|
|
229
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this4), "handleUpdate", function (portals) {
|
|
230
|
+
return _this4.setState({
|
|
237
231
|
portals: portals
|
|
238
232
|
});
|
|
239
233
|
});
|
|
240
|
-
props.portalProviderAPI.setContext((0, _assertThisInitialized2.default)(
|
|
241
|
-
props.portalProviderAPI.on('update',
|
|
242
|
-
|
|
234
|
+
props.portalProviderAPI.setContext((0, _assertThisInitialized2.default)(_this4));
|
|
235
|
+
props.portalProviderAPI.on('update', _this4.handleUpdate);
|
|
236
|
+
_this4.state = {
|
|
243
237
|
portals: new Map()
|
|
244
238
|
};
|
|
245
|
-
return
|
|
239
|
+
return _this4;
|
|
246
240
|
}
|
|
247
241
|
|
|
248
242
|
(0, _createClass2.default)(PortalRenderer, [{
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -95,7 +95,7 @@ Object.defineProperty(exports, "isEmptyParagraph", {
|
|
|
95
95
|
return _document.isEmptyParagraph;
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
|
-
exports.isInListItem = exports.isInLayoutColumn = void 0;
|
|
98
|
+
exports.isInsideBlockQuote = exports.isInListItem = exports.isInLayoutColumn = void 0;
|
|
99
99
|
Object.defineProperty(exports, "isLastItemMediaGroup", {
|
|
100
100
|
enumerable: true,
|
|
101
101
|
get: function get() {
|
|
@@ -831,6 +831,13 @@ var hasOpenEnd = function hasOpenEnd(slice) {
|
|
|
831
831
|
|
|
832
832
|
exports.hasOpenEnd = hasOpenEnd;
|
|
833
833
|
|
|
834
|
+
var isInsideBlockQuote = function isInsideBlockQuote(state) {
|
|
835
|
+
var blockquote = state.schema.nodes.blockquote;
|
|
836
|
+
return (0, _prosemirrorUtils.hasParentNodeOfType)(blockquote)(state.selection);
|
|
837
|
+
};
|
|
838
|
+
|
|
839
|
+
exports.isInsideBlockQuote = isInsideBlockQuote;
|
|
840
|
+
|
|
834
841
|
function filterChildrenBetween(doc, from, to, predicate) {
|
|
835
842
|
var results = [];
|
|
836
843
|
doc.nodesBetween(from, to, function (node, pos, parent) {
|
|
@@ -15,7 +15,12 @@ Object.defineProperty(exports, "setNodeSelection", {
|
|
|
15
15
|
return _utils.setNodeSelection;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
exports
|
|
18
|
+
Object.defineProperty(exports, "setTextSelection", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _utils.setTextSelection;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
19
24
|
|
|
20
25
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
26
|
|
|
@@ -31,13 +36,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
31
36
|
|
|
32
37
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
33
38
|
|
|
34
|
-
function setTextSelection(view, anchor, head) {
|
|
35
|
-
var state = view.state,
|
|
36
|
-
dispatch = view.dispatch;
|
|
37
|
-
var tr = state.tr.setSelection(_prosemirrorState.TextSelection.create(state.doc, anchor, head));
|
|
38
|
-
dispatch(tr);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
39
|
function setAllSelection(view) {
|
|
42
40
|
var state = view.state,
|
|
43
41
|
dispatch = view.dispatch;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "
|
|
9
|
+
var version = "173.0.1";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
|
|
12
12
|
var nextMajorVersion = function nextMajorVersion() {
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/index.js
CHANGED
|
@@ -29,7 +29,7 @@ export { subscribeToToolbarAndPickerUpdates } from './plugins/view-update-subscr
|
|
|
29
29
|
export { subscribeTypeAheadUpdates } from './plugins/view-update-subscription/subscribe/type-ahead-updates';
|
|
30
30
|
export { insertBlockType, insertBlockTypesWithAnalytics, setBlockType, setBlockTypeWithAnalytics } from './plugins/block-type/commands';
|
|
31
31
|
export { createTable } from './plugins/table/commands';
|
|
32
|
-
export {
|
|
32
|
+
export { insertTaskDecisionCommand } from './plugins/tasks-and-decisions/commands';
|
|
33
33
|
export { EventDispatcher } from './event-dispatcher';
|
|
34
34
|
export { pluginKey as statusPluginKey } from './plugins/status/plugin';
|
|
35
35
|
export { insertDate, openDatePicker, deleteDate } from './plugins/date/actions';
|
|
@@ -15,6 +15,7 @@ import decorationPlugin from './pm-plugins/decoration';
|
|
|
15
15
|
import scrollGutter from './pm-plugins/scroll-gutter';
|
|
16
16
|
import { keymap } from '../../utils/keymap';
|
|
17
17
|
import frozenEditor from './pm-plugins/frozen-editor';
|
|
18
|
+
import compositionPlugin from './pm-plugins/composition';
|
|
18
19
|
// Chrome >= 88
|
|
19
20
|
export const isChromeWithSelectionBug = browser.chrome && browser.chrome_version >= 88;
|
|
20
21
|
|
|
@@ -105,6 +106,10 @@ const basePlugin = options => ({
|
|
|
105
106
|
name: 'disableSpellcheckingPlugin',
|
|
106
107
|
plugin: () => disableSpellcheckingPlugin()
|
|
107
108
|
});
|
|
109
|
+
plugins.push({
|
|
110
|
+
name: 'compositionPlugin',
|
|
111
|
+
plugin: () => compositionPlugin()
|
|
112
|
+
});
|
|
108
113
|
return plugins;
|
|
109
114
|
},
|
|
110
115
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { PluginKey } from 'prosemirror-state';
|
|
3
|
+
const compositionPluginKey = new PluginKey('compositionPlugin');
|
|
4
|
+
export const isComposing = state => {
|
|
5
|
+
return compositionPluginKey.getState(state).isComposing;
|
|
6
|
+
};
|
|
7
|
+
export default (() => new SafePlugin({
|
|
8
|
+
key: compositionPluginKey,
|
|
9
|
+
state: {
|
|
10
|
+
init: () => ({
|
|
11
|
+
isComposing: false
|
|
12
|
+
}),
|
|
13
|
+
apply: (tr, value) => {
|
|
14
|
+
const isComposing = tr.getMeta(compositionPluginKey);
|
|
15
|
+
|
|
16
|
+
if (typeof isComposing === 'undefined') {
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
isComposing
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
props: {
|
|
26
|
+
handleDOMEvents: {
|
|
27
|
+
compositionstart: (view, event) => {
|
|
28
|
+
const {
|
|
29
|
+
tr
|
|
30
|
+
} = view.state;
|
|
31
|
+
tr.setMeta(compositionPluginKey, true);
|
|
32
|
+
view.dispatch(tr);
|
|
33
|
+
return false;
|
|
34
|
+
},
|
|
35
|
+
compositionend: (view, event) => {
|
|
36
|
+
const {
|
|
37
|
+
tr
|
|
38
|
+
} = view.state;
|
|
39
|
+
tr.setMeta(compositionPluginKey, false);
|
|
40
|
+
view.dispatch(tr);
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}));
|
|
@@ -156,19 +156,20 @@ const breakoutPlugin = options => ({
|
|
|
156
156
|
|
|
157
157
|
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
158
158
|
plugins: {
|
|
159
|
-
|
|
159
|
+
breakoutPluginState: pluginKey,
|
|
160
|
+
widthPluginState: widthPluginKey
|
|
160
161
|
},
|
|
161
162
|
render: ({
|
|
162
|
-
|
|
163
|
+
breakoutPluginState
|
|
163
164
|
}) => {
|
|
164
|
-
var
|
|
165
|
+
var _breakoutPluginState$;
|
|
165
166
|
|
|
166
167
|
return /*#__PURE__*/React.createElement(LayoutButton, {
|
|
167
168
|
editorView: editorView,
|
|
168
169
|
mountPoint: popupsMountPoint,
|
|
169
170
|
boundariesElement: popupsBoundariesElement,
|
|
170
171
|
scrollableElement: popupsScrollableElement,
|
|
171
|
-
node: (
|
|
172
|
+
node: (_breakoutPluginState$ = breakoutPluginState === null || breakoutPluginState === void 0 ? void 0 : breakoutPluginState.breakoutNode) !== null && _breakoutPluginState$ !== void 0 ? _breakoutPluginState$ : null
|
|
172
173
|
});
|
|
173
174
|
}
|
|
174
175
|
});
|
|
@@ -131,9 +131,7 @@ class LayoutButton extends React.Component {
|
|
|
131
131
|
boundariesElement: boundariesElement,
|
|
132
132
|
scrollableElement: scrollableElement,
|
|
133
133
|
stick: true,
|
|
134
|
-
forcePlacement: true
|
|
135
|
-
scheduleExtraLayoutUpdates: true,
|
|
136
|
-
waitForExtraLayoutUpdates: true
|
|
134
|
+
forcePlacement: true
|
|
137
135
|
}, jsx("div", {
|
|
138
136
|
css: toolbarButtonWrapper
|
|
139
137
|
}, jsx(ToolbarButton, {
|
|
@@ -17,6 +17,9 @@ import { getFeatureFlags } from '../../feature-flags-context';
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
function replaceLinksToCards(tr, cardAdf, schema, request) {
|
|
20
|
+
const {
|
|
21
|
+
inlineCard
|
|
22
|
+
} = schema.nodes;
|
|
20
23
|
const {
|
|
21
24
|
url
|
|
22
25
|
} = request;
|
|
@@ -38,9 +41,15 @@ function replaceLinksToCards(tr, cardAdf, schema, request) {
|
|
|
38
41
|
|
|
39
42
|
if (!replaceLink) {
|
|
40
43
|
return;
|
|
41
|
-
}
|
|
44
|
+
} // ED-5638: add an extra space after inline cards to avoid re-rendering them
|
|
45
|
+
|
|
42
46
|
|
|
43
47
|
const nodes = [cardAdf];
|
|
48
|
+
|
|
49
|
+
if (cardAdf.type === inlineCard) {
|
|
50
|
+
nodes.push(schema.text(' '));
|
|
51
|
+
}
|
|
52
|
+
|
|
44
53
|
tr.replaceWith(pos, pos + (node.text || url).length, nodes);
|
|
45
54
|
return $pos.node($pos.depth - 1).type.name;
|
|
46
55
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import {
|
|
2
|
+
import { TextSelection } from 'prosemirror-state';
|
|
3
3
|
import { keydownHandler } from 'prosemirror-keymap';
|
|
4
4
|
import { setTextSelection } from 'prosemirror-utils';
|
|
5
5
|
import { getCursor } from '../../../utils';
|
|
@@ -9,53 +9,16 @@ import { getAutoClosingBracketInfo, shouldAutoCloseBracket } from '../ide-ux/bra
|
|
|
9
9
|
import { getAutoClosingQuoteInfo, shouldAutoCloseQuote } from '../ide-ux/quote-handling';
|
|
10
10
|
import { getEndOfCurrentLine, getStartOfCurrentLine, isCursorInsideCodeBlock, isSelectionEntirelyInsideCodeBlock, getLineInfo } from '../ide-ux/line-handling';
|
|
11
11
|
import { insertIndent, outdent, indent, insertNewlineWithIndent } from '../ide-ux/commands';
|
|
12
|
-
|
|
12
|
+
import { isComposing } from '../../base/pm-plugins/composition';
|
|
13
13
|
export default new SafePlugin({
|
|
14
|
-
key: codeBlockIDEKeyBindingsKey,
|
|
15
|
-
state: {
|
|
16
|
-
init: () => ({
|
|
17
|
-
isComposing: false
|
|
18
|
-
}),
|
|
19
|
-
apply: (tr, value) => {
|
|
20
|
-
const isComposing = tr.getMeta(codeBlockIDEKeyBindingsKey);
|
|
21
|
-
|
|
22
|
-
if (typeof isComposing === 'undefined') {
|
|
23
|
-
return value;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
isComposing
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
14
|
props: {
|
|
32
|
-
handleDOMEvents: {
|
|
33
|
-
compositionstart: (view, event) => {
|
|
34
|
-
const {
|
|
35
|
-
tr
|
|
36
|
-
} = view.state;
|
|
37
|
-
tr.setMeta(codeBlockIDEKeyBindingsKey, true);
|
|
38
|
-
view.dispatch(tr);
|
|
39
|
-
return false;
|
|
40
|
-
},
|
|
41
|
-
compositionend: (view, event) => {
|
|
42
|
-
const {
|
|
43
|
-
tr
|
|
44
|
-
} = view.state;
|
|
45
|
-
tr.setMeta(codeBlockIDEKeyBindingsKey, false);
|
|
46
|
-
view.dispatch(tr);
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
|
|
51
15
|
handleTextInput(view, from, to, text) {
|
|
52
16
|
const {
|
|
53
17
|
state,
|
|
54
18
|
dispatch
|
|
55
19
|
} = view;
|
|
56
|
-
const isComposing = codeBlockIDEKeyBindingsKey.getState(state).isComposing;
|
|
57
20
|
|
|
58
|
-
if (isCursorInsideCodeBlock(state) && !isComposing) {
|
|
21
|
+
if (isCursorInsideCodeBlock(state) && !isComposing(state)) {
|
|
59
22
|
const beforeText = getStartOfCurrentLine(state).text;
|
|
60
23
|
const afterText = getEndOfCurrentLine(state).text; // If text is a closing bracket/quote and we've already inserted it, move the selection after
|
|
61
24
|
|