@atlaskit/editor-core 179.0.4 → 179.1.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 +28 -0
- package/dist/cjs/create-editor/ReactEditorView.js +1 -1
- package/dist/cjs/create-editor/create-plugins-list.js +6 -287
- package/dist/cjs/editor.js +5 -7
- package/dist/cjs/labs/next/presets/universal.js +313 -0
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +24 -5
- package/dist/cjs/plugins/floating-toolbar/index.js +6 -0
- package/dist/cjs/plugins/floating-toolbar/pm-plugins/force-focus/index.js +72 -0
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +12 -9
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +3 -1
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -2
- package/dist/cjs/plugins/list/actions/outdent-list-items-selected.js +40 -1
- package/dist/cjs/plugins/list/commands/outdent-list.js +22 -9
- package/dist/cjs/plugins/list/pm-plugins/input-rules/create-list-input-rule.js +30 -12
- package/dist/cjs/plugins/list/utils/analytics.js +18 -2
- package/dist/cjs/plugins/media/commands/linking.js +2 -2
- package/dist/cjs/plugins/media/pm-plugins/alt-text/index.js +1 -12
- package/dist/cjs/plugins/media/toolbar/alt-text.js +14 -3
- package/dist/cjs/plugins/media/toolbar/linking-toolbar-appearance.js +6 -6
- package/dist/cjs/plugins/media/toolbar/linking.js +7 -1
- package/dist/cjs/plugins/paste/handlers.js +7 -5
- package/dist/cjs/plugins/placeholder/index.js +1 -0
- package/dist/cjs/plugins/placeholder/styles.js +1 -1
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/Toolbar.js +17 -0
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +13 -13
- package/dist/cjs/utils/document.js +3 -2
- package/dist/cjs/utils/input-rules.js +3 -2
- package/dist/cjs/utils/lists.js +31 -0
- package/dist/cjs/utils/prepare-quick-insert-provider.js +22 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +1 -1
- package/dist/es2019/create-editor/create-plugins-list.js +5 -293
- package/dist/es2019/editor.js +5 -7
- package/dist/es2019/labs/next/presets/universal.js +311 -0
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +19 -2
- package/dist/es2019/plugins/floating-toolbar/index.js +4 -0
- package/dist/es2019/plugins/floating-toolbar/pm-plugins/force-focus/index.js +59 -0
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +6 -3
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +3 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -2
- package/dist/es2019/plugins/list/actions/outdent-list-items-selected.js +41 -1
- package/dist/es2019/plugins/list/commands/outdent-list.js +16 -1
- package/dist/es2019/plugins/list/pm-plugins/input-rules/create-list-input-rule.js +29 -11
- package/dist/es2019/plugins/list/utils/analytics.js +12 -0
- package/dist/es2019/plugins/media/commands/linking.js +2 -2
- package/dist/es2019/plugins/media/pm-plugins/alt-text/index.js +1 -12
- package/dist/es2019/plugins/media/toolbar/alt-text.js +14 -3
- package/dist/es2019/plugins/media/toolbar/linking-toolbar-appearance.js +6 -6
- package/dist/es2019/plugins/media/toolbar/linking.js +9 -1
- package/dist/es2019/plugins/paste/handlers.js +8 -6
- package/dist/es2019/plugins/placeholder/index.js +1 -0
- package/dist/es2019/plugins/placeholder/styles.js +7 -0
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/Toolbar.js +17 -0
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +13 -13
- package/dist/es2019/utils/document.js +3 -2
- package/dist/es2019/utils/input-rules.js +3 -2
- package/dist/es2019/utils/lists.js +26 -0
- package/dist/es2019/utils/prepare-quick-insert-provider.js +17 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +1 -1
- package/dist/esm/create-editor/create-plugins-list.js +6 -287
- package/dist/esm/editor.js +5 -7
- package/dist/esm/labs/next/presets/universal.js +306 -0
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +24 -5
- package/dist/esm/plugins/floating-toolbar/index.js +6 -0
- package/dist/esm/plugins/floating-toolbar/pm-plugins/force-focus/index.js +62 -0
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +12 -9
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +3 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -2
- package/dist/esm/plugins/list/actions/outdent-list-items-selected.js +40 -1
- package/dist/esm/plugins/list/commands/outdent-list.js +15 -2
- package/dist/esm/plugins/list/pm-plugins/input-rules/create-list-input-rule.js +30 -12
- package/dist/esm/plugins/list/utils/analytics.js +12 -0
- package/dist/esm/plugins/media/commands/linking.js +2 -2
- package/dist/esm/plugins/media/pm-plugins/alt-text/index.js +1 -12
- package/dist/esm/plugins/media/toolbar/alt-text.js +14 -3
- package/dist/esm/plugins/media/toolbar/linking-toolbar-appearance.js +6 -6
- package/dist/esm/plugins/media/toolbar/linking.js +7 -1
- package/dist/esm/plugins/paste/handlers.js +8 -6
- package/dist/esm/plugins/placeholder/index.js +1 -0
- package/dist/esm/plugins/placeholder/styles.js +1 -1
- package/dist/esm/plugins/toolbar-lists-indentation/ui/Toolbar.js +17 -0
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +13 -13
- package/dist/esm/utils/document.js +3 -2
- package/dist/esm/utils/input-rules.js +3 -2
- package/dist/esm/utils/lists.js +24 -0
- package/dist/esm/utils/prepare-quick-insert-provider.js +17 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/create-plugins-list.d.ts +5 -4
- package/dist/types/{plugins/feature-flags-context → create-editor}/feature-flags-from-props.d.ts +2 -2
- package/dist/types/labs/next/presets/universal.d.ts +30 -0
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +4 -0
- package/dist/types/plugins/expand/index.d.ts +4 -1
- package/dist/types/plugins/floating-toolbar/pm-plugins/force-focus/index.d.ts +18 -0
- package/dist/types/plugins/list/utils/analytics.d.ts +5 -2
- package/dist/types/plugins/media/commands/linking.d.ts +1 -1
- package/dist/types/types/editor-props.d.ts +96 -92
- package/dist/types/utils/input-rules.d.ts +2 -1
- package/dist/types/utils/lists.d.ts +2 -0
- package/dist/types/utils/prepare-quick-insert-provider.d.ts +16 -0
- package/package.json +14 -15
- package/report.api.md +89 -79
- /package/dist/cjs/{plugins/feature-flags-context → create-editor}/feature-flags-from-props.js +0 -0
- /package/dist/es2019/{plugins/feature-flags-context → create-editor}/feature-flags-from-props.js +0 -0
- /package/dist/esm/{plugins/feature-flags-context → create-editor}/feature-flags-from-props.js +0 -0
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
3
|
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) { _defineProperty(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; }
|
|
4
|
+
import { OUTDENT_SCENARIOS } from '@atlaskit/editor-common/analytics';
|
|
4
5
|
import { addAnalytics, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '../../analytics';
|
|
5
6
|
import { isInsideListItem, isInsideTableCell } from '../utils/selection';
|
|
6
7
|
import { isBulletList } from '../utils/node';
|
|
7
8
|
import { findFirstParentListNode } from '../utils/find';
|
|
8
|
-
import { getCommonListAnalyticsAttributes } from '../utils/analytics';
|
|
9
|
+
import { getCommonListAnalyticsAttributes, getRestartListsAttributes } from '../utils/analytics';
|
|
9
10
|
import { outdentListItemsSelected as outdentListAction } from '../actions/outdent-list-items-selected';
|
|
10
11
|
import { closeHistory } from 'prosemirror-history';
|
|
12
|
+
import { getFeatureFlags } from '../../feature-flags-context';
|
|
11
13
|
export function outdentList() {
|
|
12
14
|
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INPUT_METHOD.KEYBOARD;
|
|
13
15
|
return function (state, dispatch) {
|
|
@@ -31,12 +33,23 @@ export function outdentList() {
|
|
|
31
33
|
// If inside table cell and can't outdent list, then let it handle by table keymap
|
|
32
34
|
return !isInsideTableCell(state);
|
|
33
35
|
}
|
|
36
|
+
var featureFlags = getFeatureFlags(state);
|
|
37
|
+
var restartListsAttributes = {};
|
|
38
|
+
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
|
|
39
|
+
var _getRestartListsAttri = getRestartListsAttributes(customTr),
|
|
40
|
+
outdentScenario = _getRestartListsAttri.outdentScenario,
|
|
41
|
+
splitListStartNumber = _getRestartListsAttri.splitListStartNumber;
|
|
42
|
+
if (outdentScenario === OUTDENT_SCENARIOS.SPLIT_LIST) {
|
|
43
|
+
restartListsAttributes.outdentScenario = outdentScenario;
|
|
44
|
+
restartListsAttributes.splitListStartNumber = splitListStartNumber;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
34
47
|
addAnalytics(state, customTr, {
|
|
35
48
|
action: ACTION.OUTDENTED,
|
|
36
49
|
actionSubject: ACTION_SUBJECT.LIST,
|
|
37
50
|
actionSubjectId: actionSubjectId,
|
|
38
51
|
eventType: EVENT_TYPE.TRACK,
|
|
39
|
-
attributes: _objectSpread(_objectSpread({}, getCommonListAnalyticsAttributes(state)), {}, {
|
|
52
|
+
attributes: _objectSpread(_objectSpread(_objectSpread({}, getCommonListAnalyticsAttributes(state)), restartListsAttributes), {}, {
|
|
40
53
|
inputMethod: inputMethod
|
|
41
54
|
})
|
|
42
55
|
});
|
|
@@ -1,28 +1,46 @@
|
|
|
1
1
|
import { ruleWithAnalytics, createWrappingJoinRule } from '../../../../utils/input-rules';
|
|
2
2
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '../../../analytics';
|
|
3
|
+
import { JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
var getOrder = function getOrder(matchResult) {
|
|
5
|
+
return Number(matchResult[1]);
|
|
6
|
+
};
|
|
3
7
|
export function createRuleForListType(_ref) {
|
|
4
8
|
var listType = _ref.listType,
|
|
5
9
|
expression = _ref.expression,
|
|
6
10
|
featureFlags = _ref.featureFlags;
|
|
11
|
+
var joinScenario = JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST.NO_JOIN;
|
|
7
12
|
var isBulletList = listType.name === 'bulletList';
|
|
8
13
|
var actionSubjectId = isBulletList ? ACTION_SUBJECT_ID.FORMAT_LIST_BULLET : ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
var getAnalyticsPayload = function getAnalyticsPayload(state, matchResult) {
|
|
15
|
+
var analyticsPayload = {
|
|
16
|
+
action: ACTION.INSERTED,
|
|
17
|
+
actionSubject: ACTION_SUBJECT.LIST,
|
|
18
|
+
actionSubjectId: actionSubjectId,
|
|
19
|
+
eventType: EVENT_TYPE.TRACK,
|
|
20
|
+
attributes: {
|
|
21
|
+
inputMethod: INPUT_METHOD.FORMATTING
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && listType === state.schema.nodes.orderedList && analyticsPayload.attributes) {
|
|
25
|
+
analyticsPayload.attributes.listStartNumber = getOrder(matchResult);
|
|
26
|
+
analyticsPayload.attributes.joinScenario = joinScenario;
|
|
27
|
+
// we reset the tracked joinScenario after storing it in the event payload
|
|
28
|
+
joinScenario = JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST.NO_JOIN;
|
|
16
29
|
}
|
|
30
|
+
return analyticsPayload;
|
|
17
31
|
};
|
|
18
|
-
var
|
|
19
|
-
|
|
32
|
+
var joinToNeighbourIfSameListType = function joinToNeighbourIfSameListType(_, node, scenario) {
|
|
33
|
+
var shouldJoin = node.type === listType;
|
|
34
|
+
if (shouldJoin) {
|
|
35
|
+
joinScenario = scenario;
|
|
36
|
+
}
|
|
37
|
+
return shouldJoin;
|
|
20
38
|
};
|
|
21
39
|
var getAttrs = {};
|
|
22
40
|
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
|
|
23
41
|
getAttrs = function getAttrs(matchResult) {
|
|
24
42
|
return {
|
|
25
|
-
order:
|
|
43
|
+
order: getOrder(matchResult)
|
|
26
44
|
};
|
|
27
45
|
};
|
|
28
46
|
}
|
|
@@ -30,7 +48,7 @@ export function createRuleForListType(_ref) {
|
|
|
30
48
|
match: expression,
|
|
31
49
|
nodeType: listType,
|
|
32
50
|
getAttrs: getAttrs,
|
|
33
|
-
joinPredicate:
|
|
51
|
+
joinPredicate: joinToNeighbourIfSameListType
|
|
34
52
|
});
|
|
35
|
-
return ruleWithAnalytics(
|
|
53
|
+
return ruleWithAnalytics(getAnalyticsPayload)(inputRule);
|
|
36
54
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
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) { _defineProperty(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; }
|
|
1
4
|
import { isListNode, isListItemNode } from './node';
|
|
2
5
|
import { getListItemAttributes } from './selection';
|
|
3
6
|
export var getCommonListAnalyticsAttributes = function getCommonListAnalyticsAttributes(state) {
|
|
@@ -29,4 +32,13 @@ export var countListItemsInSelection = function countListItemsInSelection(state)
|
|
|
29
32
|
}
|
|
30
33
|
});
|
|
31
34
|
return count;
|
|
35
|
+
};
|
|
36
|
+
export var RESTART_LISTS_ANALYTICS_KEY = 'restartListsAnalytics';
|
|
37
|
+
export var getRestartListsAttributes = function getRestartListsAttributes(tr) {
|
|
38
|
+
var _tr$getMeta;
|
|
39
|
+
return (_tr$getMeta = tr.getMeta(RESTART_LISTS_ANALYTICS_KEY)) !== null && _tr$getMeta !== void 0 ? _tr$getMeta : {};
|
|
40
|
+
};
|
|
41
|
+
export var storeRestartListsAttributes = function storeRestartListsAttributes(tr, attributes) {
|
|
42
|
+
var meta = getRestartListsAttributes(tr);
|
|
43
|
+
tr.setMeta(RESTART_LISTS_ANALYTICS_KEY, _objectSpread(_objectSpread({}, meta), attributes));
|
|
32
44
|
};
|
|
@@ -47,11 +47,11 @@ export var showLinkingToolbarWithMediaTypeCheck = function showLinkingToolbarWit
|
|
|
47
47
|
var hideLinkingToolbarCommand = createMediaLinkingCommand({
|
|
48
48
|
type: MediaLinkingActionsTypes.hideToolbar
|
|
49
49
|
});
|
|
50
|
-
export var hideLinkingToolbar = function hideLinkingToolbar(state, dispatch, view) {
|
|
50
|
+
export var hideLinkingToolbar = function hideLinkingToolbar(state, dispatch, view, focusFloatingToolbar) {
|
|
51
51
|
hideLinkingToolbarCommand(state, dispatch, view);
|
|
52
52
|
|
|
53
53
|
// restore focus on the editor so keyboard shortcuts aren't lost to the browser
|
|
54
|
-
if (view) {
|
|
54
|
+
if (view && !focusFloatingToolbar) {
|
|
55
55
|
view.focus();
|
|
56
56
|
}
|
|
57
57
|
};
|
|
@@ -25,18 +25,7 @@ export var createPlugin = function createPlugin(_ref) {
|
|
|
25
25
|
state: createPluginState(dispatch, {
|
|
26
26
|
isAltTextEditorOpen: false
|
|
27
27
|
}),
|
|
28
|
-
key: pluginKey
|
|
29
|
-
view: function view() {
|
|
30
|
-
return {
|
|
31
|
-
update: function update(view, prev) {
|
|
32
|
-
var pluginState = getPluginState(view.state);
|
|
33
|
-
var oldPluginState = getPluginState(prev);
|
|
34
|
-
if (pluginState && oldPluginState && oldPluginState.isAltTextEditorOpen && !pluginState.isAltTextEditorOpen && !view.hasFocus()) {
|
|
35
|
-
view.focus();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
}
|
|
28
|
+
key: pluginKey
|
|
40
29
|
});
|
|
41
30
|
};
|
|
42
31
|
export { createCommand, getPluginState };
|
|
@@ -9,6 +9,9 @@ import AltTextEdit from '../pm-plugins/alt-text/ui/AltTextEdit';
|
|
|
9
9
|
import { CONTAINER_WIDTH_IN_PX } from '../pm-plugins/alt-text/ui/AltTextEdit';
|
|
10
10
|
import { getMediaNodeFromSelection } from '../utils/media-common';
|
|
11
11
|
import { ClassNames } from '../pm-plugins/alt-text/style';
|
|
12
|
+
import { withOuterListeners } from '@atlaskit/editor-common/ui';
|
|
13
|
+
import { forceFocusSelector } from '../../floating-toolbar/pm-plugins/force-focus';
|
|
14
|
+
var testId = 'alt-text-edit-button';
|
|
12
15
|
export var altTextButton = function altTextButton(intl, state) {
|
|
13
16
|
var mediaNode = getMediaNodeFromSelection(state);
|
|
14
17
|
var message = mediaNode && mediaNode.attrs.alt ? messages.editAltText : messages.altText;
|
|
@@ -19,13 +22,14 @@ export var altTextButton = function altTextButton(intl, state) {
|
|
|
19
22
|
type: 'button',
|
|
20
23
|
onClick: openMediaAltTextMenu,
|
|
21
24
|
showTitle: true,
|
|
22
|
-
testId:
|
|
25
|
+
testId: testId,
|
|
23
26
|
tooltipContent: /*#__PURE__*/React.createElement(ToolTipContent, {
|
|
24
27
|
description: title,
|
|
25
28
|
keymap: addAltText
|
|
26
29
|
})
|
|
27
30
|
};
|
|
28
31
|
};
|
|
32
|
+
var AltTextEditWithListeners = withOuterListeners(AltTextEdit);
|
|
29
33
|
export var altTextEditComponent = function altTextEditComponent(options) {
|
|
30
34
|
return {
|
|
31
35
|
type: 'custom',
|
|
@@ -39,11 +43,18 @@ export var altTextEditComponent = function altTextEditComponent(options) {
|
|
|
39
43
|
if (!mediaNode) {
|
|
40
44
|
return null;
|
|
41
45
|
}
|
|
42
|
-
|
|
46
|
+
/** Focus should move to the 'Alt text' button when the toolbar closes
|
|
47
|
+
* and not close the floating toolbar.
|
|
48
|
+
*/
|
|
49
|
+
var handleEsc = function handleEsc(e) {
|
|
50
|
+
forceFocusSelector("[data-testid=\"".concat(testId, "\"]"), view);
|
|
51
|
+
};
|
|
52
|
+
return /*#__PURE__*/React.createElement(AltTextEditWithListeners, {
|
|
43
53
|
view: view,
|
|
44
54
|
key: idx,
|
|
45
55
|
value: mediaNode.attrs.alt,
|
|
46
|
-
altTextValidator: options && options.altTextValidator
|
|
56
|
+
altTextValidator: options && options.altTextValidator,
|
|
57
|
+
handleEscapeKeydown: handleEsc
|
|
47
58
|
});
|
|
48
59
|
}
|
|
49
60
|
};
|
|
@@ -23,25 +23,24 @@ export var LinkToolbarAppearance = function LinkToolbarAppearance(_ref) {
|
|
|
23
23
|
onAddLink = _ref.onAddLink,
|
|
24
24
|
onEditLink = _ref.onEditLink,
|
|
25
25
|
onOpenLink = _ref.onOpenLink;
|
|
26
|
-
var _useState = useState(
|
|
26
|
+
var _useState = useState(true),
|
|
27
27
|
_useState2 = _slicedToArray(_useState, 2),
|
|
28
28
|
showLinkingControls = _useState2[0],
|
|
29
29
|
setShowLinkingControls = _useState2[1];
|
|
30
30
|
useEffect(function () {
|
|
31
31
|
var _stateKey$getState;
|
|
32
|
-
setShowLinkingControls(false);
|
|
33
32
|
var mediaNode = currentMediaNode(editorState);
|
|
34
33
|
if (!mediaNode) {
|
|
34
|
+
setShowLinkingControls(false);
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
var mediaClientConfig = (_stateKey$getState = stateKey.getState(editorState)) === null || _stateKey$getState === void 0 ? void 0 : _stateKey$getState.mediaClientConfig;
|
|
38
38
|
if (!mediaClientConfig) {
|
|
39
|
+
setShowLinkingControls(false);
|
|
39
40
|
return;
|
|
40
41
|
}
|
|
41
42
|
checkMediaType(mediaNode, mediaClientConfig).then(function (mediaType) {
|
|
42
|
-
|
|
43
|
-
setShowLinkingControls(true);
|
|
44
|
-
}
|
|
43
|
+
setShowLinkingControls(mediaType === 'external' || mediaType === 'image');
|
|
45
44
|
});
|
|
46
45
|
}, [editorState]);
|
|
47
46
|
if (!showLinkingControls) {
|
|
@@ -59,7 +58,8 @@ export var LinkToolbarAppearance = function LinkToolbarAppearance(_ref) {
|
|
|
59
58
|
tooltipContent: jsx(ToolTipContent, {
|
|
60
59
|
description: title,
|
|
61
60
|
keymap: addLink
|
|
62
|
-
})
|
|
61
|
+
}),
|
|
62
|
+
testId: "edit-link-button"
|
|
63
63
|
}, title)), jsx("div", {
|
|
64
64
|
css: wrapper
|
|
65
65
|
}, jsx(Separator, null)), jsx(ToolbarButton, {
|
|
@@ -6,6 +6,8 @@ import { hideLinkingToolbar, setUrlToMedia, unlink } from '../commands/linking';
|
|
|
6
6
|
import { getMediaLinkingState } from '../pm-plugins/linking';
|
|
7
7
|
import MediaLinkingToolbar from '../ui/MediaLinkingToolbar';
|
|
8
8
|
import { RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '../../../ui/LinkSearch/ToolbarComponents';
|
|
9
|
+
import { forceFocusSelector } from '../../floating-toolbar/pm-plugins/force-focus';
|
|
10
|
+
var FORCE_FOCUS_SELECTOR = '[data-testid="add-link-button"],[data-testid="edit-link-button"]';
|
|
9
11
|
export function shouldShowMediaLinkToolbar(editorState) {
|
|
10
12
|
var mediaLinkingState = getMediaLinkingState(editorState);
|
|
11
13
|
if (!mediaLinkingState || mediaLinkingState.mediaPos === null) {
|
|
@@ -58,7 +60,11 @@ export var getLinkingToolbar = function getLinkingToolbar(toolbarBaseConfig, med
|
|
|
58
60
|
hideLinkingToolbar(view.state, view.dispatch, view);
|
|
59
61
|
},
|
|
60
62
|
onCancel: function onCancel() {
|
|
61
|
-
|
|
63
|
+
hideLinkingToolbar(view.state, view.dispatch, view, true);
|
|
64
|
+
/** Focus should move to the 'Add link' button when the toolbar closes
|
|
65
|
+
* and not close the floating toolbar.
|
|
66
|
+
*/
|
|
67
|
+
forceFocusSelector(FORCE_FOCUS_SELECTOR, view);
|
|
62
68
|
},
|
|
63
69
|
onSubmit: function onSubmit(href, meta) {
|
|
64
70
|
setUrlToMedia(href, meta.inputMethod)(view.state, view.dispatch, view);
|
|
@@ -9,7 +9,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
9
9
|
import { closeHistory } from 'prosemirror-history';
|
|
10
10
|
import { Fragment, Node as PMNode, Slice } from 'prosemirror-model';
|
|
11
11
|
import { TextSelection, NodeSelection } from 'prosemirror-state';
|
|
12
|
-
import { findParentNodeOfType, hasParentNodeOfType, safeInsert } from 'prosemirror-utils';
|
|
12
|
+
import { canInsert, findParentNodeOfType, hasParentNodeOfType, safeInsert } from 'prosemirror-utils';
|
|
13
13
|
import uuid from 'uuid/v4';
|
|
14
14
|
import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
|
|
15
15
|
import { compose, insideTable, isParagraph, isText, isLinkMark, insideTableCell, isInListItem } from '../../utils';
|
|
@@ -27,6 +27,7 @@ import { canLinkBeCreatedInRange } from '../hyperlink/pm-plugins/main';
|
|
|
27
27
|
import { insertSliceForLists } from './edge-cases';
|
|
28
28
|
import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from './commands';
|
|
29
29
|
import { getPluginState as getPastePluginState } from './pm-plugins/plugin-factory';
|
|
30
|
+
import { doesSelectionWhichStartsOrEndsInListContainEntireList } from '../../utils/lists';
|
|
30
31
|
|
|
31
32
|
// remove text attribute from mention for copy/paste (GDPR)
|
|
32
33
|
export function handleMention(slice, schema) {
|
|
@@ -91,7 +92,7 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice) {
|
|
|
91
92
|
}
|
|
92
93
|
var transformedSlice = compose.apply(null, filters)(slice);
|
|
93
94
|
var tr = closeHistory(state.tr);
|
|
94
|
-
var transformedSliceIsValidNode = transformedSlice.content.firstChild.type.inlineContent || ['decisionList', 'decisionItem', 'taskList', 'taskItem', 'panel'].includes(transformedSlice.content.firstChild.type.name);
|
|
95
|
+
var transformedSliceIsValidNode = transformedSlice.content.firstChild.type.inlineContent || ['decisionList', 'decisionItem', 'taskList', 'taskItem', 'panel'].includes(transformedSlice.content.firstChild.type.name) && !isInListItem(state);
|
|
95
96
|
// If the slice or the selection are valid nodes to handle,
|
|
96
97
|
// and the slice is not a whole node (i.e. openStart is 1 and openEnd is 0)
|
|
97
98
|
// or the slice's first node is a paragraph,
|
|
@@ -114,11 +115,12 @@ export function handlePastePanelIntoList(slice) {
|
|
|
114
115
|
var schema = state.schema,
|
|
115
116
|
tr = state.tr;
|
|
116
117
|
var selection = tr.selection;
|
|
117
|
-
|
|
118
118
|
// Check this pasting action is related to copy content from panel node into a selected the list node
|
|
119
|
-
var selectionParentListNode = selection.$to.node(selection.$to.depth - 1);
|
|
120
119
|
var panelNode = slice.content.firstChild;
|
|
121
|
-
|
|
120
|
+
var isSliceWholeNode = slice.openStart === 0 && slice.openEnd === 0;
|
|
121
|
+
var selectionParentListItemNode = selection.$to.node(selection.$to.depth - 1);
|
|
122
|
+
var sliceIsWholeNodeButShouldNotReplaceSelection = isSliceWholeNode && !doesSelectionWhichStartsOrEndsInListContainEntireList(selection);
|
|
123
|
+
if (!dispatch || !selectionParentListItemNode || (selectionParentListItemNode === null || selectionParentListItemNode === void 0 ? void 0 : selectionParentListItemNode.type) !== schema.nodes.listItem || !panelNode || (panelNode === null || panelNode === void 0 ? void 0 : panelNode.type) !== schema.nodes.panel || (panelNode === null || panelNode === void 0 ? void 0 : panelNode.content.firstChild) === undefined || sliceIsWholeNodeButShouldNotReplaceSelection) {
|
|
122
124
|
return false;
|
|
123
125
|
}
|
|
124
126
|
|
|
@@ -683,7 +685,7 @@ export function handleRichText(slice) {
|
|
|
683
685
|
return false;
|
|
684
686
|
}
|
|
685
687
|
});
|
|
686
|
-
if (insideTableCell(state) && (!doesBlockNodeExist || isInListItem(state)) || sliceHasList) {
|
|
688
|
+
if (insideTableCell(state) && (!doesBlockNodeExist || isInListItem(state) && canInsert(selection.$from, slice.content) && canInsert(selection.$to, slice.content)) || sliceHasList) {
|
|
687
689
|
tr.replaceSelection(slice);
|
|
688
690
|
} else {
|
|
689
691
|
// need safeInsert rather than replaceSelection, so that nodes aren't split in half
|
|
@@ -33,6 +33,7 @@ export function createPlaceholderDecoration(editorState, placeholderText) {
|
|
|
33
33
|
// when backspace in GBoard composition
|
|
34
34
|
if (browser.android && browser.chrome) {
|
|
35
35
|
var buffNode = document.createElement('span');
|
|
36
|
+
buffNode.setAttribute('class', 'placeholder-android');
|
|
36
37
|
buffNode.setAttribute('contenteditable', 'true');
|
|
37
38
|
buffNode.textContent = ' ';
|
|
38
39
|
placeholderDecoration.appendChild(buffNode);
|
|
@@ -2,4 +2,4 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
2
2
|
var _templateObject;
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { N200 } from '@atlaskit/theme/colors';
|
|
5
|
-
export var placeholderStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror .placeholder-decoration {\n color: ", ";\n width: 100%;\n pointer-events: none;\n user-select: none;\n }\n"])), "var(--ds-text-subtlest, ".concat(N200, ")"));
|
|
5
|
+
export var placeholderStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror .placeholder-decoration {\n color: ", ";\n width: 100%;\n pointer-events: none;\n user-select: none;\n\n .placeholder-android {\n pointer-events: none;\n outline: none;\n user-select: none;\n position: absolute;\n }\n }\n"])), "var(--ds-text-subtlest, ".concat(N200, ")"));
|
|
@@ -11,9 +11,12 @@ import { messages } from '../../list/messages';
|
|
|
11
11
|
import { messages as indentationMessages } from '../../indentation/messages';
|
|
12
12
|
import { buttonGroupStyle, separatorStyles } from '../../../ui/styles';
|
|
13
13
|
import { getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
|
|
14
|
+
import { useEffect, useRef } from 'react';
|
|
14
15
|
export function Toolbar(props) {
|
|
15
16
|
var _useIntl = useIntl(),
|
|
16
17
|
formatMessage = _useIntl.formatMessage;
|
|
18
|
+
var indentButtonRef = useRef(null);
|
|
19
|
+
var outdentButtonRef = useRef(null);
|
|
17
20
|
var disabled = props.disabled,
|
|
18
21
|
isReducedSpacing = props.isReducedSpacing,
|
|
19
22
|
bulletListActive = props.bulletListActive,
|
|
@@ -28,6 +31,8 @@ export function Toolbar(props) {
|
|
|
28
31
|
var labelOrderedList = formatMessage(messages.orderedList);
|
|
29
32
|
var indentMessage = formatMessage(indentationMessages.indent);
|
|
30
33
|
var outdentMessage = formatMessage(indentationMessages.outdent);
|
|
34
|
+
var isIndentButtonFocused = document.activeElement === indentButtonRef.current;
|
|
35
|
+
var isOutdentButtonFocused = document.activeElement === outdentButtonRef.current;
|
|
31
36
|
var handleOnItemActivated = function handleOnItemActivated(buttonName) {
|
|
32
37
|
return function (event) {
|
|
33
38
|
return onItemActivated({
|
|
@@ -36,6 +41,16 @@ export function Toolbar(props) {
|
|
|
36
41
|
});
|
|
37
42
|
};
|
|
38
43
|
};
|
|
44
|
+
useEffect(function () {
|
|
45
|
+
if (isIndentButtonFocused && indentDisabled && outdentButtonRef.current) {
|
|
46
|
+
outdentButtonRef.current.focus();
|
|
47
|
+
}
|
|
48
|
+
}, [indentButtonRef, indentDisabled, isIndentButtonFocused]);
|
|
49
|
+
useEffect(function () {
|
|
50
|
+
if (isOutdentButtonFocused && outdentDisabled && indentButtonRef.current) {
|
|
51
|
+
indentButtonRef.current.focus();
|
|
52
|
+
}
|
|
53
|
+
}, [outdentButtonRef, outdentDisabled, isOutdentButtonFocused]);
|
|
39
54
|
return jsx("span", {
|
|
40
55
|
css: buttonGroupStyle
|
|
41
56
|
}, jsx(ToolbarButton, {
|
|
@@ -75,6 +90,7 @@ export function Toolbar(props) {
|
|
|
75
90
|
}), showIndentationButtons && jsx(ToolbarButton, {
|
|
76
91
|
buttonId: TOOLBAR_BUTTON.OUTDENT,
|
|
77
92
|
testId: TOOLBAR_BUTTON.OUTDENT,
|
|
93
|
+
ref: outdentButtonRef,
|
|
78
94
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
79
95
|
onClick: handleOnItemActivated('outdent'),
|
|
80
96
|
iconBefore: jsx(OutdentIcon, {
|
|
@@ -90,6 +106,7 @@ export function Toolbar(props) {
|
|
|
90
106
|
}), showIndentationButtons && jsx(ToolbarButton, {
|
|
91
107
|
buttonId: TOOLBAR_BUTTON.INDENT,
|
|
92
108
|
testId: TOOLBAR_BUTTON.INDENT,
|
|
109
|
+
ref: indentButtonRef,
|
|
93
110
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
94
111
|
onClick: handleOnItemActivated('indent'),
|
|
95
112
|
iconBefore: jsx(IndentIcon, {
|
|
@@ -197,20 +197,20 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
197
197
|
return false;
|
|
198
198
|
}, [onQueryFocus]);
|
|
199
199
|
var queryStyle = css({
|
|
200
|
-
outline: 'none',
|
|
201
|
-
position: 'absolute',
|
|
202
|
-
fontFamily: 'inherit',
|
|
203
|
-
fontSize: 'inherit',
|
|
204
|
-
fontWeight: 'inherit',
|
|
205
|
-
letterSpacing: 'inherit',
|
|
206
|
-
padding: 0,
|
|
207
|
-
height: '100%',
|
|
208
|
-
width: '100%',
|
|
209
|
-
top: 0,
|
|
210
|
-
left: 0,
|
|
211
|
-
background: 'transparent',
|
|
212
|
-
border: 'none',
|
|
213
200
|
'&&': {
|
|
201
|
+
outline: 'none',
|
|
202
|
+
position: 'absolute',
|
|
203
|
+
fontFamily: 'inherit',
|
|
204
|
+
fontSize: 'inherit',
|
|
205
|
+
fontWeight: 'inherit',
|
|
206
|
+
letterSpacing: 'inherit',
|
|
207
|
+
padding: 0,
|
|
208
|
+
height: '100%',
|
|
209
|
+
width: '100%',
|
|
210
|
+
top: 0,
|
|
211
|
+
left: 0,
|
|
212
|
+
background: 'transparent',
|
|
213
|
+
border: 'none',
|
|
214
214
|
color: "".concat("var(--ds-link, ".concat(colors.B400, ")"))
|
|
215
215
|
}
|
|
216
216
|
});
|
|
@@ -29,7 +29,8 @@ export function hasVisibleContent(node) {
|
|
|
29
29
|
}
|
|
30
30
|
for (var _index = 0; _index < node.childCount; _index++) {
|
|
31
31
|
var child = node.child(_index);
|
|
32
|
-
|
|
32
|
+
var invisibleNodeTypes = ['paragraph', 'text', 'hardBreak'];
|
|
33
|
+
if (!invisibleNodeTypes.includes(child.type.name) || hasVisibleContent(child)) {
|
|
33
34
|
return true;
|
|
34
35
|
}
|
|
35
36
|
}
|
|
@@ -262,7 +263,7 @@ export function processRawValue(schema, value, providerFactory, sanitizePrivateC
|
|
|
262
263
|
action: ACTION.DOCUMENT_PROCESSING_ERROR,
|
|
263
264
|
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
264
265
|
eventType: EVENT_TYPE.OPERATIONAL,
|
|
265
|
-
|
|
266
|
+
nonPrivacySafeAttributes: {
|
|
266
267
|
errorStack: e instanceof Error ? e.stack : String(e)
|
|
267
268
|
}
|
|
268
269
|
});
|
|
@@ -6,6 +6,7 @@ import { canJoin, findWrapping } from 'prosemirror-transform';
|
|
|
6
6
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
7
7
|
import { createInputRulePlugin } from '@atlaskit/prosemirror-input-rules';
|
|
8
8
|
import { addAnalytics } from '../plugins/analytics';
|
|
9
|
+
import { JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST } from '@atlaskit/editor-common/analytics';
|
|
9
10
|
import { closeHistory } from 'prosemirror-history';
|
|
10
11
|
import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
|
|
11
12
|
import { getFeatureFlags } from '../plugins/feature-flags-context';
|
|
@@ -120,13 +121,13 @@ export var createWrappingJoinRule = function createWrappingJoinRule(_ref3) {
|
|
|
120
121
|
if (_node) {
|
|
121
122
|
var nodeEnd = _node.pos + _node.node.nodeSize;
|
|
122
123
|
var after = tr.doc.resolve(nodeEnd).nodeAfter;
|
|
123
|
-
if (after && after.type === nodeType && canJoin(tr.doc, nodeEnd) && (!joinPredicate || joinPredicate(match, after))) {
|
|
124
|
+
if (after && after.type === nodeType && canJoin(tr.doc, nodeEnd) && (!joinPredicate || joinPredicate(match, after, JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST.JOINED_TO_LIST_BELOW))) {
|
|
124
125
|
tr.join(nodeEnd);
|
|
125
126
|
}
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
var before = tr.doc.resolve(fixedStart - 1).nodeBefore;
|
|
129
|
-
if (before && before.type === nodeType && canJoin(tr.doc, fixedStart - 1) && (!joinPredicate || joinPredicate(match, before))) {
|
|
130
|
+
if (before && before.type === nodeType && canJoin(tr.doc, fixedStart - 1) && (!joinPredicate || joinPredicate(match, before, JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST.JOINED_TO_LIST_ABOVE))) {
|
|
130
131
|
tr.join(fixedStart - 1);
|
|
131
132
|
}
|
|
132
133
|
return tr;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { findRootParentListNode } from '../plugins/list/utils/find';
|
|
2
|
+
export var doesSelectionWhichStartsOrEndsInListContainEntireList = function doesSelectionWhichStartsOrEndsInListContainEntireList(selection) {
|
|
3
|
+
var $from = selection.$from,
|
|
4
|
+
$to = selection.$to,
|
|
5
|
+
from = selection.from,
|
|
6
|
+
to = selection.to;
|
|
7
|
+
var selectionParentListItemNodeResolvedPos = findRootParentListNode($from) || findRootParentListNode($to);
|
|
8
|
+
var selectionParentListNode = selectionParentListItemNodeResolvedPos === null || selectionParentListItemNodeResolvedPos === void 0 ? void 0 : selectionParentListItemNodeResolvedPos.parent;
|
|
9
|
+
if (!selectionParentListItemNodeResolvedPos || !selectionParentListNode) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
var startOfEntireList = $from.pos < $to.pos ? selectionParentListItemNodeResolvedPos.pos + $from.depth - 1 : selectionParentListItemNodeResolvedPos.pos + $to.depth - 1;
|
|
13
|
+
var endOfEntireList = $from.pos < $to.pos ? selectionParentListItemNodeResolvedPos.pos + selectionParentListNode.nodeSize - $to.depth - 1 : selectionParentListItemNodeResolvedPos.pos + selectionParentListNode.nodeSize - $from.depth - 1;
|
|
14
|
+
if (!startOfEntireList || !endOfEntireList) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
if (from < to) {
|
|
18
|
+
return startOfEntireList >= $from.pos && endOfEntireList <= $to.pos;
|
|
19
|
+
} else if (from > to) {
|
|
20
|
+
return startOfEntireList >= $to.pos && endOfEntireList <= $from.pos;
|
|
21
|
+
} else {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { extensionProviderToQuickInsertProvider, combineQuickInsertProviders } from './extensions';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* Used to combine the quickInsert provider and extension provider (if available)
|
|
6
|
+
* Or return a provider that is available (quickInsertProvider preferred)
|
|
7
|
+
* @param editorActions
|
|
8
|
+
* @param extensionProvider
|
|
9
|
+
* @param quickInsert
|
|
10
|
+
* @param createAnalyticsEvent
|
|
11
|
+
* @returns Quick insert provider if available
|
|
12
|
+
*/
|
|
13
|
+
export default function prepareQuickInsertProvider(editorActions, extensionProvider, quickInsert, createAnalyticsEvent) {
|
|
14
|
+
var quickInsertProvider = quickInsert && typeof quickInsert !== 'boolean' && quickInsert.provider;
|
|
15
|
+
var extensionQuickInsertProvider = extensionProvider && extensionProviderToQuickInsertProvider(extensionProvider, editorActions, createAnalyticsEvent);
|
|
16
|
+
return quickInsertProvider && extensionQuickInsertProvider ? combineQuickInsertProviders([quickInsertProvider, extensionQuickInsertProvider]) : quickInsertProvider || extensionQuickInsertProvider;
|
|
17
|
+
}
|
package/dist/esm/version.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
2
|
import { EditorPlugin, EditorProps } from '../types';
|
|
3
|
+
import { EditorPluginFeatureProps } from '../types/editor-props';
|
|
3
4
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
4
|
-
import { ScrollGutterPluginOptions } from '../plugins/base/pm-plugins/scroll-gutter';
|
|
5
|
-
import { DefaultPresetPluginOptions } from '../labs/next/presets/default';
|
|
6
|
-
import { EditorPresetProps } from '../labs/next/presets/types';
|
|
7
5
|
import type { InsertNodeAPI } from '../insert-api/types';
|
|
8
6
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
9
7
|
import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
|
|
8
|
+
import { ScrollGutterPluginOptions } from '../plugins/base/pm-plugins/scroll-gutter';
|
|
9
|
+
import { DefaultPresetPluginOptions } from '../labs/next/presets/default';
|
|
10
|
+
import { EditorPresetProps } from '../labs/next/presets/types';
|
|
10
11
|
export declare function getScrollGutterOptions(props: EditorProps): ScrollGutterPluginOptions | undefined;
|
|
11
|
-
export declare function getDefaultPresetOptionsFromEditorProps(props: EditorProps, createAnalyticsEvent?: CreateUIAnalyticsEvent): EditorPresetProps & DefaultPresetPluginOptions;
|
|
12
|
+
export declare function getDefaultPresetOptionsFromEditorProps(props: EditorProps, createAnalyticsEvent?: CreateUIAnalyticsEvent): EditorPresetProps & DefaultPresetPluginOptions & EditorPluginFeatureProps;
|
|
12
13
|
/**
|
|
13
14
|
* Maps EditorProps to EditorPlugins
|
|
14
15
|
*
|
package/dist/types/{plugins/feature-flags-context → create-editor}/feature-flags-from-props.d.ts
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EditorProps } from '
|
|
2
|
-
import type { FeatureFlags } from '
|
|
1
|
+
import { EditorProps } from '../types';
|
|
2
|
+
import type { FeatureFlags } from '../types/feature-flags';
|
|
3
3
|
/**
|
|
4
4
|
* Transforms EditorProps to an FeatureFlags object,
|
|
5
5
|
* which is used by both current and archv3 editors.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
+
import { EditorPlugin } from '../../../types';
|
|
3
|
+
import type { EditorAppearance, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
4
|
+
import { DefaultPresetPluginOptions } from './default';
|
|
5
|
+
import { EditorPresetProps } from './types';
|
|
6
|
+
import type { InsertNodeAPI } from '../../../insert-api/types';
|
|
7
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
8
|
+
import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
|
|
9
|
+
import { Preset } from './preset';
|
|
10
|
+
import { FeatureFlags } from '../../../types/feature-flags';
|
|
11
|
+
import { EditorPluginFeatureProps, EditorProviderProps } from '../../../types/editor-props';
|
|
12
|
+
declare type UniversalPresetProps = EditorPresetProps & DefaultPresetPluginOptions & EditorPluginFeatureProps & EditorProviderProps;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a preset with all of the available plugins.
|
|
15
|
+
* Basis for create-plugins-list and can be used to migrate from Editor -> EditorNext (Presets project)
|
|
16
|
+
* with minimal friction.
|
|
17
|
+
*
|
|
18
|
+
* @param appearance
|
|
19
|
+
* @param props A subset of full EditorProps for the full feature preset
|
|
20
|
+
* @param featureFlags
|
|
21
|
+
* @param prevAppearance The appearance of the editor in the previous render
|
|
22
|
+
* @param createAnalyticsEvent
|
|
23
|
+
* @param insertNodeAPI
|
|
24
|
+
* @param editorAnalyticsAPI
|
|
25
|
+
* @param editorSelectionAPI
|
|
26
|
+
* @param getEditorContainerWidth
|
|
27
|
+
* @returns a full featured preset configured according to the provided props - basis for create-plugins-list
|
|
28
|
+
*/
|
|
29
|
+
export default function createUniversalPreset(appearance: EditorAppearance | undefined, props: UniversalPresetProps, featureFlags: FeatureFlags, prevAppearance?: EditorAppearance, createAnalyticsEvent?: CreateUIAnalyticsEvent, insertNodeAPI?: InsertNodeAPI, editorAnalyticsAPI?: EditorAnalyticsAPI, editorSelectionAPI?: EditorSelectionAPI, getEditorContainerWidth?: GetEditorContainerWidth): Preset<EditorPlugin, []>;
|
|
30
|
+
export {};
|
|
@@ -17,6 +17,10 @@ export declare type EditLinkToolbarProps = {
|
|
|
17
17
|
export declare class EditLinkToolbar extends React.Component<EditLinkToolbarProps> {
|
|
18
18
|
componentDidUpdate(prevProps: EditLinkToolbarProps): void;
|
|
19
19
|
componentWillUnmount(): void;
|
|
20
|
+
/** Focus should move to the 'Edit link' button when the toolbar closes
|
|
21
|
+
* and not close the floating toolbar.
|
|
22
|
+
*/
|
|
23
|
+
private handleEsc;
|
|
20
24
|
private hideLinkToolbar;
|
|
21
25
|
render(): JSX.Element;
|
|
22
26
|
}
|
|
@@ -5,7 +5,10 @@ interface ExpandPluginOptions extends LongPressSelectionPluginOptions {
|
|
|
5
5
|
appearance?: EditorProps['appearance'];
|
|
6
6
|
}
|
|
7
7
|
declare const expandPlugin: NextEditorPlugin<'expand', never, ExpandPluginOptions>;
|
|
8
|
+
interface ExpandEditorProps {
|
|
9
|
+
allowExpand?: EditorProps['allowExpand'];
|
|
10
|
+
}
|
|
8
11
|
export default expandPlugin;
|
|
9
12
|
export type { ExpandPluginState } from './types';
|
|
10
|
-
export declare function isExpandInsertionEnabled({ allowExpand }:
|
|
13
|
+
export declare function isExpandInsertionEnabled({ allowExpand }: ExpandEditorProps): boolean;
|
|
11
14
|
export { pluginKey } from './pm-plugins/plugin-factory';
|