@atlaskit/editor-plugin-synced-block 24.0.4 → 24.0.6
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-commands/index.js +60 -60
- package/dist/cjs/nodeviews/bodiedSyncedBlock.js +6 -6
- package/dist/cjs/nodeviews/syncedBlock.js +5 -4
- package/dist/cjs/pm-plugins/main.js +21 -21
- package/dist/cjs/pm-plugins/menu-and-toolbar-experiences.js +41 -37
- package/dist/cjs/pm-plugins/utils/selection-decorations.js +1 -1
- package/dist/cjs/pm-plugins/utils/utils.js +7 -7
- package/dist/cjs/syncedBlockPlugin.js +4 -4
- package/dist/cjs/ui/CreateSyncedBlockButton.js +12 -11
- package/dist/cjs/ui/CreateSyncedBlockDropdownItem.js +22 -20
- package/dist/cjs/ui/DeleteConfirmationModal.js +22 -22
- package/dist/cjs/ui/Flag.js +35 -35
- package/dist/cjs/ui/SourceSyncBlockPlaceholder.js +3 -3
- package/dist/cjs/ui/SyncBlockLabel.js +13 -13
- package/dist/cjs/ui/SyncBlockRefresher.js +4 -4
- package/dist/cjs/ui/SyncBlockRendererWrapper.js +7 -5
- package/dist/cjs/ui/SyncBlockSSRReactContextsProvider.js +2 -2
- package/dist/cjs/ui/SyncedLocationDropdown.js +46 -45
- package/dist/cjs/ui/block-menu-components.js +5 -4
- package/dist/cjs/ui/floating-toolbar.js +27 -26
- package/dist/cjs/ui/quick-insert/SyncedBlockQuickInsertMenuItem.js +9 -9
- package/dist/cjs/ui/quick-insert/getSyncedBlockQuickInsertComponents.js +3 -3
- package/dist/cjs/ui/quick-insert.js +9 -9
- package/dist/cjs/ui/toolbar-components.js +16 -14
- package/dist/es2019/editor-commands/index.js +2 -2
- package/dist/es2019/nodeviews/bodiedSyncedBlock.js +3 -3
- package/dist/es2019/nodeviews/syncedBlock.js +3 -2
- package/dist/es2019/pm-plugins/main.js +6 -6
- package/dist/es2019/pm-plugins/menu-and-toolbar-experiences.js +6 -2
- package/dist/es2019/pm-plugins/utils/selection-decorations.js +1 -1
- package/dist/es2019/pm-plugins/utils/utils.js +1 -1
- package/dist/es2019/syncedBlockPlugin.js +2 -2
- package/dist/es2019/ui/CreateSyncedBlockButton.js +6 -5
- package/dist/es2019/ui/CreateSyncedBlockDropdownItem.js +7 -5
- package/dist/es2019/ui/DeleteConfirmationModal.js +3 -3
- package/dist/es2019/ui/Flag.js +4 -4
- package/dist/es2019/ui/SourceSyncBlockPlaceholder.js +2 -2
- package/dist/es2019/ui/SyncBlockLabel.js +2 -2
- package/dist/es2019/ui/SyncBlockRefresher.js +2 -2
- package/dist/es2019/ui/SyncBlockRendererWrapper.js +4 -2
- package/dist/es2019/ui/SyncBlockSSRReactContextsProvider.js +1 -1
- package/dist/es2019/ui/SyncedLocationDropdown.js +7 -6
- package/dist/es2019/ui/block-menu-components.js +2 -1
- package/dist/es2019/ui/floating-toolbar.js +9 -6
- package/dist/es2019/ui/quick-insert/SyncedBlockQuickInsertMenuItem.js +3 -3
- package/dist/es2019/ui/quick-insert/getSyncedBlockQuickInsertComponents.js +1 -1
- package/dist/es2019/ui/quick-insert.js +3 -3
- package/dist/es2019/ui/toolbar-components.js +4 -2
- package/dist/esm/editor-commands/index.js +2 -2
- package/dist/esm/nodeviews/bodiedSyncedBlock.js +3 -3
- package/dist/esm/nodeviews/syncedBlock.js +3 -2
- package/dist/esm/pm-plugins/main.js +6 -6
- package/dist/esm/pm-plugins/menu-and-toolbar-experiences.js +6 -2
- package/dist/esm/pm-plugins/utils/selection-decorations.js +1 -1
- package/dist/esm/pm-plugins/utils/utils.js +1 -1
- package/dist/esm/syncedBlockPlugin.js +2 -2
- package/dist/esm/ui/CreateSyncedBlockButton.js +6 -5
- package/dist/esm/ui/CreateSyncedBlockDropdownItem.js +7 -5
- package/dist/esm/ui/DeleteConfirmationModal.js +3 -3
- package/dist/esm/ui/Flag.js +4 -4
- package/dist/esm/ui/SourceSyncBlockPlaceholder.js +2 -2
- package/dist/esm/ui/SyncBlockLabel.js +2 -2
- package/dist/esm/ui/SyncBlockRefresher.js +2 -2
- package/dist/esm/ui/SyncBlockRendererWrapper.js +4 -2
- package/dist/esm/ui/SyncBlockSSRReactContextsProvider.js +1 -1
- package/dist/esm/ui/SyncedLocationDropdown.js +7 -6
- package/dist/esm/ui/block-menu-components.js +2 -1
- package/dist/esm/ui/floating-toolbar.js +9 -6
- package/dist/esm/ui/quick-insert/SyncedBlockQuickInsertMenuItem.js +3 -3
- package/dist/esm/ui/quick-insert/getSyncedBlockQuickInsertComponents.js +1 -1
- package/dist/esm/ui/quick-insert.js +3 -3
- package/dist/esm/ui/toolbar-components.js +4 -2
- package/dist/types/editor-actions/index.d.ts +1 -1
- package/dist/types/editor-commands/index.d.ts +7 -3
- package/dist/types/nodeviews/bodiedSyncedBlock.d.ts +6 -5
- package/dist/types/nodeviews/lazySyncedBlock.d.ts +1 -1
- package/dist/types/nodeviews/syncedBlock.d.ts +7 -5
- package/dist/types/pm-plugins/main.d.ts +4 -3
- package/dist/types/pm-plugins/menu-and-toolbar-experiences.d.ts +1 -1
- package/dist/types/pm-plugins/utils/handle-bodied-sync-block-creation.d.ts +1 -1
- package/dist/types/pm-plugins/utils/handle-bodied-sync-block-removal.d.ts +2 -2
- package/dist/types/pm-plugins/utils/ignore-dom-event.d.ts +1 -1
- package/dist/types/syncedBlockPluginType.d.ts +21 -18
- package/dist/types/types/index.d.ts +2 -1
- package/dist/types/ui/CreateSyncedBlockButton.d.ts +1 -1
- package/dist/types/ui/CreateSyncedBlockDropdownItem.d.ts +1 -1
- package/dist/types/ui/DeleteConfirmationModal.d.ts +2 -2
- package/dist/types/ui/Flag.d.ts +1 -1
- package/dist/types/ui/SyncBlockRefresher.d.ts +2 -2
- package/dist/types/ui/SyncBlockRendererWrapper.d.ts +2 -2
- package/dist/types/ui/SyncedLocationDropdown.d.ts +5 -2
- package/dist/types/ui/block-menu-components.d.ts +2 -2
- package/dist/types/ui/floating-toolbar.d.ts +3 -2
- package/dist/types/ui/getUnpublishedSourceType.d.ts +1 -1
- package/dist/types/ui/quick-insert/SyncedBlockQuickInsertMenuItem.d.ts +2 -2
- package/dist/types/ui/quick-insert/getSyncedBlockQuickInsertComponents.d.ts +2 -2
- package/dist/types/ui/quick-insert.d.ts +3 -3
- package/dist/types/ui/toolbar-components.d.ts +2 -2
- package/docs/0-intro.tsx +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -8,18 +8,18 @@ exports.unsync = exports.removeSyncedBlockAtPos = exports.removeSyncedBlock = ex
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
10
|
var _schemaDefault = require("@atlaskit/adf-schema/schema-default");
|
|
11
|
-
var
|
|
11
|
+
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
12
12
|
var _copyButton = require("@atlaskit/editor-common/copy-button");
|
|
13
|
-
var
|
|
13
|
+
var _utils = require("@atlaskit/editor-common/selection/utils");
|
|
14
14
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
15
15
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
16
|
-
var
|
|
17
|
-
var
|
|
16
|
+
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
17
|
+
var _utils3 = require("@atlaskit/editor-synced-block-provider/utils");
|
|
18
18
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
19
19
|
var _main = require("../pm-plugins/main");
|
|
20
|
-
var
|
|
20
|
+
var _utils4 = require("../pm-plugins/utils/utils");
|
|
21
21
|
var _types = require("../types");
|
|
22
|
-
var
|
|
22
|
+
var _utils5 = require("./utils");
|
|
23
23
|
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; }
|
|
24
24
|
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; }
|
|
25
25
|
/**
|
|
@@ -100,41 +100,41 @@ var createSyncedBlock = exports.createSyncedBlock = function createSyncedBlock(_
|
|
|
100
100
|
var newBodiedSyncBlockNode = bodiedSyncBlock.createAndFill(attrs, paragraphNode ? [paragraphNode] : []);
|
|
101
101
|
if (!newBodiedSyncBlockNode) {
|
|
102
102
|
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
|
|
103
|
-
action:
|
|
104
|
-
actionSubject:
|
|
105
|
-
actionSubjectId:
|
|
103
|
+
action: _enums.ACTION.ERROR,
|
|
104
|
+
actionSubject: _enums.ACTION_SUBJECT.SYNCED_BLOCK,
|
|
105
|
+
actionSubjectId: _enums.ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE,
|
|
106
106
|
attributes: {
|
|
107
107
|
error: 'Create and fill for empty content failed'
|
|
108
108
|
},
|
|
109
|
-
eventType:
|
|
109
|
+
eventType: _enums.EVENT_TYPE.OPERATIONAL
|
|
110
110
|
});
|
|
111
111
|
return false;
|
|
112
112
|
}
|
|
113
113
|
if (typeAheadInsert) {
|
|
114
114
|
tr = typeAheadInsert(newBodiedSyncBlockNode);
|
|
115
115
|
} else {
|
|
116
|
-
tr = (0,
|
|
116
|
+
tr = (0, _utils2.safeInsert)(newBodiedSyncBlockNode)(tr).scrollIntoView();
|
|
117
117
|
// safeInsert does not move the selection into the new block, so place the
|
|
118
118
|
// caret inside the block's empty paragraph so typing continues inside the
|
|
119
119
|
// synced block (EDITOR-7949).
|
|
120
120
|
tr = placeCaretInsideBodiedSyncBlock(tr, newBodiedSyncBlockNode.attrs.localId);
|
|
121
121
|
}
|
|
122
122
|
} else {
|
|
123
|
-
var conversionInfo = (0,
|
|
123
|
+
var conversionInfo = (0, _utils4.canBeConvertedToSyncBlock)(tr.selection);
|
|
124
124
|
if (!conversionInfo) {
|
|
125
125
|
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
|
|
126
|
-
action:
|
|
127
|
-
actionSubject:
|
|
128
|
-
actionSubjectId:
|
|
126
|
+
action: _enums.ACTION.ERROR,
|
|
127
|
+
actionSubject: _enums.ACTION_SUBJECT.SYNCED_BLOCK,
|
|
128
|
+
actionSubjectId: _enums.ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE,
|
|
129
129
|
attributes: {
|
|
130
130
|
error: 'Content cannot be converted to sync block'
|
|
131
131
|
},
|
|
132
|
-
eventType:
|
|
132
|
+
eventType: _enums.EVENT_TYPE.OPERATIONAL
|
|
133
133
|
});
|
|
134
134
|
return false;
|
|
135
135
|
}
|
|
136
136
|
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_sync_block_node_types')) {
|
|
137
|
-
nodeTypes = (0, _toConsumableArray2.default)(new Set((0,
|
|
137
|
+
nodeTypes = (0, _toConsumableArray2.default)(new Set((0, _utils.getSourceNodesFromSelectionRange)(tr, tr.selection).map(function (node) {
|
|
138
138
|
return node.type.name;
|
|
139
139
|
}))).sort();
|
|
140
140
|
}
|
|
@@ -142,13 +142,13 @@ var createSyncedBlock = exports.createSyncedBlock = function createSyncedBlock(_
|
|
|
142
142
|
var _newBodiedSyncBlockNode = bodiedSyncBlock.createAndFill(_attrs, conversionInfo.contentToInclude, conversionInfo.breakoutMark ? [conversionInfo.breakoutMark] : undefined);
|
|
143
143
|
if (!_newBodiedSyncBlockNode) {
|
|
144
144
|
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
|
|
145
|
-
action:
|
|
146
|
-
actionSubject:
|
|
147
|
-
actionSubjectId:
|
|
145
|
+
action: _enums.ACTION.ERROR,
|
|
146
|
+
actionSubject: _enums.ACTION_SUBJECT.SYNCED_BLOCK,
|
|
147
|
+
actionSubjectId: _enums.ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE,
|
|
148
148
|
attributes: {
|
|
149
149
|
error: 'Create and fill for content failed'
|
|
150
150
|
},
|
|
151
|
-
eventType:
|
|
151
|
+
eventType: _enums.EVENT_TYPE.OPERATIONAL
|
|
152
152
|
});
|
|
153
153
|
return false;
|
|
154
154
|
}
|
|
@@ -184,14 +184,14 @@ var copySyncedBlockReferenceToClipboard = exports.copySyncedBlockReferenceToClip
|
|
|
184
184
|
};
|
|
185
185
|
var copySyncedBlockReferenceToClipboardInternal = function copySyncedBlockReferenceToClipboardInternal(schema, selection, syncBlockStore, inputMethod, api, isLivePage) {
|
|
186
186
|
var _syncBlockStore$refer;
|
|
187
|
-
var syncBlockFindResult = (0,
|
|
187
|
+
var syncBlockFindResult = (0, _utils4.findSyncBlockOrBodiedSyncBlock)(schema, selection);
|
|
188
188
|
if (!syncBlockFindResult) {
|
|
189
189
|
var _api$analytics;
|
|
190
190
|
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || _api$analytics.fireAnalyticsEvent({
|
|
191
|
-
eventType:
|
|
192
|
-
action:
|
|
193
|
-
actionSubject:
|
|
194
|
-
actionSubjectId:
|
|
191
|
+
eventType: _enums.EVENT_TYPE.OPERATIONAL,
|
|
192
|
+
action: _enums.ACTION.ERROR,
|
|
193
|
+
actionSubject: _enums.ACTION_SUBJECT.SYNCED_BLOCK,
|
|
194
|
+
actionSubjectId: _enums.ACTION_SUBJECT_ID.SYNCED_BLOCK_COPY,
|
|
195
195
|
attributes: {
|
|
196
196
|
error: 'No sync block found in selection',
|
|
197
197
|
inputMethod: inputMethod
|
|
@@ -199,7 +199,7 @@ var copySyncedBlockReferenceToClipboardInternal = function copySyncedBlockRefere
|
|
|
199
199
|
});
|
|
200
200
|
return false;
|
|
201
201
|
}
|
|
202
|
-
var isBodiedSyncBlock = (0,
|
|
202
|
+
var isBodiedSyncBlock = (0, _utils4.isBodiedSyncBlockNode)(syncBlockFindResult.node, schema.nodes.bodiedSyncBlock);
|
|
203
203
|
var referenceSyncBlockNode = null;
|
|
204
204
|
if (isBodiedSyncBlock) {
|
|
205
205
|
var syncBlock = schema.nodes.syncBlock;
|
|
@@ -211,10 +211,10 @@ var copySyncedBlockReferenceToClipboardInternal = function copySyncedBlockRefere
|
|
|
211
211
|
if (!referenceSyncBlockNode) {
|
|
212
212
|
var _api$analytics2;
|
|
213
213
|
api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || (_api$analytics2 = _api$analytics2.actions) === null || _api$analytics2 === void 0 || _api$analytics2.fireAnalyticsEvent({
|
|
214
|
-
eventType:
|
|
215
|
-
action:
|
|
216
|
-
actionSubject:
|
|
217
|
-
actionSubjectId:
|
|
214
|
+
eventType: _enums.EVENT_TYPE.OPERATIONAL,
|
|
215
|
+
action: _enums.ACTION.ERROR,
|
|
216
|
+
actionSubject: _enums.ACTION_SUBJECT.SYNCED_BLOCK,
|
|
217
|
+
actionSubjectId: _enums.ACTION_SUBJECT_ID.SYNCED_BLOCK_COPY,
|
|
218
218
|
attributes: {
|
|
219
219
|
error: 'Failed to create reference sync block node',
|
|
220
220
|
resourceId: syncBlockFindResult.node.attrs.resourceId,
|
|
@@ -229,10 +229,10 @@ var copySyncedBlockReferenceToClipboardInternal = function copySyncedBlockRefere
|
|
|
229
229
|
if (!referenceSyncBlockNode) {
|
|
230
230
|
var _api$analytics3;
|
|
231
231
|
api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 || (_api$analytics3 = _api$analytics3.actions) === null || _api$analytics3 === void 0 || _api$analytics3.fireAnalyticsEvent({
|
|
232
|
-
eventType:
|
|
233
|
-
action:
|
|
234
|
-
actionSubject:
|
|
235
|
-
actionSubjectId:
|
|
232
|
+
eventType: _enums.EVENT_TYPE.OPERATIONAL,
|
|
233
|
+
action: _enums.ACTION.ERROR,
|
|
234
|
+
actionSubject: _enums.ACTION_SUBJECT.SYNCED_BLOCK,
|
|
235
|
+
actionSubjectId: _enums.ACTION_SUBJECT_ID.SYNCED_BLOCK_COPY,
|
|
236
236
|
attributes: {
|
|
237
237
|
error: 'No reference sync block node available',
|
|
238
238
|
inputMethod: inputMethod
|
|
@@ -246,15 +246,15 @@ var copySyncedBlockReferenceToClipboardInternal = function copySyncedBlockRefere
|
|
|
246
246
|
// bodiedSyncBlock its `localId` is the source uuid (copy was page-form only).
|
|
247
247
|
var sourceJoinKey = isBodiedSyncBlock ? syncBlockFindResult.node.attrs.localId : undefined;
|
|
248
248
|
var isSourceContentUnpublished = isBodiedSyncBlock ? syncBlockStore.sourceManager.getStatus(syncBlockFindResult.node.attrs.resourceId) !== 'active' : ((_syncBlockStore$refer = syncBlockStore.referenceManager.getFromCache(referenceSyncBlockNode.attrs.resourceId)) === null || _syncBlockStore$refer === void 0 || (_syncBlockStore$refer = _syncBlockStore$refer.data) === null || _syncBlockStore$refer === void 0 ? void 0 : _syncBlockStore$refer.status) === 'unpublished';
|
|
249
|
-
var sourceProduct = (0,
|
|
249
|
+
var sourceProduct = (0, _utils3.getSourceProductFromResourceIdSafe)(referenceSyncBlockNode.attrs.resourceId);
|
|
250
250
|
var copyResult = (0, _copyButton.copyDomNodeWithResult)(domNode, referenceSyncBlockNode.type, selection);
|
|
251
251
|
if (copyResult === false) {
|
|
252
252
|
var _api$analytics4;
|
|
253
253
|
api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 || (_api$analytics4 = _api$analytics4.actions) === null || _api$analytics4 === void 0 || _api$analytics4.fireAnalyticsEvent({
|
|
254
|
-
eventType:
|
|
255
|
-
action:
|
|
256
|
-
actionSubject:
|
|
257
|
-
actionSubjectId:
|
|
254
|
+
eventType: _enums.EVENT_TYPE.OPERATIONAL,
|
|
255
|
+
action: _enums.ACTION.ERROR,
|
|
256
|
+
actionSubject: _enums.ACTION_SUBJECT.SYNCED_BLOCK,
|
|
257
|
+
actionSubjectId: _enums.ACTION_SUBJECT_ID.SYNCED_BLOCK_COPY,
|
|
258
258
|
attributes: {
|
|
259
259
|
error: 'Failed to copy synced block to clipboard',
|
|
260
260
|
resourceId: referenceSyncBlockNode.attrs.resourceId,
|
|
@@ -263,15 +263,15 @@ var copySyncedBlockReferenceToClipboardInternal = function copySyncedBlockRefere
|
|
|
263
263
|
});
|
|
264
264
|
return false;
|
|
265
265
|
}
|
|
266
|
-
(0,
|
|
266
|
+
(0, _utils4.deferDispatch)(function () {
|
|
267
267
|
api === null || api === void 0 || api.core.actions.execute(function (_ref3) {
|
|
268
268
|
var _api$analytics5;
|
|
269
269
|
var tr = _ref3.tr;
|
|
270
270
|
api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 || (_api$analytics5 = _api$analytics5.actions) === null || _api$analytics5 === void 0 || _api$analytics5.fireAnalyticsEvent({
|
|
271
|
-
eventType:
|
|
272
|
-
action:
|
|
273
|
-
actionSubject:
|
|
274
|
-
actionSubjectId:
|
|
271
|
+
eventType: _enums.EVENT_TYPE.OPERATIONAL,
|
|
272
|
+
action: _enums.ACTION.COPIED,
|
|
273
|
+
actionSubject: _enums.ACTION_SUBJECT.SYNCED_BLOCK,
|
|
274
|
+
actionSubjectId: _enums.ACTION_SUBJECT_ID.SYNCED_BLOCK_COPY,
|
|
275
275
|
attributes: _objectSpread({
|
|
276
276
|
resourceId: referenceSyncBlockNode.attrs.resourceId,
|
|
277
277
|
inputMethod: inputMethod
|
|
@@ -294,7 +294,7 @@ var copySyncedBlockReferenceToClipboardInternal = function copySyncedBlockRefere
|
|
|
294
294
|
var editSyncedBlockSource = exports.editSyncedBlockSource = function editSyncedBlockSource(syncBlockStore, api) {
|
|
295
295
|
return function (state, dispatch, _view) {
|
|
296
296
|
var _syncBlock$node, _syncBlockStore$refer2;
|
|
297
|
-
var syncBlock = (0,
|
|
297
|
+
var syncBlock = (0, _utils4.findSyncBlock)(state.schema, state.selection);
|
|
298
298
|
var resourceId = syncBlock === null || syncBlock === void 0 || (_syncBlock$node = syncBlock.node) === null || _syncBlock$node === void 0 || (_syncBlock$node = _syncBlock$node.attrs) === null || _syncBlock$node === void 0 ? void 0 : _syncBlock$node.resourceId;
|
|
299
299
|
if (!resourceId) {
|
|
300
300
|
return false;
|
|
@@ -302,14 +302,14 @@ var editSyncedBlockSource = exports.editSyncedBlockSource = function editSyncedB
|
|
|
302
302
|
var syncBlockURL = syncBlockStore.referenceManager.getSyncBlockURL(resourceId);
|
|
303
303
|
var syncBlockData = (_syncBlockStore$refer2 = syncBlockStore.referenceManager.getFromCache(resourceId)) === null || _syncBlockStore$refer2 === void 0 ? void 0 : _syncBlockStore$refer2.data;
|
|
304
304
|
var isOnSameDocument = (syncBlockData === null || syncBlockData === void 0 ? void 0 : syncBlockData.onSameDocument) === true;
|
|
305
|
-
var sourceBlock = isOnSameDocument && syncBlockData ? (0,
|
|
305
|
+
var sourceBlock = isOnSameDocument && syncBlockData ? (0, _utils5.findBodiedSyncBlockByLocalId)(state, syncBlockData.blockInstanceId) : undefined;
|
|
306
306
|
if (syncBlockURL) {
|
|
307
307
|
var _api$analytics6;
|
|
308
308
|
api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 || _api$analytics6.actions.fireAnalyticsEvent({
|
|
309
|
-
eventType:
|
|
310
|
-
action:
|
|
311
|
-
actionSubject:
|
|
312
|
-
actionSubjectId:
|
|
309
|
+
eventType: _enums.EVENT_TYPE.OPERATIONAL,
|
|
310
|
+
action: _enums.ACTION.SYNCED_BLOCK_EDIT_SOURCE,
|
|
311
|
+
actionSubject: _enums.ACTION_SUBJECT.SYNCED_BLOCK,
|
|
312
|
+
actionSubjectId: _enums.ACTION_SUBJECT_ID.SYNCED_BLOCK_SOURCE_URL,
|
|
313
313
|
attributes: {
|
|
314
314
|
resourceId: resourceId,
|
|
315
315
|
sameDocument: isOnSameDocument
|
|
@@ -325,10 +325,10 @@ var editSyncedBlockSource = exports.editSyncedBlockSource = function editSyncedB
|
|
|
325
325
|
var _api$analytics7;
|
|
326
326
|
var _tr = state.tr;
|
|
327
327
|
api === null || api === void 0 || (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 || (_api$analytics7 = _api$analytics7.actions) === null || _api$analytics7 === void 0 || _api$analytics7.attachAnalyticsEvent({
|
|
328
|
-
eventType:
|
|
329
|
-
action:
|
|
330
|
-
actionSubject:
|
|
331
|
-
actionSubjectId:
|
|
328
|
+
eventType: _enums.EVENT_TYPE.OPERATIONAL,
|
|
329
|
+
action: _enums.ACTION.ERROR,
|
|
330
|
+
actionSubject: _enums.ACTION_SUBJECT.SYNCED_BLOCK,
|
|
331
|
+
actionSubjectId: _enums.ACTION_SUBJECT_ID.SYNCED_BLOCK_SOURCE_URL,
|
|
332
332
|
attributes: {
|
|
333
333
|
error: 'No URL resolved for synced block'
|
|
334
334
|
}
|
|
@@ -346,10 +346,10 @@ var removeSyncedBlock = exports.removeSyncedBlock = function removeSyncedBlock(a
|
|
|
346
346
|
return false;
|
|
347
347
|
}
|
|
348
348
|
var removeTr = tr;
|
|
349
|
-
if ((0,
|
|
350
|
-
removeTr = (0,
|
|
349
|
+
if ((0, _utils2.findSelectedNodeOfType)(nodes.syncBlock)(tr.selection) || (0, _utils2.findSelectedNodeOfType)(nodes.bodiedSyncBlock)(tr.selection)) {
|
|
350
|
+
removeTr = (0, _utils2.removeSelectedNode)(tr);
|
|
351
351
|
} else {
|
|
352
|
-
removeTr = (0,
|
|
352
|
+
removeTr = (0, _utils2.removeParentNodeOfType)(nodes.bodiedSyncBlock)(tr);
|
|
353
353
|
}
|
|
354
354
|
if (!removeTr) {
|
|
355
355
|
return false;
|
|
@@ -385,7 +385,7 @@ var unsync = exports.unsync = function unsync(storeManager, isBodiedSyncBlock, v
|
|
|
385
385
|
return false;
|
|
386
386
|
}
|
|
387
387
|
var state = view.state;
|
|
388
|
-
var syncBlock = (0,
|
|
388
|
+
var syncBlock = (0, _utils4.findSyncBlockOrBodiedSyncBlock)(state.schema, state.selection);
|
|
389
389
|
if (!syncBlock) {
|
|
390
390
|
return false;
|
|
391
391
|
}
|
|
@@ -412,5 +412,5 @@ var unsync = exports.unsync = function unsync(storeManager, isBodiedSyncBlock, v
|
|
|
412
412
|
// use defaultSchema for serialization so we can serialize any type of nodes and marks despite current editor's schema might not allow it
|
|
413
413
|
var contentFragment = _model.Fragment.fromJSON(_schemaDefault.defaultSchema, syncBlockContent);
|
|
414
414
|
var contentDOM = _model.DOMSerializer.fromSchema(_schemaDefault.defaultSchema).serializeFragment(contentFragment);
|
|
415
|
-
return (0,
|
|
415
|
+
return (0, _utils5.pasteSyncBlockHTMLContent)(contentDOM, view);
|
|
416
416
|
};
|
|
@@ -10,10 +10,10 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
10
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
var
|
|
13
|
+
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
14
|
+
var _isOfflineMode = require("@atlaskit/editor-common/connectivity/isOfflineMode");
|
|
14
15
|
var _errorBoundary = require("@atlaskit/editor-common/error-boundary");
|
|
15
|
-
var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
16
|
-
var _editorPluginConnectivity = require("@atlaskit/editor-plugin-connectivity");
|
|
16
|
+
var _syncBlock = require("@atlaskit/editor-common/styles/sync-block");
|
|
17
17
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
18
18
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
19
19
|
var _getUnpublishedSourceType = require("../ui/getUnpublishedSourceType");
|
|
@@ -104,8 +104,8 @@ var BodiedSyncBlock = exports.BodiedSyncBlock = /*#__PURE__*/function () {
|
|
|
104
104
|
this.nodeViewPortalProviderAPI.render(function () {
|
|
105
105
|
var _this$api;
|
|
106
106
|
return /*#__PURE__*/_react.default.createElement(_errorBoundary.ErrorBoundary, {
|
|
107
|
-
component:
|
|
108
|
-
componentId:
|
|
107
|
+
component: _enums.ACTION_SUBJECT.SYNCED_BLOCK,
|
|
108
|
+
componentId: _enums.ACTION_SUBJECT_ID.SYNCED_BLOCK_LABEL,
|
|
109
109
|
dispatchAnalyticsEvent: (_this$api = _this.api) === null || _this$api === void 0 || (_this$api = _this$api.analytics) === null || _this$api === void 0 ? void 0 : _this$api.actions.fireAnalyticsEvent,
|
|
110
110
|
fallbackComponent: null
|
|
111
111
|
}, /*#__PURE__*/_react.default.createElement(SourceSyncBlockLabel, {
|
|
@@ -130,7 +130,7 @@ var BodiedSyncBlock = exports.BodiedSyncBlock = /*#__PURE__*/function () {
|
|
|
130
130
|
nextViewMode = _ref2.nextViewMode;
|
|
131
131
|
var connectivityMode = nextConnectivityMode !== null && nextConnectivityMode !== void 0 ? nextConnectivityMode : (_this$api2 = this.api) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.connectivity) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.sharedState) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.currentState()) === null || _this$api2 === void 0 ? void 0 : _this$api2.mode;
|
|
132
132
|
var viewMode = nextViewMode !== null && nextViewMode !== void 0 ? nextViewMode : (_this$api3 = this.api) === null || _this$api3 === void 0 || (_this$api3 = _this$api3.editorViewMode) === null || _this$api3 === void 0 || (_this$api3 = _this$api3.sharedState) === null || _this$api3 === void 0 || (_this$api3 = _this$api3.currentState()) === null || _this$api3 === void 0 ? void 0 : _this$api3.mode;
|
|
133
|
-
var isOnline = !(0,
|
|
133
|
+
var isOnline = !(0, _isOfflineMode.isOfflineMode)(connectivityMode);
|
|
134
134
|
var isEditMode = viewMode !== 'view';
|
|
135
135
|
var shouldBeEditable = isOnline && isEditMode;
|
|
136
136
|
this.contentDOM.setAttribute('contenteditable', shouldBeEditable ? 'true' : 'false');
|
|
@@ -13,10 +13,11 @@ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
|
13
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
var _react = _interopRequireDefault(require("react"));
|
|
16
|
-
var
|
|
16
|
+
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
17
17
|
var _errorBoundary = require("@atlaskit/editor-common/error-boundary");
|
|
18
18
|
var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
|
|
19
|
-
var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
19
|
+
var _syncBlock = require("@atlaskit/editor-common/styles/sync-block");
|
|
20
|
+
var _SyncBlockActionsContext = require("@atlaskit/editor-common/sync-block/SyncBlockActionsContext");
|
|
20
21
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
21
22
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
22
23
|
var _editorCommands = require("../editor-commands");
|
|
@@ -221,10 +222,10 @@ var SyncBlock = exports.SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
221
222
|
return /*#__PURE__*/_react.default.createElement(_SyncBlockSSRReactContextsProvider.SyncBlockSSRReactContextsProvider, {
|
|
222
223
|
intl: this.intl
|
|
223
224
|
}, /*#__PURE__*/_react.default.createElement(_errorBoundary.ErrorBoundary, {
|
|
224
|
-
component:
|
|
225
|
+
component: _enums.ACTION_SUBJECT.SYNCED_BLOCK,
|
|
225
226
|
dispatchAnalyticsEvent: (_this$api3 = this.api) === null || _this$api3 === void 0 || (_this$api3 = _this$api3.analytics) === null || _this$api3 === void 0 ? void 0 : _this$api3.actions.fireAnalyticsEvent,
|
|
226
227
|
fallbackComponent: null
|
|
227
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
228
|
+
}, /*#__PURE__*/_react.default.createElement(_SyncBlockActionsContext.SyncBlockActionsProvider, {
|
|
228
229
|
removeSyncBlock: this.removeSyncBlockStable,
|
|
229
230
|
fetchSyncBlockSourceInfo: this.fetchSyncBlockSourceInfoStable
|
|
230
231
|
}, /*#__PURE__*/_react.default.createElement(_SyncBlockRendererWrapper.SyncBlockRendererWrapper, {
|
|
@@ -11,18 +11,18 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
12
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
13
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
14
|
-
var
|
|
14
|
+
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
15
15
|
var _collab = require("@atlaskit/editor-common/collab");
|
|
16
|
+
var _isOfflineMode = require("@atlaskit/editor-common/connectivity/isOfflineMode");
|
|
16
17
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
17
18
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
18
|
-
var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
19
|
+
var _syncBlock = require("@atlaskit/editor-common/styles/sync-block");
|
|
19
20
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
20
|
-
var
|
|
21
|
+
var _slice = require("@atlaskit/editor-common/utils/slice");
|
|
21
22
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
22
23
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
23
24
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
24
25
|
var _view3 = require("@atlaskit/editor-prosemirror/view");
|
|
25
|
-
var _editorSyncedBlockProvider = require("@atlaskit/editor-synced-block-provider");
|
|
26
26
|
var _utils2 = require("@atlaskit/editor-synced-block-provider/utils");
|
|
27
27
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
28
28
|
var _bodiedSyncedBlock = require("../nodeviews/bodiedSyncedBlock");
|
|
@@ -120,7 +120,7 @@ var showCopiedFlag = function showCopiedFlag(api, isLivePage, isSourceContentUnp
|
|
|
120
120
|
};
|
|
121
121
|
var showExtensionInSyncBlockWarningIfNeeded = function showExtensionInSyncBlockWarningIfNeeded(tr, state, api, extensionFlagShown) {
|
|
122
122
|
var _api$connectivity;
|
|
123
|
-
if (!tr.docChanged || tr.getMeta('isRemote') || Boolean(tr.getMeta(_utils.pmHistoryPluginKey)) || (0,
|
|
123
|
+
if (!tr.docChanged || tr.getMeta('isRemote') || Boolean(tr.getMeta(_utils.pmHistoryPluginKey)) || (0, _isOfflineMode.isOfflineMode)(api === null || api === void 0 || (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.sharedState.currentState()) === null || _api$connectivity === void 0 ? void 0 : _api$connectivity.mode)) {
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
126
126
|
var resourceId = (0, _utils3.wasExtensionInsertedInBodiedSyncBlock)(tr, state);
|
|
@@ -264,14 +264,14 @@ var filterTransactionOnline = function filterTransactionOnline(_ref3) {
|
|
|
264
264
|
syncBlockRemoved.forEach(function (syncBlock) {
|
|
265
265
|
var _api$analytics;
|
|
266
266
|
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || _api$analytics.fireAnalyticsEvent({
|
|
267
|
-
action:
|
|
268
|
-
actionSubject:
|
|
269
|
-
actionSubjectId:
|
|
267
|
+
action: _enums.ACTION.DELETED,
|
|
268
|
+
actionSubject: _enums.ACTION_SUBJECT.SYNCED_BLOCK,
|
|
269
|
+
actionSubjectId: _enums.ACTION_SUBJECT_ID.REFERENCE_SYNCED_BLOCK_DELETE,
|
|
270
270
|
attributes: {
|
|
271
271
|
resourceId: syncBlock.attrs.resourceId,
|
|
272
272
|
blockInstanceId: syncBlock.attrs.localId
|
|
273
273
|
},
|
|
274
|
-
eventType:
|
|
274
|
+
eventType: _enums.EVENT_TYPE.OPERATIONAL
|
|
275
275
|
});
|
|
276
276
|
});
|
|
277
277
|
|
|
@@ -298,16 +298,16 @@ var filterTransactionOnline = function filterTransactionOnline(_ref3) {
|
|
|
298
298
|
syncBlockAdded.forEach(function (syncBlock) {
|
|
299
299
|
var _api$analytics2;
|
|
300
300
|
api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || (_api$analytics2 = _api$analytics2.actions) === null || _api$analytics2 === void 0 || _api$analytics2.fireAnalyticsEvent({
|
|
301
|
-
action:
|
|
302
|
-
actionSubject:
|
|
303
|
-
actionSubjectId:
|
|
301
|
+
action: _enums.ACTION.INSERTED,
|
|
302
|
+
actionSubject: _enums.ACTION_SUBJECT.DOCUMENT,
|
|
303
|
+
actionSubjectId: _enums.ACTION_SUBJECT_ID.SYNCED_BLOCK,
|
|
304
304
|
attributes: {
|
|
305
305
|
resourceId: syncBlock.attrs.resourceId,
|
|
306
306
|
blockInstanceId: syncBlock.attrs.localId,
|
|
307
307
|
sourceProduct: (0, _utils2.getSourceProductFromResourceIdSafe)(syncBlock.attrs.resourceId),
|
|
308
308
|
isPaste: isPaste
|
|
309
309
|
},
|
|
310
|
-
eventType:
|
|
310
|
+
eventType: _enums.EVENT_TYPE.TRACK
|
|
311
311
|
});
|
|
312
312
|
});
|
|
313
313
|
if (bodiedSyncBlockRemoved.length > 0) {
|
|
@@ -693,7 +693,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
693
693
|
var docHasSyncedBlocks = (0, _hasSyncedBlocks.hasSyncedBlocks)(instance.doc);
|
|
694
694
|
if (docHasSyncedBlocks) {
|
|
695
695
|
var syncBlockNodes = instance.doc.children.filter(syncBlockStore.referenceManager.isReferenceBlock);
|
|
696
|
-
syncBlockStore.referenceManager.fetchSyncBlocksData((0,
|
|
696
|
+
syncBlockStore.referenceManager.fetchSyncBlocksData((0, _utils2.convertPMNodesToSyncBlockNodes)(syncBlockNodes));
|
|
697
697
|
|
|
698
698
|
// Populate source sync block cache from initial document.
|
|
699
699
|
// This replaces the constructor call in the nodeview.
|
|
@@ -708,7 +708,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
708
708
|
}
|
|
709
709
|
|
|
710
710
|
// Read initial shared-state signals for status decorations
|
|
711
|
-
var initIsOffline = (0,
|
|
711
|
+
var initIsOffline = (0, _isOfflineMode.isOfflineMode)(api === null || api === void 0 || (_api$connectivity2 = api.connectivity) === null || _api$connectivity2 === void 0 || (_api$connectivity2 = _api$connectivity2.sharedState.currentState()) === null || _api$connectivity2 === void 0 ? void 0 : _api$connectivity2.mode);
|
|
712
712
|
var initIsViewMode = (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view';
|
|
713
713
|
var initIsDragging = (api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || (_api$userIntent = _api$userIntent.sharedState.currentState()) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.currentUserIntent) === 'dragging';
|
|
714
714
|
|
|
@@ -762,7 +762,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
762
762
|
// status decoration rebuilds (e.g. drag border). Without this check the
|
|
763
763
|
// fast path would swallow drag-start transactions and the synced block
|
|
764
764
|
// border would never appear (see VR test: synced-block-drag-selection).
|
|
765
|
-
if (!meta && !tr.docChanged && tr.selection.eq(oldEditorState.selection) && nextHasUnsavedBodiedSyncBlockChanges === currentPluginState.hasUnsavedBodiedSyncBlockChanges && (api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 || (_api$userIntent2 = _api$userIntent2.sharedState.currentState()) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.currentUserIntent) === 'dragging' === prevDragging && (0,
|
|
765
|
+
if (!meta && !tr.docChanged && tr.selection.eq(oldEditorState.selection) && nextHasUnsavedBodiedSyncBlockChanges === currentPluginState.hasUnsavedBodiedSyncBlockChanges && (api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 || (_api$userIntent2 = _api$userIntent2.sharedState.currentState()) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.currentUserIntent) === 'dragging' === prevDragging && (0, _isOfflineMode.isOfflineMode)(api === null || api === void 0 || (_api$connectivity3 = api.connectivity) === null || _api$connectivity3 === void 0 || (_api$connectivity3 = _api$connectivity3.sharedState.currentState()) === null || _api$connectivity3 === void 0 ? void 0 : _api$connectivity3.mode) === prevOffline && (api === null || api === void 0 || (_api$editorViewMode2 = api.editorViewMode) === null || _api$editorViewMode2 === void 0 || (_api$editorViewMode2 = _api$editorViewMode2.sharedState.currentState()) === null || _api$editorViewMode2 === void 0 ? void 0 : _api$editorViewMode2.mode) === 'view' === prevViewMode) {
|
|
766
766
|
return currentPluginState;
|
|
767
767
|
}
|
|
768
768
|
|
|
@@ -803,7 +803,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
803
803
|
} else {
|
|
804
804
|
var _api$connectivity4, _api$editorViewMode3, _api$userIntent3;
|
|
805
805
|
// Read current shared-state signals
|
|
806
|
-
nextIsOffline = (0,
|
|
806
|
+
nextIsOffline = (0, _isOfflineMode.isOfflineMode)(api === null || api === void 0 || (_api$connectivity4 = api.connectivity) === null || _api$connectivity4 === void 0 || (_api$connectivity4 = _api$connectivity4.sharedState.currentState()) === null || _api$connectivity4 === void 0 ? void 0 : _api$connectivity4.mode);
|
|
807
807
|
nextIsViewMode = (api === null || api === void 0 || (_api$editorViewMode3 = api.editorViewMode) === null || _api$editorViewMode3 === void 0 || (_api$editorViewMode3 = _api$editorViewMode3.sharedState.currentState()) === null || _api$editorViewMode3 === void 0 ? void 0 : _api$editorViewMode3.mode) === 'view';
|
|
808
808
|
nextIsDragging = (api === null || api === void 0 || (_api$userIntent3 = api.userIntent) === null || _api$userIntent3 === void 0 || (_api$userIntent3 = _api$userIntent3.sharedState.currentState()) === null || _api$userIntent3 === void 0 ? void 0 : _api$userIntent3.currentUserIntent) === 'dragging';
|
|
809
809
|
|
|
@@ -943,7 +943,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
943
943
|
// Instead, strip the bodiedSyncBlock wrapper and keep only the
|
|
944
944
|
// inner content to prevent createBlock being called with the
|
|
945
945
|
// wrong parentId.
|
|
946
|
-
return (0,
|
|
946
|
+
return (0, _slice.mapSlice)(slice, function (node) {
|
|
947
947
|
if (node.type.name === 'bodiedSyncBlock' && node.attrs.resourceId) {
|
|
948
948
|
// Return the inner content without the sync block wrapper.
|
|
949
949
|
// This is the same behavior as when a partial selection of
|
|
@@ -966,7 +966,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
966
966
|
return slice;
|
|
967
967
|
}
|
|
968
968
|
var containsCutSyncBlock = false;
|
|
969
|
-
var transformedSlice = (0,
|
|
969
|
+
var transformedSlice = (0, _slice.mapSlice)(slice, function (node) {
|
|
970
970
|
if (syncBlockStore.referenceManager.isReferenceBlock(node)) {
|
|
971
971
|
var _syncBlockStore$refer;
|
|
972
972
|
if (isCut) {
|
|
@@ -1029,7 +1029,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
1029
1029
|
if (viewMode === 'view') {
|
|
1030
1030
|
return true;
|
|
1031
1031
|
}
|
|
1032
|
-
var isOffline = (0,
|
|
1032
|
+
var isOffline = (0, _isOfflineMode.isOfflineMode)(api === null || api === void 0 || (_api$connectivity5 = api.connectivity) === null || _api$connectivity5 === void 0 || (_api$connectivity5 = _api$connectivity5.sharedState.currentState()) === null || _api$connectivity5 === void 0 ? void 0 : _api$connectivity5.mode);
|
|
1033
1033
|
var isConfirmedSyncBlockDeletion = Boolean(tr.getMeta('isConfirmedSyncBlockDeletion'));
|
|
1034
1034
|
|
|
1035
1035
|
// Track newly added reference sync blocks before processing the transaction
|
|
@@ -1075,7 +1075,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
1075
1075
|
}).filter(function (node) {
|
|
1076
1076
|
return node !== undefined;
|
|
1077
1077
|
});
|
|
1078
|
-
syncBlockStore.referenceManager.fetchSyncBlocksData((0,
|
|
1078
|
+
syncBlockStore.referenceManager.fetchSyncBlocksData((0, _utils2.convertPMNodesToSyncBlockNodes)(syncBlockNodes));
|
|
1079
1079
|
}
|
|
1080
1080
|
if (!tr.docChanged || Boolean(tr.getMeta('isRemote')) || !isOffline && isConfirmedSyncBlockDeletion) {
|
|
1081
1081
|
return true;
|