@atlaskit/editor-plugin-synced-block 13.0.15 → 13.0.17
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 +14 -0
- package/dist/cjs/editor-commands/index.js +2 -1
- package/dist/cjs/pm-plugins/utils/utils.js +8 -1
- package/dist/es2019/editor-commands/index.js +2 -1
- package/dist/es2019/pm-plugins/utils/utils.js +6 -1
- package/dist/esm/editor-commands/index.js +2 -1
- package/dist/esm/pm-plugins/utils/utils.js +8 -1
- package/dist/types/pm-plugins/utils/utils.d.ts +2 -1
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
+
## 13.0.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 13.0.16
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`ec69e45a298f2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ec69e45a298f2) -
|
|
14
|
+
[ux] Preserve synced block breakout width behind `platform_editor_blocks_patch_8`.
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 13.0.15
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -13,6 +13,7 @@ var _model = require("@atlaskit/editor-prosemirror/model");
|
|
|
13
13
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
14
14
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
15
15
|
var _utils2 = require("@atlaskit/editor-synced-block-provider/utils");
|
|
16
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
16
17
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
17
18
|
var _main = require("../pm-plugins/main");
|
|
18
19
|
var _utils3 = require("../pm-plugins/utils/utils");
|
|
@@ -131,7 +132,7 @@ var createSyncedBlock = exports.createSyncedBlock = function createSyncedBlock(_
|
|
|
131
132
|
return false;
|
|
132
133
|
}
|
|
133
134
|
var _attrs = syncBlockStore.sourceManager.generateBodiedSyncBlockAttrs();
|
|
134
|
-
var _newBodiedSyncBlockNode = bodiedSyncBlock.createAndFill(_attrs, conversionInfo.contentToInclude);
|
|
135
|
+
var _newBodiedSyncBlockNode = bodiedSyncBlock.createAndFill(_attrs, conversionInfo.contentToInclude, (0, _fg.fg)('platform_editor_blocks_patch_8') && conversionInfo.breakoutMark ? [conversionInfo.breakoutMark] : undefined);
|
|
135
136
|
if (!_newBodiedSyncBlockNode) {
|
|
136
137
|
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
|
|
137
138
|
action: _analytics.ACTION.ERROR,
|
|
@@ -45,6 +45,7 @@ var getUnsupportedNodeTypes = exports.getUnsupportedNodeTypes = (0, _memoizeOne.
|
|
|
45
45
|
* or false if conversion is not possible
|
|
46
46
|
*/
|
|
47
47
|
var canBeConvertedToSyncBlock = exports.canBeConvertedToSyncBlock = function canBeConvertedToSyncBlock(selection) {
|
|
48
|
+
var _selectedContent$firs;
|
|
48
49
|
var _expandSelectionToBlo = (0, _selection.expandSelectionToBlockRange)(selection),
|
|
49
50
|
$from = _expandSelectionToBlo.$from,
|
|
50
51
|
range = _expandSelectionToBlo.range;
|
|
@@ -64,8 +65,14 @@ var canBeConvertedToSyncBlock = exports.canBeConvertedToSyncBlock = function can
|
|
|
64
65
|
if (!canBeConverted) {
|
|
65
66
|
return false;
|
|
66
67
|
}
|
|
67
|
-
var
|
|
68
|
+
var selectedContent = $from.doc.slice(from, to).content;
|
|
69
|
+
// A single wrapper cannot preserve independent breakout widths for a multi-node selection.
|
|
70
|
+
var breakoutMark = selectedContent.childCount === 1 ? (_selectedContent$firs = selectedContent.firstChild) === null || _selectedContent$firs === void 0 ? void 0 : _selectedContent$firs.marks.find(function (mark) {
|
|
71
|
+
return mark.type.name === 'breakout';
|
|
72
|
+
}) : undefined;
|
|
73
|
+
var contentToInclude = removeBreakoutMarks(selectedContent);
|
|
68
74
|
return {
|
|
75
|
+
breakoutMark: breakoutMark,
|
|
69
76
|
contentToInclude: contentToInclude,
|
|
70
77
|
from: from,
|
|
71
78
|
to: to
|
|
@@ -5,6 +5,7 @@ import { DOMSerializer, Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
|
5
5
|
import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { findSelectedNodeOfType, removeParentNodeOfType, removeSelectedNode, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
7
7
|
import { getSourceProductFromResourceIdSafe } from '@atlaskit/editor-synced-block-provider/utils';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
8
9
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
9
10
|
import { creationMetaKey, deleteMechanismMetaKey, syncedBlockPluginKey } from '../pm-plugins/main';
|
|
10
11
|
import { canBeConvertedToSyncBlock, deferDispatch, findSyncBlock, findSyncBlockOrBodiedSyncBlock, isBodiedSyncBlockNode } from '../pm-plugins/utils/utils';
|
|
@@ -127,7 +128,7 @@ export const createSyncedBlock = ({
|
|
|
127
128
|
return false;
|
|
128
129
|
}
|
|
129
130
|
const attrs = syncBlockStore.sourceManager.generateBodiedSyncBlockAttrs();
|
|
130
|
-
const newBodiedSyncBlockNode = bodiedSyncBlock.createAndFill(attrs, conversionInfo.contentToInclude);
|
|
131
|
+
const newBodiedSyncBlockNode = bodiedSyncBlock.createAndFill(attrs, conversionInfo.contentToInclude, fg('platform_editor_blocks_patch_8') && conversionInfo.breakoutMark ? [conversionInfo.breakoutMark] : undefined);
|
|
131
132
|
if (!newBodiedSyncBlockNode) {
|
|
132
133
|
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 ? void 0 : fireAnalyticsEvent({
|
|
133
134
|
action: ACTION.ERROR,
|
|
@@ -36,6 +36,7 @@ export const getUnsupportedNodeTypes = memoizeOne(() => new Set(['inlineExtensio
|
|
|
36
36
|
* or false if conversion is not possible
|
|
37
37
|
*/
|
|
38
38
|
export const canBeConvertedToSyncBlock = selection => {
|
|
39
|
+
var _selectedContent$firs;
|
|
39
40
|
const {
|
|
40
41
|
$from,
|
|
41
42
|
range
|
|
@@ -56,8 +57,12 @@ export const canBeConvertedToSyncBlock = selection => {
|
|
|
56
57
|
if (!canBeConverted) {
|
|
57
58
|
return false;
|
|
58
59
|
}
|
|
59
|
-
const
|
|
60
|
+
const selectedContent = $from.doc.slice(from, to).content;
|
|
61
|
+
// A single wrapper cannot preserve independent breakout widths for a multi-node selection.
|
|
62
|
+
const breakoutMark = selectedContent.childCount === 1 ? (_selectedContent$firs = selectedContent.firstChild) === null || _selectedContent$firs === void 0 ? void 0 : _selectedContent$firs.marks.find(mark => mark.type.name === 'breakout') : undefined;
|
|
63
|
+
const contentToInclude = removeBreakoutMarks(selectedContent);
|
|
60
64
|
return {
|
|
65
|
+
breakoutMark,
|
|
61
66
|
contentToInclude,
|
|
62
67
|
from,
|
|
63
68
|
to
|
|
@@ -8,6 +8,7 @@ import { DOMSerializer, Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
|
8
8
|
import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
9
9
|
import { findSelectedNodeOfType, removeParentNodeOfType, removeSelectedNode, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
10
10
|
import { getSourceProductFromResourceIdSafe } from '@atlaskit/editor-synced-block-provider/utils';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
11
12
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
12
13
|
import { creationMetaKey, deleteMechanismMetaKey, syncedBlockPluginKey } from '../pm-plugins/main';
|
|
13
14
|
import { canBeConvertedToSyncBlock, deferDispatch, findSyncBlock, findSyncBlockOrBodiedSyncBlock, isBodiedSyncBlockNode } from '../pm-plugins/utils/utils';
|
|
@@ -124,7 +125,7 @@ export var createSyncedBlock = function createSyncedBlock(_ref) {
|
|
|
124
125
|
return false;
|
|
125
126
|
}
|
|
126
127
|
var _attrs = syncBlockStore.sourceManager.generateBodiedSyncBlockAttrs();
|
|
127
|
-
var _newBodiedSyncBlockNode = bodiedSyncBlock.createAndFill(_attrs, conversionInfo.contentToInclude);
|
|
128
|
+
var _newBodiedSyncBlockNode = bodiedSyncBlock.createAndFill(_attrs, conversionInfo.contentToInclude, fg('platform_editor_blocks_patch_8') && conversionInfo.breakoutMark ? [conversionInfo.breakoutMark] : undefined);
|
|
128
129
|
if (!_newBodiedSyncBlockNode) {
|
|
129
130
|
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
|
|
130
131
|
action: ACTION.ERROR,
|
|
@@ -39,6 +39,7 @@ export var getUnsupportedNodeTypes = memoizeOne(function () {
|
|
|
39
39
|
* or false if conversion is not possible
|
|
40
40
|
*/
|
|
41
41
|
export var canBeConvertedToSyncBlock = function canBeConvertedToSyncBlock(selection) {
|
|
42
|
+
var _selectedContent$firs;
|
|
42
43
|
var _expandSelectionToBlo = expandSelectionToBlockRange(selection),
|
|
43
44
|
$from = _expandSelectionToBlo.$from,
|
|
44
45
|
range = _expandSelectionToBlo.range;
|
|
@@ -58,8 +59,14 @@ export var canBeConvertedToSyncBlock = function canBeConvertedToSyncBlock(select
|
|
|
58
59
|
if (!canBeConverted) {
|
|
59
60
|
return false;
|
|
60
61
|
}
|
|
61
|
-
var
|
|
62
|
+
var selectedContent = $from.doc.slice(from, to).content;
|
|
63
|
+
// A single wrapper cannot preserve independent breakout widths for a multi-node selection.
|
|
64
|
+
var breakoutMark = selectedContent.childCount === 1 ? (_selectedContent$firs = selectedContent.firstChild) === null || _selectedContent$firs === void 0 ? void 0 : _selectedContent$firs.marks.find(function (mark) {
|
|
65
|
+
return mark.type.name === 'breakout';
|
|
66
|
+
}) : undefined;
|
|
67
|
+
var contentToInclude = removeBreakoutMarks(selectedContent);
|
|
62
68
|
return {
|
|
69
|
+
breakoutMark: breakoutMark,
|
|
63
70
|
contentToInclude: contentToInclude,
|
|
64
71
|
from: from,
|
|
65
72
|
to: to
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MemoizedFn } from 'memoize-one';
|
|
2
2
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type { NodeType, Node as PMNode, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
import type { Mark, NodeType, Node as PMNode, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import type { EditorState, Selection, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
6
6
|
/**
|
|
@@ -13,6 +13,7 @@ export declare const findBodiedSyncBlock: (schema: Schema, selection: Selection)
|
|
|
13
13
|
export declare const findSyncBlockOrBodiedSyncBlock: (schema: Schema, selection: Selection) => ContentNodeWithPos | undefined;
|
|
14
14
|
export declare const isBodiedSyncBlockNode: (node: PMNode, bodiedSyncBlock: NodeType) => boolean;
|
|
15
15
|
export interface SyncBlockConversionInfo {
|
|
16
|
+
breakoutMark?: Mark;
|
|
16
17
|
contentToInclude: Fragment;
|
|
17
18
|
from: number;
|
|
18
19
|
to: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.17",
|
|
4
4
|
"description": "SyncedBlock plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^2.1.0",
|
|
49
49
|
"@atlaskit/primitives": "^22.4.0",
|
|
50
50
|
"@atlaskit/spinner": "20.3.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^158.0.0",
|
|
52
52
|
"@atlaskit/tokens": "16.8.0",
|
|
53
53
|
"@atlaskit/tooltip": "^24.2.0",
|
|
54
54
|
"@atlaskit/visually-hidden": "^4.3.0",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"memoize-one": "^6.0.0"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@atlaskit/editor-common": "^119.
|
|
63
|
+
"@atlaskit/editor-common": "^119.16.0",
|
|
64
64
|
"react": "^18.2.0 || ^19.2.0",
|
|
65
65
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
66
66
|
},
|
|
@@ -112,6 +112,9 @@
|
|
|
112
112
|
"platform_editor_blocks_patch_7": {
|
|
113
113
|
"type": "boolean"
|
|
114
114
|
},
|
|
115
|
+
"platform_editor_blocks_patch_8": {
|
|
116
|
+
"type": "boolean"
|
|
117
|
+
},
|
|
115
118
|
"platform_editor_blocks_patch_9": {
|
|
116
119
|
"type": "boolean"
|
|
117
120
|
}
|