Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@atlaskit/editor-prosemirror

Package Overview
Dependencies
Maintainers
0
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atlaskit/editor-prosemirror - npm Package Compare versions

Comparing version 6.1.2 to 6.2.0

src/__tests__/transform-override-off.ts

6

CHANGELOG.md
# @atlaskit/editor-prosemirror
## 6.2.0
### Minor Changes
- 5b63e77: Add platform feature flag override for step type to metadata step type
## 6.1.2

@@ -4,0 +10,0 @@

@@ -14,2 +14,3 @@ "use strict";

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
var _prosemirrorTransform = require("prosemirror-transform");

@@ -23,2 +24,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }

var stepImplementation = originalFromJSON(schema, jsonStep);
// See https://switcheroo.atlassian.com/ui/gates/4e7e1e8c-9126-4dba-a2a3-1c2b86f81c36/key/platform_editor_metadata_steps
if (!(0, _platformFeatureFlags.fg)('platform_editor_metadata_steps')) {
return stepImplementation;
}
return new Proxy(stepImplementation, {

@@ -25,0 +31,0 @@ get: function get(target, prop, receiver) {

3

dist/cjs/transform.js

@@ -69,3 +69,3 @@ "use strict";

get: function get() {
return _prosemirrorTransform.Step;
return _transformOverride.Step;
}

@@ -139,2 +139,3 @@ });

});
var _transformOverride = require("./transform-override");
var _prosemirrorTransform = require("prosemirror-transform");

@@ -0,1 +1,2 @@

import { fg } from '@atlaskit/platform-feature-flags';
import { Step } from 'prosemirror-transform';

@@ -7,2 +8,7 @@ // Using this avoids infinite recursion, as referencing Step.fromJSON inside Step.fromJSON

