@atlaskit/editor-plugin-breakout 2.2.5 → 2.2.6
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 +10 -0
- package/dist/cjs/breakoutPlugin.js +2 -2
- package/dist/cjs/editor-commands/set-breakout-width.js +22 -0
- package/dist/cjs/pm-plugins/resizer-callbacks.js +76 -0
- package/dist/cjs/pm-plugins/resizing-mark-view.js +16 -11
- package/dist/cjs/pm-plugins/resizing-plugin.js +2 -2
- package/dist/es2019/breakoutPlugin.js +2 -2
- package/dist/es2019/editor-commands/set-breakout-width.js +16 -0
- package/dist/es2019/pm-plugins/resizer-callbacks.js +74 -0
- package/dist/es2019/pm-plugins/resizing-mark-view.js +15 -10
- package/dist/es2019/pm-plugins/resizing-plugin.js +2 -2
- package/dist/esm/breakoutPlugin.js +2 -2
- package/dist/esm/editor-commands/set-breakout-width.js +16 -0
- package/dist/esm/pm-plugins/resizer-callbacks.js +70 -0
- package/dist/esm/pm-plugins/resizing-mark-view.js +15 -10
- package/dist/esm/pm-plugins/resizing-plugin.js +2 -2
- package/dist/types/breakoutPluginType.d.ts +3 -1
- package/dist/types/editor-commands/set-breakout-width.d.ts +2 -0
- package/dist/types/pm-plugins/resizer-callbacks.d.ts +16 -0
- package/dist/types/pm-plugins/resizing-mark-view.d.ts +5 -1
- package/dist/types/pm-plugins/resizing-plugin.d.ts +3 -1
- package/dist/types-ts4.5/breakoutPluginType.d.ts +3 -1
- package/dist/types-ts4.5/editor-commands/set-breakout-width.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/resizer-callbacks.d.ts +16 -0
- package/dist/types-ts4.5/pm-plugins/resizing-mark-view.d.ts +5 -1
- package/dist/types-ts4.5/pm-plugins/resizing-plugin.d.ts +3 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-breakout
|
|
2
2
|
|
|
3
|
+
## 2.2.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#157540](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/157540)
|
|
8
|
+
[`16b7448512972`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/16b7448512972) -
|
|
9
|
+
[ux] [ED-28038] this change adds the drag callbacks to the new resizing experience behind the
|
|
10
|
+
platform_editor_breakout_resizing experiment.
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 2.2.5
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -74,7 +74,7 @@ function shouldPluginStateUpdate(newBreakoutNode, currentBreakoutNode) {
|
|
|
74
74
|
}
|
|
75
75
|
return newBreakoutNode || currentBreakoutNode ? true : false;
|
|
76
76
|
}
|
|
77
|
-
function createPlugin(
|
|
77
|
+
function createPlugin(api, _ref) {
|
|
78
78
|
var dispatch = _ref.dispatch;
|
|
79
79
|
return new _safePlugin.SafePlugin({
|
|
80
80
|
state: {
|
|
@@ -178,7 +178,7 @@ var breakoutPlugin = exports.breakoutPlugin = function breakoutPlugin(_ref3) {
|
|
|
178
178
|
return [{
|
|
179
179
|
name: 'breakout-resizing',
|
|
180
180
|
plugin: function plugin() {
|
|
181
|
-
return (0, _resizingPlugin.createResizingPlugin)();
|
|
181
|
+
return (0, _resizingPlugin.createResizingPlugin)(api);
|
|
182
182
|
}
|
|
183
183
|
}];
|
|
184
184
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.setBreakoutWidth = setBreakoutWidth;
|
|
7
|
+
// TODO: ED-28029 - add fixes for expands and codeblocks
|
|
8
|
+
function setBreakoutWidth(width, pos, isLivePage) {
|
|
9
|
+
return function (state, dispatch) {
|
|
10
|
+
var node = state.doc.nodeAt(pos);
|
|
11
|
+
if (!node) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
var tr = state.tr.setNodeMarkup(pos, node.type, node.attrs, [state.schema.marks.breakout.create({
|
|
15
|
+
width: width
|
|
16
|
+
})]);
|
|
17
|
+
if (dispatch) {
|
|
18
|
+
dispatch(tr);
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createResizerCallbacks = createResizerCallbacks;
|
|
7
|
+
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
8
|
+
var _preventUnhandled = require("@atlaskit/pragmatic-drag-and-drop/prevent-unhandled");
|
|
9
|
+
var _setBreakoutWidth = require("../editor-commands/set-breakout-width");
|
|
10
|
+
var _resizingMarkView = require("./resizing-mark-view");
|
|
11
|
+
var RESIZE_RATIO = 2;
|
|
12
|
+
var WIDTHS = {
|
|
13
|
+
MIN: 760,
|
|
14
|
+
MAX: 1800
|
|
15
|
+
};
|
|
16
|
+
function getProposedWidth(_ref) {
|
|
17
|
+
var _api$width$sharedStat;
|
|
18
|
+
var initialWidth = _ref.initialWidth,
|
|
19
|
+
location = _ref.location,
|
|
20
|
+
api = _ref.api;
|
|
21
|
+
var diffX = (location.current.input.clientX - location.initial.input.clientX) * RESIZE_RATIO;
|
|
22
|
+
var proposedWidth = initialWidth + diffX;
|
|
23
|
+
|
|
24
|
+
// TODO: ED-28024 - add snapping logic
|
|
25
|
+
|
|
26
|
+
var containerWidth = ((api === null || api === void 0 || (_api$width$sharedStat = api.width.sharedState) === null || _api$width$sharedStat === void 0 || (_api$width$sharedStat = _api$width$sharedStat.currentState()) === null || _api$width$sharedStat === void 0 ? void 0 : _api$width$sharedStat.width) || 0) - 2 * (0, _editorSharedStyles.akEditorGutterPaddingDynamic)() - _editorSharedStyles.akEditorGutterPadding;
|
|
27
|
+
return Math.min(Math.max(WIDTHS.MIN, Math.min(proposedWidth, containerWidth)), WIDTHS.MAX);
|
|
28
|
+
}
|
|
29
|
+
;
|
|
30
|
+
function createResizerCallbacks(_ref2) {
|
|
31
|
+
var dom = _ref2.dom,
|
|
32
|
+
contentDOM = _ref2.contentDOM,
|
|
33
|
+
view = _ref2.view,
|
|
34
|
+
mark = _ref2.mark,
|
|
35
|
+
api = _ref2.api;
|
|
36
|
+
return {
|
|
37
|
+
onDragStart: function onDragStart() {
|
|
38
|
+
requestAnimationFrame(function () {
|
|
39
|
+
var _api$userIntent;
|
|
40
|
+
// TODO: ED-28027 - add guidelines
|
|
41
|
+
api === null || api === void 0 || api.core.actions.execute((_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.commands.setCurrentUserIntent('dragging'));
|
|
42
|
+
});
|
|
43
|
+
view.dispatch(view.state.tr.setMeta('is-resizer-resizing', true));
|
|
44
|
+
},
|
|
45
|
+
onDrag: function onDrag(_ref3) {
|
|
46
|
+
var location = _ref3.location;
|
|
47
|
+
var initialWidth = mark.attrs.width;
|
|
48
|
+
var newWidth = getProposedWidth({
|
|
49
|
+
initialWidth: initialWidth,
|
|
50
|
+
location: location,
|
|
51
|
+
api: api
|
|
52
|
+
});
|
|
53
|
+
contentDOM.style.setProperty(_resizingMarkView.LOCAL_RESIZE_PROPERTY, "".concat(newWidth, "px"));
|
|
54
|
+
},
|
|
55
|
+
onDrop: function onDrop(_ref4) {
|
|
56
|
+
var _api$userIntent2;
|
|
57
|
+
var location = _ref4.location;
|
|
58
|
+
// TODO: ED-28027 - remove guidelines
|
|
59
|
+
_preventUnhandled.preventUnhandled.stop();
|
|
60
|
+
var pos = view.posAtDOM(dom, 0);
|
|
61
|
+
if (pos === undefined) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
var initialWidth = mark.attrs.width;
|
|
65
|
+
var newWidth = getProposedWidth({
|
|
66
|
+
initialWidth: initialWidth,
|
|
67
|
+
location: location,
|
|
68
|
+
api: api
|
|
69
|
+
});
|
|
70
|
+
(0, _setBreakoutWidth.setBreakoutWidth)(newWidth, pos)(view.state, view.dispatch);
|
|
71
|
+
contentDOM.style.removeProperty(_resizingMarkView.LOCAL_RESIZE_PROPERTY);
|
|
72
|
+
view.dispatch(view.state.tr.setMeta('is-resizer-resizing', false).setMeta('scrollIntoView', false));
|
|
73
|
+
api === null || api === void 0 || api.core.actions.execute((_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.commands.setCurrentUserIntent('default'));
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
@@ -4,14 +4,15 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.ResizingMarkView = void 0;
|
|
7
|
+
exports.ResizingMarkView = exports.LOCAL_RESIZE_PROPERTY = void 0;
|
|
8
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
10
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
11
11
|
var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
12
12
|
var _disableNativeDragPreview = require("@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview");
|
|
13
13
|
var _preventUnhandled = require("@atlaskit/pragmatic-drag-and-drop/prevent-unhandled");
|
|
14
|
-
var
|
|
14
|
+
var _resizerCallbacks = require("./resizer-callbacks");
|
|
15
|
+
var LOCAL_RESIZE_PROPERTY = exports.LOCAL_RESIZE_PROPERTY = '--local-resizing-width';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
*
|
|
@@ -21,11 +22,12 @@ var ResizingMarkView = exports.ResizingMarkView = /*#__PURE__*/function () {
|
|
|
21
22
|
* Wrap node view in a resizing mark view
|
|
22
23
|
* @param {Mark} mark - The breakout mark to resize
|
|
23
24
|
* @param {EditorView} view - The editor view
|
|
25
|
+
* @param {ExtractInjectionAPI<BreakoutPlugin> | undefined} api - the pluginInjectionAPI
|
|
24
26
|
* @example
|
|
25
27
|
* ```ts
|
|
26
28
|
* ```
|
|
27
29
|
*/
|
|
28
|
-
function ResizingMarkView(mark, view) {
|
|
30
|
+
function ResizingMarkView(mark, view, api) {
|
|
29
31
|
(0, _classCallCheck2.default)(this, ResizingMarkView);
|
|
30
32
|
var dom = document.createElement('div');
|
|
31
33
|
var contentDOM = document.createElement('div');
|
|
@@ -44,21 +46,24 @@ var ResizingMarkView = exports.ResizingMarkView = /*#__PURE__*/function () {
|
|
|
44
46
|
contentDOM.style.gridRow = '1';
|
|
45
47
|
contentDOM.style.gridColumn = '1';
|
|
46
48
|
if (mark.attrs.width) {
|
|
47
|
-
contentDOM.style.minWidth = "min(var(".concat(
|
|
49
|
+
contentDOM.style.minWidth = "min(var(".concat(LOCAL_RESIZE_PROPERTY, ", ").concat(mark.attrs.width, "px), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding)))");
|
|
48
50
|
} else {
|
|
49
51
|
if (mark.attrs.mode === 'wide') {
|
|
50
|
-
contentDOM.style.minWidth = "max(var(--ak-editor--line-length), min(var(".concat(
|
|
52
|
+
contentDOM.style.minWidth = "max(var(--ak-editor--line-length), min(var(".concat(LOCAL_RESIZE_PROPERTY, ", var(--ak-editor--breakout-wide-layout-width)), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))");
|
|
51
53
|
}
|
|
52
54
|
if (mark.attrs.mode === 'full-width') {
|
|
53
|
-
contentDOM.style.minWidth = "max(var(--ak-editor--line-length), min(var(".concat(
|
|
55
|
+
contentDOM.style.minWidth = "max(var(--ak-editor--line-length), min(var(".concat(LOCAL_RESIZE_PROPERTY, ", var(--ak-editor--full-width-layout-width)), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))");
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
58
|
dom.appendChild(contentDOM);
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
var callbacks = (0, _resizerCallbacks.createResizerCallbacks)({
|
|
60
|
+
dom: dom,
|
|
61
|
+
contentDOM: contentDOM,
|
|
62
|
+
view: view,
|
|
63
|
+
mark: mark,
|
|
64
|
+
api: api
|
|
65
|
+
});
|
|
66
|
+
var _createPragmaticResiz = createPragmaticResizer(callbacks),
|
|
62
67
|
leftHandle = _createPragmaticResiz.leftHandle,
|
|
63
68
|
rightHandle = _createPragmaticResiz.rightHandle,
|
|
64
69
|
destroy = _createPragmaticResiz.destroy;
|
|
@@ -8,13 +8,13 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
|
8
8
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
9
|
var _resizingMarkView = require("./resizing-mark-view");
|
|
10
10
|
var resizingPluginKey = exports.resizingPluginKey = new _state.PluginKey('breakout-resizing');
|
|
11
|
-
var createResizingPlugin = exports.createResizingPlugin = function createResizingPlugin() {
|
|
11
|
+
var createResizingPlugin = exports.createResizingPlugin = function createResizingPlugin(api) {
|
|
12
12
|
return new _safePlugin.SafePlugin({
|
|
13
13
|
key: resizingPluginKey,
|
|
14
14
|
props: {
|
|
15
15
|
markViews: {
|
|
16
16
|
breakout: function breakout(mark, view) {
|
|
17
|
-
return new _resizingMarkView.ResizingMarkView(mark, view);
|
|
17
|
+
return new _resizingMarkView.ResizingMarkView(mark, view, api);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -63,7 +63,7 @@ function shouldPluginStateUpdate(newBreakoutNode, currentBreakoutNode) {
|
|
|
63
63
|
}
|
|
64
64
|
return newBreakoutNode || currentBreakoutNode ? true : false;
|
|
65
65
|
}
|
|
66
|
-
function createPlugin(
|
|
66
|
+
function createPlugin(api, {
|
|
67
67
|
dispatch
|
|
68
68
|
}) {
|
|
69
69
|
return new SafePlugin({
|
|
@@ -171,7 +171,7 @@ export const breakoutPlugin = ({
|
|
|
171
171
|
if (editorExperiment('platform_editor_breakout_resizing', true)) {
|
|
172
172
|
return [{
|
|
173
173
|
name: 'breakout-resizing',
|
|
174
|
-
plugin: () => createResizingPlugin()
|
|
174
|
+
plugin: () => createResizingPlugin(api)
|
|
175
175
|
}];
|
|
176
176
|
}
|
|
177
177
|
return [{
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// TODO: ED-28029 - add fixes for expands and codeblocks
|
|
2
|
+
export function setBreakoutWidth(width, pos, isLivePage) {
|
|
3
|
+
return (state, dispatch) => {
|
|
4
|
+
const node = state.doc.nodeAt(pos);
|
|
5
|
+
if (!node) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
const tr = state.tr.setNodeMarkup(pos, node.type, node.attrs, [state.schema.marks.breakout.create({
|
|
9
|
+
width
|
|
10
|
+
})]);
|
|
11
|
+
if (dispatch) {
|
|
12
|
+
dispatch(tr);
|
|
13
|
+
}
|
|
14
|
+
return true;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { akEditorGutterPaddingDynamic, akEditorGutterPadding } from "@atlaskit/editor-shared-styles";
|
|
2
|
+
import { preventUnhandled } from "@atlaskit/pragmatic-drag-and-drop/prevent-unhandled";
|
|
3
|
+
import { setBreakoutWidth } from "../editor-commands/set-breakout-width";
|
|
4
|
+
import { LOCAL_RESIZE_PROPERTY } from "./resizing-mark-view";
|
|
5
|
+
const RESIZE_RATIO = 2;
|
|
6
|
+
const WIDTHS = {
|
|
7
|
+
MIN: 760,
|
|
8
|
+
MAX: 1800
|
|
9
|
+
};
|
|
10
|
+
function getProposedWidth({
|
|
11
|
+
initialWidth,
|
|
12
|
+
location,
|
|
13
|
+
api
|
|
14
|
+
}) {
|
|
15
|
+
var _api$width$sharedStat, _api$width$sharedStat2;
|
|
16
|
+
const diffX = (location.current.input.clientX - location.initial.input.clientX) * RESIZE_RATIO;
|
|
17
|
+
const proposedWidth = initialWidth + diffX;
|
|
18
|
+
|
|
19
|
+
// TODO: ED-28024 - add snapping logic
|
|
20
|
+
|
|
21
|
+
const containerWidth = ((api === null || api === void 0 ? void 0 : (_api$width$sharedStat = api.width.sharedState) === null || _api$width$sharedStat === void 0 ? void 0 : (_api$width$sharedStat2 = _api$width$sharedStat.currentState()) === null || _api$width$sharedStat2 === void 0 ? void 0 : _api$width$sharedStat2.width) || 0) - 2 * akEditorGutterPaddingDynamic() - akEditorGutterPadding;
|
|
22
|
+
return Math.min(Math.max(WIDTHS.MIN, Math.min(proposedWidth, containerWidth)), WIDTHS.MAX);
|
|
23
|
+
}
|
|
24
|
+
;
|
|
25
|
+
export function createResizerCallbacks({
|
|
26
|
+
dom,
|
|
27
|
+
contentDOM,
|
|
28
|
+
view,
|
|
29
|
+
mark,
|
|
30
|
+
api
|
|
31
|
+
}) {
|
|
32
|
+
return {
|
|
33
|
+
onDragStart: () => {
|
|
34
|
+
requestAnimationFrame(() => {
|
|
35
|
+
var _api$userIntent;
|
|
36
|
+
// TODO: ED-28027 - add guidelines
|
|
37
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute((_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.commands.setCurrentUserIntent('dragging'));
|
|
38
|
+
});
|
|
39
|
+
view.dispatch(view.state.tr.setMeta('is-resizer-resizing', true));
|
|
40
|
+
},
|
|
41
|
+
onDrag: ({
|
|
42
|
+
location
|
|
43
|
+
}) => {
|
|
44
|
+
const initialWidth = mark.attrs.width;
|
|
45
|
+
const newWidth = getProposedWidth({
|
|
46
|
+
initialWidth,
|
|
47
|
+
location,
|
|
48
|
+
api
|
|
49
|
+
});
|
|
50
|
+
contentDOM.style.setProperty(LOCAL_RESIZE_PROPERTY, `${newWidth}px`);
|
|
51
|
+
},
|
|
52
|
+
onDrop({
|
|
53
|
+
location
|
|
54
|
+
}) {
|
|
55
|
+
var _api$userIntent2;
|
|
56
|
+
// TODO: ED-28027 - remove guidelines
|
|
57
|
+
preventUnhandled.stop();
|
|
58
|
+
const pos = view.posAtDOM(dom, 0);
|
|
59
|
+
if (pos === undefined) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const initialWidth = mark.attrs.width;
|
|
63
|
+
const newWidth = getProposedWidth({
|
|
64
|
+
initialWidth,
|
|
65
|
+
location,
|
|
66
|
+
api
|
|
67
|
+
});
|
|
68
|
+
setBreakoutWidth(newWidth, pos)(view.state, view.dispatch);
|
|
69
|
+
contentDOM.style.removeProperty(LOCAL_RESIZE_PROPERTY);
|
|
70
|
+
view.dispatch(view.state.tr.setMeta('is-resizer-resizing', false).setMeta('scrollIntoView', false));
|
|
71
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute((_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.commands.setCurrentUserIntent('default'));
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -2,7 +2,8 @@ import { BreakoutCssClassName } from '@atlaskit/editor-common/styles';
|
|
|
2
2
|
import { draggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
3
3
|
import { disableNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview';
|
|
4
4
|
import { preventUnhandled } from '@atlaskit/pragmatic-drag-and-drop/prevent-unhandled';
|
|
5
|
-
|
|
5
|
+
import { createResizerCallbacks } from './resizer-callbacks';
|
|
6
|
+
export const LOCAL_RESIZE_PROPERTY = '--local-resizing-width';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
*
|
|
@@ -12,11 +13,12 @@ export class ResizingMarkView {
|
|
|
12
13
|
* Wrap node view in a resizing mark view
|
|
13
14
|
* @param {Mark} mark - The breakout mark to resize
|
|
14
15
|
* @param {EditorView} view - The editor view
|
|
16
|
+
* @param {ExtractInjectionAPI<BreakoutPlugin> | undefined} api - the pluginInjectionAPI
|
|
15
17
|
* @example
|
|
16
18
|
* ```ts
|
|
17
19
|
* ```
|
|
18
20
|
*/
|
|
19
|
-
constructor(mark, view) {
|
|
21
|
+
constructor(mark, view, api) {
|
|
20
22
|
const dom = document.createElement('div');
|
|
21
23
|
const contentDOM = document.createElement('div');
|
|
22
24
|
contentDOM.className = BreakoutCssClassName.BREAKOUT_MARK_DOM;
|
|
@@ -34,25 +36,28 @@ export class ResizingMarkView {
|
|
|
34
36
|
contentDOM.style.gridRow = '1';
|
|
35
37
|
contentDOM.style.gridColumn = '1';
|
|
36
38
|
if (mark.attrs.width) {
|
|
37
|
-
contentDOM.style.minWidth = `min(var(${
|
|
39
|
+
contentDOM.style.minWidth = `min(var(${LOCAL_RESIZE_PROPERTY}, ${mark.attrs.width}px), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding)))`;
|
|
38
40
|
} else {
|
|
39
41
|
if (mark.attrs.mode === 'wide') {
|
|
40
|
-
contentDOM.style.minWidth = `max(var(--ak-editor--line-length), min(var(${
|
|
42
|
+
contentDOM.style.minWidth = `max(var(--ak-editor--line-length), min(var(${LOCAL_RESIZE_PROPERTY}, var(--ak-editor--breakout-wide-layout-width)), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))`;
|
|
41
43
|
}
|
|
42
44
|
if (mark.attrs.mode === 'full-width') {
|
|
43
|
-
contentDOM.style.minWidth = `max(var(--ak-editor--line-length), min(var(${
|
|
45
|
+
contentDOM.style.minWidth = `max(var(--ak-editor--line-length), min(var(${LOCAL_RESIZE_PROPERTY}, var(--ak-editor--full-width-layout-width)), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))`;
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
dom.appendChild(contentDOM);
|
|
49
|
+
const callbacks = createResizerCallbacks({
|
|
50
|
+
dom,
|
|
51
|
+
contentDOM,
|
|
52
|
+
view,
|
|
53
|
+
mark,
|
|
54
|
+
api
|
|
55
|
+
});
|
|
47
56
|
const {
|
|
48
57
|
leftHandle,
|
|
49
58
|
rightHandle,
|
|
50
59
|
destroy
|
|
51
|
-
} = createPragmaticResizer(
|
|
52
|
-
onDragStart: () => {},
|
|
53
|
-
onDrag: () => {},
|
|
54
|
-
onDrop: () => {}
|
|
55
|
-
});
|
|
60
|
+
} = createPragmaticResizer(callbacks);
|
|
56
61
|
dom.prepend(leftHandle);
|
|
57
62
|
dom.appendChild(rightHandle);
|
|
58
63
|
this.dom = dom;
|
|
@@ -2,13 +2,13 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { ResizingMarkView } from './resizing-mark-view';
|
|
4
4
|
export const resizingPluginKey = new PluginKey('breakout-resizing');
|
|
5
|
-
export const createResizingPlugin =
|
|
5
|
+
export const createResizingPlugin = api => {
|
|
6
6
|
return new SafePlugin({
|
|
7
7
|
key: resizingPluginKey,
|
|
8
8
|
props: {
|
|
9
9
|
markViews: {
|
|
10
10
|
breakout: (mark, view) => {
|
|
11
|
-
return new ResizingMarkView(mark, view);
|
|
11
|
+
return new ResizingMarkView(mark, view, api);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -67,7 +67,7 @@ function shouldPluginStateUpdate(newBreakoutNode, currentBreakoutNode) {
|
|
|
67
67
|
}
|
|
68
68
|
return newBreakoutNode || currentBreakoutNode ? true : false;
|
|
69
69
|
}
|
|
70
|
-
function createPlugin(
|
|
70
|
+
function createPlugin(api, _ref) {
|
|
71
71
|
var dispatch = _ref.dispatch;
|
|
72
72
|
return new SafePlugin({
|
|
73
73
|
state: {
|
|
@@ -171,7 +171,7 @@ export var breakoutPlugin = function breakoutPlugin(_ref3) {
|
|
|
171
171
|
return [{
|
|
172
172
|
name: 'breakout-resizing',
|
|
173
173
|
plugin: function plugin() {
|
|
174
|
-
return createResizingPlugin();
|
|
174
|
+
return createResizingPlugin(api);
|
|
175
175
|
}
|
|
176
176
|
}];
|
|
177
177
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// TODO: ED-28029 - add fixes for expands and codeblocks
|
|
2
|
+
export function setBreakoutWidth(width, pos, isLivePage) {
|
|
3
|
+
return function (state, dispatch) {
|
|
4
|
+
var node = state.doc.nodeAt(pos);
|
|
5
|
+
if (!node) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
var tr = state.tr.setNodeMarkup(pos, node.type, node.attrs, [state.schema.marks.breakout.create({
|
|
9
|
+
width: width
|
|
10
|
+
})]);
|
|
11
|
+
if (dispatch) {
|
|
12
|
+
dispatch(tr);
|
|
13
|
+
}
|
|
14
|
+
return true;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { akEditorGutterPaddingDynamic, akEditorGutterPadding } from "@atlaskit/editor-shared-styles";
|
|
2
|
+
import { preventUnhandled } from "@atlaskit/pragmatic-drag-and-drop/prevent-unhandled";
|
|
3
|
+
import { setBreakoutWidth } from "../editor-commands/set-breakout-width";
|
|
4
|
+
import { LOCAL_RESIZE_PROPERTY } from "./resizing-mark-view";
|
|
5
|
+
var RESIZE_RATIO = 2;
|
|
6
|
+
var WIDTHS = {
|
|
7
|
+
MIN: 760,
|
|
8
|
+
MAX: 1800
|
|
9
|
+
};
|
|
10
|
+
function getProposedWidth(_ref) {
|
|
11
|
+
var _api$width$sharedStat;
|
|
12
|
+
var initialWidth = _ref.initialWidth,
|
|
13
|
+
location = _ref.location,
|
|
14
|
+
api = _ref.api;
|
|
15
|
+
var diffX = (location.current.input.clientX - location.initial.input.clientX) * RESIZE_RATIO;
|
|
16
|
+
var proposedWidth = initialWidth + diffX;
|
|
17
|
+
|
|
18
|
+
// TODO: ED-28024 - add snapping logic
|
|
19
|
+
|
|
20
|
+
var containerWidth = ((api === null || api === void 0 || (_api$width$sharedStat = api.width.sharedState) === null || _api$width$sharedStat === void 0 || (_api$width$sharedStat = _api$width$sharedStat.currentState()) === null || _api$width$sharedStat === void 0 ? void 0 : _api$width$sharedStat.width) || 0) - 2 * akEditorGutterPaddingDynamic() - akEditorGutterPadding;
|
|
21
|
+
return Math.min(Math.max(WIDTHS.MIN, Math.min(proposedWidth, containerWidth)), WIDTHS.MAX);
|
|
22
|
+
}
|
|
23
|
+
;
|
|
24
|
+
export function createResizerCallbacks(_ref2) {
|
|
25
|
+
var dom = _ref2.dom,
|
|
26
|
+
contentDOM = _ref2.contentDOM,
|
|
27
|
+
view = _ref2.view,
|
|
28
|
+
mark = _ref2.mark,
|
|
29
|
+
api = _ref2.api;
|
|
30
|
+
return {
|
|
31
|
+
onDragStart: function onDragStart() {
|
|
32
|
+
requestAnimationFrame(function () {
|
|
33
|
+
var _api$userIntent;
|
|
34
|
+
// TODO: ED-28027 - add guidelines
|
|
35
|
+
api === null || api === void 0 || api.core.actions.execute((_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.commands.setCurrentUserIntent('dragging'));
|
|
36
|
+
});
|
|
37
|
+
view.dispatch(view.state.tr.setMeta('is-resizer-resizing', true));
|
|
38
|
+
},
|
|
39
|
+
onDrag: function onDrag(_ref3) {
|
|
40
|
+
var location = _ref3.location;
|
|
41
|
+
var initialWidth = mark.attrs.width;
|
|
42
|
+
var newWidth = getProposedWidth({
|
|
43
|
+
initialWidth: initialWidth,
|
|
44
|
+
location: location,
|
|
45
|
+
api: api
|
|
46
|
+
});
|
|
47
|
+
contentDOM.style.setProperty(LOCAL_RESIZE_PROPERTY, "".concat(newWidth, "px"));
|
|
48
|
+
},
|
|
49
|
+
onDrop: function onDrop(_ref4) {
|
|
50
|
+
var _api$userIntent2;
|
|
51
|
+
var location = _ref4.location;
|
|
52
|
+
// TODO: ED-28027 - remove guidelines
|
|
53
|
+
preventUnhandled.stop();
|
|
54
|
+
var pos = view.posAtDOM(dom, 0);
|
|
55
|
+
if (pos === undefined) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
var initialWidth = mark.attrs.width;
|
|
59
|
+
var newWidth = getProposedWidth({
|
|
60
|
+
initialWidth: initialWidth,
|
|
61
|
+
location: location,
|
|
62
|
+
api: api
|
|
63
|
+
});
|
|
64
|
+
setBreakoutWidth(newWidth, pos)(view.state, view.dispatch);
|
|
65
|
+
contentDOM.style.removeProperty(LOCAL_RESIZE_PROPERTY);
|
|
66
|
+
view.dispatch(view.state.tr.setMeta('is-resizer-resizing', false).setMeta('scrollIntoView', false));
|
|
67
|
+
api === null || api === void 0 || api.core.actions.execute((_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.commands.setCurrentUserIntent('default'));
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -4,7 +4,8 @@ import { BreakoutCssClassName } from '@atlaskit/editor-common/styles';
|
|
|
4
4
|
import { draggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
5
5
|
import { disableNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview';
|
|
6
6
|
import { preventUnhandled } from '@atlaskit/pragmatic-drag-and-drop/prevent-unhandled';
|
|
7
|
-
|
|
7
|
+
import { createResizerCallbacks } from './resizer-callbacks';
|
|
8
|
+
export var LOCAL_RESIZE_PROPERTY = '--local-resizing-width';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
*
|
|
@@ -14,11 +15,12 @@ export var ResizingMarkView = /*#__PURE__*/function () {
|
|
|
14
15
|
* Wrap node view in a resizing mark view
|
|
15
16
|
* @param {Mark} mark - The breakout mark to resize
|
|
16
17
|
* @param {EditorView} view - The editor view
|
|
18
|
+
* @param {ExtractInjectionAPI<BreakoutPlugin> | undefined} api - the pluginInjectionAPI
|
|
17
19
|
* @example
|
|
18
20
|
* ```ts
|
|
19
21
|
* ```
|
|
20
22
|
*/
|
|
21
|
-
function ResizingMarkView(mark, view) {
|
|
23
|
+
function ResizingMarkView(mark, view, api) {
|
|
22
24
|
_classCallCheck(this, ResizingMarkView);
|
|
23
25
|
var dom = document.createElement('div');
|
|
24
26
|
var contentDOM = document.createElement('div');
|
|
@@ -37,21 +39,24 @@ export var ResizingMarkView = /*#__PURE__*/function () {
|
|
|
37
39
|
contentDOM.style.gridRow = '1';
|
|
38
40
|
contentDOM.style.gridColumn = '1';
|
|
39
41
|
if (mark.attrs.width) {
|
|
40
|
-
contentDOM.style.minWidth = "min(var(".concat(
|
|
42
|
+
contentDOM.style.minWidth = "min(var(".concat(LOCAL_RESIZE_PROPERTY, ", ").concat(mark.attrs.width, "px), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding)))");
|
|
41
43
|
} else {
|
|
42
44
|
if (mark.attrs.mode === 'wide') {
|
|
43
|
-
contentDOM.style.minWidth = "max(var(--ak-editor--line-length), min(var(".concat(
|
|
45
|
+
contentDOM.style.minWidth = "max(var(--ak-editor--line-length), min(var(".concat(LOCAL_RESIZE_PROPERTY, ", var(--ak-editor--breakout-wide-layout-width)), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))");
|
|
44
46
|
}
|
|
45
47
|
if (mark.attrs.mode === 'full-width') {
|
|
46
|
-
contentDOM.style.minWidth = "max(var(--ak-editor--line-length), min(var(".concat(
|
|
48
|
+
contentDOM.style.minWidth = "max(var(--ak-editor--line-length), min(var(".concat(LOCAL_RESIZE_PROPERTY, ", var(--ak-editor--full-width-layout-width)), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))");
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
51
|
dom.appendChild(contentDOM);
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
var callbacks = createResizerCallbacks({
|
|
53
|
+
dom: dom,
|
|
54
|
+
contentDOM: contentDOM,
|
|
55
|
+
view: view,
|
|
56
|
+
mark: mark,
|
|
57
|
+
api: api
|
|
58
|
+
});
|
|
59
|
+
var _createPragmaticResiz = createPragmaticResizer(callbacks),
|
|
55
60
|
leftHandle = _createPragmaticResiz.leftHandle,
|
|
56
61
|
rightHandle = _createPragmaticResiz.rightHandle,
|
|
57
62
|
destroy = _createPragmaticResiz.destroy;
|
|
@@ -2,13 +2,13 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { ResizingMarkView } from './resizing-mark-view';
|
|
4
4
|
export var resizingPluginKey = new PluginKey('breakout-resizing');
|
|
5
|
-
export var createResizingPlugin = function createResizingPlugin() {
|
|
5
|
+
export var createResizingPlugin = function createResizingPlugin(api) {
|
|
6
6
|
return new SafePlugin({
|
|
7
7
|
key: resizingPluginKey,
|
|
8
8
|
props: {
|
|
9
9
|
markViews: {
|
|
10
10
|
breakout: function breakout(mark, view) {
|
|
11
|
-
return new ResizingMarkView(mark, view);
|
|
11
|
+
return new ResizingMarkView(mark, view, api);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -2,6 +2,7 @@ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/t
|
|
|
2
2
|
import { type BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls';
|
|
3
3
|
import { type EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
4
4
|
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
5
|
+
import { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
5
6
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
6
7
|
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
7
8
|
export interface BreakoutPluginState {
|
|
@@ -14,7 +15,8 @@ export type BreakoutPluginDependencies = [
|
|
|
14
15
|
WidthPlugin,
|
|
15
16
|
OptionalPlugin<EditorViewModePlugin>,
|
|
16
17
|
OptionalPlugin<EditorDisabledPlugin>,
|
|
17
|
-
OptionalPlugin<BlockControlsPlugin
|
|
18
|
+
OptionalPlugin<BlockControlsPlugin>,
|
|
19
|
+
OptionalPlugin<UserIntentPlugin>
|
|
18
20
|
];
|
|
19
21
|
export type BreakoutPlugin = NextEditorPlugin<'breakout', {
|
|
20
22
|
pluginConfiguration: BreakoutPluginOptions | undefined;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ExtractInjectionAPI } from "@atlaskit/editor-common/types";
|
|
2
|
+
import { Mark } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
import { EditorView } from "@atlaskit/editor-prosemirror/view";
|
|
4
|
+
import { BaseEventPayload, ElementDragType } from "@atlaskit/pragmatic-drag-and-drop/types";
|
|
5
|
+
import { BreakoutPlugin } from "../breakoutPluginType";
|
|
6
|
+
export declare function createResizerCallbacks({ dom, contentDOM, view, mark, api }: {
|
|
7
|
+
dom: HTMLElement;
|
|
8
|
+
contentDOM: HTMLElement;
|
|
9
|
+
view: EditorView;
|
|
10
|
+
mark: Mark;
|
|
11
|
+
api: ExtractInjectionAPI<BreakoutPlugin> | undefined;
|
|
12
|
+
}): {
|
|
13
|
+
onDragStart: () => void;
|
|
14
|
+
onDrag: (args: BaseEventPayload<ElementDragType>) => void;
|
|
15
|
+
onDrop: (args: BaseEventPayload<ElementDragType>) => void;
|
|
16
|
+
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
1
2
|
import type { Mark } from '@atlaskit/editor-prosemirror/model';
|
|
2
3
|
import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import { BreakoutPlugin } from '../breakoutPluginType';
|
|
5
|
+
export declare const LOCAL_RESIZE_PROPERTY = "--local-resizing-width";
|
|
3
6
|
/**
|
|
4
7
|
*
|
|
5
8
|
*/
|
|
@@ -13,11 +16,12 @@ export declare class ResizingMarkView implements NodeView {
|
|
|
13
16
|
* Wrap node view in a resizing mark view
|
|
14
17
|
* @param {Mark} mark - The breakout mark to resize
|
|
15
18
|
* @param {EditorView} view - The editor view
|
|
19
|
+
* @param {ExtractInjectionAPI<BreakoutPlugin> | undefined} api - the pluginInjectionAPI
|
|
16
20
|
* @example
|
|
17
21
|
* ```ts
|
|
18
22
|
* ```
|
|
19
23
|
*/
|
|
20
|
-
constructor(mark: Mark, view: EditorView);
|
|
24
|
+
constructor(mark: Mark, view: EditorView, api: ExtractInjectionAPI<BreakoutPlugin> | undefined);
|
|
21
25
|
/**
|
|
22
26
|
*
|
|
23
27
|
* @example
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
3
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import { BreakoutPlugin } from '../breakoutPluginType';
|
|
3
5
|
export declare const resizingPluginKey: PluginKey<any>;
|
|
4
|
-
export declare const createResizingPlugin: () => SafePlugin<any>;
|
|
6
|
+
export declare const createResizingPlugin: (api: ExtractInjectionAPI<BreakoutPlugin> | undefined) => SafePlugin<any>;
|
|
@@ -2,6 +2,7 @@ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/t
|
|
|
2
2
|
import { type BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls';
|
|
3
3
|
import { type EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
4
4
|
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
5
|
+
import { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
5
6
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
6
7
|
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
7
8
|
export interface BreakoutPluginState {
|
|
@@ -14,7 +15,8 @@ export type BreakoutPluginDependencies = [
|
|
|
14
15
|
WidthPlugin,
|
|
15
16
|
OptionalPlugin<EditorViewModePlugin>,
|
|
16
17
|
OptionalPlugin<EditorDisabledPlugin>,
|
|
17
|
-
OptionalPlugin<BlockControlsPlugin
|
|
18
|
+
OptionalPlugin<BlockControlsPlugin>,
|
|
19
|
+
OptionalPlugin<UserIntentPlugin>
|
|
18
20
|
];
|
|
19
21
|
export type BreakoutPlugin = NextEditorPlugin<'breakout', {
|
|
20
22
|
pluginConfiguration: BreakoutPluginOptions | undefined;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ExtractInjectionAPI } from "@atlaskit/editor-common/types";
|
|
2
|
+
import { Mark } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
import { EditorView } from "@atlaskit/editor-prosemirror/view";
|
|
4
|
+
import { BaseEventPayload, ElementDragType } from "@atlaskit/pragmatic-drag-and-drop/types";
|
|
5
|
+
import { BreakoutPlugin } from "../breakoutPluginType";
|
|
6
|
+
export declare function createResizerCallbacks({ dom, contentDOM, view, mark, api }: {
|
|
7
|
+
dom: HTMLElement;
|
|
8
|
+
contentDOM: HTMLElement;
|
|
9
|
+
view: EditorView;
|
|
10
|
+
mark: Mark;
|
|
11
|
+
api: ExtractInjectionAPI<BreakoutPlugin> | undefined;
|
|
12
|
+
}): {
|
|
13
|
+
onDragStart: () => void;
|
|
14
|
+
onDrag: (args: BaseEventPayload<ElementDragType>) => void;
|
|
15
|
+
onDrop: (args: BaseEventPayload<ElementDragType>) => void;
|
|
16
|
+
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
1
2
|
import type { Mark } from '@atlaskit/editor-prosemirror/model';
|
|
2
3
|
import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import { BreakoutPlugin } from '../breakoutPluginType';
|
|
5
|
+
export declare const LOCAL_RESIZE_PROPERTY = "--local-resizing-width";
|
|
3
6
|
/**
|
|
4
7
|
*
|
|
5
8
|
*/
|
|
@@ -13,11 +16,12 @@ export declare class ResizingMarkView implements NodeView {
|
|
|
13
16
|
* Wrap node view in a resizing mark view
|
|
14
17
|
* @param {Mark} mark - The breakout mark to resize
|
|
15
18
|
* @param {EditorView} view - The editor view
|
|
19
|
+
* @param {ExtractInjectionAPI<BreakoutPlugin> | undefined} api - the pluginInjectionAPI
|
|
16
20
|
* @example
|
|
17
21
|
* ```ts
|
|
18
22
|
* ```
|
|
19
23
|
*/
|
|
20
|
-
constructor(mark: Mark, view: EditorView);
|
|
24
|
+
constructor(mark: Mark, view: EditorView, api: ExtractInjectionAPI<BreakoutPlugin> | undefined);
|
|
21
25
|
/**
|
|
22
26
|
*
|
|
23
27
|
* @example
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
3
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import { BreakoutPlugin } from '../breakoutPluginType';
|
|
3
5
|
export declare const resizingPluginKey: PluginKey<any>;
|
|
4
|
-
export declare const createResizingPlugin: () => SafePlugin<any>;
|
|
6
|
+
export declare const createResizingPlugin: (api: ExtractInjectionAPI<BreakoutPlugin> | undefined) => SafePlugin<any>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-breakout",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.6",
|
|
4
4
|
"description": "Breakout plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"@atlaskit/editor-plugin-block-controls": "^3.14.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-editor-viewmode": "^3.1.0",
|
|
41
|
+
"@atlaskit/editor-plugin-user-intent": "^0.1.0",
|
|
41
42
|
"@atlaskit/editor-plugin-width": "^3.0.0",
|
|
42
43
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
43
44
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
46
47
|
"@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
|
|
47
48
|
"@atlaskit/theme": "^18.0.0",
|
|
48
|
-
"@atlaskit/tmp-editor-statsig": "^4.
|
|
49
|
+
"@atlaskit/tmp-editor-statsig": "^4.24.0",
|
|
49
50
|
"@atlaskit/tokens": "^4.9.0",
|
|
50
51
|
"@babel/runtime": "^7.0.0",
|
|
51
52
|
"@emotion/react": "^11.7.1"
|