@atlaskit/editor-plugin-synced-block 2.1.0 → 2.2.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/afm-cc/tsconfig.json +9 -0
  3. package/afm-dev-agents/tsconfig.json +9 -0
  4. package/afm-jira/tsconfig.json +9 -0
  5. package/afm-passionfruit/tsconfig.json +9 -0
  6. package/afm-post-office/tsconfig.json +9 -0
  7. package/afm-rovo-extension/tsconfig.json +9 -0
  8. package/afm-townsquare/tsconfig.json +9 -0
  9. package/dist/cjs/nodeviews/syncedBlock.js +118 -75
  10. package/dist/cjs/pm-plugins/actions.js +23 -9
  11. package/dist/cjs/pm-plugins/main.js +34 -8
  12. package/dist/cjs/pm-plugins/utils/track-sync-blocks.js +54 -0
  13. package/dist/cjs/pm-plugins/utils/utils.js +11 -0
  14. package/dist/cjs/syncedBlockPlugin.js +12 -3
  15. package/dist/cjs/ui/ContentComponent.js +55 -0
  16. package/dist/cjs/ui/SyncBlockEditorWrapper.js +38 -0
  17. package/dist/cjs/ui/SyncBlockRendererWrapper.js +26 -0
  18. package/dist/cjs/ui/floating-toolbar.js +58 -3
  19. package/dist/es2019/nodeviews/syncedBlock.js +103 -67
  20. package/dist/es2019/pm-plugins/actions.js +23 -8
  21. package/dist/es2019/pm-plugins/main.js +35 -8
  22. package/dist/es2019/pm-plugins/utils/track-sync-blocks.js +50 -0
  23. package/dist/es2019/pm-plugins/utils/utils.js +7 -0
  24. package/dist/es2019/syncedBlockPlugin.js +10 -3
  25. package/dist/es2019/ui/ContentComponent.js +41 -0
  26. package/dist/es2019/ui/SyncBlockEditorWrapper.js +28 -0
  27. package/dist/es2019/ui/SyncBlockRendererWrapper.js +20 -0
  28. package/dist/es2019/ui/floating-toolbar.js +56 -2
  29. package/dist/esm/nodeviews/syncedBlock.js +116 -72
  30. package/dist/esm/pm-plugins/actions.js +21 -8
  31. package/dist/esm/pm-plugins/main.js +34 -8
  32. package/dist/esm/pm-plugins/utils/track-sync-blocks.js +48 -0
  33. package/dist/esm/pm-plugins/utils/utils.js +5 -0
  34. package/dist/esm/syncedBlockPlugin.js +12 -3
  35. package/dist/esm/ui/ContentComponent.js +46 -0
  36. package/dist/esm/ui/SyncBlockEditorWrapper.js +31 -0
  37. package/dist/esm/ui/SyncBlockRendererWrapper.js +19 -0
  38. package/dist/esm/ui/floating-toolbar.js +57 -3
  39. package/dist/types/nodeviews/syncedBlock.d.ts +29 -15
  40. package/dist/types/pm-plugins/actions.d.ts +3 -1
  41. package/dist/types/pm-plugins/main.d.ts +3 -3
  42. package/dist/types/pm-plugins/utils/track-sync-blocks.d.ts +7 -0
  43. package/dist/types/pm-plugins/utils/utils.d.ts +3 -0
  44. package/dist/types/syncedBlockPluginType.d.ts +8 -2
  45. package/dist/types/ui/ContentComponent.d.ts +5 -0
  46. package/dist/types/ui/SyncBlockEditorWrapper.d.ts +16 -0
  47. package/dist/types/ui/SyncBlockRendererWrapper.d.ts +9 -0
  48. package/dist/types/ui/floating-toolbar.d.ts +6 -2
  49. package/dist/types-ts4.5/nodeviews/syncedBlock.d.ts +29 -15
  50. package/dist/types-ts4.5/pm-plugins/actions.d.ts +3 -1
  51. package/dist/types-ts4.5/pm-plugins/main.d.ts +3 -3
  52. package/dist/types-ts4.5/pm-plugins/utils/track-sync-blocks.d.ts +7 -0
  53. package/dist/types-ts4.5/pm-plugins/utils/utils.d.ts +3 -0
  54. package/dist/types-ts4.5/syncedBlockPluginType.d.ts +10 -2
  55. package/dist/types-ts4.5/ui/ContentComponent.d.ts +5 -0
  56. package/dist/types-ts4.5/ui/SyncBlockEditorWrapper.d.ts +16 -0
  57. package/dist/types-ts4.5/ui/SyncBlockRendererWrapper.d.ts +9 -0
  58. package/dist/types-ts4.5/ui/floating-toolbar.d.ts +6 -2
  59. package/package.json +8 -4
