UNPKG

@atlaskit/editor-plugin-show-diff

Version:

ShowDiff plugin for @atlaskit/editor-core

33 lines (32 loc) 1.55 kB
// It is important to get all steps in that package // Ignored via go/ees005 // eslint-disable-next-line import/no-namespace import * as adfCustomSteps from '@atlaskit/adf-schema/steps'; // It is important to get all steps in that package // Ignored via go/ees005 // eslint-disable-next-line import/no-namespace import * as atlaskKitCustomSteps from '@atlaskit/custom-steps'; import { Step } from '@atlaskit/editor-prosemirror/transform'; export var enforceCustomStepRegisters = function enforceCustomStepRegisters() { var tryToRegisterStep = function tryToRegisterStep(obj) { for (var _i = 0, _Object$values = Object.values(obj); _i < _Object$values.length; _i++) { var _customStep$prototype; var customStep = _Object$values[_i]; // @ts-expect-error ProseMirror step classes expose jsonID on prototype. var id = customStep === null || customStep === void 0 || (_customStep$prototype = customStep.prototype) === null || _customStep$prototype === void 0 ? void 0 : _customStep$prototype.jsonID; if (typeof id === 'string') { try { // Re-register if needed; ignore if already registered. // @ts-expect-error Step.jsonID expects a step constructor. Step.jsonID(id, customStep); } catch (_unused) { // Step already registered. } } } }; // @ts-expect-error Step modules export non-step symbols too. tryToRegisterStep(atlaskKitCustomSteps); // @ts-expect-error Step modules export non-step symbols too. tryToRegisterStep(adfCustomSteps); };