@atlaskit/editor-plugin-synced-block 0.1.2 → 2.0.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 (103) hide show
  1. package/CHANGELOG.md +5 -15
  2. package/afm-cc/tsconfig.json +0 -15
  3. package/afm-dev-agents/tsconfig.json +0 -15
  4. package/afm-jira/tsconfig.json +0 -15
  5. package/afm-passionfruit/tsconfig.json +0 -15
  6. package/afm-post-office/tsconfig.json +0 -15
  7. package/afm-rovo-extension/tsconfig.json +0 -15
  8. package/afm-townsquare/tsconfig.json +0 -15
  9. package/dist/cjs/nodeviews/syncedBlock.js +20 -0
  10. package/dist/cjs/pm-plugins/main.js +0 -21
  11. package/dist/cjs/syncedBlockPlugin.js +9 -5
  12. package/dist/cjs/ui/floating-toolbar.js +39 -0
  13. package/dist/es2019/nodeviews/syncedBlock.js +10 -0
  14. package/dist/es2019/pm-plugins/main.js +0 -24
  15. package/dist/es2019/syncedBlockPlugin.js +18 -15
  16. package/dist/es2019/ui/floating-toolbar.js +31 -0
  17. package/dist/esm/nodeviews/syncedBlock.js +13 -0
  18. package/dist/esm/pm-plugins/main.js +0 -21
  19. package/dist/esm/syncedBlockPlugin.js +9 -4
  20. package/dist/esm/ui/floating-toolbar.js +32 -0
  21. package/dist/types/index.d.ts +0 -1
  22. package/dist/types/nodeviews/syncedBlock.d.ts +11 -0
  23. package/dist/types/ui/floating-toolbar.d.ts +2 -0
  24. package/dist/types-ts4.5/index.d.ts +0 -1
  25. package/dist/types-ts4.5/nodeviews/syncedBlock.d.ts +11 -0
  26. package/dist/types-ts4.5/ui/floating-toolbar.d.ts +2 -0
  27. package/package.json +3 -9
  28. package/SyncedBlock/package.json +0 -15
  29. package/dist/cjs/pm-plugins/SyncClient.js +0 -167
  30. package/dist/cjs/pm-plugins/utils.js +0 -19
  31. package/dist/cjs/types/index.js +0 -1
  32. package/dist/cjs/ui/extensions/synced-block/components/GlobalStyles.js +0 -25
  33. package/dist/cjs/ui/extensions/synced-block/components/SyncedBlockLiveView.js +0 -25
  34. package/dist/cjs/ui/extensions/synced-block/components/SyncedBlockRenderer.js +0 -25
  35. package/dist/cjs/ui/extensions/synced-block/constants.js +0 -32
  36. package/dist/cjs/ui/extensions/synced-block/getSyncedBlockExtensionProvider.js +0 -11
  37. package/dist/cjs/ui/extensions/synced-block/hooks/useLiveSyncedBlockContent.js +0 -29
  38. package/dist/cjs/ui/extensions/synced-block/hooks/usePollContentProperty.js +0 -121
  39. package/dist/cjs/ui/extensions/synced-block/index.js +0 -19
  40. package/dist/cjs/ui/extensions/synced-block/manifest.js +0 -281
  41. package/dist/cjs/ui/extensions/synced-block/utils/ari.js +0 -29
  42. package/dist/cjs/ui/extensions/synced-block/utils/content-property.js +0 -159
  43. package/dist/cjs/ui/extensions/synced-block/utils/synced-block.js +0 -65
  44. package/dist/es2019/pm-plugins/SyncClient.js +0 -102
  45. package/dist/es2019/pm-plugins/utils.js +0 -13
  46. package/dist/es2019/types/index.js +0 -0
  47. package/dist/es2019/ui/extensions/synced-block/components/GlobalStyles.js +0 -18
  48. package/dist/es2019/ui/extensions/synced-block/components/SyncedBlockLiveView.js +0 -19
  49. package/dist/es2019/ui/extensions/synced-block/components/SyncedBlockRenderer.js +0 -19
  50. package/dist/es2019/ui/extensions/synced-block/constants.js +0 -26
  51. package/dist/es2019/ui/extensions/synced-block/getSyncedBlockExtensionProvider.js +0 -5
  52. package/dist/es2019/ui/extensions/synced-block/hooks/useLiveSyncedBlockContent.js +0 -24
  53. package/dist/es2019/ui/extensions/synced-block/hooks/usePollContentProperty.js +0 -107
  54. package/dist/es2019/ui/extensions/synced-block/index.js +0 -5
  55. package/dist/es2019/ui/extensions/synced-block/manifest.js +0 -172
  56. package/dist/es2019/ui/extensions/synced-block/utils/ari.js +0 -19
  57. package/dist/es2019/ui/extensions/synced-block/utils/content-property.js +0 -108
  58. package/dist/es2019/ui/extensions/synced-block/utils/synced-block.js +0 -57
  59. package/dist/esm/pm-plugins/SyncClient.js +0 -160
  60. package/dist/esm/pm-plugins/utils.js +0 -13
  61. package/dist/esm/types/index.js +0 -0
  62. package/dist/esm/ui/extensions/synced-block/components/GlobalStyles.js +0 -18
  63. package/dist/esm/ui/extensions/synced-block/components/SyncedBlockLiveView.js +0 -18
  64. package/dist/esm/ui/extensions/synced-block/components/SyncedBlockRenderer.js +0 -18
  65. package/dist/esm/ui/extensions/synced-block/constants.js +0 -26
  66. package/dist/esm/ui/extensions/synced-block/getSyncedBlockExtensionProvider.js +0 -5
  67. package/dist/esm/ui/extensions/synced-block/hooks/useLiveSyncedBlockContent.js +0 -23
  68. package/dist/esm/ui/extensions/synced-block/hooks/usePollContentProperty.js +0 -114
  69. package/dist/esm/ui/extensions/synced-block/index.js +0 -5
  70. package/dist/esm/ui/extensions/synced-block/manifest.js +0 -274
  71. package/dist/esm/ui/extensions/synced-block/utils/ari.js +0 -23
  72. package/dist/esm/ui/extensions/synced-block/utils/content-property.js +0 -153
  73. package/dist/esm/ui/extensions/synced-block/utils/synced-block.js +0 -58
  74. package/dist/types/pm-plugins/SyncClient.d.ts +0 -14
  75. package/dist/types/pm-plugins/utils.d.ts +0 -5
  76. package/dist/types/types/index.d.ts +0 -3
  77. package/dist/types/ui/extensions/synced-block/components/GlobalStyles.d.ts +0 -6
  78. package/dist/types/ui/extensions/synced-block/components/SyncedBlockLiveView.d.ts +0 -7
  79. package/dist/types/ui/extensions/synced-block/components/SyncedBlockRenderer.d.ts +0 -7
  80. package/dist/types/ui/extensions/synced-block/constants.d.ts +0 -8
  81. package/dist/types/ui/extensions/synced-block/getSyncedBlockExtensionProvider.d.ts +0 -3
  82. package/dist/types/ui/extensions/synced-block/hooks/useLiveSyncedBlockContent.d.ts +0 -6
  83. package/dist/types/ui/extensions/synced-block/hooks/usePollContentProperty.d.ts +0 -7
  84. package/dist/types/ui/extensions/synced-block/index.d.ts +0 -2
  85. package/dist/types/ui/extensions/synced-block/manifest.d.ts +0 -3
  86. package/dist/types/ui/extensions/synced-block/utils/ari.d.ts +0 -4
  87. package/dist/types/ui/extensions/synced-block/utils/content-property.d.ts +0 -33
  88. package/dist/types/ui/extensions/synced-block/utils/synced-block.d.ts +0 -24
  89. package/dist/types-ts4.5/pm-plugins/SyncClient.d.ts +0 -14
  90. package/dist/types-ts4.5/pm-plugins/utils.d.ts +0 -5
  91. package/dist/types-ts4.5/types/index.d.ts +0 -3
  92. package/dist/types-ts4.5/ui/extensions/synced-block/components/GlobalStyles.d.ts +0 -6
  93. package/dist/types-ts4.5/ui/extensions/synced-block/components/SyncedBlockLiveView.d.ts +0 -7
  94. package/dist/types-ts4.5/ui/extensions/synced-block/components/SyncedBlockRenderer.d.ts +0 -7
  95. package/dist/types-ts4.5/ui/extensions/synced-block/constants.d.ts +0 -8
  96. package/dist/types-ts4.5/ui/extensions/synced-block/getSyncedBlockExtensionProvider.d.ts +0 -3
  97. package/dist/types-ts4.5/ui/extensions/synced-block/hooks/useLiveSyncedBlockContent.d.ts +0 -6
  98. package/dist/types-ts4.5/ui/extensions/synced-block/hooks/usePollContentProperty.d.ts +0 -7
  99. package/dist/types-ts4.5/ui/extensions/synced-block/index.d.ts +0 -2
  100. package/dist/types-ts4.5/ui/extensions/synced-block/manifest.d.ts +0 -3
  101. package/dist/types-ts4.5/ui/extensions/synced-block/utils/ari.d.ts +0 -4
  102. package/dist/types-ts4.5/ui/extensions/synced-block/utils/content-property.d.ts +0 -33
  103. package/dist/types-ts4.5/ui/extensions/synced-block/utils/synced-block.d.ts +0 -24
