@atlaskit/editor-plugin-synced-block 4.4.0 → 4.5.0
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 +22 -0
- package/afm-cc/tsconfig.json +2 -1
- package/afm-jira/tsconfig.json +2 -1
- package/afm-products/tsconfig.json +2 -1
- package/dist/cjs/nodeviews/syncedBlock.js +2 -1
- package/dist/cjs/pm-plugins/main.js +57 -36
- package/dist/cjs/pm-plugins/utils/handle-bodied-sync-block-removal.js +87 -0
- package/dist/cjs/syncedBlockPlugin.js +6 -4
- package/dist/cjs/types/index.js +1 -0
- package/dist/cjs/ui/DeleteConfirmationModal.js +53 -12
- package/dist/cjs/ui/Flag.js +44 -17
- package/dist/cjs/ui/SyncBlockRendererWrapper.js +4 -2
- package/dist/es2019/nodeviews/syncedBlock.js +2 -1
- package/dist/es2019/pm-plugins/main.js +56 -33
- package/dist/es2019/pm-plugins/utils/handle-bodied-sync-block-removal.js +74 -0
- package/dist/es2019/syncedBlockPlugin.js +6 -4
- package/dist/es2019/types/index.js +1 -0
- package/dist/es2019/ui/DeleteConfirmationModal.js +56 -12
- package/dist/es2019/ui/Flag.js +43 -13
- package/dist/es2019/ui/SyncBlockRendererWrapper.js +4 -2
- package/dist/esm/nodeviews/syncedBlock.js +2 -1
- package/dist/esm/pm-plugins/main.js +57 -37
- package/dist/esm/pm-plugins/utils/handle-bodied-sync-block-removal.js +80 -0
- package/dist/esm/syncedBlockPlugin.js +6 -4
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/ui/DeleteConfirmationModal.js +53 -12
- package/dist/esm/ui/Flag.js +44 -17
- package/dist/esm/ui/SyncBlockRendererWrapper.js +4 -2
- package/dist/types/pm-plugins/main.d.ts +3 -2
- package/dist/types/pm-plugins/utils/handle-bodied-sync-block-removal.d.ts +9 -0
- package/dist/types/pm-plugins/utils/track-sync-blocks.d.ts +2 -11
- package/dist/types/syncedBlockPluginType.d.ts +2 -5
- package/dist/types/types/index.d.ts +28 -2
- package/dist/types/ui/CreateSyncedBlockButton.d.ts +1 -1
- package/dist/types/ui/OverflowMenuSection.d.ts +1 -1
- package/dist/types/ui/SyncBlockRendererWrapper.d.ts +5 -3
- package/dist/types-ts4.5/pm-plugins/main.d.ts +3 -2
- package/dist/types-ts4.5/pm-plugins/utils/handle-bodied-sync-block-removal.d.ts +9 -0
- package/dist/types-ts4.5/pm-plugins/utils/track-sync-blocks.d.ts +2 -11
- package/dist/types-ts4.5/syncedBlockPluginType.d.ts +2 -5
- package/dist/types-ts4.5/types/index.d.ts +28 -2
- package/dist/types-ts4.5/ui/CreateSyncedBlockButton.d.ts +1 -1
- package/dist/types-ts4.5/ui/OverflowMenuSection.d.ts +1 -1
- package/dist/types-ts4.5/ui/SyncBlockRendererWrapper.d.ts +5 -3
- package/package.json +7 -7
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
3
|
import type { UseFetchSyncBlockDataResult } from '@atlaskit/editor-synced-block-provider';
|
|
3
|
-
import type { SyncedBlockRendererProps } from '../syncedBlockPluginType';
|
|
4
|
+
import type { SyncedBlockPlugin, SyncedBlockRendererProps } from '../syncedBlockPluginType';
|
|
4
5
|
type Props = {
|
|
5
|
-
|
|
6
|
+
api?: ExtractInjectionAPI<SyncedBlockPlugin>;
|
|
6
7
|
localId: string;
|
|
8
|
+
syncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
7
9
|
useFetchSyncBlockData: () => UseFetchSyncBlockDataResult;
|
|
8
10
|
useFetchSyncBlockTitle: () => string | undefined;
|
|
9
11
|
};
|
|
10
|
-
export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({ syncedBlockRenderer, useFetchSyncBlockData, localId, useFetchSyncBlockTitle, }: Props) => React.JSX.Element>;
|
|
12
|
+
export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({ syncedBlockRenderer, useFetchSyncBlockData, localId, useFetchSyncBlockTitle, api, }: Props) => React.JSX.Element>;
|
|
11
13
|
export {};
|
|
@@ -4,11 +4,12 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
|
4
4
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import { type SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
6
6
|
import type { SyncedBlockPlugin, SyncedBlockPluginOptions } from '../syncedBlockPluginType';
|
|
7
|
-
import {
|
|
7
|
+
import { type ActiveFlag, type BodiedSyncBlockDeletionStatus } from '../types';
|
|
8
8
|
export declare const syncedBlockPluginKey: PluginKey<any>;
|
|
9
9
|
type SyncedBlockPluginState = {
|
|
10
|
+
activeFlag: ActiveFlag;
|
|
11
|
+
bodiedSyncBlockDeletionStatus?: BodiedSyncBlockDeletionStatus;
|
|
10
12
|
selectionDecorationSet: DecorationSet;
|
|
11
|
-
showFlag: FLAG_ID | false;
|
|
12
13
|
syncBlockStore: SyncBlockStoreManager;
|
|
13
14
|
};
|
|
14
15
|
export declare const createPlugin: (options: SyncedBlockPluginOptions | undefined, pmPluginFactoryParams: PMPluginFactoryParams, syncBlockStore: SyncBlockStoreManager, api?: ExtractInjectionAPI<SyncedBlockPlugin>) => SafePlugin<SyncedBlockPluginState>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
4
|
+
import type { SyncedBlockPlugin } from '../../syncedBlockPluginType';
|
|
5
|
+
import { type SyncBlockInfo } from '../../types';
|
|
6
|
+
export type ConfirmationTransactionRef = {
|
|
7
|
+
current: Transaction | undefined;
|
|
8
|
+
};
|
|
9
|
+
export declare const handleBodiedSyncBlockRemoval: (tr: Transaction, bodiedSyncBlockRemoved: SyncBlockInfo[], syncBlockStore: SyncBlockStoreManager, api: ExtractInjectionAPI<SyncedBlockPlugin> | undefined, confirmationTransactionRef: ConfirmationTransactionRef) => boolean;
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import type { SyncBlockAttrs } from '../../syncedBlockPluginType';
|
|
4
3
|
export declare const trackSyncBlocks: (predicate: (node: PMNode) => boolean, tr: Transaction, state: EditorState) => {
|
|
5
|
-
removed:
|
|
6
|
-
|
|
7
|
-
from?: number;
|
|
8
|
-
to?: number;
|
|
9
|
-
}[];
|
|
10
|
-
added: {
|
|
11
|
-
attrs: SyncBlockAttrs;
|
|
12
|
-
from?: number;
|
|
13
|
-
to?: number;
|
|
14
|
-
}[];
|
|
4
|
+
removed: import("../../types").SyncBlockInfo[];
|
|
5
|
+
added: import("../../types").SyncBlockInfo[];
|
|
15
6
|
};
|
|
16
7
|
/**
|
|
17
8
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
2
|
-
import type { EditorCommand, LongPressSelectionPluginOptions, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { EditorCommand, ExtractInjectionAPI, LongPressSelectionPluginOptions, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
4
4
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
5
|
import type { BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls';
|
|
@@ -36,6 +36,7 @@ export type SyncedBlockEditorProps = {
|
|
|
36
36
|
popupsMountPoint: HTMLElement;
|
|
37
37
|
};
|
|
38
38
|
export type SyncedBlockRendererProps = {
|
|
39
|
+
api?: ExtractInjectionAPI<SyncedBlockPlugin>;
|
|
39
40
|
useFetchSyncBlockData: () => UseFetchSyncBlockDataResult;
|
|
40
41
|
};
|
|
41
42
|
export interface SyncedBlockPluginOptions extends LongPressSelectionPluginOptions {
|
|
@@ -71,7 +72,3 @@ export type SyncedBlockPlugin = NextEditorPlugin<'syncedBlock', {
|
|
|
71
72
|
pluginConfiguration: SyncedBlockPluginOptions | undefined;
|
|
72
73
|
sharedState: SyncedBlockSharedState | undefined;
|
|
73
74
|
}>;
|
|
74
|
-
export type SyncBlockAttrs = {
|
|
75
|
-
localId: string;
|
|
76
|
-
resourceId: string;
|
|
77
|
-
};
|
|
@@ -1,16 +1,42 @@
|
|
|
1
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
1
2
|
import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
2
3
|
export declare enum FLAG_ID {
|
|
3
4
|
CANNOT_DELETE_WHEN_OFFLINE = "cannot-delete-when-offline",
|
|
4
5
|
CANNOT_EDIT_WHEN_OFFLINE = "cannot-edit-when-offline",
|
|
5
|
-
CANNOT_CREATE_WHEN_OFFLINE = "cannot-create-when-offline"
|
|
6
|
+
CANNOT_CREATE_WHEN_OFFLINE = "cannot-create-when-offline",
|
|
7
|
+
FAIL_TO_DELETE = "fail-to-delete"
|
|
6
8
|
}
|
|
9
|
+
type FlagConfig = {
|
|
10
|
+
id: FLAG_ID;
|
|
11
|
+
onDismissed?: (tr: Transaction) => Transaction | void;
|
|
12
|
+
onRetry?: () => void;
|
|
13
|
+
};
|
|
14
|
+
export type BodiedSyncBlockDeletionStatus = 'none' | 'processing' | 'completed';
|
|
15
|
+
export type ActiveFlag = FlagConfig | false;
|
|
7
16
|
export type SyncedBlockSharedState = {
|
|
8
17
|
/**
|
|
9
18
|
* Whether to show a flag (usually for errors, e.g. fail to delete)
|
|
10
19
|
*/
|
|
11
|
-
|
|
20
|
+
activeFlag: ActiveFlag;
|
|
21
|
+
/**
|
|
22
|
+
* Whether the plugin is currently saving bodiedSyncBlock deletion to backend
|
|
23
|
+
*/
|
|
24
|
+
bodiedSyncBlockDeletionStatus?: BodiedSyncBlockDeletionStatus;
|
|
12
25
|
/**
|
|
13
26
|
* The current sync block store manager, used to manage fetching and updating sync block data
|
|
14
27
|
*/
|
|
15
28
|
syncBlockStore: SyncBlockStoreManager;
|
|
16
29
|
};
|
|
30
|
+
export type SyncBlockAttrs = {
|
|
31
|
+
localId: string;
|
|
32
|
+
resourceId: string;
|
|
33
|
+
};
|
|
34
|
+
export type SyncBlockInfo = {
|
|
35
|
+
attrs: SyncBlockAttrs;
|
|
36
|
+
from?: number;
|
|
37
|
+
to?: number;
|
|
38
|
+
};
|
|
39
|
+
export type SyncBlockMap = {
|
|
40
|
+
[key: string]: SyncBlockInfo;
|
|
41
|
+
};
|
|
42
|
+
export {};
|
|
@@ -4,5 +4,5 @@ import type { SyncedBlockPlugin } from '../syncedBlockPluginType';
|
|
|
4
4
|
type CreateSyncedBlockButtonProps = {
|
|
5
5
|
api?: ExtractInjectionAPI<SyncedBlockPlugin>;
|
|
6
6
|
};
|
|
7
|
-
export declare const CreateSyncedBlockButton: ({ api }: CreateSyncedBlockButtonProps) => React.JSX.Element;
|
|
7
|
+
export declare const CreateSyncedBlockButton: ({ api, }: CreateSyncedBlockButtonProps) => React.JSX.Element;
|
|
8
8
|
export {};
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
type OverflowMenuSectionProps = {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
};
|
|
5
|
-
export declare const OverflowMenuSection: ({ children }: OverflowMenuSectionProps) => React.JSX.Element | null;
|
|
5
|
+
export declare const OverflowMenuSection: ({ children, }: OverflowMenuSectionProps) => React.JSX.Element | null;
|
|
6
6
|
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
3
|
import type { UseFetchSyncBlockDataResult } from '@atlaskit/editor-synced-block-provider';
|
|
3
|
-
import type { SyncedBlockRendererProps } from '../syncedBlockPluginType';
|
|
4
|
+
import type { SyncedBlockPlugin, SyncedBlockRendererProps } from '../syncedBlockPluginType';
|
|
4
5
|
type Props = {
|
|
5
|
-
|
|
6
|
+
api?: ExtractInjectionAPI<SyncedBlockPlugin>;
|
|
6
7
|
localId: string;
|
|
8
|
+
syncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
7
9
|
useFetchSyncBlockData: () => UseFetchSyncBlockDataResult;
|
|
8
10
|
useFetchSyncBlockTitle: () => string | undefined;
|
|
9
11
|
};
|
|
10
|
-
export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({ syncedBlockRenderer, useFetchSyncBlockData, localId, useFetchSyncBlockTitle, }: Props) => React.JSX.Element>;
|
|
12
|
+
export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({ syncedBlockRenderer, useFetchSyncBlockData, localId, useFetchSyncBlockTitle, api, }: Props) => React.JSX.Element>;
|
|
11
13
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"description": "SyncedBlock plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,25 +29,25 @@
|
|
|
29
29
|
"atlaskit:src": "src/index.ts",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/adf-schema": "^51.5.1",
|
|
32
|
-
"@atlaskit/button": "23.
|
|
32
|
+
"@atlaskit/button": "23.7.0",
|
|
33
33
|
"@atlaskit/editor-json-transformer": "^8.31.0",
|
|
34
34
|
"@atlaskit/editor-plugin-analytics": "^6.2.0",
|
|
35
|
-
"@atlaskit/editor-plugin-block-menu": "^5.
|
|
35
|
+
"@atlaskit/editor-plugin-block-menu": "^5.2.0",
|
|
36
36
|
"@atlaskit/editor-plugin-connectivity": "6.0.0",
|
|
37
37
|
"@atlaskit/editor-plugin-decorations": "^6.1.0",
|
|
38
38
|
"@atlaskit/editor-plugin-floating-toolbar": "^8.2.0",
|
|
39
39
|
"@atlaskit/editor-plugin-selection": "^6.1.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
41
41
|
"@atlaskit/editor-shared-styles": "^3.10.0",
|
|
42
|
-
"@atlaskit/editor-synced-block-provider": "^2.
|
|
42
|
+
"@atlaskit/editor-synced-block-provider": "^2.15.0",
|
|
43
43
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
44
44
|
"@atlaskit/editor-toolbar": "^0.18.0",
|
|
45
|
-
"@atlaskit/flag": "^17.
|
|
45
|
+
"@atlaskit/flag": "^17.6.0",
|
|
46
46
|
"@atlaskit/icon": "29.0.2",
|
|
47
47
|
"@atlaskit/icon-lab": "^5.12.0",
|
|
48
48
|
"@atlaskit/logo": "^19.9.0",
|
|
49
49
|
"@atlaskit/lozenge": "^13.1.0",
|
|
50
|
-
"@atlaskit/modal-dialog": "^14.
|
|
50
|
+
"@atlaskit/modal-dialog": "^14.8.0",
|
|
51
51
|
"@atlaskit/primitives": "^16.4.0",
|
|
52
52
|
"@atlaskit/tokens": "8.4.1",
|
|
53
53
|
"@atlaskit/tooltip": "^20.11.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@atlaskit/editor-common": "^110.
|
|
59
|
+
"@atlaskit/editor-common": "^110.41.0",
|
|
60
60
|
"react": "^18.2.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|