@atlaskit/editor-core 179.0.4 → 179.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 +22 -0
- package/dist/cjs/create-editor/ReactEditorView.js +1 -1
- package/dist/cjs/create-editor/create-plugins-list.js +6 -287
- package/dist/cjs/{plugins/feature-flags-context → create-editor}/feature-flags-from-props.js +0 -0
- 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/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/{plugins/feature-flags-context → create-editor}/feature-flags-from-props.js +0 -0
- 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/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/{plugins/feature-flags-context → create-editor}/feature-flags-from-props.js +0 -0
- 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/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 +8 -8
- package/report.api.md +89 -79
|
@@ -6,17 +6,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.outdentList = outdentList;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _analytics = require("
|
|
9
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
|
+
var _analytics2 = require("../../analytics");
|
|
10
11
|
var _selection = require("../utils/selection");
|
|
11
12
|
var _node = require("../utils/node");
|
|
12
13
|
var _find = require("../utils/find");
|
|
13
|
-
var
|
|
14
|
+
var _analytics3 = require("../utils/analytics");
|
|
14
15
|
var _outdentListItemsSelected = require("../actions/outdent-list-items-selected");
|
|
15
16
|
var _prosemirrorHistory = require("prosemirror-history");
|
|
17
|
+
var _featureFlagsContext = require("../../feature-flags-context");
|
|
16
18
|
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; }
|
|
17
19
|
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; }
|
|
18
20
|
function outdentList() {
|
|
19
|
-
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :
|
|
21
|
+
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics2.INPUT_METHOD.KEYBOARD;
|
|
20
22
|
return function (state, dispatch) {
|
|
21
23
|
if (!(0, _selection.isInsideListItem)(state)) {
|
|
22
24
|
return false;
|
|
@@ -30,7 +32,7 @@ function outdentList() {
|
|
|
30
32
|
|
|
31
33
|
// Save the history, so it could undo/revert to the same state before the outdent, see https://product-fabric.atlassian.net/browse/ED-14753
|
|
32
34
|
(0, _prosemirrorHistory.closeHistory)(state.tr);
|
|
33
|
-
var actionSubjectId = (0, _node.isBulletList)(parentListNode.node) ?
|
|
35
|
+
var actionSubjectId = (0, _node.isBulletList)(parentListNode.node) ? _analytics2.ACTION_SUBJECT_ID.FORMAT_LIST_BULLET : _analytics2.ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
|
|
34
36
|
var customTr = state.tr;
|
|
35
37
|
(0, _outdentListItemsSelected.outdentListItemsSelected)(customTr, state);
|
|
36
38
|
if (!customTr || !customTr.docChanged) {
|
|
@@ -38,12 +40,23 @@ function outdentList() {
|
|
|
38
40
|
// If inside table cell and can't outdent list, then let it handle by table keymap
|
|
39
41
|
return !(0, _selection.isInsideTableCell)(state);
|
|
40
42
|
}
|
|
41
|
-
(0,
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
var featureFlags = (0, _featureFlagsContext.getFeatureFlags)(state);
|
|
44
|
+
var restartListsAttributes = {};
|
|
45
|
+
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
|
|
46
|
+
var _getRestartListsAttri = (0, _analytics3.getRestartListsAttributes)(customTr),
|
|
47
|
+
outdentScenario = _getRestartListsAttri.outdentScenario,
|
|
48
|
+
splitListStartNumber = _getRestartListsAttri.splitListStartNumber;
|
|
49
|
+
if (outdentScenario === _analytics.OUTDENT_SCENARIOS.SPLIT_LIST) {
|
|
50
|
+
restartListsAttributes.outdentScenario = outdentScenario;
|
|
51
|
+
restartListsAttributes.splitListStartNumber = splitListStartNumber;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
(0, _analytics2.addAnalytics)(state, customTr, {
|
|
55
|
+
action: _analytics2.ACTION.OUTDENTED,
|
|
56
|
+
actionSubject: _analytics2.ACTION_SUBJECT.LIST,
|
|
44
57
|
actionSubjectId: actionSubjectId,
|
|
45
|
-
eventType:
|
|
46
|
-
attributes: _objectSpread(_objectSpread({}, (0,
|
|
58
|
+
eventType: _analytics2.EVENT_TYPE.TRACK,
|
|
59
|
+
attributes: _objectSpread(_objectSpread(_objectSpread({}, (0, _analytics3.getCommonListAnalyticsAttributes)(state)), restartListsAttributes), {}, {
|
|
47
60
|
inputMethod: inputMethod
|
|
48
61
|
})
|
|
49
62
|
});
|
|
@@ -6,29 +6,47 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.createRuleForListType = createRuleForListType;
|
|
7
7
|
var _inputRules = require("../../../../utils/input-rules");
|
|
8
8
|
var _analytics = require("../../../analytics");
|
|
9
|
+
var _analytics2 = require("@atlaskit/editor-common/analytics");
|
|
10
|
+
var getOrder = function getOrder(matchResult) {
|
|
11
|
+
return Number(matchResult[1]);
|
|
12
|
+
};
|
|
9
13
|
function createRuleForListType(_ref) {
|
|
10
14
|
var listType = _ref.listType,
|
|
11
15
|
expression = _ref.expression,
|
|
12
16
|
featureFlags = _ref.featureFlags;
|
|
17
|
+
var joinScenario = _analytics2.JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST.NO_JOIN;
|
|
13
18
|
var isBulletList = listType.name === 'bulletList';
|
|
14
19
|
var actionSubjectId = isBulletList ? _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_BULLET : _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
var getAnalyticsPayload = function getAnalyticsPayload(state, matchResult) {
|
|
21
|
+
var analyticsPayload = {
|
|
22
|
+
action: _analytics.ACTION.INSERTED,
|
|
23
|
+
actionSubject: _analytics.ACTION_SUBJECT.LIST,
|
|
24
|
+
actionSubjectId: actionSubjectId,
|
|
25
|
+
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
26
|
+
attributes: {
|
|
27
|
+
inputMethod: _analytics.INPUT_METHOD.FORMATTING
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && listType === state.schema.nodes.orderedList && analyticsPayload.attributes) {
|
|
31
|
+
analyticsPayload.attributes.listStartNumber = getOrder(matchResult);
|
|
32
|
+
analyticsPayload.attributes.joinScenario = joinScenario;
|
|
33
|
+
// we reset the tracked joinScenario after storing it in the event payload
|
|
34
|
+
joinScenario = _analytics2.JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST.NO_JOIN;
|
|
22
35
|
}
|
|
36
|
+
return analyticsPayload;
|
|
23
37
|
};
|
|
24
|
-
var
|
|
25
|
-
|
|
38
|
+
var joinToNeighbourIfSameListType = function joinToNeighbourIfSameListType(_, node, scenario) {
|
|
39
|
+
var shouldJoin = node.type === listType;
|
|
40
|
+
if (shouldJoin) {
|
|
41
|
+
joinScenario = scenario;
|
|
42
|
+
}
|
|
43
|
+
return shouldJoin;
|
|
26
44
|
};
|
|
27
45
|
var getAttrs = {};
|
|
28
46
|
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
|
|
29
47
|
getAttrs = function getAttrs(matchResult) {
|
|
30
48
|
return {
|
|
31
|
-
order:
|
|
49
|
+
order: getOrder(matchResult)
|
|
32
50
|
};
|
|
33
51
|
};
|
|
34
52
|
}
|
|
@@ -36,7 +54,7 @@ function createRuleForListType(_ref) {
|
|
|
36
54
|
match: expression,
|
|
37
55
|
nodeType: listType,
|
|
38
56
|
getAttrs: getAttrs,
|
|
39
|
-
joinPredicate:
|
|
57
|
+
joinPredicate: joinToNeighbourIfSameListType
|
|
40
58
|
});
|
|
41
|
-
return (0, _inputRules.ruleWithAnalytics)(
|
|
59
|
+
return (0, _inputRules.ruleWithAnalytics)(getAnalyticsPayload)(inputRule);
|
|
42
60
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports.getCommonListAnalyticsAttributes = exports.countListItemsInSelection = void 0;
|
|
7
|
+
exports.storeRestartListsAttributes = exports.getRestartListsAttributes = exports.getCommonListAnalyticsAttributes = exports.countListItemsInSelection = exports.RESTART_LISTS_ANALYTICS_KEY = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
9
|
var _node = require("./node");
|
|
8
10
|
var _selection = require("./selection");
|
|
11
|
+
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; }
|
|
12
|
+
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; }
|
|
9
13
|
var getCommonListAnalyticsAttributes = function getCommonListAnalyticsAttributes(state) {
|
|
10
14
|
var _state$selection = state.selection,
|
|
11
15
|
$from = _state$selection.$from,
|
|
@@ -37,4 +41,16 @@ var countListItemsInSelection = function countListItemsInSelection(state) {
|
|
|
37
41
|
});
|
|
38
42
|
return count;
|
|
39
43
|
};
|
|
40
|
-
exports.countListItemsInSelection = countListItemsInSelection;
|
|
44
|
+
exports.countListItemsInSelection = countListItemsInSelection;
|
|
45
|
+
var RESTART_LISTS_ANALYTICS_KEY = 'restartListsAnalytics';
|
|
46
|
+
exports.RESTART_LISTS_ANALYTICS_KEY = RESTART_LISTS_ANALYTICS_KEY;
|
|
47
|
+
var getRestartListsAttributes = function getRestartListsAttributes(tr) {
|
|
48
|
+
var _tr$getMeta;
|
|
49
|
+
return (_tr$getMeta = tr.getMeta(RESTART_LISTS_ANALYTICS_KEY)) !== null && _tr$getMeta !== void 0 ? _tr$getMeta : {};
|
|
50
|
+
};
|
|
51
|
+
exports.getRestartListsAttributes = getRestartListsAttributes;
|
|
52
|
+
var storeRestartListsAttributes = function storeRestartListsAttributes(tr, attributes) {
|
|
53
|
+
var meta = getRestartListsAttributes(tr);
|
|
54
|
+
tr.setMeta(RESTART_LISTS_ANALYTICS_KEY, _objectSpread(_objectSpread({}, meta), attributes));
|
|
55
|
+
};
|
|
56
|
+
exports.storeRestartListsAttributes = storeRestartListsAttributes;
|
|
@@ -56,11 +56,11 @@ exports.showLinkingToolbarWithMediaTypeCheck = showLinkingToolbarWithMediaTypeCh
|
|
|
56
56
|
var hideLinkingToolbarCommand = (0, _linking.createMediaLinkingCommand)({
|
|
57
57
|
type: _actions.MediaLinkingActionsTypes.hideToolbar
|
|
58
58
|
});
|
|
59
|
-
var hideLinkingToolbar = function hideLinkingToolbar(state, dispatch, view) {
|
|
59
|
+
var hideLinkingToolbar = function hideLinkingToolbar(state, dispatch, view, focusFloatingToolbar) {
|
|
60
60
|
hideLinkingToolbarCommand(state, dispatch, view);
|
|
61
61
|
|
|
62
62
|
// restore focus on the editor so keyboard shortcuts aren't lost to the browser
|
|
63
|
-
if (view) {
|
|
63
|
+
if (view && !focusFloatingToolbar) {
|
|
64
64
|
view.focus();
|
|
65
65
|
}
|
|
66
66
|
};
|
|
@@ -35,18 +35,7 @@ var createPlugin = function createPlugin(_ref) {
|
|
|
35
35
|
state: createPluginState(dispatch, {
|
|
36
36
|
isAltTextEditorOpen: false
|
|
37
37
|
}),
|
|
38
|
-
key: pluginKey
|
|
39
|
-
view: function view() {
|
|
40
|
-
return {
|
|
41
|
-
update: function update(view, prev) {
|
|
42
|
-
var pluginState = getPluginState(view.state);
|
|
43
|
-
var oldPluginState = getPluginState(prev);
|
|
44
|
-
if (pluginState && oldPluginState && oldPluginState.isAltTextEditorOpen && !pluginState.isAltTextEditorOpen && !view.hasFocus()) {
|
|
45
|
-
view.focus();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
}
|
|
38
|
+
key: pluginKey
|
|
50
39
|
});
|
|
51
40
|
};
|
|
52
41
|
exports.createPlugin = createPlugin;
|
|
@@ -14,10 +14,13 @@ var _messages = require("../pm-plugins/alt-text/messages");
|
|
|
14
14
|
var _AltTextEdit = _interopRequireWildcard(require("../pm-plugins/alt-text/ui/AltTextEdit"));
|
|
15
15
|
var _mediaCommon = require("../utils/media-common");
|
|
16
16
|
var _style = require("../pm-plugins/alt-text/style");
|
|
17
|
+
var _ui = require("@atlaskit/editor-common/ui");
|
|
18
|
+
var _forceFocus = require("../../floating-toolbar/pm-plugins/force-focus");
|
|
17
19
|
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); }
|
|
18
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
21
|
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; }
|
|
20
22
|
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; }
|
|
23
|
+
var testId = 'alt-text-edit-button';
|
|
21
24
|
var altTextButton = function altTextButton(intl, state) {
|
|
22
25
|
var mediaNode = (0, _mediaCommon.getMediaNodeFromSelection)(state);
|
|
23
26
|
var message = mediaNode && mediaNode.attrs.alt ? _messages.messages.editAltText : _messages.messages.altText;
|
|
@@ -28,7 +31,7 @@ var altTextButton = function altTextButton(intl, state) {
|
|
|
28
31
|
type: 'button',
|
|
29
32
|
onClick: _commands.openMediaAltTextMenu,
|
|
30
33
|
showTitle: true,
|
|
31
|
-
testId:
|
|
34
|
+
testId: testId,
|
|
32
35
|
tooltipContent: /*#__PURE__*/_react.default.createElement(_keymaps.ToolTipContent, {
|
|
33
36
|
description: title,
|
|
34
37
|
keymap: _keymaps.addAltText
|
|
@@ -36,6 +39,7 @@ var altTextButton = function altTextButton(intl, state) {
|
|
|
36
39
|
};
|
|
37
40
|
};
|
|
38
41
|
exports.altTextButton = altTextButton;
|
|
42
|
+
var AltTextEditWithListeners = (0, _ui.withOuterListeners)(_AltTextEdit.default);
|
|
39
43
|
var altTextEditComponent = function altTextEditComponent(options) {
|
|
40
44
|
return {
|
|
41
45
|
type: 'custom',
|
|
@@ -49,11 +53,18 @@ var altTextEditComponent = function altTextEditComponent(options) {
|
|
|
49
53
|
if (!mediaNode) {
|
|
50
54
|
return null;
|
|
51
55
|
}
|
|
52
|
-
|
|
56
|
+
/** Focus should move to the 'Alt text' button when the toolbar closes
|
|
57
|
+
* and not close the floating toolbar.
|
|
58
|
+
*/
|
|
59
|
+
var handleEsc = function handleEsc(e) {
|
|
60
|
+
(0, _forceFocus.forceFocusSelector)("[data-testid=\"".concat(testId, "\"]"), view);
|
|
61
|
+
};
|
|
62
|
+
return /*#__PURE__*/_react.default.createElement(AltTextEditWithListeners, {
|
|
53
63
|
view: view,
|
|
54
64
|
key: idx,
|
|
55
65
|
value: mediaNode.attrs.alt,
|
|
56
|
-
altTextValidator: options && options.altTextValidator
|
|
66
|
+
altTextValidator: options && options.altTextValidator,
|
|
67
|
+
handleEscapeKeydown: handleEsc
|
|
57
68
|
});
|
|
58
69
|
}
|
|
59
70
|
};
|
|
@@ -32,25 +32,24 @@ var LinkToolbarAppearance = function LinkToolbarAppearance(_ref) {
|
|
|
32
32
|
onAddLink = _ref.onAddLink,
|
|
33
33
|
onEditLink = _ref.onEditLink,
|
|
34
34
|
onOpenLink = _ref.onOpenLink;
|
|
35
|
-
var _useState = (0, _react.useState)(
|
|
35
|
+
var _useState = (0, _react.useState)(true),
|
|
36
36
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
37
37
|
showLinkingControls = _useState2[0],
|
|
38
38
|
setShowLinkingControls = _useState2[1];
|
|
39
39
|
(0, _react.useEffect)(function () {
|
|
40
40
|
var _stateKey$getState;
|
|
41
|
-
setShowLinkingControls(false);
|
|
42
41
|
var mediaNode = (0, _currentMediaNode.currentMediaNode)(editorState);
|
|
43
42
|
if (!mediaNode) {
|
|
43
|
+
setShowLinkingControls(false);
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
46
|
var mediaClientConfig = (_stateKey$getState = _pluginKey.stateKey.getState(editorState)) === null || _stateKey$getState === void 0 ? void 0 : _stateKey$getState.mediaClientConfig;
|
|
47
47
|
if (!mediaClientConfig) {
|
|
48
|
+
setShowLinkingControls(false);
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
50
51
|
(0, _checkMediaType.checkMediaType)(mediaNode, mediaClientConfig).then(function (mediaType) {
|
|
51
|
-
|
|
52
|
-
setShowLinkingControls(true);
|
|
53
|
-
}
|
|
52
|
+
setShowLinkingControls(mediaType === 'external' || mediaType === 'image');
|
|
54
53
|
});
|
|
55
54
|
}, [editorState]);
|
|
56
55
|
if (!showLinkingControls) {
|
|
@@ -68,7 +67,8 @@ var LinkToolbarAppearance = function LinkToolbarAppearance(_ref) {
|
|
|
68
67
|
tooltipContent: (0, _react2.jsx)(_keymaps.ToolTipContent, {
|
|
69
68
|
description: title,
|
|
70
69
|
keymap: _keymaps.addLink
|
|
71
|
-
})
|
|
70
|
+
}),
|
|
71
|
+
testId: "edit-link-button"
|
|
72
72
|
}, title)), (0, _react2.jsx)("div", {
|
|
73
73
|
css: wrapper
|
|
74
74
|
}, (0, _react2.jsx)(_Separator.default, null)), (0, _react2.jsx)(_Button.default, {
|
|
@@ -12,8 +12,10 @@ var _linking = require("../commands/linking");
|
|
|
12
12
|
var _linking2 = require("../pm-plugins/linking");
|
|
13
13
|
var _MediaLinkingToolbar = _interopRequireDefault(require("../ui/MediaLinkingToolbar"));
|
|
14
14
|
var _ToolbarComponents = require("../../../ui/LinkSearch/ToolbarComponents");
|
|
15
|
+
var _forceFocus = require("../../floating-toolbar/pm-plugins/force-focus");
|
|
15
16
|
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; }
|
|
16
17
|
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; }
|
|
18
|
+
var FORCE_FOCUS_SELECTOR = '[data-testid="add-link-button"],[data-testid="edit-link-button"]';
|
|
17
19
|
function shouldShowMediaLinkToolbar(editorState) {
|
|
18
20
|
var mediaLinkingState = (0, _linking2.getMediaLinkingState)(editorState);
|
|
19
21
|
if (!mediaLinkingState || mediaLinkingState.mediaPos === null) {
|
|
@@ -66,7 +68,11 @@ var getLinkingToolbar = function getLinkingToolbar(toolbarBaseConfig, mediaLinki
|
|
|
66
68
|
(0, _linking.hideLinkingToolbar)(view.state, view.dispatch, view);
|
|
67
69
|
},
|
|
68
70
|
onCancel: function onCancel() {
|
|
69
|
-
|
|
71
|
+
(0, _linking.hideLinkingToolbar)(view.state, view.dispatch, view, true);
|
|
72
|
+
/** Focus should move to the 'Add link' button when the toolbar closes
|
|
73
|
+
* and not close the floating toolbar.
|
|
74
|
+
*/
|
|
75
|
+
(0, _forceFocus.forceFocusSelector)(FORCE_FOCUS_SELECTOR, view);
|
|
70
76
|
},
|
|
71
77
|
onSubmit: function onSubmit(href, meta) {
|
|
72
78
|
(0, _linking.setUrlToMedia)(href, meta.inputMethod)(view.state, view.dispatch, view);
|
|
@@ -44,6 +44,7 @@ var _main2 = require("../hyperlink/pm-plugins/main");
|
|
|
44
44
|
var _edgeCases = require("./edge-cases");
|
|
45
45
|
var _commands = require("./commands");
|
|
46
46
|
var _pluginFactory = require("./pm-plugins/plugin-factory");
|
|
47
|
+
var _lists = require("../../utils/lists");
|
|
47
48
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
48
49
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
49
50
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
@@ -112,7 +113,7 @@ function handlePasteIntoTaskOrDecisionOrPanel(slice) {
|
|
|
112
113
|
}
|
|
113
114
|
var transformedSlice = _utils2.compose.apply(null, filters)(slice);
|
|
114
115
|
var tr = (0, _prosemirrorHistory.closeHistory)(state.tr);
|
|
115
|
-
var transformedSliceIsValidNode = transformedSlice.content.firstChild.type.inlineContent || ['decisionList', 'decisionItem', 'taskList', 'taskItem', 'panel'].includes(transformedSlice.content.firstChild.type.name);
|
|
116
|
+
var transformedSliceIsValidNode = transformedSlice.content.firstChild.type.inlineContent || ['decisionList', 'decisionItem', 'taskList', 'taskItem', 'panel'].includes(transformedSlice.content.firstChild.type.name) && !(0, _utils2.isInListItem)(state);
|
|
116
117
|
// If the slice or the selection are valid nodes to handle,
|
|
117
118
|
// and the slice is not a whole node (i.e. openStart is 1 and openEnd is 0)
|
|
118
119
|
// or the slice's first node is a paragraph,
|
|
@@ -135,11 +136,12 @@ function handlePastePanelIntoList(slice) {
|
|
|
135
136
|
var schema = state.schema,
|
|
136
137
|
tr = state.tr;
|
|
137
138
|
var selection = tr.selection;
|
|
138
|
-
|
|
139
139
|
// Check this pasting action is related to copy content from panel node into a selected the list node
|
|
140
|
-
var selectionParentListNode = selection.$to.node(selection.$to.depth - 1);
|
|
141
140
|
var panelNode = slice.content.firstChild;
|
|
142
|
-
|
|
141
|
+
var isSliceWholeNode = slice.openStart === 0 && slice.openEnd === 0;
|
|
142
|
+
var selectionParentListItemNode = selection.$to.node(selection.$to.depth - 1);
|
|
143
|
+
var sliceIsWholeNodeButShouldNotReplaceSelection = isSliceWholeNode && !(0, _lists.doesSelectionWhichStartsOrEndsInListContainEntireList)(selection);
|
|
144
|
+
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) {
|
|
143
145
|
return false;
|
|
144
146
|
}
|
|
145
147
|
|
|
@@ -704,7 +706,7 @@ function handleRichText(slice) {
|
|
|
704
706
|
return false;
|
|
705
707
|
}
|
|
706
708
|
});
|
|
707
|
-
if ((0, _utils2.insideTableCell)(state) && (!doesBlockNodeExist || (0, _utils2.isInListItem)(state)) || sliceHasList) {
|
|
709
|
+
if ((0, _utils2.insideTableCell)(state) && (!doesBlockNodeExist || (0, _utils2.isInListItem)(state) && (0, _prosemirrorUtils.canInsert)(selection.$from, slice.content) && (0, _prosemirrorUtils.canInsert)(selection.$to, slice.content)) || sliceHasList) {
|
|
708
710
|
tr.replaceSelection(slice);
|
|
709
711
|
} else {
|
|
710
712
|
// need safeInsert rather than replaceSelection, so that nodes aren't split in half
|
|
@@ -18,6 +18,7 @@ var _messages = require("../../list/messages");
|
|
|
18
18
|
var _messages2 = require("../../indentation/messages");
|
|
19
19
|
var _styles = require("../../../ui/styles");
|
|
20
20
|
var _keymaps2 = require("@atlaskit/editor-common/keymaps");
|
|
21
|
+
var _react2 = require("react");
|
|
21
22
|
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); }
|
|
22
23
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
24
|
/** @jsx jsx */
|
|
@@ -25,6 +26,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
25
26
|
function Toolbar(props) {
|
|
26
27
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
27
28
|
formatMessage = _useIntl.formatMessage;
|
|
29
|
+
var indentButtonRef = (0, _react2.useRef)(null);
|
|
30
|
+
var outdentButtonRef = (0, _react2.useRef)(null);
|
|
28
31
|
var disabled = props.disabled,
|
|
29
32
|
isReducedSpacing = props.isReducedSpacing,
|
|
30
33
|
bulletListActive = props.bulletListActive,
|
|
@@ -39,6 +42,8 @@ function Toolbar(props) {
|
|
|
39
42
|
var labelOrderedList = formatMessage(_messages.messages.orderedList);
|
|
40
43
|
var indentMessage = formatMessage(_messages2.messages.indent);
|
|
41
44
|
var outdentMessage = formatMessage(_messages2.messages.outdent);
|
|
45
|
+
var isIndentButtonFocused = document.activeElement === indentButtonRef.current;
|
|
46
|
+
var isOutdentButtonFocused = document.activeElement === outdentButtonRef.current;
|
|
42
47
|
var handleOnItemActivated = function handleOnItemActivated(buttonName) {
|
|
43
48
|
return function (event) {
|
|
44
49
|
return onItemActivated({
|
|
@@ -47,6 +52,16 @@ function Toolbar(props) {
|
|
|
47
52
|
});
|
|
48
53
|
};
|
|
49
54
|
};
|
|
55
|
+
(0, _react2.useEffect)(function () {
|
|
56
|
+
if (isIndentButtonFocused && indentDisabled && outdentButtonRef.current) {
|
|
57
|
+
outdentButtonRef.current.focus();
|
|
58
|
+
}
|
|
59
|
+
}, [indentButtonRef, indentDisabled, isIndentButtonFocused]);
|
|
60
|
+
(0, _react2.useEffect)(function () {
|
|
61
|
+
if (isOutdentButtonFocused && outdentDisabled && indentButtonRef.current) {
|
|
62
|
+
indentButtonRef.current.focus();
|
|
63
|
+
}
|
|
64
|
+
}, [outdentButtonRef, outdentDisabled, isOutdentButtonFocused]);
|
|
50
65
|
return (0, _react.jsx)("span", {
|
|
51
66
|
css: _styles.buttonGroupStyle
|
|
52
67
|
}, (0, _react.jsx)(_ToolbarButton.default, {
|
|
@@ -86,6 +101,7 @@ function Toolbar(props) {
|
|
|
86
101
|
}), showIndentationButtons && (0, _react.jsx)(_ToolbarButton.default, {
|
|
87
102
|
buttonId: _ToolbarButton.TOOLBAR_BUTTON.OUTDENT,
|
|
88
103
|
testId: _ToolbarButton.TOOLBAR_BUTTON.OUTDENT,
|
|
104
|
+
ref: outdentButtonRef,
|
|
89
105
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
90
106
|
onClick: handleOnItemActivated('outdent'),
|
|
91
107
|
iconBefore: (0, _react.jsx)(_outdent.default, {
|
|
@@ -101,6 +117,7 @@ function Toolbar(props) {
|
|
|
101
117
|
}), showIndentationButtons && (0, _react.jsx)(_ToolbarButton.default, {
|
|
102
118
|
buttonId: _ToolbarButton.TOOLBAR_BUTTON.INDENT,
|
|
103
119
|
testId: _ToolbarButton.TOOLBAR_BUTTON.INDENT,
|
|
120
|
+
ref: indentButtonRef,
|
|
104
121
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
105
122
|
onClick: handleOnItemActivated('indent'),
|
|
106
123
|
iconBefore: (0, _react.jsx)(_indent.default, {
|
|
@@ -207,20 +207,20 @@ var InputQuery = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
207
207
|
return false;
|
|
208
208
|
}, [onQueryFocus]);
|
|
209
209
|
var queryStyle = (0, _react2.css)({
|
|
210
|
-
outline: 'none',
|
|
211
|
-
position: 'absolute',
|
|
212
|
-
fontFamily: 'inherit',
|
|
213
|
-
fontSize: 'inherit',
|
|
214
|
-
fontWeight: 'inherit',
|
|
215
|
-
letterSpacing: 'inherit',
|
|
216
|
-
padding: 0,
|
|
217
|
-
height: '100%',
|
|
218
|
-
width: '100%',
|
|
219
|
-
top: 0,
|
|
220
|
-
left: 0,
|
|
221
|
-
background: 'transparent',
|
|
222
|
-
border: 'none',
|
|
223
210
|
'&&': {
|
|
211
|
+
outline: 'none',
|
|
212
|
+
position: 'absolute',
|
|
213
|
+
fontFamily: 'inherit',
|
|
214
|
+
fontSize: 'inherit',
|
|
215
|
+
fontWeight: 'inherit',
|
|
216
|
+
letterSpacing: 'inherit',
|
|
217
|
+
padding: 0,
|
|
218
|
+
height: '100%',
|
|
219
|
+
width: '100%',
|
|
220
|
+
top: 0,
|
|
221
|
+
left: 0,
|
|
222
|
+
background: 'transparent',
|
|
223
|
+
border: 'none',
|
|
224
224
|
color: "".concat("var(--ds-link, ".concat(colors.B400, ")"))
|
|
225
225
|
}
|
|
226
226
|
});
|
|
@@ -51,7 +51,8 @@ function hasVisibleContent(node) {
|
|
|
51
51
|
}
|
|
52
52
|
for (var _index = 0; _index < node.childCount; _index++) {
|
|
53
53
|
var child = node.child(_index);
|
|
54
|
-
|
|
54
|
+
var invisibleNodeTypes = ['paragraph', 'text', 'hardBreak'];
|
|
55
|
+
if (!invisibleNodeTypes.includes(child.type.name) || hasVisibleContent(child)) {
|
|
55
56
|
return true;
|
|
56
57
|
}
|
|
57
58
|
}
|
|
@@ -284,7 +285,7 @@ function processRawValue(schema, value, providerFactory, sanitizePrivateContent,
|
|
|
284
285
|
action: _enums.ACTION.DOCUMENT_PROCESSING_ERROR,
|
|
285
286
|
actionSubject: _enums.ACTION_SUBJECT.EDITOR,
|
|
286
287
|
eventType: _enums.EVENT_TYPE.OPERATIONAL,
|
|
287
|
-
|
|
288
|
+
nonPrivacySafeAttributes: {
|
|
288
289
|
errorStack: e instanceof Error ? e.stack : String(e)
|
|
289
290
|
}
|
|
290
291
|
});
|
|
@@ -11,6 +11,7 @@ var _prosemirrorTransform = require("prosemirror-transform");
|
|
|
11
11
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
12
12
|
var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
|
|
13
13
|
var _analytics = require("../plugins/analytics");
|
|
14
|
+
var _analytics2 = require("@atlaskit/editor-common/analytics");
|
|
14
15
|
var _prosemirrorHistory = require("prosemirror-history");
|
|
15
16
|
var _prosemirrorUtils = require("prosemirror-utils");
|
|
16
17
|
var _featureFlagsContext = require("../plugins/feature-flags-context");
|
|
@@ -132,13 +133,13 @@ var createWrappingJoinRule = function createWrappingJoinRule(_ref3) {
|
|
|
132
133
|
if (_node) {
|
|
133
134
|
var nodeEnd = _node.pos + _node.node.nodeSize;
|
|
134
135
|
var after = tr.doc.resolve(nodeEnd).nodeAfter;
|
|
135
|
-
if (after && after.type === nodeType && (0, _prosemirrorTransform.canJoin)(tr.doc, nodeEnd) && (!joinPredicate || joinPredicate(match, after))) {
|
|
136
|
+
if (after && after.type === nodeType && (0, _prosemirrorTransform.canJoin)(tr.doc, nodeEnd) && (!joinPredicate || joinPredicate(match, after, _analytics2.JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST.JOINED_TO_LIST_BELOW))) {
|
|
136
137
|
tr.join(nodeEnd);
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
}
|
|
140
141
|
var before = tr.doc.resolve(fixedStart - 1).nodeBefore;
|
|
141
|
-
if (before && before.type === nodeType && (0, _prosemirrorTransform.canJoin)(tr.doc, fixedStart - 1) && (!joinPredicate || joinPredicate(match, before))) {
|
|
142
|
+
if (before && before.type === nodeType && (0, _prosemirrorTransform.canJoin)(tr.doc, fixedStart - 1) && (!joinPredicate || joinPredicate(match, before, _analytics2.JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST.JOINED_TO_LIST_ABOVE))) {
|
|
142
143
|
tr.join(fixedStart - 1);
|
|
143
144
|
}
|
|
144
145
|
return tr;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.doesSelectionWhichStartsOrEndsInListContainEntireList = void 0;
|
|
7
|
+
var _find = require("../plugins/list/utils/find");
|
|
8
|
+
var doesSelectionWhichStartsOrEndsInListContainEntireList = function doesSelectionWhichStartsOrEndsInListContainEntireList(selection) {
|
|
9
|
+
var $from = selection.$from,
|
|
10
|
+
$to = selection.$to,
|
|
11
|
+
from = selection.from,
|
|
12
|
+
to = selection.to;
|
|
13
|
+
var selectionParentListItemNodeResolvedPos = (0, _find.findRootParentListNode)($from) || (0, _find.findRootParentListNode)($to);
|
|
14
|
+
var selectionParentListNode = selectionParentListItemNodeResolvedPos === null || selectionParentListItemNodeResolvedPos === void 0 ? void 0 : selectionParentListItemNodeResolvedPos.parent;
|
|
15
|
+
if (!selectionParentListItemNodeResolvedPos || !selectionParentListNode) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
var startOfEntireList = $from.pos < $to.pos ? selectionParentListItemNodeResolvedPos.pos + $from.depth - 1 : selectionParentListItemNodeResolvedPos.pos + $to.depth - 1;
|
|
19
|
+
var endOfEntireList = $from.pos < $to.pos ? selectionParentListItemNodeResolvedPos.pos + selectionParentListNode.nodeSize - $to.depth - 1 : selectionParentListItemNodeResolvedPos.pos + selectionParentListNode.nodeSize - $from.depth - 1;
|
|
20
|
+
if (!startOfEntireList || !endOfEntireList) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
if (from < to) {
|
|
24
|
+
return startOfEntireList >= $from.pos && endOfEntireList <= $to.pos;
|
|
25
|
+
} else if (from > to) {
|
|
26
|
+
return startOfEntireList >= $to.pos && endOfEntireList <= $from.pos;
|
|
27
|
+
} else {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
exports.doesSelectionWhichStartsOrEndsInListContainEntireList = doesSelectionWhichStartsOrEndsInListContainEntireList;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = prepareQuickInsertProvider;
|
|
7
|
+
var _extensions = require("./extensions");
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* Used to combine the quickInsert provider and extension provider (if available)
|
|
11
|
+
* Or return a provider that is available (quickInsertProvider preferred)
|
|
12
|
+
* @param editorActions
|
|
13
|
+
* @param extensionProvider
|
|
14
|
+
* @param quickInsert
|
|
15
|
+
* @param createAnalyticsEvent
|
|
16
|
+
* @returns Quick insert provider if available
|
|
17
|
+
*/
|
|
18
|
+
function prepareQuickInsertProvider(editorActions, extensionProvider, quickInsert, createAnalyticsEvent) {
|
|
19
|
+
var quickInsertProvider = quickInsert && typeof quickInsert !== 'boolean' && quickInsert.provider;
|
|
20
|
+
var extensionQuickInsertProvider = extensionProvider && (0, _extensions.extensionProviderToQuickInsertProvider)(extensionProvider, editorActions, createAnalyticsEvent);
|
|
21
|
+
return quickInsertProvider && extensionQuickInsertProvider ? (0, _extensions.combineQuickInsertProviders)([quickInsertProvider, extensionQuickInsertProvider]) : quickInsertProvider || extensionQuickInsertProvider;
|
|
22
|
+
}
|
|
@@ -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 = "179.0
|
|
9
|
+
var version = "179.1.0";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/cjs/version.json
CHANGED
|
@@ -14,7 +14,7 @@ import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
|
14
14
|
import { findChangedNodesFromTransaction, validateNodes, validNode } from '../utils/nodes';
|
|
15
15
|
import createPluginList from './create-plugins-list';
|
|
16
16
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent, FULL_WIDTH_MODE, getAnalyticsEventsFromTransaction, PLATFORMS } from '../plugins/analytics';
|
|
17
|
-
import { createFeatureFlagsFromProps } from '
|
|
17
|
+
import { createFeatureFlagsFromProps } from './feature-flags-from-props';
|
|
18
18
|
import { getEnabledFeatureFlagKeys } from '../plugins/feature-flags-context/get-enabled-feature-flag-keys';
|
|
19
19
|
import { createErrorReporter, createPMPlugins, processPluginsList } from './create-editor';
|
|
20
20
|
import { getDocStructure } from '../utils/document-logger';
|