package/CHANGELOG.md CHANGED
@@ -1,27 +1,17 @@
1
1
  # @atlaskit/editor-plugin-synced-block
2
2
 
3
- ## 0.1.2
3
+ ## 2.0.0
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - [`a2cd8c46a3e94`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a2cd8c46a3e94) -
8
- EDITOR-1442 Bump adf-schema
9
7
  - Updated dependencies
10
8
 
11
- ## 0.1.1
9
+ ## 1.0.0
12
10
 
13
- ### Patch Changes
14
-
15
- - [`7ce112e18ca29`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7ce112e18ca29) -
16
- [ux] Copy the sync block reference to clipboard
17
- - Updated dependencies
18
-
19
- ## 0.1.0
20
-
21
- ### Minor Changes
11
+ ### Major Changes
22
12
 
23
- - [`c29118e6ca79d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c29118e6ca79d) -
24
- ED-28986 create initial version of synced blocks
13
+ - [`168d76bdf8be6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/168d76bdf8be6) -
14
+ Created new synced-block plugin (scaffolding only)
25
15
 
26
16
  ### Patch Changes
27
17
 
@@ -22,21 +22,6 @@
22
22
  "../src/**/stories/**/*"
23
23
  ],
24
24
  "references": [
25
- {
26
- "path": "../../adf-utils/afm-cc/tsconfig.json"
27
- },
28
- {
29
- "path": "../../editor-json-transformer/afm-cc/tsconfig.json"
30
- },
31
- {
32
- "path": "../../../design-system/icon/afm-cc/tsconfig.json"
33
- },
34
- {
35
- "path": "../../renderer/afm-cc/tsconfig.json"
36
- },
37
- {
38
- "path": "../../../design-system/tokens/afm-cc/tsconfig.json"
39
- },
40
25
  {
41
26
  "path": "../../editor-common/afm-cc/tsconfig.json"
42
27
  }
@@ -22,21 +22,6 @@
22
22
  "../src/**/stories/**/*"
23
23
  ],
