@atlaskit/editor-plugin-synced-block 10.3.9 → 10.4.1
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 +19 -0
- package/dist/cjs/nodeviews/bodiedSyncedBlock.js +2 -3
- package/dist/cjs/syncedBlockPlugin.js +1 -1
- package/dist/cjs/ui/floating-toolbar.js +21 -3
- package/dist/es2019/nodeviews/bodiedSyncedBlock.js +2 -3
- package/dist/es2019/syncedBlockPlugin.js +1 -1
- package/dist/es2019/ui/floating-toolbar.js +19 -3
- package/dist/esm/nodeviews/bodiedSyncedBlock.js +2 -3
- package/dist/esm/syncedBlockPlugin.js +1 -1
- package/dist/esm/ui/floating-toolbar.js +22 -4
- package/dist/types/entry-points/synced-block-plugin-type.d.ts +1 -1
- package/dist/types/syncedBlockPluginType.d.ts +10 -0
- package/dist/types/ui/floating-toolbar.d.ts +2 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
+
## 10.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`67ae1e14e8090`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/67ae1e14e8090) -
|
|
8
|
+
Revert persistent placeholder decorations for empty source synced blocks while retaining the sync
|
|
9
|
+
block activation experiment setup.
|
|
10
|
+
|
|
11
|
+
## 10.4.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [`b0cecd4d5b970`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b0cecd4d5b970) -
|
|
16
|
+
Add a product feedback trigger to synced block overflow actions.
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 10.3.9
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -19,7 +19,6 @@ var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
|
19
19
|
var _editorPluginConnectivity = require("@atlaskit/editor-plugin-connectivity");
|
|
20
20
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
21
21
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
22
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
23
22
|
var _BodiedSyncBlockWrapper = require("../ui/BodiedSyncBlockWrapper");
|
|
24
23
|
var _SyncBlockLabel = require("../ui/SyncBlockLabel");
|
|
25
24
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
@@ -199,8 +198,8 @@ var BodiedSyncBlock = exports.BodiedSyncBlock = /*#__PURE__*/function () {
|
|
|
199
198
|
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- NodeView DOM must be created against active runtime document
|
|
200
199
|
labelContainer = document.createElement('div');
|
|
201
200
|
this.dom.appendChild(labelContainer);
|
|
202
|
-
} else if ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_14')
|
|
203
|
-
// Render the label into a separate container for the
|
|
201
|
+
} else if ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_14')) {
|
|
202
|
+
// Render the label into a separate container for the patch path so
|
|
204
203
|
// portal implementations that write directly into the target do not clobber
|
|
205
204
|
// the ProseMirror contentDOM.
|
|
206
205
|
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- NodeView DOM must be created against active runtime document
|
|
@@ -147,7 +147,7 @@ var syncedBlockPlugin = exports.syncedBlockPlugin = function syncedBlockPlugin(_
|
|
|
147
147
|
if (!((_syncedBlockPluginKey = _main.syncedBlockPluginKey.getState(state)) !== null && _syncedBlockPluginKey !== void 0 && _syncedBlockPluginKey.hasSyncedBlocks) && isPerfExperimentOn) {
|
|
148
148
|
return undefined;
|
|
149
149
|
}
|
|
150
|
-
return (0, _floatingToolbar.getToolbarConfig)(state, intl, api, syncBlockStore, config === null || config === void 0 ? void 0 : config.__livePage);
|
|
150
|
+
return (0, _floatingToolbar.getToolbarConfig)(state, intl, api, syncBlockStore, config === null || config === void 0 ? void 0 : config.__livePage, config === null || config === void 0 ? void 0 : config.onGiveFeedback);
|
|
151
151
|
}
|
|
152
152
|
},
|
|
153
153
|
contentComponent: function contentComponent(_ref4) {
|
|
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.getToolbarConfig = void 0;
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
11
|
var _react = _interopRequireDefault(require("react"));
|
|
11
12
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
13
|
var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/messages"));
|
|
14
|
+
var _selection = require("@atlaskit/editor-common/selection");
|
|
13
15
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
14
16
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
15
17
|
var _consts = require("@atlaskit/editor-shared-styles/consts");
|
|
@@ -18,6 +20,7 @@ var _copy = _interopRequireDefault(require("@atlaskit/icon/core/copy"));
|
|
|
18
20
|
var _delete = _interopRequireDefault(require("@atlaskit/icon/core/delete"));
|
|
19
21
|
var _edit = _interopRequireDefault(require("@atlaskit/icon/core/edit"));
|
|
20
22
|
var _linkBroken = _interopRequireDefault(require("@atlaskit/icon/core/link-broken"));
|
|
23
|
+
var _megaphone = _interopRequireDefault(require("@atlaskit/icon/core/megaphone"));
|
|
21
24
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
22
25
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
23
26
|
var _editorCommands = require("../editor-commands");
|
|
@@ -27,7 +30,7 @@ var _SyncedLocationDropdown = require("./SyncedLocationDropdown");
|
|
|
27
30
|
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); }
|
|
28
31
|
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; }
|
|
29
32
|
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; }
|
|
30
|
-
var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(state, intl, api, syncBlockStore, isLivePage) {
|
|
33
|
+
var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(state, intl, api, syncBlockStore, isLivePage, onGiveFeedback) {
|
|
31
34
|
var _syncBlockInstance$er, _api$decorations, _api$connectivity;
|
|
32
35
|
var syncBlockObject = (0, _utils2.findSyncBlockOrBodiedSyncBlock)(state.schema, state.selection);
|
|
33
36
|
if (!syncBlockObject) {
|
|
@@ -171,14 +174,29 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(stat
|
|
|
171
174
|
var overflowMenuConfig = [{
|
|
172
175
|
type: 'overflow-dropdown',
|
|
173
176
|
testId: testId,
|
|
174
|
-
options: [
|
|
177
|
+
options: [].concat((0, _toConsumableArray2.default)(isSyncBlockActivationEnabled && onGiveFeedback ? [{
|
|
178
|
+
title: formatMessage(_messages.toolbarInsertBlockMessages.feedbackDialog),
|
|
179
|
+
icon: /*#__PURE__*/_react.default.createElement(_megaphone.default, {
|
|
180
|
+
label: ""
|
|
181
|
+
}),
|
|
182
|
+
onClick: function onClick() {
|
|
183
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref) {
|
|
184
|
+
var tr = _ref.tr;
|
|
185
|
+
return tr.setSelection(new _selection.GapCursorSelection(tr.doc.resolve(syncBlockObject.pos + syncBlockObject.node.nodeSize), _selection.Side.RIGHT));
|
|
186
|
+
});
|
|
187
|
+
onGiveFeedback({
|
|
188
|
+
blockType: isBodiedSyncBlock ? 'source' : 'reference'
|
|
189
|
+
});
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
192
|
+
}] : []), [_objectSpread({
|
|
175
193
|
title: formatMessage(_messages.default.delete),
|
|
176
194
|
onClick: (0, _editorCommands.removeSyncedBlock)(api),
|
|
177
195
|
icon: /*#__PURE__*/_react.default.createElement(_delete.default, {
|
|
178
196
|
label: ""
|
|
179
197
|
}),
|
|
180
198
|
testId: isBodiedSyncBlock ? _types.SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarSourceDelete : _types.SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceDelete
|
|
181
|
-
}, hoverDecorationProps(nodeType))]
|
|
199
|
+
}, hoverDecorationProps(nodeType))])
|
|
182
200
|
}];
|
|
183
201
|
items.push.apply(items, overflowMenuConfig);
|
|
184
202
|
}
|
|
@@ -7,7 +7,6 @@ import { BodiedSyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-
|
|
|
7
7
|
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
8
8
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
10
|
import { BodiedSyncBlockWrapper } from '../ui/BodiedSyncBlockWrapper';
|
|
12
11
|
import { SyncBlockLabel } from '../ui/SyncBlockLabel';
|
|
13
12
|
const toDOMOld = () => ['div', {
|
|
@@ -164,8 +163,8 @@ export class BodiedSyncBlock {
|
|
|
164
163
|
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- NodeView DOM must be created against active runtime document
|
|
165
164
|
labelContainer = document.createElement('div');
|
|
166
165
|
this.dom.appendChild(labelContainer);
|
|
167
|
-
} else if (fg('platform_synced_block_patch_14')
|
|
168
|
-
// Render the label into a separate container for the
|
|
166
|
+
} else if (fg('platform_synced_block_patch_14')) {
|
|
167
|
+
// Render the label into a separate container for the patch path so
|
|
169
168
|
// portal implementations that write directly into the target do not clobber
|
|
170
169
|
// the ProseMirror contentDOM.
|
|
171
170
|
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- NodeView DOM must be created against active runtime document
|
|
@@ -136,7 +136,7 @@ export const syncedBlockPlugin = ({
|
|
|
136
136
|
if (!((_syncedBlockPluginKey = syncedBlockPluginKey.getState(state)) !== null && _syncedBlockPluginKey !== void 0 && _syncedBlockPluginKey.hasSyncedBlocks) && isPerfExperimentOn) {
|
|
137
137
|
return undefined;
|
|
138
138
|
}
|
|
139
|
-
return getToolbarConfig(state, intl, api, syncBlockStore, config === null || config === void 0 ? void 0 : config.__livePage);
|
|
139
|
+
return getToolbarConfig(state, intl, api, syncBlockStore, config === null || config === void 0 ? void 0 : config.__livePage, config === null || config === void 0 ? void 0 : config.onGiveFeedback);
|
|
140
140
|
}
|
|
141
141
|
},
|
|
142
142
|
contentComponent: ({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import commonMessages, { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
3
|
+
import commonMessages, { syncBlockMessages as messages, toolbarInsertBlockMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { GapCursorSelection, Side } from '@atlaskit/editor-common/selection';
|
|
4
5
|
import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
|
|
5
6
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
6
7
|
import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles/consts';
|
|
@@ -9,13 +10,14 @@ import CopyIcon from '@atlaskit/icon/core/copy';
|
|
|
9
10
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
10
11
|
import EditIcon from '@atlaskit/icon/core/edit';
|
|
11
12
|
import LinkBrokenIcon from '@atlaskit/icon/core/link-broken';
|
|
13
|
+
import MegaphoneIcon from '@atlaskit/icon/core/megaphone';
|
|
12
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
15
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
16
|
import { copySyncedBlockReferenceToClipboard, editSyncedBlockSource, removeSyncedBlock, unsync } from '../editor-commands';
|
|
15
17
|
import { findSyncBlockOrBodiedSyncBlock, isBodiedSyncBlockNode } from '../pm-plugins/utils/utils';
|
|
16
18
|
import { SYNCED_BLOCK_BUTTON_TEST_ID } from '../types';
|
|
17
19
|
import { SyncedLocationDropdown } from './SyncedLocationDropdown';
|
|
18
|
-
export const getToolbarConfig = (state, intl, api, syncBlockStore, isLivePage) => {
|
|
20
|
+
export const getToolbarConfig = (state, intl, api, syncBlockStore, isLivePage, onGiveFeedback) => {
|
|
19
21
|
var _syncBlockInstance$er, _api$decorations, _api$connectivity, _api$connectivity$sha;
|
|
20
22
|
const syncBlockObject = findSyncBlockOrBodiedSyncBlock(state.schema, state.selection);
|
|
21
23
|
if (!syncBlockObject) {
|
|
@@ -168,7 +170,21 @@ export const getToolbarConfig = (state, intl, api, syncBlockStore, isLivePage) =
|
|
|
168
170
|
const overflowMenuConfig = [{
|
|
169
171
|
type: 'overflow-dropdown',
|
|
170
172
|
testId,
|
|
171
|
-
options: [{
|
|
173
|
+
options: [...(isSyncBlockActivationEnabled && onGiveFeedback ? [{
|
|
174
|
+
title: formatMessage(toolbarInsertBlockMessages.feedbackDialog),
|
|
175
|
+
icon: /*#__PURE__*/React.createElement(MegaphoneIcon, {
|
|
176
|
+
label: ""
|
|
177
|
+
}),
|
|
178
|
+
onClick: () => {
|
|
179
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(({
|
|
180
|
+
tr
|
|
181
|
+
}) => tr.setSelection(new GapCursorSelection(tr.doc.resolve(syncBlockObject.pos + syncBlockObject.node.nodeSize), Side.RIGHT)));
|
|
182
|
+
onGiveFeedback({
|
|
183
|
+
blockType: isBodiedSyncBlock ? 'source' : 'reference'
|
|
184
|
+
});
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
}] : []), {
|
|
172
188
|
title: formatMessage(commonMessages.delete),
|
|
173
189
|
onClick: removeSyncedBlock(api),
|
|
174
190
|
icon: /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
@@ -14,7 +14,6 @@ import { BodiedSyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-
|
|
|
14
14
|
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
15
15
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
16
16
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
18
17
|
import { BodiedSyncBlockWrapper } from '../ui/BodiedSyncBlockWrapper';
|
|
19
18
|
import { SyncBlockLabel } from '../ui/SyncBlockLabel';
|
|
20
19
|
var toDOMOld = function toDOMOld() {
|
|
@@ -192,8 +191,8 @@ export var BodiedSyncBlock = /*#__PURE__*/function () {
|
|
|
192
191
|
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- NodeView DOM must be created against active runtime document
|
|
193
192
|
labelContainer = document.createElement('div');
|
|
194
193
|
this.dom.appendChild(labelContainer);
|
|
195
|
-
} else if (fg('platform_synced_block_patch_14')
|
|
196
|
-
// Render the label into a separate container for the
|
|
194
|
+
} else if (fg('platform_synced_block_patch_14')) {
|
|
195
|
+
// Render the label into a separate container for the patch path so
|
|
197
196
|
// portal implementations that write directly into the target do not clobber
|
|
198
197
|
// the ProseMirror contentDOM.
|
|
199
198
|
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- NodeView DOM must be created against active runtime document
|
|
@@ -141,7 +141,7 @@ export var syncedBlockPlugin = function syncedBlockPlugin(_ref2) {
|
|
|
141
141
|
if (!((_syncedBlockPluginKey = syncedBlockPluginKey.getState(state)) !== null && _syncedBlockPluginKey !== void 0 && _syncedBlockPluginKey.hasSyncedBlocks) && isPerfExperimentOn) {
|
|
142
142
|
return undefined;
|
|
143
143
|
}
|
|
144
|
-
return getToolbarConfig(state, intl, api, syncBlockStore, config === null || config === void 0 ? void 0 : config.__livePage);
|
|
144
|
+
return getToolbarConfig(state, intl, api, syncBlockStore, config === null || config === void 0 ? void 0 : config.__livePage, config === null || config === void 0 ? void 0 : config.onGiveFeedback);
|
|
145
145
|
}
|
|
146
146
|
},
|
|
147
147
|
contentComponent: function contentComponent(_ref4) {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
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; }
|
|
3
4
|
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) { _defineProperty(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; }
|
|
4
5
|
import React from 'react';
|
|
5
6
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
|
-
import commonMessages, { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
+
import commonMessages, { syncBlockMessages as messages, toolbarInsertBlockMessages } from '@atlaskit/editor-common/messages';
|
|
8
|
+
import { GapCursorSelection, Side } from '@atlaskit/editor-common/selection';
|
|
7
9
|
import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
|
|
8
10
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
9
11
|
import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles/consts';
|
|
@@ -12,13 +14,14 @@ import CopyIcon from '@atlaskit/icon/core/copy';
|
|
|
12
14
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
13
15
|
import EditIcon from '@atlaskit/icon/core/edit';
|
|
14
16
|
import LinkBrokenIcon from '@atlaskit/icon/core/link-broken';
|
|
17
|
+
import MegaphoneIcon from '@atlaskit/icon/core/megaphone';
|
|
15
18
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
19
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
17
20
|
import { copySyncedBlockReferenceToClipboard, editSyncedBlockSource, removeSyncedBlock, unsync } from '../editor-commands';
|
|
18
21
|
import { findSyncBlockOrBodiedSyncBlock, isBodiedSyncBlockNode } from '../pm-plugins/utils/utils';
|
|
19
22
|
import { SYNCED_BLOCK_BUTTON_TEST_ID } from '../types';
|
|
20
23
|
import { SyncedLocationDropdown } from './SyncedLocationDropdown';
|
|
21
|
-
export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBlockStore, isLivePage) {
|
|
24
|
+
export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBlockStore, isLivePage, onGiveFeedback) {
|
|
22
25
|
var _syncBlockInstance$er, _api$decorations, _api$connectivity;
|
|
23
26
|
var syncBlockObject = findSyncBlockOrBodiedSyncBlock(state.schema, state.selection);
|
|
24
27
|
if (!syncBlockObject) {
|
|
@@ -162,14 +165,29 @@ export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBl
|
|
|
162
165
|
var overflowMenuConfig = [{
|
|
163
166
|
type: 'overflow-dropdown',
|
|
164
167
|
testId: testId,
|
|
165
|
-
options: [
|
|
168
|
+
options: [].concat(_toConsumableArray(isSyncBlockActivationEnabled && onGiveFeedback ? [{
|
|
169
|
+
title: formatMessage(toolbarInsertBlockMessages.feedbackDialog),
|
|
170
|
+
icon: /*#__PURE__*/React.createElement(MegaphoneIcon, {
|
|
171
|
+
label: ""
|
|
172
|
+
}),
|
|
173
|
+
onClick: function onClick() {
|
|
174
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref) {
|
|
175
|
+
var tr = _ref.tr;
|
|
176
|
+
return tr.setSelection(new GapCursorSelection(tr.doc.resolve(syncBlockObject.pos + syncBlockObject.node.nodeSize), Side.RIGHT));
|
|
177
|
+
});
|
|
178
|
+
onGiveFeedback({
|
|
179
|
+
blockType: isBodiedSyncBlock ? 'source' : 'reference'
|
|
180
|
+
});
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
}] : []), [_objectSpread({
|
|
166
184
|
title: formatMessage(commonMessages.delete),
|
|
167
185
|
onClick: removeSyncedBlock(api),
|
|
168
186
|
icon: /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
169
187
|
label: ""
|
|
170
188
|
}),
|
|
171
189
|
testId: isBodiedSyncBlock ? SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarSourceDelete : SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceDelete
|
|
172
|
-
}, hoverDecorationProps(nodeType))]
|
|
190
|
+
}, hoverDecorationProps(nodeType))])
|
|
173
191
|
}];
|
|
174
192
|
items.push.apply(items, overflowMenuConfig);
|
|
175
193
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { SyncedBlockPlugin, SyncedBlockPluginOptions, SyncedBlockEditorProps, SyncedBlockRendererProps, } from '../syncedBlockPluginType';
|
|
1
|
+
export type { SyncedBlockFeedbackContext, SyncedBlockPlugin, SyncedBlockPluginOptions, SyncedBlockEditorProps, SyncedBlockRendererProps, } from '../syncedBlockPluginType';
|
|
@@ -43,6 +43,10 @@ export type SyncedBlockRendererProps = {
|
|
|
43
43
|
api?: ExtractInjectionAPI<SyncedBlockPlugin>;
|
|
44
44
|
syncBlockFetchResult: UseFetchSyncBlockDataResult;
|
|
45
45
|
};
|
|
46
|
+
export type SyncedBlockFeedbackContext = {
|
|
47
|
+
blockType: 'source' | 'reference';
|
|
48
|
+
entryPoint?: string;
|
|
49
|
+
};
|
|
46
50
|
export interface SyncedBlockPluginOptions extends LongPressSelectionPluginOptions {
|
|
47
51
|
/**
|
|
48
52
|
* Enables Live Page specific behaviour for the synced block plugin.
|
|
@@ -53,6 +57,12 @@ export interface SyncedBlockPluginOptions extends LongPressSelectionPluginOption
|
|
|
53
57
|
*/
|
|
54
58
|
__livePage?: boolean;
|
|
55
59
|
enableSourceCreation?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Opens the host product's synced-block feedback collector.
|
|
62
|
+
* The editor plugin owns the menu affordance; the product owns the collector
|
|
63
|
+
* configuration and lifecycle.
|
|
64
|
+
*/
|
|
65
|
+
onGiveFeedback?: (context: SyncedBlockFeedbackContext) => void;
|
|
56
66
|
syncBlockDataProvider: SyncBlockDataProviderInterface;
|
|
57
67
|
syncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
58
68
|
}
|
|
@@ -2,5 +2,5 @@ import type { IntlShape } from 'react-intl';
|
|
|
2
2
|
import type { ExtractInjectionAPI, FloatingToolbarConfig } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
5
|
-
import type { SyncedBlockPlugin } from '../syncedBlockPluginType';
|
|
6
|
-
export declare const getToolbarConfig: (state: EditorState, intl: IntlShape, api: ExtractInjectionAPI<SyncedBlockPlugin> | undefined, syncBlockStore: SyncBlockStoreManager, isLivePage?: boolean) => FloatingToolbarConfig | undefined;
|
|
5
|
+
import type { SyncedBlockFeedbackContext, SyncedBlockPlugin } from '../syncedBlockPluginType';
|
|
6
|
+
export declare const getToolbarConfig: (state: EditorState, intl: IntlShape, api: ExtractInjectionAPI<SyncedBlockPlugin> | undefined, syncBlockStore: SyncBlockStoreManager, isLivePage?: boolean, onGiveFeedback?: (context: SyncedBlockFeedbackContext) => void) => FloatingToolbarConfig | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.4.1",
|
|
4
4
|
"description": "SyncedBlock plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"@atlaskit/lozenge": "^14.1.0",
|
|
45
45
|
"@atlaskit/modal-dialog": "^16.1.0",
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^2.1.0",
|
|
47
|
-
"@atlaskit/primitives": "^22.
|
|
47
|
+
"@atlaskit/primitives": "^22.2.0",
|
|
48
48
|
"@atlaskit/spinner": "20.1.1",
|
|
49
|
-
"@atlaskit/tmp-editor-statsig": "^132.
|
|
49
|
+
"@atlaskit/tmp-editor-statsig": "^132.6.0",
|
|
50
50
|
"@atlaskit/tokens": "16.3.0",
|
|
51
51
|
"@atlaskit/tooltip": "^23.1.0",
|
|
52
52
|
"@atlaskit/visually-hidden": "^4.2.0",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"memoize-one": "^6.0.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@atlaskit/editor-common": "^116.
|
|
60
|
+
"@atlaskit/editor-common": "^116.38.0",
|
|
61
61
|
"react": "^18.2.0",
|
|
62
62
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
63
63
|
},
|