@atlaskit/editor-common 94.21.0 → 94.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/preset/builder.js +68 -5
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/utils/processRawValue.js +15 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/preset/builder.js +56 -5
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/utils/processRawValue.js +11 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/preset/builder.js +69 -5
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/utils/processRawValue.js +15 -1
- package/dist/types/preset/builder.d.ts +33 -2
- package/dist/types/utils/processRawValue.d.ts +2 -2
- package/dist/types-ts4.5/preset/builder.d.ts +33 -2
- package/dist/types-ts4.5/utils/processRawValue.d.ts +2 -2
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 94.22.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#163532](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/163532)
|
|
8
|
+
[`b80779d45e179`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b80779d45e179) -
|
|
9
|
+
moved processRawFragmentValue to editor-common
|
|
10
|
+
- [#165273](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/165273)
|
|
11
|
+
[`665190aa04bde`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/665190aa04bde) -
|
|
12
|
+
Fix setting up editorApi with usePreset for react strict mode by adding new apiResolver for
|
|
13
|
+
preset.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 94.21.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -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 = "94.
|
|
20
|
+
var packageVersion = "94.22.0";
|
|
21
21
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
22
22
|
// Remove URL as it has UGC
|
|
23
23
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -11,6 +11,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
11
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
+
var _eventDispatcher = require("../event-dispatcher");
|
|
14
15
|
/*********************
|
|
15
16
|
* *
|
|
16
17
|
* BASE TYPES *
|
|
@@ -500,14 +501,17 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
500
501
|
* If your code is inside an EditorPlugin you should be using the @see ExtractInjectionAPI.
|
|
501
502
|
*/
|
|
502
503
|
var EditorPresetBuilder = exports.EditorPresetBuilder = /*#__PURE__*/function () {
|
|
503
|
-
/**
|
|
504
|
-
* Returns the editor API when resolved.
|
|
505
|
-
* This occurs when the preset is initially built.
|
|
506
|
-
*/
|
|
507
|
-
|
|
508
504
|
function EditorPresetBuilder() {
|
|
509
505
|
var _this = this;
|
|
510
506
|
(0, _classCallCheck2.default)(this, EditorPresetBuilder);
|
|
507
|
+
/**
|
|
508
|
+
* @deprecated Use `apiResolver` instead
|
|
509
|
+
*/
|
|
510
|
+
/**
|
|
511
|
+
* Returns the editor API when resolved.
|
|
512
|
+
* This occurs when the preset is initially built.
|
|
513
|
+
*/
|
|
514
|
+
(0, _defineProperty2.default)(this, "apiEmitter", function () {});
|
|
511
515
|
(0, _defineProperty2.default)(this, "safeEntry", function (plugin) {
|
|
512
516
|
return Array.isArray(plugin) ? plugin : [plugin, undefined];
|
|
513
517
|
});
|
|
@@ -518,6 +522,9 @@ var EditorPresetBuilder = exports.EditorPresetBuilder = /*#__PURE__*/function ()
|
|
|
518
522
|
this.apiPromise = new Promise(function (r) {
|
|
519
523
|
return _this.resolver = r;
|
|
520
524
|
});
|
|
525
|
+
this.apiResolver = new APIDispatcher(function (emitter) {
|
|
526
|
+
return _this.apiEmitter = emitter;
|
|
527
|
+
});
|
|
521
528
|
}
|
|
522
529
|
(0, _createClass2.default)(EditorPresetBuilder, [{
|
|
523
530
|
key: "add",
|
|
@@ -575,6 +582,8 @@ var EditorPresetBuilder = exports.EditorPresetBuilder = /*#__PURE__*/function ()
|
|
|
575
582
|
// The pluginInjectionAPI API doesn't have information enough to build a proper type for the API.
|
|
576
583
|
// It is returning a generic type but on top of the Proxy system
|
|
577
584
|
// So, we can safely recast it here
|
|
585
|
+
this.apiEmitter(pluginInjectionAPI.api());
|
|
586
|
+
// Deprecated approach
|
|
578
587
|
(_this$resolver = this.resolver) === null || _this$resolver === void 0 || _this$resolver.call(this, pluginInjectionAPI.api());
|
|
579
588
|
}
|
|
580
589
|
return this.removeExcludedPlugins(editorPlugins, excludePlugins);
|
|
@@ -645,4 +654,58 @@ var EditorPresetBuilder = exports.EditorPresetBuilder = /*#__PURE__*/function ()
|
|
|
645
654
|
}
|
|
646
655
|
}]);
|
|
647
656
|
return EditorPresetBuilder;
|
|
657
|
+
}();
|
|
658
|
+
/**
|
|
659
|
+
* WARNING: Internal object
|
|
660
|
+
*
|
|
661
|
+
* Dedicated wrapper around EventDispatcher for public API around the editor API.
|
|
662
|
+
* This only has the public method `on` which is used to listen to updates to the editor API.
|
|
663
|
+
*
|
|
664
|
+
* This shouldn't really be used externally - the `editorAPI` should be accessed via `usePreset`.
|
|
665
|
+
*/
|
|
666
|
+
var APIDispatcher = /*#__PURE__*/function () {
|
|
667
|
+
function APIDispatcher(emitter) {
|
|
668
|
+
var _this3 = this;
|
|
669
|
+
(0, _classCallCheck2.default)(this, APIDispatcher);
|
|
670
|
+
(0, _defineProperty2.default)(this, "eventDispatcher", new _eventDispatcher.EventDispatcher());
|
|
671
|
+
(0, _defineProperty2.default)(this, "key", 'api-resolved-event');
|
|
672
|
+
// Need to store the last event created in case we subscribe after the fact
|
|
673
|
+
(0, _defineProperty2.default)(this, "initialEvent", undefined);
|
|
674
|
+
this.emitter = emitter;
|
|
675
|
+
this.emitter(function (v) {
|
|
676
|
+
_this3.initialEvent = v;
|
|
677
|
+
_this3.eventDispatcher.emit(_this3.key, v);
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Used to observe Editor API events
|
|
683
|
+
*
|
|
684
|
+
* @param cb Callback to listen to the editor API.
|
|
685
|
+
* This will also emit the last event if the stream has already started.
|
|
686
|
+
* @returns Cleanup function to cleanup the listener
|
|
687
|
+
*/
|
|
688
|
+
(0, _createClass2.default)(APIDispatcher, [{
|
|
689
|
+
key: "on",
|
|
690
|
+
value: function on(cb) {
|
|
691
|
+
var _this4 = this;
|
|
692
|
+
if (this.initialEvent !== undefined) {
|
|
693
|
+
// Keeps timing consistent with old approach - certain products
|
|
694
|
+
// ie. ai-mate relied on this.
|
|
695
|
+
Promise.resolve().then(function () {
|
|
696
|
+
return cb(_this4.initialEvent);
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
this.eventDispatcher.on(this.key, cb);
|
|
700
|
+
return function () {
|
|
701
|
+
_this4.eventDispatcher.off(_this4.key, cb);
|
|
702
|
+
};
|
|
703
|
+
}
|
|
704
|
+
}, {
|
|
705
|
+
key: "destroy",
|
|
706
|
+
value: function destroy() {
|
|
707
|
+
this.eventDispatcher.destroy();
|
|
708
|
+
}
|
|
709
|
+
}]);
|
|
710
|
+
return APIDispatcher;
|
|
648
711
|
}();
|
|
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
24
24
|
* @jsx jsx
|
|
25
25
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
26
26
|
var packageName = "@atlaskit/editor-common";
|
|
27
|
-
var packageVersion = "94.
|
|
27
|
+
var packageVersion = "94.22.0";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.processRawFragmentValue = processRawFragmentValue;
|
|
6
7
|
exports.processRawValue = processRawValue;
|
|
7
8
|
exports.processRawValueWithoutValidation = processRawValueWithoutValidation;
|
|
8
9
|
var _transforms = require("@atlaskit/adf-utils/transforms");
|
|
@@ -241,6 +242,20 @@ function processRawValue(schema, value, providerFactory, sanitizePrivateContent,
|
|
|
241
242
|
return;
|
|
242
243
|
}
|
|
243
244
|
}
|
|
245
|
+
function processRawFragmentValue(schema, value, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent) {
|
|
246
|
+
if (!value) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
var adfEntities = value.map(function (item) {
|
|
250
|
+
return processRawValue(schema, item, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent);
|
|
251
|
+
}).filter(function (item) {
|
|
252
|
+
return Boolean(item);
|
|
253
|
+
});
|
|
254
|
+
if (adfEntities.length === 0) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
return _model.Fragment.from(adfEntities);
|
|
258
|
+
}
|
|
244
259
|
function isProseMirrorSchemaCheckError(error) {
|
|
245
260
|
return error instanceof RangeError && (!!error.message.match(/^Invalid collection of marks for node/) || !!error.message.match(/^Invalid content for node/));
|
|
246
261
|
}
|
|
@@ -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 = "94.
|
|
4
|
+
const packageVersion = "94.22.0";
|
|
5
5
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
6
6
|
// Remove URL as it has UGC
|
|
7
7
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { EventDispatcher } from '../event-dispatcher';
|
|
3
|
+
|
|
2
4
|
/*********************
|
|
3
5
|
* *
|
|
4
6
|
* BASE TYPES *
|
|
@@ -525,15 +527,19 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
525
527
|
* If your code is inside an EditorPlugin you should be using the @see ExtractInjectionAPI.
|
|
526
528
|
*/
|
|
527
529
|
export class EditorPresetBuilder {
|
|
528
|
-
/**
|
|
529
|
-
* Returns the editor API when resolved.
|
|
530
|
-
* This occurs when the preset is initially built.
|
|
531
|
-
*/
|
|
532
|
-
|
|
533
530
|
constructor(...more) {
|
|
531
|
+
/**
|
|
532
|
+
* @deprecated Use `apiResolver` instead
|
|
533
|
+
*/
|
|
534
|
+
/**
|
|
535
|
+
* Returns the editor API when resolved.
|
|
536
|
+
* This occurs when the preset is initially built.
|
|
537
|
+
*/
|
|
538
|
+
_defineProperty(this, "apiEmitter", () => {});
|
|
534
539
|
_defineProperty(this, "safeEntry", plugin => Array.isArray(plugin) ? plugin : [plugin, undefined]);
|
|
535
540
|
this.data = [...more] || [];
|
|
536
541
|
this.apiPromise = new Promise(r => this.resolver = r);
|
|
542
|
+
this.apiResolver = new APIDispatcher(emitter => this.apiEmitter = emitter);
|
|
537
543
|
}
|
|
538
544
|
add(nextOrTuple) {
|
|
539
545
|
return new EditorPresetBuilder(
|
|
@@ -583,6 +589,8 @@ export class EditorPresetBuilder {
|
|
|
583
589
|
// The pluginInjectionAPI API doesn't have information enough to build a proper type for the API.
|
|
584
590
|
// It is returning a generic type but on top of the Proxy system
|
|
585
591
|
// So, we can safely recast it here
|
|
592
|
+
this.apiEmitter(pluginInjectionAPI.api());
|
|
593
|
+
// Deprecated approach
|
|
586
594
|
(_this$resolver = this.resolver) === null || _this$resolver === void 0 ? void 0 : _this$resolver.call(this, pluginInjectionAPI.api());
|
|
587
595
|
}
|
|
588
596
|
return this.removeExcludedPlugins(editorPlugins, excludePlugins);
|
|
@@ -637,4 +645,47 @@ export class EditorPresetBuilder {
|
|
|
637
645
|
}
|
|
638
646
|
return plugins;
|
|
639
647
|
}
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* WARNING: Internal object
|
|
651
|
+
*
|
|
652
|
+
* Dedicated wrapper around EventDispatcher for public API around the editor API.
|
|
653
|
+
* This only has the public method `on` which is used to listen to updates to the editor API.
|
|
654
|
+
*
|
|
655
|
+
* This shouldn't really be used externally - the `editorAPI` should be accessed via `usePreset`.
|
|
656
|
+
*/
|
|
657
|
+
class APIDispatcher {
|
|
658
|
+
constructor(emitter) {
|
|
659
|
+
_defineProperty(this, "eventDispatcher", new EventDispatcher());
|
|
660
|
+
_defineProperty(this, "key", 'api-resolved-event');
|
|
661
|
+
// Need to store the last event created in case we subscribe after the fact
|
|
662
|
+
_defineProperty(this, "initialEvent", undefined);
|
|
663
|
+
this.emitter = emitter;
|
|
664
|
+
this.emitter(v => {
|
|
665
|
+
this.initialEvent = v;
|
|
666
|
+
this.eventDispatcher.emit(this.key, v);
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Used to observe Editor API events
|
|
672
|
+
*
|
|
673
|
+
* @param cb Callback to listen to the editor API.
|
|
674
|
+
* This will also emit the last event if the stream has already started.
|
|
675
|
+
* @returns Cleanup function to cleanup the listener
|
|
676
|
+
*/
|
|
677
|
+
on(cb) {
|
|
678
|
+
if (this.initialEvent !== undefined) {
|
|
679
|
+
// Keeps timing consistent with old approach - certain products
|
|
680
|
+
// ie. ai-mate relied on this.
|
|
681
|
+
Promise.resolve().then(() => cb(this.initialEvent));
|
|
682
|
+
}
|
|
683
|
+
this.eventDispatcher.on(this.key, cb);
|
|
684
|
+
return () => {
|
|
685
|
+
this.eventDispatcher.off(this.key, cb);
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
destroy() {
|
|
689
|
+
this.eventDispatcher.destroy();
|
|
690
|
+
}
|
|
640
691
|
}
|
|
@@ -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 = "94.
|
|
16
|
+
const packageVersion = "94.22.0";
|
|
17
17
|
const halfFocusRing = 1;
|
|
18
18
|
const dropOffset = '0, 8';
|
|
19
19
|
class DropList extends Component {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { transformDedupeMarks, transformIndentationMarks, transformInvalidMediaContent, transformMediaLinkMarks, transformNestedTablesIncomingDocument, transformNodesMissingContent, transformTextLinkCodeMarks } from '@atlaskit/adf-utils/transforms';
|
|
2
|
-
import { Node } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { Fragment, Node } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics';
|
|
5
5
|
import { sanitizeNodeForPrivacy } from './filter/privacy-filter';
|
|
@@ -241,6 +241,16 @@ export function processRawValue(schema, value, providerFactory, sanitizePrivateC
|
|
|
241
241
|
return;
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
+
export function processRawFragmentValue(schema, value, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent) {
|
|
245
|
+
if (!value) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
const adfEntities = value.map(item => processRawValue(schema, item, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent)).filter(item => Boolean(item));
|
|
249
|
+
if (adfEntities.length === 0) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
return Fragment.from(adfEntities);
|
|
253
|
+
}
|
|
244
254
|
function isProseMirrorSchemaCheckError(error) {
|
|
245
255
|
return error instanceof RangeError && (!!error.message.match(/^Invalid collection of marks for node/) || !!error.message.match(/^Invalid content for node/));
|
|
246
256
|
}
|
|
@@ -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 = "94.
|
|
10
|
+
var packageVersion = "94.22.0";
|
|
11
11
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
12
12
|
// Remove URL as it has UGC
|
|
13
13
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -4,6 +4,8 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
4
4
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
5
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
6
6
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
|
+
import { EventDispatcher } from '../event-dispatcher';
|
|
8
|
+
|
|
7
9
|
/*********************
|
|
8
10
|
* *
|
|
9
11
|
* BASE TYPES *
|
|
@@ -530,14 +532,17 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
530
532
|
* If your code is inside an EditorPlugin you should be using the @see ExtractInjectionAPI.
|
|
531
533
|
*/
|
|
532
534
|
export var EditorPresetBuilder = /*#__PURE__*/function () {
|
|
533
|
-
/**
|
|
534
|
-
* Returns the editor API when resolved.
|
|
535
|
-
* This occurs when the preset is initially built.
|
|
536
|
-
*/
|
|
537
|
-
|
|
538
535
|
function EditorPresetBuilder() {
|
|
539
536
|
var _this = this;
|
|
540
537
|
_classCallCheck(this, EditorPresetBuilder);
|
|
538
|
+
/**
|
|
539
|
+
* @deprecated Use `apiResolver` instead
|
|
540
|
+
*/
|
|
541
|
+
/**
|
|
542
|
+
* Returns the editor API when resolved.
|
|
543
|
+
* This occurs when the preset is initially built.
|
|
544
|
+
*/
|
|
545
|
+
_defineProperty(this, "apiEmitter", function () {});
|
|
541
546
|
_defineProperty(this, "safeEntry", function (plugin) {
|
|
542
547
|
return Array.isArray(plugin) ? plugin : [plugin, undefined];
|
|
543
548
|
});
|
|
@@ -548,6 +553,9 @@ export var EditorPresetBuilder = /*#__PURE__*/function () {
|
|
|
548
553
|
this.apiPromise = new Promise(function (r) {
|
|
549
554
|
return _this.resolver = r;
|
|
550
555
|
});
|
|
556
|
+
this.apiResolver = new APIDispatcher(function (emitter) {
|
|
557
|
+
return _this.apiEmitter = emitter;
|
|
558
|
+
});
|
|
551
559
|
}
|
|
552
560
|
_createClass(EditorPresetBuilder, [{
|
|
553
561
|
key: "add",
|
|
@@ -605,6 +613,8 @@ export var EditorPresetBuilder = /*#__PURE__*/function () {
|
|
|
605
613
|
// The pluginInjectionAPI API doesn't have information enough to build a proper type for the API.
|
|
606
614
|
// It is returning a generic type but on top of the Proxy system
|
|
607
615
|
// So, we can safely recast it here
|
|
616
|
+
this.apiEmitter(pluginInjectionAPI.api());
|
|
617
|
+
// Deprecated approach
|
|
608
618
|
(_this$resolver = this.resolver) === null || _this$resolver === void 0 || _this$resolver.call(this, pluginInjectionAPI.api());
|
|
609
619
|
}
|
|
610
620
|
return this.removeExcludedPlugins(editorPlugins, excludePlugins);
|
|
@@ -675,4 +685,58 @@ export var EditorPresetBuilder = /*#__PURE__*/function () {
|
|
|
675
685
|
}
|
|
676
686
|
}]);
|
|
677
687
|
return EditorPresetBuilder;
|
|
688
|
+
}();
|
|
689
|
+
/**
|
|
690
|
+
* WARNING: Internal object
|
|
691
|
+
*
|
|
692
|
+
* Dedicated wrapper around EventDispatcher for public API around the editor API.
|
|
693
|
+
* This only has the public method `on` which is used to listen to updates to the editor API.
|
|
694
|
+
*
|
|
695
|
+
* This shouldn't really be used externally - the `editorAPI` should be accessed via `usePreset`.
|
|
696
|
+
*/
|
|
697
|
+
var APIDispatcher = /*#__PURE__*/function () {
|
|
698
|
+
function APIDispatcher(emitter) {
|
|
699
|
+
var _this3 = this;
|
|
700
|
+
_classCallCheck(this, APIDispatcher);
|
|
701
|
+
_defineProperty(this, "eventDispatcher", new EventDispatcher());
|
|
702
|
+
_defineProperty(this, "key", 'api-resolved-event');
|
|
703
|
+
// Need to store the last event created in case we subscribe after the fact
|
|
704
|
+
_defineProperty(this, "initialEvent", undefined);
|
|
705
|
+
this.emitter = emitter;
|
|
706
|
+
this.emitter(function (v) {
|
|
707
|
+
_this3.initialEvent = v;
|
|
708
|
+
_this3.eventDispatcher.emit(_this3.key, v);
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* Used to observe Editor API events
|
|
714
|
+
*
|
|
715
|
+
* @param cb Callback to listen to the editor API.
|
|
716
|
+
* This will also emit the last event if the stream has already started.
|
|
717
|
+
* @returns Cleanup function to cleanup the listener
|
|
718
|
+
*/
|
|
719
|
+
_createClass(APIDispatcher, [{
|
|
720
|
+
key: "on",
|
|
721
|
+
value: function on(cb) {
|
|
722
|
+
var _this4 = this;
|
|
723
|
+
if (this.initialEvent !== undefined) {
|
|
724
|
+
// Keeps timing consistent with old approach - certain products
|
|
725
|
+
// ie. ai-mate relied on this.
|
|
726
|
+
Promise.resolve().then(function () {
|
|
727
|
+
return cb(_this4.initialEvent);
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
this.eventDispatcher.on(this.key, cb);
|
|
731
|
+
return function () {
|
|
732
|
+
_this4.eventDispatcher.off(_this4.key, cb);
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
}, {
|
|
736
|
+
key: "destroy",
|
|
737
|
+
value: function destroy() {
|
|
738
|
+
this.eventDispatcher.destroy();
|
|
739
|
+
}
|
|
740
|
+
}]);
|
|
741
|
+
return APIDispatcher;
|
|
678
742
|
}();
|
|
@@ -21,7 +21,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
21
21
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
22
22
|
import Layer from '../Layer';
|
|
23
23
|
var packageName = "@atlaskit/editor-common";
|
|
24
|
-
var packageVersion = "94.
|
|
24
|
+
var packageVersion = "94.22.0";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { transformDedupeMarks, transformIndentationMarks, transformInvalidMediaContent, transformMediaLinkMarks, transformNestedTablesIncomingDocument, transformNodesMissingContent, transformTextLinkCodeMarks } from '@atlaskit/adf-utils/transforms';
|
|
2
|
-
import { Node } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { Fragment, Node } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics';
|
|
5
5
|
import { sanitizeNodeForPrivacy } from './filter/privacy-filter';
|
|
@@ -234,6 +234,20 @@ export function processRawValue(schema, value, providerFactory, sanitizePrivateC
|
|
|
234
234
|
return;
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
|
+
export function processRawFragmentValue(schema, value, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent) {
|
|
238
|
+
if (!value) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
var adfEntities = value.map(function (item) {
|
|
242
|
+
return processRawValue(schema, item, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent);
|
|
243
|
+
}).filter(function (item) {
|
|
244
|
+
return Boolean(item);
|
|
245
|
+
});
|
|
246
|
+
if (adfEntities.length === 0) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
return Fragment.from(adfEntities);
|
|
250
|
+
}
|
|
237
251
|
function isProseMirrorSchemaCheckError(error) {
|
|
238
252
|
return error instanceof RangeError && (!!error.message.match(/^Invalid collection of marks for node/) || !!error.message.match(/^Invalid content for node/));
|
|
239
253
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Listener } from '../event-dispatcher';
|
|
1
2
|
import type { CorePlugin, DefaultEditorPlugin, DependencyPlugin, NextEditorPlugin, NextEditorPluginMetadata, OptionalPlugin, PluginDependenciesAPI } from '../types';
|
|
2
3
|
import type { EditorPlugin } from '../types/editor-plugin';
|
|
3
4
|
import type { EditorPluginInjectionAPI } from './plugin-injection-api';
|
|
@@ -553,11 +554,16 @@ type BuildProps = {
|
|
|
553
554
|
export declare class EditorPresetBuilder<PluginNames extends AllPluginNames[] = [], StackPlugins extends AllEditorPresetPluginTypes[] = []> {
|
|
554
555
|
private readonly data;
|
|
555
556
|
/**
|
|
556
|
-
*
|
|
557
|
-
* This occurs when the preset is initially built.
|
|
557
|
+
* @deprecated Use `apiResolver` instead
|
|
558
558
|
*/
|
|
559
559
|
apiPromise: Promise<unknown>;
|
|
560
560
|
private resolver;
|
|
561
|
+
/**
|
|
562
|
+
* Returns the editor API when resolved.
|
|
563
|
+
* This occurs when the preset is initially built.
|
|
564
|
+
*/
|
|
565
|
+
apiResolver: APIDispatcher;
|
|
566
|
+
private apiEmitter;
|
|
561
567
|
constructor(...more: [...StackPlugins]);
|
|
562
568
|
add<NewPlugin extends PresetPlugin>(nextOrTuple: SafePresetCheck<NewPlugin, StackPlugins>): EditorPresetBuilder<[
|
|
563
569
|
ExtractPluginNameFromAllBuilderPlugins<NewPlugin>,
|
|
@@ -580,4 +586,29 @@ export declare class EditorPresetBuilder<PluginNames extends AllPluginNames[] =
|
|
|
580
586
|
private removeExcludedPlugins;
|
|
581
587
|
private safeEntry;
|
|
582
588
|
}
|
|
589
|
+
type Emitter = (value: unknown) => void;
|
|
590
|
+
/**
|
|
591
|
+
* WARNING: Internal object
|
|
592
|
+
*
|
|
593
|
+
* Dedicated wrapper around EventDispatcher for public API around the editor API.
|
|
594
|
+
* This only has the public method `on` which is used to listen to updates to the editor API.
|
|
595
|
+
*
|
|
596
|
+
* This shouldn't really be used externally - the `editorAPI` should be accessed via `usePreset`.
|
|
597
|
+
*/
|
|
598
|
+
declare class APIDispatcher {
|
|
599
|
+
private emitter;
|
|
600
|
+
private eventDispatcher;
|
|
601
|
+
private key;
|
|
602
|
+
private initialEvent;
|
|
603
|
+
constructor(emitter: (emitter: Emitter) => void);
|
|
604
|
+
/**
|
|
605
|
+
* Used to observe Editor API events
|
|
606
|
+
*
|
|
607
|
+
* @param cb Callback to listen to the editor API.
|
|
608
|
+
* This will also emit the last event if the stream has already started.
|
|
609
|
+
* @returns Cleanup function to cleanup the listener
|
|
610
|
+
*/
|
|
611
|
+
on(cb: Listener<unknown>): () => void;
|
|
612
|
+
destroy(): void;
|
|
613
|
+
}
|
|
583
614
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { Node } from '@atlaskit/editor-prosemirror/model';
|
|
1
|
+
import { Fragment, Node, type Schema } from '@atlaskit/editor-prosemirror/model';
|
|
3
2
|
import type { DispatchAnalyticsEvent } from '../analytics';
|
|
4
3
|
import type { ProviderFactory } from '../provider-factory';
|
|
5
4
|
import type { ReplaceRawValue, Transformer } from '../types';
|
|
6
5
|
export declare function processRawValueWithoutValidation(schema: Schema, value?: ReplaceRawValue, dispatchAnalyticsEvent?: DispatchAnalyticsEvent): Node | undefined;
|
|
7
6
|
export declare function processRawValue(schema: Schema, value?: ReplaceRawValue, providerFactory?: ProviderFactory, sanitizePrivateContent?: boolean, contentTransformer?: Transformer<string>, dispatchAnalyticsEvent?: DispatchAnalyticsEvent): Node | undefined;
|
|
7
|
+
export declare function processRawFragmentValue(schema: Schema, value?: ReplaceRawValue[], providerFactory?: ProviderFactory, sanitizePrivateContent?: boolean, contentTransformer?: Transformer<string>, dispatchAnalyticsEvent?: DispatchAnalyticsEvent): Fragment | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Listener } from '../event-dispatcher';
|
|
1
2
|
import type { CorePlugin, DefaultEditorPlugin, DependencyPlugin, NextEditorPlugin, NextEditorPluginMetadata, OptionalPlugin, PluginDependenciesAPI } from '../types';
|
|
2
3
|
import type { EditorPlugin } from '../types/editor-plugin';
|
|
3
4
|
import type { EditorPluginInjectionAPI } from './plugin-injection-api';
|
|
@@ -582,11 +583,16 @@ export declare class EditorPresetBuilder<PluginNames extends AllPluginNames[] =
|
|
|
582
583
|
]> {
|
|
583
584
|
private readonly data;
|
|
584
585
|
/**
|
|
585
|
-
*
|
|
586
|
-
* This occurs when the preset is initially built.
|
|
586
|
+
* @deprecated Use `apiResolver` instead
|
|
587
587
|
*/
|
|
588
588
|
apiPromise: Promise<unknown>;
|
|
589
589
|
private resolver;
|
|
590
|
+
/**
|
|
591
|
+
* Returns the editor API when resolved.
|
|
592
|
+
* This occurs when the preset is initially built.
|
|
593
|
+
*/
|
|
594
|
+
apiResolver: APIDispatcher;
|
|
595
|
+
private apiEmitter;
|
|
590
596
|
constructor(...more: [
|
|
591
597
|
...StackPlugins
|
|
592
598
|
]);
|
|
@@ -611,4 +617,29 @@ export declare class EditorPresetBuilder<PluginNames extends AllPluginNames[] =
|
|
|
611
617
|
private removeExcludedPlugins;
|
|
612
618
|
private safeEntry;
|
|
613
619
|
}
|
|
620
|
+
type Emitter = (value: unknown) => void;
|
|
621
|
+
/**
|
|
622
|
+
* WARNING: Internal object
|
|
623
|
+
*
|
|
624
|
+
* Dedicated wrapper around EventDispatcher for public API around the editor API.
|
|
625
|
+
* This only has the public method `on` which is used to listen to updates to the editor API.
|
|
626
|
+
*
|
|
627
|
+
* This shouldn't really be used externally - the `editorAPI` should be accessed via `usePreset`.
|
|
628
|
+
*/
|
|
629
|
+
declare class APIDispatcher {
|
|
630
|
+
private emitter;
|
|
631
|
+
private eventDispatcher;
|
|
632
|
+
private key;
|
|
633
|
+
private initialEvent;
|
|
634
|
+
constructor(emitter: (emitter: Emitter) => void);
|
|
635
|
+
/**
|
|
636
|
+
* Used to observe Editor API events
|
|
637
|
+
*
|
|
638
|
+
* @param cb Callback to listen to the editor API.
|
|
639
|
+
* This will also emit the last event if the stream has already started.
|
|
640
|
+
* @returns Cleanup function to cleanup the listener
|
|
641
|
+
*/
|
|
642
|
+
on(cb: Listener<unknown>): () => void;
|
|
643
|
+
destroy(): void;
|
|
644
|
+
}
|
|
614
645
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { Node } from '@atlaskit/editor-prosemirror/model';
|
|
1
|
+
import { Fragment, Node, type Schema } from '@atlaskit/editor-prosemirror/model';
|
|
3
2
|
import type { DispatchAnalyticsEvent } from '../analytics';
|
|
4
3
|
import type { ProviderFactory } from '../provider-factory';
|
|
5
4
|
import type { ReplaceRawValue, Transformer } from '../types';
|
|
6
5
|
export declare function processRawValueWithoutValidation(schema: Schema, value?: ReplaceRawValue, dispatchAnalyticsEvent?: DispatchAnalyticsEvent): Node | undefined;
|
|
7
6
|
export declare function processRawValue(schema: Schema, value?: ReplaceRawValue, providerFactory?: ProviderFactory, sanitizePrivateContent?: boolean, contentTransformer?: Transformer<string>, dispatchAnalyticsEvent?: DispatchAnalyticsEvent): Node | undefined;
|
|
7
|
+
export declare function processRawFragmentValue(schema: Schema, value?: ReplaceRawValue[], providerFactory?: ProviderFactory, sanitizePrivateContent?: boolean, contentTransformer?: Transformer<string>, dispatchAnalyticsEvent?: DispatchAnalyticsEvent): Fragment | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "94.
|
|
3
|
+
"version": "94.22.0",
|
|
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/"
|
|
@@ -127,10 +127,10 @@
|
|
|
127
127
|
"@atlaskit/editor-prosemirror": "6.0.0",
|
|
128
128
|
"@atlaskit/editor-shared-styles": "^3.2.0",
|
|
129
129
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
130
|
-
"@atlaskit/emoji": "^67.
|
|
130
|
+
"@atlaskit/emoji": "^67.10.0",
|
|
131
131
|
"@atlaskit/icon": "^22.24.0",
|
|
132
132
|
"@atlaskit/icon-object": "^6.7.0",
|
|
133
|
-
"@atlaskit/link-datasource": "^3.
|
|
133
|
+
"@atlaskit/link-datasource": "^3.10.0",
|
|
134
134
|
"@atlaskit/link-picker": "^1.47.0",
|
|
135
135
|
"@atlaskit/media-card": "^78.14.0",
|
|
136
136
|
"@atlaskit/media-client": "^28.3.0",
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
"@atlaskit/media-picker": "^67.0.0",
|
|
141
141
|
"@atlaskit/media-ui": "^26.2.0",
|
|
142
142
|
"@atlaskit/media-viewer": "49.4.1",
|
|
143
|
-
"@atlaskit/mention": "^23.
|
|
143
|
+
"@atlaskit/mention": "^23.4.0",
|
|
144
144
|
"@atlaskit/menu": "^2.13.0",
|
|
145
145
|
"@atlaskit/onboarding": "^12.1.0",
|
|
146
146
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
"@atlaskit/spinner": "^16.3.0",
|
|
154
154
|
"@atlaskit/task-decision": "^17.11.0",
|
|
155
155
|
"@atlaskit/textfield": "^6.5.0",
|
|
156
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
156
|
+
"@atlaskit/tmp-editor-statsig": "^2.17.0",
|
|
157
157
|
"@atlaskit/tokens": "^2.2.0",
|
|
158
158
|
"@atlaskit/tooltip": "^18.9.0",
|
|
159
159
|
"@atlaskit/width-detector": "^4.3.0",
|