@atlaskit/editor-core 185.1.1 → 185.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/create-editor/create-editor.js +4 -0
- package/dist/cjs/editor-next/editor-internal.js +2 -1
- package/dist/cjs/test-utils.js +4 -0
- package/dist/cjs/ui/Appearance/Chromeless.js +4 -2
- package/dist/cjs/ui/Appearance/Comment/Comment.js +5 -6
- package/dist/cjs/ui/Appearance/FullPage/FullPage.js +2 -1
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +2 -4
- package/dist/cjs/ui/Appearance/FullPage/StyledComponents.js +1 -1
- package/dist/cjs/ui/Appearance/Mobile.js +29 -4
- package/dist/cjs/ui/AppearanceComponents/Mobile.js +7 -5
- package/dist/cjs/ui/ContextPanel/index.js +7 -1
- package/dist/cjs/ui/PluginSlot/index.js +11 -5
- package/dist/cjs/ui/PluginSlot/mount-plugin-hooks.js +34 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/create-editor.js +4 -0
- package/dist/es2019/editor-next/editor-internal.js +2 -1
- package/dist/es2019/test-utils.js +4 -0
- package/dist/es2019/ui/Appearance/Chromeless.js +4 -2
- package/dist/es2019/ui/Appearance/Comment/Comment.js +5 -6
- package/dist/es2019/ui/Appearance/FullPage/FullPage.js +2 -1
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +2 -4
- package/dist/es2019/ui/Appearance/FullPage/StyledComponents.js +6 -1
- package/dist/es2019/ui/Appearance/Mobile.js +29 -4
- package/dist/es2019/ui/AppearanceComponents/Mobile.js +7 -6
- package/dist/es2019/ui/ContextPanel/index.js +6 -1
- package/dist/es2019/ui/PluginSlot/index.js +11 -5
- package/dist/es2019/ui/PluginSlot/mount-plugin-hooks.js +27 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/create-editor.js +4 -0
- package/dist/esm/editor-next/editor-internal.js +2 -1
- package/dist/esm/test-utils.js +4 -0
- package/dist/esm/ui/Appearance/Chromeless.js +4 -2
- package/dist/esm/ui/Appearance/Comment/Comment.js +5 -6
- package/dist/esm/ui/Appearance/FullPage/FullPage.js +2 -1
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +2 -4
- package/dist/esm/ui/Appearance/FullPage/StyledComponents.js +1 -1
- package/dist/esm/ui/Appearance/Mobile.js +29 -4
- package/dist/esm/ui/AppearanceComponents/Mobile.js +6 -5
- package/dist/esm/ui/ContextPanel/index.js +5 -1
- package/dist/esm/ui/PluginSlot/index.js +11 -5
- package/dist/esm/ui/PluginSlot/mount-plugin-hooks.js +27 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/get-plugins.d.ts +2 -1
- package/dist/types/test-utils.d.ts +2 -1
- package/dist/types/types/editor-appearance-component.d.ts +3 -1
- package/dist/types/types/editor-config.d.ts +2 -1
- package/dist/types/ui/Appearance/FullPage/FullPageContentArea.d.ts +3 -1
- package/dist/types/ui/Appearance/Mobile.d.ts +1 -1
- package/dist/types/ui/AppearanceComponents/Mobile.d.ts +8 -8
- package/dist/types/ui/ContextPanel/index.d.ts +1 -0
- package/dist/types/ui/PluginSlot/index.d.ts +3 -1
- package/dist/types/ui/PluginSlot/mount-plugin-hooks.d.ts +10 -0
- package/dist/types-ts4.5/create-editor/get-plugins.d.ts +2 -1
- package/dist/types-ts4.5/test-utils.d.ts +2 -1
- package/dist/types-ts4.5/types/editor-appearance-component.d.ts +3 -1
- package/dist/types-ts4.5/types/editor-config.d.ts +2 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/FullPageContentArea.d.ts +3 -1
- package/dist/types-ts4.5/ui/Appearance/Mobile.d.ts +1 -1
- package/dist/types-ts4.5/ui/AppearanceComponents/Mobile.d.ts +8 -8
- package/dist/types-ts4.5/ui/ContextPanel/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/PluginSlot/index.d.ts +3 -1
- package/dist/types-ts4.5/ui/PluginSlot/mount-plugin-hooks.d.ts +10 -0
- package/package.json +6 -6
- package/report.api.md +3 -0
- package/tmp/api-report-tmp.d.ts +2426 -0
- package/dist/cjs/ui/WidthEmitter/index.js +0 -64
- package/dist/es2019/ui/WidthEmitter/index.js +0 -56
- package/dist/esm/ui/WidthEmitter/index.js +0 -53
- package/dist/types/ui/WidthEmitter/index.d.ts +0 -7
- package/dist/types-ts4.5/ui/WidthEmitter/index.d.ts +0 -7
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _ui = require("@atlaskit/editor-common/ui");
|
|
12
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
// TODO: ED-17870 This workaround will be removed here.
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
var widthPluginKey = {
|
|
17
|
-
key: 'widthPlugin$',
|
|
18
|
-
getState: function getState(state) {
|
|
19
|
-
return state['widthPlugin$'];
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
// Why do we need this? Why not just use the width from the context directly rather than this?
|
|
23
|
-
// Well my friend - some of the VR tests break, seemingly due to the fact that existing behaviour
|
|
24
|
-
// assumes the initial value is 0, the width from context may not start from 0 however.
|
|
25
|
-
// We should investigate further if we can remove this entirely but for now we'll do this
|
|
26
|
-
// awkward workaround to keep the behaviour consistent.
|
|
27
|
-
var useListener = function useListener(contextValue) {
|
|
28
|
-
var _useState = (0, _react.useState)(0),
|
|
29
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
30
|
-
value = _useState2[0],
|
|
31
|
-
setValue = _useState2[1];
|
|
32
|
-
(0, _react.useEffect)(function () {
|
|
33
|
-
setValue(contextValue);
|
|
34
|
-
}, [contextValue]);
|
|
35
|
-
return value;
|
|
36
|
-
};
|
|
37
|
-
var WidthEmitter = function WidthEmitter(_ref) {
|
|
38
|
-
var editorView = _ref.editorView;
|
|
39
|
-
var _useContext = (0, _react.useContext)(_ui.ContextPanel),
|
|
40
|
-
contextPanelWidthContext = _useContext.width;
|
|
41
|
-
var _useContext2 = (0, _react.useContext)(_ui.WidthContext),
|
|
42
|
-
containerWidthContext = _useContext2.width;
|
|
43
|
-
var containerWidth = useListener(containerWidthContext);
|
|
44
|
-
var contextPanelWidth = useListener(contextPanelWidthContext);
|
|
45
|
-
(0, _react.useEffect)(function () {
|
|
46
|
-
var width = containerWidth - contextPanelWidth;
|
|
47
|
-
if (width <= 0 || isNaN(width) || !editorView) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
var dom = editorView.dom,
|
|
51
|
-
tr = editorView.state.tr,
|
|
52
|
-
dispatch = editorView.dispatch;
|
|
53
|
-
tr.setMeta(widthPluginKey, {
|
|
54
|
-
width: width,
|
|
55
|
-
containerWidth: containerWidth,
|
|
56
|
-
lineLength: dom ? dom.clientWidth : undefined
|
|
57
|
-
});
|
|
58
|
-
dispatch(tr);
|
|
59
|
-
return function () {};
|
|
60
|
-
}, [editorView, contextPanelWidth, containerWidth]);
|
|
61
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
62
|
-
};
|
|
63
|
-
var _default = WidthEmitter;
|
|
64
|
-
exports.default = _default;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import React, { useContext, useEffect, useState } from 'react';
|
|
2
|
-
import { ContextPanel, WidthContext } from '@atlaskit/editor-common/ui';
|
|
3
|
-
// TODO: ED-17870 This workaround will be removed here.
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
const widthPluginKey = {
|
|
6
|
-
key: 'widthPlugin$',
|
|
7
|
-
getState: state => {
|
|
8
|
-
return state['widthPlugin$'];
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
// Why do we need this? Why not just use the width from the context directly rather than this?
|
|
12
|
-
// Well my friend - some of the VR tests break, seemingly due to the fact that existing behaviour
|
|
13
|
-
// assumes the initial value is 0, the width from context may not start from 0 however.
|
|
14
|
-
// We should investigate further if we can remove this entirely but for now we'll do this
|
|
15
|
-
// awkward workaround to keep the behaviour consistent.
|
|
16
|
-
const useListener = contextValue => {
|
|
17
|
-
const [value, setValue] = useState(0);
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
setValue(contextValue);
|
|
20
|
-
}, [contextValue]);
|
|
21
|
-
return value;
|
|
22
|
-
};
|
|
23
|
-
const WidthEmitter = ({
|
|
24
|
-
editorView
|
|
25
|
-
}) => {
|
|
26
|
-
const {
|
|
27
|
-
width: contextPanelWidthContext
|
|
28
|
-
} = useContext(ContextPanel);
|
|
29
|
-
const {
|
|
30
|
-
width: containerWidthContext
|
|
31
|
-
} = useContext(WidthContext);
|
|
32
|
-
const containerWidth = useListener(containerWidthContext);
|
|
33
|
-
const contextPanelWidth = useListener(contextPanelWidthContext);
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
const width = containerWidth - contextPanelWidth;
|
|
36
|
-
if (width <= 0 || isNaN(width) || !editorView) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const {
|
|
40
|
-
dom,
|
|
41
|
-
state: {
|
|
42
|
-
tr
|
|
43
|
-
},
|
|
44
|
-
dispatch
|
|
45
|
-
} = editorView;
|
|
46
|
-
tr.setMeta(widthPluginKey, {
|
|
47
|
-
width,
|
|
48
|
-
containerWidth,
|
|
49
|
-
lineLength: dom ? dom.clientWidth : undefined
|
|
50
|
-
});
|
|
51
|
-
dispatch(tr);
|
|
52
|
-
return () => {};
|
|
53
|
-
}, [editorView, contextPanelWidth, containerWidth]);
|
|
54
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
55
|
-
};
|
|
56
|
-
export default WidthEmitter;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import React, { useContext, useEffect, useState } from 'react';
|
|
3
|
-
import { ContextPanel, WidthContext } from '@atlaskit/editor-common/ui';
|
|
4
|
-
// TODO: ED-17870 This workaround will be removed here.
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
var widthPluginKey = {
|
|
7
|
-
key: 'widthPlugin$',
|
|
8
|
-
getState: function getState(state) {
|
|
9
|
-
return state['widthPlugin$'];
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
// Why do we need this? Why not just use the width from the context directly rather than this?
|
|
13
|
-
// Well my friend - some of the VR tests break, seemingly due to the fact that existing behaviour
|
|
14
|
-
// assumes the initial value is 0, the width from context may not start from 0 however.
|
|
15
|
-
// We should investigate further if we can remove this entirely but for now we'll do this
|
|
16
|
-
// awkward workaround to keep the behaviour consistent.
|
|
17
|
-
var useListener = function useListener(contextValue) {
|
|
18
|
-
var _useState = useState(0),
|
|
19
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
-
value = _useState2[0],
|
|
21
|
-
setValue = _useState2[1];
|
|
22
|
-
useEffect(function () {
|
|
23
|
-
setValue(contextValue);
|
|
24
|
-
}, [contextValue]);
|
|
25
|
-
return value;
|
|
26
|
-
};
|
|
27
|
-
var WidthEmitter = function WidthEmitter(_ref) {
|
|
28
|
-
var editorView = _ref.editorView;
|
|
29
|
-
var _useContext = useContext(ContextPanel),
|
|
30
|
-
contextPanelWidthContext = _useContext.width;
|
|
31
|
-
var _useContext2 = useContext(WidthContext),
|
|
32
|
-
containerWidthContext = _useContext2.width;
|
|
33
|
-
var containerWidth = useListener(containerWidthContext);
|
|
34
|
-
var contextPanelWidth = useListener(contextPanelWidthContext);
|
|
35
|
-
useEffect(function () {
|
|
36
|
-
var width = containerWidth - contextPanelWidth;
|
|
37
|
-
if (width <= 0 || isNaN(width) || !editorView) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
var dom = editorView.dom,
|
|
41
|
-
tr = editorView.state.tr,
|
|
42
|
-
dispatch = editorView.dispatch;
|
|
43
|
-
tr.setMeta(widthPluginKey, {
|
|
44
|
-
width: width,
|
|
45
|
-
containerWidth: containerWidth,
|
|
46
|
-
lineLength: dom ? dom.clientWidth : undefined
|
|
47
|
-
});
|
|
48
|
-
dispatch(tr);
|
|
49
|
-
return function () {};
|
|
50
|
-
}, [editorView, contextPanelWidth, containerWidth]);
|
|
51
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
52
|
-
};
|
|
53
|
-
export default WidthEmitter;
|