@atlaskit/editor-common 104.1.2 → 104.1.4
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 +20 -0
- package/dist/cjs/annotation/index.js +0 -1
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/react-node-view/index.js +30 -11
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/annotation/index.js +0 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/react-node-view/index.js +30 -11
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/annotation/index.js +0 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/react-node-view/index.js +30 -11
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/annotation/index.d.ts +33 -4
- package/dist/types/types/annotation/index.d.ts +2 -2
- package/dist/types-ts4.5/annotation/index.d.ts +33 -4
- package/dist/types-ts4.5/types/annotation/index.d.ts +2 -2
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 104.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#149969](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/149969)
|
|
8
|
+
[`42c3f35e57188`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/42c3f35e57188) -
|
|
9
|
+
ED-27882: Get rid of parent offset check in \_handleRef in the react node view. Add metadata to
|
|
10
|
+
these calls in the \_handleRef and \_handleTableRef.
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 104.1.3
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#142925](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/142925)
|
|
18
|
+
[`e013698350bef`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e013698350bef) -
|
|
19
|
+
This updates the renderer to use the new annotation manager create comment APIs and disables the
|
|
20
|
+
use of the old create hooks. This should be backward compatible and can be controled by a FG
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 104.1.2
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -35,7 +35,6 @@ var AnnotationUpdateEmitter = exports.AnnotationUpdateEmitter = /*#__PURE__*/fun
|
|
|
35
35
|
}
|
|
36
36
|
}]);
|
|
37
37
|
}(_events.EventEmitter); // type ActionResult = { step: Step; doc: JSONDocNode } | false;
|
|
38
|
-
// } & AnnotationByMatches)
|
|
39
38
|
// | false;
|
|
40
39
|
// ### Events
|
|
41
40
|
// ### Hook Results
|
|
@@ -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 = "104.1.
|
|
20
|
+
var packageVersion = "104.1.4";
|
|
21
21
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
22
22
|
// Remove URL as it has UGC
|
|
23
23
|
// Ignored via go/ees007
|
|
@@ -22,6 +22,7 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
22
22
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
23
23
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
24
24
|
var _react = _interopRequireDefault(require("react"));
|
|
25
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
25
26
|
var _analytics = require("../analytics");
|
|
26
27
|
var _eventDispatcher = require("../event-dispatcher");
|
|
27
28
|
var _ErrorBoundary = require("../ui/ErrorBoundary");
|
|
@@ -159,13 +160,12 @@ var ReactNodeView = exports.default = /*#__PURE__*/function () {
|
|
|
159
160
|
// Ignored via go/ees005
|
|
160
161
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
161
162
|
var oldIgnoreMutation;
|
|
163
|
+
var parentOffset = 0; // Remove with feature gate: platform_editor_r18_fix_selection_resync
|
|
162
164
|
var selectionBookmark;
|
|
163
|
-
var parentOffset = 0;
|
|
164
165
|
var mutationsIgnored = false;
|
|
165
166
|
|
|
166
167
|
// move the contentDOM node inside the inner reference after rendering
|
|
167
168
|
if (node && contentDOM && !node.contains(contentDOM)) {
|
|
168
|
-
var _this$view$state$sele;
|
|
169
169
|
// @ts-ignore - ignoreMutation may not be declared
|
|
170
170
|
oldIgnoreMutation = this.ignoreMutation; // store ref to previous ignoreMutation
|
|
171
171
|
|
|
@@ -186,21 +186,40 @@ var ReactNodeView = exports.default = /*#__PURE__*/function () {
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
// ... and capture parent offset before DOM change
|
|
189
|
-
if ((
|
|
190
|
-
var _this$view$state$
|
|
191
|
-
|
|
189
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_r18_fix_selection_resync')) {
|
|
190
|
+
var _this$view$state$sele;
|
|
191
|
+
if (((_this$view$state$sele = this.view.state.selection) === null || _this$view$state$sele === void 0 ? void 0 : _this$view$state$sele.ranges.length) > 0) {
|
|
192
|
+
var _this$view$state$sele2, _this$view$state$sele3;
|
|
193
|
+
parentOffset = (_this$view$state$sele2 = (_this$view$state$sele3 = this.view.state.selection) === null || _this$view$state$sele3 === void 0 || (_this$view$state$sele3 = _this$view$state$sele3.ranges[0].$from) === null || _this$view$state$sele3 === void 0 ? void 0 : _this$view$state$sele3.parentOffset) !== null && _this$view$state$sele2 !== void 0 ? _this$view$state$sele2 : 0;
|
|
194
|
+
}
|
|
192
195
|
}
|
|
193
196
|
node.appendChild(contentDOM);
|
|
197
|
+
|
|
198
|
+
// After the next frame:
|
|
194
199
|
requestAnimationFrame(function () {
|
|
195
|
-
//
|
|
200
|
+
// Restore the original mutation handler
|
|
196
201
|
// @ts-ignore - this may not have been declared by implementing class
|
|
197
202
|
_this4.ignoreMutation = oldIgnoreMutation;
|
|
198
203
|
|
|
199
|
-
//
|
|
200
|
-
//
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
+
// Restore the selection only if:
|
|
205
|
+
// - We have a selection bookmark
|
|
206
|
+
// - Mutations were ignored during the table move
|
|
207
|
+
// - The bookmarked selection is different from the current selection.
|
|
208
|
+
if (selectionBookmark && mutationsIgnored) {
|
|
209
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_r18_fix_selection_resync')) {
|
|
210
|
+
var resolvedSelection = selectionBookmark.resolve(_this4.view.state.tr.doc);
|
|
211
|
+
// Don't set the selection if it's the same as the current selection.
|
|
212
|
+
if (!resolvedSelection.eq(_this4.view.state.selection)) {
|
|
213
|
+
var tr = _this4.view.state.tr.setSelection(resolvedSelection);
|
|
214
|
+
tr.setMeta('source', 'ReactNodeView:_handleRef:selection-resync');
|
|
215
|
+
_this4.view.dispatch(tr);
|
|
216
|
+
}
|
|
217
|
+
} else {
|
|
218
|
+
if (parentOffset > 0) {
|
|
219
|
+
// ... and dispatch expected selection state
|
|
220
|
+
_this4.view.dispatch(_this4.view.state.tr.setSelection(selectionBookmark.resolve(_this4.view.state.tr.doc)));
|
|
221
|
+
}
|
|
222
|
+
}
|
|
204
223
|
}
|
|
205
224
|
});
|
|
206
225
|
}
|
|
@@ -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 = "104.1.
|
|
26
|
+
var packageVersion = "104.1.4";
|
|
27
27
|
var halfFocusRing = 1;
|
|
28
28
|
var dropOffset = '0, 8';
|
|
29
29
|
// Ignored via go/ees005
|
|
@@ -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 = "104.1.
|
|
4
|
+
const packageVersion = "104.1.4";
|
|
5
5
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
6
6
|
// Remove URL as it has UGC
|
|
7
7
|
// Ignored via go/ees007
|
|
@@ -4,6 +4,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
4
4
|
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
5
5
|
|
|
6
6
|
import React from 'react';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
|
|
8
9
|
import { createDispatch } from '../event-dispatcher';
|
|
9
10
|
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
@@ -122,13 +123,12 @@ export default class ReactNodeView {
|
|
|
122
123
|
// Ignored via go/ees005
|
|
123
124
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
124
125
|
let oldIgnoreMutation;
|
|
126
|
+
let parentOffset = 0; // Remove with feature gate: platform_editor_r18_fix_selection_resync
|
|
125
127
|
let selectionBookmark;
|
|
126
|
-
let parentOffset = 0;
|
|
127
128
|
let mutationsIgnored = false;
|
|
128
129
|
|
|
129
130
|
// move the contentDOM node inside the inner reference after rendering
|
|
130
131
|
if (node && contentDOM && !node.contains(contentDOM)) {
|
|
131
|
-
var _this$view$state$sele;
|
|
132
132
|
// @ts-ignore - ignoreMutation may not be declared
|
|
133
133
|
oldIgnoreMutation = this.ignoreMutation; // store ref to previous ignoreMutation
|
|
134
134
|
|
|
@@ -149,21 +149,40 @@ export default class ReactNodeView {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
// ... and capture parent offset before DOM change
|
|
152
|
-
if ((
|
|
153
|
-
var _this$view$state$
|
|
154
|
-
|
|
152
|
+
if (!fg('platform_editor_r18_fix_selection_resync')) {
|
|
153
|
+
var _this$view$state$sele;
|
|
154
|
+
if (((_this$view$state$sele = this.view.state.selection) === null || _this$view$state$sele === void 0 ? void 0 : _this$view$state$sele.ranges.length) > 0) {
|
|
155
|
+
var _this$view$state$sele2, _this$view$state$sele3, _this$view$state$sele4;
|
|
156
|
+
parentOffset = (_this$view$state$sele2 = (_this$view$state$sele3 = this.view.state.selection) === null || _this$view$state$sele3 === void 0 ? void 0 : (_this$view$state$sele4 = _this$view$state$sele3.ranges[0].$from) === null || _this$view$state$sele4 === void 0 ? void 0 : _this$view$state$sele4.parentOffset) !== null && _this$view$state$sele2 !== void 0 ? _this$view$state$sele2 : 0;
|
|
157
|
+
}
|
|
155
158
|
}
|
|
156
159
|
node.appendChild(contentDOM);
|
|
160
|
+
|
|
161
|
+
// After the next frame:
|
|
157
162
|
requestAnimationFrame(() => {
|
|
158
|
-
//
|
|
163
|
+
// Restore the original mutation handler
|
|
159
164
|
// @ts-ignore - this may not have been declared by implementing class
|
|
160
165
|
this.ignoreMutation = oldIgnoreMutation;
|
|
161
166
|
|
|
162
|
-
//
|
|
163
|
-
//
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
+
// Restore the selection only if:
|
|
168
|
+
// - We have a selection bookmark
|
|
169
|
+
// - Mutations were ignored during the table move
|
|
170
|
+
// - The bookmarked selection is different from the current selection.
|
|
171
|
+
if (selectionBookmark && mutationsIgnored) {
|
|
172
|
+
if (fg('platform_editor_r18_fix_selection_resync')) {
|
|
173
|
+
const resolvedSelection = selectionBookmark.resolve(this.view.state.tr.doc);
|
|
174
|
+
// Don't set the selection if it's the same as the current selection.
|
|
175
|
+
if (!resolvedSelection.eq(this.view.state.selection)) {
|
|
176
|
+
const tr = this.view.state.tr.setSelection(resolvedSelection);
|
|
177
|
+
tr.setMeta('source', 'ReactNodeView:_handleRef:selection-resync');
|
|
178
|
+
this.view.dispatch(tr);
|
|
179
|
+
}
|
|
180
|
+
} else {
|
|
181
|
+
if (parentOffset > 0) {
|
|
182
|
+
// ... and dispatch expected selection state
|
|
183
|
+
this.view.dispatch(this.view.state.tr.setSelection(selectionBookmark.resolve(this.view.state.tr.doc)));
|
|
184
|
+
}
|
|
185
|
+
}
|
|
167
186
|
}
|
|
168
187
|
});
|
|
169
188
|
}
|
|
@@ -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 = "104.1.
|
|
16
|
+
const packageVersion = "104.1.4";
|
|
17
17
|
const halfFocusRing = 1;
|
|
18
18
|
const dropOffset = '0, 8';
|
|
19
19
|
// Ignored via go/ees005
|
|
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
import { isFedRamp } from './environment';
|
|
8
8
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
9
9
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
10
|
-
var packageVersion = "104.1.
|
|
10
|
+
var packageVersion = "104.1.4";
|
|
11
11
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
12
12
|
// Remove URL as it has UGC
|
|
13
13
|
// Ignored via go/ees007
|
|
@@ -6,6 +6,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
6
6
|
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
|
|
10
11
|
import { createDispatch } from '../event-dispatcher';
|
|
11
12
|
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
@@ -141,13 +142,12 @@ var ReactNodeView = /*#__PURE__*/function () {
|
|
|
141
142
|
// Ignored via go/ees005
|
|
142
143
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
143
144
|
var oldIgnoreMutation;
|
|
145
|
+
var parentOffset = 0; // Remove with feature gate: platform_editor_r18_fix_selection_resync
|
|
144
146
|
var selectionBookmark;
|
|
145
|
-
var parentOffset = 0;
|
|
146
147
|
var mutationsIgnored = false;
|
|
147
148
|
|
|
148
149
|
// move the contentDOM node inside the inner reference after rendering
|
|
149
150
|
if (node && contentDOM && !node.contains(contentDOM)) {
|
|
150
|
-
var _this$view$state$sele;
|
|
151
151
|
// @ts-ignore - ignoreMutation may not be declared
|
|
152
152
|
oldIgnoreMutation = this.ignoreMutation; // store ref to previous ignoreMutation
|
|
153
153
|
|
|
@@ -168,21 +168,40 @@ var ReactNodeView = /*#__PURE__*/function () {
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
// ... and capture parent offset before DOM change
|
|
171
|
-
if ((
|
|
172
|
-
var _this$view$state$
|
|
173
|
-
|
|
171
|
+
if (!fg('platform_editor_r18_fix_selection_resync')) {
|
|
172
|
+
var _this$view$state$sele;
|
|
173
|
+
if (((_this$view$state$sele = this.view.state.selection) === null || _this$view$state$sele === void 0 ? void 0 : _this$view$state$sele.ranges.length) > 0) {
|
|
174
|
+
var _this$view$state$sele2, _this$view$state$sele3;
|
|
175
|
+
parentOffset = (_this$view$state$sele2 = (_this$view$state$sele3 = this.view.state.selection) === null || _this$view$state$sele3 === void 0 || (_this$view$state$sele3 = _this$view$state$sele3.ranges[0].$from) === null || _this$view$state$sele3 === void 0 ? void 0 : _this$view$state$sele3.parentOffset) !== null && _this$view$state$sele2 !== void 0 ? _this$view$state$sele2 : 0;
|
|
176
|
+
}
|
|
174
177
|
}
|
|
175
178
|
node.appendChild(contentDOM);
|
|
179
|
+
|
|
180
|
+
// After the next frame:
|
|
176
181
|
requestAnimationFrame(function () {
|
|
177
|
-
//
|
|
182
|
+
// Restore the original mutation handler
|
|
178
183
|
// @ts-ignore - this may not have been declared by implementing class
|
|
179
184
|
_this4.ignoreMutation = oldIgnoreMutation;
|
|
180
185
|
|
|
181
|
-
//
|
|
182
|
-
//
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
+
// Restore the selection only if:
|
|
187
|
+
// - We have a selection bookmark
|
|
188
|
+
// - Mutations were ignored during the table move
|
|
189
|
+
// - The bookmarked selection is different from the current selection.
|
|
190
|
+
if (selectionBookmark && mutationsIgnored) {
|
|
191
|
+
if (fg('platform_editor_r18_fix_selection_resync')) {
|
|
192
|
+
var resolvedSelection = selectionBookmark.resolve(_this4.view.state.tr.doc);
|
|
193
|
+
// Don't set the selection if it's the same as the current selection.
|
|
194
|
+
if (!resolvedSelection.eq(_this4.view.state.selection)) {
|
|
195
|
+
var tr = _this4.view.state.tr.setSelection(resolvedSelection);
|
|
196
|
+
tr.setMeta('source', 'ReactNodeView:_handleRef:selection-resync');
|
|
197
|
+
_this4.view.dispatch(tr);
|
|
198
|
+
}
|
|
199
|
+
} else {
|
|
200
|
+
if (parentOffset > 0) {
|
|
201
|
+
// ... and dispatch expected selection state
|
|
202
|
+
_this4.view.dispatch(_this4.view.state.tr.setSelection(selectionBookmark.resolve(_this4.view.state.tr.doc)));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
186
205
|
}
|
|
187
206
|
});
|
|
188
207
|
}
|
|
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
20
20
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
21
21
|
import Layer from '../Layer';
|
|
22
22
|
var packageName = "@atlaskit/editor-common";
|
|
23
|
-
var packageVersion = "104.1.
|
|
23
|
+
var packageVersion = "104.1.4";
|
|
24
24
|
var halfFocusRing = 1;
|
|
25
25
|
var dropOffset = '0, 8';
|
|
26
26
|
// Ignored via go/ees005
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
5
|
import type { AnnotationId } from '@atlaskit/adf-schema';
|
|
6
6
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
7
|
-
import type {
|
|
7
|
+
import type { AddNodeMarkStep, AddMarkStep } from '@atlaskit/editor-prosemirror/transform';
|
|
8
8
|
export type UpdateEvent = 'create' | 'delete' | 'resolve' | 'unresolve' | 'setselectedannotation' | 'sethoveredannotation' | 'removehoveredannotation' | 'closeinlinecomment';
|
|
9
9
|
export type VisibilityEvent = 'setvisibility';
|
|
10
10
|
type AnnotationCallback = (params: string) => void;
|
|
@@ -14,13 +14,19 @@ export declare class AnnotationUpdateEmitter extends EventEmitter {
|
|
|
14
14
|
on(event: UpdateEvent, listener: (annotationId: string) => void): this;
|
|
15
15
|
off(event: string, listener: AnnotationCallback | VisibilityCallback): this;
|
|
16
16
|
}
|
|
17
|
-
type
|
|
18
|
-
|
|
17
|
+
type AnnotationByMatches = {
|
|
18
|
+
originalSelection: string;
|
|
19
|
+
numMatches: number;
|
|
20
|
+
matchIndex: number;
|
|
21
|
+
pos?: number;
|
|
22
|
+
};
|
|
23
|
+
export type ActionResult = {
|
|
24
|
+
step: AddMarkStep | AddNodeMarkStep;
|
|
19
25
|
doc: JSONDocNode;
|
|
20
26
|
/** The list of types of all inline nodes, which were wrapped by annotation. */
|
|
21
27
|
inlineNodeTypes?: string[];
|
|
22
28
|
targetNodeType?: string;
|
|
23
|
-
};
|
|
29
|
+
} & AnnotationByMatches;
|
|
24
30
|
export type AnnotationDraftStartedData = {
|
|
25
31
|
targetElement: HTMLElement | undefined;
|
|
26
32
|
/**
|
|
@@ -64,6 +70,11 @@ export type ApplyDraftResult = {
|
|
|
64
70
|
} | {
|
|
65
71
|
success: true;
|
|
66
72
|
targetElement: HTMLElement | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* The actionResult will be set if the id passed to the applyDraft method is different from the id created
|
|
75
|
+
* from the startDraft call.
|
|
76
|
+
*/
|
|
77
|
+
actionResult: ActionResult | undefined;
|
|
67
78
|
};
|
|
68
79
|
export type GetDraftResult = {
|
|
69
80
|
success: false;
|
|
@@ -99,7 +110,21 @@ export type AnnotationManagerMethods = {
|
|
|
99
110
|
allowAnnotation: () => boolean;
|
|
100
111
|
startDraft: () => StartDraftResult;
|
|
101
112
|
clearDraft: () => ClearDraftResult;
|
|
113
|
+
/**
|
|
114
|
+
* This will apply the current draft to the document.
|
|
115
|
+
*
|
|
116
|
+
* If an id is passed, it will be used to apply the draft, it will
|
|
117
|
+
* also generate a new actionResult value if the passed id is different from the one returned from the startDraft method.
|
|
118
|
+
*
|
|
119
|
+
* @param id The id of the annotation to apply. Ideally the same as the one returned from the startDraft method.
|
|
120
|
+
* If the id is different, the actionResult will contain a step and document with the new id. Changing the id is discouraged
|
|
121
|
+
* as this creates different behaviour between the editor and renderer.
|
|
122
|
+
*/
|
|
102
123
|
applyDraft: (id: AnnotationId) => ApplyDraftResult;
|
|
124
|
+
/**
|
|
125
|
+
* This can be used to inspect the current active draft.
|
|
126
|
+
* @returns The current draft data. If the draft is not started, it will return an error.
|
|
127
|
+
*/
|
|
103
128
|
getDraft: () => GetDraftResult;
|
|
104
129
|
setIsAnnotationSelected: (id: AnnotationId, isSelected: boolean) => SelectAnnotationResult;
|
|
105
130
|
setIsAnnotationHovered: (id: AnnotationId, isHovered: boolean) => HoverAnnotationResult;
|
|
@@ -113,6 +138,7 @@ export type AnnotationManager = AnnotationManagerMethods & {
|
|
|
113
138
|
setPreemptiveGate(handler: () => Promise<boolean>): AnnotationManager;
|
|
114
139
|
/**
|
|
115
140
|
* This method is used to run the configured preemptive gate check.
|
|
141
|
+
* @private
|
|
116
142
|
* @internal
|
|
117
143
|
*/
|
|
118
144
|
checkPreemptiveGate(): Promise<boolean>;
|
|
@@ -121,6 +147,7 @@ export type AnnotationManager = AnnotationManagerMethods & {
|
|
|
121
147
|
onAnnotationSelectionChange(handler: (data: AnnotationSelectedChangeData) => void): AnnotationManager;
|
|
122
148
|
offAnnotationSelectionChange(handler: (data: AnnotationSelectedChangeData) => void): AnnotationManager;
|
|
123
149
|
/**
|
|
150
|
+
* @private
|
|
124
151
|
* @internal
|
|
125
152
|
* This method is intended for internal Platform use only. It is not intended for use by Product code.
|
|
126
153
|
*/
|
|
@@ -132,11 +159,13 @@ export type AnnotationManager = AnnotationManagerMethods & {
|
|
|
132
159
|
data: AnnotationSelectedChangeData;
|
|
133
160
|
}): AnnotationManager;
|
|
134
161
|
/**
|
|
162
|
+
* @private
|
|
135
163
|
* @internal
|
|
136
164
|
* This method is intended for internal Platform use only. It is not intended for use by Product code.
|
|
137
165
|
*/
|
|
138
166
|
hook<H extends keyof AnnotationManagerMethods>(method: H, handler: AnnotationManagerMethods[H]): AnnotationManager;
|
|
139
167
|
/**
|
|
168
|
+
*
|
|
140
169
|
* @internal
|
|
141
170
|
* This method is intended for internal Platform use only. It is not intended for use by Product code.
|
|
142
171
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { AnnotationId, AnnotationTypes } from '@atlaskit/adf-schema';
|
|
3
3
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
4
|
-
import type { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
4
|
+
import type { AddNodeMarkStep, AddMarkStep, Step } from '@atlaskit/editor-prosemirror/transform';
|
|
5
5
|
import type { AnnotationManager } from '../../annotation';
|
|
6
6
|
import type { AnnotationState, AnnotationUpdateEmitter } from './emitter';
|
|
7
7
|
export type AnnotationByMatches = {
|
|
@@ -16,7 +16,7 @@ type ActionResult = {
|
|
|
16
16
|
doc: JSONDocNode;
|
|
17
17
|
} | false;
|
|
18
18
|
export type AnnotationActionResult = ({
|
|
19
|
-
step:
|
|
19
|
+
step: AddMarkStep | AddNodeMarkStep;
|
|
20
20
|
doc: JSONDocNode;
|
|
21
21
|
/** The list of types of all inline nodes, which were wrapped by annotation. */
|
|
22
22
|
inlineNodeTypes?: string[];
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
5
|
import type { AnnotationId } from '@atlaskit/adf-schema';
|
|
6
6
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
7
|
-
import type {
|
|
7
|
+
import type { AddNodeMarkStep, AddMarkStep } from '@atlaskit/editor-prosemirror/transform';
|
|
8
8
|
export type UpdateEvent = 'create' | 'delete' | 'resolve' | 'unresolve' | 'setselectedannotation' | 'sethoveredannotation' | 'removehoveredannotation' | 'closeinlinecomment';
|
|
9
9
|
export type VisibilityEvent = 'setvisibility';
|
|
10
10
|
type AnnotationCallback = (params: string) => void;
|
|
@@ -14,13 +14,19 @@ export declare class AnnotationUpdateEmitter extends EventEmitter {
|
|
|
14
14
|
on(event: UpdateEvent, listener: (annotationId: string) => void): this;
|
|
15
15
|
off(event: string, listener: AnnotationCallback | VisibilityCallback): this;
|
|
16
16
|
}
|
|
17
|
-
type
|
|
18
|
-
|
|
17
|
+
type AnnotationByMatches = {
|
|
18
|
+
originalSelection: string;
|
|
19
|
+
numMatches: number;
|
|
20
|
+
matchIndex: number;
|
|
21
|
+
pos?: number;
|
|
22
|
+
};
|
|
23
|
+
export type ActionResult = {
|
|
24
|
+
step: AddMarkStep | AddNodeMarkStep;
|
|
19
25
|
doc: JSONDocNode;
|
|
20
26
|
/** The list of types of all inline nodes, which were wrapped by annotation. */
|
|
21
27
|
inlineNodeTypes?: string[];
|
|
22
28
|
targetNodeType?: string;
|
|
23
|
-
};
|
|
29
|
+
} & AnnotationByMatches;
|
|
24
30
|
export type AnnotationDraftStartedData = {
|
|
25
31
|
targetElement: HTMLElement | undefined;
|
|
26
32
|
/**
|
|
@@ -64,6 +70,11 @@ export type ApplyDraftResult = {
|
|
|
64
70
|
} | {
|
|
65
71
|
success: true;
|
|
66
72
|
targetElement: HTMLElement | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* The actionResult will be set if the id passed to the applyDraft method is different from the id created
|
|
75
|
+
* from the startDraft call.
|
|
76
|
+
*/
|
|
77
|
+
actionResult: ActionResult | undefined;
|
|
67
78
|
};
|
|
68
79
|
export type GetDraftResult = {
|
|
69
80
|
success: false;
|
|
@@ -99,7 +110,21 @@ export type AnnotationManagerMethods = {
|
|
|
99
110
|
allowAnnotation: () => boolean;
|
|
100
111
|
startDraft: () => StartDraftResult;
|
|
101
112
|
clearDraft: () => ClearDraftResult;
|
|
113
|
+
/**
|
|
114
|
+
* This will apply the current draft to the document.
|
|
115
|
+
*
|
|
116
|
+
* If an id is passed, it will be used to apply the draft, it will
|
|
117
|
+
* also generate a new actionResult value if the passed id is different from the one returned from the startDraft method.
|
|
118
|
+
*
|
|
119
|
+
* @param id The id of the annotation to apply. Ideally the same as the one returned from the startDraft method.
|
|
120
|
+
* If the id is different, the actionResult will contain a step and document with the new id. Changing the id is discouraged
|
|
121
|
+
* as this creates different behaviour between the editor and renderer.
|
|
122
|
+
*/
|
|
102
123
|
applyDraft: (id: AnnotationId) => ApplyDraftResult;
|
|
124
|
+
/**
|
|
125
|
+
* This can be used to inspect the current active draft.
|
|
126
|
+
* @returns The current draft data. If the draft is not started, it will return an error.
|
|
127
|
+
*/
|
|
103
128
|
getDraft: () => GetDraftResult;
|
|
104
129
|
setIsAnnotationSelected: (id: AnnotationId, isSelected: boolean) => SelectAnnotationResult;
|
|
105
130
|
setIsAnnotationHovered: (id: AnnotationId, isHovered: boolean) => HoverAnnotationResult;
|
|
@@ -113,6 +138,7 @@ export type AnnotationManager = AnnotationManagerMethods & {
|
|
|
113
138
|
setPreemptiveGate(handler: () => Promise<boolean>): AnnotationManager;
|
|
114
139
|
/**
|
|
115
140
|
* This method is used to run the configured preemptive gate check.
|
|
141
|
+
* @private
|
|
116
142
|
* @internal
|
|
117
143
|
*/
|
|
118
144
|
checkPreemptiveGate(): Promise<boolean>;
|
|
@@ -121,6 +147,7 @@ export type AnnotationManager = AnnotationManagerMethods & {
|
|
|
121
147
|
onAnnotationSelectionChange(handler: (data: AnnotationSelectedChangeData) => void): AnnotationManager;
|
|
122
148
|
offAnnotationSelectionChange(handler: (data: AnnotationSelectedChangeData) => void): AnnotationManager;
|
|
123
149
|
/**
|
|
150
|
+
* @private
|
|
124
151
|
* @internal
|
|
125
152
|
* This method is intended for internal Platform use only. It is not intended for use by Product code.
|
|
126
153
|
*/
|
|
@@ -132,11 +159,13 @@ export type AnnotationManager = AnnotationManagerMethods & {
|
|
|
132
159
|
data: AnnotationSelectedChangeData;
|
|
133
160
|
}): AnnotationManager;
|
|
134
161
|
/**
|
|
162
|
+
* @private
|
|
135
163
|
* @internal
|
|
136
164
|
* This method is intended for internal Platform use only. It is not intended for use by Product code.
|
|
137
165
|
*/
|
|
138
166
|
hook<H extends keyof AnnotationManagerMethods>(method: H, handler: AnnotationManagerMethods[H]): AnnotationManager;
|
|
139
167
|
/**
|
|
168
|
+
*
|
|
140
169
|
* @internal
|
|
141
170
|
* This method is intended for internal Platform use only. It is not intended for use by Product code.
|
|
142
171
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { AnnotationId, AnnotationTypes } from '@atlaskit/adf-schema';
|
|
3
3
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
4
|
-
import type { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
4
|
+
import type { AddNodeMarkStep, AddMarkStep, Step } from '@atlaskit/editor-prosemirror/transform';
|
|
5
5
|
import type { AnnotationManager } from '../../annotation';
|
|
6
6
|
import type { AnnotationState, AnnotationUpdateEmitter } from './emitter';
|
|
7
7
|
export type AnnotationByMatches = {
|
|
@@ -16,7 +16,7 @@ type ActionResult = {
|
|
|
16
16
|
doc: JSONDocNode;
|
|
17
17
|
} | false;
|
|
18
18
|
export type AnnotationActionResult = ({
|
|
19
|
-
step:
|
|
19
|
+
step: AddMarkStep | AddNodeMarkStep;
|
|
20
20
|
doc: JSONDocNode;
|
|
21
21
|
/** The list of types of all inline nodes, which were wrapped by annotation. */
|
|
22
22
|
inlineNodeTypes?: string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "104.1.
|
|
3
|
+
"version": "104.1.4",
|
|
4
4
|
"description": "A package that contains common classes and components for editor and renderer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
"@atlaskit/platform-feature-flags-react": "^0.2.0",
|
|
158
158
|
"@atlaskit/popper": "^7.0.0",
|
|
159
159
|
"@atlaskit/primitives": "^14.7.0",
|
|
160
|
-
"@atlaskit/profilecard": "^23.
|
|
160
|
+
"@atlaskit/profilecard": "^23.11.0",
|
|
161
161
|
"@atlaskit/react-ufo": "^3.10.0",
|
|
162
162
|
"@atlaskit/section-message": "^8.2.0",
|
|
163
163
|
"@atlaskit/smart-card": "^37.1.0",
|
|
@@ -378,6 +378,9 @@
|
|
|
378
378
|
},
|
|
379
379
|
"platform_editor_controls_patch_analytics": {
|
|
380
380
|
"type": "boolean"
|
|
381
|
+
},
|
|
382
|
+
"platform_editor_r18_fix_selection_resync": {
|
|
383
|
+
"type": "boolean"
|
|
381
384
|
}
|
|
382
385
|
}
|
|
383
386
|
}
|