@atlaskit/editor-core 188.12.0 → 188.12.2
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 +15 -0
- package/dist/cjs/labs/next/presets/universal.js +12 -1
- package/dist/cjs/plugins/annotation/index.js +12 -1
- package/dist/cjs/plugins/annotation/pm-plugins/inline-comment.js +2 -1
- package/dist/cjs/plugins/annotation/pm-plugins/plugin-factory.js +5 -0
- package/dist/cjs/plugins/annotation/pm-plugins/reducer.js +2 -1
- package/dist/cjs/plugins/annotation/toolbar.js +2 -156
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +33 -31
- package/dist/cjs/plugins/layout/actions.js +20 -17
- package/dist/cjs/plugins/layout/index.js +6 -2
- package/dist/cjs/plugins/panel/index.js +1 -1
- package/dist/cjs/plugins/panel/toolbar.js +9 -7
- package/dist/cjs/plugins/paste/plugins/media.js +50 -24
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +0 -6
- package/dist/cjs/plugins/paste/pm-plugins/main.js +1 -0
- package/dist/cjs/plugins/rank.js +1 -1
- package/dist/cjs/plugins/tasks-and-decisions/index.js +1 -1
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +104 -90
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/labs/next/presets/universal.js +12 -1
- package/dist/es2019/plugins/annotation/index.js +14 -1
- package/dist/es2019/plugins/annotation/pm-plugins/inline-comment.js +2 -1
- package/dist/es2019/plugins/annotation/pm-plugins/plugin-factory.js +6 -0
- package/dist/es2019/plugins/annotation/pm-plugins/reducer.js +2 -1
- package/dist/es2019/plugins/annotation/toolbar.js +1 -156
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +4 -3
- package/dist/es2019/plugins/layout/actions.js +4 -3
- package/dist/es2019/plugins/layout/index.js +63 -57
- package/dist/es2019/plugins/panel/index.js +1 -1
- package/dist/es2019/plugins/panel/toolbar.js +9 -7
- package/dist/es2019/plugins/paste/plugins/media.js +53 -25
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +1 -4
- package/dist/es2019/plugins/paste/pm-plugins/main.js +4 -5
- package/dist/es2019/plugins/rank.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/index.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +22 -14
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/labs/next/presets/universal.js +12 -1
- package/dist/esm/plugins/annotation/index.js +12 -1
- package/dist/esm/plugins/annotation/pm-plugins/inline-comment.js +2 -1
- package/dist/esm/plugins/annotation/pm-plugins/plugin-factory.js +5 -0
- package/dist/esm/plugins/annotation/pm-plugins/reducer.js +2 -1
- package/dist/esm/plugins/annotation/toolbar.js +1 -156
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +33 -31
- package/dist/esm/plugins/layout/actions.js +15 -12
- package/dist/esm/plugins/layout/index.js +7 -3
- package/dist/esm/plugins/panel/index.js +1 -1
- package/dist/esm/plugins/panel/toolbar.js +9 -7
- package/dist/esm/plugins/paste/plugins/media.js +50 -23
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +1 -6
- package/dist/esm/plugins/paste/pm-plugins/main.js +4 -5
- package/dist/esm/plugins/rank.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/index.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +104 -90
- package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/annotation/pm-plugins/types.d.ts +1 -0
- package/dist/types/plugins/insert-block/types.d.ts +3 -1
- package/dist/types/plugins/layout/actions.d.ts +2 -1
- package/dist/types/plugins/layout/index.d.ts +4 -0
- package/dist/types/plugins/panel/index.d.ts +2 -2
- package/dist/types/plugins/panel/toolbar.d.ts +5 -3
- package/dist/types/plugins/paste/plugins/media.d.ts +11 -0
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +0 -1
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/keymaps.d.ts +7 -4
- package/dist/types/plugins/tasks-and-decisions/types.d.ts +5 -1
- package/dist/types-ts4.5/plugins/annotation/pm-plugins/types.d.ts +1 -0
- package/dist/types-ts4.5/plugins/insert-block/types.d.ts +3 -1
- package/dist/types-ts4.5/plugins/layout/actions.d.ts +2 -1
- package/dist/types-ts4.5/plugins/layout/index.d.ts +4 -0
- package/dist/types-ts4.5/plugins/panel/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/panel/toolbar.d.ts +5 -3
- package/dist/types-ts4.5/plugins/paste/plugins/media.d.ts +11 -0
- package/dist/types-ts4.5/plugins/paste/pm-plugins/analytics.d.ts +0 -1
- package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/keymaps.d.ts +7 -4
- package/dist/types-ts4.5/plugins/tasks-and-decisions/types.d.ts +3 -1
- package/package.json +6 -2
|
@@ -6,14 +6,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.isImage = void 0;
|
|
8
8
|
exports.transformSliceForMedia = transformSliceForMedia;
|
|
9
|
-
exports.unwrapNestedMediaElements = exports.transformSliceToCorrectMediaWrapper = void 0;
|
|
9
|
+
exports.unwrapNestedMediaElements = exports.transformSliceToMediaSingleWithNewExperience = exports.transformSliceToCorrectMediaWrapper = void 0;
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
12
12
|
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
13
13
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
14
|
var _mediaCommon = require("@atlaskit/media-common");
|
|
15
|
+
var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
15
16
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
17
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18
|
+
/**
|
|
19
|
+
* Ensure correct layout in nested mode
|
|
20
|
+
*
|
|
21
|
+
* TODO: this func is only used in handlePaste, so layout update won't work for drop event
|
|
22
|
+
*/
|
|
17
23
|
function transformSliceForMedia(slice, schema) {
|
|
18
24
|
var _schema$nodes = schema.nodes,
|
|
19
25
|
mediaSingle = _schema$nodes.mediaSingle,
|
|
@@ -21,8 +27,6 @@ function transformSliceForMedia(slice, schema) {
|
|
|
21
27
|
table = _schema$nodes.table,
|
|
22
28
|
bulletList = _schema$nodes.bulletList,
|
|
23
29
|
orderedList = _schema$nodes.orderedList,
|
|
24
|
-
media = _schema$nodes.media,
|
|
25
|
-
mediaInline = _schema$nodes.mediaInline,
|
|
26
30
|
expand = _schema$nodes.expand,
|
|
27
31
|
nestedExpand = _schema$nodes.nestedExpand;
|
|
28
32
|
return function (selection) {
|
|
@@ -49,27 +53,6 @@ function transformSliceForMedia(slice, schema) {
|
|
|
49
53
|
return node.type.name === 'mediaSingle' ? mediaSingle.createChecked(attrs, node.content, node.marks) : node;
|
|
50
54
|
});
|
|
51
55
|
}
|
|
52
|
-
var __mediaTraceId = (0, _mediaCommon.getRandomHex)(8);
|
|
53
|
-
newSlice = (0, _utils2.mapSlice)(newSlice, function (node) {
|
|
54
|
-
// This logic is duplicated in editor-plugin-ai where external images can be inserted
|
|
55
|
-
// from external sources through the use of AI. The editor-plugin-ai package is avoiding
|
|
56
|
-
// sharing dependencies with editor-core to support products using it with various versions
|
|
57
|
-
// of editor packages.
|
|
58
|
-
// The duplication is in the following file:
|
|
59
|
-
// packages/editor/editor-plugin-ai/src/prebuilt/content-transformers/markdown-to-pm/markdown-transformer.ts
|
|
60
|
-
if (node.type.name === 'media') {
|
|
61
|
-
return media.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
62
|
-
__external: node.attrs.type === 'external',
|
|
63
|
-
__mediaTraceId: node.attrs.type === 'external' ? null : __mediaTraceId
|
|
64
|
-
}), node.content, node.marks);
|
|
65
|
-
}
|
|
66
|
-
if (node.type.name === 'mediaInline') {
|
|
67
|
-
return mediaInline.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
68
|
-
__mediaTraceId: __mediaTraceId
|
|
69
|
-
}), node.content, node.marks);
|
|
70
|
-
}
|
|
71
|
-
return node;
|
|
72
|
-
});
|
|
73
56
|
return newSlice;
|
|
74
57
|
};
|
|
75
58
|
}
|
|
@@ -95,6 +78,49 @@ var transformSliceToCorrectMediaWrapper = exports.transformSliceToCorrectMediaWr
|
|
|
95
78
|
});
|
|
96
79
|
};
|
|
97
80
|
|
|
81
|
+
/**
|
|
82
|
+
* This func will be called when copy & paste, drag & drop external html with media, media files, and slices from editor
|
|
83
|
+
* Because width may not be available when transform, DEFAULT_IMAGE_WIDTH is used as a fallback
|
|
84
|
+
*
|
|
85
|
+
*/
|
|
86
|
+
var transformSliceToMediaSingleWithNewExperience = exports.transformSliceToMediaSingleWithNewExperience = function transformSliceToMediaSingleWithNewExperience(slice, schema) {
|
|
87
|
+
var _schema$nodes3 = schema.nodes,
|
|
88
|
+
mediaInline = _schema$nodes3.mediaInline,
|
|
89
|
+
mediaSingle = _schema$nodes3.mediaSingle,
|
|
90
|
+
media = _schema$nodes3.media;
|
|
91
|
+
var newSlice = (0, _utils2.mapSlice)(slice, function (node) {
|
|
92
|
+
// This logic is duplicated in editor-plugin-ai where external images can be inserted
|
|
93
|
+
// from external sources through the use of AI. The editor-plugin-ai package is avoiding
|
|
94
|
+
// sharing dependencies with editor-core to support products using it with various versions
|
|
95
|
+
// of editor packages.
|
|
96
|
+
// The duplication is in the following file:
|
|
97
|
+
// packages/editor/editor-plugin-ai/src/prebuilt/content-transformers/markdown-to-pm/markdown-transformer.ts
|
|
98
|
+
if (node.type === mediaSingle) {
|
|
99
|
+
return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.extended-resize-experience') ? mediaSingle.createChecked({
|
|
100
|
+
width: node.attrs.width || _mediaSingle.DEFAULT_IMAGE_WIDTH,
|
|
101
|
+
widthType: node.attrs.widthType || 'pixel',
|
|
102
|
+
layout: node.attrs.layout
|
|
103
|
+
}, node.content, node.marks) : node;
|
|
104
|
+
}
|
|
105
|
+
return node;
|
|
106
|
+
});
|
|
107
|
+
return (0, _utils2.mapSlice)(newSlice, function (node) {
|
|
108
|
+
var __mediaTraceId = (0, _mediaCommon.getRandomHex)(8);
|
|
109
|
+
if (node.type === media) {
|
|
110
|
+
return media.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
111
|
+
__external: node.attrs.type === 'external',
|
|
112
|
+
__mediaTraceId: node.attrs.type === 'external' ? null : __mediaTraceId
|
|
113
|
+
}), node.content, node.marks);
|
|
114
|
+
}
|
|
115
|
+
if (node.type.name === 'mediaInline') {
|
|
116
|
+
return mediaInline.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
117
|
+
__mediaTraceId: __mediaTraceId
|
|
118
|
+
}), node.content, node.marks);
|
|
119
|
+
}
|
|
120
|
+
return node;
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
|
|
98
124
|
/**
|
|
99
125
|
* Check base styles to see if an element will be invisible when rendered in a document.
|
|
100
126
|
* @param element
|
|
@@ -10,7 +10,6 @@ exports.getContent = getContent;
|
|
|
10
10
|
exports.getContentNodeTypes = void 0;
|
|
11
11
|
exports.getMediaTraceId = getMediaTraceId;
|
|
12
12
|
exports.handleSelectedTableWithAnalytics = exports.handleRichTextWithAnalytics = exports.handlePastePreservingMarksWithAnalytics = exports.handlePastePanelOrDecisionIntoListWithAnalytics = exports.handlePasteNonNestableBlockNodesIntoListWithAnalytics = exports.handlePasteLinkOnSelectedTextWithAnalytics = exports.handlePasteIntoTaskAndDecisionWithAnalytics = exports.handlePasteIntoCaptionWithAnalytics = exports.handlePasteAsPlainTextWithAnalytics = exports.handleMediaSingleWithAnalytics = exports.handleMarkdownWithAnalytics = exports.handleExpandWithAnalytics = exports.handleCodeBlockWithAnalytics = void 0;
|
|
13
|
-
exports.pasteCommandWithAnalytics = pasteCommandWithAnalytics;
|
|
14
13
|
exports.sendPasteAnalyticsEvent = sendPasteAnalyticsEvent;
|
|
15
14
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
16
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -226,11 +225,6 @@ function sendPasteAnalyticsEvent(view, event, slice, pasteContext) {
|
|
|
226
225
|
var payload = createPasteAnalyticsPayload(view, event, slice, pasteContext);
|
|
227
226
|
view.dispatch((0, _analytics.addAnalytics)(view.state, view.state.tr, payload));
|
|
228
227
|
}
|
|
229
|
-
function pasteCommandWithAnalytics(view, event, slice, pasteContext) {
|
|
230
|
-
return (0, _analytics.withAnalytics)(function () {
|
|
231
|
-
return createPasteAnalyticsPayload(view, event, slice, pasteContext);
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
228
|
var handlePasteAsPlainTextWithAnalytics = exports.handlePasteAsPlainTextWithAnalytics = function handlePasteAsPlainTextWithAnalytics(view, event, slice) {
|
|
235
229
|
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
236
230
|
type: _analytics.PasteTypes.plain,
|
|
@@ -395,6 +395,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
395
395
|
}
|
|
396
396
|
slice = (0, _utils3.transformSingleLineCodeBlockToCodeMark)(slice, schema);
|
|
397
397
|
slice = (0, _media.transformSliceToCorrectMediaWrapper)(slice, schema);
|
|
398
|
+
slice = (0, _media.transformSliceToMediaSingleWithNewExperience)(slice, schema);
|
|
398
399
|
slice = (0, _utils5.transformSliceToDecisionList)(slice, schema);
|
|
399
400
|
|
|
400
401
|
// splitting linebreaks into paragraphs must happen before upgrading text to lists
|
package/dist/cjs/plugins/rank.js
CHANGED
|
@@ -19,7 +19,7 @@ var _default = exports.default = {
|
|
|
19
19
|
'mediaKeymap',
|
|
20
20
|
// selection keymap needs to be above gap cursor keymap so it can set node selections from
|
|
21
21
|
// left/right arrows
|
|
22
|
-
'selectionKeymap', 'gapCursorKeymap', 'gapCursor', 'syncUrlText', 'fakeCursorToolbarPlugin', 'hyperLink', 'table', 'tableDecorations', 'hyperlinkInputRule', 'tablePMColResizing', 'hyperlinkKeymap', 'tableColResizing', 'undoRedoKeyMap', 'blockTypeKeyMap', 'tableEditing', 'filterStepsPlugin', 'pmCollab', 'collab', 'ruleInputRule', 'ruleKeymap', 'panel', 'media', 'mediaSingleKeymap', 'mediaEditor', 'unsupportedContent', 'jiraIssue', 'fakeTextCursor', 'helpDialog', 'helpDialogKeymap', 'macro', 'expand', 'extension', 'layout', 'contextPanel', 'floatingToolbar', 'clearMarksOnChange', 'reactNodeView', 'history', 'undoRedoPlugin', 'codeBlockIndent', 'placeholder', 'width', 'maxContentSize', 'multilineContent', 'grid', 'mobileDimensions', 'scrollGutterPlugin', 'analytics', 'findReplace', 'selection', 'avatarGroup', 'viewUpdateSubscription', 'beforePrimaryToolbar', 'inlineCode'],
|
|
22
|
+
'selectionKeymap', 'gapCursorKeymap', 'gapCursor', 'syncUrlText', 'fakeCursorToolbarPlugin', 'hyperLink', 'table', 'tableDecorations', 'hyperlinkInputRule', 'tablePMColResizing', 'hyperlinkKeymap', 'tableColResizing', 'undoRedoKeyMap', 'blockTypeKeyMap', 'tableEditing', 'filterStepsPlugin', 'pmCollab', 'collab', 'ruleInputRule', 'ruleKeymap', 'panel', 'media', 'mediaSingleKeymap', 'mediaEditor', 'unsupportedContent', 'jiraIssue', 'fakeTextCursor', 'helpDialog', 'helpDialogKeymap', 'macro', 'expand', 'extension', 'layout', 'contextPanel', 'selectionToolbar', 'floatingToolbar', 'clearMarksOnChange', 'reactNodeView', 'history', 'undoRedoPlugin', 'codeBlockIndent', 'placeholder', 'width', 'maxContentSize', 'multilineContent', 'grid', 'mobileDimensions', 'scrollGutterPlugin', 'analytics', 'findReplace', 'selection', 'avatarGroup', 'viewUpdateSubscription', 'beforePrimaryToolbar', 'inlineCode'],
|
|
23
23
|
nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'rule', 'panel', 'mention', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'unsupportedBlock', 'unsupportedInline', 'confluenceJiraIssue', 'hardBreak', 'emoji', 'placeholder', 'mediaSingle', 'mediaGroup', 'table', 'expand', 'nestedExpand', 'media', 'tableHeader', 'decisionList', 'tableRow', 'decisionItem', 'tableCell', 'taskList', 'taskItem', 'extension', 'bodiedExtension', 'inlineExtension', 'layoutSection', 'layoutColumn', 'inlineCard', 'blockCard', 'embedCard'],
|
|
24
24
|
marks: [
|
|
25
25
|
// Fragment mark is both for inline and block elements
|
|
@@ -79,7 +79,7 @@ var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref2) {
|
|
|
79
79
|
name: 'tasksAndDecisionsKeyMap',
|
|
80
80
|
plugin: function plugin(_ref5) {
|
|
81
81
|
var schema = _ref5.schema;
|
|
82
|
-
return (0, _keymaps.default)(schema, allowNestedTasks, consumeTabs);
|
|
82
|
+
return (0, _keymaps.default)(schema, api, allowNestedTasks, consumeTabs);
|
|
83
83
|
}
|
|
84
84
|
} // Needs to be after "save-on-enter"
|
|
85
85
|
];
|
|
@@ -15,7 +15,8 @@ var _steps = require("@atlaskit/adf-schema/steps");
|
|
|
15
15
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
16
16
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
17
17
|
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
18
|
-
var _analytics = require("
|
|
18
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
19
|
+
var _editorAnalytics = require("@atlaskit/editor-common/editor-analytics");
|
|
19
20
|
var _commands2 = require("../commands");
|
|
20
21
|
var _commands3 = require("./commands");
|
|
21
22
|
var _helpers = require("./helpers");
|
|
@@ -96,16 +97,18 @@ var joinTaskDecisionFollowing = function joinTaskDecisionFollowing(state, dispat
|
|
|
96
97
|
}
|
|
97
98
|
return false;
|
|
98
99
|
};
|
|
99
|
-
var getUnindentCommand = exports.getUnindentCommand = function getUnindentCommand() {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
100
|
+
var getUnindentCommand = exports.getUnindentCommand = function getUnindentCommand(editorAnalyticsAPI) {
|
|
101
|
+
return function () {
|
|
102
|
+
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.KEYBOARD;
|
|
103
|
+
return (0, _utils2.filterCommand)(_helpers.isInsideTask, function (state, dispatch) {
|
|
104
|
+
var normalizedSelection = (0, _utils3.normalizeTaskItemsSelection)(state.selection);
|
|
105
|
+
var curIndentLevel = (0, _helpers.getCurrentIndentLevel)(normalizedSelection);
|
|
106
|
+
if (!curIndentLevel || curIndentLevel === 1) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
return (0, _editorAnalytics.withAnalytics)(editorAnalyticsAPI, indentationAnalytics(curIndentLevel, _analytics.INDENT_DIRECTION.OUTDENT, inputMethod))((0, _commands.autoJoin)(_commands3.liftSelection, ['taskList']))(state, dispatch);
|
|
110
|
+
});
|
|
111
|
+
};
|
|
109
112
|
};
|
|
110
113
|
|
|
111
114
|
// if selection is decision item or first action item in table cell
|
|
@@ -122,53 +125,59 @@ var shouldLetTabThroughInTable = function shouldLetTabThroughInTable(state) {
|
|
|
122
125
|
}
|
|
123
126
|
return false;
|
|
124
127
|
};
|
|
125
|
-
var getIndentCommand = exports.getIndentCommand = function getIndentCommand() {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
128
|
+
var getIndentCommand = exports.getIndentCommand = function getIndentCommand(editorAnalyticsAPI) {
|
|
129
|
+
return function () {
|
|
130
|
+
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.KEYBOARD;
|
|
131
|
+
return (0, _utils2.filterCommand)(_helpers.isInsideTask, function (state, dispatch) {
|
|
132
|
+
var normalizedSelection = (0, _utils3.normalizeTaskItemsSelection)(state.selection);
|
|
133
|
+
var curIndentLevel = (0, _helpers.getCurrentIndentLevel)(normalizedSelection);
|
|
134
|
+
if (!curIndentLevel || curIndentLevel >= 6) {
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
return (0, _editorAnalytics.withAnalytics)(editorAnalyticsAPI, indentationAnalytics(curIndentLevel, _analytics.INDENT_DIRECTION.INDENT, inputMethod))((0, _commands.autoJoin)(_commands3.wrapSelectionInTaskList, ['taskList']))(state, dispatch);
|
|
138
|
+
});
|
|
139
|
+
};
|
|
135
140
|
};
|
|
136
|
-
var backspaceFrom = function backspaceFrom(
|
|
137
|
-
return function (
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
var backspaceFrom = function backspaceFrom(editorAnalyticsAPI) {
|
|
142
|
+
return function ($from) {
|
|
143
|
+
return function (state, dispatch) {
|
|
144
|
+
// previous was empty, just delete backwards
|
|
145
|
+
var taskBefore = $from.doc.resolve($from.before());
|
|
146
|
+
if (taskBefore.nodeBefore && (0, _helpers.isActionOrDecisionItem)(taskBefore.nodeBefore) && taskBefore.nodeBefore.nodeSize === 2) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
143
149
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
150
|
+
// if nested, just unindent
|
|
151
|
+
var _state$schema$nodes3 = state.schema.nodes,
|
|
152
|
+
taskList = _state$schema$nodes3.taskList,
|
|
153
|
+
paragraph = _state$schema$nodes3.paragraph;
|
|
154
|
+
if ($from.node($from.depth - 2).type === taskList) {
|
|
155
|
+
return getUnindentCommand(editorAnalyticsAPI)()(state, dispatch);
|
|
156
|
+
}
|
|
151
157
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
158
|
+
// bottom level, should "unwrap" taskItem contents into paragraph
|
|
159
|
+
// we achieve this by slicing the content out, and replacing
|
|
160
|
+
if (actionDecisionFollowsOrNothing($from)) {
|
|
161
|
+
if (dispatch) {
|
|
162
|
+
var taskContent = state.doc.slice($from.start(), $from.end()).content;
|
|
157
163
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
164
|
+
// might be end of document after
|
|
165
|
+
var slice = taskContent.size ? paragraph.createChecked(undefined, taskContent) : paragraph.createChecked();
|
|
166
|
+
dispatch(splitListItemWith(state.tr, slice, $from, true));
|
|
167
|
+
}
|
|
168
|
+
return true;
|
|
161
169
|
}
|
|
162
|
-
return
|
|
163
|
-
}
|
|
164
|
-
return false;
|
|
170
|
+
return false;
|
|
171
|
+
};
|
|
165
172
|
};
|
|
166
173
|
};
|
|
167
|
-
var backspace =
|
|
168
|
-
return (0,
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
174
|
+
var backspace = function backspace(editorAnalyticsAPI) {
|
|
175
|
+
return (0, _utils2.filterCommand)(_utils2.isEmptySelectionAtStart, (0, _commands.autoJoin)((0, _commands.chainCommands)(function (state, dispatch) {
|
|
176
|
+
return (0, _commands3.joinAtCut)(state.selection.$from)(state, dispatch);
|
|
177
|
+
}, (0, _utils2.filterCommand)(_helpers.isInsideTaskOrDecisionItem, function (state, dispatch) {
|
|
178
|
+
return backspaceFrom(editorAnalyticsAPI)(state.selection.$from)(state, dispatch);
|
|
179
|
+
})), ['taskList', 'decisionList']));
|
|
180
|
+
};
|
|
172
181
|
var unindentTaskOrUnwrapTaskDecisionFollowing = function unindentTaskOrUnwrapTaskDecisionFollowing(state, dispatch) {
|
|
173
182
|
var $from = state.selection.$from,
|
|
174
183
|
_state$schema$nodes4 = state.schema.nodes,
|
|
@@ -278,42 +287,44 @@ var splitListItem = function splitListItem(state, dispatch) {
|
|
|
278
287
|
}
|
|
279
288
|
return false;
|
|
280
289
|
};
|
|
281
|
-
var enter =
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
$
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
var
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
290
|
+
var enter = function enter(editorAnalyticsAPI) {
|
|
291
|
+
return (0, _utils2.filterCommand)(_helpers.isInsideTaskOrDecisionItem, (0, _commands.chainCommands)((0, _utils2.filterCommand)(_helpers.isEmptyTaskDecision, (0, _commands.chainCommands)(getUnindentCommand(editorAnalyticsAPI)(), splitListItem)), function (state, dispatch) {
|
|
292
|
+
var selection = state.selection,
|
|
293
|
+
schema = state.schema;
|
|
294
|
+
var taskItem = schema.nodes.taskItem;
|
|
295
|
+
var $from = selection.$from,
|
|
296
|
+
$to = selection.$to;
|
|
297
|
+
var node = $from.node($from.depth);
|
|
298
|
+
var nodeType = node && node.type;
|
|
299
|
+
var listType = nodeType === taskItem ? 'taskList' : 'decisionList';
|
|
300
|
+
var addItem = function addItem(_ref) {
|
|
301
|
+
var tr = _ref.tr,
|
|
302
|
+
itemLocalId = _ref.itemLocalId;
|
|
303
|
+
// ED-8932: When cursor is at the beginning of a task item, instead of split, we insert above.
|
|
304
|
+
if ($from.pos === $to.pos && $from.parentOffset === 0) {
|
|
305
|
+
var newTask = nodeType.createAndFill({
|
|
306
|
+
localId: itemLocalId
|
|
307
|
+
});
|
|
308
|
+
if (newTask) {
|
|
309
|
+
// Current position will point to text node, but we want to insert above the taskItem node
|
|
310
|
+
return tr.insert($from.pos - 1, newTask);
|
|
311
|
+
}
|
|
301
312
|
}
|
|
313
|
+
return tr.split($from.pos, 1, [{
|
|
314
|
+
type: nodeType,
|
|
315
|
+
attrs: {
|
|
316
|
+
localId: itemLocalId
|
|
317
|
+
}
|
|
318
|
+
}]);
|
|
319
|
+
};
|
|
320
|
+
var insertTr = (0, _commands2.insertTaskDecisionWithAnalytics)(state, listType, _analytics.INPUT_METHOD.KEYBOARD, addItem);
|
|
321
|
+
if (insertTr && dispatch) {
|
|
322
|
+
insertTr.scrollIntoView();
|
|
323
|
+
dispatch(insertTr);
|
|
302
324
|
}
|
|
303
|
-
return
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
localId: itemLocalId
|
|
307
|
-
}
|
|
308
|
-
}]);
|
|
309
|
-
};
|
|
310
|
-
var insertTr = (0, _commands2.insertTaskDecisionWithAnalytics)(state, listType, _analytics.INPUT_METHOD.KEYBOARD, addItem);
|
|
311
|
-
if (insertTr && dispatch) {
|
|
312
|
-
insertTr.scrollIntoView();
|
|
313
|
-
dispatch(insertTr);
|
|
314
|
-
}
|
|
315
|
-
return true;
|
|
316
|
-
}));
|
|
325
|
+
return true;
|
|
326
|
+
}));
|
|
327
|
+
};
|
|
317
328
|
var cmdOptEnter = (0, _utils2.filterCommand)(_helpers.isInsideTaskOrDecisionItem, function (state, dispatch) {
|
|
318
329
|
var selection = state.selection,
|
|
319
330
|
schema = state.schema;
|
|
@@ -334,17 +345,20 @@ var cmdOptEnter = (0, _utils2.filterCommand)(_helpers.isInsideTaskOrDecisionItem
|
|
|
334
345
|
}
|
|
335
346
|
return true;
|
|
336
347
|
});
|
|
337
|
-
function keymapPlugin(schema, allowNestedTasks, consumeTabs) {
|
|
348
|
+
function keymapPlugin(schema, api, allowNestedTasks, consumeTabs) {
|
|
349
|
+
var _api$analytics3, _api$analytics4;
|
|
338
350
|
var indentHandlers = {
|
|
339
351
|
'Shift-Tab': (0, _utils2.filterCommand)([_helpers.isInsideTaskOrDecisionItem, function (state) {
|
|
340
352
|
return !shouldLetTabThroughInTable(state);
|
|
341
353
|
}], function (state, dispatch) {
|
|
342
|
-
|
|
354
|
+
var _api$analytics;
|
|
355
|
+
return getUnindentCommand(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(_analytics.INPUT_METHOD.KEYBOARD)(state, dispatch) || !!consumeTabs;
|
|
343
356
|
}),
|
|
344
357
|
Tab: (0, _utils2.filterCommand)([_helpers.isInsideTaskOrDecisionItem, function (state) {
|
|
345
358
|
return !shouldLetTabThroughInTable(state);
|
|
346
359
|
}], function (state, dispatch) {
|
|
347
|
-
|
|
360
|
+
var _api$analytics2;
|
|
361
|
+
return getIndentCommand(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(_analytics.INPUT_METHOD.KEYBOARD)(state, dispatch) || !!consumeTabs;
|
|
348
362
|
})
|
|
349
363
|
};
|
|
350
364
|
var defaultHandlers = consumeTabs ? {
|
|
@@ -352,10 +366,10 @@ function keymapPlugin(schema, allowNestedTasks, consumeTabs) {
|
|
|
352
366
|
Tab: _helpers.isInsideTaskOrDecisionItem
|
|
353
367
|
} : {};
|
|
354
368
|
var keymaps = _objectSpread((0, _defineProperty2.default)({
|
|
355
|
-
Backspace: backspace,
|
|
369
|
+
Backspace: backspace(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions),
|
|
356
370
|
Delete: deleteForwards,
|
|
357
371
|
'Ctrl-d': deleteForwards,
|
|
358
|
-
Enter: enter
|
|
372
|
+
Enter: enter(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions)
|
|
359
373
|
}, _keymaps.toggleTaskItemCheckbox.common, cmdOptEnter), allowNestedTasks ? indentHandlers : defaultHandlers);
|
|
360
374
|
return (0, _keymap.keymap)(keymaps);
|
|
361
375
|
}
|
|
@@ -30,7 +30,8 @@ var onItemActivated = exports.onItemActivated = function onItemActivated(pluginI
|
|
|
30
30
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.indentList(_analytics.INPUT_METHOD.TOOLBAR));
|
|
31
31
|
}
|
|
32
32
|
if (node === 'taskList') {
|
|
33
|
-
|
|
33
|
+
var _pluginInjectionApi$a;
|
|
34
|
+
(0, _keymaps.getIndentCommand)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
34
35
|
}
|
|
35
36
|
break;
|
|
36
37
|
}
|
|
@@ -45,7 +46,8 @@ var onItemActivated = exports.onItemActivated = function onItemActivated(pluginI
|
|
|
45
46
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.outdentList(_analytics.INPUT_METHOD.TOOLBAR));
|
|
46
47
|
}
|
|
47
48
|
if (_node === 'taskList') {
|
|
48
|
-
|
|
49
|
+
var _pluginInjectionApi$a2;
|
|
50
|
+
(0, _keymaps.getUnindentCommand)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
49
51
|
}
|
|
50
52
|
break;
|
|
51
53
|
}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = exports.name = "@atlaskit/editor-core";
|
|
8
|
-
var version = exports.version = "188.12.
|
|
8
|
+
var version = exports.version = "188.12.2";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|
|
@@ -20,6 +20,7 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
|
20
20
|
import { saveOnEnterPlugin } from '@atlaskit/editor-plugin-save-on-enter';
|
|
21
21
|
import { scrollIntoViewPlugin } from '@atlaskit/editor-plugin-scroll-into-view';
|
|
22
22
|
import { mentionsPlugin } from '@atlaskit/editor-plugin-mentions';
|
|
23
|
+
import { selectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
|
|
23
24
|
import { isFullPage as fullPageCheck } from '../../../utils/is-full-page';
|
|
24
25
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
25
26
|
import { createDefaultPreset } from './default';
|
|
@@ -398,6 +399,16 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
398
399
|
return builder;
|
|
399
400
|
}).add([codeBidiWarningPlugin, {
|
|
400
401
|
appearance
|
|
401
|
-
}])
|
|
402
|
+
}])
|
|
403
|
+
/**
|
|
404
|
+
* Do not use this plugin - it is for AI purposes only.
|
|
405
|
+
*/.maybeAdd(selectionToolbarPlugin, (plugin, builder) => {
|
|
406
|
+
if (getBooleanFF('platform.editor.enable-selection-toolbar_ucdwd')) {
|
|
407
|
+
return builder.add([plugin, {
|
|
408
|
+
preferenceToolbarAboveSelection: false
|
|
409
|
+
}]);
|
|
410
|
+
}
|
|
411
|
+
return builder;
|
|
412
|
+
});
|
|
402
413
|
return finalPreset;
|
|
403
414
|
}
|
|
@@ -7,6 +7,7 @@ import { getPluginState } from './utils';
|
|
|
7
7
|
import { buildToolbar } from './toolbar';
|
|
8
8
|
import { InlineCommentView } from './ui/InlineCommentView';
|
|
9
9
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
10
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
const annotationPlugin = ({
|
|
11
12
|
config: annotationProviders,
|
|
12
13
|
api
|
|
@@ -53,7 +54,19 @@ const annotationPlugin = ({
|
|
|
53
54
|
}],
|
|
54
55
|
pluginsOptions: {
|
|
55
56
|
floatingToolbar(state, intl) {
|
|
56
|
-
if (!annotationProviders) {
|
|
57
|
+
if (getBooleanFF('platform.editor.enable-selection-toolbar_ucdwd') || !annotationProviders) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const pluginState = getPluginState(state);
|
|
61
|
+
if (pluginState && pluginState.isVisible && !pluginState.bookmark && !pluginState.mouseData.isSelecting) {
|
|
62
|
+
const {
|
|
63
|
+
isToolbarAbove
|
|
64
|
+
} = annotationProviders.inlineComment;
|
|
65
|
+
return buildToolbar(state, intl, isToolbarAbove);
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
selectionToolbar(state, intl) {
|
|
69
|
+
if (!getBooleanFF('platform.editor.enable-selection-toolbar_ucdwd') || !annotationProviders) {
|
|
57
70
|
return;
|
|
58
71
|
}
|
|
59
72
|
const pluginState = getPluginState(state);
|
|
@@ -11,6 +11,12 @@ const handleDocChanged = (tr, prevPluginState) => {
|
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
const handleSelectionChanged = (tr, pluginState) => {
|
|
14
|
+
if (pluginState.skipSelectionHandling) {
|
|
15
|
+
return {
|
|
16
|
+
...pluginState,
|
|
17
|
+
skipSelectionHandling: false
|
|
18
|
+
};
|
|
19
|
+
}
|
|
14
20
|
const selectedAnnotations = findAnnotationsInSelection(tr.selection, tr.doc);
|
|
15
21
|
const changed = selectedAnnotations.length !== pluginState.selectedAnnotations.length || selectedAnnotations.some(annotationInfo => {
|
|
16
22
|
return !pluginState.selectedAnnotations.some(aInfo => aInfo.type === annotationInfo.id);
|
|
@@ -54,7 +54,8 @@ export default ((pluginState, action) => {
|
|
|
54
54
|
case ACTIONS.SET_SELECTED_ANNOTATION:
|
|
55
55
|
return {
|
|
56
56
|
...pluginState,
|
|
57
|
-
selectedAnnotations: [...action.data.selectedAnnotations]
|
|
57
|
+
selectedAnnotations: [...action.data.selectedAnnotations],
|
|
58
|
+
skipSelectionHandling: true
|
|
58
59
|
};
|
|
59
60
|
default:
|
|
60
61
|
return pluginState;
|