@atlaskit/editor-plugin-synced-block 2.0.1 → 2.1.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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # @atlaskit/editor-plugin-synced-block
2
2
 
3
+ ## 2.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`2ce1b7efe1d2e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2ce1b7efe1d2e) -
8
+ EDITOR-1640 Create Sync-Block data manager scaffolding
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
3
14
  ## 2.0.1
4
15
 
5
16
  ### Patch Changes
@@ -11,7 +11,7 @@ var syncedBlockPluginKey = exports.syncedBlockPluginKey = new _state.PluginKey('
11
11
 
12
12
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
13
13
 
14
- var createPlugin = exports.createPlugin = function createPlugin(config, pmPluginFactoryParams) {
14
+ var createPlugin = exports.createPlugin = function createPlugin(config, pmPluginFactoryParams, _syncBlockStore) {
15
15
  return new _safePlugin.SafePlugin({
16
16
  key: syncedBlockPluginKey,
17
17
  state: {
@@ -7,12 +7,14 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.syncedBlockPlugin = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _adfSchema = require("@atlaskit/adf-schema");
10
+ var _syncBlock = require("@atlaskit/editor-common/sync-block");
10
11
  var _smartLink = _interopRequireDefault(require("@atlaskit/icon/core/smart-link"));
11
12
  var _actions = require("./pm-plugins/actions");
12
13
  var _main = require("./pm-plugins/main");
13
14
  var _floatingToolbar = require("./ui/floating-toolbar");
14
15
  var syncedBlockPlugin = exports.syncedBlockPlugin = function syncedBlockPlugin(_ref) {
15
16
  var config = _ref.config;
17
+ var syncBlockStore = new _syncBlock.SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.dataProvider);
16
18
  return {
17
19
  name: 'syncedBlock',
18
20
  nodes: function nodes() {
@@ -25,7 +27,7 @@ var syncedBlockPlugin = exports.syncedBlockPlugin = function syncedBlockPlugin(_
25
27
  return [{
26
28
  name: 'syncedBlockPlugin',
27
29
  plugin: function plugin(params) {
28
- return (0, _main.createPlugin)(config, params);
30
+ return (0, _main.createPlugin)(config, params, syncBlockStore);
29
31
  }
30
32
  }];
31
33
  },
@@ -5,7 +5,7 @@ export const syncedBlockPluginKey = new PluginKey('syncedBlockPlugin');
5
5
 
6
6
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
7
7
 
8
- export const createPlugin = (config, pmPluginFactoryParams) => {
8
+ export const createPlugin = (config, pmPluginFactoryParams, _syncBlockStore) => {
9
9
  return new SafePlugin({
10
10
  key: syncedBlockPluginKey,
11
11
  state: {
@@ -1,40 +1,44 @@
1
1
  import React from 'react';
2
2
  import { syncBlock } from '@atlaskit/adf-schema';
3
+ import { SyncBlockStoreManager } from '@atlaskit/editor-common/sync-block';
3
4
  import SmartLinkIcon from '@atlaskit/icon/core/smart-link';
4
5
  import { createSyncedBlock } from './pm-plugins/actions';
5
6
  import { createPlugin } from './pm-plugins/main';
6
7
  import { getToolbarConfig } from './ui/floating-toolbar';
7
8
  export const syncedBlockPlugin = ({
8
9
  config
9
- }) => ({
10
- name: 'syncedBlock',
11
- nodes() {
12
- return [{
13
- name: 'syncBlock',
14
- node: syncBlock
15
- }];
16
- },
17
- pmPlugins() {
18
- return [{
19
- name: 'syncedBlockPlugin',
20
- plugin: params => createPlugin(config, params)
21
- }];
22
- },
23
- pluginsOptions: {
24
- quickInsert: () => [{
25
- id: 'syncBlock',
26
- title: 'Synced Block',
27
- description: 'Create a synced block',
28
- priority: 800,
29
- keywords: ['synced', 'block', 'synced-block', 'sync', 'sync-block'],
30
- keyshortcut: '',
31
- icon: () => /*#__PURE__*/React.createElement(SmartLinkIcon, {
32
- label: "Synced Block"
33
- }),
34
- action: (_insert, state) => {
35
- return createSyncedBlock(state);
36
- }
37
- }],
38
- floatingToolbar: getToolbarConfig()
39
- }
40
- });
10
+ }) => {
11
+ const syncBlockStore = new SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.dataProvider);
12
+ return {
13
+ name: 'syncedBlock',
14
+ nodes() {
15
+ return [{
16
+ name: 'syncBlock',
17
+ node: syncBlock
18
+ }];
19
+ },
20
+ pmPlugins() {
21
+ return [{
22
+ name: 'syncedBlockPlugin',
23
+ plugin: params => createPlugin(config, params, syncBlockStore)
24
+ }];
25
+ },
26
+ pluginsOptions: {
27
+ quickInsert: () => [{
28
+ id: 'syncBlock',
29
+ title: 'Synced Block',
30
+ description: 'Create a synced block',
31
+ priority: 800,
32
+ keywords: ['synced', 'block', 'synced-block', 'sync', 'sync-block'],
33
+ keyshortcut: '',
34
+ icon: () => /*#__PURE__*/React.createElement(SmartLinkIcon, {
35
+ label: "Synced Block"
36
+ }),
37
+ action: (_insert, state) => {
38
+ return createSyncedBlock(state);
39
+ }
40
+ }],
41
+ floatingToolbar: getToolbarConfig()
42
+ }
43
+ };
44
+ };
@@ -5,7 +5,7 @@ export var syncedBlockPluginKey = new PluginKey('syncedBlockPlugin');
5
5
 
6
6
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
7
7
 
8
- export var createPlugin = function createPlugin(config, pmPluginFactoryParams) {
8
+ export var createPlugin = function createPlugin(config, pmPluginFactoryParams, _syncBlockStore) {
9
9
  return new SafePlugin({
10
10
  key: syncedBlockPluginKey,
11
11
  state: {
@@ -1,11 +1,13 @@
1
1
  import React from 'react';
2
2
  import { syncBlock } from '@atlaskit/adf-schema';
3
+ import { SyncBlockStoreManager } from '@atlaskit/editor-common/sync-block';
3
4
  import SmartLinkIcon from '@atlaskit/icon/core/smart-link';
4
5
  import { createSyncedBlock } from './pm-plugins/actions';
5
6
  import { createPlugin } from './pm-plugins/main';
6
7
  import { getToolbarConfig } from './ui/floating-toolbar';
7
8
  export var syncedBlockPlugin = function syncedBlockPlugin(_ref) {
8
9
  var config = _ref.config;
10
+ var syncBlockStore = new SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.dataProvider);
9
11
  return {
10
12
  name: 'syncedBlock',
11
13
  nodes: function nodes() {
@@ -18,7 +20,7 @@ export var syncedBlockPlugin = function syncedBlockPlugin(_ref) {
18
20
  return [{
19
21
  name: 'syncedBlockPlugin',
20
22
  plugin: function plugin(params) {
21
- return createPlugin(config, params);
23
+ return createPlugin(config, params, syncBlockStore);
22
24
  }
23
25
  }];
24
26
  },
@@ -1,8 +1,9 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import type { SyncBlockStoreManager } from '@atlaskit/editor-common/sync-block';
2
3
  import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
3
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
5
  import type { SyncedBlockPluginOptions } from '../syncedBlockPluginType';
5
6
  export declare const syncedBlockPluginKey: PluginKey<any>;
6
7
  type SyncedBlockPluginState = {};
7
- export declare const createPlugin: (config: SyncedBlockPluginOptions | undefined, pmPluginFactoryParams: PMPluginFactoryParams) => SafePlugin<SyncedBlockPluginState>;
8
+ export declare const createPlugin: (config: SyncedBlockPluginOptions | undefined, pmPluginFactoryParams: PMPluginFactoryParams, _syncBlockStore: SyncBlockStoreManager) => SafePlugin<SyncedBlockPluginState>;
8
9
  export {};
@@ -1,5 +1,6 @@
1
1
  import type { DocNode } from '@atlaskit/adf-schema';
2
2
  import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
3
+ import type { SyncBlockDataProvider } from '@atlaskit/editor-common/sync-block';
3
4
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
4
5
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
5
6
  import type { EditorView } from '@atlaskit/editor-prosemirror/dist/types/view';
@@ -29,6 +30,7 @@ export type SyncedBlockRendererProps = {
29
30
  docNode: DocNode;
30
31
  };
31
32
  export type SyncedBlockPluginOptions = {
33
+ dataProvider?: SyncBlockDataProvider;
32
34
  getSyncedBlockEditor?: (props: SyncedBlockEditorProps) => React.JSX.Element;
33
35
  getSyncedBlockRenderer?: (props: SyncedBlockRendererProps) => React.JSX.Element;
34
36
  };
@@ -1,8 +1,9 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import type { SyncBlockStoreManager } from '@atlaskit/editor-common/sync-block';
2
3
  import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
3
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
5
  import type { SyncedBlockPluginOptions } from '../syncedBlockPluginType';
5
6
  export declare const syncedBlockPluginKey: PluginKey<any>;
6
7
  type SyncedBlockPluginState = {};
7
- export declare const createPlugin: (config: SyncedBlockPluginOptions | undefined, pmPluginFactoryParams: PMPluginFactoryParams) => SafePlugin<SyncedBlockPluginState>;
8
+ export declare const createPlugin: (config: SyncedBlockPluginOptions | undefined, pmPluginFactoryParams: PMPluginFactoryParams, _syncBlockStore: SyncBlockStoreManager) => SafePlugin<SyncedBlockPluginState>;
8
9
  export {};
@@ -1,5 +1,6 @@
1
1
  import type { DocNode } from '@atlaskit/adf-schema';
2
2
  import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
3
+ import type { SyncBlockDataProvider } from '@atlaskit/editor-common/sync-block';
3
4
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
4
5
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
5
6
  import type { EditorView } from '@atlaskit/editor-prosemirror/dist/types/view';
@@ -29,6 +30,7 @@ export type SyncedBlockRendererProps = {
29
30
  docNode: DocNode;
30
31
  };
31
32
  export type SyncedBlockPluginOptions = {
33
+ dataProvider?: SyncBlockDataProvider;
32
34
  getSyncedBlockEditor?: (props: SyncedBlockEditorProps) => React.JSX.Element;
33
35
  getSyncedBlockRenderer?: (props: SyncedBlockRendererProps) => React.JSX.Element;
34
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-synced-block",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "SyncedBlock plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,7 +35,7 @@
35
35
  "react-intl-next": "npm:react-intl@^5.18.1"
36
36
  },
37
37
  "peerDependencies": {
38
- "@atlaskit/editor-common": "^109.7.0",
38
+ "@atlaskit/editor-common": "^109.8.0",
39
39
  "react": "^18.2.0"
40
40
  },
41
41
  "devDependencies": {