@atlaskit/editor-common 103.2.0 → 103.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/cjs/analytics/types/alignment-events.js +5 -0
- package/dist/cjs/analytics/types/enums.js +1 -0
- package/dist/cjs/annotation/index.js +16 -1
- package/dist/cjs/annotation/manager.js +243 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/analytics/types/alignment-events.js +1 -0
- package/dist/es2019/analytics/types/enums.js +1 -0
- package/dist/es2019/annotation/index.js +22 -0
- package/dist/es2019/annotation/manager.js +196 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/analytics/types/alignment-events.js +1 -0
- package/dist/esm/analytics/types/enums.js +1 -0
- package/dist/esm/annotation/index.js +23 -1
- package/dist/esm/annotation/manager.js +236 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/analytics/types/alignment-events.d.ts +8 -0
- package/dist/types/analytics/types/enums.d.ts +2 -1
- package/dist/types/analytics/types/events.d.ts +2 -1
- package/dist/types/annotation/index.d.ts +132 -0
- package/dist/types/annotation/manager.d.ts +32 -0
- package/dist/types/types/annotation/index.d.ts +2 -0
- package/dist/types-ts4.5/analytics/types/alignment-events.d.ts +8 -0
- package/dist/types-ts4.5/analytics/types/enums.d.ts +2 -1
- package/dist/types-ts4.5/analytics/types/events.d.ts +2 -1
- package/dist/types-ts4.5/annotation/index.d.ts +132 -0
- package/dist/types-ts4.5/annotation/manager.d.ts +32 -0
- package/dist/types-ts4.5/types/annotation/index.d.ts +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 103.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#139038](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/139038)
|
|
8
|
+
[`50d48758aba38`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/50d48758aba38) -
|
|
9
|
+
[ED-27448] Implement alignment updated event
|
|
10
|
+
|
|
11
|
+
## 103.3.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#137860](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/137860)
|
|
16
|
+
[`04e753d1ba0f4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/04e753d1ba0f4) -
|
|
17
|
+
Created a new Annotation manager implementation and interface and updated CCFE to create and share
|
|
18
|
+
this instance around
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
3
24
|
## 103.2.0
|
|
4
25
|
|
|
5
26
|
### Minor Changes
|
|
@@ -317,6 +317,7 @@ var ACTION_SUBJECT = exports.ACTION_SUBJECT = /*#__PURE__*/function (ACTION_SUBJ
|
|
|
317
317
|
ACTION_SUBJECT["EDITOR_PLUGIN_SELECTION_EXTENSION"] = "editorPluginSelectionExtension";
|
|
318
318
|
ACTION_SUBJECT["AI_DEFINITIONS"] = "aiDefinitions";
|
|
319
319
|
ACTION_SUBJECT["USER_PREFERENCES"] = "userPreferences";
|
|
320
|
+
ACTION_SUBJECT["ALIGNMENT"] = "alignment";
|
|
320
321
|
return ACTION_SUBJECT;
|
|
321
322
|
}({});
|
|
322
323
|
var ACTION_SUBJECT_ID = exports.ACTION_SUBJECT_ID = /*#__PURE__*/function (ACTION_SUBJECT_ID) {
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.AnnotationUpdateEmitter = void 0;
|
|
8
|
+
exports.createAnnotationManager = createAnnotationManager;
|
|
8
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
11
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
@@ -12,6 +13,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
12
13
|
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
13
14
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
15
|
var _events = require("events");
|
|
16
|
+
var _manager = require("./manager");
|
|
15
17
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
16
18
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
17
19
|
function _superPropGet(t, o, e, r) { var p = (0, _get2.default)((0, _getPrototypeOf2.default)(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
@@ -32,4 +34,17 @@ var AnnotationUpdateEmitter = exports.AnnotationUpdateEmitter = /*#__PURE__*/fun
|
|
|
32
34
|
return _superPropGet(AnnotationUpdateEmitter, "removeListener", this, 3)([event, listener]);
|
|
33
35
|
}
|
|
34
36
|
}]);
|
|
35
|
-
}(_events.EventEmitter);
|
|
37
|
+
}(_events.EventEmitter); // type ActionResult = { step: Step; doc: JSONDocNode } | false;
|
|
38
|
+
// } & AnnotationByMatches)
|
|
39
|
+
// | false;
|
|
40
|
+
// ### Events
|
|
41
|
+
// ### Hook Results
|
|
42
|
+
/**
|
|
43
|
+
* This is the list of methods which exist on the Manager interface. These are the methods that can be hooked into.
|
|
44
|
+
*/
|
|
45
|
+
/*
|
|
46
|
+
* This is the public interface for the AnnotationManager. It provides methods for interacting with the manager.
|
|
47
|
+
*/
|
|
48
|
+
function createAnnotationManager() {
|
|
49
|
+
return new _manager.SharedAnnotationManager();
|
|
50
|
+
}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.SharedAnnotationManager = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _events = require("events");
|
|
12
|
+
var SharedAnnotationManager = exports.SharedAnnotationManager = /*#__PURE__*/function () {
|
|
13
|
+
function SharedAnnotationManager() {
|
|
14
|
+
(0, _classCallCheck2.default)(this, SharedAnnotationManager);
|
|
15
|
+
/**
|
|
16
|
+
* This is the event emitter that is used to emit events from the manager. It is used to communicate with
|
|
17
|
+
* other parts of the application.
|
|
18
|
+
*/
|
|
19
|
+
(0, _defineProperty2.default)(this, "emitter", new _events.EventEmitter());
|
|
20
|
+
/**
|
|
21
|
+
* This is the map of hooks that can be added to the manager. Hooks are a 1:1 mapping of methods that can be
|
|
22
|
+
* called on the manager. They are used to extend the functionality of the manager.
|
|
23
|
+
*/
|
|
24
|
+
(0, _defineProperty2.default)(this, "hooks", new Map());
|
|
25
|
+
(0, _defineProperty2.default)(this, "preemptiveGate", function () {
|
|
26
|
+
return Promise.resolve(true);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return (0, _createClass2.default)(SharedAnnotationManager, [{
|
|
30
|
+
key: "setPreemptiveGate",
|
|
31
|
+
value: function setPreemptiveGate(handler) {
|
|
32
|
+
this.preemptiveGate = handler;
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
}, {
|
|
36
|
+
key: "checkPreemptiveGate",
|
|
37
|
+
value: function checkPreemptiveGate() {
|
|
38
|
+
return this.preemptiveGate();
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
key: "onDraftAnnotationStarted",
|
|
42
|
+
value: function onDraftAnnotationStarted(handler) {
|
|
43
|
+
this.emitter.on('draftAnnotationStarted', handler);
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
key: "offDraftAnnotationStarted",
|
|
48
|
+
value: function offDraftAnnotationStarted(handler) {
|
|
49
|
+
this.emitter.off('draftAnnotationStarted', handler);
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
53
|
+
key: "onAnnotationSelectionChange",
|
|
54
|
+
value: function onAnnotationSelectionChange(handler) {
|
|
55
|
+
this.emitter.on('annotationSelectionChanged', handler);
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
59
|
+
key: "offAnnotationSelectionChange",
|
|
60
|
+
value: function offAnnotationSelectionChange(handler) {
|
|
61
|
+
this.emitter.off('annotationSelectionChanged', handler);
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
}, {
|
|
65
|
+
key: "emit",
|
|
66
|
+
value: function emit(event) {
|
|
67
|
+
this.emitter.emit(event.name, event.data);
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
key: "hook",
|
|
72
|
+
value: function hook(method, handler) {
|
|
73
|
+
this.hooks.set(method, handler);
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
}, {
|
|
77
|
+
key: "unhook",
|
|
78
|
+
value: function unhook(method, handler) {
|
|
79
|
+
if (!this.hooks.has(method) || this.hooks.get(method) !== handler) {
|
|
80
|
+
return this;
|
|
81
|
+
}
|
|
82
|
+
this.hooks.delete(method);
|
|
83
|
+
return this;
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
key: "allowAnnotation",
|
|
87
|
+
value: function allowAnnotation() {
|
|
88
|
+
var fn = this.hooks.get('allowAnnotation');
|
|
89
|
+
if (!fn) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
return fn();
|
|
94
|
+
} catch (error) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}, {
|
|
99
|
+
key: "startDraft",
|
|
100
|
+
value: function startDraft() {
|
|
101
|
+
var fn = this.hooks.get('startDraft');
|
|
102
|
+
if (!fn) {
|
|
103
|
+
return {
|
|
104
|
+
success: false,
|
|
105
|
+
reason: 'manager-not-initialized'
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
var result = fn();
|
|
110
|
+
if (result.success) {
|
|
111
|
+
this.emitter.emit('draftAnnotationStarted', {
|
|
112
|
+
targetElement: result.targetElement,
|
|
113
|
+
inlineNodeTypes: result.inlineNodeTypes,
|
|
114
|
+
actionResult: result.actionResult
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
return result;
|
|
118
|
+
} catch (error) {
|
|
119
|
+
return {
|
|
120
|
+
success: false,
|
|
121
|
+
reason: 'hook-execution-error'
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}, {
|
|
126
|
+
key: "clearDraft",
|
|
127
|
+
value: function clearDraft() {
|
|
128
|
+
var fn = this.hooks.get('clearDraft');
|
|
129
|
+
if (!fn) {
|
|
130
|
+
return {
|
|
131
|
+
success: false,
|
|
132
|
+
reason: 'manager-not-initialized'
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
return fn();
|
|
137
|
+
} catch (error) {
|
|
138
|
+
return {
|
|
139
|
+
success: false,
|
|
140
|
+
reason: 'hook-execution-error'
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}, {
|
|
145
|
+
key: "applyDraft",
|
|
146
|
+
value: function applyDraft(id) {
|
|
147
|
+
var fn = this.hooks.get('applyDraft');
|
|
148
|
+
if (!fn) {
|
|
149
|
+
return {
|
|
150
|
+
success: false,
|
|
151
|
+
reason: 'manager-not-initialized'
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
try {
|
|
155
|
+
return fn(id);
|
|
156
|
+
} catch (error) {
|
|
157
|
+
return {
|
|
158
|
+
success: false,
|
|
159
|
+
reason: 'hook-execution-error'
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}, {
|
|
164
|
+
key: "getDraft",
|
|
165
|
+
value: function getDraft() {
|
|
166
|
+
var fn = this.hooks.get('getDraft');
|
|
167
|
+
if (!fn) {
|
|
168
|
+
return {
|
|
169
|
+
success: false,
|
|
170
|
+
reason: 'manager-not-initialized'
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
try {
|
|
174
|
+
return fn();
|
|
175
|
+
} catch (error) {
|
|
176
|
+
return {
|
|
177
|
+
success: false,
|
|
178
|
+
reason: 'hook-execution-error'
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}, {
|
|
183
|
+
key: "setIsAnnotationSelected",
|
|
184
|
+
value: function setIsAnnotationSelected(id, isSelected) {
|
|
185
|
+
var fn = this.hooks.get('setIsAnnotationSelected');
|
|
186
|
+
if (!fn) {
|
|
187
|
+
return {
|
|
188
|
+
success: false,
|
|
189
|
+
reason: 'manager-not-initialized'
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
try {
|
|
193
|
+
// NOTE: The hook needs to manage the firing the annotationSelectionChanged event when a change is made. This is
|
|
194
|
+
// because the hook is responsible for the state of the selection. The manager is not responsible for the state of
|
|
195
|
+
// the selection.
|
|
196
|
+
return fn(id, isSelected);
|
|
197
|
+
} catch (error) {
|
|
198
|
+
return {
|
|
199
|
+
success: false,
|
|
200
|
+
reason: 'hook-execution-error'
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}, {
|
|
205
|
+
key: "setIsAnnotationHovered",
|
|
206
|
+
value: function setIsAnnotationHovered(id, isHovered) {
|
|
207
|
+
var fn = this.hooks.get('setIsAnnotationHovered');
|
|
208
|
+
if (!fn) {
|
|
209
|
+
return {
|
|
210
|
+
success: false,
|
|
211
|
+
reason: 'manager-not-initialized'
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
try {
|
|
215
|
+
return fn(id, isHovered);
|
|
216
|
+
} catch (error) {
|
|
217
|
+
return {
|
|
218
|
+
success: false,
|
|
219
|
+
reason: 'hook-execution-error'
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}, {
|
|
224
|
+
key: "clearAnnotation",
|
|
225
|
+
value: function clearAnnotation(id) {
|
|
226
|
+
var fn = this.hooks.get('clearAnnotation');
|
|
227
|
+
if (!fn) {
|
|
228
|
+
return {
|
|
229
|
+
success: false,
|
|
230
|
+
reason: 'manager-not-initialized'
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
try {
|
|
234
|
+
return fn(id);
|
|
235
|
+
} catch (error) {
|
|
236
|
+
return {
|
|
237
|
+
success: false,
|
|
238
|
+
reason: 'hook-execution-error'
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}]);
|
|
243
|
+
}();
|
|
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
17
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
18
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
19
19
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
20
|
-
var packageVersion = "103.
|
|
20
|
+
var packageVersion = "103.3.1";
|
|
21
21
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
22
22
|
// Remove URL as it has UGC
|
|
23
23
|
// Ignored via go/ees007
|
|
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
23
23
|
* @jsx jsx
|
|
24
24
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
25
25
|
var packageName = "@atlaskit/editor-common";
|
|
26
|
-
var packageVersion = "103.
|
|
26
|
+
var packageVersion = "103.3.1";
|
|
27
27
|
var halfFocusRing = 1;
|
|
28
28
|
var dropOffset = '0, 8';
|
|
29
29
|
// Ignored via go/ees005
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -311,6 +311,7 @@ export let ACTION_SUBJECT = /*#__PURE__*/function (ACTION_SUBJECT) {
|
|
|
311
311
|
ACTION_SUBJECT["EDITOR_PLUGIN_SELECTION_EXTENSION"] = "editorPluginSelectionExtension";
|
|
312
312
|
ACTION_SUBJECT["AI_DEFINITIONS"] = "aiDefinitions";
|
|
313
313
|
ACTION_SUBJECT["USER_PREFERENCES"] = "userPreferences";
|
|
314
|
+
ACTION_SUBJECT["ALIGNMENT"] = "alignment";
|
|
314
315
|
return ACTION_SUBJECT;
|
|
315
316
|
}({});
|
|
316
317
|
export let ACTION_SUBJECT_ID = /*#__PURE__*/function (ACTION_SUBJECT_ID) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
+
import { SharedAnnotationManager } from './manager';
|
|
2
3
|
export class AnnotationUpdateEmitter extends EventEmitter {
|
|
3
4
|
on(event, listener) {
|
|
4
5
|
return super.on(event, listener);
|
|
@@ -6,4 +7,25 @@ export class AnnotationUpdateEmitter extends EventEmitter {
|
|
|
6
7
|
off(event, listener) {
|
|
7
8
|
return super.removeListener(event, listener);
|
|
8
9
|
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// type ActionResult = { step: Step; doc: JSONDocNode } | false;
|
|
13
|
+
|
|
14
|
+
// } & AnnotationByMatches)
|
|
15
|
+
// | false;
|
|
16
|
+
|
|
17
|
+
// ### Events
|
|
18
|
+
|
|
19
|
+
// ### Hook Results
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* This is the list of methods which exist on the Manager interface. These are the methods that can be hooked into.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
* This is the public interface for the AnnotationManager. It provides methods for interacting with the manager.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
export function createAnnotationManager() {
|
|
30
|
+
return new SharedAnnotationManager();
|
|
9
31
|
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
export class SharedAnnotationManager {
|
|
4
|
+
constructor() {
|
|
5
|
+
/**
|
|
6
|
+
* This is the event emitter that is used to emit events from the manager. It is used to communicate with
|
|
7
|
+
* other parts of the application.
|
|
8
|
+
*/
|
|
9
|
+
_defineProperty(this, "emitter", new EventEmitter());
|
|
10
|
+
/**
|
|
11
|
+
* This is the map of hooks that can be added to the manager. Hooks are a 1:1 mapping of methods that can be
|
|
12
|
+
* called on the manager. They are used to extend the functionality of the manager.
|
|
13
|
+
*/
|
|
14
|
+
_defineProperty(this, "hooks", new Map());
|
|
15
|
+
_defineProperty(this, "preemptiveGate", () => Promise.resolve(true));
|
|
16
|
+
}
|
|
17
|
+
setPreemptiveGate(handler) {
|
|
18
|
+
this.preemptiveGate = handler;
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
checkPreemptiveGate() {
|
|
22
|
+
return this.preemptiveGate();
|
|
23
|
+
}
|
|
24
|
+
onDraftAnnotationStarted(handler) {
|
|
25
|
+
this.emitter.on('draftAnnotationStarted', handler);
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
offDraftAnnotationStarted(handler) {
|
|
29
|
+
this.emitter.off('draftAnnotationStarted', handler);
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
onAnnotationSelectionChange(handler) {
|
|
33
|
+
this.emitter.on('annotationSelectionChanged', handler);
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
offAnnotationSelectionChange(handler) {
|
|
37
|
+
this.emitter.off('annotationSelectionChanged', handler);
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
emit(event) {
|
|
41
|
+
this.emitter.emit(event.name, event.data);
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
hook(method, handler) {
|
|
45
|
+
this.hooks.set(method, handler);
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
unhook(method, handler) {
|
|
49
|
+
if (!this.hooks.has(method) || this.hooks.get(method) !== handler) {
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
this.hooks.delete(method);
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
allowAnnotation() {
|
|
56
|
+
const fn = this.hooks.get('allowAnnotation');
|
|
57
|
+
if (!fn) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
return fn();
|
|
62
|
+
} catch (error) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
startDraft() {
|
|
67
|
+
const fn = this.hooks.get('startDraft');
|
|
68
|
+
if (!fn) {
|
|
69
|
+
return {
|
|
70
|
+
success: false,
|
|
71
|
+
reason: 'manager-not-initialized'
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
const result = fn();
|
|
76
|
+
if (result.success) {
|
|
77
|
+
this.emitter.emit('draftAnnotationStarted', {
|
|
78
|
+
targetElement: result.targetElement,
|
|
79
|
+
inlineNodeTypes: result.inlineNodeTypes,
|
|
80
|
+
actionResult: result.actionResult
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return result;
|
|
84
|
+
} catch (error) {
|
|
85
|
+
return {
|
|
86
|
+
success: false,
|
|
87
|
+
reason: 'hook-execution-error'
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
clearDraft() {
|
|
92
|
+
const fn = this.hooks.get('clearDraft');
|
|
93
|
+
if (!fn) {
|
|
94
|
+
return {
|
|
95
|
+
success: false,
|
|
96
|
+
reason: 'manager-not-initialized'
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
return fn();
|
|
101
|
+
} catch (error) {
|
|
102
|
+
return {
|
|
103
|
+
success: false,
|
|
104
|
+
reason: 'hook-execution-error'
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
applyDraft(id) {
|
|
109
|
+
const fn = this.hooks.get('applyDraft');
|
|
110
|
+
if (!fn) {
|
|
111
|
+
return {
|
|
112
|
+
success: false,
|
|
113
|
+
reason: 'manager-not-initialized'
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
try {
|
|
117
|
+
return fn(id);
|
|
118
|
+
} catch (error) {
|
|
119
|
+
return {
|
|
120
|
+
success: false,
|
|
121
|
+
reason: 'hook-execution-error'
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
getDraft() {
|
|
126
|
+
const fn = this.hooks.get('getDraft');
|
|
127
|
+
if (!fn) {
|
|
128
|
+
return {
|
|
129
|
+
success: false,
|
|
130
|
+
reason: 'manager-not-initialized'
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
try {
|
|
134
|
+
return fn();
|
|
135
|
+
} catch (error) {
|
|
136
|
+
return {
|
|
137
|
+
success: false,
|
|
138
|
+
reason: 'hook-execution-error'
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
setIsAnnotationSelected(id, isSelected) {
|
|
143
|
+
const fn = this.hooks.get('setIsAnnotationSelected');
|
|
144
|
+
if (!fn) {
|
|
145
|
+
return {
|
|
146
|
+
success: false,
|
|
147
|
+
reason: 'manager-not-initialized'
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
try {
|
|
151
|
+
// NOTE: The hook needs to manage the firing the annotationSelectionChanged event when a change is made. This is
|
|
152
|
+
// because the hook is responsible for the state of the selection. The manager is not responsible for the state of
|
|
153
|
+
// the selection.
|
|
154
|
+
return fn(id, isSelected);
|
|
155
|
+
} catch (error) {
|
|
156
|
+
return {
|
|
157
|
+
success: false,
|
|
158
|
+
reason: 'hook-execution-error'
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
setIsAnnotationHovered(id, isHovered) {
|
|
163
|
+
const fn = this.hooks.get('setIsAnnotationHovered');
|
|
164
|
+
if (!fn) {
|
|
165
|
+
return {
|
|
166
|
+
success: false,
|
|
167
|
+
reason: 'manager-not-initialized'
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
try {
|
|
171
|
+
return fn(id, isHovered);
|
|
172
|
+
} catch (error) {
|
|
173
|
+
return {
|
|
174
|
+
success: false,
|
|
175
|
+
reason: 'hook-execution-error'
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
clearAnnotation(id) {
|
|
180
|
+
const fn = this.hooks.get('clearAnnotation');
|
|
181
|
+
if (!fn) {
|
|
182
|
+
return {
|
|
183
|
+
success: false,
|
|
184
|
+
reason: 'manager-not-initialized'
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
try {
|
|
188
|
+
return fn(id);
|
|
189
|
+
} catch (error) {
|
|
190
|
+
return {
|
|
191
|
+
success: false,
|
|
192
|
+
reason: 'hook-execution-error'
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isFedRamp } from './environment';
|
|
2
2
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
3
3
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
4
|
-
const packageVersion = "103.
|
|
4
|
+
const packageVersion = "103.3.1";
|
|
5
5
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
6
6
|
// Remove URL as it has UGC
|
|
7
7
|
// Ignored via go/ees007
|
|
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
13
13
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
14
14
|
import Layer from '../Layer';
|
|
15
15
|
const packageName = "@atlaskit/editor-common";
|
|
16
|
-
const packageVersion = "103.
|
|
16
|
+
const packageVersion = "103.3.1";
|
|
17
17
|
const halfFocusRing = 1;
|
|
18
18
|
const dropOffset = '0, 8';
|
|
19
19
|
// Ignored via go/ees005
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -311,6 +311,7 @@ export var ACTION_SUBJECT = /*#__PURE__*/function (ACTION_SUBJECT) {
|
|
|
311
311
|
ACTION_SUBJECT["EDITOR_PLUGIN_SELECTION_EXTENSION"] = "editorPluginSelectionExtension";
|
|
312
312
|
ACTION_SUBJECT["AI_DEFINITIONS"] = "aiDefinitions";
|
|
313
313
|
ACTION_SUBJECT["USER_PREFERENCES"] = "userPreferences";
|
|
314
|
+
ACTION_SUBJECT["ALIGNMENT"] = "alignment";
|
|
314
315
|
return ACTION_SUBJECT;
|
|
315
316
|
}({});
|
|
316
317
|
export var ACTION_SUBJECT_ID = /*#__PURE__*/function (ACTION_SUBJECT_ID) {
|
|
@@ -8,6 +8,7 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
|
|
|
8
8
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
9
|
function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
10
10
|
import { EventEmitter } from 'events';
|
|
11
|
+
import { SharedAnnotationManager } from './manager';
|
|
11
12
|
export var AnnotationUpdateEmitter = /*#__PURE__*/function (_EventEmitter) {
|
|
12
13
|
function AnnotationUpdateEmitter() {
|
|
13
14
|
_classCallCheck(this, AnnotationUpdateEmitter);
|
|
@@ -25,4 +26,25 @@ export var AnnotationUpdateEmitter = /*#__PURE__*/function (_EventEmitter) {
|
|
|
25
26
|
return _superPropGet(AnnotationUpdateEmitter, "removeListener", this, 3)([event, listener]);
|
|
26
27
|
}
|
|
27
28
|
}]);
|
|
28
|
-
}(EventEmitter);
|
|
29
|
+
}(EventEmitter);
|
|
30
|
+
|
|
31
|
+
// type ActionResult = { step: Step; doc: JSONDocNode } | false;
|
|
32
|
+
|
|
33
|
+
// } & AnnotationByMatches)
|
|
34
|
+
// | false;
|
|
35
|
+
|
|
36
|
+
// ### Events
|
|
37
|
+
|
|
38
|
+
// ### Hook Results
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* This is the list of methods which exist on the Manager interface. These are the methods that can be hooked into.
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/*
|
|
45
|
+
* This is the public interface for the AnnotationManager. It provides methods for interacting with the manager.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
export function createAnnotationManager() {
|
|
49
|
+
return new SharedAnnotationManager();
|
|
50
|
+
}
|