@atlaskit/editor-plugin-synced-block 10.8.5 → 11.0.1

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.
Files changed (29) hide show
  1. package/AGENTS.md +3 -3
  2. package/CHANGELOG.md +19 -0
  3. package/dist/cjs/nodeviews/bodiedSyncedBlock.js +25 -193
  4. package/dist/cjs/nodeviews/syncedBlock.js +4 -25
  5. package/dist/cjs/pm-plugins/main.js +64 -130
  6. package/dist/cjs/pm-plugins/menu-and-toolbar-experiences.js +2 -7
  7. package/dist/cjs/pm-plugins/utils/has-synced-blocks.js +2 -2
  8. package/dist/cjs/syncedBlockPlugin.js +3 -12
  9. package/dist/es2019/nodeviews/bodiedSyncedBlock.js +9 -150
  10. package/dist/es2019/nodeviews/syncedBlock.js +3 -17
  11. package/dist/es2019/pm-plugins/main.js +65 -133
  12. package/dist/es2019/pm-plugins/menu-and-toolbar-experiences.js +2 -7
  13. package/dist/es2019/pm-plugins/utils/has-synced-blocks.js +2 -2
  14. package/dist/es2019/syncedBlockPlugin.js +3 -12
  15. package/dist/esm/nodeviews/bodiedSyncedBlock.js +24 -192
  16. package/dist/esm/nodeviews/syncedBlock.js +4 -25
  17. package/dist/esm/pm-plugins/main.js +65 -131
  18. package/dist/esm/pm-plugins/menu-and-toolbar-experiences.js +2 -7
  19. package/dist/esm/pm-plugins/utils/has-synced-blocks.js +2 -2
  20. package/dist/esm/syncedBlockPlugin.js +3 -12
  21. package/dist/types/nodeviews/bodiedSyncedBlock.d.ts +1 -13
  22. package/dist/types/pm-plugins/main.d.ts +6 -10
  23. package/dist/types/pm-plugins/utils/has-synced-blocks.d.ts +2 -2
  24. package/dist/types/types/index.d.ts +1 -2
  25. package/package.json +15 -15
  26. package/dist/cjs/ui/BodiedSyncBlockWrapper.js +0 -25
  27. package/dist/es2019/ui/BodiedSyncBlockWrapper.js +0 -19
  28. package/dist/esm/ui/BodiedSyncBlockWrapper.js +0 -18
  29. package/dist/types/ui/BodiedSyncBlockWrapper.d.ts +0 -9
@@ -23,9 +23,7 @@ var _view2 = require("@atlaskit/editor-prosemirror/view");
23
23
  var _editorSyncedBlockProvider = require("@atlaskit/editor-synced-block-provider");
24
24
  var _utils2 = require("@atlaskit/editor-synced-block-provider/utils");
25
25
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
26
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
27
26
  var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
28
- var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
29
27
  var _bodiedSyncedBlock = require("../nodeviews/bodiedSyncedBlock");
30
28
  var _syncedBlock = require("../nodeviews/syncedBlock");
31
29
  var _types = require("../types");
