@atlaskit/editor-plugin-layout 2.3.2 → 2.4.1
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 +21 -0
- package/dist/cjs/nodeviews/index.js +8 -0
- package/dist/cjs/ui/toolbar.js +16 -3
- package/dist/es2019/nodeviews/index.js +8 -0
- package/dist/es2019/ui/toolbar.js +12 -2
- package/dist/esm/nodeviews/index.js +8 -0
- package/dist/esm/ui/toolbar.js +16 -3
- package/dist/types/layoutPluginType.d.ts +3 -1
- package/dist/types-ts4.5/layoutPluginType.d.ts +3 -1
- package/package.json +9 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-layout
|
|
2
2
|
|
|
3
|
+
## 2.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#134468](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/134468)
|
|
8
|
+
[`e312ec529d05a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e312ec529d05a) -
|
|
9
|
+
[ux] Apply hover decoration when hovering on copy/delete button on overflow menu
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 2.4.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#132381](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/132381)
|
|
17
|
+
[`19e52e77d3cfc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/19e52e77d3cfc) -
|
|
18
|
+
ED-27195 enable guildeline for breakout resizer
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
3
24
|
## 2.3.2
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -16,6 +16,7 @@ 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
18
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
19
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
19
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
21
|
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; }
|
|
21
22
|
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)); }
|
|
@@ -61,6 +62,12 @@ var LayoutBreakoutResizer = function LayoutBreakoutResizer(_ref) {
|
|
|
61
62
|
var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$s;
|
|
62
63
|
return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s = pluginInjectionApi.selection) === null || _pluginInjectionApi$s === void 0 ? void 0 : _pluginInjectionApi$s.commands.displayGapCursor(toggle))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
|
|
63
64
|
}, [pluginInjectionApi]);
|
|
65
|
+
var displayGuidelines = (0, _react.useCallback)(function (guidelines) {
|
|
66
|
+
var _pluginInjectionApi$g;
|
|
67
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$g = pluginInjectionApi.guideline) === null || _pluginInjectionApi$g === void 0 || (_pluginInjectionApi$g = _pluginInjectionApi$g.actions) === null || _pluginInjectionApi$g === void 0 || _pluginInjectionApi$g.displayGuideline(view)({
|
|
68
|
+
guidelines: guidelines
|
|
69
|
+
});
|
|
70
|
+
}, [pluginInjectionApi, view]);
|
|
64
71
|
return /*#__PURE__*/_react.default.createElement(_resizer.BreakoutResizer, {
|
|
65
72
|
getRef: forwardRef,
|
|
66
73
|
getPos: getPos,
|
|
@@ -70,6 +77,7 @@ var LayoutBreakoutResizer = function LayoutBreakoutResizer(_ref) {
|
|
|
70
77
|
disabled: (editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled) === true || !isBreakoutAvailable(view.state.schema),
|
|
71
78
|
parentRef: parentRef,
|
|
72
79
|
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
|
|
80
|
+
displayGuidelines: (0, _experiments.editorExperiment)('single_column_layouts', true) ? displayGuidelines : undefined,
|
|
73
81
|
displayGapCursor: displayGapCursor
|
|
74
82
|
});
|
|
75
83
|
};
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.layoutToolbarTitle = exports.buildToolbar = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
11
|
var _react = _interopRequireDefault(require("react"));
|
|
11
12
|
var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/messages"));
|
|
12
13
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
14
|
+
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
13
15
|
var _copy = _interopRequireDefault(require("@atlaskit/icon/core/copy"));
|
|
14
16
|
var _deleteEditorRemove = _interopRequireDefault(require("@atlaskit/icon/core/migration/delete--editor-remove"));
|
|
15
17
|
var _layoutOneColumnEditorLayoutSingle = _interopRequireDefault(require("@atlaskit/icon/core/migration/layout-one-column--editor-layout-single"));
|
|
@@ -18,12 +20,15 @@ var _layoutThreeColumnsSidebarsEditorLayoutThreeWithSidebars = _interopRequireDe
|
|
|
18
20
|
var _layoutTwoColumnsEditorLayoutTwoEqual = _interopRequireDefault(require("@atlaskit/icon/core/migration/layout-two-columns--editor-layout-two-equal"));
|
|
19
21
|
var _layoutTwoColumnsSidebarLeftEditorLayoutTwoLeftSidebar = _interopRequireDefault(require("@atlaskit/icon/core/migration/layout-two-columns-sidebar-left--editor-layout-two-left-sidebar"));
|
|
20
22
|
var _layoutTwoColumnsSidebarRightEditorLayoutTwoRightSidebar = _interopRequireDefault(require("@atlaskit/icon/core/migration/layout-two-columns-sidebar-right--editor-layout-two-right-sidebar"));
|
|
23
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
21
24
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
22
25
|
var _actions = require("../pm-plugins/actions");
|
|
23
26
|
var _LayoutThreeWithLeftSidebars = require("./icons/LayoutThreeWithLeftSidebars");
|
|
24
27
|
var _LayoutThreeWithRightSidebars = require("./icons/LayoutThreeWithRightSidebars");
|
|
25
28
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
26
29
|
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; }
|
|
30
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
31
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
27
32
|
var LAYOUT_TYPES = [{
|
|
28
33
|
id: 'editor.layout.twoEquals',
|
|
29
34
|
type: 'two_equal',
|
|
@@ -222,9 +227,17 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(state, intl, pos
|
|
|
222
227
|
}]
|
|
223
228
|
};
|
|
224
229
|
var layoutTypes = allowSingleColumnLayout ? LAYOUT_TYPES_WITH_SINGLE_COL : LAYOUT_TYPES;
|
|
230
|
+
var hoverDecorationProps = function hoverDecorationProps(nodeType, className) {
|
|
231
|
+
return (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_1') ? {
|
|
232
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
|
|
233
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className),
|
|
234
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
|
|
235
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className)
|
|
236
|
+
} : undefined;
|
|
237
|
+
};
|
|
225
238
|
var overflowMenu = {
|
|
226
239
|
type: 'overflow-dropdown',
|
|
227
|
-
options: [{
|
|
240
|
+
options: [_objectSpread({
|
|
228
241
|
title: 'Copy',
|
|
229
242
|
onClick: function onClick() {
|
|
230
243
|
var _api$core, _api$floatingToolbar;
|
|
@@ -235,13 +248,13 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(state, intl, pos
|
|
|
235
248
|
icon: /*#__PURE__*/_react.default.createElement(_copy.default, {
|
|
236
249
|
label: "Copy"
|
|
237
250
|
})
|
|
238
|
-
}, {
|
|
251
|
+
}, hoverDecorationProps(nodeType, _editorSharedStyles.akEditorSelectedNodeClassName)), _objectSpread({
|
|
239
252
|
title: 'Delete',
|
|
240
253
|
onClick: (0, _actions.deleteActiveLayoutNode)(editorAnalyticsAPI),
|
|
241
254
|
icon: /*#__PURE__*/_react.default.createElement(_deleteEditorRemove.default, {
|
|
242
255
|
label: "Delete"
|
|
243
256
|
})
|
|
244
|
-
}]
|
|
257
|
+
}, hoverDecorationProps(nodeType))]
|
|
245
258
|
};
|
|
246
259
|
return {
|
|
247
260
|
title: layoutToolbarTitle,
|
|
@@ -3,6 +3,7 @@ import { useSharedPluginState } 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
5
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
6
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
7
|
const isEmptyParagraph = node => {
|
|
7
8
|
return !!node && node.type.name === 'paragraph' && !node.childCount;
|
|
8
9
|
};
|
|
@@ -46,6 +47,12 @@ const LayoutBreakoutResizer = ({
|
|
|
46
47
|
var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$s;
|
|
47
48
|
return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$s = pluginInjectionApi.selection) === null || _pluginInjectionApi$s === void 0 ? void 0 : _pluginInjectionApi$s.commands.displayGapCursor(toggle))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
|
|
48
49
|
}, [pluginInjectionApi]);
|
|
50
|
+
const displayGuidelines = useCallback(guidelines => {
|
|
51
|
+
var _pluginInjectionApi$g, _pluginInjectionApi$g2;
|
|
52
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$g = pluginInjectionApi.guideline) === null || _pluginInjectionApi$g === void 0 ? void 0 : (_pluginInjectionApi$g2 = _pluginInjectionApi$g.actions) === null || _pluginInjectionApi$g2 === void 0 ? void 0 : _pluginInjectionApi$g2.displayGuideline(view)({
|
|
53
|
+
guidelines
|
|
54
|
+
});
|
|
55
|
+
}, [pluginInjectionApi, view]);
|
|
49
56
|
return /*#__PURE__*/React.createElement(BreakoutResizer, {
|
|
50
57
|
getRef: forwardRef,
|
|
51
58
|
getPos: getPos,
|
|
@@ -55,6 +62,7 @@ const LayoutBreakoutResizer = ({
|
|
|
55
62
|
disabled: (editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled) === true || !isBreakoutAvailable(view.state.schema),
|
|
56
63
|
parentRef: parentRef,
|
|
57
64
|
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
|
|
65
|
+
displayGuidelines: editorExperiment('single_column_layouts', true) ? displayGuidelines : undefined,
|
|
58
66
|
displayGapCursor: displayGapCursor
|
|
59
67
|
});
|
|
60
68
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import commonMessages, { layoutMessages, layoutMessages as toolbarMessages } from '@atlaskit/editor-common/messages';
|
|
3
3
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
+
import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
4
5
|
import CopyIcon from '@atlaskit/icon/core/copy';
|
|
5
6
|
import DeleteIcon from '@atlaskit/icon/core/migration/delete--editor-remove';
|
|
6
7
|
import LayoutOneColumnIcon from '@atlaskit/icon/core/migration/layout-one-column--editor-layout-single';
|
|
@@ -9,6 +10,7 @@ import LayoutThreeColumnsSidebarsIcon from '@atlaskit/icon/core/migration/layout
|
|
|
9
10
|
import LayoutTwoColumnsIcon from '@atlaskit/icon/core/migration/layout-two-columns--editor-layout-two-equal';
|
|
10
11
|
import LayoutTwoColumnsSidebarLeftIcon from '@atlaskit/icon/core/migration/layout-two-columns-sidebar-left--editor-layout-two-left-sidebar';
|
|
11
12
|
import LayoutTwoColumnsSidebarRightIcon from '@atlaskit/icon/core/migration/layout-two-columns-sidebar-right--editor-layout-two-right-sidebar';
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
14
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
13
15
|
import { deleteActiveLayoutNode, getPresetLayout, setPresetLayout } from '../pm-plugins/actions';
|
|
14
16
|
import { LayoutThreeWithLeftSidebarsIcon } from './icons/LayoutThreeWithLeftSidebars';
|
|
@@ -209,6 +211,12 @@ export const buildToolbar = (state, intl, pos, _allowBreakout, addSidebarLayouts
|
|
|
209
211
|
}]
|
|
210
212
|
};
|
|
211
213
|
const layoutTypes = allowSingleColumnLayout ? LAYOUT_TYPES_WITH_SINGLE_COL : LAYOUT_TYPES;
|
|
214
|
+
const hoverDecorationProps = (nodeType, className) => fg('platform_editor_controls_patch_1') ? {
|
|
215
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
|
|
216
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className),
|
|
217
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
|
|
218
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className)
|
|
219
|
+
} : undefined;
|
|
212
220
|
const overflowMenu = {
|
|
213
221
|
type: 'overflow-dropdown',
|
|
214
222
|
options: [{
|
|
@@ -221,13 +229,15 @@ export const buildToolbar = (state, intl, pos, _allowBreakout, addSidebarLayouts
|
|
|
221
229
|
},
|
|
222
230
|
icon: /*#__PURE__*/React.createElement(CopyIcon, {
|
|
223
231
|
label: "Copy"
|
|
224
|
-
})
|
|
232
|
+
}),
|
|
233
|
+
...hoverDecorationProps(nodeType, akEditorSelectedNodeClassName)
|
|
225
234
|
}, {
|
|
226
235
|
title: 'Delete',
|
|
227
236
|
onClick: deleteActiveLayoutNode(editorAnalyticsAPI),
|
|
228
237
|
icon: /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
229
238
|
label: "Delete"
|
|
230
|
-
})
|
|
239
|
+
}),
|
|
240
|
+
...hoverDecorationProps(nodeType)
|
|
231
241
|
}]
|
|
232
242
|
};
|
|
233
243
|
return {
|
|
@@ -10,6 +10,7 @@ import { useSharedPluginState } 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
12
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
13
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
13
14
|
var isEmptyParagraph = function isEmptyParagraph(node) {
|
|
14
15
|
return !!node && node.type.name === 'paragraph' && !node.childCount;
|
|
15
16
|
};
|
|
@@ -51,6 +52,12 @@ var LayoutBreakoutResizer = function LayoutBreakoutResizer(_ref) {
|
|
|
51
52
|
var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$s;
|
|
52
53
|
return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s = pluginInjectionApi.selection) === null || _pluginInjectionApi$s === void 0 ? void 0 : _pluginInjectionApi$s.commands.displayGapCursor(toggle))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
|
|
53
54
|
}, [pluginInjectionApi]);
|
|
55
|
+
var displayGuidelines = useCallback(function (guidelines) {
|
|
56
|
+
var _pluginInjectionApi$g;
|
|
57
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$g = pluginInjectionApi.guideline) === null || _pluginInjectionApi$g === void 0 || (_pluginInjectionApi$g = _pluginInjectionApi$g.actions) === null || _pluginInjectionApi$g === void 0 || _pluginInjectionApi$g.displayGuideline(view)({
|
|
58
|
+
guidelines: guidelines
|
|
59
|
+
});
|
|
60
|
+
}, [pluginInjectionApi, view]);
|
|
54
61
|
return /*#__PURE__*/React.createElement(BreakoutResizer, {
|
|
55
62
|
getRef: forwardRef,
|
|
56
63
|
getPos: getPos,
|
|
@@ -60,6 +67,7 @@ var LayoutBreakoutResizer = function LayoutBreakoutResizer(_ref) {
|
|
|
60
67
|
disabled: (editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled) === true || !isBreakoutAvailable(view.state.schema),
|
|
61
68
|
parentRef: parentRef,
|
|
62
69
|
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
|
|
70
|
+
displayGuidelines: editorExperiment('single_column_layouts', true) ? displayGuidelines : undefined,
|
|
63
71
|
displayGapCursor: displayGapCursor
|
|
64
72
|
});
|
|
65
73
|
};
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2
5
|
import React from 'react';
|
|
3
6
|
import commonMessages, { layoutMessages, layoutMessages as toolbarMessages } from '@atlaskit/editor-common/messages';
|
|
4
7
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
8
|
+
import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
5
9
|
import CopyIcon from '@atlaskit/icon/core/copy';
|
|
6
10
|
import DeleteIcon from '@atlaskit/icon/core/migration/delete--editor-remove';
|
|
7
11
|
import LayoutOneColumnIcon from '@atlaskit/icon/core/migration/layout-one-column--editor-layout-single';
|
|
@@ -10,6 +14,7 @@ import LayoutThreeColumnsSidebarsIcon from '@atlaskit/icon/core/migration/layout
|
|
|
10
14
|
import LayoutTwoColumnsIcon from '@atlaskit/icon/core/migration/layout-two-columns--editor-layout-two-equal';
|
|
11
15
|
import LayoutTwoColumnsSidebarLeftIcon from '@atlaskit/icon/core/migration/layout-two-columns-sidebar-left--editor-layout-two-left-sidebar';
|
|
12
16
|
import LayoutTwoColumnsSidebarRightIcon from '@atlaskit/icon/core/migration/layout-two-columns-sidebar-right--editor-layout-two-right-sidebar';
|
|
17
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
18
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
14
19
|
import { deleteActiveLayoutNode, getPresetLayout, setPresetLayout } from '../pm-plugins/actions';
|
|
15
20
|
import { LayoutThreeWithLeftSidebarsIcon } from './icons/LayoutThreeWithLeftSidebars';
|
|
@@ -212,9 +217,17 @@ export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout
|
|
|
212
217
|
}]
|
|
213
218
|
};
|
|
214
219
|
var layoutTypes = allowSingleColumnLayout ? LAYOUT_TYPES_WITH_SINGLE_COL : LAYOUT_TYPES;
|
|
220
|
+
var hoverDecorationProps = function hoverDecorationProps(nodeType, className) {
|
|
221
|
+
return fg('platform_editor_controls_patch_1') ? {
|
|
222
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
|
|
223
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className),
|
|
224
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
|
|
225
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className)
|
|
226
|
+
} : undefined;
|
|
227
|
+
};
|
|
215
228
|
var overflowMenu = {
|
|
216
229
|
type: 'overflow-dropdown',
|
|
217
|
-
options: [{
|
|
230
|
+
options: [_objectSpread({
|
|
218
231
|
title: 'Copy',
|
|
219
232
|
onClick: function onClick() {
|
|
220
233
|
var _api$core, _api$floatingToolbar;
|
|
@@ -225,13 +238,13 @@ export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout
|
|
|
225
238
|
icon: /*#__PURE__*/React.createElement(CopyIcon, {
|
|
226
239
|
label: "Copy"
|
|
227
240
|
})
|
|
228
|
-
}, {
|
|
241
|
+
}, hoverDecorationProps(nodeType, akEditorSelectedNodeClassName)), _objectSpread({
|
|
229
242
|
title: 'Delete',
|
|
230
243
|
onClick: deleteActiveLayoutNode(editorAnalyticsAPI),
|
|
231
244
|
icon: /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
232
245
|
label: "Delete"
|
|
233
246
|
})
|
|
234
|
-
}]
|
|
247
|
+
}, hoverDecorationProps(nodeType))]
|
|
235
248
|
};
|
|
236
249
|
return {
|
|
237
250
|
title: layoutToolbarTitle,
|
|
@@ -2,6 +2,7 @@ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/t
|
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
3
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
4
4
|
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
5
|
+
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
5
6
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
6
7
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
7
8
|
import type { insertLayoutColumnsWithAnalytics } from './pm-plugins/actions';
|
|
@@ -11,7 +12,8 @@ export type LayoutPluginDependencies = [
|
|
|
11
12
|
SelectionPlugin,
|
|
12
13
|
OptionalPlugin<AnalyticsPlugin>,
|
|
13
14
|
OptionalPlugin<WidthPlugin>,
|
|
14
|
-
OptionalPlugin<EditorDisabledPlugin
|
|
15
|
+
OptionalPlugin<EditorDisabledPlugin>,
|
|
16
|
+
OptionalPlugin<GuidelinePlugin>
|
|
15
17
|
];
|
|
16
18
|
export type LayoutPlugin = NextEditorPlugin<'layout', {
|
|
17
19
|
pluginConfiguration: LayoutPluginOptions | undefined;
|
|
@@ -2,6 +2,7 @@ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/t
|
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
3
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
4
4
|
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
5
|
+
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
5
6
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
6
7
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
7
8
|
import type { insertLayoutColumnsWithAnalytics } from './pm-plugins/actions';
|
|
@@ -11,7 +12,8 @@ export type LayoutPluginDependencies = [
|
|
|
11
12
|
SelectionPlugin,
|
|
12
13
|
OptionalPlugin<AnalyticsPlugin>,
|
|
13
14
|
OptionalPlugin<WidthPlugin>,
|
|
14
|
-
OptionalPlugin<EditorDisabledPlugin
|
|
15
|
+
OptionalPlugin<EditorDisabledPlugin>,
|
|
16
|
+
OptionalPlugin<GuidelinePlugin>
|
|
15
17
|
];
|
|
16
18
|
export type LayoutPlugin = NextEditorPlugin<'layout', {
|
|
17
19
|
pluginConfiguration: LayoutPluginOptions | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-layout",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"description": "Layout plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,16 +34,18 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
37
|
-
"@atlaskit/editor-common": "^102.
|
|
37
|
+
"@atlaskit/editor-common": "^102.15.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
39
39
|
"@atlaskit/editor-plugin-decorations": "^2.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
|
|
41
|
+
"@atlaskit/editor-plugin-guideline": "^2.0.0",
|
|
41
42
|
"@atlaskit/editor-plugin-selection": "^2.1.0",
|
|
42
43
|
"@atlaskit/editor-plugin-width": "^3.0.0",
|
|
43
44
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
44
|
-
"@atlaskit/
|
|
45
|
+
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
46
|
+
"@atlaskit/icon": "^25.3.0",
|
|
45
47
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
46
|
-
"@atlaskit/tmp-editor-statsig": "^4.
|
|
48
|
+
"@atlaskit/tmp-editor-statsig": "^4.6.0",
|
|
47
49
|
"@atlaskit/tokens": "^4.5.0",
|
|
48
50
|
"@babel/runtime": "^7.0.0",
|
|
49
51
|
"@emotion/react": "^11.7.1"
|
|
@@ -99,6 +101,9 @@
|
|
|
99
101
|
"platform-feature-flags": {
|
|
100
102
|
"platform-visual-refresh-icons": {
|
|
101
103
|
"type": "boolean"
|
|
104
|
+
},
|
|
105
|
+
"platform_editor_controls_patch_1": {
|
|
106
|
+
"type": "boolean"
|
|
102
107
|
}
|
|
103
108
|
}
|
|
104
109
|
}
|