24
24
  "references": [
25
- {
26
- "path": "../../adf-utils/afm-dev-agents/tsconfig.json"
27
- },
28
- {
29
- "path": "../../editor-json-transformer/afm-dev-agents/tsconfig.json"
30
- },
31
- {
32
- "path": "../../../design-system/icon/afm-dev-agents/tsconfig.json"
33
- },
34
- {
35
- "path": "../../renderer/afm-dev-agents/tsconfig.json"
36
- },
37
- {
38
- "path": "../../../design-system/tokens/afm-dev-agents/tsconfig.json"
39
- },
40
25
  {
41
26
  "path": "../../editor-common/afm-dev-agents/tsconfig.json"
42
27
  }
@@ -22,21 +22,6 @@
22
22
  "../src/**/stories/**/*"
23
23
  ],
24
24
  "references": [
25
- {
26
- "path": "../../adf-utils/afm-jira/tsconfig.json"
27
- },
28
- {
29
- "path": "../../editor-json-transformer/afm-jira/tsconfig.json"
30
- },
31
- {
32
- "path": "../../../design-system/icon/afm-jira/tsconfig.json"
33
- },
34
- {
35
- "path": "../../renderer/afm-jira/tsconfig.json"
36
- },
37
- {
38
- "path": "../../../design-system/tokens/afm-jira/tsconfig.json"
39
- },
40
25
  {
41
26
  "path": "../../editor-common/afm-jira/tsconfig.json"
42
27
  }
@@ -22,21 +22,6 @@
22
22
  "../src/**/stories/**/*"
23
23
  ],
