@atlaskit/editor-plugin-synced-block 4.3.15 → 4.4.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,17 @@
1
1
  # @atlaskit/editor-plugin-synced-block
2
2
 
3
+ ## 4.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`676d28a61e356`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/676d28a61e356) -
8
+ Add runtime blockAri generation for endpoint calls, update resourceId generation for create
9
+ reference from toolbar
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 4.3.15
4
16
 
5
17
  ### Patch Changes
@@ -59,17 +59,21 @@ var createSyncedBlock = exports.createSyncedBlock = function createSyncedBlock(_
59
59
  // see filterTransaction for more details
60
60
  return tr;
61
61
  };
62
- var copySyncedBlockReferenceToClipboardEditorCommand = exports.copySyncedBlockReferenceToClipboardEditorCommand = function copySyncedBlockReferenceToClipboardEditorCommand(_ref2) {
63
- var tr = _ref2.tr;
64
- if (copySyncedBlockReferenceToClipboardInternal(tr.doc.type.schema, tr.selection)) {
65
- return tr;
66
- }
67
- return null;
62
+ var copySyncedBlockReferenceToClipboardEditorCommand = exports.copySyncedBlockReferenceToClipboardEditorCommand = function copySyncedBlockReferenceToClipboardEditorCommand(syncBlockStore) {
63
+ return function (_ref2) {
64
+ var tr = _ref2.tr;
65
+ if (copySyncedBlockReferenceToClipboardInternal(tr.doc.type.schema, tr.selection, syncBlockStore)) {
66
+ return tr;
67
+ }
68
+ return null;
69
+ };
68
70
  };
69
- var copySyncedBlockReferenceToClipboard = exports.copySyncedBlockReferenceToClipboard = function copySyncedBlockReferenceToClipboard(state, _dispatch, _view) {
70
- return copySyncedBlockReferenceToClipboardInternal(state.tr.doc.type.schema, state.tr.selection);
71
+ var copySyncedBlockReferenceToClipboard = exports.copySyncedBlockReferenceToClipboard = function copySyncedBlockReferenceToClipboard(syncBlockStore) {
72
+ return function (state, _dispatch, _view) {
73
+ return copySyncedBlockReferenceToClipboardInternal(state.tr.doc.type.schema, state.tr.selection, syncBlockStore);
74
+ };
71
75
  };
72
- var copySyncedBlockReferenceToClipboardInternal = function copySyncedBlockReferenceToClipboardInternal(schema, selection) {
76
+ var copySyncedBlockReferenceToClipboardInternal = function copySyncedBlockReferenceToClipboardInternal(schema, selection, syncBlockStore) {
73
77
  var syncBlockFindResult = (0, _utils2.findSyncBlockOrBodiedSyncBlock)(schema, selection);
74
78
  if (!syncBlockFindResult) {
75
79
  return false;
@@ -81,7 +85,7 @@ var copySyncedBlockReferenceToClipboardInternal = function copySyncedBlockRefere
81
85
 
82
86
  // create sync block reference node
83
87
  referenceSyncBlockNode = syncBlock.createAndFill({
84
- resourceId: syncBlockFindResult.node.attrs.resourceId
88
+ resourceId: syncBlockStore.referenceManager.generateResourceIdForReference(syncBlockFindResult.node.attrs.resourceId)
85
89
  });
86
90
  if (!referenceSyncBlockNode) {
87
91
  return false;
@@ -48,7 +48,7 @@ var syncedBlockPlugin = exports.syncedBlockPlugin = function syncedBlockPlugin(_
48
48
  },
49
49
  commands: {
50
50
  copySyncedBlockReferenceToClipboard: function copySyncedBlockReferenceToClipboard() {
51
- return _editorCommands.copySyncedBlockReferenceToClipboardEditorCommand;
51
+ return (0, _editorCommands.copySyncedBlockReferenceToClipboardEditorCommand)(syncBlockStore);
52
52
  },
53
53
  insertSyncedBlock: function insertSyncedBlock() {
54
54
  return function (_ref2) {
@@ -47,7 +47,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(stat
47
47
  title: formatMessage(_messages.syncBlockMessages.copySyncBlockLabel),
48
48
  showTitle: false,
49
49
  tooltipContent: formatMessage(_messages.syncBlockMessages.copySyncBlockTooltip),
50
- onClick: _editorCommands.copySyncedBlockReferenceToClipboard
50
+ onClick: (0, _editorCommands.copySyncedBlockReferenceToClipboard)(syncBlockStore)
51
51
  }, hoverDecorationProps(nodeType, _consts.akEditorSelectedNodeClassName));
52
52
  items.push(copyButton);
53
53
  var disabled = !syncBlockStore.referenceManager.getSyncBlockURL(syncBlockObject.node.attrs.resourceId);
@@ -59,18 +59,18 @@ export const createSyncedBlock = ({
59
59
  // see filterTransaction for more details
60
60
  return tr;
61
61
  };
62
- export const copySyncedBlockReferenceToClipboardEditorCommand = ({
62
+ export const copySyncedBlockReferenceToClipboardEditorCommand = syncBlockStore => ({
63
63
  tr
64
64
  }) => {
65
- if (copySyncedBlockReferenceToClipboardInternal(tr.doc.type.schema, tr.selection)) {
65
+ if (copySyncedBlockReferenceToClipboardInternal(tr.doc.type.schema, tr.selection, syncBlockStore)) {
66
66
  return tr;
67
67
  }
68
68
  return null;
69
69
  };
70
- export const copySyncedBlockReferenceToClipboard = (state, _dispatch, _view) => {
71
- return copySyncedBlockReferenceToClipboardInternal(state.tr.doc.type.schema, state.tr.selection);
70
+ export const copySyncedBlockReferenceToClipboard = syncBlockStore => (state, _dispatch, _view) => {
71
+ return copySyncedBlockReferenceToClipboardInternal(state.tr.doc.type.schema, state.tr.selection, syncBlockStore);
72
72
  };
73
- const copySyncedBlockReferenceToClipboardInternal = (schema, selection) => {
73
+ const copySyncedBlockReferenceToClipboardInternal = (schema, selection, syncBlockStore) => {
74
74
  const syncBlockFindResult = findSyncBlockOrBodiedSyncBlock(schema, selection);
75
75
  if (!syncBlockFindResult) {
76
76
  return false;
@@ -86,7 +86,7 @@ const copySyncedBlockReferenceToClipboardInternal = (schema, selection) => {
86
86
 
87
87
  // create sync block reference node
88
88
  referenceSyncBlockNode = syncBlock.createAndFill({
89
- resourceId: syncBlockFindResult.node.attrs.resourceId
89
+ resourceId: syncBlockStore.referenceManager.generateResourceIdForReference(syncBlockFindResult.node.attrs.resourceId)
90
90
  });
91
91
  if (!referenceSyncBlockNode) {
92
92
  return false;
@@ -39,7 +39,7 @@ export const syncedBlockPlugin = ({
39
39
  }];
40
40
  },
41
41
  commands: {
42
- copySyncedBlockReferenceToClipboard: () => copySyncedBlockReferenceToClipboardEditorCommand,
42
+ copySyncedBlockReferenceToClipboard: () => copySyncedBlockReferenceToClipboardEditorCommand(syncBlockStore),
43
43
  insertSyncedBlock: () => ({
44
44
  tr
45
45
  }) => createSyncedBlock({
@@ -41,7 +41,7 @@ export const getToolbarConfig = (state, intl, api, syncBlockStore) => {
41
41
  title: formatMessage(messages.copySyncBlockLabel),
42
42
  showTitle: false,
43
43
  tooltipContent: formatMessage(messages.copySyncBlockTooltip),
44
- onClick: copySyncedBlockReferenceToClipboard,
44
+ onClick: copySyncedBlockReferenceToClipboard(syncBlockStore),
45
45
  ...hoverDecorationProps(nodeType, akEditorSelectedNodeClassName)
46
46
  };
47
47
  items.push(copyButton);
@@ -53,17 +53,21 @@ export var createSyncedBlock = function createSyncedBlock(_ref) {
53
53
  // see filterTransaction for more details
54
54
  return tr;
55
55
  };
56
- export var copySyncedBlockReferenceToClipboardEditorCommand = function copySyncedBlockReferenceToClipboardEditorCommand(_ref2) {
57
- var tr = _ref2.tr;
58
- if (copySyncedBlockReferenceToClipboardInternal(tr.doc.type.schema, tr.selection)) {
59
- return tr;
60
- }
61
- return null;
56
+ export var copySyncedBlockReferenceToClipboardEditorCommand = function copySyncedBlockReferenceToClipboardEditorCommand(syncBlockStore) {
57
+ return function (_ref2) {
58
+ var tr = _ref2.tr;
59
+ if (copySyncedBlockReferenceToClipboardInternal(tr.doc.type.schema, tr.selection, syncBlockStore)) {
60
+ return tr;
61
+ }
62
+ return null;
63
+ };
62
64
  };
63
- export var copySyncedBlockReferenceToClipboard = function copySyncedBlockReferenceToClipboard(state, _dispatch, _view) {
64
- return copySyncedBlockReferenceToClipboardInternal(state.tr.doc.type.schema, state.tr.selection);
65
+ export var copySyncedBlockReferenceToClipboard = function copySyncedBlockReferenceToClipboard(syncBlockStore) {
66
+ return function (state, _dispatch, _view) {
67
+ return copySyncedBlockReferenceToClipboardInternal(state.tr.doc.type.schema, state.tr.selection, syncBlockStore);
68
+ };
65
69
  };
66
- var copySyncedBlockReferenceToClipboardInternal = function copySyncedBlockReferenceToClipboardInternal(schema, selection) {
70
+ var copySyncedBlockReferenceToClipboardInternal = function copySyncedBlockReferenceToClipboardInternal(schema, selection, syncBlockStore) {
67
71
  var syncBlockFindResult = findSyncBlockOrBodiedSyncBlock(schema, selection);
68
72
  if (!syncBlockFindResult) {
69
73
  return false;
@@ -75,7 +79,7 @@ var copySyncedBlockReferenceToClipboardInternal = function copySyncedBlockRefere
75
79
 
76
80
  // create sync block reference node
77
81
  referenceSyncBlockNode = syncBlock.createAndFill({
78
- resourceId: syncBlockFindResult.node.attrs.resourceId
82
+ resourceId: syncBlockStore.referenceManager.generateResourceIdForReference(syncBlockFindResult.node.attrs.resourceId)
79
83
  });
80
84
  if (!referenceSyncBlockNode) {
81
85
  return false;
@@ -41,7 +41,7 @@ export var syncedBlockPlugin = function syncedBlockPlugin(_ref) {
41
41
  },
42
42
  commands: {
43
43
  copySyncedBlockReferenceToClipboard: function copySyncedBlockReferenceToClipboard() {
44
- return copySyncedBlockReferenceToClipboardEditorCommand;
44
+ return copySyncedBlockReferenceToClipboardEditorCommand(syncBlockStore);
45
45
  },
46
46
  insertSyncedBlock: function insertSyncedBlock() {
47
47
  return function (_ref2) {
@@ -38,7 +38,7 @@ export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBl
38
38
  title: formatMessage(messages.copySyncBlockLabel),
39
39
  showTitle: false,
40
40
  tooltipContent: formatMessage(messages.copySyncBlockTooltip),
41
- onClick: copySyncedBlockReferenceToClipboard
41
+ onClick: copySyncedBlockReferenceToClipboard(syncBlockStore)
42
42
  }, hoverDecorationProps(nodeType, akEditorSelectedNodeClassName));
43
43
  items.push(copyButton);
44
44
  var disabled = !syncBlockStore.referenceManager.getSyncBlockURL(syncBlockObject.node.attrs.resourceId);
@@ -8,8 +8,8 @@ type createSyncedBlockProps = {
8
8
  typeAheadInsert?: TypeAheadInsert;
9
9
  };
10
10
  export declare const createSyncedBlock: ({ tr, syncBlockStore, typeAheadInsert, }: createSyncedBlockProps) => false | Transaction;
11
- export declare const copySyncedBlockReferenceToClipboardEditorCommand: EditorCommand;
12
- export declare const copySyncedBlockReferenceToClipboard: Command;
11
+ export declare const copySyncedBlockReferenceToClipboardEditorCommand: (syncBlockStore: SyncBlockStoreManager) => EditorCommand;
12
+ export declare const copySyncedBlockReferenceToClipboard: (syncBlockStore: SyncBlockStoreManager) => Command;
13
13
  export declare const editSyncedBlockSource: (syncBlockStore: SyncBlockStoreManager, api?: ExtractInjectionAPI<SyncedBlockPlugin>) => Command;
14
14
  export declare const removeSyncedBlock: (api?: ExtractInjectionAPI<SyncedBlockPlugin>) => Command;
15
15
  export {};
@@ -8,8 +8,8 @@ type createSyncedBlockProps = {
8
8
  typeAheadInsert?: TypeAheadInsert;
9
9
  };
10
10
  export declare const createSyncedBlock: ({ tr, syncBlockStore, typeAheadInsert, }: createSyncedBlockProps) => false | Transaction;
11
- export declare const copySyncedBlockReferenceToClipboardEditorCommand: EditorCommand;
12
- export declare const copySyncedBlockReferenceToClipboard: Command;
11
+ export declare const copySyncedBlockReferenceToClipboardEditorCommand: (syncBlockStore: SyncBlockStoreManager) => EditorCommand;
12
+ export declare const copySyncedBlockReferenceToClipboard: (syncBlockStore: SyncBlockStoreManager) => Command;
13
13
  export declare const editSyncedBlockSource: (syncBlockStore: SyncBlockStoreManager, api?: ExtractInjectionAPI<SyncedBlockPlugin>) => Command;
14
14
  export declare const removeSyncedBlock: (api?: ExtractInjectionAPI<SyncedBlockPlugin>) => Command;
15
15
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-synced-block",
3
- "version": "4.3.15",
3
+ "version": "4.4.0",
4
4
  "description": "SyncedBlock plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -39,7 +39,7 @@
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.12.0",
42
+ "@atlaskit/editor-synced-block-provider": "^2.13.0",
43
43
  "@atlaskit/editor-tables": "^2.9.0",
44
44
  "@atlaskit/editor-toolbar": "^0.18.0",
45
45
  "@atlaskit/flag": "^17.5.0",