@atlaskit/editor-plugin-synced-block 8.4.3 → 8.4.5

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-synced-block
2
2
 
3
+ ## 8.4.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 8.4.4
10
+
11
+ ### Patch Changes
12
+
13
+ - [`0805dc02ccee3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0805dc02ccee3) -
14
+ Fix partial cut handling for source synced blocks behind platform_synced_block_patch_13.
15
+ - Updated dependencies
16
+
3
17
  ## 8.4.3
4
18
 
5
19
  ### Patch Changes
@@ -290,6 +290,7 @@ var SyncedBlockPluginContext = /*#__PURE__*/function () {
290
290
  current: undefined
291
291
  });
292
292
  (0, _defineProperty2.default)(this, "_isCopyEvent", false);
293
+ (0, _defineProperty2.default)(this, "_isCutEvent", false);
293
294
  (0, _defineProperty2.default)(this, "unpublishedFlagShown", new Set());
294
295
  (0, _defineProperty2.default)(this, "extensionFlagShown", new Set());
295
296
  }
@@ -303,6 +304,11 @@ var SyncedBlockPluginContext = /*#__PURE__*/function () {
303
304
  value: function markCopyEvent() {
304
305
  this._isCopyEvent = true;
305
306
  }
307
+ }, {
308
+ key: "markCutEvent",
309
+ value: function markCutEvent() {
310
+ this._isCutEvent = true;
311
+ }
306
312
  }, {
307
313
  key: "consumeCopyEvent",
308
314
  value: function consumeCopyEvent() {
@@ -310,6 +316,13 @@ var SyncedBlockPluginContext = /*#__PURE__*/function () {
310
316
  this._isCopyEvent = false;
311
317
  return was;
312
318
  }
319
+ }, {
320
+ key: "consumeCutEvent",
321
+ value: function consumeCutEvent() {
322
+ var was = this._isCutEvent;
323
+ this._isCutEvent = false;
324
+ return was;
325
+ }
313
326
  }]);
314
327
  }();
315
328
  var createPlugin = exports.createPlugin = function createPlugin(options, pmPluginFactoryParams, syncBlockStore, api) {
@@ -672,6 +685,13 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
672
685
  copy: function copy() {
673
686
  ctx.markCopyEvent();
674
687
  return false;
688
+ },
689
+ cut: function cut() {
690
+ if ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_13')) {
691
+ ctx.consumeCutEvent();
692
+ ctx.markCutEvent();
693
+ }
694
+ return false;
675
695
  }
676
696
  },
677
697
  transformPasted: function transformPasted(slice, _view) {
@@ -704,11 +724,16 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
704
724
  var syncBlockStore = pluginState === null || pluginState === void 0 ? void 0 : pluginState.syncBlockStore;
705
725
  var schema = state.schema;
706
726
  var isCopy = ctx.consumeCopyEvent();
707
- if (!syncBlockStore || !isCopy) {
727
+ var isSyncedBlockPatch13Enabled = (0, _platformFeatureFlags.fg)('platform_synced_block_patch_13');
728
+ var isCut = isSyncedBlockPatch13Enabled && ctx.consumeCutEvent();
729
+ if (!syncBlockStore || !isCopy && !isCut) {
708
730
  return slice;
709
731
  }
710
732
  return (0, _utils.mapSlice)(slice, function (node) {
711
733
  if (syncBlockStore.referenceManager.isReferenceBlock(node)) {
734
+ if (isCut) {
735
+ return node;
736
+ }
712
737
  showCopiedFlag(api);
713
738
  return node;
714
739
  }
@@ -718,6 +743,9 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
718
743
  if (!(0, _utils3.sliceFullyContainsNode)(slice, node)) {
719
744
  return node.content;
720
745
  }
746
+ if (isSyncedBlockPatch13Enabled && isCut) {
747
+ return node;
748
+ }
721
749
  showCopiedFlag(api);
722
750
  var newResourceId = syncBlockStore.referenceManager.generateResourceIdForReference(node.attrs.resourceId);
723
751
  // Convert bodiedSyncBlock to syncBlock
@@ -266,6 +266,7 @@ class SyncedBlockPluginContext {
266
266
  current: undefined
267
267
  });
268
268
  _defineProperty(this, "_isCopyEvent", false);
269
+ _defineProperty(this, "_isCutEvent", false);
269
270
  _defineProperty(this, "unpublishedFlagShown", new Set());
270
271
  _defineProperty(this, "extensionFlagShown", new Set());
271
272
  }
@@ -275,11 +276,19 @@ class SyncedBlockPluginContext {
275
276
  markCopyEvent() {
276
277
  this._isCopyEvent = true;
277
278
  }
279
+ markCutEvent() {
280
+ this._isCutEvent = true;
281
+ }
278
282
  consumeCopyEvent() {
279
283
  const was = this._isCopyEvent;
280
284
  this._isCopyEvent = false;
281
285
  return was;
282
286
  }
287
+ consumeCutEvent() {
288
+ const was = this._isCutEvent;
289
+ this._isCutEvent = false;
290
+ return was;
291
+ }
283
292
  }
284
293
  export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api) => {
285
294
  const {
@@ -640,6 +649,13 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
640
649
  copy: () => {
641
650
  ctx.markCopyEvent();
642
651
  return false;
652
+ },
653
+ cut: () => {
654
+ if (fg('platform_synced_block_patch_13')) {
655
+ ctx.consumeCutEvent();
656
+ ctx.markCutEvent();
657
+ }
658
+ return false;
643
659
  }
644
660
  },
645
661
  transformPasted: (slice, _view) => {
@@ -675,11 +691,16 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
675
691
  schema
676
692
  } = state;
677
693
  const isCopy = ctx.consumeCopyEvent();
678
- if (!syncBlockStore || !isCopy) {
694
+ const isSyncedBlockPatch13Enabled = fg('platform_synced_block_patch_13');
695
+ const isCut = isSyncedBlockPatch13Enabled && ctx.consumeCutEvent();
696
+ if (!syncBlockStore || !isCopy && !isCut) {
679
697
  return slice;
680
698
  }
681
699
  return mapSlice(slice, node => {
682
700
  if (syncBlockStore.referenceManager.isReferenceBlock(node)) {
701
+ if (isCut) {
702
+ return node;
703
+ }
683
704
  showCopiedFlag(api);
684
705
  return node;
685
706
  }
@@ -689,6 +710,9 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
689
710
  if (!sliceFullyContainsNode(slice, node)) {
690
711
  return node.content;
691
712
  }
713
+ if (isSyncedBlockPatch13Enabled && isCut) {
714
+ return node;
715
+ }
692
716
  showCopiedFlag(api);
693
717
  const newResourceId = syncBlockStore.referenceManager.generateResourceIdForReference(node.attrs.resourceId);
694
718
  // Convert bodiedSyncBlock to syncBlock
@@ -283,6 +283,7 @@ var SyncedBlockPluginContext = /*#__PURE__*/function () {
283
283
  current: undefined
284
284
  });
285
285
  _defineProperty(this, "_isCopyEvent", false);
286
+ _defineProperty(this, "_isCutEvent", false);
286
287
  _defineProperty(this, "unpublishedFlagShown", new Set());
287
288
  _defineProperty(this, "extensionFlagShown", new Set());
288
289
  }
@@ -296,6 +297,11 @@ var SyncedBlockPluginContext = /*#__PURE__*/function () {
296
297
  value: function markCopyEvent() {
297
298
  this._isCopyEvent = true;
298
299
  }
300
+ }, {
301
+ key: "markCutEvent",
302
+ value: function markCutEvent() {
303
+ this._isCutEvent = true;
304
+ }
299
305
  }, {
300
306
  key: "consumeCopyEvent",
301
307
  value: function consumeCopyEvent() {
@@ -303,6 +309,13 @@ var SyncedBlockPluginContext = /*#__PURE__*/function () {
303
309
  this._isCopyEvent = false;
304
310
  return was;
305
311
  }
312
+ }, {
313
+ key: "consumeCutEvent",
314
+ value: function consumeCutEvent() {
315
+ var was = this._isCutEvent;
316
+ this._isCutEvent = false;
317
+ return was;
318
+ }
306
319
  }]);
307
320
  }();
308
321
  export var createPlugin = function createPlugin(options, pmPluginFactoryParams, syncBlockStore, api) {
@@ -665,6 +678,13 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
665
678
  copy: function copy() {
666
679
  ctx.markCopyEvent();
667
680
  return false;
681
+ },
682
+ cut: function cut() {
683
+ if (fg('platform_synced_block_patch_13')) {
684
+ ctx.consumeCutEvent();
685
+ ctx.markCutEvent();
686
+ }
687
+ return false;
668
688
  }
669
689
  },
670
690
  transformPasted: function transformPasted(slice, _view) {
@@ -697,11 +717,16 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
697
717
  var syncBlockStore = pluginState === null || pluginState === void 0 ? void 0 : pluginState.syncBlockStore;
698
718
  var schema = state.schema;
699
719
  var isCopy = ctx.consumeCopyEvent();
700
- if (!syncBlockStore || !isCopy) {
720
+ var isSyncedBlockPatch13Enabled = fg('platform_synced_block_patch_13');
721
+ var isCut = isSyncedBlockPatch13Enabled && ctx.consumeCutEvent();
722
+ if (!syncBlockStore || !isCopy && !isCut) {
701
723
  return slice;
702
724
  }
703
725
  return mapSlice(slice, function (node) {
704
726
  if (syncBlockStore.referenceManager.isReferenceBlock(node)) {
727
+ if (isCut) {
728
+ return node;
729
+ }
705
730
  showCopiedFlag(api);
706
731
  return node;
707
732
  }
@@ -711,6 +736,9 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
711
736
  if (!sliceFullyContainsNode(slice, node)) {
712
737
  return node.content;
713
738
  }
739
+ if (isSyncedBlockPatch13Enabled && isCut) {
740
+ return node;
741
+ }
714
742
  showCopiedFlag(api);
715
743
  var newResourceId = syncBlockStore.referenceManager.generateResourceIdForReference(node.attrs.resourceId);
716
744
  // Convert bodiedSyncBlock to syncBlock
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-synced-block",
3
- "version": "8.4.3",
3
+ "version": "8.4.5",
4
4
  "description": "SyncedBlock plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "@atlaskit/adf-schema": "^52.14.0",
32
32
  "@atlaskit/button": "23.11.8",
33
- "@atlaskit/dropdown-menu": "16.9.5",
33
+ "@atlaskit/dropdown-menu": "16.9.6",
34
34
  "@atlaskit/editor-json-transformer": "^8.32.0",
35
35
  "@atlaskit/editor-plugin-analytics": "^10.1.0",
36
36
  "@atlaskit/editor-plugin-block-menu": "^9.2.0",
@@ -64,7 +64,7 @@
64
64
  "date-fns": "^2.17.0"
65
65
  },
66
66
  "peerDependencies": {
67
- "@atlaskit/editor-common": "^114.46.0",
67
+ "@atlaskit/editor-common": "^114.47.0",
68
68
  "react": "^18.2.0",
69
69
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
70
70
  },