24
24
  "references": [
25
- {
26
- "path": "../../adf-utils/afm-passionfruit/tsconfig.json"
27
- },
28
- {
29
- "path": "../../editor-json-transformer/afm-passionfruit/tsconfig.json"
30
- },
31
- {
32
- "path": "../../../design-system/icon/afm-passionfruit/tsconfig.json"
33
- },
34
- {
35
- "path": "../../renderer/afm-passionfruit/tsconfig.json"
36
- },
37
- {
38
- "path": "../../../design-system/tokens/afm-passionfruit/tsconfig.json"
39
- },
40
25
  {
41
26
  "path": "../../editor-common/afm-passionfruit/tsconfig.json"
42
27
  }
@@ -22,21 +22,6 @@
22
22
  "../src/**/stories/**/*"
23
23
  ],
24
24
  "references": [
25
- {
26
- "path": "../../adf-utils/afm-post-office/tsconfig.json"
27
- },
28
- {
29
- "path": "../../editor-json-transformer/afm-post-office/tsconfig.json"
30
- },
31
- {
32
- "path": "../../../design-system/icon/afm-post-office/tsconfig.json"
33
- },
34
- {
35
- "path": "../../renderer/afm-post-office/tsconfig.json"
36
- },
37
- {
38
- "path": "../../../design-system/tokens/afm-post-office/tsconfig.json"
39
- },
40
25
  {
41
26
  "path": "../../editor-common/afm-post-office/tsconfig.json"
42
27
  }
@@ -22,21 +22,6 @@
22
22
  "../src/**/stories/**/*"
23
23
  ],
24
24
  "references": [
25
- {
26
- "path": "../../adf-utils/afm-rovo-extension/tsconfig.json"
27
- },
28
- {
29
- "path": "../../editor-json-transformer/afm-rovo-extension/tsconfig.json"
30
- },
31
- {
32
- "path": "../../../design-system/icon/afm-rovo-extension/tsconfig.json"
33
- },
34
- {
35
- "path": "../../renderer/afm-rovo-extension/tsconfig.json"
36
- },
37
- {
38
- "path": "../../../design-system/tokens/afm-rovo-extension/tsconfig.json"
39
- },
40
25
  {
41
26
  "path": "../../editor-common/afm-rovo-extension/tsconfig.json"
42
27
  }
@@ -22,21 +22,6 @@
22
22
  "../src/**/stories/**/*"
23
23
  ],