const stepImplementation = originalFromJSON(schema, jsonStep);
// See https://switcheroo.atlassian.com/ui/gates/4e7e1e8c-9126-4dba-a2a3-1c2b86f81c36/key/platform_editor_metadata_steps
if (!fg('platform_editor_metadata_steps')) {
return stepImplementation;
}
return new Proxy(stepImplementation, {

@@ -9,0 +15,0 @@ get(target, prop, receiver) {

@@ -1,4 +0,2 @@

// TODO: Insert MetadataStep override here.
// See https://bitbucket.org/atlassian/adf-schema/pull-requests/421/diff#comment-564387809
export { AddMarkStep, AddNodeMarkStep, AttrStep, DocAttrStep, MapResult, Mapping, RemoveMarkStep, RemoveNodeMarkStep, ReplaceAroundStep, ReplaceStep, Step, StepMap, StepResult, Transform, canJoin, canSplit, dropPoint, findWrapping, insertPoint, joinPoint, liftTarget, replaceStep } from 'prosemirror-transform';
export { Step } from './transform-override';
export { AddMarkStep, AddNodeMarkStep, AttrStep, DocAttrStep, MapResult, Mapping, RemoveMarkStep, RemoveNodeMarkStep, ReplaceAroundStep, ReplaceStep, StepMap, StepResult, Transform, canJoin, canSplit, dropPoint, findWrapping, insertPoint, joinPoint, liftTarget, replaceStep } from 'prosemirror-transform';
import _defineProperty from "@babel/runtime/helpers/defineProperty";
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
import { fg } from '@atlaskit/platform-feature-flags';
import { Step } from 'prosemirror-transform';

@@ -10,2 +11,7 @@ // Using this avoids infinite recursion, as referencing Step.fromJSON inside Step.fromJSON

var stepImplementation = originalFromJSON(schema, jsonStep);
// See https://switcheroo.atlassian.com/ui/gates/4e7e1e8c-9126-4dba-a2a3-1c2b86f81c36/key/platform_editor_metadata_steps
if (!fg('platform_editor_metadata_steps')) {
return stepImplementation;
}
return new Proxy(stepImplementation, {

@@ -12,0 +18,0 @@ get: function get(target, prop, receiver) {

@@ -1,4 +0,2 @@

// TODO: Insert MetadataStep override here.
// See https://bitbucket.org/atlassian/adf-schema/pull-requests/421/diff#comment-564387809
export { AddMarkStep, AddNodeMarkStep, AttrStep, DocAttrStep, MapResult, Mapping, RemoveMarkStep, RemoveNodeMarkStep, ReplaceAroundStep, ReplaceStep, Step, StepMap, StepResult, Transform, canJoin, canSplit, dropPoint, findWrapping, insertPoint, joinPoint, liftTarget, replaceStep } from 'prosemirror-transform';
export { Step } from './transform-override';
export { AddMarkStep, AddNodeMarkStep, AttrStep, DocAttrStep, MapResult, Mapping, RemoveMarkStep, RemoveNodeMarkStep, ReplaceAroundStep, ReplaceStep, StepMap, StepResult, Transform, canJoin, canSplit, dropPoint, findWrapping, insertPoint, joinPoint, liftTarget, replaceStep } from 'prosemirror-transform';
export type { Mappable } from 'prosemirror-transform';
export { AddMarkStep, AddNodeMarkStep, AttrStep, DocAttrStep, MapResult, Mapping, RemoveMarkStep, RemoveNodeMarkStep, ReplaceAroundStep, ReplaceStep, Step, StepMap, StepResult, Transform, canJoin, canSplit, dropPoint, findWrapping, insertPoint, joinPoint, liftTarget, replaceStep, } from 'prosemirror-transform';
export { Step } from './transform-override';
export { AddMarkStep, AddNodeMarkStep, AttrStep, DocAttrStep, MapResult, Mapping, RemoveMarkStep, RemoveNodeMarkStep, ReplaceAroundStep, ReplaceStep, StepMap, StepResult, Transform, canJoin, canSplit, dropPoint, findWrapping, insertPoint, joinPoint, liftTarget, replaceStep, } from 'prosemirror-transform';
{
"name": "@atlaskit/editor-prosemirror",
"version": "6.1.2",
"version": "6.2.0",
"description": "Package to group all prosemirror libraries in a single place ",

@@ -35,2 +35,3 @@ "author": "Atlassian Pty Ltd",

"dependencies": {
"@atlaskit/platform-feature-flags": "^0.3.0",
"@babel/runtime": "^7.0.0",

@@ -37,0 +38,0 @@ "prosemirror-commands": "1.6.0",

@@ -1,5 +0,10 @@

import { MetadataStep, Step } from '../transform-override';
import { MetadataStep } from '../transform-override';
import { Step } from '../transform';
import { defaultSchema } from '@atlaskit/adf-schema/schema-default';
describe('prosemirror-transform-override', () => {
jest.mock('@atlaskit/platform-feature-flags', () => ({
fg: (flagName: string) => flagName === 'platform_editor_metadata_steps',
}));
describe('prosemirror-transform-override when on', () => {
it('should still transform steps without Metadata as expected', () => {

@@ -57,3 +62,3 @@ const json = { stepType: 'replace', to: 15, from: 10 };

};
const parsedStep = Step.fromJSON(defaultSchema, json, true) as MetadataStep;
const parsedStep = Step.fromJSON(defaultSchema, json) as MetadataStep;
parsedStep.metadata = { testField: 'Im a test' };

@@ -60,0 +65,0 @@ const unparsedStep = parsedStep.toJSON();

@@ -0,1 +1,2 @@

import { fg } from '@atlaskit/platform-feature-flags';
import { Step } from 'prosemirror-transform';

@@ -14,2 +15,7 @@

// See https://switcheroo.atlassian.com/ui/gates/4e7e1e8c-9126-4dba-a2a3-1c2b86f81c36/key/platform_editor_metadata_steps
if (!fg('platform_editor_metadata_steps')) {
return stepImplementation;
}
return new Proxy(stepImplementation, {

@@ -16,0 +22,0 @@ get(target, prop, receiver) {

export type { Mappable } from 'prosemirror-transform';
// TODO: Insert MetadataStep override here.
// See https://bitbucket.org/atlassian/adf-schema/pull-requests/421/diff#comment-564387809
export { Step } from './transform-override';

@@ -17,3 +16,2 @@ export {

ReplaceStep,
Step,
StepMap,

@@ -20,0 +18,0 @@ StepResult,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc