@atlaskit/editor-plugin-layout 24.0.1 → 25.0.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 +15 -0
- package/dist/cjs/layoutPlugin.js +5 -1
- package/dist/cjs/pm-plugins/main.js +5 -1
- package/dist/es2019/layoutPlugin.js +5 -1
- package/dist/es2019/pm-plugins/main.js +3 -2
- package/dist/esm/layoutPlugin.js +5 -1
- package/dist/esm/pm-plugins/main.js +5 -1
- package/dist/types/layoutPluginType.d.ts +2 -0
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-layout
|
|
2
2
|
|
|
3
|
+
## 25.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`6e187a17c0713`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6e187a17c0713) -
|
|
8
|
+
Fix inner layout resize handles appearing when editor is in view mode despite not being able to
|
|
9
|
+
resize anything. Behind experiment `platform_editor_disable_view_layout_resize`
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 25.0.0
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 24.0.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/cjs/layoutPlugin.js
CHANGED
|
@@ -102,11 +102,15 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
|
|
|
102
102
|
}];
|
|
103
103
|
},
|
|
104
104
|
pmPlugins: function pmPlugins() {
|
|
105
|
+
var isViewMode = function isViewMode() {
|
|
106
|
+
var _api$editorViewMode;
|
|
107
|
+
return (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view';
|
|
108
|
+
};
|
|
105
109
|
var plugins = [{
|
|
106
110
|
name: 'layout',
|
|
107
111
|
plugin: function plugin() {
|
|
108
112
|
var _api$analytics;
|
|
109
|
-
return (0, _main.default)(options, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
113
|
+
return (0, _main.default)(options, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, isViewMode);
|
|
110
114
|
}
|
|
111
115
|
}];
|
|
112
116
|
plugins.push({
|
|
@@ -16,6 +16,7 @@ var _model = require("@atlaskit/editor-prosemirror/model");
|
|
|
16
16
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
17
17
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
18
18
|
var _view2 = require("@atlaskit/editor-prosemirror/view");
|
|
19
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
19
20
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
20
21
|
var _actions = require("./actions");
|
|
21
22
|
var _columnResizeDivider = require("./column-resize-divider");
|
|
@@ -212,6 +213,9 @@ var handleDeleteLayoutColumn = function handleDeleteLayoutColumn(state, dispatch
|
|
|
212
213
|
return false;
|
|
213
214
|
};
|
|
214
215
|
var _default = exports.default = function _default(options, editorAnalyticsAPI) {
|
|
216
|
+
var isViewMode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
|
|
217
|
+
return false;
|
|
218
|
+
};
|
|
215
219
|
// Store a reference to the EditorView so widget decorations can dispatch transactions
|
|
216
220
|
var editorViewRef;
|
|
217
221
|
return new _safePlugin.SafePlugin({
|
|
@@ -275,7 +279,7 @@ var _default = exports.default = function _default(options, editorAnalyticsAPI)
|
|
|
275
279
|
decorations: function decorations(state) {
|
|
276
280
|
var layoutState = _pluginKey.pluginKey.getState(state);
|
|
277
281
|
var isLayoutResizingPluginAvailable = _resizing.pluginKey.get(state) !== undefined;
|
|
278
|
-
if ((0, _editorExperiment.editorExperiment)('advanced_layouts', true) && isLayoutResizingPluginAvailable) {
|
|
282
|
+
if ((0, _editorExperiment.editorExperiment)('advanced_layouts', true) && isLayoutResizingPluginAvailable && !(isViewMode() && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_disable_view_layout_resize'))) {
|
|
279
283
|
var dividerDecorations = (0, _columnResizeDivider.getColumnDividerDecorations)(state, editorViewRef, editorAnalyticsAPI);
|
|
280
284
|
var selectedDecorations = layoutState.pos !== null ? getNodeDecoration(layoutState.pos, state.doc.nodeAt(layoutState.pos)) : [];
|
|
281
285
|
var _dangerPreviewDecorations = getDangerPreviewDecorations(state, layoutState.dangerPreviewLayoutColumnPositions);
|
|
@@ -94,11 +94,15 @@ export const layoutPlugin = ({
|
|
|
94
94
|
}];
|
|
95
95
|
},
|
|
96
96
|
pmPlugins() {
|
|
97
|
+
const isViewMode = () => {
|
|
98
|
+
var _api$editorViewMode, _api$editorViewMode$s;
|
|
99
|
+
return (api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : (_api$editorViewMode$s = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode$s === void 0 ? void 0 : _api$editorViewMode$s.mode) === 'view';
|
|
100
|
+
};
|
|
97
101
|
const plugins = [{
|
|
98
102
|
name: 'layout',
|
|
99
103
|
plugin: () => {
|
|
100
104
|
var _api$analytics;
|
|
101
|
-
return createLayoutPlugin(options, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
105
|
+
return createLayoutPlugin(options, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, isViewMode);
|
|
102
106
|
}
|
|
103
107
|
}];
|
|
104
108
|
plugins.push({
|
|
@@ -7,6 +7,7 @@ import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
|
7
7
|
import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
8
|
import { findParentNodeClosestToPos, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
9
9
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
10
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
10
11
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
11
12
|
import { fixColumnSizes, fixColumnStructure, getSelectedLayout, LAYOUT_COLUMN_INSERT_META } from './actions';
|
|
12
13
|
import { getColumnDividerDecorations } from './column-resize-divider';
|
|
@@ -213,7 +214,7 @@ const handleDeleteLayoutColumn = (state, dispatch) => {
|
|
|
213
214
|
}
|
|
214
215
|
return false;
|
|
215
216
|
};
|
|
216
|
-
export default ((options, editorAnalyticsAPI) => {
|
|
217
|
+
export default ((options, editorAnalyticsAPI, isViewMode = () => false) => {
|
|
217
218
|
// Store a reference to the EditorView so widget decorations can dispatch transactions
|
|
218
219
|
let editorViewRef;
|
|
219
220
|
return new SafePlugin({
|
|
@@ -275,7 +276,7 @@ export default ((options, editorAnalyticsAPI) => {
|
|
|
275
276
|
decorations(state) {
|
|
276
277
|
const layoutState = pluginKey.getState(state);
|
|
277
278
|
const isLayoutResizingPluginAvailable = layoutResizingPluginKey.get(state) !== undefined;
|
|
278
|
-
if (editorExperiment('advanced_layouts', true) && isLayoutResizingPluginAvailable) {
|
|
279
|
+
if (editorExperiment('advanced_layouts', true) && isLayoutResizingPluginAvailable && !(isViewMode() && isExperimentEnabled('platform_editor_disable_view_layout_resize'))) {
|
|
279
280
|
const dividerDecorations = getColumnDividerDecorations(state, editorViewRef, editorAnalyticsAPI);
|
|
280
281
|
const selectedDecorations = layoutState.pos !== null ? getNodeDecoration(layoutState.pos, state.doc.nodeAt(layoutState.pos)) : [];
|
|
281
282
|
const dangerPreviewDecorations = getDangerPreviewDecorations(state, layoutState.dangerPreviewLayoutColumnPositions);
|
package/dist/esm/layoutPlugin.js
CHANGED
|
@@ -95,11 +95,15 @@ export var layoutPlugin = function layoutPlugin(_ref) {
|
|
|
95
95
|
}];
|
|
96
96
|
},
|
|
97
97
|
pmPlugins: function pmPlugins() {
|
|
98
|
+
var isViewMode = function isViewMode() {
|
|
99
|
+
var _api$editorViewMode;
|
|
100
|
+
return (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view';
|
|
101
|
+
};
|
|
98
102
|
var plugins = [{
|
|
99
103
|
name: 'layout',
|
|
100
104
|
plugin: function plugin() {
|
|
101
105
|
var _api$analytics;
|
|
102
|
-
return createLayoutPlugin(options, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
106
|
+
return createLayoutPlugin(options, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, isViewMode);
|
|
103
107
|
}
|
|
104
108
|
}];
|
|
105
109
|
plugins.push({
|
|
@@ -11,6 +11,7 @@ import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
|
11
11
|
import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
12
12
|
import { findParentNodeClosestToPos, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
13
13
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
14
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
14
15
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
15
16
|
import { fixColumnSizes, fixColumnStructure, getSelectedLayout, LAYOUT_COLUMN_INSERT_META } from './actions';
|
|
16
17
|
import { getColumnDividerDecorations } from './column-resize-divider';
|
|
@@ -205,6 +206,9 @@ var handleDeleteLayoutColumn = function handleDeleteLayoutColumn(state, dispatch
|
|
|
205
206
|
return false;
|
|
206
207
|
};
|
|
207
208
|
export default (function (options, editorAnalyticsAPI) {
|
|
209
|
+
var isViewMode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
|
|
210
|
+
return false;
|
|
211
|
+
};
|
|
208
212
|
// Store a reference to the EditorView so widget decorations can dispatch transactions
|
|
209
213
|
var editorViewRef;
|
|
210
214
|
return new SafePlugin({
|
|
@@ -268,7 +272,7 @@ export default (function (options, editorAnalyticsAPI) {
|
|
|
268
272
|
decorations: function decorations(state) {
|
|
269
273
|
var layoutState = pluginKey.getState(state);
|
|
270
274
|
var isLayoutResizingPluginAvailable = layoutResizingPluginKey.get(state) !== undefined;
|
|
271
|
-
if (editorExperiment('advanced_layouts', true) && isLayoutResizingPluginAvailable) {
|
|
275
|
+
if (editorExperiment('advanced_layouts', true) && isLayoutResizingPluginAvailable && !(isViewMode() && isExperimentEnabled('platform_editor_disable_view_layout_resize'))) {
|
|
272
276
|
var dividerDecorations = getColumnDividerDecorations(state, editorViewRef, editorAnalyticsAPI);
|
|
273
277
|
var selectedDecorations = layoutState.pos !== null ? getNodeDecoration(layoutState.pos, state.doc.nodeAt(layoutState.pos)) : [];
|
|
274
278
|
var _dangerPreviewDecorations = getDangerPreviewDecorations(state, layoutState.dangerPreviewLayoutColumnPositions);
|
|
@@ -4,6 +4,7 @@ import type { BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls
|
|
|
4
4
|
import type { BlockMenuPlugin } from '@atlaskit/editor-plugin-block-menu';
|
|
5
5
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
6
6
|
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
7
|
+
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode/editorViewmodePluginType';
|
|
7
8
|
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
8
9
|
import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
|
|
9
10
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
@@ -20,6 +21,7 @@ export type LayoutPluginDependencies = [
|
|
|
20
21
|
OptionalPlugin<AnalyticsPlugin>,
|
|
21
22
|
OptionalPlugin<WidthPlugin>,
|
|
22
23
|
OptionalPlugin<EditorDisabledPlugin>,
|
|
24
|
+
OptionalPlugin<EditorViewModePlugin>,
|
|
23
25
|
OptionalPlugin<GuidelinePlugin>,
|
|
24
26
|
OptionalPlugin<InteractionPlugin>,
|
|
25
27
|
OptionalPlugin<BlockControlsPlugin>,
|
|
@@ -4,4 +4,4 @@ import type { LayoutPluginOptions } from '../types';
|
|
|
4
4
|
import type { LayoutState } from './types';
|
|
5
5
|
export declare const DEFAULT_LAYOUT = "two_equal";
|
|
6
6
|
export default _default;
|
|
7
|
-
declare function _default(options: LayoutPluginOptions, editorAnalyticsAPI?: EditorAnalyticsAPI): SafePlugin<LayoutState>;
|
|
7
|
+
declare function _default(options: LayoutPluginOptions, editorAnalyticsAPI?: EditorAnalyticsAPI, isViewMode?: () => boolean): SafePlugin<LayoutState>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-layout",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.1",
|
|
4
4
|
"description": "Layout plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@atlaskit/adf-schema": "^57.6.0",
|
|
25
25
|
"@atlaskit/css": "^1.1.0",
|
|
26
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
27
|
-
"@atlaskit/editor-plugin-block-controls": "^
|
|
28
|
-
"@atlaskit/editor-plugin-block-menu": "^
|
|
29
|
-
"@atlaskit/editor-plugin-decorations": "^
|
|
30
|
-
"@atlaskit/editor-plugin-editor-disabled": "^
|
|
31
|
-
"@atlaskit/editor-plugin-guideline": "^
|
|
32
|
-
"@atlaskit/editor-plugin-interaction": "^
|
|
33
|
-
"@atlaskit/editor-plugin-selection": "^
|
|
34
|
-
"@atlaskit/editor-plugin-toolbar": "^
|
|
35
|
-
"@atlaskit/editor-plugin-ui-control-registry": "^
|
|
36
|
-
"@atlaskit/editor-plugin-user-intent": "^
|
|
37
|
-
"@atlaskit/editor-plugin-width": "^
|
|
26
|
+
"@atlaskit/editor-plugin-analytics": "^24.0.0",
|
|
27
|
+
"@atlaskit/editor-plugin-block-controls": "^25.0.0",
|
|
28
|
+
"@atlaskit/editor-plugin-block-menu": "^23.0.0",
|
|
29
|
+
"@atlaskit/editor-plugin-decorations": "^24.0.0",
|
|
30
|
+
"@atlaskit/editor-plugin-editor-disabled": "^24.0.0",
|
|
31
|
+
"@atlaskit/editor-plugin-guideline": "^24.0.0",
|
|
32
|
+
"@atlaskit/editor-plugin-interaction": "^38.0.0",
|
|
33
|
+
"@atlaskit/editor-plugin-selection": "^24.0.0",
|
|
34
|
+
"@atlaskit/editor-plugin-toolbar": "^21.0.0",
|
|
35
|
+
"@atlaskit/editor-plugin-ui-control-registry": "^18.0.0",
|
|
36
|
+
"@atlaskit/editor-plugin-user-intent": "^22.0.0",
|
|
37
|
+
"@atlaskit/editor-plugin-width": "^25.0.0",
|
|
38
38
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
39
39
|
"@atlaskit/editor-shared-styles": "^4.3.0",
|
|
40
40
|
"@atlaskit/editor-toolbar": "^2.8.0",
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
"@atlaskit/icon-lab": "^7.11.0",
|
|
44
44
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
46
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
46
|
+
"@atlaskit/tmp-editor-statsig": "^221.0.0",
|
|
47
47
|
"@atlaskit/tokens": "^20.1.0",
|
|
48
48
|
"@babel/runtime": "^7.0.0",
|
|
49
49
|
"@emotion/react": "^11.7.1",
|
|
50
50
|
"bind-event-listener": "^3.0.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@atlaskit/editor-common": "^
|
|
53
|
+
"@atlaskit/editor-common": "^128.1.0",
|
|
54
54
|
"react": "^18.2.0 || ^19.2.0",
|
|
55
55
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
56
56
|
},
|