24
24
  "references": [
25
- {
26
- "path": "../../adf-utils/afm-townsquare/tsconfig.json"
27
- },
28
- {
29
- "path": "../../editor-json-transformer/afm-townsquare/tsconfig.json"
30
- },
31
- {
32
- "path": "../../../design-system/icon/afm-townsquare/tsconfig.json"
33
- },
34
- {
35
- "path": "../../renderer/afm-townsquare/tsconfig.json"
36
- },
37
- {
38
- "path": "../../../design-system/tokens/afm-townsquare/tsconfig.json"
39
- },
40
25
  {
41
26
  "path": "../../editor-common/afm-townsquare/tsconfig.json"
42
27
  }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getSyncedBlockNodeView = void 0;
8
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
9
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
+ var SyncedBlockNodeView = /*#__PURE__*/(0, _createClass2.default)(function SyncedBlockNodeView(node, view, getPos) {
11
+ (0, _classCallCheck2.default)(this, SyncedBlockNodeView);
12
+ this.node = node;
13
+ this.view = view;
14
+ this.getPos = getPos;
15
+ });
16
+ var getSyncedBlockNodeView = exports.getSyncedBlockNodeView = function getSyncedBlockNodeView() {
17
+ return function (node, view, getPos) {
18
+ return new SyncedBlockNodeView(node, view, getPos);
19
+ };
20
+ };
@@ -6,14 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.syncedBlockPluginKey = exports.createPlugin = void 0;
7
7
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
8
  var _state = require("@atlaskit/editor-prosemirror/state");
9
- var _SyncClient = require("./SyncClient");
10
- var _utils = require("./utils");
11
9
  var syncedBlockPluginKey = exports.syncedBlockPluginKey = new _state.PluginKey('syncedBlockPlugin');
12
10
 
13
11
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
14
12
 
15
13
  var createPlugin = exports.createPlugin = function createPlugin() {
16
- var syncClient = new _SyncClient.SyncClient();
17
14
  return new _safePlugin.SafePlugin({
18
15
  key: syncedBlockPluginKey,
19
16
  state: {
@@ -21,24 +18,6 @@ var createPlugin = exports.createPlugin = function createPlugin() {
21
18
  return {};
22
19
  },
23
20
  apply: function apply(tr, currentPluginState) {
24
- if (tr.docChanged) {
25
- var $pos = tr.selection.$from;
26
- var syncedBlockParent = (0, _utils.findSyncedBlockParent)($pos);
27
- if (syncedBlockParent) {
28
- var node = syncedBlockParent.node,
29
- attributes = syncedBlockParent.attributes;
30
- var _attributes$parameter = attributes.parameters,
31
- sourceDocumentAri = _attributes$parameter.sourceDocumentAri,
32
- contentAri = _attributes$parameter.contentAri,
33
- contentPropertyKey = _attributes$parameter.contentPropertyKey;
34
- syncClient.syncContent({
35
- sourceDocumentAri: sourceDocumentAri,
36
- contentAri: contentAri,
37
- contentPropertyKey: contentPropertyKey,
38
- node: node
39
- });
40
- }
41
- }
42
21
  var meta = tr.getMeta(syncedBlockPluginKey);
43
22
  if (meta) {
44
23
  return meta;
@@ -1,24 +1,28 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.syncedBlockPlugin = void 0;
8
- var _react = _interopRequireDefault(require("react"));
7
+ var _syncedBlock = require("./nodeviews/syncedBlock");
9
8
  var _main = require("./pm-plugins/main");
10
- var _GlobalStyles = require("./ui/extensions/synced-block/components/GlobalStyles");
9
+ var _floatingToolbar = require("./ui/floating-toolbar");
11
10
  var syncedBlockPlugin = exports.syncedBlockPlugin = function syncedBlockPlugin() {
12
11
  return {
13
12
  name: 'syncedBlock',
13
+ props: {
14
+ nodeViews: {
15
+ syncedBlock: (0, _syncedBlock.getSyncedBlockNodeView)()
16
+ }
17
+ },
14
18
  pmPlugins: function pmPlugins() {
15
19
  return [{
16
20
  name: 'syncedBlockPlugin',
17
21
  plugin: _main.createPlugin
18
22
  }];
19
23
  },
20
- contentComponent: function contentComponent() {
21
- return /*#__PURE__*/_react.default.createElement(_GlobalStyles.GlobalStylesWrapper, null);
24
+ pluginsOptions: {
25
+ floatingToolbar: (0, _floatingToolbar.getToolbarConfig)()
22
26
  }
23
27
  };
24
28
  };
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getToolbarConfig = void 0;
8
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
+ var basicButton = function basicButton(formatMessage) {
10
+ return [{
11
+ id: 'placeholder',
12
+ type: 'button',
13
+ onClick: function onClick() {
14
+ return true;
15
+ },
16
+ title: formatMessage({
17
+ id: 'placeholder',
18
+ defaultMessage: 'Message',
19
+ description: 'Placeholder description.'
20
+ })
21
+ }];
22
+ };
23
+ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
24
+ return function (state, intl) {
25
+ var formatMessage = intl.formatMessage;
26
+
27
+ // placeholder nodeType
28
+ var nodeType = [state.schema.nodes.paragraph];
29
+ var basicButtonArray = basicButton(formatMessage);
30
+ return {
31
+ title: 'Floating controls',
32
+ nodeType: nodeType,
33
+ items: [].concat((0, _toConsumableArray2.default)(basicButtonArray), [{
34
+ type: 'separator'
35
+ }]),
36
+ scrollable: true
37
+ };
38
+ };
39
+ };
@@ -0,0 +1,10 @@
1
+ class SyncedBlockNodeView {
2
+ constructor(node, view, getPos) {
3
+ this.node = node;
4
+ this.view = view;
5
+ this.getPos = getPos;
6
+ }
7
+ }
8
+ export const getSyncedBlockNodeView = () => (node, view, getPos) => {
9
+ return new SyncedBlockNodeView(node, view, getPos);
10
+ };
@@ -1,13 +1,10 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import { SyncClient } from './SyncClient';
4
- import { findSyncedBlockParent } from './utils';
5
3
  export const syncedBlockPluginKey = new PluginKey('syncedBlockPlugin');
6
4
 
7
5
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
8
6
 
9
7
  export const createPlugin = () => {
10
- const syncClient = new SyncClient();
11
8
  return new SafePlugin({
12
9
  key: syncedBlockPluginKey,
13
10
  state: {
@@ -15,27 +12,6 @@ export const createPlugin = () => {
15
12
  return {};
16
13
  },
17
14
  apply: (tr, currentPluginState) => {
18
- if (tr.docChanged) {
19
- const $pos = tr.selection.$from;
20
- const syncedBlockParent = findSyncedBlockParent($pos);
21
- if (syncedBlockParent) {
22
- const {
23
- node,
24
- attributes
25
- } = syncedBlockParent;
26
- const {
27
- sourceDocumentAri,
28
- contentAri,
29
- contentPropertyKey
30
- } = attributes.parameters;
31
- syncClient.syncContent({
32
- sourceDocumentAri,
33
- contentAri,
34
- contentPropertyKey,
35
- node
36
- });
37
- }
38
- }
39
15
  const meta = tr.getMeta(syncedBlockPluginKey);
40
16
  if (meta) {
41
17
  return meta;
@@ -1,17 +1,20 @@
1
- import React from 'react';
1
+ import { getSyncedBlockNodeView } from './nodeviews/syncedBlock';
2
2
  import { createPlugin } from './pm-plugins/main';
3
- import { GlobalStylesWrapper } from './ui/extensions/synced-block/components/GlobalStyles';
4
- export const syncedBlockPlugin = () => {
5
- return {
6
- name: 'syncedBlock',
7
- pmPlugins() {
8
- return [{
9
- name: 'syncedBlockPlugin',
10
- plugin: createPlugin
11
- }];
12
- },
13
- contentComponent() {
14
- return /*#__PURE__*/React.createElement(GlobalStylesWrapper, null);
3
+ import { getToolbarConfig } from './ui/floating-toolbar';
4
+ export const syncedBlockPlugin = () => ({
5
+ name: 'syncedBlock',
6
+ props: {
7
+ nodeViews: {
8
+ syncedBlock: getSyncedBlockNodeView()
15
9
  }
16
- };
17
- };
10
+ },
11
+ pmPlugins() {
12
+ return [{
13
+ name: 'syncedBlockPlugin',
14
+ plugin: createPlugin
15
+ }];
16
+ },
17
+ pluginsOptions: {
18
+ floatingToolbar: getToolbarConfig()
19
+ }
20
+ });
@@ -0,0 +1,31 @@
1
+ const basicButton = formatMessage => {
2
+ return [{
3
+ id: 'placeholder',
4
+ type: 'button',
5
+ onClick: () => {
6
+ return true;
7
+ },
8
+ title: formatMessage({
9
+ id: 'placeholder',
10
+ defaultMessage: 'Message',
11
+ description: 'Placeholder description.'
12
+ })
13
+ }];
14
+ };
15
+ export const getToolbarConfig = () => (state, intl) => {
16
+ const {
17
+ formatMessage
18
+ } = intl;
19
+
20
+ // placeholder nodeType
21
+ const nodeType = [state.schema.nodes.paragraph];
22
+ const basicButtonArray = basicButton(formatMessage);
23
+ return {
24
+ title: 'Floating controls',
25
+ nodeType,
26
+ items: [...basicButtonArray, {
27
+ type: 'separator'
28
+ }],
29
+ scrollable: true
30
+ };
31
+ };
@@ -0,0 +1,13 @@
1
+ import _createClass from "@babel/runtime/helpers/createClass";
2
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
+ var SyncedBlockNodeView = /*#__PURE__*/_createClass(function SyncedBlockNodeView(node, view, getPos) {
4
+ _classCallCheck(this, SyncedBlockNodeView);
5
+ this.node = node;
6
+ this.view = view;
7
+ this.getPos = getPos;
8
+ });
9
+ export var getSyncedBlockNodeView = function getSyncedBlockNodeView() {
10
+ return function (node, view, getPos) {
11
+ return new SyncedBlockNodeView(node, view, getPos);
12
+ };
13
+ };
@@ -1,13 +1,10 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import { SyncClient } from './SyncClient';
4
- import { findSyncedBlockParent } from './utils';
5
3
  export var syncedBlockPluginKey = new PluginKey('syncedBlockPlugin');
6
4
 
7
5
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
8
6
 
9
7
  export var createPlugin = function createPlugin() {
10
- var syncClient = new SyncClient();
11
8
  return new SafePlugin({
12
9
  key: syncedBlockPluginKey,
13
10
  state: {
@@ -15,24 +12,6 @@ export var createPlugin = function createPlugin() {
15
12
  return {};
16
13
  },
17
14
  apply: function apply(tr, currentPluginState) {
18
- if (tr.docChanged) {
19
- var $pos = tr.selection.$from;
20
- var syncedBlockParent = findSyncedBlockParent($pos);
21
- if (syncedBlockParent) {
22
- var node = syncedBlockParent.node,
23
- attributes = syncedBlockParent.attributes;
24
- var _attributes$parameter = attributes.parameters,
25
- sourceDocumentAri = _attributes$parameter.sourceDocumentAri,
26
- contentAri = _attributes$parameter.contentAri,
27
- contentPropertyKey = _attributes$parameter.contentPropertyKey;
28
- syncClient.syncContent({
29
- sourceDocumentAri: sourceDocumentAri,
30
- contentAri: contentAri,
31
- contentPropertyKey: contentPropertyKey,
32
- node: node
33
- });
34
- }
35
- }
36
15
  var meta = tr.getMeta(syncedBlockPluginKey);
37
16
  if (meta) {
38
17
  return meta;
@@ -1,17 +1,22 @@
1
- import React from 'react';
1
+ import { getSyncedBlockNodeView } from './nodeviews/syncedBlock';
2
2
  import { createPlugin } from './pm-plugins/main';
3
- import { GlobalStylesWrapper } from './ui/extensions/synced-block/components/GlobalStyles';
3
+ import { getToolbarConfig } from './ui/floating-toolbar';
4
4
  export var syncedBlockPlugin = function syncedBlockPlugin() {
5
5
  return {
6
6
  name: 'syncedBlock',
7
+ props: {
8
+ nodeViews: {
9
+ syncedBlock: getSyncedBlockNodeView()
10
+ }
11
+ },
7
12
  pmPlugins: function pmPlugins() {
8
13
  return [{
9
14
  name: 'syncedBlockPlugin',
10
15
  plugin: createPlugin
11
16
  }];
12
17
  },
13
- contentComponent: function contentComponent() {
14
- return /*#__PURE__*/React.createElement(GlobalStylesWrapper, null);
18
+ pluginsOptions: {
19
+ floatingToolbar: getToolbarConfig()
15
20
  }
16
21
  };
17
22
  };
@@ -0,0 +1,32 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ var basicButton = function basicButton(formatMessage) {
3
+ return [{
4
+ id: 'placeholder',
5
+ type: 'button',
6
+ onClick: function onClick() {
7
+ return true;
8
+ },
9
+ title: formatMessage({
10
+ id: 'placeholder',
11
+ defaultMessage: 'Message',
12
+ description: 'Placeholder description.'
13
+ })
14
+ }];
15
+ };
16
+ export var getToolbarConfig = function getToolbarConfig() {
17
+ return function (state, intl) {
18
+ var formatMessage = intl.formatMessage;
19
+
20
+ // placeholder nodeType
21
+ var nodeType = [state.schema.nodes.paragraph];
22
+ var basicButtonArray = basicButton(formatMessage);
23
+ return {
24
+ title: 'Floating controls',
25
+ nodeType: nodeType,
26
+ items: [].concat(_toConsumableArray(basicButtonArray), [{
27
+ type: 'separator'
28
+ }]),
29
+ scrollable: true
30
+ };
31
+ };
32
+ };
@@ -1,3 +1,2 @@
1
1
  export { syncedBlockPlugin } from './syncedBlockPlugin';
2
2
  export type { SyncedBlockPlugin } from './syncedBlockPluginType';
3
- export type { SyncedBlockPluginOptions } from './types';
@@ -0,0 +1,11 @@
1
+ import type { getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
2
+ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
+ declare class SyncedBlockNodeView {
5
+ node: PMNode;
6
+ view: EditorView;
7
+ getPos: getPosHandlerNode;
8
+ constructor(node: PMNode, view: EditorView, getPos: getPosHandlerNode);
9
+ }
10
+ export declare const getSyncedBlockNodeView: () => (node: PMNode, view: EditorView, getPos: getPosHandler) => SyncedBlockNodeView;
11
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { FloatingToolbarHandler } from '@atlaskit/editor-common/types';
2
+ export declare const getToolbarConfig: () => FloatingToolbarHandler;
@@ -1,3 +1,2 @@
1
1
  export { syncedBlockPlugin } from './syncedBlockPlugin';
2
2
  export type { SyncedBlockPlugin } from './syncedBlockPluginType';
3
- export type { SyncedBlockPluginOptions } from './types';
@@ -0,0 +1,11 @@
1
+ import type { getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
2
+ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
+ declare class SyncedBlockNodeView {
5
+ node: PMNode;
6
+ view: EditorView;
7
+ getPos: getPosHandlerNode;
8
+ constructor(node: PMNode, view: EditorView, getPos: getPosHandlerNode);
9
+ }
10
+ export declare const getSyncedBlockNodeView: () => (node: PMNode, view: EditorView, getPos: getPosHandler) => SyncedBlockNodeView;
11
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { FloatingToolbarHandler } from '@atlaskit/editor-common/types';
2
+ export declare const getToolbarConfig: () => FloatingToolbarHandler;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-synced-block",
3
- "version": "0.1.2",
3
+ "version": "2.0.0",
4
4
  "description": "SyncedBlock plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -28,18 +28,12 @@
28
28
  "sideEffects": false,
29
29
  "atlaskit:src": "src/index.ts",
30
30
  "dependencies": {
31
- "@atlaskit/adf-schema": "^50.2.3",
32
- "@atlaskit/adf-utils": "^19.21.0",
33
- "@atlaskit/editor-json-transformer": "^8.27.0",
34
31
  "@atlaskit/editor-prosemirror": "7.0.0",
35
- "@atlaskit/icon": "^28.1.0",
36
- "@atlaskit/renderer": "^120.5.0",
37
- "@atlaskit/tokens": "^6.1.0",
38
32
  "@babel/runtime": "^7.0.0",
39
- "@emotion/react": "^11.7.1"
33
+ "react-intl-next": "npm:react-intl@^5.18.1"
40
34
  },
41
35
  "peerDependencies": {
42
- "@atlaskit/editor-common": "^107.33.0",
36
+ "@atlaskit/editor-common": "^109.0.0",
43
37
  "react": "^18.2.0"
44
38
  },
45
39
  "devDependencies": {
@@ -1,15 +0,0 @@
1
- {
2
- "name": "@atlaskit/editor-plugin-synced-block/SyncedBlock",
3
- "main": "../dist/cjs/ui/extensions/synced-block/index.js",
4
- "module": "../dist/esm/ui/extensions/synced-block/index.js",
5
- "module:es2019": "../dist/es2019/ui/extensions/synced-block/index.js",
6
- "sideEffects": false,
7
- "types": "../dist/types/ui/extensions/synced-block/index.d.ts",
8
- "typesVersions": {
9
- ">=4.5 <5.9": {
10
- "*": [
11
- "../dist/types-ts4.5/ui/extensions/synced-block/index.d.ts"
12
- ]
13
- }
14
- }
15
- }