@atlaskit/editor-plugin-synced-block 5.4.3 → 5.4.4
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,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
+
## 5.4.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`29d9d25ebe53a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/29d9d25ebe53a) -
|
|
8
|
+
[ux] EDITOR-5009 show sync block border when dragging
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 5.4.3
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -365,16 +365,18 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
365
365
|
})
|
|
366
366
|
},
|
|
367
367
|
decorations: function decorations(state) {
|
|
368
|
-
var _currentPluginState$s, _api$connectivity2, _api$editorViewMode;
|
|
368
|
+
var _currentPluginState$s, _api$connectivity2, _api$editorViewMode, _api$userIntent;
|
|
369
369
|
var currentPluginState = syncedBlockPluginKey.getState(state);
|
|
370
370
|
var selectionDecorationSet = (_currentPluginState$s = currentPluginState === null || currentPluginState === void 0 ? void 0 : currentPluginState.selectionDecorationSet) !== null && _currentPluginState$s !== void 0 ? _currentPluginState$s : _view.DecorationSet.empty;
|
|
371
371
|
var syncBlockStore = currentPluginState === null || currentPluginState === void 0 ? void 0 : currentPluginState.syncBlockStore;
|
|
372
372
|
var doc = state.doc;
|
|
373
373
|
var isOffline = (0, _editorPluginConnectivity.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);
|
|
374
374
|
var isViewMode = (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';
|
|
375
|
+
var isDragging = (0, _platformFeatureFlags.fg)('platform_synced_block_patch_5') ? (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' : undefined;
|
|
375
376
|
var offlineDecorations = [];
|
|
376
377
|
var viewModeDecorations = [];
|
|
377
378
|
var loadingDecorations = [];
|
|
379
|
+
var dragDecorations = [];
|
|
378
380
|
state.doc.descendants(function (node, pos) {
|
|
379
381
|
if (node.type.name === 'bodiedSyncBlock' && isOffline) {
|
|
380
382
|
offlineDecorations.push(_view.Decoration.node(pos, pos + node.nodeSize, {
|
|
@@ -391,8 +393,15 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
391
393
|
class: _syncBlock.SyncBlockStateCssClassName.creationLoadingClassName
|
|
392
394
|
}));
|
|
393
395
|
}
|
|
396
|
+
|
|
397
|
+
// Show sync block border while the user is dragging
|
|
398
|
+
if (isDragging && (node.type.name === 'bodiedSyncBlock' || node.type.name === 'syncBlock') && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_5')) {
|
|
399
|
+
dragDecorations.push(_view.Decoration.node(pos, pos + node.nodeSize, {
|
|
400
|
+
class: _syncBlock.SyncBlockStateCssClassName.draggingClassName
|
|
401
|
+
}));
|
|
402
|
+
}
|
|
394
403
|
});
|
|
395
|
-
return selectionDecorationSet.add(doc, offlineDecorations).add(doc, viewModeDecorations).add(doc, loadingDecorations);
|
|
404
|
+
return selectionDecorationSet.add(doc, offlineDecorations).add(doc, viewModeDecorations).add(doc, loadingDecorations).add(doc, dragDecorations);
|
|
396
405
|
},
|
|
397
406
|
handleClickOn: (0, _selection.createSelectionClickHandler)(['bodiedSyncBlock'], function (target) {
|
|
398
407
|
return !!target.closest(".".concat(_syncBlock.BodiedSyncBlockSharedCssClassName.prefix));
|
|
@@ -326,7 +326,7 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
|
|
|
326
326
|
})
|
|
327
327
|
},
|
|
328
328
|
decorations: state => {
|
|
329
|
-
var _currentPluginState$s, _api$connectivity2, _api$connectivity2$sh, _api$editorViewMode, _api$editorViewMode$s;
|
|
329
|
+
var _currentPluginState$s, _api$connectivity2, _api$connectivity2$sh, _api$editorViewMode, _api$editorViewMode$s, _api$userIntent, _api$userIntent$share;
|
|
330
330
|
const currentPluginState = syncedBlockPluginKey.getState(state);
|
|
331
331
|
const selectionDecorationSet = (_currentPluginState$s = currentPluginState === null || currentPluginState === void 0 ? void 0 : currentPluginState.selectionDecorationSet) !== null && _currentPluginState$s !== void 0 ? _currentPluginState$s : DecorationSet.empty;
|
|
332
332
|
const syncBlockStore = currentPluginState === null || currentPluginState === void 0 ? void 0 : currentPluginState.syncBlockStore;
|
|
@@ -335,9 +335,11 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
|
|
|
335
335
|
} = state;
|
|
336
336
|
const isOffline = isOfflineMode(api === null || api === void 0 ? void 0 : (_api$connectivity2 = api.connectivity) === null || _api$connectivity2 === void 0 ? void 0 : (_api$connectivity2$sh = _api$connectivity2.sharedState.currentState()) === null || _api$connectivity2$sh === void 0 ? void 0 : _api$connectivity2$sh.mode);
|
|
337
337
|
const isViewMode = (api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : (_api$editorViewMode$s = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode$s === void 0 ? void 0 : _api$editorViewMode$s.mode) === 'view';
|
|
338
|
+
const isDragging = fg('platform_synced_block_patch_5') ? (api === null || api === void 0 ? void 0 : (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : (_api$userIntent$share = _api$userIntent.sharedState.currentState()) === null || _api$userIntent$share === void 0 ? void 0 : _api$userIntent$share.currentUserIntent) === 'dragging' : undefined;
|
|
338
339
|
const offlineDecorations = [];
|
|
339
340
|
const viewModeDecorations = [];
|
|
340
341
|
const loadingDecorations = [];
|
|
342
|
+
const dragDecorations = [];
|
|
341
343
|
state.doc.descendants((node, pos) => {
|
|
342
344
|
if (node.type.name === 'bodiedSyncBlock' && isOffline) {
|
|
343
345
|
offlineDecorations.push(Decoration.node(pos, pos + node.nodeSize, {
|
|
@@ -354,8 +356,15 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
|
|
|
354
356
|
class: SyncBlockStateCssClassName.creationLoadingClassName
|
|
355
357
|
}));
|
|
356
358
|
}
|
|
359
|
+
|
|
360
|
+
// Show sync block border while the user is dragging
|
|
361
|
+
if (isDragging && (node.type.name === 'bodiedSyncBlock' || node.type.name === 'syncBlock') && fg('platform_synced_block_patch_5')) {
|
|
362
|
+
dragDecorations.push(Decoration.node(pos, pos + node.nodeSize, {
|
|
363
|
+
class: SyncBlockStateCssClassName.draggingClassName
|
|
364
|
+
}));
|
|
365
|
+
}
|
|
357
366
|
});
|
|
358
|
-
return selectionDecorationSet.add(doc, offlineDecorations).add(doc, viewModeDecorations).add(doc, loadingDecorations);
|
|
367
|
+
return selectionDecorationSet.add(doc, offlineDecorations).add(doc, viewModeDecorations).add(doc, loadingDecorations).add(doc, dragDecorations);
|
|
359
368
|
},
|
|
360
369
|
handleClickOn: createSelectionClickHandler(['bodiedSyncBlock'], target => !!target.closest(`.${BodiedSyncBlockSharedCssClassName.prefix}`), {
|
|
361
370
|
useLongPressSelection
|
|
@@ -358,16 +358,18 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
358
358
|
})
|
|
359
359
|
},
|
|
360
360
|
decorations: function decorations(state) {
|
|
361
|
-
var _currentPluginState$s, _api$connectivity2, _api$editorViewMode;
|
|
361
|
+
var _currentPluginState$s, _api$connectivity2, _api$editorViewMode, _api$userIntent;
|
|
362
362
|
var currentPluginState = syncedBlockPluginKey.getState(state);
|
|
363
363
|
var selectionDecorationSet = (_currentPluginState$s = currentPluginState === null || currentPluginState === void 0 ? void 0 : currentPluginState.selectionDecorationSet) !== null && _currentPluginState$s !== void 0 ? _currentPluginState$s : DecorationSet.empty;
|
|
364
364
|
var syncBlockStore = currentPluginState === null || currentPluginState === void 0 ? void 0 : currentPluginState.syncBlockStore;
|
|
365
365
|
var doc = state.doc;
|
|
366
366
|
var isOffline = 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);
|
|
367
367
|
var isViewMode = (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';
|
|
368
|
+
var isDragging = fg('platform_synced_block_patch_5') ? (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' : undefined;
|
|
368
369
|
var offlineDecorations = [];
|
|
369
370
|
var viewModeDecorations = [];
|
|
370
371
|
var loadingDecorations = [];
|
|
372
|
+
var dragDecorations = [];
|
|
371
373
|
state.doc.descendants(function (node, pos) {
|
|
372
374
|
if (node.type.name === 'bodiedSyncBlock' && isOffline) {
|
|
373
375
|
offlineDecorations.push(Decoration.node(pos, pos + node.nodeSize, {
|
|
@@ -384,8 +386,15 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
384
386
|
class: SyncBlockStateCssClassName.creationLoadingClassName
|
|
385
387
|
}));
|
|
386
388
|
}
|
|
389
|
+
|
|
390
|
+
// Show sync block border while the user is dragging
|
|
391
|
+
if (isDragging && (node.type.name === 'bodiedSyncBlock' || node.type.name === 'syncBlock') && fg('platform_synced_block_patch_5')) {
|
|
392
|
+
dragDecorations.push(Decoration.node(pos, pos + node.nodeSize, {
|
|
393
|
+
class: SyncBlockStateCssClassName.draggingClassName
|
|
394
|
+
}));
|
|
395
|
+
}
|
|
387
396
|
});
|
|
388
|
-
return selectionDecorationSet.add(doc, offlineDecorations).add(doc, viewModeDecorations).add(doc, loadingDecorations);
|
|
397
|
+
return selectionDecorationSet.add(doc, offlineDecorations).add(doc, viewModeDecorations).add(doc, loadingDecorations).add(doc, dragDecorations);
|
|
389
398
|
},
|
|
390
399
|
handleClickOn: createSelectionClickHandler(['bodiedSyncBlock'], function (target) {
|
|
391
400
|
return !!target.closest(".".concat(BodiedSyncBlockSharedCssClassName.prefix));
|
|
@@ -12,6 +12,7 @@ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmo
|
|
|
12
12
|
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
13
13
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
14
14
|
import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
15
|
+
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
15
16
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
16
17
|
import type { SyncBlockDataProviderInterface, UseFetchSyncBlockDataResult } from '@atlaskit/editor-synced-block-provider';
|
|
17
18
|
import type { SyncedBlockSharedState } from './types';
|
|
@@ -79,7 +80,8 @@ export type SyncedBlockPlugin = NextEditorPlugin<'syncedBlock', {
|
|
|
79
80
|
OptionalPlugin<AnalyticsPlugin>,
|
|
80
81
|
OptionalPlugin<ConnectivityPlugin>,
|
|
81
82
|
OptionalPlugin<EditorViewModePlugin>,
|
|
82
|
-
OptionalPlugin<ContentFormatPlugin
|
|
83
|
+
OptionalPlugin<ContentFormatPlugin>,
|
|
84
|
+
OptionalPlugin<UserIntentPlugin>
|
|
83
85
|
];
|
|
84
86
|
pluginConfiguration: SyncedBlockPluginOptions | undefined;
|
|
85
87
|
sharedState: SyncedBlockSharedState | undefined;
|
|
@@ -12,6 +12,7 @@ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmo
|
|
|
12
12
|
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
13
13
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
14
14
|
import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
15
|
+
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
15
16
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
16
17
|
import type { SyncBlockDataProviderInterface, UseFetchSyncBlockDataResult } from '@atlaskit/editor-synced-block-provider';
|
|
17
18
|
import type { SyncedBlockSharedState } from './types';
|
|
@@ -79,7 +80,8 @@ export type SyncedBlockPlugin = NextEditorPlugin<'syncedBlock', {
|
|
|
79
80
|
OptionalPlugin<AnalyticsPlugin>,
|
|
80
81
|
OptionalPlugin<ConnectivityPlugin>,
|
|
81
82
|
OptionalPlugin<EditorViewModePlugin>,
|
|
82
|
-
OptionalPlugin<ContentFormatPlugin
|
|
83
|
+
OptionalPlugin<ContentFormatPlugin>,
|
|
84
|
+
OptionalPlugin<UserIntentPlugin>
|
|
83
85
|
];
|
|
84
86
|
pluginConfiguration: SyncedBlockPluginOptions | undefined;
|
|
85
87
|
sharedState: SyncedBlockSharedState | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.4",
|
|
4
4
|
"description": "SyncedBlock plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
"@atlaskit/tooltip": "^20.14.0",
|
|
56
56
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
57
57
|
"@babel/runtime": "^7.0.0",
|
|
58
|
-
"@compiled/react": "^0.
|
|
58
|
+
"@compiled/react": "^0.20.0",
|
|
59
59
|
"bind-event-listener": "^3.0.0",
|
|
60
60
|
"date-fns": "^2.17.0",
|
|
61
61
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@atlaskit/editor-common": "^111.
|
|
64
|
+
"@atlaskit/editor-common": "^111.24.0",
|
|
65
65
|
"react": "^18.2.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|