@atlaskit/editor-plugin-block-controls 8.10.2 → 8.10.3
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-block-controls
|
|
2
2
|
|
|
3
|
+
## 8.10.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5d27d5dc155ff`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5d27d5dc155ff) -
|
|
8
|
+
Editor-5020: Fix the column drop hint not visible inside sync block
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 8.10.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getActiveDropTargetDecorations = exports.canMoveNodeOrSliceToPos = void 0;
|
|
7
7
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
8
8
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
9
|
+
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
9
10
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
10
11
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
11
12
|
var _decorationsCommon = require("./decorations-common");
|
|
@@ -211,23 +212,45 @@ var getActiveDropTargetDecorations = exports.getActiveDropTargetDecorations = fu
|
|
|
211
212
|
pos: root.pos
|
|
212
213
|
};
|
|
213
214
|
}
|
|
215
|
+
var anchorEmitNodeWithPos = rootNodeWithPos;
|
|
214
216
|
if ((0, _experiments.editorExperiment)('advanced_layouts', true)) {
|
|
215
|
-
|
|
217
|
+
if ((0, _expValEquals.expValEquals)('platform_synced_block', 'isEnabled', true) && (0, _expValEquals.expValEquals)('platform_synced_block_patch_6', 'isEnabled', true)) {
|
|
218
|
+
var schema = rootNodeWithPos.node.type.schema;
|
|
219
|
+
var layoutSection = schema.nodes.layoutSection;
|
|
220
|
+
var isLayoutSectionChildOfRoot = (0, _utils2.findChildrenByType)(rootNodeWithPos.node, layoutSection, false).length > 0;
|
|
221
|
+
if (isLayoutSectionChildOfRoot) {
|
|
222
|
+
// if node has layoutSection as a child, get the layoutSection node and pos
|
|
223
|
+
for (var ancestorDepth = $toPos.depth; ancestorDepth >= 1; ancestorDepth--) {
|
|
224
|
+
if ($toPos.node(ancestorDepth).type.name === 'layoutSection') {
|
|
225
|
+
anchorEmitNodeWithPos = {
|
|
226
|
+
node: $toPos.node(ancestorDepth),
|
|
227
|
+
pos: $toPos.before(ancestorDepth)
|
|
228
|
+
};
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
} else {
|
|
233
|
+
anchorEmitNodeWithPos = rootNodeWithPos;
|
|
234
|
+
}
|
|
235
|
+
} else {
|
|
236
|
+
anchorEmitNodeWithPos = rootNodeWithPos;
|
|
237
|
+
}
|
|
238
|
+
var _isSameLayout = $activeNodePos && (0, _validation.isInSameLayout)($activeNodePos, state.doc.resolve(anchorEmitNodeWithPos.pos));
|
|
216
239
|
var hasUnsupportedContent = UNSUPPORTED_LAYOUT_CONTENT.includes((activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) || '') && (0, _experiments.editorExperiment)('platform_synced_block', true);
|
|
217
|
-
if (
|
|
218
|
-
var layoutSectionNode =
|
|
240
|
+
if (anchorEmitNodeWithPos.node.type.name === 'layoutSection' && !hasUnsupportedContent) {
|
|
241
|
+
var layoutSectionNode = anchorEmitNodeWithPos.node;
|
|
219
242
|
if (layoutSectionNode.childCount < (0, _consts.maxLayoutColumnSupported)() || _isSameLayout) {
|
|
220
243
|
layoutSectionNode.descendants(function (childNode, childPos, parent, index) {
|
|
221
244
|
if (childNode.type.name === 'layoutColumn' && (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'layoutSection' && index !== 0 // Not the first node
|
|
222
245
|
) {
|
|
223
|
-
var currentPos =
|
|
246
|
+
var currentPos = anchorEmitNodeWithPos.pos + childPos + 1;
|
|
224
247
|
if (existingDecsPos.includes(currentPos)) {
|
|
225
248
|
// if the decoration already exists, we don't add it again.
|
|
226
249
|
decsToRemove = decsToRemove.filter(function (dec) {
|
|
227
250
|
return dec.from !== currentPos;
|
|
228
251
|
});
|
|
229
252
|
} else {
|
|
230
|
-
decsToAdd.push((0, _decorationsDropTarget.createLayoutDropTargetDecoration)(
|
|
253
|
+
decsToAdd.push((0, _decorationsDropTarget.createLayoutDropTargetDecoration)(anchorEmitNodeWithPos.pos + childPos + 1, {
|
|
231
254
|
api: api,
|
|
232
255
|
parent: parent,
|
|
233
256
|
formatMessage: formatMessage
|
|
@@ -239,7 +262,7 @@ var getActiveDropTargetDecorations = exports.getActiveDropTargetDecorations = fu
|
|
|
239
262
|
}
|
|
240
263
|
}
|
|
241
264
|
}
|
|
242
|
-
_activeAnchorTracker.defaultActiveAnchorTracker.emit((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? api.core.actions.getAnchorIdForNode(
|
|
265
|
+
_activeAnchorTracker.defaultActiveAnchorTracker.emit((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? api.core.actions.getAnchorIdForNode(anchorEmitNodeWithPos.node, anchorEmitNodeWithPos.pos) || '' : (0, _decorationsCommon.getNodeAnchor)(anchorEmitNodeWithPos.node));
|
|
243
266
|
return {
|
|
244
267
|
decsToAdd: decsToAdd,
|
|
245
268
|
decsToRemove: decsToRemove
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
|
|
2
2
|
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
3
|
+
import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
4
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
6
|
import { getNodeAnchor } from './decorations-common';
|
|
@@ -194,21 +195,45 @@ export const getActiveDropTargetDecorations = (activeDropTargetNode, state, api,
|
|
|
194
195
|
pos: root.pos
|
|
195
196
|
};
|
|
196
197
|
}
|
|
198
|
+
let anchorEmitNodeWithPos = rootNodeWithPos;
|
|
197
199
|
if (editorExperiment('advanced_layouts', true)) {
|
|
198
|
-
|
|
200
|
+
if (expValEquals('platform_synced_block', 'isEnabled', true) && expValEquals('platform_synced_block_patch_6', 'isEnabled', true)) {
|
|
201
|
+
const schema = rootNodeWithPos.node.type.schema;
|
|
202
|
+
const {
|
|
203
|
+
layoutSection
|
|
204
|
+
} = schema.nodes;
|
|
205
|
+
const isLayoutSectionChildOfRoot = findChildrenByType(rootNodeWithPos.node, layoutSection, false).length > 0;
|
|
206
|
+
if (isLayoutSectionChildOfRoot) {
|
|
207
|
+
// if node has layoutSection as a child, get the layoutSection node and pos
|
|
208
|
+
for (let ancestorDepth = $toPos.depth; ancestorDepth >= 1; ancestorDepth--) {
|
|
209
|
+
if ($toPos.node(ancestorDepth).type.name === 'layoutSection') {
|
|
210
|
+
anchorEmitNodeWithPos = {
|
|
211
|
+
node: $toPos.node(ancestorDepth),
|
|
212
|
+
pos: $toPos.before(ancestorDepth)
|
|
213
|
+
};
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
} else {
|
|
218
|
+
anchorEmitNodeWithPos = rootNodeWithPos;
|
|
219
|
+
}
|
|
220
|
+
} else {
|
|
221
|
+
anchorEmitNodeWithPos = rootNodeWithPos;
|
|
222
|
+
}
|
|
223
|
+
const isSameLayout = $activeNodePos && isInSameLayout($activeNodePos, state.doc.resolve(anchorEmitNodeWithPos.pos));
|
|
199
224
|
const hasUnsupportedContent = UNSUPPORTED_LAYOUT_CONTENT.includes((activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) || '') && editorExperiment('platform_synced_block', true);
|
|
200
|
-
if (
|
|
201
|
-
const layoutSectionNode =
|
|
225
|
+
if (anchorEmitNodeWithPos.node.type.name === 'layoutSection' && !hasUnsupportedContent) {
|
|
226
|
+
const layoutSectionNode = anchorEmitNodeWithPos.node;
|
|
202
227
|
if (layoutSectionNode.childCount < maxLayoutColumnSupported() || isSameLayout) {
|
|
203
228
|
layoutSectionNode.descendants((childNode, childPos, parent, index) => {
|
|
204
229
|
if (childNode.type.name === 'layoutColumn' && (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'layoutSection' && index !== 0 // Not the first node
|
|
205
230
|
) {
|
|
206
|
-
const currentPos =
|
|
231
|
+
const currentPos = anchorEmitNodeWithPos.pos + childPos + 1;
|
|
207
232
|
if (existingDecsPos.includes(currentPos)) {
|
|
208
233
|
// if the decoration already exists, we don't add it again.
|
|
209
234
|
decsToRemove = decsToRemove.filter(dec => dec.from !== currentPos);
|
|
210
235
|
} else {
|
|
211
|
-
decsToAdd.push(createLayoutDropTargetDecoration(
|
|
236
|
+
decsToAdd.push(createLayoutDropTargetDecoration(anchorEmitNodeWithPos.pos + childPos + 1, {
|
|
212
237
|
api,
|
|
213
238
|
parent,
|
|
214
239
|
formatMessage
|
|
@@ -220,7 +245,7 @@ export const getActiveDropTargetDecorations = (activeDropTargetNode, state, api,
|
|
|
220
245
|
}
|
|
221
246
|
}
|
|
222
247
|
}
|
|
223
|
-
defaultActiveAnchorTracker.emit(expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? api.core.actions.getAnchorIdForNode(
|
|
248
|
+
defaultActiveAnchorTracker.emit(expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? api.core.actions.getAnchorIdForNode(anchorEmitNodeWithPos.node, anchorEmitNodeWithPos.pos) || '' : getNodeAnchor(anchorEmitNodeWithPos.node));
|
|
224
249
|
return {
|
|
225
250
|
decsToAdd,
|
|
226
251
|
decsToRemove
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
|
|
2
2
|
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
3
|
+
import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
4
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
6
|
import { getNodeAnchor } from './decorations-common';
|
|
@@ -206,23 +207,45 @@ export var getActiveDropTargetDecorations = function getActiveDropTargetDecorati
|
|
|
206
207
|
pos: root.pos
|
|
207
208
|
};
|
|
208
209
|
}
|
|
210
|
+
var anchorEmitNodeWithPos = rootNodeWithPos;
|
|
209
211
|
if (editorExperiment('advanced_layouts', true)) {
|
|
210
|
-
|
|
212
|
+
if (expValEquals('platform_synced_block', 'isEnabled', true) && expValEquals('platform_synced_block_patch_6', 'isEnabled', true)) {
|
|
213
|
+
var schema = rootNodeWithPos.node.type.schema;
|
|
214
|
+
var layoutSection = schema.nodes.layoutSection;
|
|
215
|
+
var isLayoutSectionChildOfRoot = findChildrenByType(rootNodeWithPos.node, layoutSection, false).length > 0;
|
|
216
|
+
if (isLayoutSectionChildOfRoot) {
|
|
217
|
+
// if node has layoutSection as a child, get the layoutSection node and pos
|
|
218
|
+
for (var ancestorDepth = $toPos.depth; ancestorDepth >= 1; ancestorDepth--) {
|
|
219
|
+
if ($toPos.node(ancestorDepth).type.name === 'layoutSection') {
|
|
220
|
+
anchorEmitNodeWithPos = {
|
|
221
|
+
node: $toPos.node(ancestorDepth),
|
|
222
|
+
pos: $toPos.before(ancestorDepth)
|
|
223
|
+
};
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
} else {
|
|
228
|
+
anchorEmitNodeWithPos = rootNodeWithPos;
|
|
229
|
+
}
|
|
230
|
+
} else {
|
|
231
|
+
anchorEmitNodeWithPos = rootNodeWithPos;
|
|
232
|
+
}
|
|
233
|
+
var _isSameLayout = $activeNodePos && isInSameLayout($activeNodePos, state.doc.resolve(anchorEmitNodeWithPos.pos));
|
|
211
234
|
var hasUnsupportedContent = UNSUPPORTED_LAYOUT_CONTENT.includes((activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) || '') && editorExperiment('platform_synced_block', true);
|
|
212
|
-
if (
|
|
213
|
-
var layoutSectionNode =
|
|
235
|
+
if (anchorEmitNodeWithPos.node.type.name === 'layoutSection' && !hasUnsupportedContent) {
|
|
236
|
+
var layoutSectionNode = anchorEmitNodeWithPos.node;
|
|
214
237
|
if (layoutSectionNode.childCount < maxLayoutColumnSupported() || _isSameLayout) {
|
|
215
238
|
layoutSectionNode.descendants(function (childNode, childPos, parent, index) {
|
|
216
239
|
if (childNode.type.name === 'layoutColumn' && (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'layoutSection' && index !== 0 // Not the first node
|
|
217
240
|
) {
|
|
218
|
-
var currentPos =
|
|
241
|
+
var currentPos = anchorEmitNodeWithPos.pos + childPos + 1;
|
|
219
242
|
if (existingDecsPos.includes(currentPos)) {
|
|
220
243
|
// if the decoration already exists, we don't add it again.
|
|
221
244
|
decsToRemove = decsToRemove.filter(function (dec) {
|
|
222
245
|
return dec.from !== currentPos;
|
|
223
246
|
});
|
|
224
247
|
} else {
|
|
225
|
-
decsToAdd.push(createLayoutDropTargetDecoration(
|
|
248
|
+
decsToAdd.push(createLayoutDropTargetDecoration(anchorEmitNodeWithPos.pos + childPos + 1, {
|
|
226
249
|
api: api,
|
|
227
250
|
parent: parent,
|
|
228
251
|
formatMessage: formatMessage
|
|
@@ -234,7 +257,7 @@ export var getActiveDropTargetDecorations = function getActiveDropTargetDecorati
|
|
|
234
257
|
}
|
|
235
258
|
}
|
|
236
259
|
}
|
|
237
|
-
defaultActiveAnchorTracker.emit(expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? api.core.actions.getAnchorIdForNode(
|
|
260
|
+
defaultActiveAnchorTracker.emit(expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? api.core.actions.getAnchorIdForNode(anchorEmitNodeWithPos.node, anchorEmitNodeWithPos.pos) || '' : getNodeAnchor(anchorEmitNodeWithPos.node));
|
|
238
261
|
return {
|
|
239
262
|
decsToAdd: decsToAdd,
|
|
240
263
|
decsToRemove: decsToRemove
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "8.10.
|
|
3
|
+
"version": "8.10.3",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
57
57
|
"@atlaskit/primitives": "^18.0.0",
|
|
58
58
|
"@atlaskit/theme": "^22.0.0",
|
|
59
|
-
"@atlaskit/tmp-editor-statsig": "^35.
|
|
59
|
+
"@atlaskit/tmp-editor-statsig": "^35.2.0",
|
|
60
60
|
"@atlaskit/tokens": "^11.0.0",
|
|
61
61
|
"@atlaskit/tooltip": "^20.14.0",
|
|
62
62
|
"@babel/runtime": "^7.0.0",
|