@atlaskit/editor-plugin-breakout 1.1.1 → 1.1.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 +81 -26
- package/dist/cjs/commands/remove-breakout.js +3 -1
- package/dist/cjs/commands/set-breakout-mode.js +3 -1
- package/dist/cjs/plugin.js +3 -1
- package/dist/cjs/ui/LayoutButton.js +5 -4
- package/dist/cjs/utils/single-player-expand.js +17 -0
- package/dist/es2019/commands/remove-breakout.js +3 -1
- package/dist/es2019/commands/set-breakout-mode.js +3 -1
- package/dist/es2019/plugin.js +3 -1
- package/dist/es2019/ui/LayoutButton.js +5 -4
- package/dist/es2019/utils/single-player-expand.js +11 -0
- package/dist/esm/commands/remove-breakout.js +3 -1
- package/dist/esm/commands/set-breakout-mode.js +3 -1
- package/dist/esm/plugin.js +3 -1
- package/dist/esm/ui/LayoutButton.js +5 -4
- package/dist/esm/utils/single-player-expand.js +11 -0
- package/dist/types/commands/remove-breakout.d.ts +1 -1
- package/dist/types/commands/set-breakout-mode.d.ts +1 -1
- package/dist/types/ui/LayoutButton.d.ts +1 -0
- package/dist/types/utils/single-player-expand.d.ts +3 -0
- package/dist/types-ts4.5/commands/remove-breakout.d.ts +1 -1
- package/dist/types-ts4.5/commands/set-breakout-mode.d.ts +1 -1
- package/dist/types-ts4.5/ui/LayoutButton.d.ts +1 -0
- package/dist/types-ts4.5/utils/single-player-expand.d.ts +3 -0
- package/package.json +12 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,127 +1,182 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-breakout
|
|
2
2
|
|
|
3
|
+
## 1.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#96237](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/96237)
|
|
8
|
+
[`0401e7b5a88e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0401e7b5a88e) -
|
|
9
|
+
[ED-23102] Bump ADF schema to version 35.12.2
|
|
10
|
+
|
|
11
|
+
## 1.1.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#94901](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/94901)
|
|
16
|
+
[`da964fcdc828`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/da964fcdc828) -
|
|
17
|
+
[ED-23097] Bump ADF schema to version 35.12.1
|
|
18
|
+
- [#94398](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/94398)
|
|
19
|
+
[`4df808e35fda`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4df808e35fda) -
|
|
20
|
+
[ux] [ED-23108] Solve bug where single player expands would lose their expanded state when
|
|
21
|
+
adding breakout marks. Single player expands are only used when
|
|
22
|
+
`platform.editor.single-player-expand` FF AND live page are both enabled.
|
|
23
|
+
|
|
3
24
|
## 1.1.1
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
6
27
|
|
|
7
|
-
-
|
|
28
|
+
- [#93689](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/93689)
|
|
29
|
+
[`5ba5d2b4a9ac`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5ba5d2b4a9ac) -
|
|
30
|
+
Updating adf-schema version to 35.10.0
|
|
8
31
|
|
|
9
32
|
## 1.1.0
|
|
10
33
|
|
|
11
34
|
### Minor Changes
|
|
12
35
|
|
|
13
|
-
-
|
|
36
|
+
- [#91934](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91934)
|
|
37
|
+
[`b76a78c6a199`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b76a78c6a199) -
|
|
38
|
+
bumped editor-prosemirror version to 4.0.0
|
|
14
39
|
|
|
15
40
|
### Patch Changes
|
|
16
41
|
|
|
17
|
-
-
|
|
42
|
+
- Updated dependencies
|
|
18
43
|
|
|
19
44
|
## 1.0.9
|
|
20
45
|
|
|
21
46
|
### Patch Changes
|
|
22
47
|
|
|
23
|
-
-
|
|
48
|
+
- [#92426](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/92426)
|
|
49
|
+
[`32c76c7c225c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/32c76c7c225c) -
|
|
50
|
+
Bump adf-schema to 35.9.2 to support table alignment options
|
|
24
51
|
|
|
25
52
|
## 1.0.8
|
|
26
53
|
|
|
27
54
|
### Patch Changes
|
|
28
55
|
|
|
29
|
-
-
|
|
30
|
-
-
|
|
56
|
+
- [#91106](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91106)
|
|
57
|
+
[`b6ffa30186b9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b6ffa30186b9) -
|
|
58
|
+
Bump ADF-schema package to version 35.0.0
|
|
59
|
+
- Updated dependencies
|
|
31
60
|
|
|
32
61
|
## 1.0.7
|
|
33
62
|
|
|
34
63
|
### Patch Changes
|
|
35
64
|
|
|
36
|
-
-
|
|
37
|
-
-
|
|
65
|
+
- [#88938](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/88938)
|
|
66
|
+
[`db547827ee45`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/db547827ee45) -
|
|
67
|
+
[ux] Don't render LayoutButton when editor in 'view' mode
|
|
68
|
+
- Updated dependencies
|
|
38
69
|
|
|
39
70
|
## 1.0.6
|
|
40
71
|
|
|
41
72
|
### Patch Changes
|
|
42
73
|
|
|
43
|
-
-
|
|
74
|
+
- [#86724](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/86724)
|
|
75
|
+
[`718a9aa2424d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/718a9aa2424d) -
|
|
76
|
+
[ED-22607] Remove references to maxFrames for multi bodied extensions and bump adf-schema from
|
|
77
|
+
35.7.0 to 35.8.0
|
|
44
78
|
|
|
45
79
|
## 1.0.5
|
|
46
80
|
|
|
47
81
|
### Patch Changes
|
|
48
82
|
|
|
49
|
-
-
|
|
83
|
+
- [#81777](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/81777)
|
|
84
|
+
[`c6d7a5378751`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c6d7a5378751) -
|
|
85
|
+
Bump adf-schema to 35.7.0
|
|
50
86
|
|
|
51
87
|
## 1.0.4
|
|
52
88
|
|
|
53
89
|
### Patch Changes
|
|
54
90
|
|
|
55
|
-
-
|
|
91
|
+
- [#83116](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83116)
|
|
92
|
+
[`8d4e99057fe0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8d4e99057fe0) -
|
|
93
|
+
Upgrade Typescript from `4.9.5` to `5.4.2`
|
|
56
94
|
|
|
57
95
|
## 1.0.3
|
|
58
96
|
|
|
59
97
|
### Patch Changes
|
|
60
98
|
|
|
61
|
-
-
|
|
99
|
+
- [#80679](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80679)
|
|
100
|
+
[`104eb9443b7e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/104eb9443b7e) -
|
|
101
|
+
ED-22553 Updating adf-schema version to 35.6.0
|
|
62
102
|
|
|
63
103
|
## 1.0.2
|
|
64
104
|
|
|
65
105
|
### Patch Changes
|
|
66
106
|
|
|
67
|
-
-
|
|
68
|
-
-
|
|
107
|
+
- [#78224](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/78224)
|
|
108
|
+
[`6b4c9dd4ad34`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6b4c9dd4ad34) -
|
|
109
|
+
ED-22219: adf-schema updated to 35.5.2
|
|
110
|
+
- Updated dependencies
|
|
69
111
|
|
|
70
112
|
## 1.0.1
|
|
71
113
|
|
|
72
114
|
### Patch Changes
|
|
73
115
|
|
|
74
|
-
-
|
|
116
|
+
- Updated dependencies
|
|
75
117
|
|
|
76
118
|
## 1.0.0
|
|
77
119
|
|
|
78
120
|
### Major Changes
|
|
79
121
|
|
|
80
|
-
-
|
|
122
|
+
- [#72386](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/72386)
|
|
123
|
+
[`0c52b0be40c1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0c52b0be40c1) -
|
|
124
|
+
This changeset exists to bump all editor plugins that currently don't have a major version. This
|
|
125
|
+
is to address an issue with Jira plugin consumption.
|
|
81
126
|
|
|
82
127
|
### Patch Changes
|
|
83
128
|
|
|
84
|
-
-
|
|
129
|
+
- Updated dependencies
|
|
85
130
|
|
|
86
131
|
## 0.2.2
|
|
87
132
|
|
|
88
133
|
### Patch Changes
|
|
89
134
|
|
|
90
|
-
-
|
|
135
|
+
- [#68572](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68572)
|
|
136
|
+
[`15d407fe5143`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/15d407fe5143) -
|
|
137
|
+
Upgrading @atlaskit/editor-prosemirror dependency
|
|
91
138
|
|
|
92
139
|
## 0.2.1
|
|
93
140
|
|
|
94
141
|
### Patch Changes
|
|
95
142
|
|
|
96
|
-
-
|
|
143
|
+
- [#70152](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/70152)
|
|
144
|
+
[`53ed3673df28`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/53ed3673df28) -
|
|
145
|
+
Updating adf-schema version to 35.5.1
|
|
97
146
|
|
|
98
147
|
## 0.2.0
|
|
99
148
|
|
|
100
149
|
### Minor Changes
|
|
101
150
|
|
|
102
|
-
-
|
|
151
|
+
- [#68790](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68790)
|
|
152
|
+
[`c6d8affc52d1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c6d8affc52d1) -
|
|
153
|
+
Support maybeAdd plugins in usePreset. Add typing support for universal preset.
|
|
103
154
|
|
|
104
|
-
|
|
155
|
+
Now when using the editor API with the universal preset
|
|
105
156
|
|
|
106
157
|
### Patch Changes
|
|
107
158
|
|
|
108
|
-
-
|
|
159
|
+
- Updated dependencies
|
|
109
160
|
|
|
110
161
|
## 0.1.3
|
|
111
162
|
|
|
112
163
|
### Patch Changes
|
|
113
164
|
|
|
114
|
-
-
|
|
165
|
+
- Updated dependencies
|
|
115
166
|
|
|
116
167
|
## 0.1.2
|
|
117
168
|
|
|
118
169
|
### Patch Changes
|
|
119
170
|
|
|
120
|
-
-
|
|
171
|
+
- [#67238](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/67238)
|
|
172
|
+
[`40533849b2ec`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/40533849b2ec) -
|
|
173
|
+
[ED-21835] Change EditorAPI type to always union with undefined
|
|
121
174
|
|
|
122
175
|
## 0.1.1
|
|
123
176
|
|
|
124
177
|
### Patch Changes
|
|
125
178
|
|
|
126
|
-
-
|
|
127
|
-
-
|
|
179
|
+
- [#65031](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/65031)
|
|
180
|
+
[`a00094111b5a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a00094111b5a) -
|
|
181
|
+
ED-21609 Update adf-schema to 35.3.0
|
|
182
|
+
- Updated dependencies
|
|
@@ -6,7 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.removeBreakout = removeBreakout;
|
|
7
7
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
8
8
|
var _findBreakoutNode = require("../utils/find-breakout-node");
|
|
9
|
-
|
|
9
|
+
var _singlePlayerExpand = require("../utils/single-player-expand");
|
|
10
|
+
function removeBreakout(isLivePage) {
|
|
10
11
|
return function (state, dispatch) {
|
|
11
12
|
var node = (0, _findBreakoutNode.findSupportedNodeForBreakout)(state.selection);
|
|
12
13
|
if (!node) {
|
|
@@ -16,6 +17,7 @@ function removeBreakout() {
|
|
|
16
17
|
return m.type.name !== 'breakout';
|
|
17
18
|
});
|
|
18
19
|
var tr = state.tr.setNodeMarkup(node.pos, node.node.type, node.node.attrs, marks);
|
|
20
|
+
(0, _singlePlayerExpand.updateExpandedState)(tr, node, isLivePage);
|
|
19
21
|
tr.setMeta('scrollIntoView', false);
|
|
20
22
|
if (state.selection instanceof _state.NodeSelection) {
|
|
21
23
|
if (state.selection.$anchor.pos === node.pos) {
|
|
@@ -6,7 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.setBreakoutMode = setBreakoutMode;
|
|
7
7
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
8
8
|
var _findBreakoutNode = require("../utils/find-breakout-node");
|
|
9
|
-
|
|
9
|
+
var _singlePlayerExpand = require("../utils/single-player-expand");
|
|
10
|
+
function setBreakoutMode(mode, isLivePage) {
|
|
10
11
|
return function (state, dispatch) {
|
|
11
12
|
var node = (0, _findBreakoutNode.findSupportedNodeForBreakout)(state.selection);
|
|
12
13
|
if (!node) {
|
|
@@ -15,6 +16,7 @@ function setBreakoutMode(mode) {
|
|
|
15
16
|
var tr = state.tr.setNodeMarkup(node.pos, node.node.type, node.node.attrs, [state.schema.marks.breakout.create({
|
|
16
17
|
mode: mode
|
|
17
18
|
})]);
|
|
19
|
+
(0, _singlePlayerExpand.updateExpandedState)(tr, node, isLivePage);
|
|
18
20
|
tr.setMeta('scrollIntoView', false);
|
|
19
21
|
if (state.selection instanceof _state.NodeSelection) {
|
|
20
22
|
if (state.selection.$anchor.pos === node.pos) {
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -160,12 +160,14 @@ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref3) {
|
|
|
160
160
|
breakoutState = _useSharedPluginState.breakoutState,
|
|
161
161
|
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
162
162
|
var isViewMode = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
|
|
163
|
+
var isEditMode = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'edit';
|
|
163
164
|
return !isViewMode ? /*#__PURE__*/_react.default.createElement(_LayoutButton.default, {
|
|
164
165
|
editorView: editorView,
|
|
165
166
|
mountPoint: mountPoint,
|
|
166
167
|
boundariesElement: boundariesElement,
|
|
167
168
|
scrollableElement: scrollableElement,
|
|
168
|
-
node: (_breakoutState$breako = breakoutState === null || breakoutState === void 0 || (_breakoutState$breako2 = breakoutState.breakoutNode) === null || _breakoutState$breako2 === void 0 ? void 0 : _breakoutState$breako2.node) !== null && _breakoutState$breako !== void 0 ? _breakoutState$breako : null
|
|
169
|
+
node: (_breakoutState$breako = breakoutState === null || breakoutState === void 0 || (_breakoutState$breako2 = breakoutState.breakoutNode) === null || _breakoutState$breako2 === void 0 ? void 0 : _breakoutState$breako2.node) !== null && _breakoutState$breako !== void 0 ? _breakoutState$breako : null,
|
|
170
|
+
isLivePage: isEditMode
|
|
169
171
|
}) : null;
|
|
170
172
|
};
|
|
171
173
|
var breakoutPlugin = exports.breakoutPlugin = function breakoutPlugin(_ref4) {
|
|
@@ -52,16 +52,17 @@ var LayoutButton = function LayoutButton(_ref) {
|
|
|
52
52
|
boundariesElement = _ref.boundariesElement,
|
|
53
53
|
scrollableElement = _ref.scrollableElement,
|
|
54
54
|
editorView = _ref.editorView,
|
|
55
|
-
node = _ref.node
|
|
55
|
+
node = _ref.node,
|
|
56
|
+
isLivePage = _ref.isLivePage;
|
|
56
57
|
var handleClick = (0, _react.useCallback)(function (breakoutMode) {
|
|
57
58
|
var state = editorView.state,
|
|
58
59
|
dispatch = editorView.dispatch;
|
|
59
60
|
if (['wide', 'full-width'].indexOf(breakoutMode) !== -1) {
|
|
60
|
-
(0, _setBreakoutMode.setBreakoutMode)(breakoutMode)(state, dispatch);
|
|
61
|
+
(0, _setBreakoutMode.setBreakoutMode)(breakoutMode, isLivePage)(state, dispatch);
|
|
61
62
|
} else {
|
|
62
|
-
(0, _removeBreakout.removeBreakout)()(state, dispatch);
|
|
63
|
+
(0, _removeBreakout.removeBreakout)(isLivePage)(state, dispatch);
|
|
63
64
|
}
|
|
64
|
-
}, [editorView]);
|
|
65
|
+
}, [editorView, isLivePage]);
|
|
65
66
|
var state = editorView.state;
|
|
66
67
|
if (!node || !(0, _isBreakoutMarkAllowed.isBreakoutMarkAllowed)(state)) {
|
|
67
68
|
return null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.updateExpandedState = void 0;
|
|
7
|
+
var _expand = require("@atlaskit/editor-common/expand");
|
|
8
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
|
+
var updateExpandedState = exports.updateExpandedState = function updateExpandedState(tr, node, isLivePage) {
|
|
10
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.single-player-expand') && isLivePage) {
|
|
11
|
+
var wasExpandExpanded = _expand.expandedState.get(node.node);
|
|
12
|
+
var newExpand = tr.doc.nodeAt(node.pos);
|
|
13
|
+
if (wasExpandExpanded !== undefined && newExpand) {
|
|
14
|
+
_expand.expandedState.set(newExpand, wasExpandExpanded);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { findSupportedNodeForBreakout } from '../utils/find-breakout-node';
|
|
3
|
-
|
|
3
|
+
import { updateExpandedState } from '../utils/single-player-expand';
|
|
4
|
+
export function removeBreakout(isLivePage) {
|
|
4
5
|
return (state, dispatch) => {
|
|
5
6
|
const node = findSupportedNodeForBreakout(state.selection);
|
|
6
7
|
if (!node) {
|
|
@@ -8,6 +9,7 @@ export function removeBreakout() {
|
|
|
8
9
|
}
|
|
9
10
|
const marks = node.node.marks.filter(m => m.type.name !== 'breakout');
|
|
10
11
|
const tr = state.tr.setNodeMarkup(node.pos, node.node.type, node.node.attrs, marks);
|
|
12
|
+
updateExpandedState(tr, node, isLivePage);
|
|
11
13
|
tr.setMeta('scrollIntoView', false);
|
|
12
14
|
if (state.selection instanceof NodeSelection) {
|
|
13
15
|
if (state.selection.$anchor.pos === node.pos) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { findSupportedNodeForBreakout } from '../utils/find-breakout-node';
|
|
3
|
-
|
|
3
|
+
import { updateExpandedState } from '../utils/single-player-expand';
|
|
4
|
+
export function setBreakoutMode(mode, isLivePage) {
|
|
4
5
|
return (state, dispatch) => {
|
|
5
6
|
const node = findSupportedNodeForBreakout(state.selection);
|
|
6
7
|
if (!node) {
|
|
@@ -9,6 +10,7 @@ export function setBreakoutMode(mode) {
|
|
|
9
10
|
const tr = state.tr.setNodeMarkup(node.pos, node.node.type, node.node.attrs, [state.schema.marks.breakout.create({
|
|
10
11
|
mode
|
|
11
12
|
})]);
|
|
13
|
+
updateExpandedState(tr, node, isLivePage);
|
|
12
14
|
tr.setMeta('scrollIntoView', false);
|
|
13
15
|
if (state.selection instanceof NodeSelection) {
|
|
14
16
|
if (state.selection.$anchor.pos === node.pos) {
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -151,12 +151,14 @@ const LayoutButtonWrapper = ({
|
|
|
151
151
|
editorViewModeState
|
|
152
152
|
} = useSharedPluginState(api, ['width', 'breakout', 'editorViewMode']);
|
|
153
153
|
const isViewMode = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
|
|
154
|
+
const isEditMode = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'edit';
|
|
154
155
|
return !isViewMode ? /*#__PURE__*/React.createElement(LayoutButton, {
|
|
155
156
|
editorView: editorView,
|
|
156
157
|
mountPoint: mountPoint,
|
|
157
158
|
boundariesElement: boundariesElement,
|
|
158
159
|
scrollableElement: scrollableElement,
|
|
159
|
-
node: (_breakoutState$breako = breakoutState === null || breakoutState === void 0 ? void 0 : (_breakoutState$breako2 = breakoutState.breakoutNode) === null || _breakoutState$breako2 === void 0 ? void 0 : _breakoutState$breako2.node) !== null && _breakoutState$breako !== void 0 ? _breakoutState$breako : null
|
|
160
|
+
node: (_breakoutState$breako = breakoutState === null || breakoutState === void 0 ? void 0 : (_breakoutState$breako2 = breakoutState.breakoutNode) === null || _breakoutState$breako2 === void 0 ? void 0 : _breakoutState$breako2.node) !== null && _breakoutState$breako !== void 0 ? _breakoutState$breako : null,
|
|
161
|
+
isLivePage: isEditMode
|
|
160
162
|
}) : null;
|
|
161
163
|
};
|
|
162
164
|
export const breakoutPlugin = ({
|
|
@@ -46,7 +46,8 @@ const LayoutButton = ({
|
|
|
46
46
|
boundariesElement,
|
|
47
47
|
scrollableElement,
|
|
48
48
|
editorView,
|
|
49
|
-
node
|
|
49
|
+
node,
|
|
50
|
+
isLivePage
|
|
50
51
|
}) => {
|
|
51
52
|
const handleClick = useCallback(breakoutMode => {
|
|
52
53
|
const {
|
|
@@ -54,11 +55,11 @@ const LayoutButton = ({
|
|
|
54
55
|
dispatch
|
|
55
56
|
} = editorView;
|
|
56
57
|
if (['wide', 'full-width'].indexOf(breakoutMode) !== -1) {
|
|
57
|
-
setBreakoutMode(breakoutMode)(state, dispatch);
|
|
58
|
+
setBreakoutMode(breakoutMode, isLivePage)(state, dispatch);
|
|
58
59
|
} else {
|
|
59
|
-
removeBreakout()(state, dispatch);
|
|
60
|
+
removeBreakout(isLivePage)(state, dispatch);
|
|
60
61
|
}
|
|
61
|
-
}, [editorView]);
|
|
62
|
+
}, [editorView, isLivePage]);
|
|
62
63
|
const {
|
|
63
64
|
state
|
|
64
65
|
} = editorView;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { expandedState } from '@atlaskit/editor-common/expand';
|
|
2
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
export const updateExpandedState = (tr, node, isLivePage) => {
|
|
4
|
+
if (getBooleanFF('platform.editor.single-player-expand') && isLivePage) {
|
|
5
|
+
const wasExpandExpanded = expandedState.get(node.node);
|
|
6
|
+
const newExpand = tr.doc.nodeAt(node.pos);
|
|
7
|
+
if (wasExpandExpanded !== undefined && newExpand) {
|
|
8
|
+
expandedState.set(newExpand, wasExpandExpanded);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { findSupportedNodeForBreakout } from '../utils/find-breakout-node';
|
|
3
|
-
|
|
3
|
+
import { updateExpandedState } from '../utils/single-player-expand';
|
|
4
|
+
export function removeBreakout(isLivePage) {
|
|
4
5
|
return function (state, dispatch) {
|
|
5
6
|
var node = findSupportedNodeForBreakout(state.selection);
|
|
6
7
|
if (!node) {
|
|
@@ -10,6 +11,7 @@ export function removeBreakout() {
|
|
|
10
11
|
return m.type.name !== 'breakout';
|
|
11
12
|
});
|
|
12
13
|
var tr = state.tr.setNodeMarkup(node.pos, node.node.type, node.node.attrs, marks);
|
|
14
|
+
updateExpandedState(tr, node, isLivePage);
|
|
13
15
|
tr.setMeta('scrollIntoView', false);
|
|
14
16
|
if (state.selection instanceof NodeSelection) {
|
|
15
17
|
if (state.selection.$anchor.pos === node.pos) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { findSupportedNodeForBreakout } from '../utils/find-breakout-node';
|
|
3
|
-
|
|
3
|
+
import { updateExpandedState } from '../utils/single-player-expand';
|
|
4
|
+
export function setBreakoutMode(mode, isLivePage) {
|
|
4
5
|
return function (state, dispatch) {
|
|
5
6
|
var node = findSupportedNodeForBreakout(state.selection);
|
|
6
7
|
if (!node) {
|
|
@@ -9,6 +10,7 @@ export function setBreakoutMode(mode) {
|
|
|
9
10
|
var tr = state.tr.setNodeMarkup(node.pos, node.node.type, node.node.attrs, [state.schema.marks.breakout.create({
|
|
10
11
|
mode: mode
|
|
11
12
|
})]);
|
|
13
|
+
updateExpandedState(tr, node, isLivePage);
|
|
12
14
|
tr.setMeta('scrollIntoView', false);
|
|
13
15
|
if (state.selection instanceof NodeSelection) {
|
|
14
16
|
if (state.selection.$anchor.pos === node.pos) {
|
package/dist/esm/plugin.js
CHANGED
|
@@ -153,12 +153,14 @@ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref3) {
|
|
|
153
153
|
breakoutState = _useSharedPluginState.breakoutState,
|
|
154
154
|
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
155
155
|
var isViewMode = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
|
|
156
|
+
var isEditMode = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'edit';
|
|
156
157
|
return !isViewMode ? /*#__PURE__*/React.createElement(LayoutButton, {
|
|
157
158
|
editorView: editorView,
|
|
158
159
|
mountPoint: mountPoint,
|
|
159
160
|
boundariesElement: boundariesElement,
|
|
160
161
|
scrollableElement: scrollableElement,
|
|
161
|
-
node: (_breakoutState$breako = breakoutState === null || breakoutState === void 0 || (_breakoutState$breako2 = breakoutState.breakoutNode) === null || _breakoutState$breako2 === void 0 ? void 0 : _breakoutState$breako2.node) !== null && _breakoutState$breako !== void 0 ? _breakoutState$breako : null
|
|
162
|
+
node: (_breakoutState$breako = breakoutState === null || breakoutState === void 0 || (_breakoutState$breako2 = breakoutState.breakoutNode) === null || _breakoutState$breako2 === void 0 ? void 0 : _breakoutState$breako2.node) !== null && _breakoutState$breako !== void 0 ? _breakoutState$breako : null,
|
|
163
|
+
isLivePage: isEditMode
|
|
162
164
|
}) : null;
|
|
163
165
|
};
|
|
164
166
|
export var breakoutPlugin = function breakoutPlugin(_ref4) {
|
|
@@ -44,16 +44,17 @@ var LayoutButton = function LayoutButton(_ref) {
|
|
|
44
44
|
boundariesElement = _ref.boundariesElement,
|
|
45
45
|
scrollableElement = _ref.scrollableElement,
|
|
46
46
|
editorView = _ref.editorView,
|
|
47
|
-
node = _ref.node
|
|
47
|
+
node = _ref.node,
|
|
48
|
+
isLivePage = _ref.isLivePage;
|
|
48
49
|
var handleClick = useCallback(function (breakoutMode) {
|
|
49
50
|
var state = editorView.state,
|
|
50
51
|
dispatch = editorView.dispatch;
|
|
51
52
|
if (['wide', 'full-width'].indexOf(breakoutMode) !== -1) {
|
|
52
|
-
setBreakoutMode(breakoutMode)(state, dispatch);
|
|
53
|
+
setBreakoutMode(breakoutMode, isLivePage)(state, dispatch);
|
|
53
54
|
} else {
|
|
54
|
-
removeBreakout()(state, dispatch);
|
|
55
|
+
removeBreakout(isLivePage)(state, dispatch);
|
|
55
56
|
}
|
|
56
|
-
}, [editorView]);
|
|
57
|
+
}, [editorView, isLivePage]);
|
|
57
58
|
var state = editorView.state;
|
|
58
59
|
if (!node || !isBreakoutMarkAllowed(state)) {
|
|
59
60
|
return null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { expandedState } from '@atlaskit/editor-common/expand';
|
|
2
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
export var updateExpandedState = function updateExpandedState(tr, node, isLivePage) {
|
|
4
|
+
if (getBooleanFF('platform.editor.single-player-expand') && isLivePage) {
|
|
5
|
+
var wasExpandExpanded = expandedState.get(node.node);
|
|
6
|
+
var newExpand = tr.doc.nodeAt(node.pos);
|
|
7
|
+
if (wasExpandExpanded !== undefined && newExpand) {
|
|
8
|
+
expandedState.set(newExpand, wasExpandExpanded);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
2
|
-
export declare function removeBreakout(): Command;
|
|
2
|
+
export declare function removeBreakout(isLivePage?: boolean): Command;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { BreakoutMode, Command } from '@atlaskit/editor-common/types';
|
|
2
|
-
export declare function setBreakoutMode(mode: BreakoutMode): Command;
|
|
2
|
+
export declare function setBreakoutMode(mode: BreakoutMode, isLivePage?: boolean): Command;
|
|
@@ -9,6 +9,7 @@ export interface Props {
|
|
|
9
9
|
boundariesElement?: HTMLElement;
|
|
10
10
|
scrollableElement?: HTMLElement;
|
|
11
11
|
handleClick?: Function;
|
|
12
|
+
isLivePage?: boolean;
|
|
12
13
|
}
|
|
13
14
|
declare const _default: import("react").FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps>> & {
|
|
14
15
|
WrappedComponent: import("react").ComponentType<Props & WrappedComponentProps>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/dist/types/state';
|
|
2
|
+
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/dist/types/utils';
|
|
3
|
+
export declare const updateExpandedState: (tr: Transaction, node: ContentNodeWithPos, isLivePage?: boolean) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
2
|
-
export declare function removeBreakout(): Command;
|
|
2
|
+
export declare function removeBreakout(isLivePage?: boolean): Command;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { BreakoutMode, Command } from '@atlaskit/editor-common/types';
|
|
2
|
-
export declare function setBreakoutMode(mode: BreakoutMode): Command;
|
|
2
|
+
export declare function setBreakoutMode(mode: BreakoutMode, isLivePage?: boolean): Command;
|
|
@@ -9,6 +9,7 @@ export interface Props {
|
|
|
9
9
|
boundariesElement?: HTMLElement;
|
|
10
10
|
scrollableElement?: HTMLElement;
|
|
11
11
|
handleClick?: Function;
|
|
12
|
+
isLivePage?: boolean;
|
|
12
13
|
}
|
|
13
14
|
declare const _default: import("react").FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps>> & {
|
|
14
15
|
WrappedComponent: import("react").ComponentType<Props & WrappedComponentProps>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/dist/types/state';
|
|
2
|
+
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/dist/types/utils';
|
|
3
|
+
export declare const updateExpandedState: (tr: Transaction, node: ContentNodeWithPos, isLivePage?: boolean) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-breakout",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Breakout plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,15 +31,16 @@
|
|
|
31
31
|
".": "./src/index.ts"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@atlaskit/adf-schema": "^35.
|
|
35
|
-
"@atlaskit/editor-common": "^78.
|
|
34
|
+
"@atlaskit/adf-schema": "^35.12.2",
|
|
35
|
+
"@atlaskit/editor-common": "^78.37.0",
|
|
36
36
|
"@atlaskit/editor-plugin-editor-viewmode": "^1.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-width": "^1.1.0",
|
|
38
38
|
"@atlaskit/editor-prosemirror": "4.0.0",
|
|
39
|
-
"@atlaskit/editor-shared-styles": "^2.
|
|
39
|
+
"@atlaskit/editor-shared-styles": "^2.10.0",
|
|
40
40
|
"@atlaskit/icon": "^22.1.0",
|
|
41
|
+
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
41
42
|
"@atlaskit/theme": "^12.7.0",
|
|
42
|
-
"@atlaskit/tokens": "^1.
|
|
43
|
+
"@atlaskit/tokens": "^1.45.0",
|
|
43
44
|
"@babel/runtime": "^7.0.0",
|
|
44
45
|
"@emotion/react": "^11.7.1"
|
|
45
46
|
},
|
|
@@ -94,5 +95,10 @@
|
|
|
94
95
|
]
|
|
95
96
|
}
|
|
96
97
|
},
|
|
97
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
98
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0",
|
|
99
|
+
"platform-feature-flags": {
|
|
100
|
+
"platform.editor.single-player-expand": {
|
|
101
|
+
"type": "boolean"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
98
104
|
}
|