@atlaskit/editor-plugin-synced-block 11.0.0 → 11.0.2
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/AGENTS.md +3 -3
- package/CHANGELOG.md +19 -0
- package/dist/cjs/nodeviews/bodiedSyncedBlock.js +25 -193
- package/dist/cjs/nodeviews/syncedBlock.js +4 -25
- package/dist/cjs/pm-plugins/main.js +64 -130
- package/dist/cjs/pm-plugins/menu-and-toolbar-experiences.js +2 -7
- package/dist/cjs/pm-plugins/utils/has-synced-blocks.js +2 -2
- package/dist/cjs/syncedBlockPlugin.js +3 -12
- package/dist/es2019/nodeviews/bodiedSyncedBlock.js +9 -150
- package/dist/es2019/nodeviews/syncedBlock.js +3 -17
- package/dist/es2019/pm-plugins/main.js +65 -133
- package/dist/es2019/pm-plugins/menu-and-toolbar-experiences.js +2 -7
- package/dist/es2019/pm-plugins/utils/has-synced-blocks.js +2 -2
- package/dist/es2019/syncedBlockPlugin.js +3 -12
- package/dist/esm/nodeviews/bodiedSyncedBlock.js +24 -192
- package/dist/esm/nodeviews/syncedBlock.js +4 -25
- package/dist/esm/pm-plugins/main.js +65 -131
- package/dist/esm/pm-plugins/menu-and-toolbar-experiences.js +2 -7
- package/dist/esm/pm-plugins/utils/has-synced-blocks.js +2 -2
- package/dist/esm/syncedBlockPlugin.js +3 -12
- package/dist/types/nodeviews/bodiedSyncedBlock.d.ts +1 -13
- package/dist/types/pm-plugins/main.d.ts +6 -10
- package/dist/types/pm-plugins/utils/has-synced-blocks.d.ts +2 -2
- package/dist/types/types/index.d.ts +1 -2
- package/package.json +6 -6
- package/dist/cjs/ui/BodiedSyncBlockWrapper.js +0 -25
- package/dist/es2019/ui/BodiedSyncBlockWrapper.js +0 -19
- package/dist/esm/ui/BodiedSyncBlockWrapper.js +0 -18
- package/dist/types/ui/BodiedSyncBlockWrapper.d.ts +0 -9
|
@@ -21,10 +21,8 @@ import { DecorationSet, Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
|
21
21
|
import { convertPMNodesToSyncBlockNodes, rebaseTransaction } from '@atlaskit/editor-synced-block-provider';
|
|
22
22
|
import { getSourceProductFromResourceIdSafe } from '@atlaskit/editor-synced-block-provider/utils';
|
|
23
23
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
24
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
25
24
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
26
|
-
import {
|
|
27
|
-
import { bodiedSyncBlockNodeView, bodiedSyncBlockNodeViewOld } from '../nodeviews/bodiedSyncedBlock';
|
|
25
|
+
import { bodiedSyncBlockNodeView } from '../nodeviews/bodiedSyncedBlock';
|
|
28
26
|
import { SyncBlock as SyncBlockView } from '../nodeviews/syncedBlock';
|
|
29
27
|
import { FLAG_ID } from '../types';
|
|
30
28
|
import { handleBodiedSyncBlockCreation } from './utils/handle-bodied-sync-block-creation';
|
|
@@ -58,13 +56,13 @@ var syncedBlockPromptedFeedbackMetaKey = new PluginKey('syncedBlockPromptedFeedb
|
|
|
58
56
|
*/
|
|
59
57
|
|
|
60
58
|
export var creationMetaKey = new PluginKey('syncedBlockCreationMeta');
|
|
61
|
-
var mapRetryCreationPosMap = function mapRetryCreationPosMap(oldMap, newRetryCreationPos, mapPos
|
|
59
|
+
var mapRetryCreationPosMap = function mapRetryCreationPosMap(oldMap, newRetryCreationPos, mapPos) {
|
|
62
60
|
var resourceId = newRetryCreationPos === null || newRetryCreationPos === void 0 ? void 0 : newRetryCreationPos.resourceId;
|
|
63
61
|
|
|
64
62
|
// Fast path: no new entry and nothing to remap — return the same reference.
|
|
65
63
|
// This is critical for PR-E (EDITOR-6929) which relies on reference equality
|
|
66
64
|
// to short-circuit SharedStateAPI deep-equality checks.
|
|
67
|
-
if (
|
|
65
|
+
if (!resourceId && oldMap.size === 0) {
|
|
68
66
|
return oldMap;
|
|
69
67
|
}
|
|
70
68
|
var newMap = new Map(oldMap);
|
|
@@ -627,12 +625,6 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
627
625
|
var _ref8 = options || {},
|
|
628
626
|
_ref8$useLongPressSel = _ref8.useLongPressSelection,
|
|
629
627
|
useLongPressSelection = _ref8$useLongPressSel === void 0 ? false : _ref8$useLongPressSel;
|
|
630
|
-
|
|
631
|
-
// Cache the experiment value once at plugin creation time.
|
|
632
|
-
// This fires the exposure event exactly once (correct per Exposure Events 101)
|
|
633
|
-
// and avoids ~10 redundant Statsig SDK evaluations per keystroke in hot paths
|
|
634
|
-
// (apply, filterTransaction, appendTransaction, decorations).
|
|
635
|
-
var isPerfExperimentOn = expValEquals('editor_synced_block_perf', 'isEnabled', true);
|
|
636
628
|
var ctx = new SyncedBlockPluginContext(options === null || options === void 0 ? void 0 : options.onGiveFeedback, options === null || options === void 0 ? void 0 : options.shouldShowFeedbackPrompt, api);
|
|
637
629
|
var confirmationTransactionRef = ctx.confirmationTransactionRef;
|
|
638
630
|
var unpublishedFlagShown = ctx.unpublishedFlagShown;
|
|
@@ -689,11 +681,11 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
689
681
|
state: {
|
|
690
682
|
init: function init(_, instance) {
|
|
691
683
|
var _api$connectivity2, _api$editorViewMode, _api$userIntent;
|
|
692
|
-
// When
|
|
693
|
-
//
|
|
694
|
-
//
|
|
695
|
-
//
|
|
696
|
-
var docHasSyncedBlocks =
|
|
684
|
+
// When the document has no synced blocks, we skip the eager fetch +
|
|
685
|
+
// cache walks. They will be re-run lazily by `apply` the first time a
|
|
686
|
+
// synced block enters the document (paste, collab insert, or
|
|
687
|
+
// programmatic insert).
|
|
688
|
+
var docHasSyncedBlocks = hasSyncedBlocks(instance.doc);
|
|
697
689
|
if (docHasSyncedBlocks) {
|
|
698
690
|
var syncBlockNodes = instance.doc.children.filter(syncBlockStore.referenceManager.isReferenceBlock);
|
|
699
691
|
syncBlockStore.referenceManager.fetchSyncBlocksData(convertPMNodesToSyncBlockNodes(syncBlockNodes));
|
|
@@ -719,7 +711,7 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
719
711
|
// When the perf gate is ON and the doc has synced blocks we do a
|
|
720
712
|
// single traversal here; afterwards `apply()` will map or rebuild
|
|
721
713
|
// only when a status signal changes.
|
|
722
|
-
var initStatusDecorationSet = docHasSyncedBlocks
|
|
714
|
+
var initStatusDecorationSet = docHasSyncedBlocks ? buildStatusDecorations(instance.doc, syncBlockStore, initIsOffline, initIsViewMode, initIsDragging) : DecorationSet.empty;
|
|
723
715
|
return {
|
|
724
716
|
selectionDecorationSet: calculateDecorations(instance.doc, instance.selection, instance.schema),
|
|
725
717
|
activeFlag: false,
|
|
@@ -736,8 +728,6 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
736
728
|
apply: function apply(tr, currentPluginState, oldEditorState) {
|
|
737
729
|
var _api$userIntent2, _api$connectivity3, _api$editorViewMode2, _meta$activeFlag, _meta$bodiedSyncBlock;
|
|
738
730
|
var meta = tr.getMeta(syncedBlockPluginKey);
|
|
739
|
-
// isPerfExperimentOn is cached at createPlugin() level — see above
|
|
740
|
-
|
|
741
731
|
var activeFlag = currentPluginState.activeFlag,
|
|
742
732
|
selectionDecorationSet = currentPluginState.selectionDecorationSet,
|
|
743
733
|
bodiedSyncBlockDeletionStatus = currentPluginState.bodiedSyncBlockDeletionStatus,
|
|
@@ -767,14 +757,14 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
767
757
|
// status decoration rebuilds (e.g. drag border). Without this check the
|
|
768
758
|
// fast path would swallow drag-start transactions and the synced block
|
|
769
759
|
// border would never appear (see VR test: synced-block-drag-selection).
|
|
770
|
-
if (
|
|
760
|
+
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 && 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) {
|
|
771
761
|
return currentPluginState;
|
|
772
762
|
}
|
|
773
763
|
|
|
774
764
|
// Lazy-init bookkeeping: once a synced block enters the document we
|
|
775
765
|
// flip `hasSyncedBlocks` to `true` for the lifetime of this editor
|
|
776
766
|
var nextHasSyncedBlocks = prevHasSyncedBlocks;
|
|
777
|
-
if (!prevHasSyncedBlocks && tr.docChanged
|
|
767
|
+
if (!prevHasSyncedBlocks && tr.docChanged) {
|
|
778
768
|
if (transactionInsertsSyncedBlock(tr)) {
|
|
779
769
|
nextHasSyncedBlocks = true;
|
|
780
770
|
}
|
|
@@ -802,42 +792,40 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
802
792
|
var nextIsOffline = prevOffline;
|
|
803
793
|
var nextIsViewMode = prevViewMode;
|
|
804
794
|
var nextIsDragging = prevDragging;
|
|
805
|
-
if (
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
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';
|
|
795
|
+
if (!nextHasSyncedBlocks) {
|
|
796
|
+
// No synced blocks → keep empty status decorations
|
|
797
|
+
nextStatusDecorationSet = DecorationSet.empty;
|
|
798
|
+
} else {
|
|
799
|
+
var _api$connectivity4, _api$editorViewMode3, _api$userIntent3;
|
|
800
|
+
// Read current shared-state signals
|
|
801
|
+
nextIsOffline = 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);
|
|
802
|
+
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';
|
|
803
|
+
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';
|
|
815
804
|
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
}
|
|
829
|
-
// else: nothing changed, keep same reference
|
|
805
|
+
// Determine whether we need a full rebuild or a cheap map
|
|
806
|
+
var hasSyncedBlocksJustFlipped = nextHasSyncedBlocks && !prevHasSyncedBlocks;
|
|
807
|
+
var statusSignalChanged = nextIsOffline !== prevOffline || nextIsViewMode !== prevViewMode || nextIsDragging !== prevDragging;
|
|
808
|
+
// Meta-driven status changes (e.g. pending creation
|
|
809
|
+
// completed, retry creation pos updated)
|
|
810
|
+
var hasMetaStatusChange = !!(meta !== null && meta !== void 0 && meta.retryCreationPos) || !!(meta !== null && meta !== void 0 && meta.activeFlag);
|
|
811
|
+
if (hasSyncedBlocksJustFlipped || statusSignalChanged || hasMetaStatusChange) {
|
|
812
|
+
// Full rebuild — a status signal changed
|
|
813
|
+
nextStatusDecorationSet = buildStatusDecorations(tr.doc, syncBlockStore, nextIsOffline, nextIsViewMode, nextIsDragging);
|
|
814
|
+
} else if (tr.docChanged) {
|
|
815
|
+
// Cheap map — positions shifted but status unchanged
|
|
816
|
+
nextStatusDecorationSet = prevStatusDecorationSet.map(tr.mapping, tr.doc);
|
|
830
817
|
}
|
|
818
|
+
// else: nothing changed, keep same reference
|
|
831
819
|
}
|
|
832
820
|
var newPosEntry = meta === null || meta === void 0 ? void 0 : meta.retryCreationPos;
|
|
833
|
-
var newRetryCreationPosMap = mapRetryCreationPosMap(retryCreationPosMap, newPosEntry, tr.mapping.map.bind(tr.mapping)
|
|
821
|
+
var newRetryCreationPosMap = mapRetryCreationPosMap(retryCreationPosMap, newPosEntry, tr.mapping.map.bind(tr.mapping));
|
|
834
822
|
var nextActiveFlag = (_meta$activeFlag = meta === null || meta === void 0 ? void 0 : meta.activeFlag) !== null && _meta$activeFlag !== void 0 ? _meta$activeFlag : activeFlag;
|
|
835
823
|
var nextBodiedSyncBlockDeletionStatus = (_meta$bodiedSyncBlock = meta === null || meta === void 0 ? void 0 : meta.bodiedSyncBlockDeletionStatus) !== null && _meta$bodiedSyncBlock !== void 0 ? _meta$bodiedSyncBlock : bodiedSyncBlockDeletionStatus;
|
|
836
824
|
|
|
837
825
|
// --- Reference equality (EDITOR-6929): return the same object
|
|
838
826
|
// when ALL fields are reference-equal to avoid SharedStateAPI
|
|
839
827
|
// notifying subscribers and triggering React re-renders. ---
|
|
840
|
-
if (nextActiveFlag === activeFlag && newDecorationSet === selectionDecorationSet && newRetryCreationPosMap === retryCreationPosMap && nextHasSyncedBlocks === prevHasSyncedBlocks && nextBodiedSyncBlockDeletionStatus === bodiedSyncBlockDeletionStatus && nextHasUnsavedBodiedSyncBlockChanges === currentPluginState.hasUnsavedBodiedSyncBlockChanges && nextStatusDecorationSet === prevStatusDecorationSet && nextIsOffline === prevOffline && nextIsViewMode === prevViewMode && nextIsDragging === prevDragging
|
|
828
|
+
if (nextActiveFlag === activeFlag && newDecorationSet === selectionDecorationSet && newRetryCreationPosMap === retryCreationPosMap && nextHasSyncedBlocks === prevHasSyncedBlocks && nextBodiedSyncBlockDeletionStatus === bodiedSyncBlockDeletionStatus && nextHasUnsavedBodiedSyncBlockChanges === currentPluginState.hasUnsavedBodiedSyncBlockChanges && nextStatusDecorationSet === prevStatusDecorationSet && nextIsOffline === prevOffline && nextIsViewMode === prevViewMode && nextIsDragging === prevDragging) {
|
|
841
829
|
return currentPluginState;
|
|
842
830
|
}
|
|
843
831
|
return {
|
|
@@ -876,14 +864,7 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
876
864
|
}).init()
|
|
877
865
|
);
|
|
878
866
|
},
|
|
879
|
-
bodiedSyncBlock:
|
|
880
|
-
exposure: true
|
|
881
|
-
}) ? bodiedSyncBlockNodeView({
|
|
882
|
-
pluginOptions: options,
|
|
883
|
-
pmPluginFactoryParams: pmPluginFactoryParams,
|
|
884
|
-
api: api,
|
|
885
|
-
syncBlockStore: syncBlockStore
|
|
886
|
-
}) : bodiedSyncBlockNodeViewOld({
|
|
867
|
+
bodiedSyncBlock: bodiedSyncBlockNodeView({
|
|
887
868
|
pluginOptions: options,
|
|
888
869
|
pmPluginFactoryParams: pmPluginFactoryParams,
|
|
889
870
|
api: api,
|
|
@@ -891,6 +872,7 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
891
872
|
})
|
|
892
873
|
},
|
|
893
874
|
decorations: function decorations(state) {
|
|
875
|
+
var _api$focus$sharedStat, _api$focus;
|
|
894
876
|
var currentPluginState = syncedBlockPluginKey.getState(state);
|
|
895
877
|
if (!currentPluginState) {
|
|
896
878
|
return DecorationSet.empty;
|
|
@@ -904,68 +886,24 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
904
886
|
// `apply()`. The `decorations` prop is now an O(1) merge of
|
|
905
887
|
// the two cached sets — no `doc.descendants()` walk, no
|
|
906
888
|
// shared-state reads.
|
|
907
|
-
if (
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
return selectionDecorationSet;
|
|
911
|
-
}
|
|
889
|
+
if (!docHasSyncedBlocks) {
|
|
890
|
+
return selectionDecorationSet;
|
|
891
|
+
}
|
|
912
892
|
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
893
|
+
// Focus state is read live here (single cheap read) because
|
|
894
|
+
// it only gates whether selection decorations are included —
|
|
895
|
+
// it does not affect the status decoration set and can change
|
|
896
|
+
// within the same transaction cycle.
|
|
897
|
+
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;
|
|
918
898
|
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
} else {
|
|
926
|
-
return hasFocus ? selectionDecorationSet.add(state.doc, statusDecorations) : statusDecorationSet;
|
|
927
|
-
}
|
|
899
|
+
// Merge selection + status decorations.
|
|
900
|
+
// When the editor is unfocused,
|
|
901
|
+
// omit selection decorations (matches old behaviour).
|
|
902
|
+
var statusDecorations = statusDecorationSet.find();
|
|
903
|
+
if (statusDecorations.length === 0) {
|
|
904
|
+
return hasFocus ? selectionDecorationSet : DecorationSet.empty;
|
|
928
905
|
} else {
|
|
929
|
-
|
|
930
|
-
// --- Legacy path (perf gate OFF) ---
|
|
931
|
-
// Full `doc.descendants()` walk every transaction. Preserved
|
|
932
|
-
// for safe rollback.
|
|
933
|
-
var _syncBlockStore = currentPluginState.syncBlockStore;
|
|
934
|
-
var doc = state.doc;
|
|
935
|
-
var isOffline = 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);
|
|
936
|
-
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';
|
|
937
|
-
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';
|
|
938
|
-
var offlineDecorations = [];
|
|
939
|
-
var viewModeDecorations = [];
|
|
940
|
-
var loadingDecorations = [];
|
|
941
|
-
var dragDecorations = [];
|
|
942
|
-
state.doc.descendants(function (node, pos) {
|
|
943
|
-
if (node.type.name === 'bodiedSyncBlock' && isOffline) {
|
|
944
|
-
offlineDecorations.push(Decoration.node(pos, pos + node.nodeSize, {
|
|
945
|
-
class: SyncBlockStateCssClassName.disabledClassName
|
|
946
|
-
}));
|
|
947
|
-
}
|
|
948
|
-
if (_syncBlockStore.isSyncBlock(node) && isViewMode) {
|
|
949
|
-
viewModeDecorations.push(Decoration.node(pos, pos + node.nodeSize, {
|
|
950
|
-
class: SyncBlockStateCssClassName.viewModeClassName
|
|
951
|
-
}));
|
|
952
|
-
}
|
|
953
|
-
if (node.type.name === 'bodiedSyncBlock' && _syncBlockStore.sourceManager.isPendingCreation(node.attrs.resourceId)) {
|
|
954
|
-
loadingDecorations.push(Decoration.node(pos, pos + node.nodeSize, {
|
|
955
|
-
class: SyncBlockStateCssClassName.creationLoadingClassName
|
|
956
|
-
}));
|
|
957
|
-
}
|
|
958
|
-
if (isDragging && _syncBlockStore.isSyncBlock(node)) {
|
|
959
|
-
dragDecorations.push(Decoration.node(pos, pos + node.nodeSize, {
|
|
960
|
-
class: SyncBlockStateCssClassName.draggingClassName
|
|
961
|
-
}));
|
|
962
|
-
}
|
|
963
|
-
});
|
|
964
|
-
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) {
|
|
965
|
-
return selectionDecorationSet.add(doc, offlineDecorations).add(doc, viewModeDecorations).add(doc, loadingDecorations).add(doc, dragDecorations);
|
|
966
|
-
} else {
|
|
967
|
-
return DecorationSet.empty.add(doc, offlineDecorations).add(doc, viewModeDecorations).add(doc, loadingDecorations).add(doc, dragDecorations);
|
|
968
|
-
}
|
|
906
|
+
return hasFocus ? selectionDecorationSet.add(state.doc, statusDecorations) : statusDecorationSet;
|
|
969
907
|
}
|
|
970
908
|
},
|
|
971
909
|
handleClickOn: createSelectionClickHandler(['bodiedSyncBlock'], function (target) {
|
|
@@ -1087,22 +1025,20 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
1087
1025
|
}
|
|
1088
1026
|
},
|
|
1089
1027
|
filterTransaction: function filterTransaction(tr, state) {
|
|
1090
|
-
var _api$
|
|
1028
|
+
var _api$editorViewMode4, _api$connectivity5;
|
|
1091
1029
|
// Lazy-init: when no synced block currently exists in the doc and the
|
|
1092
1030
|
// transaction does not insert one, all downstream filter logic is a
|
|
1093
1031
|
// no-op. Avoid both the shared-state reads and the `trackSyncBlocks`
|
|
1094
1032
|
// walks for the ~99.97% of pages that have no synced blocks.
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
return true;
|
|
1099
|
-
}
|
|
1033
|
+
var pluginState = syncedBlockPluginKey.getState(state);
|
|
1034
|
+
if (pluginState && !pluginState.hasSyncedBlocks && !transactionInsertsSyncedBlock(tr)) {
|
|
1035
|
+
return true;
|
|
1100
1036
|
}
|
|
1101
|
-
var viewMode = api === null || api === void 0 || (_api$
|
|
1037
|
+
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;
|
|
1102
1038
|
if (viewMode === 'view') {
|
|
1103
1039
|
return true;
|
|
1104
1040
|
}
|
|
1105
|
-
var isOffline = isOfflineMode(api === null || api === void 0 || (_api$
|
|
1041
|
+
var isOffline = 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);
|
|
1106
1042
|
var isConfirmedSyncBlockDeletion = Boolean(tr.getMeta('isConfirmedSyncBlockDeletion'));
|
|
1107
1043
|
|
|
1108
1044
|
// Track newly added reference sync blocks before processing the transaction
|
|
@@ -1177,20 +1113,18 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
1177
1113
|
});
|
|
1178
1114
|
},
|
|
1179
1115
|
appendTransaction: function appendTransaction(trs, oldState, newState) {
|
|
1180
|
-
var _api$
|
|
1116
|
+
var _api$editorViewMode5;
|
|
1181
1117
|
// Lazy-init: when neither the previous nor the new state contains a
|
|
1182
1118
|
// synced block (and none of the dispatched transactions inserts one),
|
|
1183
1119
|
// skip all downstream work. This is the hot path on the ~99.97% of
|
|
1184
1120
|
// pages that don't use synced blocks (see EDITOR-6586).
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
return null;
|
|
1191
|
-
}
|
|
1121
|
+
var oldPluginState = syncedBlockPluginKey.getState(oldState);
|
|
1122
|
+
var newPluginState = syncedBlockPluginKey.getState(newState);
|
|
1123
|
+
var hadOrHasSyncedBlocks = !!(oldPluginState !== null && oldPluginState !== void 0 && oldPluginState.hasSyncedBlocks) || !!(newPluginState !== null && newPluginState !== void 0 && newPluginState.hasSyncedBlocks);
|
|
1124
|
+
if (!hadOrHasSyncedBlocks) {
|
|
1125
|
+
return null;
|
|
1192
1126
|
}
|
|
1193
|
-
var viewMode = api === null || api === void 0 || (_api$
|
|
1127
|
+
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;
|
|
1194
1128
|
if (viewMode === 'view') {
|
|
1195
1129
|
return null;
|
|
1196
1130
|
}
|
|
@@ -4,7 +4,6 @@ import { ACTION, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { Experience, EXPERIENCE_ID, ExperienceCheckDomMutation, ExperienceCheckTimeout, getNodeQuery, getPopupContainerFromEditorView, popupWithNestedElement, getSelectionAncestorDOM } from '@atlaskit/editor-common/experiences';
|
|
5
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
6
6
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
7
|
import { SYNCED_BLOCK_BUTTON_TEST_ID } from '../types';
|
|
9
8
|
import { syncedBlockPluginKey } from './main';
|
|
10
9
|
var TIMEOUT_DURATION = 30000;
|
|
@@ -14,10 +13,6 @@ var syncedBlockButtonIds = new Set(SYNCED_BLOCK_BUTTON_TEST_IDS);
|
|
|
14
13
|
export var getMenuAndToolbarExperiencesPlugin = function getMenuAndToolbarExperiencesPlugin(_ref) {
|
|
15
14
|
var refs = _ref.refs,
|
|
16
15
|
dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
|
|
17
|
-
// Cache the experiment value once at plugin creation time.
|
|
18
|
-
// This fires the exposure event exactly once (correct per Exposure Events 101)
|
|
19
|
-
// and avoids redundant Statsig SDK evaluations in the view() and update() hooks.
|
|
20
|
-
var isPerfExperimentOn = expValEquals('editor_synced_block_perf', 'isEnabled', true);
|
|
21
16
|
var popupsTargetEl;
|
|
22
17
|
var editorViewRef = {
|
|
23
18
|
current: undefined
|
|
@@ -180,13 +175,13 @@ export var getMenuAndToolbarExperiencesPlugin = function getMenuAndToolbarExperi
|
|
|
180
175
|
unbindClickListener = unbinders.unbindClickListener;
|
|
181
176
|
unbindKeydownListener = unbinders.unbindKeydownListener;
|
|
182
177
|
};
|
|
183
|
-
if ((_syncedBlockPluginKey = syncedBlockPluginKey.getState(_view.state)) !== null && _syncedBlockPluginKey !== void 0 && _syncedBlockPluginKey.hasSyncedBlocks
|
|
178
|
+
if ((_syncedBlockPluginKey = syncedBlockPluginKey.getState(_view.state)) !== null && _syncedBlockPluginKey !== void 0 && _syncedBlockPluginKey.hasSyncedBlocks) {
|
|
184
179
|
ensureListenersBound();
|
|
185
180
|
}
|
|
186
181
|
return {
|
|
187
182
|
update: function update(view, prevState) {
|
|
188
183
|
var _syncedBlockPluginKey2;
|
|
189
|
-
if (!listenersBound && view.state.doc !== prevState.doc && (_syncedBlockPluginKey2 = syncedBlockPluginKey.getState(view.state)) !== null && _syncedBlockPluginKey2 !== void 0 && _syncedBlockPluginKey2.hasSyncedBlocks
|
|
184
|
+
if (!listenersBound && view.state.doc !== prevState.doc && (_syncedBlockPluginKey2 = syncedBlockPluginKey.getState(view.state)) !== null && _syncedBlockPluginKey2 !== void 0 && _syncedBlockPluginKey2.hasSyncedBlocks) {
|
|
190
185
|
// Bind listeners now that synced blocks are present.
|
|
191
186
|
ensureListenersBound();
|
|
192
187
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Both `syncBlock` and `bodiedSyncBlock` are top-level nodes in the schema, so
|
|
6
6
|
* a single shallow scan is sufficient — no need for a recursive `descendants`
|
|
7
|
-
* walk. This is used
|
|
8
|
-
*
|
|
7
|
+
* walk. This is used to avoid spinning up the synced block subsystem on
|
|
8
|
+
* documents that don't contain any
|
|
9
9
|
* synced blocks (which is ~99.97% of pages, see EDITOR-6586).
|
|
10
10
|
*/
|
|
11
11
|
export var hasSyncedBlocks = function hasSyncedBlocks(doc) {
|
|
@@ -4,7 +4,6 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
4
4
|
import { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
8
7
|
import { flushBodiedSyncBlocks as _flushBodiedSyncBlocks, flushSyncBlocks, discardUnpublishedSyncBlocks as _discardUnpublishedSyncBlocks } from './editor-actions';
|
|
9
8
|
import { copySyncedBlockReferenceToClipboardEditorCommand, createSyncedBlock } from './editor-commands';
|
|
10
9
|
import { createPlugin, syncedBlockPluginKey } from './pm-plugins/main';
|
|
@@ -35,11 +34,7 @@ var LazySyncedBlockUI = function LazySyncedBlockUI(_ref) {
|
|
|
35
34
|
var _states$syncedBlockSt;
|
|
36
35
|
return (_states$syncedBlockSt = states.syncedBlockState) === null || _states$syncedBlockSt === void 0 ? void 0 : _states$syncedBlockSt.hasSyncedBlocks;
|
|
37
36
|
});
|
|
38
|
-
|
|
39
|
-
// Use expValEqualsNoExposure here because the exposure is already fired
|
|
40
|
-
// once at plugin creation time (see syncedBlockPlugin below).
|
|
41
|
-
// This component re-renders on every transaction — avoid redundant SDK evaluations.
|
|
42
|
-
if (!hasSyncBlocks && expValEqualsNoExposure('editor_synced_block_perf', 'isEnabled', true)) {
|
|
37
|
+
if (!hasSyncBlocks) {
|
|
43
38
|
return null;
|
|
44
39
|
}
|
|
45
40
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SyncBlockRefresher, {
|
|
@@ -61,7 +56,6 @@ export var syncedBlockPlugin = function syncedBlockPlugin(_ref2) {
|
|
|
61
56
|
var refs = {};
|
|
62
57
|
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;
|
|
63
58
|
var syncBlockStore = new SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.syncBlockDataProvider, viewMode, config === null || config === void 0 ? void 0 : config.__livePage);
|
|
64
|
-
var isPerfExperimentOn = expValEquals('editor_synced_block_perf', 'isEnabled', true);
|
|
65
59
|
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);
|
|
66
60
|
|
|
67
61
|
// --- Memoized getSharedState (EDITOR-6929 / PR-F) ---
|
|
@@ -140,10 +134,7 @@ export var syncedBlockPlugin = function syncedBlockPlugin(_ref2) {
|
|
|
140
134
|
// When the experiment is ON and the document has no synced blocks,
|
|
141
135
|
// skip the toolbar config entirely to avoid the per-selection-change
|
|
142
136
|
// cost of findSyncBlockOrBodiedSyncBlock (EDITOR-6931).
|
|
143
|
-
|
|
144
|
-
// because floatingToolbar is called on every selection change.
|
|
145
|
-
// computing it once at plugin initialisation is more efficient.
|
|
146
|
-
if (!((_syncedBlockPluginKey = syncedBlockPluginKey.getState(state)) !== null && _syncedBlockPluginKey !== void 0 && _syncedBlockPluginKey.hasSyncedBlocks) && isPerfExperimentOn) {
|
|
137
|
+
if (!((_syncedBlockPluginKey = syncedBlockPluginKey.getState(state)) !== null && _syncedBlockPluginKey !== void 0 && _syncedBlockPluginKey.hasSyncedBlocks)) {
|
|
147
138
|
return undefined;
|
|
148
139
|
}
|
|
149
140
|
return getToolbarConfig(state, intl, api, syncBlockStore, config === null || config === void 0 ? void 0 : config.__livePage, config === null || config === void 0 ? void 0 : config.onGiveFeedback);
|
|
@@ -177,7 +168,7 @@ export var syncedBlockPlugin = function syncedBlockPlugin(_ref2) {
|
|
|
177
168
|
|
|
178
169
|
// --- EDITOR-6929 / PR-F: return a stable reference when all
|
|
179
170
|
// fields are unchanged to prevent unnecessary React re-renders. ---
|
|
180
|
-
if (cachedSharedState !== undefined && cachedSharedState.activeFlag === activeFlag && cachedSharedState.syncBlockStore === currentSyncBlockStore && cachedSharedState.bodiedSyncBlockDeletionStatus === bodiedSyncBlockDeletionStatus && cachedSharedState.retryCreationPosMap === retryCreationPosMap && cachedSharedState.hasSyncedBlocks === hasSyncedBlocks && cachedSharedState.hasUnsavedBodiedSyncBlockChanges === hasUnsavedBodiedSyncBlockChanges
|
|
171
|
+
if (cachedSharedState !== undefined && cachedSharedState.activeFlag === activeFlag && cachedSharedState.syncBlockStore === currentSyncBlockStore && cachedSharedState.bodiedSyncBlockDeletionStatus === bodiedSyncBlockDeletionStatus && cachedSharedState.retryCreationPosMap === retryCreationPosMap && cachedSharedState.hasSyncedBlocks === hasSyncedBlocks && cachedSharedState.hasUnsavedBodiedSyncBlockChanges === hasUnsavedBodiedSyncBlockChanges) {
|
|
181
172
|
return cachedSharedState;
|
|
182
173
|
}
|
|
183
174
|
var nextSharedState = {
|
|
@@ -1,28 +1,16 @@
|
|
|
1
|
-
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
2
1
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
3
|
-
import
|
|
2
|
+
import type { getPosHandler } from '@atlaskit/editor-common/react-node-view';
|
|
4
3
|
import type { ExtractInjectionAPI, getPosHandlerNode, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
|
|
5
4
|
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
5
|
import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
7
6
|
import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
8
7
|
import type { SyncedBlockPlugin, SyncedBlockPluginOptions } from '../syncedBlockPluginType';
|
|
9
|
-
export interface BodiedSyncBlockNodeViewProps extends ReactComponentProps {
|
|
10
|
-
api?: ExtractInjectionAPI<SyncedBlockPlugin>;
|
|
11
|
-
eventDispatcher: EventDispatcher;
|
|
12
|
-
getPos: getPosHandler;
|
|
13
|
-
node: PMNode;
|
|
14
|
-
pluginOptions: SyncedBlockPluginOptions | undefined;
|
|
15
|
-
portalProviderAPI: PortalProviderAPI;
|
|
16
|
-
syncBlockStore?: SyncBlockStoreManager;
|
|
17
|
-
view: EditorView;
|
|
18
|
-
}
|
|
19
8
|
export interface BodiedSyncBlockNodeViewProperties {
|
|
20
9
|
api?: ExtractInjectionAPI<SyncedBlockPlugin>;
|
|
21
10
|
pluginOptions: SyncedBlockPluginOptions | undefined;
|
|
22
11
|
pmPluginFactoryParams: PMPluginFactoryParams;
|
|
23
12
|
syncBlockStore?: SyncBlockStoreManager;
|
|
24
13
|
}
|
|
25
|
-
export declare const bodiedSyncBlockNodeViewOld: (props: BodiedSyncBlockNodeViewProperties) => (node: PMNode, view: EditorView, getPos: getPosHandler) => ReactNodeView<BodiedSyncBlockNodeViewProps>;
|
|
26
14
|
export declare class BodiedSyncBlock implements NodeView {
|
|
27
15
|
dom: HTMLElement;
|
|
28
16
|
contentDOM: HTMLElement;
|
|
@@ -35,22 +35,18 @@ type SyncedBlockPluginState = {
|
|
|
35
35
|
activeFlag: ActiveFlag;
|
|
36
36
|
bodiedSyncBlockDeletionStatus?: BodiedSyncBlockDeletionStatus;
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* `
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* When the gate is OFF this is always `true` so existing behavior is
|
|
45
|
-
* preserved.
|
|
38
|
+
* Tracks whether the document currently contains any synced block (source or
|
|
39
|
+
* reference). When `false`, downstream work in `appendTransaction`,
|
|
40
|
+
* `decorations`, and the `contentComponent` short-circuits to avoid the
|
|
41
|
+
* per-transition feature tax on the ~99.97% of pages that have no synced
|
|
42
|
+
* blocks (see EDITOR-6586).
|
|
46
43
|
*/
|
|
47
44
|
hasSyncedBlocks: boolean;
|
|
48
45
|
hasUnsavedBodiedSyncBlockChanges?: boolean;
|
|
49
46
|
/**
|
|
50
47
|
* Cached previous values for shared-state signals. Used inside `apply()` to
|
|
51
48
|
* detect when a status change requires a full rebuild of `statusDecorationSet`
|
|
52
|
-
* instead of a cheap `map()` call.
|
|
53
|
-
* `editor_synced_block_perf` is ON.
|
|
49
|
+
* instead of a cheap `map()` call.
|
|
54
50
|
*/
|
|
55
51
|
prevIsDragging: boolean;
|
|
56
52
|
prevIsOffline: boolean;
|
|
@@ -5,8 +5,8 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
5
5
|
*
|
|
6
6
|
* Both `syncBlock` and `bodiedSyncBlock` are top-level nodes in the schema, so
|
|
7
7
|
* a single shallow scan is sufficient — no need for a recursive `descendants`
|
|
8
|
-
* walk. This is used
|
|
9
|
-
*
|
|
8
|
+
* walk. This is used to avoid spinning up the synced block subsystem on
|
|
9
|
+
* documents that don't contain any
|
|
10
10
|
* synced blocks (which is ~99.97% of pages, see EDITOR-6586).
|
|
11
11
|
*/
|
|
12
12
|
export declare const hasSyncedBlocks: (doc: PMNode) => boolean;
|
|
@@ -55,8 +55,7 @@ export type SyncedBlockSharedState = {
|
|
|
55
55
|
/**
|
|
56
56
|
* Whether the document currently contains any synced block (source or
|
|
57
57
|
* reference). Sticky once flipped to `true` for the lifetime of the
|
|
58
|
-
* editor session.
|
|
59
|
-
* always `true`.
|
|
58
|
+
* editor session.
|
|
60
59
|
*/
|
|
61
60
|
hasSyncedBlocks: boolean;
|
|
62
61
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.2",
|
|
4
4
|
"description": "SyncedBlock plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"atlaskit:src": "src/index.ts",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@atlaskit/adf-schema": "^56.5.0",
|
|
24
|
-
"@atlaskit/button": "25.0.
|
|
25
|
-
"@atlaskit/dropdown-menu": "17.2.
|
|
24
|
+
"@atlaskit/button": "25.0.1",
|
|
25
|
+
"@atlaskit/dropdown-menu": "17.2.3",
|
|
26
26
|
"@atlaskit/editor-json-transformer": "^9.2.0",
|
|
27
27
|
"@atlaskit/editor-plugin-analytics": "^13.0.0",
|
|
28
28
|
"@atlaskit/editor-plugin-block-menu": "^12.0.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@atlaskit/editor-synced-block-provider": "^9.0.0",
|
|
39
39
|
"@atlaskit/editor-toolbar": "^2.4.0",
|
|
40
40
|
"@atlaskit/flag": "^18.2.0",
|
|
41
|
-
"@atlaskit/icon": "37.2.
|
|
41
|
+
"@atlaskit/icon": "37.2.4",
|
|
42
42
|
"@atlaskit/icon-lab": "^7.4.0",
|
|
43
43
|
"@atlaskit/logo": "^21.4.0",
|
|
44
44
|
"@atlaskit/lozenge": "^15.0.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^2.1.0",
|
|
47
47
|
"@atlaskit/primitives": "^22.2.0",
|
|
48
48
|
"@atlaskit/spinner": "20.1.1",
|
|
49
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
49
|
+
"@atlaskit/tmp-editor-statsig": "^139.0.0",
|
|
50
50
|
"@atlaskit/tokens": "16.3.0",
|
|
51
51
|
"@atlaskit/tooltip": "^24.0.0",
|
|
52
52
|
"@atlaskit/visually-hidden": "^4.2.0",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"memoize-one": "^6.0.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@atlaskit/editor-common": "^117.
|
|
61
|
+
"@atlaskit/editor-common": "^117.1.0",
|
|
62
62
|
"react": "^18.2.0 || ^19.2.0",
|
|
63
63
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
64
64
|
},
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.BodiedSyncBlockWrapper = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _reactNodeView = require("@atlaskit/editor-common/react-node-view");
|
|
10
|
-
var _editorSyncedBlockProvider = require("@atlaskit/editor-synced-block-provider");
|
|
11
|
-
var _SyncBlockLabel = require("./SyncBlockLabel");
|
|
12
|
-
// Delete this file when cleaning up platform_synced_block_use_new_source_nodeview
|
|
13
|
-
var BodiedSyncBlockWrapper = exports.BodiedSyncBlockWrapper = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
14
|
-
var node = _ref.node,
|
|
15
|
-
syncBlockStore = _ref.syncBlockStore;
|
|
16
|
-
// TODO: EDITOR-2429 - this should be debounced (either here or in the data provider) to avoid excessive API writes
|
|
17
|
-
(0, _editorSyncedBlockProvider.useHandleContentChanges)(syncBlockStore, node);
|
|
18
|
-
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_reactNodeView.NodeViewContentHole, {
|
|
19
|
-
"data-testid": "bodied-sync-block-wrapper",
|
|
20
|
-
ref: ref
|
|
21
|
-
}), /*#__PURE__*/_react.default.createElement(_SyncBlockLabel.SyncBlockLabel, {
|
|
22
|
-
isSource: true,
|
|
23
|
-
localId: node.attrs.localId
|
|
24
|
-
}));
|
|
25
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { NodeViewContentHole } from '@atlaskit/editor-common/react-node-view';
|
|
3
|
-
import { useHandleContentChanges } from '@atlaskit/editor-synced-block-provider';
|
|
4
|
-
import { SyncBlockLabel } from './SyncBlockLabel';
|
|
5
|
-
// Delete this file when cleaning up platform_synced_block_use_new_source_nodeview
|
|
6
|
-
export const BodiedSyncBlockWrapper = /*#__PURE__*/React.forwardRef(({
|
|
7
|
-
node,
|
|
8
|
-
syncBlockStore
|
|
9
|
-
}, ref) => {
|
|
10
|
-
// TODO: EDITOR-2429 - this should be debounced (either here or in the data provider) to avoid excessive API writes
|
|
11
|
-
useHandleContentChanges(syncBlockStore, node);
|
|
12
|
-
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(NodeViewContentHole, {
|
|
13
|
-
"data-testid": "bodied-sync-block-wrapper",
|
|
14
|
-
ref: ref
|
|
15
|
-
}), /*#__PURE__*/React.createElement(SyncBlockLabel, {
|
|
16
|
-
isSource: true,
|
|
17
|
-
localId: node.attrs.localId
|
|
18
|
-
}));
|
|
19
|
-
});
|