@@ -65,13 +63,13 @@ var syncedBlockPromptedFeedbackMetaKey = new _state.PluginKey('syncedBlockPrompt
65
63
  */
66
64
 
67
65
  var creationMetaKey = exports.creationMetaKey = new _state.PluginKey('syncedBlockCreationMeta');
68
- var mapRetryCreationPosMap = function mapRetryCreationPosMap(oldMap, newRetryCreationPos, mapPos, isPerfExperimentOn) {
66
+ var mapRetryCreationPosMap = function mapRetryCreationPosMap(oldMap, newRetryCreationPos, mapPos) {
69
67
  var resourceId = newRetryCreationPos === null || newRetryCreationPos === void 0 ? void 0 : newRetryCreationPos.resourceId;
70
68
 
71
69
  // Fast path: no new entry and nothing to remap — return the same reference.
72
70
  // This is critical for PR-E (EDITOR-6929) which relies on reference equality
73
71
  // to short-circuit SharedStateAPI deep-equality checks.
74
- if (isPerfExperimentOn && !resourceId && oldMap.size === 0) {
72
+ if (!resourceId && oldMap.size === 0) {
75
73
  return oldMap;
76
74
  }
77
75
  var newMap = new Map(oldMap);
@@ -634,12 +632,6 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
634
632
  var _ref8 = options || {},
635
633
  _ref8$useLongPressSel = _ref8.useLongPressSelection,
636
634
  useLongPressSelection = _ref8$useLongPressSel === void 0 ? false : _ref8$useLongPressSel;
637
-
638
- // Cache the experiment value once at plugin creation time.
639
- // This fires the exposure event exactly once (correct per Exposure Events 101)
640
- // and avoids ~10 redundant Statsig SDK evaluations per keystroke in hot paths
641
- // (apply, filterTransaction, appendTransaction, decorations).
642
- var isPerfExperimentOn = (0, _expValEquals.expValEquals)('editor_synced_block_perf', 'isEnabled', true);
643
635
  var ctx = new SyncedBlockPluginContext(options === null || options === void 0 ? void 0 : options.onGiveFeedback, options === null || options === void 0 ? void 0 : options.shouldShowFeedbackPrompt, api);
644
636
  var confirmationTransactionRef = ctx.confirmationTransactionRef;
645
637
  var unpublishedFlagShown = ctx.unpublishedFlagShown;
@@ -696,11 +688,11 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
696
688
  state: {
697
689
  init: function init(_, instance) {
698
690
  var _api$connectivity2, _api$editorViewMode, _api$userIntent;
699
- // When `editor_synced_block_perf` is ON and the document has no
700
- // synced blocks, we skip the eager fetch + cache walks. They will be
701
- // re-run lazily by `apply` the first time a synced block enters the
702
- // document (paste, collab insert, or programmatic insert).
703
- var docHasSyncedBlocks = isPerfExperimentOn ? (0, _hasSyncedBlocks.hasSyncedBlocks)(instance.doc) : true;
691
+ // When the document has no synced blocks, we skip the eager fetch +
692
+ // cache walks. They will be re-run lazily by `apply` the first time a
693
+ // synced block enters the document (paste, collab insert, or
694
+ // programmatic insert).
695
+ var docHasSyncedBlocks = (0, _hasSyncedBlocks.hasSyncedBlocks)(instance.doc);
704
696
  if (docHasSyncedBlocks) {
705
697
  var syncBlockNodes = instance.doc.children.filter(syncBlockStore.referenceManager.isReferenceBlock);
706
698
  syncBlockStore.referenceManager.fetchSyncBlocksData((0, _editorSyncedBlockProvider.convertPMNodesToSyncBlockNodes)(syncBlockNodes));
@@ -726,7 +718,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
726
718
  // When the perf gate is ON and the doc has synced blocks we do a
727
719
  // single traversal here; afterwards `apply()` will map or rebuild
728
720
  // only when a status signal changes.
729
- var initStatusDecorationSet = docHasSyncedBlocks && isPerfExperimentOn ? buildStatusDecorations(instance.doc, syncBlockStore, initIsOffline, initIsViewMode, initIsDragging) : _view2.DecorationSet.empty;
721
+ var initStatusDecorationSet = docHasSyncedBlocks ? buildStatusDecorations(instance.doc, syncBlockStore, initIsOffline, initIsViewMode, initIsDragging) : _view2.DecorationSet.empty;
730
722
  return {
731
723
  selectionDecorationSet: (0, _selectionDecorations.calculateDecorations)(instance.doc, instance.selection, instance.schema),
732
724
  activeFlag: false,
@@ -743,8 +735,6 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
743
735
  apply: function apply(tr, currentPluginState, oldEditorState) {
744
736
  var _api$userIntent2, _api$connectivity3, _api$editorViewMode2, _meta$activeFlag, _meta$bodiedSyncBlock;
745
737
  var meta = tr.getMeta(syncedBlockPluginKey);
746
- // isPerfExperimentOn is cached at createPlugin() level — see above
747
-
748
738
  var activeFlag = currentPluginState.activeFlag,
749
739
  selectionDecorationSet = currentPluginState.selectionDecorationSet,
750
740
  bodiedSyncBlockDeletionStatus = currentPluginState.bodiedSyncBlockDeletionStatus,
@@ -774,14 +764,14 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
774
764
  // status decoration rebuilds (e.g. drag border). Without this check the
775
765
  // fast path would swallow drag-start transactions and the synced block
776
766
  // border would never appear (see VR test: synced-block-drag-selection).
777
- if (isPerfExperimentOn && !meta && !tr.docChanged && tr.selection.eq(oldEditorState.selection) && nextHasUnsavedBodiedSyncBlockChanges === currentPluginState.hasUnsavedBodiedSyncBlockChanges && (api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 || (_api$userIntent2 = _api$userIntent2.sharedState.currentState()) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.currentUserIntent) === 'dragging' === prevDragging && (0, _editorPluginConnectivity.isOfflineMode)(api === null || api === void 0 || (_api$connectivity3 = api.connectivity) === null || _api$connectivity3 === void 0 || (_api$connectivity3 = _api$connectivity3.sharedState.currentState()) === null || _api$connectivity3 === void 0 ? void 0 : _api$connectivity3.mode) === prevOffline && (api === null || api === void 0 || (_api$editorViewMode2 = api.editorViewMode) === null || _api$editorViewMode2 === void 0 || (_api$editorViewMode2 = _api$editorViewMode2.sharedState.currentState()) === null || _api$editorViewMode2 === void 0 ? void 0 : _api$editorViewMode2.mode) === 'view' === prevViewMode) {
767
+ if (!meta && !tr.docChanged && tr.selection.eq(oldEditorState.selection) && nextHasUnsavedBodiedSyncBlockChanges === currentPluginState.hasUnsavedBodiedSyncBlockChanges && (api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 || (_api$userIntent2 = _api$userIntent2.sharedState.currentState()) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.currentUserIntent) === 'dragging' === prevDragging && (0, _editorPluginConnectivity.isOfflineMode)(api === null || api === void 0 || (_api$connectivity3 = api.connectivity) === null || _api$connectivity3 === void 0 || (_api$connectivity3 = _api$connectivity3.sharedState.currentState()) === null || _api$connectivity3 === void 0 ? void 0 : _api$connectivity3.mode) === prevOffline && (api === null || api === void 0 || (_api$editorViewMode2 = api.editorViewMode) === null || _api$editorViewMode2 === void 0 || (_api$editorViewMode2 = _api$editorViewMode2.sharedState.currentState()) === null || _api$editorViewMode2 === void 0 ? void 0 : _api$editorViewMode2.mode) === 'view' === prevViewMode) {
778
768
  return currentPluginState;
779
769
  }
780
770
 
781
771
  // Lazy-init bookkeeping: once a synced block enters the document we
782
772
  // flip `hasSyncedBlocks` to `true` for the lifetime of this editor
783
773
  var nextHasSyncedBlocks = prevHasSyncedBlocks;
784
- if (!prevHasSyncedBlocks && tr.docChanged && isPerfExperimentOn) {
774
+ if (!prevHasSyncedBlocks && tr.docChanged) {
785
775
  if ((0, _transactionInsertsSyncedBlock.transactionInsertsSyncedBlock)(tr)) {
786
776
  nextHasSyncedBlocks = true;
787
777
  }
@@ -809,42 +799,40 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
809
799
  var nextIsOffline = prevOffline;
810
800
  var nextIsViewMode = prevViewMode;
811
801
  var nextIsDragging = prevDragging;
812
- if (isPerfExperimentOn) {
813
- if (!nextHasSyncedBlocks) {
814
- // No synced blocks → keep empty status decorations
815
- nextStatusDecorationSet = _view2.DecorationSet.empty;
816
- } else {
817
- var _api$connectivity4, _api$editorViewMode3, _api$userIntent3;
818
- // Read current shared-state signals
819
- nextIsOffline = (0, _editorPluginConnectivity.isOfflineMode)(api === null || api === void 0 || (_api$connectivity4 = api.connectivity) === null || _api$connectivity4 === void 0 || (_api$connectivity4 = _api$connectivity4.sharedState.currentState()) === null || _api$connectivity4 === void 0 ? void 0 : _api$connectivity4.mode);
820
- nextIsViewMode = (api === null || api === void 0 || (_api$editorViewMode3 = api.editorViewMode) === null || _api$editorViewMode3 === void 0 || (_api$editorViewMode3 = _api$editorViewMode3.sharedState.currentState()) === null || _api$editorViewMode3 === void 0 ? void 0 : _api$editorViewMode3.mode) === 'view';
821
- nextIsDragging = (api === null || api === void 0 || (_api$userIntent3 = api.userIntent) === null || _api$userIntent3 === void 0 || (_api$userIntent3 = _api$userIntent3.sharedState.currentState()) === null || _api$userIntent3 === void 0 ? void 0 : _api$userIntent3.currentUserIntent) === 'dragging';
802
+ if (!nextHasSyncedBlocks) {
803
+ // No synced blocks → keep empty status decorations
804
+ nextStatusDecorationSet = _view2.DecorationSet.empty;
805
+ } else {
806
+ var _api$connectivity4, _api$editorViewMode3, _api$userIntent3;
807
+ // Read current shared-state signals
808
+ nextIsOffline = (0, _editorPluginConnectivity.isOfflineMode)(api === null || api === void 0 || (_api$connectivity4 = api.connectivity) === null || _api$connectivity4 === void 0 || (_api$connectivity4 = _api$connectivity4.sharedState.currentState()) === null || _api$connectivity4 === void 0 ? void 0 : _api$connectivity4.mode);
809
+ nextIsViewMode = (api === null || api === void 0 || (_api$editorViewMode3 = api.editorViewMode) === null || _api$editorViewMode3 === void 0 || (_api$editorViewMode3 = _api$editorViewMode3.sharedState.currentState()) === null || _api$editorViewMode3 === void 0 ? void 0 : _api$editorViewMode3.mode) === 'view';
810
+ nextIsDragging = (api === null || api === void 0 || (_api$userIntent3 = api.userIntent) === null || _api$userIntent3 === void 0 || (_api$userIntent3 = _api$userIntent3.sharedState.currentState()) === null || _api$userIntent3 === void 0 ? void 0 : _api$userIntent3.currentUserIntent) === 'dragging';
822
811
 
823
- // Determine whether we need a full rebuild or a cheap map
824
- var hasSyncedBlocksJustFlipped = nextHasSyncedBlocks && !prevHasSyncedBlocks;
825
- var statusSignalChanged = nextIsOffline !== prevOffline || nextIsViewMode !== prevViewMode || nextIsDragging !== prevDragging;
826
- // Meta-driven status changes (e.g. pending creation
827
- // completed, retry creation pos updated)
828
- var hasMetaStatusChange = !!(meta !== null && meta !== void 0 && meta.retryCreationPos) || !!(meta !== null && meta !== void 0 && meta.activeFlag);
829
- if (hasSyncedBlocksJustFlipped || statusSignalChanged || hasMetaStatusChange) {
830
- // Full rebuild — a status signal changed
831
- nextStatusDecorationSet = buildStatusDecorations(tr.doc, syncBlockStore, nextIsOffline, nextIsViewMode, nextIsDragging);
832
- } else if (tr.docChanged) {
833
- // Cheap map — positions shifted but status unchanged
834
- nextStatusDecorationSet = prevStatusDecorationSet.map(tr.mapping, tr.doc);
835
- }
836
- // else: nothing changed, keep same reference
812
+ // Determine whether we need a full rebuild or a cheap map
813
+ var hasSyncedBlocksJustFlipped = nextHasSyncedBlocks && !prevHasSyncedBlocks;
814
+ var statusSignalChanged = nextIsOffline !== prevOffline || nextIsViewMode !== prevViewMode || nextIsDragging !== prevDragging;
815
+ // Meta-driven status changes (e.g. pending creation
816
+ // completed, retry creation pos updated)
817
+ var hasMetaStatusChange = !!(meta !== null && meta !== void 0 && meta.retryCreationPos) || !!(meta !== null && meta !== void 0 && meta.activeFlag);
818
+ if (hasSyncedBlocksJustFlipped || statusSignalChanged || hasMetaStatusChange) {
819
+ // Full rebuild — a status signal changed
820
+ nextStatusDecorationSet = buildStatusDecorations(tr.doc, syncBlockStore, nextIsOffline, nextIsViewMode, nextIsDragging);
821
+ } else if (tr.docChanged) {
822
+ // Cheap map — positions shifted but status unchanged
823
+ nextStatusDecorationSet = prevStatusDecorationSet.map(tr.mapping, tr.doc);
837
824
  }
825
+ // else: nothing changed, keep same reference
838
826
  }
839
827
  var newPosEntry = meta === null || meta === void 0 ? void 0 : meta.retryCreationPos;
840
- var newRetryCreationPosMap = mapRetryCreationPosMap(retryCreationPosMap, newPosEntry, tr.mapping.map.bind(tr.mapping), isPerfExperimentOn);
828
+ var newRetryCreationPosMap = mapRetryCreationPosMap(retryCreationPosMap, newPosEntry, tr.mapping.map.bind(tr.mapping));
841
829
  var nextActiveFlag = (_meta$activeFlag = meta === null || meta === void 0 ? void 0 : meta.activeFlag) !== null && _meta$activeFlag !== void 0 ? _meta$activeFlag : activeFlag;
842
830
  var nextBodiedSyncBlockDeletionStatus = (_meta$bodiedSyncBlock = meta === null || meta === void 0 ? void 0 : meta.bodiedSyncBlockDeletionStatus) !== null && _meta$bodiedSyncBlock !== void 0 ? _meta$bodiedSyncBlock : bodiedSyncBlockDeletionStatus;
843
831
 
844
832
  // --- Reference equality (EDITOR-6929): return the same object
845
833
  // when ALL fields are reference-equal to avoid SharedStateAPI
846
834
  // notifying subscribers and triggering React re-renders. ---
847
- if (nextActiveFlag === activeFlag && newDecorationSet === selectionDecorationSet && newRetryCreationPosMap === retryCreationPosMap && nextHasSyncedBlocks === prevHasSyncedBlocks && nextBodiedSyncBlockDeletionStatus === bodiedSyncBlockDeletionStatus && nextHasUnsavedBodiedSyncBlockChanges === currentPluginState.hasUnsavedBodiedSyncBlockChanges && nextStatusDecorationSet === prevStatusDecorationSet && nextIsOffline === prevOffline && nextIsViewMode === prevViewMode && nextIsDragging === prevDragging && isPerfExperimentOn) {
835
+ if (nextActiveFlag === activeFlag && newDecorationSet === selectionDecorationSet && newRetryCreationPosMap === retryCreationPosMap && nextHasSyncedBlocks === prevHasSyncedBlocks && nextBodiedSyncBlockDeletionStatus === bodiedSyncBlockDeletionStatus && nextHasUnsavedBodiedSyncBlockChanges === currentPluginState.hasUnsavedBodiedSyncBlockChanges && nextStatusDecorationSet === prevStatusDecorationSet && nextIsOffline === prevOffline && nextIsViewMode === prevViewMode && nextIsDragging === prevDragging) {
848
836
  return currentPluginState;
849
837
  }
850
838
  return {
@@ -883,14 +871,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
883
871
  }).init()
884
872
  );
885
873
  },
886
- bodiedSyncBlock: (0, _experiments.editorExperiment)('platform_synced_block_use_new_source_nodeview', true, {
887
- exposure: true
888
- }) ? (0, _bodiedSyncedBlock.bodiedSyncBlockNodeView)({
889
- pluginOptions: options,
890
- pmPluginFactoryParams: pmPluginFactoryParams,
891
- api: api,
892
- syncBlockStore: syncBlockStore
893
- }) : (0, _bodiedSyncedBlock.bodiedSyncBlockNodeViewOld)({
874
+ bodiedSyncBlock: (0, _bodiedSyncedBlock.bodiedSyncBlockNodeView)({
894
875
  pluginOptions: options,
895
876
  pmPluginFactoryParams: pmPluginFactoryParams,
896
877
  api: api,
@@ -898,6 +879,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
898
879
  })
899
880
  },
900
881
  decorations: function decorations(state) {
882
+ var _api$focus$sharedStat, _api$focus;
901
883
  var currentPluginState = syncedBlockPluginKey.getState(state);
902
884
  if (!currentPluginState) {
903
885
  return _view2.DecorationSet.empty;
@@ -911,68 +893,24 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
911
893
  // `apply()`. The `decorations` prop is now an O(1) merge of
912
894
  // the two cached sets — no `doc.descendants()` walk, no
913
895
  // shared-state reads.
914
- if (isPerfExperimentOn) {
915
- var _api$focus$sharedStat, _api$focus;
916
- if (!docHasSyncedBlocks) {
917
- return selectionDecorationSet;
918
- }
896
+ if (!docHasSyncedBlocks) {
897
+ return selectionDecorationSet;
898
+ }
919
899
 
920
- // Focus state is read live here (single cheap read) because
921
- // it only gates whether selection decorations are included —
922
- // it does not affect the status decoration set and can change
923
- // within the same transaction cycle.
924
- var hasFocus = (_api$focus$sharedStat = api === null || api === void 0 || (_api$focus = api.focus) === null || _api$focus === void 0 || (_api$focus = _api$focus.sharedState) === null || _api$focus === void 0 || (_api$focus = _api$focus.currentState()) === null || _api$focus === void 0 ? void 0 : _api$focus.hasFocus) !== null && _api$focus$sharedStat !== void 0 ? _api$focus$sharedStat : true;
900
+ // Focus state is read live here (single cheap read) because
901
+ // it only gates whether selection decorations are included —
902
+ // it does not affect the status decoration set and can change
903
+ // within the same transaction cycle.
904
+ var hasFocus = (_api$focus$sharedStat = api === null || api === void 0 || (_api$focus = api.focus) === null || _api$focus === void 0 || (_api$focus = _api$focus.sharedState) === null || _api$focus === void 0 || (_api$focus = _api$focus.currentState()) === null || _api$focus === void 0 ? void 0 : _api$focus.hasFocus) !== null && _api$focus$sharedStat !== void 0 ? _api$focus$sharedStat : true;
925
905
 
926
- // Merge selection + status decorations.
927
- // When the editor is unfocused,
928
- // omit selection decorations (matches old behaviour).
929
- var statusDecorations = statusDecorationSet.find();
930
- if (statusDecorations.length === 0) {
931
- return hasFocus ? selectionDecorationSet : _view2.DecorationSet.empty;
932
- } else {
933
- return hasFocus ? selectionDecorationSet.add(state.doc, statusDecorations) : statusDecorationSet;
934
- }
906
+ // Merge selection + status decorations.
907
+ // When the editor is unfocused,
908
+ // omit selection decorations (matches old behaviour).
909
+ var statusDecorations = statusDecorationSet.find();
910
+ if (statusDecorations.length === 0) {
911
+ return hasFocus ? selectionDecorationSet : _view2.DecorationSet.empty;
935
912
  } else {
936
- var _api$connectivity5, _api$editorViewMode4, _api$userIntent4, _api$focus2;
937
- // --- Legacy path (perf gate OFF) ---
938
- // Full `doc.descendants()` walk every transaction. Preserved
939
- // for safe rollback.
940
- var _syncBlockStore = currentPluginState.syncBlockStore;
941
- var doc = state.doc;
942
- var isOffline = (0, _editorPluginConnectivity.isOfflineMode)(api === null || api === void 0 || (_api$connectivity5 = api.connectivity) === null || _api$connectivity5 === void 0 || (_api$connectivity5 = _api$connectivity5.sharedState.currentState()) === null || _api$connectivity5 === void 0 ? void 0 : _api$connectivity5.mode);
943
- var isViewMode = (api === null || api === void 0 || (_api$editorViewMode4 = api.editorViewMode) === null || _api$editorViewMode4 === void 0 || (_api$editorViewMode4 = _api$editorViewMode4.sharedState.currentState()) === null || _api$editorViewMode4 === void 0 ? void 0 : _api$editorViewMode4.mode) === 'view';
944
- var isDragging = (api === null || api === void 0 || (_api$userIntent4 = api.userIntent) === null || _api$userIntent4 === void 0 || (_api$userIntent4 = _api$userIntent4.sharedState.currentState()) === null || _api$userIntent4 === void 0 ? void 0 : _api$userIntent4.currentUserIntent) === 'dragging';
945
- var offlineDecorations = [];
946
- var viewModeDecorations = [];
947
- var loadingDecorations = [];
948
- var dragDecorations = [];
949
- state.doc.descendants(function (node, pos) {
950
- if (node.type.name === 'bodiedSyncBlock' && isOffline) {
951
- offlineDecorations.push(_view2.Decoration.node(pos, pos + node.nodeSize, {
952
- class: _syncBlock.SyncBlockStateCssClassName.disabledClassName
953
- }));
954
- }
955
- if (_syncBlockStore.isSyncBlock(node) && isViewMode) {
956
- viewModeDecorations.push(_view2.Decoration.node(pos, pos + node.nodeSize, {
957
- class: _syncBlock.SyncBlockStateCssClassName.viewModeClassName
958
- }));
959
- }
960
- if (node.type.name === 'bodiedSyncBlock' && _syncBlockStore.sourceManager.isPendingCreation(node.attrs.resourceId)) {
961
- loadingDecorations.push(_view2.Decoration.node(pos, pos + node.nodeSize, {
962
- class: _syncBlock.SyncBlockStateCssClassName.creationLoadingClassName
963
- }));
964
- }
965
- if (isDragging && _syncBlockStore.isSyncBlock(node)) {
966
- dragDecorations.push(_view2.Decoration.node(pos, pos + node.nodeSize, {
967
- class: _syncBlock.SyncBlockStateCssClassName.draggingClassName
968
- }));
969
- }
970
- });
971
- if (api !== null && api !== void 0 && (_api$focus2 = api.focus) !== null && _api$focus2 !== void 0 && (_api$focus2 = _api$focus2.sharedState) !== null && _api$focus2 !== void 0 && (_api$focus2 = _api$focus2.currentState()) !== null && _api$focus2 !== void 0 && _api$focus2.hasFocus) {
972
- return selectionDecorationSet.add(doc, offlineDecorations).add(doc, viewModeDecorations).add(doc, loadingDecorations).add(doc, dragDecorations);
973
- } else {
974
- return _view2.DecorationSet.empty.add(doc, offlineDecorations).add(doc, viewModeDecorations).add(doc, loadingDecorations).add(doc, dragDecorations);
975
- }
913
+ return hasFocus ? selectionDecorationSet.add(state.doc, statusDecorations) : statusDecorationSet;
976
914
  }
977
915
  },
978
916
  handleClickOn: (0, _selection.createSelectionClickHandler)(['bodiedSyncBlock'], function (target) {
@@ -1094,22 +1032,20 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
1094
1032
  }
1095
1033
  },
1096
1034
  filterTransaction: function filterTransaction(tr, state) {
1097
- var _api$editorViewMode5, _api$connectivity6;
1035
+ var _api$editorViewMode4, _api$connectivity5;
1098
1036
  // Lazy-init: when no synced block currently exists in the doc and the
1099
1037
  // transaction does not insert one, all downstream filter logic is a
1100
1038
  // no-op. Avoid both the shared-state reads and the `trackSyncBlocks`
1101
1039
  // walks for the ~99.97% of pages that have no synced blocks.
1102
- if (isPerfExperimentOn) {
1103
- var pluginState = syncedBlockPluginKey.getState(state);
1104
- if (pluginState && !pluginState.hasSyncedBlocks && !(0, _transactionInsertsSyncedBlock.transactionInsertsSyncedBlock)(tr)) {
1105
- return true;
1106
- }
1040
+ var pluginState = syncedBlockPluginKey.getState(state);
1041
+ if (pluginState && !pluginState.hasSyncedBlocks && !(0, _transactionInsertsSyncedBlock.transactionInsertsSyncedBlock)(tr)) {
1042
+ return true;
1107
1043
  }
1108
- var viewMode = api === null || api === void 0 || (_api$editorViewMode5 = api.editorViewMode) === null || _api$editorViewMode5 === void 0 || (_api$editorViewMode5 = _api$editorViewMode5.sharedState.currentState()) === null || _api$editorViewMode5 === void 0 ? void 0 : _api$editorViewMode5.mode;
1044
+ var viewMode = api === null || api === void 0 || (_api$editorViewMode4 = api.editorViewMode) === null || _api$editorViewMode4 === void 0 || (_api$editorViewMode4 = _api$editorViewMode4.sharedState.currentState()) === null || _api$editorViewMode4 === void 0 ? void 0 : _api$editorViewMode4.mode;
1109
1045
  if (viewMode === 'view') {
1110
1046
  return true;
1111
1047
  }
1112
- var isOffline = (0, _editorPluginConnectivity.isOfflineMode)(api === null || api === void 0 || (_api$connectivity6 = api.connectivity) === null || _api$connectivity6 === void 0 || (_api$connectivity6 = _api$connectivity6.sharedState.currentState()) === null || _api$connectivity6 === void 0 ? void 0 : _api$connectivity6.mode);
1048
+ var isOffline = (0, _editorPluginConnectivity.isOfflineMode)(api === null || api === void 0 || (_api$connectivity5 = api.connectivity) === null || _api$connectivity5 === void 0 || (_api$connectivity5 = _api$connectivity5.sharedState.currentState()) === null || _api$connectivity5 === void 0 ? void 0 : _api$connectivity5.mode);
1113
1049
  var isConfirmedSyncBlockDeletion = Boolean(tr.getMeta('isConfirmedSyncBlockDeletion'));
1114
1050
 
1115
1051
  // Track newly added reference sync blocks before processing the transaction
@@ -1184,20 +1120,18 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
1184
1120
  });
1185
1121
  },
1186
1122
  appendTransaction: function appendTransaction(trs, oldState, newState) {
1187
- var _api$editorViewMode6;
1123
+ var _api$editorViewMode5;
1188
1124
  // Lazy-init: when neither the previous nor the new state contains a
1189
1125
  // synced block (and none of the dispatched transactions inserts one),
1190
1126
  // skip all downstream work. This is the hot path on the ~99.97% of
1191
1127
  // pages that don't use synced blocks (see EDITOR-6586).
1192
- if (isPerfExperimentOn) {
1193
- var oldPluginState = syncedBlockPluginKey.getState(oldState);
1194
- var newPluginState = syncedBlockPluginKey.getState(newState);
1195
- var hadOrHasSyncedBlocks = !!(oldPluginState !== null && oldPluginState !== void 0 && oldPluginState.hasSyncedBlocks) || !!(newPluginState !== null && newPluginState !== void 0 && newPluginState.hasSyncedBlocks);
1196
- if (!hadOrHasSyncedBlocks) {
1197
- return null;
1198
- }
1128
+ var oldPluginState = syncedBlockPluginKey.getState(oldState);
1129
+ var newPluginState = syncedBlockPluginKey.getState(newState);
1130
+ var hadOrHasSyncedBlocks = !!(oldPluginState !== null && oldPluginState !== void 0 && oldPluginState.hasSyncedBlocks) || !!(newPluginState !== null && newPluginState !== void 0 && newPluginState.hasSyncedBlocks);
1131
+ if (!hadOrHasSyncedBlocks) {
1132
+ return null;
1199
1133
  }
1200
- var viewMode = api === null || api === void 0 || (_api$editorViewMode6 = api.editorViewMode) === null || _api$editorViewMode6 === void 0 || (_api$editorViewMode6 = _api$editorViewMode6.sharedState.currentState()) === null || _api$editorViewMode6 === void 0 ? void 0 : _api$editorViewMode6.mode;
1134
+ var viewMode = api === null || api === void 0 || (_api$editorViewMode5 = api.editorViewMode) === null || _api$editorViewMode5 === void 0 || (_api$editorViewMode5 = _api$editorViewMode5.sharedState.currentState()) === null || _api$editorViewMode5 === void 0 ? void 0 : _api$editorViewMode5.mode;
1201
1135
  if (viewMode === 'view') {
1202
1136
  return null;
1203
1137
  }
@@ -11,7 +11,6 @@ var _analytics = require("@atlaskit/editor-common/analytics");
11
11
  var _experiences = require("@atlaskit/editor-common/experiences");
12
12
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
13
13
  var _state = require("@atlaskit/editor-prosemirror/state");
14
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
15
14
  var _types = require("../types");
16
15
  var _main = require("./main");
17
16
  var TIMEOUT_DURATION = 30000;
@@ -21,10 +20,6 @@ var syncedBlockButtonIds = new Set(SYNCED_BLOCK_BUTTON_TEST_IDS);
21
20
  var getMenuAndToolbarExperiencesPlugin = exports.getMenuAndToolbarExperiencesPlugin = function getMenuAndToolbarExperiencesPlugin(_ref) {
22
21
  var refs = _ref.refs,
23
22
  dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
24
- // Cache the experiment value once at plugin creation time.
25
- // This fires the exposure event exactly once (correct per Exposure Events 101)
26
- // and avoids redundant Statsig SDK evaluations in the view() and update() hooks.
27
- var isPerfExperimentOn = (0, _expValEquals.expValEquals)('editor_synced_block_perf', 'isEnabled', true);
28
23
  var popupsTargetEl;
29
24
  var editorViewRef = {
30
25
  current: undefined
@@ -187,13 +182,13 @@ var getMenuAndToolbarExperiencesPlugin = exports.getMenuAndToolbarExperiencesPlu
187
182
  unbindClickListener = unbinders.unbindClickListener;
188
183
  unbindKeydownListener = unbinders.unbindKeydownListener;
189
184
  };
190
- if ((_syncedBlockPluginKey = _main.syncedBlockPluginKey.getState(_view.state)) !== null && _syncedBlockPluginKey !== void 0 && _syncedBlockPluginKey.hasSyncedBlocks || !isPerfExperimentOn) {
185
+ if ((_syncedBlockPluginKey = _main.syncedBlockPluginKey.getState(_view.state)) !== null && _syncedBlockPluginKey !== void 0 && _syncedBlockPluginKey.hasSyncedBlocks) {
191
186
  ensureListenersBound();
192
187
  }
193
188
  return {
194
189
  update: function update(view, prevState) {
195
190
  var _syncedBlockPluginKey2;
196
- if (!listenersBound && view.state.doc !== prevState.doc && (_syncedBlockPluginKey2 = _main.syncedBlockPluginKey.getState(view.state)) !== null && _syncedBlockPluginKey2 !== void 0 && _syncedBlockPluginKey2.hasSyncedBlocks && isPerfExperimentOn) {
191
+ if (!listenersBound && view.state.doc !== prevState.doc && (_syncedBlockPluginKey2 = _main.syncedBlockPluginKey.getState(view.state)) !== null && _syncedBlockPluginKey2 !== void 0 && _syncedBlockPluginKey2.hasSyncedBlocks) {
197
192
  // Bind listeners now that synced blocks are present.
198
193
  ensureListenersBound();
199
194
  }
@@ -10,8 +10,8 @@ exports.hasSyncedBlocks = void 0;
10
10
  *
11
11
  * Both `syncBlock` and `bodiedSyncBlock` are top-level nodes in the schema, so
12
12
  * a single shallow scan is sufficient — no need for a recursive `descendants`
13
- * walk. This is used by the `editor_synced_block_perf` experiment to avoid
14
- * spinning up the synced block subsystem on documents that don't contain any
13
+ * walk. This is used to avoid spinning up the synced block subsystem on
14
+ * documents that don't contain any
15
15
  * synced blocks (which is ~99.97% of pages, see EDITOR-6586).
16
16
  */
17
17
  var hasSyncedBlocks = exports.hasSyncedBlocks = function hasSyncedBlocks(doc) {
@@ -11,7 +11,6 @@ var _hooks = require("@atlaskit/editor-common/hooks");
11
11
  var _editorSyncedBlockProvider = require("@atlaskit/editor-synced-block-provider");
12
12
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
13
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
14
- var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
15
14
  var _editorActions = require("./editor-actions");
16
15
  var _editorCommands = require("./editor-commands");
17
16
  var _main = require("./pm-plugins/main");
@@ -41,11 +40,7 @@ var LazySyncedBlockUI = function LazySyncedBlockUI(_ref) {
41
40
  var _states$syncedBlockSt;
42
41
  return (_states$syncedBlockSt = states.syncedBlockState) === null || _states$syncedBlockSt === void 0 ? void 0 : _states$syncedBlockSt.hasSyncedBlocks;
43
42
  });
44
-
45
- // Use expValEqualsNoExposure here because the exposure is already fired
46
- // once at plugin creation time (see syncedBlockPlugin below).
47
- // This component re-renders on every transaction — avoid redundant SDK evaluations.
48
- if (!hasSyncBlocks && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('editor_synced_block_perf', 'isEnabled', true)) {
43
+ if (!hasSyncBlocks) {
49
44
  return null;
50
45
  }
51
46
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_SyncBlockRefresher.SyncBlockRefresher, {
@@ -67,7 +62,6 @@ var syncedBlockPlugin = exports.syncedBlockPlugin = function syncedBlockPlugin(_
67
62
  var refs = {};
68
63
  var viewMode = api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode;
69
64
  var syncBlockStore = new _editorSyncedBlockProvider.SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.syncBlockDataProvider, viewMode, config === null || config === void 0 ? void 0 : config.__livePage);
70
- var isPerfExperimentOn = (0, _expValEquals.expValEquals)('editor_synced_block_perf', 'isEnabled', true);
71
65
  syncBlockStore.setFireAnalyticsEvent(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 ? void 0 : _api$analytics.fireAnalyticsEvent);
72
66
 
73
67
  // --- Memoized getSharedState (EDITOR-6929 / PR-F) ---
@@ -146,10 +140,7 @@ var syncedBlockPlugin = exports.syncedBlockPlugin = function syncedBlockPlugin(_
146
140
  // When the experiment is ON and the document has no synced blocks,
147
141
  // skip the toolbar config entirely to avoid the per-selection-change
148
142
  // cost of findSyncBlockOrBodiedSyncBlock (EDITOR-6931).
149
- // Save the expValEquals('editor_synced_block_perf', 'isEnabled', true) in a const
150
- // because floatingToolbar is called on every selection change.
151
- // computing it once at plugin initialisation is more efficient.
152
- if (!((_syncedBlockPluginKey = _main.syncedBlockPluginKey.getState(state)) !== null && _syncedBlockPluginKey !== void 0 && _syncedBlockPluginKey.hasSyncedBlocks) && isPerfExperimentOn) {
143
+ if (!((_syncedBlockPluginKey = _main.syncedBlockPluginKey.getState(state)) !== null && _syncedBlockPluginKey !== void 0 && _syncedBlockPluginKey.hasSyncedBlocks)) {
153
144
  return undefined;
154
145
  }
155
146
  return (0, _floatingToolbar.getToolbarConfig)(state, intl, api, syncBlockStore, config === null || config === void 0 ? void 0 : config.__livePage, config === null || config === void 0 ? void 0 : config.onGiveFeedback);
@@ -183,7 +174,7 @@ var syncedBlockPlugin = exports.syncedBlockPlugin = function syncedBlockPlugin(_
183
174
 
184
175
  // --- EDITOR-6929 / PR-F: return a stable reference when all
185
176
  // fields are unchanged to prevent unnecessary React re-renders. ---
186
- if (cachedSharedState !== undefined && cachedSharedState.activeFlag === activeFlag && cachedSharedState.syncBlockStore === currentSyncBlockStore && cachedSharedState.bodiedSyncBlockDeletionStatus === bodiedSyncBlockDeletionStatus && cachedSharedState.retryCreationPosMap === retryCreationPosMap && cachedSharedState.hasSyncedBlocks === hasSyncedBlocks && cachedSharedState.hasUnsavedBodiedSyncBlockChanges === hasUnsavedBodiedSyncBlockChanges && isPerfExperimentOn) {
177
+ if (cachedSharedState !== undefined && cachedSharedState.activeFlag === activeFlag && cachedSharedState.syncBlockStore === currentSyncBlockStore && cachedSharedState.bodiedSyncBlockDeletionStatus === bodiedSyncBlockDeletionStatus && cachedSharedState.retryCreationPosMap === retryCreationPosMap && cachedSharedState.hasSyncedBlocks === hasSyncedBlocks && cachedSharedState.hasUnsavedBodiedSyncBlockChanges === hasUnsavedBodiedSyncBlockChanges) {
187
178
  return cachedSharedState;
188
179
  }
189
180
  var nextSharedState = {