@@ -1,5 +1,59 @@
1
- export var getToolbarConfig = function getToolbarConfig() {
2
- return function (_state, _intl) {
3
- return undefined;
1
+ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
2
+ import CopyIcon from '@atlaskit/icon/core/copy';
3
+ import LinkExternalIcon from '@atlaskit/icon/core/link-external';
4
+ import { copySyncedBlockReferenceToClipboard } from '../pm-plugins/actions';
5
+ import { findSyncBlock } from '../pm-plugins/utils/utils';
6
+ export var getToolbarConfig = function getToolbarConfig(state, _intl) {
7
+ var _options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
8
+ var _providerFactory = arguments.length > 3 ? arguments[3] : undefined;
9
+ var syncBlockObject = findSyncBlock(state);
10
+ if (!syncBlockObject) {
11
+ return;
12
+ }
13
+ var nodeType = state.schema.nodes.syncBlock;
14
+ var items = [];
15
+ var copyButton = {
16
+ id: 'editor.syncedBlock.copy',
17
+ type: 'button',
18
+ appearance: 'subtle',
19
+ icon: CopyIcon,
20
+ title: 'Copy',
21
+ showTitle: true,
22
+ tooltipContent: 'Copy reference to clipboard',
23
+ onClick: copySyncedBlockReferenceToClipboard
24
+ };
25
+ items.push(copyButton);
26
+ if (syncBlockObject.node.attrs.resourceId !== syncBlockObject.node.attrs.localId) {
27
+ var editSourceButton = {
28
+ id: 'editor.syncedBlock.editSource',
29
+ type: 'button',
30
+ appearance: 'subtle',
31
+ icon: LinkExternalIcon,
32
+ title: 'Edit source',
33
+ showTitle: true,
34
+ tooltipContent: 'Navigate to source page of the sync block',
35
+ disabled: true,
36
+ onClick: function onClick(_state, _dispatch, view) {
37
+ if (!view) {
38
+ return false;
39
+ }
40
+ // to be implemented in a follow up PR
41
+ return true;
42
+ }
43
+ };
44
+ items.push(editSourceButton);
45
+ }
46
+ var getDomRef = function getDomRef(editorView) {
47
+ var domAtPos = editorView.domAtPos.bind(editorView);
48
+ var element = findDomRefAtPos(syncBlockObject.pos, domAtPos);
49
+ return element;
50
+ };
51
+ return {
52
+ title: 'Synced Block floating controls',
53
+ getDomRef: getDomRef,
54
+ nodeType: nodeType,
55
+ items: items,
56
+ scrollable: true,
57
+ groupLabel: 'Synced blocks'
4
58
  };
5
59
  };
@@ -1,28 +1,42 @@
1
1
  import React from 'react';
2
- import type { DocNode } from '@atlaskit/adf-schema';
3
- import ReactNodeView from '@atlaskit/editor-common/react-node-view';
4
- import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
2
+ import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
3
+ import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
4
+ import ReactNodeView, { type getPosHandler } from '@atlaskit/editor-common/react-node-view';
5
+ import type { ReactComponentProps } from '@atlaskit/editor-common/react-node-view';
6
+ import type { ExtractInjectionAPI, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
5
7
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
6
8
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
7
- import type { SyncedBlockPluginOptions } from '../syncedBlockPluginType';
8
- export type SyncBlockNodeViewProps = {
9
- config: SyncedBlockPluginOptions | undefined;
10
- };
11
- export declare const defaultSyncBlockDocument: DocNode;
12
- export declare const SyncBlockPluginComponent: ({ config, dom, }: {
13
- config: SyncedBlockPluginOptions | undefined;
14
- dom: HTMLElement;
15
- }) => React.JSX.Element | null;
9
+ import type { SyncedBlockPlugin, SyncedBlockPluginOptions } from '../syncedBlockPluginType';
10
+ export interface SyncBlockNodeViewProps extends ReactComponentProps {
11
+ api?: ExtractInjectionAPI<SyncedBlockPlugin>;
12
+ eventDispatcher: EventDispatcher;
13
+ getPos: getPosHandler;
14
+ isNodeNested?: boolean;
15
+ node: PMNode;
16
+ options: SyncedBlockPluginOptions | undefined;
17
+ portalProviderAPI: PortalProviderAPI;
18
+ view: EditorView;
19
+ }
16
20
  declare class SyncBlock extends ReactNodeView<SyncBlockNodeViewProps> {
21
+ private isSource;
22
+ private options;
23
+ constructor(props: SyncBlockNodeViewProps);
17
24
  unsubscribe: (() => void) | undefined;
18
25
  createDomRef(): HTMLElement;
19
- render(): React.JSX.Element;
26
+ private handleContentChanges;
27
+ private setInnerEditorView;
28
+ private renderEditor;
29
+ private renderRenderer;
30
+ render(): React.JSX.Element | null;
20
31
  stopEvent(event: Event): boolean;
32
+ selectNode(): void;
21
33
  destroy(): void;
34
+ private selectSyncBlockNode;
22
35
  }
23
36
  export interface SyncBlockNodeViewProperties {
24
- config: SyncedBlockPluginOptions | undefined;
37
+ api?: ExtractInjectionAPI<SyncedBlockPlugin>;
38
+ options: SyncedBlockPluginOptions | undefined;
25
39
  pmPluginFactoryParams: PMPluginFactoryParams;
26
40
  }
27
- export declare const syncBlockNodeView: ({ config, pmPluginFactoryParams }: SyncBlockNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => SyncBlock;
41
+ export declare const syncBlockNodeView: ({ options, pmPluginFactoryParams, api }: SyncBlockNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => SyncBlock;
28
42
  export {};
@@ -1,2 +1,4 @@
1
- import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
1
+ import type { Command } from '@atlaskit/editor-common/types';
2
+ import { type EditorState, type Transaction } from '@atlaskit/editor-prosemirror/state';
2
3
  export declare const createSyncedBlock: (state: EditorState) => Transaction;
4
+ export declare const copySyncedBlockReferenceToClipboard: Command;
@@ -1,9 +1,9 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import type { SyncBlockStoreManager } from '@atlaskit/editor-common/sync-block';
3
- import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
3
+ import type { ExtractInjectionAPI, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
4
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
- import type { SyncedBlockPluginOptions } from '../syncedBlockPluginType';
5
+ import type { SyncedBlockPlugin, SyncedBlockPluginOptions } from '../syncedBlockPluginType';
6
6
  export declare const syncedBlockPluginKey: PluginKey<any>;
7
7
  type SyncedBlockPluginState = {};
8
- export declare const createPlugin: (config: SyncedBlockPluginOptions | undefined, pmPluginFactoryParams: PMPluginFactoryParams, _syncBlockStore: SyncBlockStoreManager) => SafePlugin<SyncedBlockPluginState>;
8
+ export declare const createPlugin: (options: SyncedBlockPluginOptions | undefined, pmPluginFactoryParams: PMPluginFactoryParams, syncBlockStore: SyncBlockStoreManager, api?: ExtractInjectionAPI<SyncedBlockPlugin>) => SafePlugin<SyncedBlockPluginState>;
9
9
  export {};
@@ -0,0 +1,7 @@
1
+ import type { SyncBlockStoreManager } from '@atlaskit/editor-common/sync-block';
2
+ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
3
+ import type { SyncBlockAttrs } from '../../syncedBlockPluginType';
4
+ export declare const trackSyncBlocks: (storeManager: SyncBlockStoreManager, tr: Transaction, state: EditorState) => {
5
+ removed: SyncBlockAttrs[];
6
+ added: SyncBlockAttrs[];
7
+ };
@@ -0,0 +1,3 @@
1
+ import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
2
+ import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
3
+ export declare const findSyncBlock: (state: EditorState, selection?: Selection | null) => ReturnType<ReturnType<typeof findSelectedNodeOfType>> | ReturnType<ReturnType<typeof findParentNodeOfType>>;
@@ -3,11 +3,10 @@ import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
3
3
  import type { SyncBlockDataProvider } from '@atlaskit/editor-common/sync-block';
4
4
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
5
5
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
6
+ import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
6
7
  import type { EditorView } from '@atlaskit/editor-prosemirror/dist/types/view';
7
8
  export type SyncedBlockEditorProps = {
8
- boundariesElement: HTMLElement;
9
9
  defaultDocument: JSONDocNode;
10
- mountPoint: HTMLElement;
11
10
  onChange: (editorView: EditorView, meta: {
12
11
  /**
13
12
  * Indicates whether or not the change may be unnecessary to listen to (dirty
@@ -25,6 +24,8 @@ export type SyncedBlockEditorProps = {
25
24
  editorView: EditorView;
26
25
  eventDispatcher: EventDispatcher;
27
26
  }) => void;
27
+ popupsBoundariesElement: HTMLElement;
28
+ popupsMountPoint: HTMLElement;
28
29
  };
29
30
  export type SyncedBlockRendererProps = {
30
31
  docNode: DocNode;
@@ -35,5 +36,10 @@ export type SyncedBlockPluginOptions = {
35
36
  getSyncedBlockRenderer?: (props: SyncedBlockRendererProps) => React.JSX.Element;
36
37
  };
37
38
  export type SyncedBlockPlugin = NextEditorPlugin<'syncedBlock', {
39
+ dependencies: [SelectionPlugin];
38
40
  pluginConfiguration: SyncedBlockPluginOptions | undefined;
39
41
  }>;
42
+ export type SyncBlockAttrs = {
43
+ localId: string;
44
+ resourceId: string;
45
+ };
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type { SyncBlockStoreManager } from '@atlaskit/editor-common/sync-block';
3
+ export declare const ContentComponent: ({ syncBlockStoreManager, }: {
4
+ syncBlockStoreManager: SyncBlockStoreManager;
5
+ }) => React.JSX.Element;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
3
+ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
+ import type { SyncedBlockEditorProps } from '../syncedBlockPluginType';
6
+ type Props = {
7
+ defaultDocument: JSONDocNode;
8
+ getSyncedBlockEditor: (props: SyncedBlockEditorProps) => React.JSX.Element;
9
+ handleContentChanges: (updatedDoc: PMNode) => void;
10
+ popupsBoundariesElement: HTMLElement;
11
+ popupsMountPoint: HTMLElement;
12
+ setInnerEditorView: (editorView: EditorView) => void;
13
+ };
14
+ export declare const SyncBlockEditorWrapperDataId = "sync-block-plugin-editor-wrapper";
15
+ export declare const SyncBlockEditorWrapper: React.MemoExoticComponent<({ defaultDocument, getSyncedBlockEditor, popupsBoundariesElement, popupsMountPoint, setInnerEditorView, handleContentChanges, }: Props) => React.JSX.Element>;
16
+ export {};
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { DocNode } from '@atlaskit/adf-schema';
3
+ import type { SyncedBlockRendererProps } from '../syncedBlockPluginType';
4
+ type Props = {
5
+ docNode: DocNode;
6
+ getSyncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
7
+ };
8
+ export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({ getSyncedBlockRenderer, docNode }: Props) => React.JSX.Element>;
9
+ export {};
@@ -1,2 +1,6 @@
1
- import type { FloatingToolbarHandler } from '@atlaskit/editor-common/types';
2
- export declare const getToolbarConfig: () => FloatingToolbarHandler;
1
+ import type { IntlShape } from 'react-intl-next';
2
+ import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
3
+ import type { FloatingToolbarConfig } from '@atlaskit/editor-common/types';
4
+ import type { EditorState } from '@atlaskit/editor-prosemirror/dist/types/state';
5
+ import type { SyncedBlockPluginOptions } from '../syncedBlockPluginType';
6
+ export declare const getToolbarConfig: (state: EditorState, _intl: IntlShape, _options: SyncedBlockPluginOptions | undefined, _providerFactory: ProviderFactory) => FloatingToolbarConfig | undefined;
@@ -1,28 +1,42 @@
1
1
  import React from 'react';
2
- import type { DocNode } from '@atlaskit/adf-schema';
3
- import ReactNodeView from '@atlaskit/editor-common/react-node-view';
4
- import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
2
+ import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
3
+ import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
4
+ import ReactNodeView, { type getPosHandler } from '@atlaskit/editor-common/react-node-view';
5
+ import type { ReactComponentProps } from '@atlaskit/editor-common/react-node-view';
6
+ import type { ExtractInjectionAPI, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
5
7
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
6
8
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
7
- import type { SyncedBlockPluginOptions } from '../syncedBlockPluginType';
8
- export type SyncBlockNodeViewProps = {
9
- config: SyncedBlockPluginOptions | undefined;
10
- };
11
- export declare const defaultSyncBlockDocument: DocNode;
12
- export declare const SyncBlockPluginComponent: ({ config, dom, }: {
13
- config: SyncedBlockPluginOptions | undefined;
14
- dom: HTMLElement;
15
- }) => React.JSX.Element | null;
9
+ import type { SyncedBlockPlugin, SyncedBlockPluginOptions } from '../syncedBlockPluginType';
10
+ export interface SyncBlockNodeViewProps extends ReactComponentProps {
11
+ api?: ExtractInjectionAPI<SyncedBlockPlugin>;
12
+ eventDispatcher: EventDispatcher;
13
+ getPos: getPosHandler;
14
+ isNodeNested?: boolean;
15
+ node: PMNode;
16
+ options: SyncedBlockPluginOptions | undefined;
17
+ portalProviderAPI: PortalProviderAPI;
18
+ view: EditorView;
19
+ }
16
20
  declare class SyncBlock extends ReactNodeView<SyncBlockNodeViewProps> {
21
+ private isSource;
22
+ private options;
23
+ constructor(props: SyncBlockNodeViewProps);
17
24
  unsubscribe: (() => void) | undefined;
18
25
  createDomRef(): HTMLElement;
19
- render(): React.JSX.Element;
26
+ private handleContentChanges;
27
+ private setInnerEditorView;
28
+ private renderEditor;
29
+ private renderRenderer;
30
+ render(): React.JSX.Element | null;
20
31
  stopEvent(event: Event): boolean;
32
+ selectNode(): void;
21
33
  destroy(): void;
34
+ private selectSyncBlockNode;
22
35
  }
23
36
  export interface SyncBlockNodeViewProperties {
24
- config: SyncedBlockPluginOptions | undefined;
37
+ api?: ExtractInjectionAPI<SyncedBlockPlugin>;
38
+ options: SyncedBlockPluginOptions | undefined;
25
39
  pmPluginFactoryParams: PMPluginFactoryParams;
26
40
  }
27
- export declare const syncBlockNodeView: ({ config, pmPluginFactoryParams }: SyncBlockNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => SyncBlock;
41
+ export declare const syncBlockNodeView: ({ options, pmPluginFactoryParams, api }: SyncBlockNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => SyncBlock;
28
42
  export {};
@@ -1,2 +1,4 @@
1
- import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
1
+ import type { Command } from '@atlaskit/editor-common/types';
2
+ import { type EditorState, type Transaction } from '@atlaskit/editor-prosemirror/state';
2
3
  export declare const createSyncedBlock: (state: EditorState) => Transaction;
4
+ export declare const copySyncedBlockReferenceToClipboard: Command;
@@ -1,9 +1,9 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import type { SyncBlockStoreManager } from '@atlaskit/editor-common/sync-block';
3
- import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
3
+ import type { ExtractInjectionAPI, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
4
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
- import type { SyncedBlockPluginOptions } from '../syncedBlockPluginType';
5
+ import type { SyncedBlockPlugin, SyncedBlockPluginOptions } from '../syncedBlockPluginType';
6
6
  export declare const syncedBlockPluginKey: PluginKey<any>;
7
7
  type SyncedBlockPluginState = {};
8
- export declare const createPlugin: (config: SyncedBlockPluginOptions | undefined, pmPluginFactoryParams: PMPluginFactoryParams, _syncBlockStore: SyncBlockStoreManager) => SafePlugin<SyncedBlockPluginState>;
8
+ export declare const createPlugin: (options: SyncedBlockPluginOptions | undefined, pmPluginFactoryParams: PMPluginFactoryParams, syncBlockStore: SyncBlockStoreManager, api?: ExtractInjectionAPI<SyncedBlockPlugin>) => SafePlugin<SyncedBlockPluginState>;
9
9
  export {};
@@ -0,0 +1,7 @@
1
+ import type { SyncBlockStoreManager } from '@atlaskit/editor-common/sync-block';
2
+ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
3
+ import type { SyncBlockAttrs } from '../../syncedBlockPluginType';
4
+ export declare const trackSyncBlocks: (storeManager: SyncBlockStoreManager, tr: Transaction, state: EditorState) => {
5
+ removed: SyncBlockAttrs[];
6
+ added: SyncBlockAttrs[];
7
+ };
@@ -0,0 +1,3 @@
1
+ import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
2
+ import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
3
+ export declare const findSyncBlock: (state: EditorState, selection?: Selection | null) => ReturnType<ReturnType<typeof findSelectedNodeOfType>> | ReturnType<ReturnType<typeof findParentNodeOfType>>;
@@ -3,11 +3,10 @@ import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
3
3
  import type { SyncBlockDataProvider } from '@atlaskit/editor-common/sync-block';
4
4
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
5
5
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
6
+ import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
6
7
  import type { EditorView } from '@atlaskit/editor-prosemirror/dist/types/view';
7
8
  export type SyncedBlockEditorProps = {
8
- boundariesElement: HTMLElement;
9
9
  defaultDocument: JSONDocNode;
10
- mountPoint: HTMLElement;
11
10
  onChange: (editorView: EditorView, meta: {
12
11
  /**
13
12
  * Indicates whether or not the change may be unnecessary to listen to (dirty
@@ -25,6 +24,8 @@ export type SyncedBlockEditorProps = {
25
24
  editorView: EditorView;
26
25
  eventDispatcher: EventDispatcher;
27
26
  }) => void;
27
+ popupsBoundariesElement: HTMLElement;
28
+ popupsMountPoint: HTMLElement;
28
29
  };
29
30
  export type SyncedBlockRendererProps = {
30
31
  docNode: DocNode;
@@ -35,5 +36,12 @@ export type SyncedBlockPluginOptions = {
35
36
  getSyncedBlockRenderer?: (props: SyncedBlockRendererProps) => React.JSX.Element;
36
37
  };
37
38
  export type SyncedBlockPlugin = NextEditorPlugin<'syncedBlock', {
39
+ dependencies: [
40
+ SelectionPlugin
41
+ ];
38
42
  pluginConfiguration: SyncedBlockPluginOptions | undefined;
39
43
  }>;
44
+ export type SyncBlockAttrs = {
45
+ localId: string;
46
+ resourceId: string;
47
+ };
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type { SyncBlockStoreManager } from '@atlaskit/editor-common/sync-block';
3
+ export declare const ContentComponent: ({ syncBlockStoreManager, }: {
4
+ syncBlockStoreManager: SyncBlockStoreManager;
5
+ }) => React.JSX.Element;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
3
+ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
+ import type { SyncedBlockEditorProps } from '../syncedBlockPluginType';
6
+ type Props = {
7
+ defaultDocument: JSONDocNode;
8
+ getSyncedBlockEditor: (props: SyncedBlockEditorProps) => React.JSX.Element;
9
+ handleContentChanges: (updatedDoc: PMNode) => void;
10
+ popupsBoundariesElement: HTMLElement;
11
+ popupsMountPoint: HTMLElement;
12
+ setInnerEditorView: (editorView: EditorView) => void;
13
+ };
14
+ export declare const SyncBlockEditorWrapperDataId = "sync-block-plugin-editor-wrapper";
15
+ export declare const SyncBlockEditorWrapper: React.MemoExoticComponent<({ defaultDocument, getSyncedBlockEditor, popupsBoundariesElement, popupsMountPoint, setInnerEditorView, handleContentChanges, }: Props) => React.JSX.Element>;
16
+ export {};
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { DocNode } from '@atlaskit/adf-schema';
3
+ import type { SyncedBlockRendererProps } from '../syncedBlockPluginType';
4
+ type Props = {
5
+ docNode: DocNode;
6
+ getSyncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
7
+ };
8
+ export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({ getSyncedBlockRenderer, docNode }: Props) => React.JSX.Element>;
9
+ export {};
@@ -1,2 +1,6 @@
1
- import type { FloatingToolbarHandler } from '@atlaskit/editor-common/types';
2
- export declare const getToolbarConfig: () => FloatingToolbarHandler;
1
+ import type { IntlShape } from 'react-intl-next';
2
+ import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
3
+ import type { FloatingToolbarConfig } from '@atlaskit/editor-common/types';
4
+ import type { EditorState } from '@atlaskit/editor-prosemirror/dist/types/state';
5
+ import type { SyncedBlockPluginOptions } from '../syncedBlockPluginType';
6
+ export declare const getToolbarConfig: (state: EditorState, _intl: IntlShape, _options: SyncedBlockPluginOptions | undefined, _providerFactory: ProviderFactory) => FloatingToolbarConfig | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-synced-block",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "SyncedBlock plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -29,13 +29,17 @@
29
29
  "atlaskit:src": "src/index.ts",
30
30
  "dependencies": {
31
31
  "@atlaskit/adf-schema": "^51.1.2",
32
+ "@atlaskit/button": "23.4.9",
33
+ "@atlaskit/editor-plugin-selection": "^5.0.0",
32
34
  "@atlaskit/editor-prosemirror": "7.0.0",
33
- "@atlaskit/icon": "28.2.0",
35
+ "@atlaskit/icon": "28.2.1",
36
+ "@atlaskit/modal-dialog": "^14.3.0",
34
37
  "@babel/runtime": "^7.0.0",
35
- "react-intl-next": "npm:react-intl@^5.18.1"
38
+ "react-intl-next": "npm:react-intl@^5.18.1",
39
+ "uuid": "^3.1.0"
36
40
  },
37
41
  "peerDependencies": {
38
- "@atlaskit/editor-common": "^109.8.0",
42
+ "@atlaskit/editor-common": "^109.12.0",
39
43
  "react": "^18.2.0"
40
44
  },
41
45
  "devDependencies": {