@atlaskit/editor-plugin-synced-block 5.1.8 → 5.1.10
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 +20 -0
- package/dist/cjs/editor-commands/index.js +2 -2
- package/dist/cjs/pm-plugins/experience-tracking/create-reference-experience.js +26 -26
- package/dist/cjs/pm-plugins/experience-tracking/create-source-experience.js +14 -30
- package/dist/cjs/pm-plugins/experience-tracking/delete-reference-experience.js +175 -0
- package/dist/cjs/pm-plugins/experience-tracking/delete-source-experience.js +103 -0
- package/dist/cjs/pm-plugins/experience-tracking/get-experience-tracking-plugins.js +30 -0
- package/dist/cjs/pm-plugins/experience-tracking/provider-only-experiences.js +128 -0
- package/dist/cjs/pm-plugins/utils/experience-tracking-utils.js +85 -0
- package/dist/cjs/types/index.js +5 -2
- package/dist/cjs/ui/CreateSyncedBlockDropdownItem.js +40 -8
- package/dist/cjs/ui/DeleteConfirmationModal.js +3 -1
- package/dist/cjs/ui/floating-toolbar.js +4 -2
- package/dist/es2019/editor-commands/index.js +2 -2
- package/dist/es2019/pm-plugins/experience-tracking/create-reference-experience.js +27 -23
- package/dist/es2019/pm-plugins/experience-tracking/create-source-experience.js +14 -27
- package/dist/es2019/pm-plugins/experience-tracking/delete-reference-experience.js +181 -0
- package/dist/es2019/pm-plugins/experience-tracking/delete-source-experience.js +98 -0
- package/dist/es2019/pm-plugins/experience-tracking/get-experience-tracking-plugins.js +24 -0
- package/dist/es2019/pm-plugins/experience-tracking/provider-only-experiences.js +127 -0
- package/dist/es2019/pm-plugins/utils/experience-tracking-utils.js +65 -0
- package/dist/es2019/types/index.js +4 -1
- package/dist/es2019/ui/CreateSyncedBlockDropdownItem.js +38 -3
- package/dist/es2019/ui/DeleteConfirmationModal.js +3 -1
- package/dist/es2019/ui/floating-toolbar.js +3 -1
- package/dist/esm/editor-commands/index.js +2 -2
- package/dist/esm/pm-plugins/experience-tracking/create-reference-experience.js +26 -25
- package/dist/esm/pm-plugins/experience-tracking/create-source-experience.js +14 -29
- package/dist/esm/pm-plugins/experience-tracking/delete-reference-experience.js +169 -0
- package/dist/esm/pm-plugins/experience-tracking/delete-source-experience.js +97 -0
- package/dist/esm/pm-plugins/experience-tracking/get-experience-tracking-plugins.js +30 -0
- package/dist/esm/pm-plugins/experience-tracking/provider-only-experiences.js +122 -0
- package/dist/esm/pm-plugins/utils/experience-tracking-utils.js +79 -0
- package/dist/esm/types/index.js +4 -1
- package/dist/esm/ui/CreateSyncedBlockDropdownItem.js +40 -8
- package/dist/esm/ui/DeleteConfirmationModal.js +3 -1
- package/dist/esm/ui/floating-toolbar.js +4 -2
- package/dist/types/pm-plugins/experience-tracking/create-reference-experience.d.ts +2 -9
- package/dist/types/pm-plugins/experience-tracking/create-source-experience.d.ts +4 -15
- package/dist/types/pm-plugins/experience-tracking/delete-reference-experience.d.ts +13 -0
- package/dist/types/pm-plugins/experience-tracking/delete-source-experience.d.ts +12 -0
- package/dist/types/pm-plugins/experience-tracking/get-experience-tracking-plugins.d.ts +2 -13
- package/dist/types/pm-plugins/experience-tracking/provider-only-experiences.d.ts +3 -0
- package/dist/types/pm-plugins/utils/experience-tracking-utils.d.ts +9 -0
- package/dist/types/types/index.d.ts +15 -0
- package/dist/types-ts4.5/pm-plugins/experience-tracking/create-reference-experience.d.ts +2 -9
- package/dist/types-ts4.5/pm-plugins/experience-tracking/create-source-experience.d.ts +4 -15
- package/dist/types-ts4.5/pm-plugins/experience-tracking/delete-reference-experience.d.ts +13 -0
- package/dist/types-ts4.5/pm-plugins/experience-tracking/delete-source-experience.d.ts +12 -0
- package/dist/types-ts4.5/pm-plugins/experience-tracking/get-experience-tracking-plugins.d.ts +2 -13
- package/dist/types-ts4.5/pm-plugins/experience-tracking/provider-only-experiences.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/utils/experience-tracking-utils.d.ts +9 -0
- package/dist/types-ts4.5/types/index.d.ts +15 -0
- package/package.json +6 -6
- package/build/tsconfig.json +0 -22
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { pmHistoryPluginKey } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { findChildren } from '@atlaskit/editor-prosemirror/utils';
|
|
3
|
+
var targetEl;
|
|
4
|
+
export var getTarget = function getTarget(containerElement) {
|
|
5
|
+
if (!targetEl) {
|
|
6
|
+
var element = containerElement === null || containerElement === void 0 ? void 0 : containerElement.querySelector('.ProseMirror');
|
|
7
|
+
if (!element || !(element instanceof HTMLElement)) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
targetEl = element;
|
|
11
|
+
}
|
|
12
|
+
return targetEl;
|
|
13
|
+
};
|
|
14
|
+
export var wasSyncBlockDeletedOrAddedByHistory = function wasSyncBlockDeletedOrAddedByHistory(tr, oldState, newState) {
|
|
15
|
+
var historyMeta = tr.getMeta(pmHistoryPluginKey);
|
|
16
|
+
if (!Boolean(historyMeta)) {
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
19
|
+
var syncBlock = newState.schema.nodes.syncBlock;
|
|
20
|
+
var oldSyncBlockNodes = findChildren(oldState.doc, function (node) {
|
|
21
|
+
return node.type === syncBlock;
|
|
22
|
+
});
|
|
23
|
+
var newSyncBlockNodes = findChildren(newState.doc, function (node) {
|
|
24
|
+
return node.type === syncBlock;
|
|
25
|
+
});
|
|
26
|
+
var oldSyncBlockIds = new Set(oldSyncBlockNodes.map(function (nodeWithPos) {
|
|
27
|
+
return nodeWithPos.node.attrs.localId;
|
|
28
|
+
}).filter(function (localId) {
|
|
29
|
+
return Boolean(localId);
|
|
30
|
+
}));
|
|
31
|
+
var newSyncBlockIds = new Set(newSyncBlockNodes.map(function (nodeWithPos) {
|
|
32
|
+
return nodeWithPos.node.attrs.localId;
|
|
33
|
+
}).filter(function (localId) {
|
|
34
|
+
return Boolean(localId);
|
|
35
|
+
}));
|
|
36
|
+
var hasDeletedSyncBlock = Array.from(oldSyncBlockIds).some(function (localId) {
|
|
37
|
+
return !newSyncBlockIds.has(localId);
|
|
38
|
+
});
|
|
39
|
+
var hasAddedSyncBlock = Array.from(newSyncBlockIds).some(function (localId) {
|
|
40
|
+
return !oldSyncBlockIds.has(localId);
|
|
41
|
+
});
|
|
42
|
+
return {
|
|
43
|
+
hasDeletedSyncBlock: hasDeletedSyncBlock,
|
|
44
|
+
hasAddedSyncBlock: hasAddedSyncBlock,
|
|
45
|
+
isUndo: historyMeta.redo === false
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
var getResourceIds = function getResourceIds(nodes, resourceIds, query) {
|
|
49
|
+
nodes.forEach(function (node) {
|
|
50
|
+
if (!(node instanceof HTMLElement)) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
var syncBlockElements = node.querySelectorAll(query);
|
|
54
|
+
syncBlockElements.forEach(function (element) {
|
|
55
|
+
var resourceId = element.getAttribute('resourceid');
|
|
56
|
+
if (resourceId) {
|
|
57
|
+
resourceIds.push(resourceId);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
export var getAddedResourceIds = function getAddedResourceIds(mutations, query) {
|
|
63
|
+
var resourceIds = [];
|
|
64
|
+
mutations.forEach(function (mutation) {
|
|
65
|
+
if (mutation.type === 'childList') {
|
|
66
|
+
getResourceIds(mutation.addedNodes, resourceIds, query);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
return resourceIds;
|
|
70
|
+
};
|
|
71
|
+
export var getRemovedResourceIds = function getRemovedResourceIds(mutations, query) {
|
|
72
|
+
var resourceIds = [];
|
|
73
|
+
mutations.forEach(function (mutation) {
|
|
74
|
+
if (mutation.type === 'childList') {
|
|
75
|
+
getResourceIds(mutation.removedNodes, resourceIds, query);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return resourceIds;
|
|
79
|
+
};
|
package/dist/esm/types/index.js
CHANGED
|
@@ -5,4 +5,7 @@ export var FLAG_ID = /*#__PURE__*/function (FLAG_ID) {
|
|
|
5
5
|
FLAG_ID["FAIL_TO_DELETE"] = "fail-to-delete";
|
|
6
6
|
FLAG_ID["SYNC_BLOCK_COPIED"] = "sync-block-copied";
|
|
7
7
|
return FLAG_ID;
|
|
8
|
-
}({});
|
|
8
|
+
}({});
|
|
9
|
+
export var EXPERIENCE_ABORT_REASON = {
|
|
10
|
+
EDITOR_DESTROYED: 'editor-destroyed'
|
|
11
|
+
};
|
|
@@ -42,24 +42,56 @@ var CreateSyncedBlockDropdownItem = function CreateSyncedBlockDropdownItem(_ref)
|
|
|
42
42
|
}),
|
|
43
43
|
onClick: onClick,
|
|
44
44
|
isDisabled: isOffline,
|
|
45
|
-
testId:
|
|
45
|
+
testId: "create-synced-block-block-menu-btn",
|
|
46
46
|
elemAfter: /*#__PURE__*/React.createElement(Lozenge, {
|
|
47
47
|
appearance: "new"
|
|
48
48
|
}, formatMessage(blockMenuMessages.newLozenge))
|
|
49
49
|
}, formatMessage(blockMenuMessages.createSyncedBlock));
|
|
50
50
|
};
|
|
51
|
-
|
|
52
|
-
var
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
var _useSharedPluginState2 = useSharedPluginStateWithSelector(api, ['
|
|
51
|
+
var CopySyncedBlockDropdownItem = function CopySyncedBlockDropdownItem(_ref2) {
|
|
52
|
+
var api = _ref2.api;
|
|
53
|
+
var _useIntl2 = useIntl(),
|
|
54
|
+
formatMessage = _useIntl2.formatMessage;
|
|
55
|
+
var _useSharedPluginState2 = useSharedPluginStateWithSelector(api, ['connectivity'], function (states) {
|
|
56
|
+
var _states$connectivityS2;
|
|
57
|
+
return {
|
|
58
|
+
mode: (_states$connectivityS2 = states.connectivityState) === null || _states$connectivityS2 === void 0 ? void 0 : _states$connectivityS2.mode
|
|
59
|
+
};
|
|
60
|
+
}),
|
|
61
|
+
mode = _useSharedPluginState2.mode;
|
|
62
|
+
var onClick = function onClick() {
|
|
63
|
+
var _api$core3, _api$core4, _api$blockControls2;
|
|
64
|
+
api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(api === null || api === void 0 ? void 0 : api.syncedBlock.commands.copySyncedBlockReferenceToClipboard());
|
|
65
|
+
api === null || api === void 0 || (_api$core4 = api.core) === null || _api$core4 === void 0 || _api$core4.actions.execute(api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.commands) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.toggleBlockMenu({
|
|
66
|
+
closeMenu: true
|
|
67
|
+
}));
|
|
68
|
+
};
|
|
69
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
70
|
+
elemBefore: /*#__PURE__*/React.createElement(SyncBlocksIcon, {
|
|
71
|
+
label: ""
|
|
72
|
+
}),
|
|
73
|
+
onClick: onClick,
|
|
74
|
+
isDisabled: isOfflineMode(mode),
|
|
75
|
+
elemAfter: /*#__PURE__*/React.createElement(Lozenge, {
|
|
76
|
+
appearance: "new"
|
|
77
|
+
}, formatMessage(blockMenuMessages.newLozenge))
|
|
78
|
+
}, formatMessage(blockMenuMessages.copySyncedBlock));
|
|
79
|
+
};
|
|
80
|
+
export var CreateOrCopySyncedBlockDropdownItem = function CreateOrCopySyncedBlockDropdownItem(_ref3) {
|
|
81
|
+
var api = _ref3.api,
|
|
82
|
+
enableSourceSyncedBlockCreation = _ref3.enableSourceSyncedBlockCreation;
|
|
83
|
+
var _useSharedPluginState3 = useSharedPluginStateWithSelector(api, ['blockControls'], function (states) {
|
|
56
84
|
var _states$blockControls3, _states$blockControls4;
|
|
57
85
|
return {
|
|
58
86
|
menuTriggerByNode: (_states$blockControls3 = (_states$blockControls4 = states.blockControlsState) === null || _states$blockControls4 === void 0 ? void 0 : _states$blockControls4.menuTriggerByNode) !== null && _states$blockControls3 !== void 0 ? _states$blockControls3 : undefined
|
|
59
87
|
};
|
|
60
88
|
}),
|
|
61
|
-
menuTriggerByNode =
|
|
62
|
-
if (
|
|
89
|
+
menuTriggerByNode = _useSharedPluginState3.menuTriggerByNode;
|
|
90
|
+
if ((menuTriggerByNode === null || menuTriggerByNode === void 0 ? void 0 : menuTriggerByNode.nodeType) === 'syncBlock' || (menuTriggerByNode === null || menuTriggerByNode === void 0 ? void 0 : menuTriggerByNode.nodeType) === 'bodiedSyncBlock') {
|
|
91
|
+
return /*#__PURE__*/React.createElement(CopySyncedBlockDropdownItem, {
|
|
92
|
+
api: api
|
|
93
|
+
});
|
|
94
|
+
} else if (enableSourceSyncedBlockCreation) {
|
|
63
95
|
return /*#__PURE__*/React.createElement(CreateSyncedBlockDropdownItem, {
|
|
64
96
|
api: api
|
|
65
97
|
});
|
|
@@ -6,6 +6,7 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
6
6
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
7
|
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
8
8
|
import ModalDialog, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { Text } from '@atlaskit/primitives/compiled';
|
|
10
11
|
import { syncedBlockPluginKey } from '../pm-plugins/main';
|
|
11
12
|
export var DeleteConfirmationModal = function DeleteConfirmationModal(_ref) {
|
|
@@ -108,6 +109,7 @@ export var DeleteConfirmationModal = function DeleteConfirmationModal(_ref) {
|
|
|
108
109
|
onClick: handleClick(true),
|
|
109
110
|
autoFocus: true,
|
|
110
111
|
isDisabled: isOfflineMode(mode),
|
|
111
|
-
isLoading: bodiedSyncBlockDeletionStatus === 'processing'
|
|
112
|
+
isLoading: bodiedSyncBlockDeletionStatus === 'processing',
|
|
113
|
+
testId: fg('platform_synced_block_dogfooding') ? 'synced-block-delete-confirmation-modal-delete-button' : undefined
|
|
112
114
|
}, formatMessage(messages.deleteConfirmationModalDeleteButton)))));
|
|
113
115
|
};
|
|
@@ -9,6 +9,7 @@ import { SyncBlockError } from '@atlaskit/editor-synced-block-provider';
|
|
|
9
9
|
import CopyIcon from '@atlaskit/icon/core/copy';
|
|
10
10
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
11
11
|
import EditIcon from '@atlaskit/icon/core/edit';
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
13
|
import { copySyncedBlockReferenceToClipboard, editSyncedBlockSource, removeSyncedBlock } from '../editor-commands';
|
|
13
14
|
import { findSyncBlockOrBodiedSyncBlock, isBodiedSyncBlockNode } from '../pm-plugins/utils/utils';
|
|
14
15
|
export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBlockStore) {
|
|
@@ -38,7 +39,8 @@ export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBl
|
|
|
38
39
|
type: 'button',
|
|
39
40
|
title: formatMessage(commonMessages.delete),
|
|
40
41
|
onClick: removeSyncedBlock(api),
|
|
41
|
-
icon: DeleteIcon
|
|
42
|
+
icon: DeleteIcon,
|
|
43
|
+
testId: fg('platform_synced_block_dogfooding') ? 'reference-synced-block-delete-button' : undefined
|
|
42
44
|
}, hoverDecorationProps(nodeType, akEditorSelectedNodeClassName));
|
|
43
45
|
items.push(deleteButton);
|
|
44
46
|
} else {
|
|
@@ -49,7 +51,7 @@ export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBl
|
|
|
49
51
|
icon: CopyIcon,
|
|
50
52
|
title: formatMessage(messages.copySyncBlockLabel),
|
|
51
53
|
showTitle: false,
|
|
52
|
-
tooltipContent: formatMessage(messages.
|
|
54
|
+
tooltipContent: formatMessage(messages.copySyncedBlockTooltip),
|
|
53
55
|
onClick: copySyncedBlockReferenceToClipboard(syncBlockStore, api)
|
|
54
56
|
}, hoverDecorationProps(nodeType, akEditorSelectedNodeClassName));
|
|
55
57
|
items.push(copyButton);
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import { type DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
2
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
type
|
|
4
|
-
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
5
|
-
refs: {
|
|
6
|
-
containerElement?: HTMLElement;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
2
|
+
import { type ExperienceOptions } from '../../types';
|
|
9
3
|
/**
|
|
10
4
|
* This experience tracks when a reference sync block is inserted.
|
|
11
5
|
*
|
|
@@ -13,5 +7,4 @@ type CreateReferenceExperienceOptions = {
|
|
|
13
7
|
* Success: When the sync block is added to the DOM within 500ms of start
|
|
14
8
|
* Failure: When 500ms passes without the reference sync block being added to the DOM
|
|
15
9
|
*/
|
|
16
|
-
export declare const getCreateReferenceExperiencePlugin: ({ refs, dispatchAnalyticsEvent, }:
|
|
17
|
-
export {};
|
|
10
|
+
export declare const getCreateReferenceExperiencePlugin: ({ refs, dispatchAnalyticsEvent, }: ExperienceOptions) => SafePlugin<any>;
|
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
import { type DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
2
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
import type
|
|
4
|
-
type CreateSourceExperienceOptions = {
|
|
5
|
-
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
6
|
-
refs: {
|
|
7
|
-
containerElement?: HTMLElement;
|
|
8
|
-
popupsMountPoint?: HTMLElement;
|
|
9
|
-
wrapperElement?: HTMLElement;
|
|
10
|
-
};
|
|
11
|
-
syncBlockStore: SyncBlockStoreManager;
|
|
12
|
-
};
|
|
2
|
+
import { type ProviderExperienceOptions } from '../../types';
|
|
13
3
|
/**
|
|
14
4
|
* This experience tracks when a source sync block is inserted.
|
|
15
5
|
*
|
|
16
6
|
* Start: When user inserts a sync block via block menu, quick insert or pinned toolbar
|
|
17
|
-
* Success: When the sync block is added to the DOM within
|
|
18
|
-
* Failure: When
|
|
7
|
+
* Success: When the sync block is added to the DOM within 3000ms of start
|
|
8
|
+
* Failure: When 3000ms passes without the source sync block being added to the DOM
|
|
19
9
|
*/
|
|
20
|
-
export declare const getCreateSourceExperiencePlugin: ({ refs, dispatchAnalyticsEvent, syncBlockStore, }:
|
|
21
|
-
export {};
|
|
10
|
+
export declare const getCreateSourceExperiencePlugin: ({ refs, dispatchAnalyticsEvent, syncBlockStore, }: ProviderExperienceOptions) => SafePlugin<any>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Experience } from '@atlaskit/editor-common/experiences';
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import { type ExperienceOptions, type ProviderExperienceOptions } from '../../types';
|
|
4
|
+
/**
|
|
5
|
+
* This experience tracks when a reference sync block is deleted.
|
|
6
|
+
*
|
|
7
|
+
* Start: When user deletes ref sync block from toolbar, presses delete when cursor is in front of ref sync block,
|
|
8
|
+
* presses any key with a ref sync block selected, cuts with a ref sync block selected, triggers undo/redo that deletes a ref sync block
|
|
9
|
+
* Success: When the sync block is removed from the DOM within 2000ms of start
|
|
10
|
+
* Failure: When 2000ms passes without the reference sync block being removed from the DOM
|
|
11
|
+
*/
|
|
12
|
+
export declare const getDeleteReferenceExperiencePlugin: ({ refs, dispatchAnalyticsEvent, syncBlockStore, }: ProviderExperienceOptions) => SafePlugin<any>;
|
|
13
|
+
export declare const getDeleteReferenceExperience: ({ refs, dispatchAnalyticsEvent }: ExperienceOptions) => Experience;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Experience } from '@atlaskit/editor-common/experiences';
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import { type ExperienceOptions, type ProviderExperienceOptions } from '../../types';
|
|
4
|
+
/**
|
|
5
|
+
* This experience tracks when a source sync block is deleted.
|
|
6
|
+
*
|
|
7
|
+
* Start: When user clicks the delete button in the delete modal
|
|
8
|
+
* Success: When the sync block is removed from the DOM within 2000ms of start
|
|
9
|
+
* Failure: When 2000ms passes without the source sync block being removed from the DOM
|
|
10
|
+
*/
|
|
11
|
+
export declare const getDeleteSourceExperiencePlugin: ({ refs, dispatchAnalyticsEvent, syncBlockStore, }: ProviderExperienceOptions) => SafePlugin<any>;
|
|
12
|
+
export declare const getDeleteSourceExperience: ({ refs, dispatchAnalyticsEvent }: ExperienceOptions) => Experience;
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
type ExperienceTrackingPluginsProps = {
|
|
4
|
-
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
5
|
-
refs: {
|
|
6
|
-
containerElement?: HTMLElement;
|
|
7
|
-
popupsMountPoint?: HTMLElement;
|
|
8
|
-
wrapperElement?: HTMLElement;
|
|
9
|
-
};
|
|
10
|
-
syncBlockStore: SyncBlockStoreManager;
|
|
11
|
-
};
|
|
12
|
-
export declare const getExperienceTrackingPlugins: ({ refs, dispatchAnalyticsEvent, syncBlockStore }: ExperienceTrackingPluginsProps) => {
|
|
1
|
+
import type { ProviderExperienceOptions } from "../../types";
|
|
2
|
+
export declare const getExperienceTrackingPlugins: ({ refs, dispatchAnalyticsEvent, syncBlockStore }: ProviderExperienceOptions) => {
|
|
13
3
|
name: string;
|
|
14
4
|
plugin: () => import("@atlaskit/editor-common/safe-plugin").SafePlugin<any>;
|
|
15
5
|
}[];
|
|
16
|
-
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { type ProviderExperienceOptions } from '../../types';
|
|
3
|
+
export declare const getProviderOnlyExperiencesPlugin: ({ refs, dispatchAnalyticsEvent, syncBlockStore }: ProviderExperienceOptions) => SafePlugin<any>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { EditorState, Transaction } from "@atlaskit/editor-prosemirror/state";
|
|
2
|
+
export declare const getTarget: (containerElement: HTMLElement | undefined) => HTMLElement | null;
|
|
3
|
+
export declare const wasSyncBlockDeletedOrAddedByHistory: (tr: Transaction, oldState: EditorState, newState: EditorState) => {
|
|
4
|
+
hasAddedSyncBlock?: boolean;
|
|
5
|
+
hasDeletedSyncBlock?: boolean;
|
|
6
|
+
isUndo?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const getAddedResourceIds: (mutations: MutationRecord[], query: string) => string[];
|
|
9
|
+
export declare const getRemovedResourceIds: (mutations: MutationRecord[], query: string) => string[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DispatchAnalyticsEvent } from "@atlaskit/editor-common/analytics";
|
|
1
2
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
3
|
import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
3
4
|
export declare enum FLAG_ID {
|
|
@@ -40,4 +41,18 @@ export type SyncBlockInfo = {
|
|
|
40
41
|
export type SyncBlockMap = {
|
|
41
42
|
[key: string]: SyncBlockInfo;
|
|
42
43
|
};
|
|
44
|
+
export type ExperienceOptions = {
|
|
45
|
+
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
46
|
+
refs: {
|
|
47
|
+
containerElement?: HTMLElement;
|
|
48
|
+
popupsMountPoint?: HTMLElement;
|
|
49
|
+
wrapperElement?: HTMLElement;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export type ProviderExperienceOptions = ExperienceOptions & {
|
|
53
|
+
syncBlockStore: SyncBlockStoreManager;
|
|
54
|
+
};
|
|
55
|
+
export declare const EXPERIENCE_ABORT_REASON: {
|
|
56
|
+
EDITOR_DESTROYED: string;
|
|
57
|
+
};
|
|
43
58
|
export {};
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import { type DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
2
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
type
|
|
4
|
-
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
5
|
-
refs: {
|
|
6
|
-
containerElement?: HTMLElement;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
2
|
+
import { type ExperienceOptions } from '../../types';
|
|
9
3
|
/**
|
|
10
4
|
* This experience tracks when a reference sync block is inserted.
|
|
11
5
|
*
|
|
@@ -13,5 +7,4 @@ type CreateReferenceExperienceOptions = {
|
|
|
13
7
|
* Success: When the sync block is added to the DOM within 500ms of start
|
|
14
8
|
* Failure: When 500ms passes without the reference sync block being added to the DOM
|
|
15
9
|
*/
|
|
16
|
-
export declare const getCreateReferenceExperiencePlugin: ({ refs, dispatchAnalyticsEvent, }:
|
|
17
|
-
export {};
|
|
10
|
+
export declare const getCreateReferenceExperiencePlugin: ({ refs, dispatchAnalyticsEvent, }: ExperienceOptions) => SafePlugin<any>;
|
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
import { type DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
2
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
import type
|
|
4
|
-
type CreateSourceExperienceOptions = {
|
|
5
|
-
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
6
|
-
refs: {
|
|
7
|
-
containerElement?: HTMLElement;
|
|
8
|
-
popupsMountPoint?: HTMLElement;
|
|
9
|
-
wrapperElement?: HTMLElement;
|
|
10
|
-
};
|
|
11
|
-
syncBlockStore: SyncBlockStoreManager;
|
|
12
|
-
};
|
|
2
|
+
import { type ProviderExperienceOptions } from '../../types';
|
|
13
3
|
/**
|
|
14
4
|
* This experience tracks when a source sync block is inserted.
|
|
15
5
|
*
|
|
16
6
|
* Start: When user inserts a sync block via block menu, quick insert or pinned toolbar
|
|
17
|
-
* Success: When the sync block is added to the DOM within
|
|
18
|
-
* Failure: When
|
|
7
|
+
* Success: When the sync block is added to the DOM within 3000ms of start
|
|
8
|
+
* Failure: When 3000ms passes without the source sync block being added to the DOM
|
|
19
9
|
*/
|
|
20
|
-
export declare const getCreateSourceExperiencePlugin: ({ refs, dispatchAnalyticsEvent, syncBlockStore, }:
|
|
21
|
-
export {};
|
|
10
|
+
export declare const getCreateSourceExperiencePlugin: ({ refs, dispatchAnalyticsEvent, syncBlockStore, }: ProviderExperienceOptions) => SafePlugin<any>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Experience } from '@atlaskit/editor-common/experiences';
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import { type ExperienceOptions, type ProviderExperienceOptions } from '../../types';
|
|
4
|
+
/**
|
|
5
|
+
* This experience tracks when a reference sync block is deleted.
|
|
6
|
+
*
|
|
7
|
+
* Start: When user deletes ref sync block from toolbar, presses delete when cursor is in front of ref sync block,
|
|
8
|
+
* presses any key with a ref sync block selected, cuts with a ref sync block selected, triggers undo/redo that deletes a ref sync block
|
|
9
|
+
* Success: When the sync block is removed from the DOM within 2000ms of start
|
|
10
|
+
* Failure: When 2000ms passes without the reference sync block being removed from the DOM
|
|
11
|
+
*/
|
|
12
|
+
export declare const getDeleteReferenceExperiencePlugin: ({ refs, dispatchAnalyticsEvent, syncBlockStore, }: ProviderExperienceOptions) => SafePlugin<any>;
|
|
13
|
+
export declare const getDeleteReferenceExperience: ({ refs, dispatchAnalyticsEvent }: ExperienceOptions) => Experience;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Experience } from '@atlaskit/editor-common/experiences';
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import { type ExperienceOptions, type ProviderExperienceOptions } from '../../types';
|
|
4
|
+
/**
|
|
5
|
+
* This experience tracks when a source sync block is deleted.
|
|
6
|
+
*
|
|
7
|
+
* Start: When user clicks the delete button in the delete modal
|
|
8
|
+
* Success: When the sync block is removed from the DOM within 2000ms of start
|
|
9
|
+
* Failure: When 2000ms passes without the source sync block being removed from the DOM
|
|
10
|
+
*/
|
|
11
|
+
export declare const getDeleteSourceExperiencePlugin: ({ refs, dispatchAnalyticsEvent, syncBlockStore, }: ProviderExperienceOptions) => SafePlugin<any>;
|
|
12
|
+
export declare const getDeleteSourceExperience: ({ refs, dispatchAnalyticsEvent }: ExperienceOptions) => Experience;
|
package/dist/types-ts4.5/pm-plugins/experience-tracking/get-experience-tracking-plugins.d.ts
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
type ExperienceTrackingPluginsProps = {
|
|
4
|
-
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
5
|
-
refs: {
|
|
6
|
-
containerElement?: HTMLElement;
|
|
7
|
-
popupsMountPoint?: HTMLElement;
|
|
8
|
-
wrapperElement?: HTMLElement;
|
|
9
|
-
};
|
|
10
|
-
syncBlockStore: SyncBlockStoreManager;
|
|
11
|
-
};
|
|
12
|
-
export declare const getExperienceTrackingPlugins: ({ refs, dispatchAnalyticsEvent, syncBlockStore }: ExperienceTrackingPluginsProps) => {
|
|
1
|
+
import type { ProviderExperienceOptions } from "../../types";
|
|
2
|
+
export declare const getExperienceTrackingPlugins: ({ refs, dispatchAnalyticsEvent, syncBlockStore }: ProviderExperienceOptions) => {
|
|
13
3
|
name: string;
|
|
14
4
|
plugin: () => import("@atlaskit/editor-common/safe-plugin").SafePlugin<any>;
|
|
15
5
|
}[];
|
|
16
|
-
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { type ProviderExperienceOptions } from '../../types';
|
|
3
|
+
export declare const getProviderOnlyExperiencesPlugin: ({ refs, dispatchAnalyticsEvent, syncBlockStore }: ProviderExperienceOptions) => SafePlugin<any>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { EditorState, Transaction } from "@atlaskit/editor-prosemirror/state";
|
|
2
|
+
export declare const getTarget: (containerElement: HTMLElement | undefined) => HTMLElement | null;
|
|
3
|
+
export declare const wasSyncBlockDeletedOrAddedByHistory: (tr: Transaction, oldState: EditorState, newState: EditorState) => {
|
|
4
|
+
hasAddedSyncBlock?: boolean;
|
|
5
|
+
hasDeletedSyncBlock?: boolean;
|
|
6
|
+
isUndo?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const getAddedResourceIds: (mutations: MutationRecord[], query: string) => string[];
|
|
9
|
+
export declare const getRemovedResourceIds: (mutations: MutationRecord[], query: string) => string[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DispatchAnalyticsEvent } from "@atlaskit/editor-common/analytics";
|
|
1
2
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
3
|
import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
3
4
|
export declare enum FLAG_ID {
|
|
@@ -40,4 +41,18 @@ export type SyncBlockInfo = {
|
|
|
40
41
|
export type SyncBlockMap = {
|
|
41
42
|
[key: string]: SyncBlockInfo;
|
|
42
43
|
};
|
|
44
|
+
export type ExperienceOptions = {
|
|
45
|
+
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
46
|
+
refs: {
|
|
47
|
+
containerElement?: HTMLElement;
|
|
48
|
+
popupsMountPoint?: HTMLElement;
|
|
49
|
+
wrapperElement?: HTMLElement;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export type ProviderExperienceOptions = ExperienceOptions & {
|
|
53
|
+
syncBlockStore: SyncBlockStoreManager;
|
|
54
|
+
};
|
|
55
|
+
export declare const EXPERIENCE_ABORT_REASON: {
|
|
56
|
+
EDITOR_DESTROYED: string;
|
|
57
|
+
};
|
|
43
58
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.10",
|
|
4
4
|
"description": "SyncedBlock plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -39,18 +39,18 @@
|
|
|
39
39
|
"@atlaskit/editor-plugin-selection": "^7.0.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "^7.2.0",
|
|
41
41
|
"@atlaskit/editor-shared-styles": "^3.10.0",
|
|
42
|
-
"@atlaskit/editor-synced-block-provider": "^3.
|
|
42
|
+
"@atlaskit/editor-synced-block-provider": "^3.6.0",
|
|
43
43
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
44
44
|
"@atlaskit/editor-toolbar": "^0.19.0",
|
|
45
45
|
"@atlaskit/flag": "^17.8.0",
|
|
46
46
|
"@atlaskit/icon": "29.4.1",
|
|
47
47
|
"@atlaskit/icon-lab": "^5.14.0",
|
|
48
48
|
"@atlaskit/lozenge": "^13.3.0",
|
|
49
|
-
"@atlaskit/modal-dialog": "^14.
|
|
49
|
+
"@atlaskit/modal-dialog": "^14.10.0",
|
|
50
50
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
51
51
|
"@atlaskit/primitives": "^17.0.0",
|
|
52
|
-
"@atlaskit/tmp-editor-statsig": "^16.
|
|
53
|
-
"@atlaskit/tokens": "9.1.
|
|
52
|
+
"@atlaskit/tmp-editor-statsig": "^16.19.0",
|
|
53
|
+
"@atlaskit/tokens": "9.1.2",
|
|
54
54
|
"@atlaskit/tooltip": "^20.14.0",
|
|
55
55
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
56
56
|
"@babel/runtime": "^7.0.0",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@atlaskit/editor-common": "^111.
|
|
61
|
+
"@atlaskit/editor-common": "^111.8.0",
|
|
62
62
|
"react": "^18.2.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
package/build/tsconfig.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../tsconfig",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"paths": {}
|
|
6
|
-
},
|
|
7
|
-
"include": [
|
|
8
|
-
"../src/**/*.ts",
|
|
9
|
-
"../src/**/*.tsx"
|
|
10
|
-
],
|
|
11
|
-
"exclude": [
|
|
12
|
-
"../src/**/__tests__/*",
|
|
13
|
-
"../src/**/*.test.*",
|
|
14
|
-
"../src/**/test.*",
|
|
15
|
-
"../src/**/examples.*",
|
|
16
|
-
"../src/**/examples/*",
|
|
17
|
-
"../src/**/examples/**/*",
|
|
18
|
-
"../src/**/*.stories.*",
|
|
19
|
-
"../src/**/stories/*",
|
|
20
|
-
"../src/**/stories/**/*"
|
|
21
|
-
]
|
|
22
|
-
}
|