@atlaskit/editor-plugin-layout 2.7.2 → 2.7.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 +22 -0
- package/dist/cjs/nodeviews/index.js +63 -4
- package/dist/cjs/ui/toolbar.js +5 -0
- package/dist/es2019/nodeviews/index.js +65 -5
- package/dist/es2019/ui/toolbar.js +5 -0
- package/dist/esm/nodeviews/index.js +64 -5
- package/dist/esm/ui/toolbar.js +5 -0
- package/dist/types/nodeviews/index.d.ts +39 -0
- package/dist/types-ts4.5/nodeviews/index.d.ts +39 -0
- package/package.json +9 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-layout
|
|
2
2
|
|
|
3
|
+
## 2.7.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#158601](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/158601)
|
|
8
|
+
[`7dfac59b4421f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7dfac59b4421f) -
|
|
9
|
+
ED-27401: Updated layout guidelines
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 2.7.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#153256](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/153256)
|
|
17
|
+
[`3644fbe36073d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3644fbe36073d) -
|
|
18
|
+
[ux] When ViewAll dropdown closes via ESC key press or submenus close via ESC or Enter, the focus
|
|
19
|
+
is set on ViewAll button.
|
|
20
|
+
- [#152768](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/152768)
|
|
21
|
+
[`2e80bc703b181`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2e80bc703b181) -
|
|
22
|
+
[ED-27555] Migrate to useSharedPluginStateSelector for insert-block, layout, loom plugins
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
3
25
|
## 2.7.2
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -15,6 +15,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
15
15
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
16
16
|
var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
|
|
17
17
|
var _resizer = require("@atlaskit/editor-common/resizer");
|
|
18
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
18
19
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
19
20
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
20
21
|
var _utils = require("../pm-plugins/utils");
|
|
@@ -22,6 +23,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
22
23
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
24
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
24
25
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
26
|
+
var layoutDynamicFullWidthGuidelineOffset = 16;
|
|
25
27
|
var isEmptyParagraph = function isEmptyParagraph(node) {
|
|
26
28
|
return !!node && node.type.name === 'paragraph' && !node.childCount;
|
|
27
29
|
};
|
|
@@ -46,6 +48,18 @@ var isEmptyLayout = function isEmptyLayout(node) {
|
|
|
46
48
|
});
|
|
47
49
|
return isEmpty;
|
|
48
50
|
};
|
|
51
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
52
|
+
var editorDisabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorDisabled.editorDisabled');
|
|
53
|
+
return {
|
|
54
|
+
editorDisabled: editorDisabled
|
|
55
|
+
};
|
|
56
|
+
}, function (api) {
|
|
57
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['editorDisabled']),
|
|
58
|
+
editorDisabledState = _useSharedPluginState.editorDisabledState;
|
|
59
|
+
return {
|
|
60
|
+
editorDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled
|
|
61
|
+
};
|
|
62
|
+
});
|
|
49
63
|
var LayoutBreakoutResizer = function LayoutBreakoutResizer(_ref) {
|
|
50
64
|
var _pluginInjectionApi$a;
|
|
51
65
|
var pluginInjectionApi = _ref.pluginInjectionApi,
|
|
@@ -53,8 +67,8 @@ var LayoutBreakoutResizer = function LayoutBreakoutResizer(_ref) {
|
|
|
53
67
|
getPos = _ref.getPos,
|
|
54
68
|
view = _ref.view,
|
|
55
69
|
parentRef = _ref.parentRef;
|
|
56
|
-
var
|
|
57
|
-
|
|
70
|
+
var _useSharedState = useSharedState(pluginInjectionApi),
|
|
71
|
+
editorDisabled = _useSharedState.editorDisabled;
|
|
58
72
|
var getEditorWidth = function getEditorWidth() {
|
|
59
73
|
var _pluginInjectionApi$w;
|
|
60
74
|
return pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$w = pluginInjectionApi.width) === null || _pluginInjectionApi$w === void 0 ? void 0 : _pluginInjectionApi$w.sharedState.currentState();
|
|
@@ -86,14 +100,15 @@ var LayoutBreakoutResizer = function LayoutBreakoutResizer(_ref) {
|
|
|
86
100
|
editorView: view,
|
|
87
101
|
nodeType: "layoutSection",
|
|
88
102
|
getEditorWidth: getEditorWidth,
|
|
89
|
-
disabled:
|
|
103
|
+
disabled: editorDisabled === true || !isBreakoutAvailable(view.state.schema),
|
|
90
104
|
parentRef: parentRef,
|
|
91
105
|
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
|
|
92
106
|
displayGuidelines: (0, _experiments.editorExperiment)('single_column_layouts', true) ? displayGuidelines : undefined,
|
|
93
107
|
displayGapCursor: displayGapCursor,
|
|
94
108
|
onResizeStart: function onResizeStart() {
|
|
95
109
|
selectIntoCurrentLayout();
|
|
96
|
-
}
|
|
110
|
+
},
|
|
111
|
+
dynamicFullWidthGuidelineOffset: layoutDynamicFullWidthGuidelineOffset
|
|
97
112
|
});
|
|
98
113
|
};
|
|
99
114
|
var toDOM = function toDOM() {
|
|
@@ -103,7 +118,23 @@ var toDOM = function toDOM() {
|
|
|
103
118
|
'data-layout-section': true
|
|
104
119
|
}, 0]];
|
|
105
120
|
};
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
*
|
|
124
|
+
*/
|
|
106
125
|
var LayoutSectionView = exports.LayoutSectionView = /*#__PURE__*/function (_ReactNodeView) {
|
|
126
|
+
/**
|
|
127
|
+
* constructor
|
|
128
|
+
* @param props
|
|
129
|
+
* @param props.node
|
|
130
|
+
* @param props.view
|
|
131
|
+
* @param props.getPos
|
|
132
|
+
* @param props.portalProviderAPI
|
|
133
|
+
* @param props.eventDispatcher
|
|
134
|
+
* @param props.pluginInjectionApi
|
|
135
|
+
* @param props.options
|
|
136
|
+
* @example
|
|
137
|
+
*/
|
|
107
138
|
function LayoutSectionView(props) {
|
|
108
139
|
var _this;
|
|
109
140
|
(0, _classCallCheck2.default)(this, LayoutSectionView);
|
|
@@ -112,6 +143,12 @@ var LayoutSectionView = exports.LayoutSectionView = /*#__PURE__*/function (_Reac
|
|
|
112
143
|
_this.options = props.options;
|
|
113
144
|
return _this;
|
|
114
145
|
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* getContentDOM
|
|
149
|
+
* @example
|
|
150
|
+
* @returns
|
|
151
|
+
*/
|
|
115
152
|
(0, _inherits2.default)(LayoutSectionView, _ReactNodeView);
|
|
116
153
|
return (0, _createClass2.default)(LayoutSectionView, [{
|
|
117
154
|
key: "getContentDOM",
|
|
@@ -130,6 +167,13 @@ var LayoutSectionView = exports.LayoutSectionView = /*#__PURE__*/function (_Reac
|
|
|
130
167
|
contentDOM: contentDOM
|
|
131
168
|
};
|
|
132
169
|
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* setDomAttrs
|
|
173
|
+
* @param node
|
|
174
|
+
* @param element
|
|
175
|
+
* @example
|
|
176
|
+
*/
|
|
133
177
|
}, {
|
|
134
178
|
key: "setDomAttrs",
|
|
135
179
|
value: function setDomAttrs(node, element) {
|
|
@@ -137,6 +181,14 @@ var LayoutSectionView = exports.LayoutSectionView = /*#__PURE__*/function (_Reac
|
|
|
137
181
|
this.layoutDOM.setAttribute('data-column-rule-style', node.attrs.columnRuleStyle);
|
|
138
182
|
}
|
|
139
183
|
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* render
|
|
187
|
+
* @param props
|
|
188
|
+
* @param forwardRef
|
|
189
|
+
* @example
|
|
190
|
+
* @returns
|
|
191
|
+
*/
|
|
140
192
|
}, {
|
|
141
193
|
key: "render",
|
|
142
194
|
value: function render(props, forwardRef) {
|
|
@@ -152,6 +204,13 @@ var LayoutSectionView = exports.LayoutSectionView = /*#__PURE__*/function (_Reac
|
|
|
152
204
|
parentRef: this.layoutDOM
|
|
153
205
|
});
|
|
154
206
|
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* ignoreMutation
|
|
210
|
+
* @param mutation
|
|
211
|
+
* @example
|
|
212
|
+
* @returns
|
|
213
|
+
*/
|
|
155
214
|
}, {
|
|
156
215
|
key: "ignoreMutation",
|
|
157
216
|
value: function ignoreMutation(mutation) {
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -21,6 +21,7 @@ var _layoutThreeColumnsSidebarsEditorLayoutThreeWithSidebars = _interopRequireDe
|
|
|
21
21
|
var _layoutTwoColumnsEditorLayoutTwoEqual = _interopRequireDefault(require("@atlaskit/icon/core/migration/layout-two-columns--editor-layout-two-equal"));
|
|
22
22
|
var _layoutTwoColumnsSidebarLeftEditorLayoutTwoLeftSidebar = _interopRequireDefault(require("@atlaskit/icon/core/migration/layout-two-columns-sidebar-left--editor-layout-two-left-sidebar"));
|
|
23
23
|
var _layoutTwoColumnsSidebarRightEditorLayoutTwoRightSidebar = _interopRequireDefault(require("@atlaskit/icon/core/migration/layout-two-columns-sidebar-right--editor-layout-two-right-sidebar"));
|
|
24
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
24
25
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
25
26
|
var _actions = require("../pm-plugins/actions");
|
|
26
27
|
var _LayoutThreeWithLeftSidebars = require("./icons/LayoutThreeWithLeftSidebars");
|
|
@@ -235,8 +236,12 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(state, intl, pos
|
|
|
235
236
|
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className)
|
|
236
237
|
};
|
|
237
238
|
};
|
|
239
|
+
// testId is required to show focus on trigger button on ESC key press
|
|
240
|
+
// see hideOnEsc in platform/packages/editor/editor-plugin-floating-toolbar/src/ui/Dropdown.tsx
|
|
241
|
+
var testId = (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_8') ? 'layout-overflow-dropdown-trigger' : undefined;
|
|
238
242
|
var overflowMenu = {
|
|
239
243
|
type: 'overflow-dropdown',
|
|
244
|
+
testId: testId,
|
|
240
245
|
options: [_objectSpread({
|
|
241
246
|
title: intl.formatMessage(_messages.default.copyToClipboard),
|
|
242
247
|
onClick: function onClick() {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
2
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
3
3
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
4
4
|
import { BreakoutResizer, ignoreResizerMutations } from '@atlaskit/editor-common/resizer';
|
|
5
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
5
6
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
6
7
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
8
|
import { selectIntoLayout } from '../pm-plugins/utils';
|
|
9
|
+
const layoutDynamicFullWidthGuidelineOffset = 16;
|
|
8
10
|
const isEmptyParagraph = node => {
|
|
9
11
|
return !!node && node.type.name === 'paragraph' && !node.childCount;
|
|
10
12
|
};
|
|
@@ -29,6 +31,19 @@ const isEmptyLayout = node => {
|
|
|
29
31
|
});
|
|
30
32
|
return isEmpty;
|
|
31
33
|
};
|
|
34
|
+
const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
35
|
+
const editorDisabled = useSharedPluginStateSelector(api, 'editorDisabled.editorDisabled');
|
|
36
|
+
return {
|
|
37
|
+
editorDisabled
|
|
38
|
+
};
|
|
39
|
+
}, api => {
|
|
40
|
+
const {
|
|
41
|
+
editorDisabledState
|
|
42
|
+
} = useSharedPluginState(api, ['editorDisabled']);
|
|
43
|
+
return {
|
|
44
|
+
editorDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled
|
|
45
|
+
};
|
|
46
|
+
});
|
|
32
47
|
const LayoutBreakoutResizer = ({
|
|
33
48
|
pluginInjectionApi,
|
|
34
49
|
forwardRef,
|
|
@@ -38,8 +53,8 @@ const LayoutBreakoutResizer = ({
|
|
|
38
53
|
}) => {
|
|
39
54
|
var _pluginInjectionApi$a;
|
|
40
55
|
const {
|
|
41
|
-
|
|
42
|
-
} =
|
|
56
|
+
editorDisabled
|
|
57
|
+
} = useSharedState(pluginInjectionApi);
|
|
43
58
|
const getEditorWidth = () => {
|
|
44
59
|
var _pluginInjectionApi$w;
|
|
45
60
|
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$w = pluginInjectionApi.width) === null || _pluginInjectionApi$w === void 0 ? void 0 : _pluginInjectionApi$w.sharedState.currentState();
|
|
@@ -71,14 +86,15 @@ const LayoutBreakoutResizer = ({
|
|
|
71
86
|
editorView: view,
|
|
72
87
|
nodeType: "layoutSection",
|
|
73
88
|
getEditorWidth: getEditorWidth,
|
|
74
|
-
disabled:
|
|
89
|
+
disabled: editorDisabled === true || !isBreakoutAvailable(view.state.schema),
|
|
75
90
|
parentRef: parentRef,
|
|
76
91
|
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
|
|
77
92
|
displayGuidelines: editorExperiment('single_column_layouts', true) ? displayGuidelines : undefined,
|
|
78
93
|
displayGapCursor: displayGapCursor,
|
|
79
94
|
onResizeStart: () => {
|
|
80
95
|
selectIntoCurrentLayout();
|
|
81
|
-
}
|
|
96
|
+
},
|
|
97
|
+
dynamicFullWidthGuidelineOffset: layoutDynamicFullWidthGuidelineOffset
|
|
82
98
|
});
|
|
83
99
|
};
|
|
84
100
|
const toDOM = () => ['div', {
|
|
@@ -86,12 +102,34 @@ const toDOM = () => ['div', {
|
|
|
86
102
|
}, ['div', {
|
|
87
103
|
'data-layout-section': true
|
|
88
104
|
}, 0]];
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
*
|
|
108
|
+
*/
|
|
89
109
|
export class LayoutSectionView extends ReactNodeView {
|
|
110
|
+
/**
|
|
111
|
+
* constructor
|
|
112
|
+
* @param props
|
|
113
|
+
* @param props.node
|
|
114
|
+
* @param props.view
|
|
115
|
+
* @param props.getPos
|
|
116
|
+
* @param props.portalProviderAPI
|
|
117
|
+
* @param props.eventDispatcher
|
|
118
|
+
* @param props.pluginInjectionApi
|
|
119
|
+
* @param props.options
|
|
120
|
+
* @example
|
|
121
|
+
*/
|
|
90
122
|
constructor(props) {
|
|
91
123
|
super(props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props);
|
|
92
124
|
this.isEmpty = isEmptyLayout(this.node);
|
|
93
125
|
this.options = props.options;
|
|
94
126
|
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* getContentDOM
|
|
130
|
+
* @example
|
|
131
|
+
* @returns
|
|
132
|
+
*/
|
|
95
133
|
getContentDOM() {
|
|
96
134
|
const {
|
|
97
135
|
dom: container,
|
|
@@ -108,11 +146,26 @@ export class LayoutSectionView extends ReactNodeView {
|
|
|
108
146
|
contentDOM
|
|
109
147
|
};
|
|
110
148
|
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* setDomAttrs
|
|
152
|
+
* @param node
|
|
153
|
+
* @param element
|
|
154
|
+
* @example
|
|
155
|
+
*/
|
|
111
156
|
setDomAttrs(node, element) {
|
|
112
157
|
if (this.layoutDOM) {
|
|
113
158
|
this.layoutDOM.setAttribute('data-column-rule-style', node.attrs.columnRuleStyle);
|
|
114
159
|
}
|
|
115
160
|
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* render
|
|
164
|
+
* @param props
|
|
165
|
+
* @param forwardRef
|
|
166
|
+
* @example
|
|
167
|
+
* @returns
|
|
168
|
+
*/
|
|
116
169
|
render(props, forwardRef) {
|
|
117
170
|
this.isEmpty = isEmptyLayout(this.node);
|
|
118
171
|
if (this.layoutDOM) {
|
|
@@ -126,6 +179,13 @@ export class LayoutSectionView extends ReactNodeView {
|
|
|
126
179
|
parentRef: this.layoutDOM
|
|
127
180
|
});
|
|
128
181
|
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* ignoreMutation
|
|
185
|
+
* @param mutation
|
|
186
|
+
* @example
|
|
187
|
+
* @returns
|
|
188
|
+
*/
|
|
129
189
|
ignoreMutation(mutation) {
|
|
130
190
|
return ignoreResizerMutations(mutation);
|
|
131
191
|
}
|
|
@@ -11,6 +11,7 @@ import LayoutThreeColumnsSidebarsIcon from '@atlaskit/icon/core/migration/layout
|
|
|
11
11
|
import LayoutTwoColumnsIcon from '@atlaskit/icon/core/migration/layout-two-columns--editor-layout-two-equal';
|
|
12
12
|
import LayoutTwoColumnsSidebarLeftIcon from '@atlaskit/icon/core/migration/layout-two-columns-sidebar-left--editor-layout-two-left-sidebar';
|
|
13
13
|
import LayoutTwoColumnsSidebarRightIcon from '@atlaskit/icon/core/migration/layout-two-columns-sidebar-right--editor-layout-two-right-sidebar';
|
|
14
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
15
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
15
16
|
import { deleteActiveLayoutNode, getPresetLayout, setPresetLayout } from '../pm-plugins/actions';
|
|
16
17
|
import { LayoutThreeWithLeftSidebarsIcon } from './icons/LayoutThreeWithLeftSidebars';
|
|
@@ -217,8 +218,12 @@ export const buildToolbar = (state, intl, pos, _allowBreakout, addSidebarLayouts
|
|
|
217
218
|
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
|
|
218
219
|
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className)
|
|
219
220
|
});
|
|
221
|
+
// testId is required to show focus on trigger button on ESC key press
|
|
222
|
+
// see hideOnEsc in platform/packages/editor/editor-plugin-floating-toolbar/src/ui/Dropdown.tsx
|
|
223
|
+
const testId = fg('platform_editor_controls_patch_8') ? 'layout-overflow-dropdown-trigger' : undefined;
|
|
220
224
|
const overflowMenu = {
|
|
221
225
|
type: 'overflow-dropdown',
|
|
226
|
+
testId,
|
|
222
227
|
options: [{
|
|
223
228
|
title: intl.formatMessage(commonMessages.copyToClipboard),
|
|
224
229
|
onClick: () => {
|
|
@@ -6,12 +6,14 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
6
6
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
7
7
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
8
8
|
import React, { useCallback } from 'react';
|
|
9
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
9
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
10
10
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
11
11
|
import { BreakoutResizer, ignoreResizerMutations } from '@atlaskit/editor-common/resizer';
|
|
12
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
12
13
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
13
14
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
14
15
|
import { selectIntoLayout } from '../pm-plugins/utils';
|
|
16
|
+
var layoutDynamicFullWidthGuidelineOffset = 16;
|
|
15
17
|
var isEmptyParagraph = function isEmptyParagraph(node) {
|
|
16
18
|
return !!node && node.type.name === 'paragraph' && !node.childCount;
|
|
17
19
|
};
|
|
@@ -36,6 +38,18 @@ var isEmptyLayout = function isEmptyLayout(node) {
|
|
|
36
38
|
});
|
|
37
39
|
return isEmpty;
|
|
38
40
|
};
|
|
41
|
+
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
42
|
+
var editorDisabled = useSharedPluginStateSelector(api, 'editorDisabled.editorDisabled');
|
|
43
|
+
return {
|
|
44
|
+
editorDisabled: editorDisabled
|
|
45
|
+
};
|
|
46
|
+
}, function (api) {
|
|
47
|
+
var _useSharedPluginState = useSharedPluginState(api, ['editorDisabled']),
|
|
48
|
+
editorDisabledState = _useSharedPluginState.editorDisabledState;
|
|
49
|
+
return {
|
|
50
|
+
editorDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled
|
|
51
|
+
};
|
|
52
|
+
});
|
|
39
53
|
var LayoutBreakoutResizer = function LayoutBreakoutResizer(_ref) {
|
|
40
54
|
var _pluginInjectionApi$a;
|
|
41
55
|
var pluginInjectionApi = _ref.pluginInjectionApi,
|
|
@@ -43,8 +57,8 @@ var LayoutBreakoutResizer = function LayoutBreakoutResizer(_ref) {
|
|
|
43
57
|
getPos = _ref.getPos,
|
|
44
58
|
view = _ref.view,
|
|
45
59
|
parentRef = _ref.parentRef;
|
|
46
|
-
var
|
|
47
|
-
|
|
60
|
+
var _useSharedState = useSharedState(pluginInjectionApi),
|
|
61
|
+
editorDisabled = _useSharedState.editorDisabled;
|
|
48
62
|
var getEditorWidth = function getEditorWidth() {
|
|
49
63
|
var _pluginInjectionApi$w;
|
|
50
64
|
return pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$w = pluginInjectionApi.width) === null || _pluginInjectionApi$w === void 0 ? void 0 : _pluginInjectionApi$w.sharedState.currentState();
|
|
@@ -76,14 +90,15 @@ var LayoutBreakoutResizer = function LayoutBreakoutResizer(_ref) {
|
|
|
76
90
|
editorView: view,
|
|
77
91
|
nodeType: "layoutSection",
|
|
78
92
|
getEditorWidth: getEditorWidth,
|
|
79
|
-
disabled:
|
|
93
|
+
disabled: editorDisabled === true || !isBreakoutAvailable(view.state.schema),
|
|
80
94
|
parentRef: parentRef,
|
|
81
95
|
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
|
|
82
96
|
displayGuidelines: editorExperiment('single_column_layouts', true) ? displayGuidelines : undefined,
|
|
83
97
|
displayGapCursor: displayGapCursor,
|
|
84
98
|
onResizeStart: function onResizeStart() {
|
|
85
99
|
selectIntoCurrentLayout();
|
|
86
|
-
}
|
|
100
|
+
},
|
|
101
|
+
dynamicFullWidthGuidelineOffset: layoutDynamicFullWidthGuidelineOffset
|
|
87
102
|
});
|
|
88
103
|
};
|
|
89
104
|
var toDOM = function toDOM() {
|
|
@@ -93,7 +108,23 @@ var toDOM = function toDOM() {
|
|
|
93
108
|
'data-layout-section': true
|
|
94
109
|
}, 0]];
|
|
95
110
|
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
*
|
|
114
|
+
*/
|
|
96
115
|
export var LayoutSectionView = /*#__PURE__*/function (_ReactNodeView) {
|
|
116
|
+
/**
|
|
117
|
+
* constructor
|
|
118
|
+
* @param props
|
|
119
|
+
* @param props.node
|
|
120
|
+
* @param props.view
|
|
121
|
+
* @param props.getPos
|
|
122
|
+
* @param props.portalProviderAPI
|
|
123
|
+
* @param props.eventDispatcher
|
|
124
|
+
* @param props.pluginInjectionApi
|
|
125
|
+
* @param props.options
|
|
126
|
+
* @example
|
|
127
|
+
*/
|
|
97
128
|
function LayoutSectionView(props) {
|
|
98
129
|
var _this;
|
|
99
130
|
_classCallCheck(this, LayoutSectionView);
|
|
@@ -102,6 +133,12 @@ export var LayoutSectionView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
102
133
|
_this.options = props.options;
|
|
103
134
|
return _this;
|
|
104
135
|
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* getContentDOM
|
|
139
|
+
* @example
|
|
140
|
+
* @returns
|
|
141
|
+
*/
|
|
105
142
|
_inherits(LayoutSectionView, _ReactNodeView);
|
|
106
143
|
return _createClass(LayoutSectionView, [{
|
|
107
144
|
key: "getContentDOM",
|
|
@@ -120,6 +157,13 @@ export var LayoutSectionView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
120
157
|
contentDOM: contentDOM
|
|
121
158
|
};
|
|
122
159
|
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* setDomAttrs
|
|
163
|
+
* @param node
|
|
164
|
+
* @param element
|
|
165
|
+
* @example
|
|
166
|
+
*/
|
|
123
167
|
}, {
|
|
124
168
|
key: "setDomAttrs",
|
|
125
169
|
value: function setDomAttrs(node, element) {
|
|
@@ -127,6 +171,14 @@ export var LayoutSectionView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
127
171
|
this.layoutDOM.setAttribute('data-column-rule-style', node.attrs.columnRuleStyle);
|
|
128
172
|
}
|
|
129
173
|
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* render
|
|
177
|
+
* @param props
|
|
178
|
+
* @param forwardRef
|
|
179
|
+
* @example
|
|
180
|
+
* @returns
|
|
181
|
+
*/
|
|
130
182
|
}, {
|
|
131
183
|
key: "render",
|
|
132
184
|
value: function render(props, forwardRef) {
|
|
@@ -142,6 +194,13 @@ export var LayoutSectionView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
142
194
|
parentRef: this.layoutDOM
|
|
143
195
|
});
|
|
144
196
|
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* ignoreMutation
|
|
200
|
+
* @param mutation
|
|
201
|
+
* @example
|
|
202
|
+
* @returns
|
|
203
|
+
*/
|
|
145
204
|
}, {
|
|
146
205
|
key: "ignoreMutation",
|
|
147
206
|
value: function ignoreMutation(mutation) {
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -15,6 +15,7 @@ import LayoutThreeColumnsSidebarsIcon from '@atlaskit/icon/core/migration/layout
|
|
|
15
15
|
import LayoutTwoColumnsIcon from '@atlaskit/icon/core/migration/layout-two-columns--editor-layout-two-equal';
|
|
16
16
|
import LayoutTwoColumnsSidebarLeftIcon from '@atlaskit/icon/core/migration/layout-two-columns-sidebar-left--editor-layout-two-left-sidebar';
|
|
17
17
|
import LayoutTwoColumnsSidebarRightIcon from '@atlaskit/icon/core/migration/layout-two-columns-sidebar-right--editor-layout-two-right-sidebar';
|
|
18
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
18
19
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
19
20
|
import { deleteActiveLayoutNode, getPresetLayout, setPresetLayout } from '../pm-plugins/actions';
|
|
20
21
|
import { LayoutThreeWithLeftSidebarsIcon } from './icons/LayoutThreeWithLeftSidebars';
|
|
@@ -225,8 +226,12 @@ export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout
|
|
|
225
226
|
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className)
|
|
226
227
|
};
|
|
227
228
|
};
|
|
229
|
+
// testId is required to show focus on trigger button on ESC key press
|
|
230
|
+
// see hideOnEsc in platform/packages/editor/editor-plugin-floating-toolbar/src/ui/Dropdown.tsx
|
|
231
|
+
var testId = fg('platform_editor_controls_patch_8') ? 'layout-overflow-dropdown-trigger' : undefined;
|
|
228
232
|
var overflowMenu = {
|
|
229
233
|
type: 'overflow-dropdown',
|
|
234
|
+
testId: testId,
|
|
230
235
|
options: [_objectSpread({
|
|
231
236
|
title: intl.formatMessage(commonMessages.copyToClipboard),
|
|
232
237
|
onClick: function onClick() {
|
|
@@ -17,10 +17,25 @@ type LayoutSectionViewProps = {
|
|
|
17
17
|
options: LayoutPluginOptions;
|
|
18
18
|
};
|
|
19
19
|
type ForwardRef = (ref: HTMLElement | null) => void;
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
20
23
|
export declare class LayoutSectionView extends ReactNodeView<LayoutSectionViewProps> {
|
|
21
24
|
options: LayoutPluginOptions;
|
|
22
25
|
layoutDOM?: HTMLElement;
|
|
23
26
|
isEmpty?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* constructor
|
|
29
|
+
* @param props
|
|
30
|
+
* @param props.node
|
|
31
|
+
* @param props.view
|
|
32
|
+
* @param props.getPos
|
|
33
|
+
* @param props.portalProviderAPI
|
|
34
|
+
* @param props.eventDispatcher
|
|
35
|
+
* @param props.pluginInjectionApi
|
|
36
|
+
* @param props.options
|
|
37
|
+
* @example
|
|
38
|
+
*/
|
|
24
39
|
constructor(props: {
|
|
25
40
|
node: PMNode;
|
|
26
41
|
view: EditorView;
|
|
@@ -30,12 +45,36 @@ export declare class LayoutSectionView extends ReactNodeView<LayoutSectionViewPr
|
|
|
30
45
|
pluginInjectionApi: ExtractInjectionAPI<LayoutPlugin>;
|
|
31
46
|
options: LayoutPluginOptions;
|
|
32
47
|
});
|
|
48
|
+
/**
|
|
49
|
+
* getContentDOM
|
|
50
|
+
* @example
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
33
53
|
getContentDOM(): {
|
|
34
54
|
dom: HTMLElement;
|
|
35
55
|
contentDOM: HTMLElement | undefined;
|
|
36
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* setDomAttrs
|
|
59
|
+
* @param node
|
|
60
|
+
* @param element
|
|
61
|
+
* @example
|
|
62
|
+
*/
|
|
37
63
|
setDomAttrs(node: PMNode, element: HTMLElement): void;
|
|
64
|
+
/**
|
|
65
|
+
* render
|
|
66
|
+
* @param props
|
|
67
|
+
* @param forwardRef
|
|
68
|
+
* @example
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
38
71
|
render(props: LayoutSectionViewProps, forwardRef: ForwardRef): React.JSX.Element;
|
|
72
|
+
/**
|
|
73
|
+
* ignoreMutation
|
|
74
|
+
* @param mutation
|
|
75
|
+
* @example
|
|
76
|
+
* @returns
|
|
77
|
+
*/
|
|
39
78
|
ignoreMutation(mutation: MutationRecord | {
|
|
40
79
|
type: 'selection';
|
|
41
80
|
target: Node;
|
|
@@ -17,10 +17,25 @@ type LayoutSectionViewProps = {
|
|
|
17
17
|
options: LayoutPluginOptions;
|
|
18
18
|
};
|
|
19
19
|
type ForwardRef = (ref: HTMLElement | null) => void;
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
20
23
|
export declare class LayoutSectionView extends ReactNodeView<LayoutSectionViewProps> {
|
|
21
24
|
options: LayoutPluginOptions;
|
|
22
25
|
layoutDOM?: HTMLElement;
|
|
23
26
|
isEmpty?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* constructor
|
|
29
|
+
* @param props
|
|
30
|
+
* @param props.node
|
|
31
|
+
* @param props.view
|
|
32
|
+
* @param props.getPos
|
|
33
|
+
* @param props.portalProviderAPI
|
|
34
|
+
* @param props.eventDispatcher
|
|
35
|
+
* @param props.pluginInjectionApi
|
|
36
|
+
* @param props.options
|
|
37
|
+
* @example
|
|
38
|
+
*/
|
|
24
39
|
constructor(props: {
|
|
25
40
|
node: PMNode;
|
|
26
41
|
view: EditorView;
|
|
@@ -30,12 +45,36 @@ export declare class LayoutSectionView extends ReactNodeView<LayoutSectionViewPr
|
|
|
30
45
|
pluginInjectionApi: ExtractInjectionAPI<LayoutPlugin>;
|
|
31
46
|
options: LayoutPluginOptions;
|
|
32
47
|
});
|
|
48
|
+
/**
|
|
49
|
+
* getContentDOM
|
|
50
|
+
* @example
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
33
53
|
getContentDOM(): {
|
|
34
54
|
dom: HTMLElement;
|
|
35
55
|
contentDOM: HTMLElement | undefined;
|
|
36
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* setDomAttrs
|
|
59
|
+
* @param node
|
|
60
|
+
* @param element
|
|
61
|
+
* @example
|
|
62
|
+
*/
|
|
37
63
|
setDomAttrs(node: PMNode, element: HTMLElement): void;
|
|
64
|
+
/**
|
|
65
|
+
* render
|
|
66
|
+
* @param props
|
|
67
|
+
* @param forwardRef
|
|
68
|
+
* @example
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
38
71
|
render(props: LayoutSectionViewProps, forwardRef: ForwardRef): React.JSX.Element;
|
|
72
|
+
/**
|
|
73
|
+
* ignoreMutation
|
|
74
|
+
* @param mutation
|
|
75
|
+
* @example
|
|
76
|
+
* @returns
|
|
77
|
+
*/
|
|
39
78
|
ignoreMutation(mutation: MutationRecord | {
|
|
40
79
|
type: 'selection';
|
|
41
80
|
target: Node;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-layout",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.4",
|
|
4
4
|
"description": "Layout plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
37
|
-
"@atlaskit/editor-common": "^
|
|
38
|
-
"@atlaskit/editor-plugin-analytics": "^2.
|
|
37
|
+
"@atlaskit/editor-common": "^105.8.0",
|
|
38
|
+
"@atlaskit/editor-plugin-analytics": "^2.3.0",
|
|
39
39
|
"@atlaskit/editor-plugin-decorations": "^2.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
|
|
41
41
|
"@atlaskit/editor-plugin-guideline": "^2.0.0",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"@atlaskit/editor-plugin-width": "^3.0.0",
|
|
44
44
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
45
45
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
46
|
-
"@atlaskit/icon": "^26.
|
|
46
|
+
"@atlaskit/icon": "^26.1.0",
|
|
47
47
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
48
|
-
"@atlaskit/tmp-editor-statsig": "^4.
|
|
49
|
-
"@atlaskit/tokens": "^4.
|
|
48
|
+
"@atlaskit/tmp-editor-statsig": "^4.24.0",
|
|
49
|
+
"@atlaskit/tokens": "^4.9.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
51
51
|
"@emotion/react": "^11.7.1"
|
|
52
52
|
},
|
|
@@ -110,6 +110,9 @@
|
|
|
110
110
|
},
|
|
111
111
|
"platform_editor_controls_patch_analytics_2": {
|
|
112
112
|
"type": "boolean"
|
|
113
|
+
},
|
|
114
|
+
"platform_editor_controls_patch_8": {
|
|
115
|
+
"type": "boolean"
|
|
113
116
|
}
|
|
114
117
|
}
|
|
115
118
|
}
|