@atlaskit/editor-plugin-expand 8.3.4 → 8.3.5
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 +7 -0
- package/dist/cjs/singlePlayerExpand/node-views/index.js +20 -5
- package/dist/es2019/singlePlayerExpand/node-views/index.js +20 -5
- package/dist/esm/singlePlayerExpand/node-views/index.js +20 -5
- package/dist/types/singlePlayerExpand/node-views/index.d.ts +4 -1
- package/dist/types-ts4.5/singlePlayerExpand/node-views/index.d.ts +4 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-expand
|
|
2
2
|
|
|
3
|
+
## 8.3.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`fb11822025800`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fb11822025800) -
|
|
8
|
+
EDITOR-4473 Fix the selection changes on mouse move after multi turn into expand
|
|
9
|
+
|
|
3
10
|
## 8.3.4
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -18,6 +18,7 @@ var _styles = require("@atlaskit/editor-common/styles");
|
|
|
18
18
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
19
19
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
20
20
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
21
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
21
22
|
var _prosemirrorHistory = require("@atlaskit/prosemirror-history");
|
|
22
23
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
23
24
|
var _renderExpandButton = require("../../ui/renderExpandButton");
|
|
@@ -34,7 +35,9 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
34
35
|
var allowInteractiveExpand = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : true;
|
|
35
36
|
var __livePage = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
|
|
36
37
|
var cleanUpEditorDisabledOnChange = arguments.length > 10 ? arguments[10] : undefined;
|
|
37
|
-
var isExpanded = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] :
|
|
38
|
+
var isExpanded = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : {
|
|
39
|
+
expanded: false
|
|
40
|
+
};
|
|
38
41
|
(0, _classCallCheck2.default)(this, ExpandNodeView);
|
|
39
42
|
(0, _defineProperty2.default)(this, "allowInteractiveExpand", true);
|
|
40
43
|
(0, _defineProperty2.default)(this, "isMobile", false);
|
|
@@ -443,6 +446,11 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
443
446
|
this.getPos = getPos;
|
|
444
447
|
this.view = view;
|
|
445
448
|
this.node = _node;
|
|
449
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_block_menu', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_block_menu_v2_patch_3')) {
|
|
450
|
+
var _expandedState$get;
|
|
451
|
+
this.isExpanded.expanded = (_expandedState$get = _expand.expandedState.get(_node)) !== null && _expandedState$get !== void 0 ? _expandedState$get : false;
|
|
452
|
+
this.isExpanded.localId = _node.attrs.localId;
|
|
453
|
+
}
|
|
446
454
|
var _DOMSerializer$render = _model.DOMSerializer.renderSpec(document, (0, _NodeView.toDOM)(_node, this.__livePage, this.intl, api === null || api === void 0 || (_api$editorDisabled = api.editorDisabled) === null || _api$editorDisabled === void 0 || (_api$editorDisabled = _api$editorDisabled.sharedState.currentState()) === null || _api$editorDisabled === void 0 ? void 0 : _api$editorDisabled.editorDisabled)),
|
|
447
455
|
dom = _DOMSerializer$render.dom,
|
|
448
456
|
contentDOM = _DOMSerializer$render.contentDOM;
|
|
@@ -545,8 +553,10 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
545
553
|
}
|
|
546
554
|
}
|
|
547
555
|
if ((0, _expValEquals.expValEquals)('platform_editor_toggle_expand_on_match_found', 'isEnabled', true)) {
|
|
556
|
+
var _expandedState$get2;
|
|
548
557
|
this.node = node;
|
|
549
|
-
var
|
|
558
|
+
var currentExpanded = (_expandedState$get2 = _expand.expandedState.get(node)) !== null && _expandedState$get2 !== void 0 ? _expandedState$get2 : false;
|
|
559
|
+
var hasChanged = (0, _expValEquals.expValEquals)('platform_editor_block_menu', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_block_menu_v2_patch_3') ? this.isExpanded.expanded !== currentExpanded && this.isExpanded.localId === node.attrs.localId : this.isExpanded.expanded !== currentExpanded;
|
|
550
560
|
if (hasChanged) {
|
|
551
561
|
this.updateExpandToggleIcon(node);
|
|
552
562
|
if ((0, _expValEquals.expValEquals)('platform_editor_display_none_to_expand', 'isEnabled', true)) {
|
|
@@ -579,13 +589,18 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
579
589
|
if ((0, _expValEquals.expValEquals)('platform_editor_vc90_transition_fixes_batch_1', 'isEnabled', true)) {
|
|
580
590
|
this.renderNativeIcon(node);
|
|
581
591
|
} else {
|
|
582
|
-
var _expandedState$
|
|
583
|
-
this.renderIcon(this.icon ? this.icon : null, (_expandedState$
|
|
592
|
+
var _expandedState$get3;
|
|
593
|
+
this.renderIcon(this.icon ? this.icon : null, (_expandedState$get3 = _expand.expandedState.get(node)) !== null && _expandedState$get3 !== void 0 ? _expandedState$get3 : false);
|
|
584
594
|
}
|
|
585
595
|
}
|
|
586
596
|
this.updateExpandBodyContentEditable();
|
|
587
597
|
if ((0, _expValEquals.expValEquals)('platform_editor_toggle_expand_on_match_found', 'isEnabled', true)) {
|
|
588
|
-
this.isExpanded =
|
|
598
|
+
this.isExpanded = (0, _expValEquals.expValEquals)('platform_editor_block_menu', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_block_menu_v2_patch_3') ? {
|
|
599
|
+
expanded: expanded !== null && expanded !== void 0 ? expanded : false,
|
|
600
|
+
localId: node.attrs.localId
|
|
601
|
+
} : {
|
|
602
|
+
expanded: expanded !== null && expanded !== void 0 ? expanded : false
|
|
603
|
+
};
|
|
589
604
|
}
|
|
590
605
|
}
|
|
591
606
|
}, {
|
|
@@ -9,6 +9,7 @@ import { expandClassNames } from '@atlaskit/editor-common/styles';
|
|
|
9
9
|
import { closestElement, isEmptyNode } from '@atlaskit/editor-common/utils';
|
|
10
10
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
11
11
|
import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
13
|
import { redo, undo } from '@atlaskit/prosemirror-history';
|
|
13
14
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
15
|
import { renderExpandButton } from '../../ui/renderExpandButton';
|
|
@@ -17,7 +18,9 @@ import { ExpandButton } from '../ui/ExpandButton';
|
|
|
17
18
|
import { buildExpandClassName, toDOM } from '../ui/NodeView';
|
|
18
19
|
import { findReplaceExpandDecorations } from '../utils';
|
|
19
20
|
export class ExpandNodeView {
|
|
20
|
-
constructor(_node, view, getPos, getIntl, isMobile, selectNearNode, api, nodeViewPortalProviderAPI, allowInteractiveExpand = true, __livePage = false, cleanUpEditorDisabledOnChange, isExpanded =
|
|
21
|
+
constructor(_node, view, getPos, getIntl, isMobile, selectNearNode, api, nodeViewPortalProviderAPI, allowInteractiveExpand = true, __livePage = false, cleanUpEditorDisabledOnChange, isExpanded = {
|
|
22
|
+
expanded: false
|
|
23
|
+
}) {
|
|
21
24
|
var _api$editorDisabled, _api$editorDisabled$s, _this$api6;
|
|
22
25
|
_defineProperty(this, "allowInteractiveExpand", true);
|
|
23
26
|
_defineProperty(this, "isMobile", false);
|
|
@@ -443,6 +446,11 @@ export class ExpandNodeView {
|
|
|
443
446
|
this.getPos = getPos;
|
|
444
447
|
this.view = view;
|
|
445
448
|
this.node = _node;
|
|
449
|
+
if (expValEquals('platform_editor_block_menu', 'isEnabled', true) && fg('platform_editor_block_menu_v2_patch_3')) {
|
|
450
|
+
var _expandedState$get;
|
|
451
|
+
this.isExpanded.expanded = (_expandedState$get = expandedState.get(_node)) !== null && _expandedState$get !== void 0 ? _expandedState$get : false;
|
|
452
|
+
this.isExpanded.localId = _node.attrs.localId;
|
|
453
|
+
}
|
|
446
454
|
const {
|
|
447
455
|
dom,
|
|
448
456
|
contentDOM
|
|
@@ -539,8 +547,10 @@ export class ExpandNodeView {
|
|
|
539
547
|
}
|
|
540
548
|
}
|
|
541
549
|
if (expValEquals('platform_editor_toggle_expand_on_match_found', 'isEnabled', true)) {
|
|
550
|
+
var _expandedState$get2;
|
|
542
551
|
this.node = node;
|
|
543
|
-
const
|
|
552
|
+
const currentExpanded = (_expandedState$get2 = expandedState.get(node)) !== null && _expandedState$get2 !== void 0 ? _expandedState$get2 : false;
|
|
553
|
+
const hasChanged = expValEquals('platform_editor_block_menu', 'isEnabled', true) && fg('platform_editor_block_menu_v2_patch_3') ? this.isExpanded.expanded !== currentExpanded && this.isExpanded.localId === node.attrs.localId : this.isExpanded.expanded !== currentExpanded;
|
|
544
554
|
if (hasChanged) {
|
|
545
555
|
this.updateExpandToggleIcon(node);
|
|
546
556
|
if (expValEquals('platform_editor_display_none_to_expand', 'isEnabled', true)) {
|
|
@@ -569,13 +579,18 @@ export class ExpandNodeView {
|
|
|
569
579
|
if (expValEquals('platform_editor_vc90_transition_fixes_batch_1', 'isEnabled', true)) {
|
|
570
580
|
this.renderNativeIcon(node);
|
|
571
581
|
} else {
|
|
572
|
-
var _expandedState$
|
|
573
|
-
this.renderIcon(this.icon ? this.icon : null, (_expandedState$
|
|
582
|
+
var _expandedState$get3;
|
|
583
|
+
this.renderIcon(this.icon ? this.icon : null, (_expandedState$get3 = expandedState.get(node)) !== null && _expandedState$get3 !== void 0 ? _expandedState$get3 : false);
|
|
574
584
|
}
|
|
575
585
|
}
|
|
576
586
|
this.updateExpandBodyContentEditable();
|
|
577
587
|
if (expValEquals('platform_editor_toggle_expand_on_match_found', 'isEnabled', true)) {
|
|
578
|
-
this.isExpanded =
|
|
588
|
+
this.isExpanded = expValEquals('platform_editor_block_menu', 'isEnabled', true) && fg('platform_editor_block_menu_v2_patch_3') ? {
|
|
589
|
+
expanded: expanded !== null && expanded !== void 0 ? expanded : false,
|
|
590
|
+
localId: node.attrs.localId
|
|
591
|
+
} : {
|
|
592
|
+
expanded: expanded !== null && expanded !== void 0 ? expanded : false
|
|
593
|
+
};
|
|
579
594
|
}
|
|
580
595
|
}
|
|
581
596
|
updateDisplayStyle(node) {
|
|
@@ -11,6 +11,7 @@ import { expandClassNames } from '@atlaskit/editor-common/styles';
|
|
|
11
11
|
import { closestElement, isEmptyNode } from '@atlaskit/editor-common/utils';
|
|
12
12
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
13
13
|
import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
14
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
15
|
import { redo, undo } from '@atlaskit/prosemirror-history';
|
|
15
16
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
16
17
|
import { renderExpandButton } from '../../ui/renderExpandButton';
|
|
@@ -26,7 +27,9 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
26
27
|
var allowInteractiveExpand = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : true;
|
|
27
28
|
var __livePage = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
|
|
28
29
|
var cleanUpEditorDisabledOnChange = arguments.length > 10 ? arguments[10] : undefined;
|
|
29
|
-
var isExpanded = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] :
|
|
30
|
+
var isExpanded = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : {
|
|
31
|
+
expanded: false
|
|
32
|
+
};
|
|
30
33
|
_classCallCheck(this, ExpandNodeView);
|
|
31
34
|
_defineProperty(this, "allowInteractiveExpand", true);
|
|
32
35
|
_defineProperty(this, "isMobile", false);
|
|
@@ -435,6 +438,11 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
435
438
|
this.getPos = getPos;
|
|
436
439
|
this.view = view;
|
|
437
440
|
this.node = _node;
|
|
441
|
+
if (expValEquals('platform_editor_block_menu', 'isEnabled', true) && fg('platform_editor_block_menu_v2_patch_3')) {
|
|
442
|
+
var _expandedState$get;
|
|
443
|
+
this.isExpanded.expanded = (_expandedState$get = expandedState.get(_node)) !== null && _expandedState$get !== void 0 ? _expandedState$get : false;
|
|
444
|
+
this.isExpanded.localId = _node.attrs.localId;
|
|
445
|
+
}
|
|
438
446
|
var _DOMSerializer$render = DOMSerializer.renderSpec(document, toDOM(_node, this.__livePage, this.intl, api === null || api === void 0 || (_api$editorDisabled = api.editorDisabled) === null || _api$editorDisabled === void 0 || (_api$editorDisabled = _api$editorDisabled.sharedState.currentState()) === null || _api$editorDisabled === void 0 ? void 0 : _api$editorDisabled.editorDisabled)),
|
|
439
447
|
dom = _DOMSerializer$render.dom,
|
|
440
448
|
contentDOM = _DOMSerializer$render.contentDOM;
|
|
@@ -537,8 +545,10 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
537
545
|
}
|
|
538
546
|
}
|
|
539
547
|
if (expValEquals('platform_editor_toggle_expand_on_match_found', 'isEnabled', true)) {
|
|
548
|
+
var _expandedState$get2;
|
|
540
549
|
this.node = node;
|
|
541
|
-
var
|
|
550
|
+
var currentExpanded = (_expandedState$get2 = expandedState.get(node)) !== null && _expandedState$get2 !== void 0 ? _expandedState$get2 : false;
|
|
551
|
+
var hasChanged = expValEquals('platform_editor_block_menu', 'isEnabled', true) && fg('platform_editor_block_menu_v2_patch_3') ? this.isExpanded.expanded !== currentExpanded && this.isExpanded.localId === node.attrs.localId : this.isExpanded.expanded !== currentExpanded;
|
|
542
552
|
if (hasChanged) {
|
|
543
553
|
this.updateExpandToggleIcon(node);
|
|
544
554
|
if (expValEquals('platform_editor_display_none_to_expand', 'isEnabled', true)) {
|
|
@@ -571,13 +581,18 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
571
581
|
if (expValEquals('platform_editor_vc90_transition_fixes_batch_1', 'isEnabled', true)) {
|
|
572
582
|
this.renderNativeIcon(node);
|
|
573
583
|
} else {
|
|
574
|
-
var _expandedState$
|
|
575
|
-
this.renderIcon(this.icon ? this.icon : null, (_expandedState$
|
|
584
|
+
var _expandedState$get3;
|
|
585
|
+
this.renderIcon(this.icon ? this.icon : null, (_expandedState$get3 = expandedState.get(node)) !== null && _expandedState$get3 !== void 0 ? _expandedState$get3 : false);
|
|
576
586
|
}
|
|
577
587
|
}
|
|
578
588
|
this.updateExpandBodyContentEditable();
|
|
579
589
|
if (expValEquals('platform_editor_toggle_expand_on_match_found', 'isEnabled', true)) {
|
|
580
|
-
this.isExpanded =
|
|
590
|
+
this.isExpanded = expValEquals('platform_editor_block_menu', 'isEnabled', true) && fg('platform_editor_block_menu_v2_patch_3') ? {
|
|
591
|
+
expanded: expanded !== null && expanded !== void 0 ? expanded : false,
|
|
592
|
+
localId: node.attrs.localId
|
|
593
|
+
} : {
|
|
594
|
+
expanded: expanded !== null && expanded !== void 0 ? expanded : false
|
|
595
|
+
};
|
|
581
596
|
}
|
|
582
597
|
}
|
|
583
598
|
}, {
|
|
@@ -26,7 +26,10 @@ export declare class ExpandNodeView implements NodeView {
|
|
|
26
26
|
nodeViewPortalProviderAPI: PortalProviderAPI;
|
|
27
27
|
decorationCleanup?: () => boolean | undefined;
|
|
28
28
|
renderKey: string;
|
|
29
|
-
constructor(node: PmNode, view: EditorView, getPos: getPosHandlerNode, getIntl: () => IntlShape, isMobile: boolean, selectNearNode: SetSelectionRelativeToNode | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, nodeViewPortalProviderAPI: PortalProviderAPI, allowInteractiveExpand?: boolean, __livePage?: boolean, cleanUpEditorDisabledOnChange?: (() => void) | undefined, isExpanded?:
|
|
29
|
+
constructor(node: PmNode, view: EditorView, getPos: getPosHandlerNode, getIntl: () => IntlShape, isMobile: boolean, selectNearNode: SetSelectionRelativeToNode | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, nodeViewPortalProviderAPI: PortalProviderAPI, allowInteractiveExpand?: boolean, __livePage?: boolean, cleanUpEditorDisabledOnChange?: (() => void) | undefined, isExpanded?: {
|
|
30
|
+
expanded: boolean;
|
|
31
|
+
localId?: string;
|
|
32
|
+
});
|
|
30
33
|
private focusTitle;
|
|
31
34
|
private handleIconKeyDown;
|
|
32
35
|
private handleClick;
|
|
@@ -26,7 +26,10 @@ export declare class ExpandNodeView implements NodeView {
|
|
|
26
26
|
nodeViewPortalProviderAPI: PortalProviderAPI;
|
|
27
27
|
decorationCleanup?: () => boolean | undefined;
|
|
28
28
|
renderKey: string;
|
|
29
|
-
constructor(node: PmNode, view: EditorView, getPos: getPosHandlerNode, getIntl: () => IntlShape, isMobile: boolean, selectNearNode: SetSelectionRelativeToNode | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, nodeViewPortalProviderAPI: PortalProviderAPI, allowInteractiveExpand?: boolean, __livePage?: boolean, cleanUpEditorDisabledOnChange?: (() => void) | undefined, isExpanded?:
|
|
29
|
+
constructor(node: PmNode, view: EditorView, getPos: getPosHandlerNode, getIntl: () => IntlShape, isMobile: boolean, selectNearNode: SetSelectionRelativeToNode | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, nodeViewPortalProviderAPI: PortalProviderAPI, allowInteractiveExpand?: boolean, __livePage?: boolean, cleanUpEditorDisabledOnChange?: (() => void) | undefined, isExpanded?: {
|
|
30
|
+
expanded: boolean;
|
|
31
|
+
localId?: string;
|
|
32
|
+
});
|
|
30
33
|
private focusTitle;
|
|
31
34
|
private handleIconKeyDown;
|
|
32
35
|
private handleClick;
|