@atlaskit/editor-plugin-synced-block 3.8.2 → 3.9.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 +12 -0
- package/dist/cjs/editor-actions/index.js +9 -0
- package/dist/cjs/{pm-plugins/actions.js → editor-commands/index.js} +1 -1
- package/dist/cjs/syncedBlockPlugin.js +9 -3
- package/dist/cjs/ui/floating-toolbar.js +4 -4
- package/dist/es2019/editor-actions/index.js +3 -0
- package/dist/es2019/{pm-plugins/actions.js → editor-commands/index.js} +1 -1
- package/dist/es2019/syncedBlockPlugin.js +7 -1
- package/dist/es2019/ui/floating-toolbar.js +1 -1
- package/dist/esm/editor-actions/index.js +3 -0
- package/dist/esm/{pm-plugins/actions.js → editor-commands/index.js} +1 -1
- package/dist/esm/syncedBlockPlugin.js +7 -1
- package/dist/esm/ui/floating-toolbar.js +1 -1
- package/dist/types/editor-actions/index.d.ts +2 -0
- package/dist/types/syncedBlockPluginType.d.ts +10 -0
- package/dist/types-ts4.5/editor-actions/index.d.ts +2 -0
- package/dist/types-ts4.5/syncedBlockPluginType.d.ts +10 -0
- package/package.json +2 -2
- /package/dist/types/{pm-plugins/actions.d.ts → editor-commands/index.d.ts} +0 -0
- /package/dist/types-ts4.5/{pm-plugins/actions.d.ts → editor-commands/index.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
+
## 3.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`49860e3111ce8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/49860e3111ce8) -
|
|
8
|
+
[ux] [EDITOR-2481] Implement plugin action flushBodiedSyncBlocks so that bodied sync block content
|
|
9
|
+
is only updated when required
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 3.8.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.flushBodiedSyncBlocks = void 0;
|
|
7
|
+
var flushBodiedSyncBlocks = exports.flushBodiedSyncBlocks = function flushBodiedSyncBlocks(syncBlockStore) {
|
|
8
|
+
return syncBlockStore.flushBodiedSyncBlocks();
|
|
9
|
+
};
|
|
@@ -9,7 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
10
|
var _copyButton = require("@atlaskit/editor-common/copy-button");
|
|
11
11
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
12
|
-
var _utils2 = require("
|
|
12
|
+
var _utils2 = require("../pm-plugins/utils/utils");
|
|
13
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
14
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
15
|
var createSyncedBlock = exports.createSyncedBlock = function createSyncedBlock(_ref) {
|
|
@@ -10,7 +10,8 @@ var _adfSchema = require("@atlaskit/adf-schema");
|
|
|
10
10
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
11
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
12
12
|
var _editorSyncedBlockProvider = require("@atlaskit/editor-synced-block-provider");
|
|
13
|
-
var
|
|
13
|
+
var _editorActions = require("./editor-actions");
|
|
14
|
+
var _editorCommands = require("./editor-commands");
|
|
14
15
|
var _main = require("./pm-plugins/main");
|
|
15
16
|
var _blockMenuComponents = require("./ui/block-menu-components");
|
|
16
17
|
var _ContentComponent = require("./ui/ContentComponent");
|
|
@@ -44,13 +45,18 @@ var syncedBlockPlugin = exports.syncedBlockPlugin = function syncedBlockPlugin(_
|
|
|
44
45
|
insertSyncedBlock: function insertSyncedBlock() {
|
|
45
46
|
return function (_ref2) {
|
|
46
47
|
var tr = _ref2.tr;
|
|
47
|
-
return (0,
|
|
48
|
+
return (0, _editorCommands.createSyncedBlock)({
|
|
48
49
|
tr: tr,
|
|
49
50
|
syncBlockStore: syncBlockStore
|
|
50
51
|
}) || null;
|
|
51
52
|
};
|
|
52
53
|
}
|
|
53
54
|
},
|
|
55
|
+
actions: {
|
|
56
|
+
flushBodiedSyncBlocks: function flushBodiedSyncBlocks() {
|
|
57
|
+
return (0, _editorActions.flushBodiedSyncBlocks)(syncBlockStore);
|
|
58
|
+
}
|
|
59
|
+
},
|
|
54
60
|
pluginsOptions: {
|
|
55
61
|
quickInsert: function quickInsert(_ref3) {
|
|
56
62
|
var formatMessage = _ref3.formatMessage;
|
|
@@ -67,7 +73,7 @@ var syncedBlockPlugin = exports.syncedBlockPlugin = function syncedBlockPlugin(_
|
|
|
67
73
|
});
|
|
68
74
|
},
|
|
69
75
|
action: function action(insert, state) {
|
|
70
|
-
return (0,
|
|
76
|
+
return (0, _editorCommands.createSyncedBlock)({
|
|
71
77
|
tr: state.tr,
|
|
72
78
|
syncBlockStore: syncBlockStore,
|
|
73
79
|
typeAheadInsert: insert
|
|
@@ -14,7 +14,7 @@ var _consts = require("@atlaskit/editor-shared-styles/consts");
|
|
|
14
14
|
var _copy = _interopRequireDefault(require("@atlaskit/icon/core/copy"));
|
|
15
15
|
var _delete = _interopRequireDefault(require("@atlaskit/icon/core/delete"));
|
|
16
16
|
var _linkExternal = _interopRequireDefault(require("@atlaskit/icon/core/link-external"));
|
|
17
|
-
var
|
|
17
|
+
var _editorCommands = require("../editor-commands");
|
|
18
18
|
var _utils2 = require("../pm-plugins/utils/utils");
|
|
19
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
20
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -51,7 +51,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(stat
|
|
|
51
51
|
title: formatMessage(_messages.syncBlockMessages.copySyncBlockLabel),
|
|
52
52
|
showTitle: true,
|
|
53
53
|
tooltipContent: formatMessage(_messages.syncBlockMessages.copySyncBlockTooltip),
|
|
54
|
-
onClick: (0,
|
|
54
|
+
onClick: (0, _editorCommands.copySyncedBlockReferenceToClipboard)(api)
|
|
55
55
|
}, hoverDecorationProps(nodeType, _consts.akEditorSelectedNodeClassName));
|
|
56
56
|
items.push(copyButton);
|
|
57
57
|
var disabled = !syncBlockStore.getSyncBlockURL(syncBlockObject.node.attrs.localId);
|
|
@@ -65,7 +65,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(stat
|
|
|
65
65
|
title: formatMessage(_messages.syncBlockMessages.editSourceLabel),
|
|
66
66
|
showTitle: true,
|
|
67
67
|
tooltipContent: disabled ? formatMessage(_messages.syncBlockMessages.editSourceTooltipDisabled) : formatMessage(_messages.syncBlockMessages.editSourceTooltip),
|
|
68
|
-
onClick: (0,
|
|
68
|
+
onClick: (0, _editorCommands.editSyncedBlockSource)(syncBlockStore, api)
|
|
69
69
|
}, hoverDecorationProps(nodeType, _consts.akEditorSelectedNodeClassName));
|
|
70
70
|
items.push(editSourceButton);
|
|
71
71
|
}
|
|
@@ -81,7 +81,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(stat
|
|
|
81
81
|
testId: testId,
|
|
82
82
|
options: [_objectSpread({
|
|
83
83
|
title: formatMessage(_messages.default.delete),
|
|
84
|
-
onClick: (0,
|
|
84
|
+
onClick: (0, _editorCommands.removeSyncedBlock)(api),
|
|
85
85
|
icon: /*#__PURE__*/_react.default.createElement(_delete.default, {
|
|
86
86
|
label: ""
|
|
87
87
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { copyDomNode, toDOM } from '@atlaskit/editor-common/copy-button';
|
|
3
3
|
import { findSelectedNodeOfType, removeParentNodeOfType, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
-
import { canBeConvertedToSyncBlock, findSyncBlock, findSyncBlockOrBodiedSyncBlock, isBodiedSyncBlockNode } from '
|
|
4
|
+
import { canBeConvertedToSyncBlock, findSyncBlock, findSyncBlockOrBodiedSyncBlock, isBodiedSyncBlockNode } from '../pm-plugins/utils/utils';
|
|
5
5
|
export const createSyncedBlock = ({
|
|
6
6
|
tr,
|
|
7
7
|
syncBlockStore,
|
|
@@ -3,7 +3,8 @@ import { bodiedSyncBlock, syncBlock } from '@atlaskit/adf-schema';
|
|
|
3
3
|
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { IconSyncBlock } from '@atlaskit/editor-common/quick-insert';
|
|
5
5
|
import { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
6
|
-
import {
|
|
6
|
+
import { flushBodiedSyncBlocks } from './editor-actions';
|
|
7
|
+
import { createSyncedBlock } from './editor-commands';
|
|
7
8
|
import { createPlugin } from './pm-plugins/main';
|
|
8
9
|
import { getBlockMenuComponents } from './ui/block-menu-components';
|
|
9
10
|
import { ContentComponent } from './ui/ContentComponent';
|
|
@@ -40,6 +41,11 @@ export const syncedBlockPlugin = ({
|
|
|
40
41
|
syncBlockStore
|
|
41
42
|
}) || null
|
|
42
43
|
},
|
|
44
|
+
actions: {
|
|
45
|
+
flushBodiedSyncBlocks: () => {
|
|
46
|
+
return flushBodiedSyncBlocks(syncBlockStore);
|
|
47
|
+
}
|
|
48
|
+
},
|
|
43
49
|
pluginsOptions: {
|
|
44
50
|
quickInsert: ({
|
|
45
51
|
formatMessage
|
|
@@ -5,7 +5,7 @@ import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles/co
|
|
|
5
5
|
import CopyIcon from '@atlaskit/icon/core/copy';
|
|
6
6
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
7
7
|
import LinkExternalIcon from '@atlaskit/icon/core/link-external';
|
|
8
|
-
import { copySyncedBlockReferenceToClipboard, editSyncedBlockSource, removeSyncedBlock } from '../
|
|
8
|
+
import { copySyncedBlockReferenceToClipboard, editSyncedBlockSource, removeSyncedBlock } from '../editor-commands';
|
|
9
9
|
import { findSyncBlockOrBodiedSyncBlock, isBodiedSyncBlockNode } from '../pm-plugins/utils/utils';
|
|
10
10
|
export const getToolbarConfig = (state, intl, _options = {}, _providerFactory, api, syncBlockStore) => {
|
|
11
11
|
var _api$decorations;
|
|
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { copyDomNode, toDOM } from '@atlaskit/editor-common/copy-button';
|
|
6
6
|
import { findSelectedNodeOfType, removeParentNodeOfType, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
|
|
7
|
-
import { canBeConvertedToSyncBlock, findSyncBlock, findSyncBlockOrBodiedSyncBlock, isBodiedSyncBlockNode } from '
|
|
7
|
+
import { canBeConvertedToSyncBlock, findSyncBlock, findSyncBlockOrBodiedSyncBlock, isBodiedSyncBlockNode } from '../pm-plugins/utils/utils';
|
|
8
8
|
export var createSyncedBlock = function createSyncedBlock(_ref) {
|
|
9
9
|
var tr = _ref.tr,
|
|
10
10
|
syncBlockStore = _ref.syncBlockStore,
|
|
@@ -3,7 +3,8 @@ import { bodiedSyncBlock, syncBlock } from '@atlaskit/adf-schema';
|
|
|
3
3
|
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { IconSyncBlock } from '@atlaskit/editor-common/quick-insert';
|
|
5
5
|
import { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
6
|
-
import {
|
|
6
|
+
import { flushBodiedSyncBlocks as _flushBodiedSyncBlocks } from './editor-actions';
|
|
7
|
+
import { createSyncedBlock } from './editor-commands';
|
|
7
8
|
import { createPlugin } from './pm-plugins/main';
|
|
8
9
|
import { getBlockMenuComponents } from './ui/block-menu-components';
|
|
9
10
|
import { ContentComponent } from './ui/ContentComponent';
|
|
@@ -44,6 +45,11 @@ export var syncedBlockPlugin = function syncedBlockPlugin(_ref) {
|
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
47
|
},
|
|
48
|
+
actions: {
|
|
49
|
+
flushBodiedSyncBlocks: function flushBodiedSyncBlocks() {
|
|
50
|
+
return _flushBodiedSyncBlocks(syncBlockStore);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
47
53
|
pluginsOptions: {
|
|
48
54
|
quickInsert: function quickInsert(_ref3) {
|
|
49
55
|
var formatMessage = _ref3.formatMessage;
|
|
@@ -8,7 +8,7 @@ import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles/co
|
|
|
8
8
|
import CopyIcon from '@atlaskit/icon/core/copy';
|
|
9
9
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
10
10
|
import LinkExternalIcon from '@atlaskit/icon/core/link-external';
|
|
11
|
-
import { copySyncedBlockReferenceToClipboard, editSyncedBlockSource, removeSyncedBlock } from '../
|
|
11
|
+
import { copySyncedBlockReferenceToClipboard, editSyncedBlockSource, removeSyncedBlock } from '../editor-commands';
|
|
12
12
|
import { findSyncBlockOrBodiedSyncBlock, isBodiedSyncBlockNode } from '../pm-plugins/utils/utils';
|
|
13
13
|
export var getToolbarConfig = function getToolbarConfig(state, intl) {
|
|
14
14
|
var _api$decorations;
|
|
@@ -40,6 +40,16 @@ export type SyncedBlockPluginOptions = {
|
|
|
40
40
|
getSyncedBlockRenderer?: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
41
41
|
};
|
|
42
42
|
export type SyncedBlockPlugin = NextEditorPlugin<'syncedBlock', {
|
|
43
|
+
actions: {
|
|
44
|
+
/**
|
|
45
|
+
* Save content of bodiedSyncBlock nodes in local cache to backend.
|
|
46
|
+
* This action allows bodiedSyncBlock to be saved in sync with product saving experience
|
|
47
|
+
* as per {@link https://hello.atlassian.net/wiki/spaces/egcuc/pages/5932393240/Synced+Blocks+Save+refresh+principles}
|
|
48
|
+
*
|
|
49
|
+
* @returns true if saving all nodes successfully, false if fail to save some/all nodes
|
|
50
|
+
*/
|
|
51
|
+
flushBodiedSyncBlocks: () => Promise<boolean>;
|
|
52
|
+
};
|
|
43
53
|
commands: {
|
|
44
54
|
insertSyncedBlock: () => EditorCommand;
|
|
45
55
|
};
|
|
@@ -40,6 +40,16 @@ export type SyncedBlockPluginOptions = {
|
|
|
40
40
|
getSyncedBlockRenderer?: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
41
41
|
};
|
|
42
42
|
export type SyncedBlockPlugin = NextEditorPlugin<'syncedBlock', {
|
|
43
|
+
actions: {
|
|
44
|
+
/**
|
|
45
|
+
* Save content of bodiedSyncBlock nodes in local cache to backend.
|
|
46
|
+
* This action allows bodiedSyncBlock to be saved in sync with product saving experience
|
|
47
|
+
* as per {@link https://hello.atlassian.net/wiki/spaces/egcuc/pages/5932393240/Synced+Blocks+Save+refresh+principles}
|
|
48
|
+
*
|
|
49
|
+
* @returns true if saving all nodes successfully, false if fail to save some/all nodes
|
|
50
|
+
*/
|
|
51
|
+
flushBodiedSyncBlocks: () => Promise<boolean>;
|
|
52
|
+
};
|
|
43
53
|
commands: {
|
|
44
54
|
insertSyncedBlock: () => EditorCommand;
|
|
45
55
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "SyncedBlock plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@atlaskit/editor-plugin-selection": "^6.1.0",
|
|
39
39
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
40
40
|
"@atlaskit/editor-shared-styles": "^3.8.0",
|
|
41
|
-
"@atlaskit/editor-synced-block-provider": "^2.
|
|
41
|
+
"@atlaskit/editor-synced-block-provider": "^2.2.0",
|
|
42
42
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
43
43
|
"@atlaskit/editor-toolbar": "^0.16.0",
|
|
44
44
|
"@atlaskit/icon": "28.5.3",
|
|
File without changes
|
|
File without changes
|