@atlaskit/editor-core 190.1.19 → 190.1.23
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/afm-cc/tsconfig.json +3 -0
- package/dist/cjs/create-editor/ErrorBoundary.js +9 -5
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/paste/pm-plugins/main.js +14 -10
- package/dist/cjs/presets/default.js +2 -2
- package/dist/cjs/presets/universal.js +2 -1
- package/dist/cjs/utils/index.js +12 -18
- package/dist/cjs/utils/performance/measure-enum.js +1 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/create-editor/ErrorBoundary.js +10 -7
- package/dist/es2019/index.js +14 -1
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/paste/pm-plugins/main.js +11 -5
- package/dist/es2019/presets/default.js +1 -1
- package/dist/es2019/presets/universal.js +2 -1
- package/dist/es2019/utils/index.js +0 -7
- package/dist/es2019/utils/performance/measure-enum.js +1 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/create-editor/ErrorBoundary.js +10 -7
- package/dist/esm/index.js +14 -1
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/paste/pm-plugins/main.js +9 -5
- package/dist/esm/presets/default.js +1 -1
- package/dist/esm/presets/universal.js +2 -1
- package/dist/esm/utils/index.js +0 -5
- package/dist/esm/utils/performance/measure-enum.js +1 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/index.d.ts +15 -2
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/paste/pm-plugins/main.d.ts +2 -0
- package/dist/types/presets/default.d.ts +1 -1
- package/dist/types/types/editor-props.d.ts +1 -1
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/utils/index.d.ts +0 -1
- package/dist/types/utils/performance/measure-enum.d.ts +0 -1
- package/dist/types-ts4.5/index.d.ts +15 -2
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/paste/pm-plugins/main.d.ts +2 -0
- package/dist/types-ts4.5/presets/default.d.ts +1 -1
- package/dist/types-ts4.5/types/editor-props.d.ts +1 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.5/utils/index.d.ts +0 -1
- package/dist/types-ts4.5/utils/performance/measure-enum.d.ts +0 -1
- package/package.json +10 -4
- package/dist/cjs/plugins/annotation/commands/index.js +0 -150
- package/dist/cjs/plugins/annotation/commands/transform.js +0 -86
- package/dist/cjs/plugins/annotation/index.js +0 -130
- package/dist/cjs/plugins/annotation/nodeviews/index.js +0 -59
- package/dist/cjs/plugins/annotation/pm-plugins/inline-comment.js +0 -243
- package/dist/cjs/plugins/annotation/pm-plugins/keymap.js +0 -15
- package/dist/cjs/plugins/annotation/pm-plugins/plugin-factory.js +0 -107
- package/dist/cjs/plugins/annotation/pm-plugins/reducer.js +0 -84
- package/dist/cjs/plugins/annotation/pm-plugins/types.js +0 -17
- package/dist/cjs/plugins/annotation/toolbar.js +0 -59
- package/dist/cjs/plugins/annotation/types.js +0 -20
- package/dist/cjs/plugins/annotation/ui/AnnotationViewWrapper.js +0 -38
- package/dist/cjs/plugins/annotation/ui/InlineCommentView.js +0 -149
- package/dist/cjs/plugins/annotation/update-provider.js +0 -36
- package/dist/cjs/plugins/annotation/utils.js +0 -372
- package/dist/es2019/plugins/annotation/commands/index.js +0 -123
- package/dist/es2019/plugins/annotation/commands/transform.js +0 -64
- package/dist/es2019/plugins/annotation/index.js +0 -125
- package/dist/es2019/plugins/annotation/nodeviews/index.js +0 -31
- package/dist/es2019/plugins/annotation/pm-plugins/inline-comment.js +0 -178
- package/dist/es2019/plugins/annotation/pm-plugins/keymap.js +0 -9
- package/dist/es2019/plugins/annotation/pm-plugins/plugin-factory.js +0 -108
- package/dist/es2019/plugins/annotation/pm-plugins/reducer.js +0 -94
- package/dist/es2019/plugins/annotation/pm-plugins/types.js +0 -11
- package/dist/es2019/plugins/annotation/toolbar.js +0 -53
- package/dist/es2019/plugins/annotation/types.js +0 -14
- package/dist/es2019/plugins/annotation/ui/AnnotationViewWrapper.js +0 -14
- package/dist/es2019/plugins/annotation/ui/InlineCommentView.js +0 -147
- package/dist/es2019/plugins/annotation/update-provider.js +0 -9
- package/dist/es2019/plugins/annotation/utils.js +0 -334
- package/dist/esm/plugins/annotation/commands/index.js +0 -143
- package/dist/esm/plugins/annotation/commands/transform.js +0 -80
- package/dist/esm/plugins/annotation/index.js +0 -118
- package/dist/esm/plugins/annotation/nodeviews/index.js +0 -52
- package/dist/esm/plugins/annotation/pm-plugins/inline-comment.js +0 -236
- package/dist/esm/plugins/annotation/pm-plugins/keymap.js +0 -9
- package/dist/esm/plugins/annotation/pm-plugins/plugin-factory.js +0 -101
- package/dist/esm/plugins/annotation/pm-plugins/reducer.js +0 -77
- package/dist/esm/plugins/annotation/pm-plugins/types.js +0 -11
- package/dist/esm/plugins/annotation/toolbar.js +0 -52
- package/dist/esm/plugins/annotation/types.js +0 -14
- package/dist/esm/plugins/annotation/ui/AnnotationViewWrapper.js +0 -31
- package/dist/esm/plugins/annotation/ui/InlineCommentView.js +0 -144
- package/dist/esm/plugins/annotation/update-provider.js +0 -29
- package/dist/esm/plugins/annotation/utils.js +0 -345
- package/dist/types/plugins/annotation/commands/index.d.ts +0 -15
- package/dist/types/plugins/annotation/commands/transform.d.ts +0 -11
- package/dist/types/plugins/annotation/index.d.ts +0 -15
- package/dist/types/plugins/annotation/nodeviews/index.d.ts +0 -11
- package/dist/types/plugins/annotation/pm-plugins/inline-comment.d.ts +0 -3
- package/dist/types/plugins/annotation/pm-plugins/keymap.d.ts +0 -3
- package/dist/types/plugins/annotation/pm-plugins/plugin-factory.d.ts +0 -2
- package/dist/types/plugins/annotation/pm-plugins/reducer.d.ts +0 -3
- package/dist/types/plugins/annotation/pm-plugins/types.d.ts +0 -78
- package/dist/types/plugins/annotation/toolbar.d.ts +0 -5
- package/dist/types/plugins/annotation/types.d.ts +0 -86
- package/dist/types/plugins/annotation/ui/AnnotationViewWrapper.d.ts +0 -10
- package/dist/types/plugins/annotation/ui/InlineCommentView.d.ts +0 -13
- package/dist/types/plugins/annotation/update-provider.d.ts +0 -12
- package/dist/types/plugins/annotation/utils.d.ts +0 -45
- package/dist/types-ts4.5/plugins/annotation/commands/index.d.ts +0 -15
- package/dist/types-ts4.5/plugins/annotation/commands/transform.d.ts +0 -11
- package/dist/types-ts4.5/plugins/annotation/index.d.ts +0 -17
- package/dist/types-ts4.5/plugins/annotation/nodeviews/index.d.ts +0 -11
- package/dist/types-ts4.5/plugins/annotation/pm-plugins/inline-comment.d.ts +0 -3
- package/dist/types-ts4.5/plugins/annotation/pm-plugins/keymap.d.ts +0 -3
- package/dist/types-ts4.5/plugins/annotation/pm-plugins/plugin-factory.d.ts +0 -2
- package/dist/types-ts4.5/plugins/annotation/pm-plugins/reducer.d.ts +0 -3
- package/dist/types-ts4.5/plugins/annotation/pm-plugins/types.d.ts +0 -78
- package/dist/types-ts4.5/plugins/annotation/toolbar.d.ts +0 -5
- package/dist/types-ts4.5/plugins/annotation/types.d.ts +0 -86
- package/dist/types-ts4.5/plugins/annotation/ui/AnnotationViewWrapper.d.ts +0 -10
- package/dist/types-ts4.5/plugins/annotation/ui/InlineCommentView.d.ts +0 -13
- package/dist/types-ts4.5/plugins/annotation/update-provider.d.ts +0 -12
- package/dist/types-ts4.5/plugins/annotation/utils.d.ts +0 -45
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "190.1.
|
|
3
|
+
"version": "190.1.23",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"@atlaskit/editor-markdown-transformer": "^5.2.5",
|
|
58
58
|
"@atlaskit/editor-plugin-alignment": "^0.1.0",
|
|
59
59
|
"@atlaskit/editor-plugin-analytics": "^0.4.0",
|
|
60
|
+
"@atlaskit/editor-plugin-annotation": "^0.1.0",
|
|
60
61
|
"@atlaskit/editor-plugin-base": "^0.2.0",
|
|
61
62
|
"@atlaskit/editor-plugin-better-type-history": "^0.1.0",
|
|
62
63
|
"@atlaskit/editor-plugin-block-type": "^3.0.0",
|
|
@@ -111,7 +112,7 @@
|
|
|
111
112
|
"@atlaskit/editor-plugin-selection-toolbar": "^0.1.0",
|
|
112
113
|
"@atlaskit/editor-plugin-status": "^0.2.0",
|
|
113
114
|
"@atlaskit/editor-plugin-submit-editor": "^0.1.0",
|
|
114
|
-
"@atlaskit/editor-plugin-table": "^5.
|
|
115
|
+
"@atlaskit/editor-plugin-table": "^5.7.0",
|
|
115
116
|
"@atlaskit/editor-plugin-tasks-and-decisions": "^0.2.0",
|
|
116
117
|
"@atlaskit/editor-plugin-text-color": "^0.1.0",
|
|
117
118
|
"@atlaskit/editor-plugin-text-formatting": "^0.4.0",
|
|
@@ -145,7 +146,7 @@
|
|
|
145
146
|
"@atlaskit/textfield": "^6.0.0",
|
|
146
147
|
"@atlaskit/theme": "^12.6.0",
|
|
147
148
|
"@atlaskit/toggle": "^13.0.0",
|
|
148
|
-
"@atlaskit/tokens": "^1.
|
|
149
|
+
"@atlaskit/tokens": "^1.32.0",
|
|
149
150
|
"@atlaskit/tooltip": "^18.1.0",
|
|
150
151
|
"@atlaskit/ufo": "^0.2.0",
|
|
151
152
|
"@atlaskit/width-detector": "^4.1.0",
|
|
@@ -342,6 +343,10 @@
|
|
|
342
343
|
"type": "boolean",
|
|
343
344
|
"referenceOnly": "true"
|
|
344
345
|
},
|
|
346
|
+
"platform.editor.table.new-cell-context-menu-styling": {
|
|
347
|
+
"type": "boolean",
|
|
348
|
+
"referenceOnly": "true"
|
|
349
|
+
},
|
|
345
350
|
"platform.editor.ordered-list-auto-join-improvements_mrlv5": {
|
|
346
351
|
"type": "boolean",
|
|
347
352
|
"referenceOnly": "true"
|
|
@@ -370,7 +375,8 @@
|
|
|
370
375
|
"referenceOnly": "true"
|
|
371
376
|
},
|
|
372
377
|
"platform.editor.annotation.decouple-inline-comment-closed_flmox": {
|
|
373
|
-
"type": "boolean"
|
|
378
|
+
"type": "boolean",
|
|
379
|
+
"referenceOnly": "true"
|
|
374
380
|
}
|
|
375
381
|
}
|
|
376
382
|
}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.updateMouseState = exports.updateInlineCommentResolvedState = exports.setSelectedAnnotation = exports.setInlineCommentsVisibility = exports.setInlineCommentDraftState = exports.removeInlineCommentNearSelection = exports.createAnnotation = exports.closeComponent = exports.clearDirtyMark = exports.addInlineComment = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
|
-
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
11
|
-
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
|
-
var _utils = require("../utils");
|
|
13
|
-
var _types = require("../pm-plugins/types");
|
|
14
|
-
var _transform = _interopRequireDefault(require("./transform"));
|
|
15
|
-
var _types2 = require("../types");
|
|
16
|
-
var updateInlineCommentResolvedState = exports.updateInlineCommentResolvedState = function updateInlineCommentResolvedState(editorAnalyticsAPI) {
|
|
17
|
-
return function (partialNewState, resolveMethod) {
|
|
18
|
-
var command = {
|
|
19
|
-
type: _types.ACTIONS.UPDATE_INLINE_COMMENT_STATE,
|
|
20
|
-
data: partialNewState
|
|
21
|
-
};
|
|
22
|
-
var allResolved = Object.values(partialNewState).every(function (state) {
|
|
23
|
-
return state;
|
|
24
|
-
});
|
|
25
|
-
if (resolveMethod && allResolved) {
|
|
26
|
-
return (0, _pluginFactory.createCommand)(command, _transform.default.addResolveAnalytics(editorAnalyticsAPI)(resolveMethod));
|
|
27
|
-
}
|
|
28
|
-
return (0, _pluginFactory.createCommand)(command);
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
var closeComponent = exports.closeComponent = function closeComponent() {
|
|
32
|
-
return (0, _pluginFactory.createCommand)({
|
|
33
|
-
type: _types.ACTIONS.CLOSE_COMPONENT
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
var clearDirtyMark = exports.clearDirtyMark = function clearDirtyMark() {
|
|
37
|
-
return (0, _pluginFactory.createCommand)({
|
|
38
|
-
type: _types.ACTIONS.INLINE_COMMENT_CLEAR_DIRTY_MARK
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
var removeInlineCommentNearSelection = exports.removeInlineCommentNearSelection = function removeInlineCommentNearSelection(id) {
|
|
42
|
-
return function (state, dispatch) {
|
|
43
|
-
var tr = state.tr,
|
|
44
|
-
$from = state.selection.$from;
|
|
45
|
-
var annotationMarkType = state.schema.marks.annotation;
|
|
46
|
-
var hasAnnotation = $from.marks().some(function (mark) {
|
|
47
|
-
return mark.type === annotationMarkType;
|
|
48
|
-
});
|
|
49
|
-
if (!hasAnnotation) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// just remove entire mark from around the node
|
|
54
|
-
tr.removeMark($from.start(), $from.end(), annotationMarkType.create({
|
|
55
|
-
id: id,
|
|
56
|
-
type: _adfSchema.AnnotationTypes.INLINE_COMMENT
|
|
57
|
-
}));
|
|
58
|
-
if (dispatch) {
|
|
59
|
-
dispatch(tr);
|
|
60
|
-
}
|
|
61
|
-
return true;
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
var getDraftCommandAction = function getDraftCommandAction(drafting) {
|
|
65
|
-
return function (editorState) {
|
|
66
|
-
// validate selection only when entering draft mode
|
|
67
|
-
if (drafting && (0, _utils.isSelectionValid)(editorState) !== _types2.AnnotationSelectionType.VALID) {
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
return {
|
|
71
|
-
type: _types.ACTIONS.SET_INLINE_COMMENT_DRAFT_STATE,
|
|
72
|
-
data: {
|
|
73
|
-
drafting: drafting,
|
|
74
|
-
editorState: editorState
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
var setInlineCommentDraftState = exports.setInlineCommentDraftState = function setInlineCommentDraftState(editorAnalyticsAPI) {
|
|
80
|
-
return function (drafting) {
|
|
81
|
-
var inputMethod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _analytics.INPUT_METHOD.TOOLBAR;
|
|
82
|
-
var commandAction = getDraftCommandAction(drafting);
|
|
83
|
-
return (0, _pluginFactory.createCommand)(commandAction, _transform.default.addOpenCloseAnalytics(editorAnalyticsAPI)(drafting, inputMethod));
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
var addInlineComment = exports.addInlineComment = function addInlineComment(editorAnalyticsAPI) {
|
|
87
|
-
return function (id) {
|
|
88
|
-
var commandAction = function commandAction(editorState) {
|
|
89
|
-
return {
|
|
90
|
-
type: _types.ACTIONS.ADD_INLINE_COMMENT,
|
|
91
|
-
data: {
|
|
92
|
-
drafting: false,
|
|
93
|
-
inlineComments: (0, _defineProperty2.default)({}, id, false),
|
|
94
|
-
// Auto make the newly inserted comment selected.
|
|
95
|
-
// We move the selection to the head of the comment selection.
|
|
96
|
-
selectedAnnotations: [{
|
|
97
|
-
id: id,
|
|
98
|
-
type: _adfSchema.AnnotationTypes.INLINE_COMMENT
|
|
99
|
-
}],
|
|
100
|
-
editorState: editorState
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
return (0, _pluginFactory.createCommand)(commandAction, _transform.default.addInlineComment(editorAnalyticsAPI)(id));
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
var updateMouseState = exports.updateMouseState = function updateMouseState(mouseData) {
|
|
108
|
-
return (0, _pluginFactory.createCommand)({
|
|
109
|
-
type: _types.ACTIONS.INLINE_COMMENT_UPDATE_MOUSE_STATE,
|
|
110
|
-
data: {
|
|
111
|
-
mouseData: mouseData
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
};
|
|
115
|
-
var setSelectedAnnotation = exports.setSelectedAnnotation = function setSelectedAnnotation(id) {
|
|
116
|
-
return (0, _pluginFactory.createCommand)({
|
|
117
|
-
type: _types.ACTIONS.SET_SELECTED_ANNOTATION,
|
|
118
|
-
data: {
|
|
119
|
-
selectedAnnotations: [{
|
|
120
|
-
id: id,
|
|
121
|
-
type: _adfSchema.AnnotationTypes.INLINE_COMMENT
|
|
122
|
-
}]
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
var createAnnotation = exports.createAnnotation = function createAnnotation(editorAnalyticsAPI) {
|
|
127
|
-
return function (id) {
|
|
128
|
-
var annotationType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _adfSchema.AnnotationTypes.INLINE_COMMENT;
|
|
129
|
-
return function (state, dispatch) {
|
|
130
|
-
// don't try to add if there are is no temp highlight bookmarked
|
|
131
|
-
var _ref = (0, _utils.getPluginState)(state) || {},
|
|
132
|
-
bookmark = _ref.bookmark;
|
|
133
|
-
if (!bookmark || !dispatch) {
|
|
134
|
-
return false;
|
|
135
|
-
}
|
|
136
|
-
if (annotationType === _adfSchema.AnnotationTypes.INLINE_COMMENT) {
|
|
137
|
-
return addInlineComment(editorAnalyticsAPI)(id)(state, dispatch);
|
|
138
|
-
}
|
|
139
|
-
return false;
|
|
140
|
-
};
|
|
141
|
-
};
|
|
142
|
-
};
|
|
143
|
-
var setInlineCommentsVisibility = exports.setInlineCommentsVisibility = function setInlineCommentsVisibility(isVisible) {
|
|
144
|
-
return (0, _pluginFactory.createCommand)({
|
|
145
|
-
type: _types.ACTIONS.INLINE_COMMENT_SET_VISIBLE,
|
|
146
|
-
data: {
|
|
147
|
-
isVisible: isVisible
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
8
|
-
var _adfSchema = require("@atlaskit/adf-schema");
|
|
9
|
-
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
|
-
var _utils = require("../utils");
|
|
11
|
-
var _mark = require("@atlaskit/editor-common/mark");
|
|
12
|
-
var addAnnotationMark = function addAnnotationMark(id) {
|
|
13
|
-
return function (transaction, state) {
|
|
14
|
-
var inlineCommentState = (0, _utils.getPluginState)(state);
|
|
15
|
-
var _getSelectionPosition = (0, _utils.getSelectionPositions)(state, inlineCommentState),
|
|
16
|
-
from = _getSelectionPosition.from,
|
|
17
|
-
to = _getSelectionPosition.to,
|
|
18
|
-
head = _getSelectionPosition.head;
|
|
19
|
-
var annotationMark = state.schema.marks.annotation.create({
|
|
20
|
-
id: id,
|
|
21
|
-
type: _adfSchema.AnnotationTypes.INLINE_COMMENT
|
|
22
|
-
});
|
|
23
|
-
// Apply the mark only to text node in the range.
|
|
24
|
-
var tr = (0, _mark.applyMarkOnRange)(from, to, false, annotationMark, transaction);
|
|
25
|
-
// set selection back to the end of annotation once annotation mark is applied
|
|
26
|
-
tr.setSelection(_state.TextSelection.create(tr.doc, head));
|
|
27
|
-
return tr;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
var addInlineComment = function addInlineComment(editorAnalyticsAPI) {
|
|
31
|
-
return function (id) {
|
|
32
|
-
return function (transaction, state) {
|
|
33
|
-
var tr = addAnnotationMark(id)(transaction, state);
|
|
34
|
-
// add insert analytics step to transaction
|
|
35
|
-
tr = addInsertAnalytics(editorAnalyticsAPI)(tr, state);
|
|
36
|
-
// add close analytics step to transaction
|
|
37
|
-
tr = addOpenCloseAnalytics(editorAnalyticsAPI)(false, _analytics.INPUT_METHOD.TOOLBAR)(tr, state);
|
|
38
|
-
return tr;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
var addOpenCloseAnalytics = function addOpenCloseAnalytics(editorAnalyticsAPI) {
|
|
43
|
-
return function (drafting) {
|
|
44
|
-
var method = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _analytics.INPUT_METHOD.TOOLBAR;
|
|
45
|
-
return function (transaction, state) {
|
|
46
|
-
var draftingPayload = (0, _utils.getDraftCommandAnalyticsPayload)(drafting, method)(state);
|
|
47
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(draftingPayload)(transaction);
|
|
48
|
-
return transaction;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
var addInsertAnalytics = function addInsertAnalytics(editorAnalyticsAPI) {
|
|
53
|
-
return function (transaction, state) {
|
|
54
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
55
|
-
action: _analytics.ACTION.INSERTED,
|
|
56
|
-
actionSubject: _analytics.ACTION_SUBJECT.ANNOTATION,
|
|
57
|
-
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
58
|
-
actionSubjectId: _analytics.ACTION_SUBJECT_ID.INLINE_COMMENT
|
|
59
|
-
})(transaction);
|
|
60
|
-
return transaction;
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
var addResolveAnalytics = function addResolveAnalytics(editorAnalyticsAPI) {
|
|
64
|
-
return function (method) {
|
|
65
|
-
return function (transaction, state) {
|
|
66
|
-
var resolvedPayload = {
|
|
67
|
-
action: _analytics.ACTION.RESOLVED,
|
|
68
|
-
actionSubject: _analytics.ACTION_SUBJECT.ANNOTATION,
|
|
69
|
-
actionSubjectId: _analytics.ACTION_SUBJECT_ID.INLINE_COMMENT,
|
|
70
|
-
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
71
|
-
attributes: {
|
|
72
|
-
method: method
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(resolvedPayload)(transaction);
|
|
76
|
-
return transaction;
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
var _default = exports.default = {
|
|
81
|
-
addAnnotationMark: addAnnotationMark,
|
|
82
|
-
addInlineComment: addInlineComment,
|
|
83
|
-
addOpenCloseAnalytics: addOpenCloseAnalytics,
|
|
84
|
-
addInsertAnalytics: addInsertAnalytics,
|
|
85
|
-
addResolveAnalytics: addResolveAnalytics
|
|
86
|
-
};
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
Object.defineProperty(exports, "AnnotationUpdateEmitter", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function get() {
|
|
10
|
-
return _updateProvider.AnnotationUpdateEmitter;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
exports.default = void 0;
|
|
14
|
-
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
var _adfSchema = require("@atlaskit/adf-schema");
|
|
16
|
-
var _keymap = require("./pm-plugins/keymap");
|
|
17
|
-
var _inlineComment = require("./pm-plugins/inline-comment");
|
|
18
|
-
var _updateProvider = require("./update-provider");
|
|
19
|
-
var _utils = require("./utils");
|
|
20
|
-
var _toolbar = require("./toolbar");
|
|
21
|
-
var _InlineCommentView = require("./ui/InlineCommentView");
|
|
22
|
-
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
23
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
24
|
-
var annotationPlugin = function annotationPlugin(_ref) {
|
|
25
|
-
var annotationProviders = _ref.config,
|
|
26
|
-
api = _ref.api;
|
|
27
|
-
return {
|
|
28
|
-
name: 'annotation',
|
|
29
|
-
marks: function marks() {
|
|
30
|
-
return [{
|
|
31
|
-
name: 'annotation',
|
|
32
|
-
mark: _adfSchema.annotation
|
|
33
|
-
}];
|
|
34
|
-
},
|
|
35
|
-
getSharedState: function getSharedState(editorState) {
|
|
36
|
-
if (!editorState) {
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
39
|
-
return (0, _utils.getPluginState)(editorState) || undefined;
|
|
40
|
-
},
|
|
41
|
-
pmPlugins: function pmPlugins() {
|
|
42
|
-
return [{
|
|
43
|
-
name: 'annotation',
|
|
44
|
-
plugin: function plugin(_ref2) {
|
|
45
|
-
var dispatch = _ref2.dispatch,
|
|
46
|
-
portalProviderAPI = _ref2.portalProviderAPI,
|
|
47
|
-
eventDispatcher = _ref2.eventDispatcher;
|
|
48
|
-
if (annotationProviders) {
|
|
49
|
-
var _api$analytics;
|
|
50
|
-
return (0, _inlineComment.inlineCommentPlugin)({
|
|
51
|
-
dispatch: dispatch,
|
|
52
|
-
portalProviderAPI: portalProviderAPI,
|
|
53
|
-
eventDispatcher: eventDispatcher,
|
|
54
|
-
provider: annotationProviders.inlineComment,
|
|
55
|
-
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
}, {
|
|
61
|
-
name: 'annotationKeymap',
|
|
62
|
-
plugin: function plugin() {
|
|
63
|
-
if (annotationProviders) {
|
|
64
|
-
var _api$analytics2;
|
|
65
|
-
return (0, _keymap.keymapPlugin)(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
|
|
66
|
-
}
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
}];
|
|
70
|
-
},
|
|
71
|
-
pluginsOptions: {
|
|
72
|
-
floatingToolbar: function floatingToolbar(state, intl) {
|
|
73
|
-
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.enable-selection-toolbar_ucdwd') || !annotationProviders) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
var pluginState = (0, _utils.getPluginState)(state);
|
|
77
|
-
if (pluginState && pluginState.isVisible && !pluginState.bookmark && !pluginState.mouseData.isSelecting) {
|
|
78
|
-
var _api$analytics3;
|
|
79
|
-
var isToolbarAbove = annotationProviders.inlineComment.isToolbarAbove;
|
|
80
|
-
return (0, _toolbar.buildToolbar)(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions)(state, intl, isToolbarAbove);
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
selectionToolbar: function selectionToolbar(state, intl) {
|
|
84
|
-
if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.enable-selection-toolbar_ucdwd') || !annotationProviders) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
var pluginState = (0, _utils.getPluginState)(state);
|
|
88
|
-
if (pluginState && pluginState.isVisible && !pluginState.bookmark && !pluginState.mouseData.isSelecting) {
|
|
89
|
-
var _api$analytics4;
|
|
90
|
-
var isToolbarAbove = annotationProviders.inlineComment.isToolbarAbove;
|
|
91
|
-
return (0, _toolbar.buildToolbar)(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions)(state, intl, isToolbarAbove);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
contentComponent: function contentComponent(_ref3) {
|
|
96
|
-
var editorView = _ref3.editorView,
|
|
97
|
-
dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent;
|
|
98
|
-
if (!annotationProviders) {
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
return /*#__PURE__*/_react.default.createElement(AnnotationContentComponent, {
|
|
102
|
-
api: api,
|
|
103
|
-
editorView: editorView,
|
|
104
|
-
annotationProviders: annotationProviders,
|
|
105
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
function AnnotationContentComponent(_ref4) {
|
|
111
|
-
var _api$analytics5;
|
|
112
|
-
var api = _ref4.api,
|
|
113
|
-
editorView = _ref4.editorView,
|
|
114
|
-
annotationProviders = _ref4.annotationProviders,
|
|
115
|
-
dispatchAnalyticsEvent = _ref4.dispatchAnalyticsEvent;
|
|
116
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['annotation']),
|
|
117
|
-
inlineCommentState = _useSharedPluginState.annotationState;
|
|
118
|
-
if (inlineCommentState && !inlineCommentState.isVisible) {
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
122
|
-
"data-editor-popup": "true"
|
|
123
|
-
}, /*#__PURE__*/_react.default.createElement(_InlineCommentView.InlineCommentView, {
|
|
124
|
-
providers: annotationProviders,
|
|
125
|
-
editorView: editorView,
|
|
126
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
127
|
-
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions
|
|
128
|
-
}));
|
|
129
|
-
}
|
|
130
|
-
var _default = exports.default = annotationPlugin;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.getAnnotationViewClassname = exports.AnnotationNodeView = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
11
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
|
-
var _react = _interopRequireDefault(require("react"));
|
|
14
|
-
var _styles = require("@atlaskit/editor-common/styles");
|
|
15
|
-
var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
|
|
16
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
17
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
18
|
-
var AnnotationNodeView = exports.AnnotationNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
19
|
-
(0, _inherits2.default)(AnnotationNodeView, _ReactNodeView);
|
|
20
|
-
var _super = _createSuper(AnnotationNodeView);
|
|
21
|
-
function AnnotationNodeView() {
|
|
22
|
-
(0, _classCallCheck2.default)(this, AnnotationNodeView);
|
|
23
|
-
return _super.apply(this, arguments);
|
|
24
|
-
}
|
|
25
|
-
(0, _createClass2.default)(AnnotationNodeView, [{
|
|
26
|
-
key: "createDomRef",
|
|
27
|
-
value: function createDomRef() {
|
|
28
|
-
return document.createElement('span');
|
|
29
|
-
}
|
|
30
|
-
}, {
|
|
31
|
-
key: "getContentDOM",
|
|
32
|
-
value: function getContentDOM() {
|
|
33
|
-
var dom = document.createElement('span');
|
|
34
|
-
dom.className = 'ak-editor-annotation';
|
|
35
|
-
return {
|
|
36
|
-
dom: dom
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
}, {
|
|
40
|
-
key: "render",
|
|
41
|
-
value: function render(_props, forwardRef) {
|
|
42
|
-
return (
|
|
43
|
-
/*#__PURE__*/
|
|
44
|
-
// all inline comment states are now set in decorations at ../pm-plugins/inline-comment.ts
|
|
45
|
-
_react.default.createElement("span", {
|
|
46
|
-
"data-mark-type": "annotation",
|
|
47
|
-
ref: forwardRef
|
|
48
|
-
})
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
}]);
|
|
52
|
-
return AnnotationNodeView;
|
|
53
|
-
}(_reactNodeView.default);
|
|
54
|
-
var getAnnotationViewClassname = exports.getAnnotationViewClassname = function getAnnotationViewClassname(isUnresolved, hasFocus) {
|
|
55
|
-
if (!isUnresolved) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
return hasFocus ? _styles.AnnotationSharedClassNames.focus : _styles.AnnotationSharedClassNames.blur;
|
|
59
|
-
};
|