@atlaskit/editor-core 185.2.0 → 185.2.2
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 +7 -0
- package/dist/cjs/actions/index.js +2 -2
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +1 -2
- package/dist/cjs/index.js +0 -6
- package/dist/cjs/labs/next/internal/hooks/use-editor/create-editor.js +1 -1
- package/dist/cjs/messages.js +6 -56
- package/dist/cjs/nodeviews/getInlineNodeViewProducer.styles.js +2 -2
- package/dist/cjs/plugins/base/pm-plugins/scroll-gutter.js +1 -1
- package/dist/cjs/plugins/card/nodeviews/blockCard.js +2 -2
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +4 -4
- package/dist/cjs/plugins/card/pm-plugins/doc.js +9 -11
- package/dist/cjs/plugins/card/pm-plugins/keymap.js +3 -6
- package/dist/cjs/plugins/card/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/card/toolbar.js +12 -15
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +4 -6
- package/dist/cjs/plugins/card/ui/ResizableEmbedCard.js +7 -10
- package/dist/cjs/plugins/card/utils.js +3 -4
- package/dist/cjs/plugins/clear-marks-on-change-to-empty-document/index.js +1 -1
- package/dist/cjs/plugins/custom-autoformat/doc.js +1 -1
- package/dist/cjs/plugins/date/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/emoji/index.js +2 -2
- package/dist/cjs/plugins/floating-toolbar/index.js +1 -1
- package/dist/cjs/plugins/hyperlink/Toolbar.js +8 -8
- package/dist/cjs/plugins/hyperlink/commands.js +2 -3
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +2 -2
- package/dist/cjs/plugins/layout/actions.js +1 -1
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +2 -3
- package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -2
- package/dist/cjs/plugins/media/toolbar/index.js +9 -8
- package/dist/cjs/plugins/media/toolbar/linking-toolbar-appearance.js +4 -3
- package/dist/cjs/plugins/media/toolbar/linking.js +3 -3
- package/dist/cjs/plugins/media/ui/MediaLinkingToolbar.js +1 -1
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +6 -8
- package/dist/cjs/plugins/media/utils/media-files.js +8 -7
- package/dist/cjs/plugins/mentions/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/placeholder/index.js +2 -3
- package/dist/cjs/plugins/status/plugin.js +2 -2
- package/dist/cjs/plugins/unsupported-content/index.js +3 -3
- package/dist/cjs/ui/LinkSearch/ToolbarComponents.js +4 -11
- package/dist/cjs/utils/document.js +7 -249
- package/dist/cjs/utils/index.js +1 -23
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +2 -1
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/labs/next/internal/hooks/use-editor/create-editor.js +1 -1
- package/dist/es2019/messages.js +2 -54
- package/dist/es2019/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
- package/dist/es2019/plugins/base/pm-plugins/scroll-gutter.js +1 -1
- package/dist/es2019/plugins/card/nodeviews/blockCard.js +1 -1
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -1
- package/dist/es2019/plugins/card/pm-plugins/doc.js +2 -3
- package/dist/es2019/plugins/card/pm-plugins/keymap.js +3 -3
- package/dist/es2019/plugins/card/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/card/toolbar.js +7 -9
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +3 -4
- package/dist/es2019/plugins/card/ui/ResizableEmbedCard.js +1 -4
- package/dist/es2019/plugins/card/utils.js +1 -2
- package/dist/es2019/plugins/clear-marks-on-change-to-empty-document/index.js +1 -1
- package/dist/es2019/plugins/custom-autoformat/doc.js +1 -1
- package/dist/es2019/plugins/date/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/emoji/index.js +1 -1
- package/dist/es2019/plugins/floating-toolbar/index.js +1 -1
- package/dist/es2019/plugins/hyperlink/Toolbar.js +3 -3
- package/dist/es2019/plugins/hyperlink/commands.js +1 -2
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +1 -1
- package/dist/es2019/plugins/layout/actions.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/es2019/plugins/media/toolbar/index.js +9 -8
- package/dist/es2019/plugins/media/toolbar/linking-toolbar-appearance.js +2 -1
- package/dist/es2019/plugins/media/toolbar/linking.js +1 -1
- package/dist/es2019/plugins/media/ui/MediaLinkingToolbar.js +1 -1
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +2 -4
- package/dist/es2019/plugins/media/utils/media-files.js +4 -3
- package/dist/es2019/plugins/mentions/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/placeholder/index.js +1 -1
- package/dist/es2019/plugins/status/plugin.js +1 -1
- package/dist/es2019/plugins/unsupported-content/index.js +1 -1
- package/dist/es2019/ui/LinkSearch/ToolbarComponents.js +1 -4
- package/dist/es2019/utils/document.js +3 -244
- package/dist/es2019/utils/index.js +1 -4
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +2 -1
- package/dist/esm/create-editor/ReactEditorViewInternal.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/labs/next/internal/hooks/use-editor/create-editor.js +1 -1
- package/dist/esm/messages.js +2 -54
- package/dist/esm/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
- package/dist/esm/plugins/base/pm-plugins/scroll-gutter.js +1 -1
- package/dist/esm/plugins/card/nodeviews/blockCard.js +1 -1
- package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -1
- package/dist/esm/plugins/card/pm-plugins/doc.js +2 -3
- package/dist/esm/plugins/card/pm-plugins/keymap.js +3 -3
- package/dist/esm/plugins/card/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/card/toolbar.js +7 -9
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +3 -4
- package/dist/esm/plugins/card/ui/ResizableEmbedCard.js +1 -4
- package/dist/esm/plugins/card/utils.js +1 -2
- package/dist/esm/plugins/clear-marks-on-change-to-empty-document/index.js +1 -1
- package/dist/esm/plugins/custom-autoformat/doc.js +1 -1
- package/dist/esm/plugins/date/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/emoji/index.js +1 -1
- package/dist/esm/plugins/floating-toolbar/index.js +1 -1
- package/dist/esm/plugins/hyperlink/Toolbar.js +3 -3
- package/dist/esm/plugins/hyperlink/commands.js +1 -2
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +1 -1
- package/dist/esm/plugins/layout/actions.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/esm/plugins/media/toolbar/index.js +9 -8
- package/dist/esm/plugins/media/toolbar/linking-toolbar-appearance.js +2 -1
- package/dist/esm/plugins/media/toolbar/linking.js +1 -1
- package/dist/esm/plugins/media/ui/MediaLinkingToolbar.js +1 -1
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +2 -4
- package/dist/esm/plugins/media/utils/media-files.js +4 -3
- package/dist/esm/plugins/mentions/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/placeholder/index.js +1 -1
- package/dist/esm/plugins/status/plugin.js +1 -1
- package/dist/esm/plugins/unsupported-content/index.js +1 -1
- package/dist/esm/ui/LinkSearch/ToolbarComponents.js +1 -4
- package/dist/esm/utils/document.js +6 -240
- package/dist/esm/utils/index.js +1 -4
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/index.d.ts +1 -2
- package/dist/types/labs/next/presets/cxhtml.d.ts +3 -3
- package/dist/types/labs/next/presets/default.d.ts +1 -1
- package/dist/types/labs/next/presets/mobile.d.ts +3 -3
- package/dist/types/messages.d.ts +2 -53
- package/dist/types/plugins/card/nodeviews/blockCard.d.ts +1 -1
- package/dist/types/plugins/card/nodeviews/genericCard.d.ts +3 -3
- package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types/plugins/card/toolbar.d.ts +1 -1
- package/dist/types/plugins/card/types.d.ts +1 -1
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +1 -1
- package/dist/types/plugins/card/ui/ResizableEmbedCard.d.ts +1 -1
- package/dist/types/plugins/date/nodeviews/date.d.ts +1 -1
- package/dist/types/plugins/emoji/nodeviews/emoji.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +1 -1
- package/dist/types/plugins/hyperlink/Toolbar.d.ts +1 -1
- package/dist/types/plugins/hyperlink/commands.d.ts +2 -3
- package/dist/types/plugins/hyperlink/index.d.ts +1 -1
- package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.d.ts +1 -1
- package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +1 -1
- package/dist/types/plugins/media/ui/ResizableMediaSingle/types.d.ts +0 -15
- package/dist/types/plugins/media/utils/media-files.d.ts +1 -1
- package/dist/types/plugins/mentions/nodeviews/mention.d.ts +1 -1
- package/dist/types/plugins/status/nodeviews/status.d.ts +1 -1
- package/dist/types/plugins/unsupported-content/unsupported-inline-node-view.d.ts +1 -1
- package/dist/types/types/editor-props.d.ts +1 -1
- package/dist/types/ui/LinkSearch/ToolbarComponents.d.ts +0 -4
- package/dist/types/utils/document.d.ts +0 -12
- package/dist/types/utils/index.d.ts +1 -2
- package/dist/types-ts4.5/index.d.ts +1 -2
- package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +3 -3
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +1 -1
- package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +3 -3
- package/dist/types-ts4.5/messages.d.ts +2 -53
- package/dist/types-ts4.5/plugins/card/nodeviews/blockCard.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/nodeviews/genericCard.d.ts +3 -3
- package/dist/types-ts4.5/plugins/card/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/toolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/types.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/ui/ResizableEmbedCard.d.ts +1 -1
- package/dist/types-ts4.5/plugins/date/nodeviews/date.d.ts +1 -1
- package/dist/types-ts4.5/plugins/emoji/nodeviews/emoji.d.ts +1 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/hyperlink/Toolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/hyperlink/commands.d.ts +2 -3
- package/dist/types-ts4.5/plugins/hyperlink/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/types.d.ts +0 -15
- package/dist/types-ts4.5/plugins/media/utils/media-files.d.ts +1 -1
- package/dist/types-ts4.5/plugins/mentions/nodeviews/mention.d.ts +1 -1
- package/dist/types-ts4.5/plugins/status/nodeviews/status.d.ts +1 -1
- package/dist/types-ts4.5/plugins/unsupported-content/unsupported-inline-node-view.d.ts +1 -1
- package/dist/types-ts4.5/types/editor-props.d.ts +1 -1
- package/dist/types-ts4.5/ui/LinkSearch/ToolbarComponents.d.ts +0 -4
- package/dist/types-ts4.5/utils/document.d.ts +0 -12
- package/dist/types-ts4.5/utils/index.d.ts +1 -2
- package/package.json +4 -5
- package/report.api.md +9 -34
- package/tmp/api-report-tmp.d.ts +7 -33
- package/dist/cjs/nodeviews/getInlineNodeViewProducer.js +0 -227
- package/dist/cjs/plugins/hyperlink/types.js +0 -5
- package/dist/cjs/ui/MediaAndEmbedsToolbar/index.js +0 -152
- package/dist/cjs/ui/Resizer/index.js +0 -210
- package/dist/cjs/ui/Resizer/styled.js +0 -15
- package/dist/cjs/ui/Resizer/types.js +0 -5
- package/dist/cjs/ui/Resizer/utils.js +0 -21
- package/dist/cjs/utils/filter/privacy-filter.js +0 -55
- package/dist/cjs/utils/linking-utils.js +0 -84
- package/dist/cjs/utils/rich-media-utils.js +0 -130
- package/dist/es2019/nodeviews/getInlineNodeViewProducer.js +0 -221
- package/dist/es2019/plugins/hyperlink/types.js +0 -1
- package/dist/es2019/ui/MediaAndEmbedsToolbar/index.js +0 -159
- package/dist/es2019/ui/Resizer/index.js +0 -191
- package/dist/es2019/ui/Resizer/styled.js +0 -15
- package/dist/es2019/ui/Resizer/types.js +0 -1
- package/dist/es2019/ui/Resizer/utils.js +0 -12
- package/dist/es2019/utils/filter/privacy-filter.js +0 -47
- package/dist/es2019/utils/linking-utils.js +0 -74
- package/dist/es2019/utils/rich-media-utils.js +0 -108
- package/dist/esm/nodeviews/getInlineNodeViewProducer.js +0 -217
- package/dist/esm/plugins/hyperlink/types.js +0 -1
- package/dist/esm/ui/MediaAndEmbedsToolbar/index.js +0 -144
- package/dist/esm/ui/Resizer/index.js +0 -203
- package/dist/esm/ui/Resizer/styled.js +0 -7
- package/dist/esm/ui/Resizer/types.js +0 -1
- package/dist/esm/ui/Resizer/utils.js +0 -12
- package/dist/esm/utils/filter/privacy-filter.js +0 -48
- package/dist/esm/utils/linking-utils.js +0 -74
- package/dist/esm/utils/rich-media-utils.js +0 -117
- package/dist/types/nodeviews/getInlineNodeViewProducer.d.ts +0 -24
- package/dist/types/plugins/hyperlink/types.d.ts +0 -35
- package/dist/types/ui/MediaAndEmbedsToolbar/index.d.ts +0 -9
- package/dist/types/ui/Resizer/index.d.ts +0 -41
- package/dist/types/ui/Resizer/styled.d.ts +0 -2
- package/dist/types/ui/Resizer/types.d.ts +0 -26
- package/dist/types/ui/Resizer/utils.d.ts +0 -6
- package/dist/types/utils/filter/privacy-filter.d.ts +0 -9
- package/dist/types/utils/linking-utils.d.ts +0 -14
- package/dist/types/utils/rich-media-utils.d.ts +0 -8
- package/dist/types-ts4.5/nodeviews/getInlineNodeViewProducer.d.ts +0 -24
- package/dist/types-ts4.5/plugins/hyperlink/types.d.ts +0 -35
- package/dist/types-ts4.5/ui/MediaAndEmbedsToolbar/index.d.ts +0 -9
- package/dist/types-ts4.5/ui/Resizer/index.d.ts +0 -41
- package/dist/types-ts4.5/ui/Resizer/styled.d.ts +0 -2
- package/dist/types-ts4.5/ui/Resizer/types.d.ts +0 -26
- package/dist/types-ts4.5/ui/Resizer/utils.d.ts +0 -6
- package/dist/types-ts4.5/utils/filter/privacy-filter.d.ts +0 -9
- package/dist/types-ts4.5/utils/linking-utils.d.ts +0 -14
- package/dist/types-ts4.5/utils/rich-media-utils.d.ts +0 -8
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
|
-
import React from 'react';
|
|
11
|
-
import classnames from 'classnames';
|
|
12
|
-
import { Resizable } from 're-resizable';
|
|
13
|
-
import { gridTypeForLayout } from '@atlaskit/editor-common/utils';
|
|
14
|
-
import { snapTo, handleSides } from './utils';
|
|
15
|
-
import { richMediaClassName } from '@atlaskit/editor-common/styles';
|
|
16
|
-
import { akRichMediaResizeZIndex } from '@atlaskit/editor-shared-styles';
|
|
17
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../plugins/analytics';
|
|
18
|
-
var getResizeAnalyticsEvent = function getResizeAnalyticsEvent(type, size, layout) {
|
|
19
|
-
var actionSubject = type === 'embed' ? ACTION_SUBJECT.EMBEDS : ACTION_SUBJECT.MEDIA_SINGLE;
|
|
20
|
-
return {
|
|
21
|
-
action: ACTION.EDITED,
|
|
22
|
-
actionSubject: actionSubject,
|
|
23
|
-
actionSubjectId: ACTION_SUBJECT_ID.RESIZED,
|
|
24
|
-
attributes: {
|
|
25
|
-
size: size,
|
|
26
|
-
layout: layout
|
|
27
|
-
},
|
|
28
|
-
eventType: EVENT_TYPE.UI
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
var getWidthFromSnapPoints = function getWidthFromSnapPoints(width, snapPoints) {
|
|
32
|
-
if (snapPoints.length) {
|
|
33
|
-
return Math.min(Math.max(width, snapPoints[0]), snapPoints[snapPoints.length - 1]);
|
|
34
|
-
}
|
|
35
|
-
return width;
|
|
36
|
-
};
|
|
37
|
-
var Resizer = /*#__PURE__*/function (_React$Component) {
|
|
38
|
-
_inherits(Resizer, _React$Component);
|
|
39
|
-
var _super = _createSuper(Resizer);
|
|
40
|
-
function Resizer() {
|
|
41
|
-
var _this;
|
|
42
|
-
_classCallCheck(this, Resizer);
|
|
43
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
44
|
-
args[_key] = arguments[_key];
|
|
45
|
-
}
|
|
46
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
47
|
-
_defineProperty(_assertThisInitialized(_this), "resizable", /*#__PURE__*/React.createRef());
|
|
48
|
-
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
49
|
-
isResizing: false
|
|
50
|
-
});
|
|
51
|
-
_defineProperty(_assertThisInitialized(_this), "handleResizeStart", function (event) {
|
|
52
|
-
var _this$props = _this.props,
|
|
53
|
-
_this$props$innerPadd = _this$props.innerPadding,
|
|
54
|
-
innerPadding = _this$props$innerPadd === void 0 ? 0 : _this$props$innerPadd,
|
|
55
|
-
highlights = _this$props.highlights,
|
|
56
|
-
displayGrid = _this$props.displayGrid,
|
|
57
|
-
layout = _this$props.layout,
|
|
58
|
-
width = _this$props.width,
|
|
59
|
-
snapPoints = _this$props.snapPoints;
|
|
60
|
-
|
|
61
|
-
// prevent creating a drag event on Firefox
|
|
62
|
-
event.preventDefault();
|
|
63
|
-
_this.setState({
|
|
64
|
-
isResizing: true
|
|
65
|
-
}, function () {
|
|
66
|
-
var newHighlights = highlights(width + innerPadding, snapPoints);
|
|
67
|
-
displayGrid === null || displayGrid === void 0 ? void 0 : displayGrid(newHighlights.length > 0, gridTypeForLayout(layout), newHighlights);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
_defineProperty(_assertThisInitialized(_this), "handleResize", function (_event, _direction, _elementRef, delta) {
|
|
71
|
-
var _this$props2 = _this.props,
|
|
72
|
-
highlights = _this$props2.highlights,
|
|
73
|
-
calcNewSize = _this$props2.calcNewSize,
|
|
74
|
-
scaleFactor = _this$props2.scaleFactor,
|
|
75
|
-
snapPoints = _this$props2.snapPoints,
|
|
76
|
-
displayGrid = _this$props2.displayGrid,
|
|
77
|
-
layout = _this$props2.layout,
|
|
78
|
-
updateSize = _this$props2.updateSize,
|
|
79
|
-
_this$props2$innerPad = _this$props2.innerPadding,
|
|
80
|
-
innerPadding = _this$props2$innerPad === void 0 ? 0 : _this$props2$innerPad;
|
|
81
|
-
var resizable = _this.resizable.current;
|
|
82
|
-
var isResizing = _this.state.isResizing;
|
|
83
|
-
if (!resizable || !resizable.state.original || !isResizing) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
var newWidth = getWidthFromSnapPoints(resizable.state.original.width + delta.width * (scaleFactor || 1), snapPoints);
|
|
87
|
-
var newSize = calcNewSize(newWidth + innerPadding, false);
|
|
88
|
-
if (newSize.layout !== layout) {
|
|
89
|
-
updateSize(newSize.width, newSize.layout);
|
|
90
|
-
}
|
|
91
|
-
var newHighlights = highlights(newWidth, snapPoints);
|
|
92
|
-
displayGrid === null || displayGrid === void 0 ? void 0 : displayGrid(newHighlights.length > 0, gridTypeForLayout(newSize.layout), newHighlights);
|
|
93
|
-
resizable.updateSize({
|
|
94
|
-
width: newWidth,
|
|
95
|
-
height: 'auto'
|
|
96
|
-
});
|
|
97
|
-
resizable.setState({
|
|
98
|
-
isResizing: true
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
_defineProperty(_assertThisInitialized(_this), "handleResizeStop", function (_event, _direction, _elementRef, delta) {
|
|
102
|
-
var _this$props3 = _this.props,
|
|
103
|
-
highlights = _this$props3.highlights,
|
|
104
|
-
calcNewSize = _this$props3.calcNewSize,
|
|
105
|
-
snapPoints = _this$props3.snapPoints,
|
|
106
|
-
displayGrid = _this$props3.displayGrid,
|
|
107
|
-
layout = _this$props3.layout,
|
|
108
|
-
updateSize = _this$props3.updateSize,
|
|
109
|
-
dispatchAnalyticsEvent = _this$props3.dispatchAnalyticsEvent,
|
|
110
|
-
nodeType = _this$props3.nodeType;
|
|
111
|
-
var resizable = _this.resizable.current;
|
|
112
|
-
var isResizing = _this.state.isResizing;
|
|
113
|
-
if (!resizable || !resizable.state.original || !isResizing) {
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
var newWidth = getWidthFromSnapPoints(resizable.state.original.width + delta.width, snapPoints);
|
|
117
|
-
var snapWidth = snapTo(newWidth, snapPoints);
|
|
118
|
-
var newSize = calcNewSize(snapWidth, true);
|
|
119
|
-
var newHighlights = highlights(newWidth, snapPoints);
|
|
120
|
-
if (dispatchAnalyticsEvent) {
|
|
121
|
-
dispatchAnalyticsEvent(getResizeAnalyticsEvent(nodeType, newSize.width, newSize.layout));
|
|
122
|
-
}
|
|
123
|
-
// show committed grid size
|
|
124
|
-
displayGrid === null || displayGrid === void 0 ? void 0 : displayGrid(newHighlights.length > 0, gridTypeForLayout(newSize.layout), newHighlights);
|
|
125
|
-
_this.setState({
|
|
126
|
-
isResizing: false
|
|
127
|
-
}, function () {
|
|
128
|
-
updateSize(newSize.width, newSize.layout);
|
|
129
|
-
displayGrid === null || displayGrid === void 0 ? void 0 : displayGrid(false, gridTypeForLayout(layout), []);
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
return _this;
|
|
133
|
-
}
|
|
134
|
-
_createClass(Resizer, [{
|
|
135
|
-
key: "render",
|
|
136
|
-
value: function render() {
|
|
137
|
-
var handleStyles = {};
|
|
138
|
-
var handles = {};
|
|
139
|
-
var handleComponent = {};
|
|
140
|
-
var _this$props4 = this.props,
|
|
141
|
-
_this$props4$innerPad = _this$props4.innerPadding,
|
|
142
|
-
innerPadding = _this$props4$innerPad === void 0 ? 0 : _this$props4$innerPad,
|
|
143
|
-
width = _this$props4.width,
|
|
144
|
-
pctWidth = _this$props4.pctWidth,
|
|
145
|
-
selected = _this$props4.selected,
|
|
146
|
-
layout = _this$props4.layout,
|
|
147
|
-
enable = _this$props4.enable,
|
|
148
|
-
children = _this$props4.children,
|
|
149
|
-
ratio = _this$props4.ratio,
|
|
150
|
-
handleComponentFunc = _this$props4.handleComponentFunc;
|
|
151
|
-
var isResizing = this.state.isResizing;
|
|
152
|
-
handleSides.forEach(function (side) {
|
|
153
|
-
var _handleStyles$side;
|
|
154
|
-
handles[side] = "richMedia-resize-handle-".concat(side);
|
|
155
|
-
handleStyles[side] = (_handleStyles$side = {
|
|
156
|
-
width: '24px'
|
|
157
|
-
}, _defineProperty(_handleStyles$side, side, "".concat(-13 - innerPadding, "px")), _defineProperty(_handleStyles$side, "zIndex", akRichMediaResizeZIndex), _defineProperty(_handleStyles$side, "pointerEvents", 'auto'), _handleStyles$side);
|
|
158
|
-
var sideHandleComponent = handleComponentFunc && handleComponentFunc(side);
|
|
159
|
-
if (sideHandleComponent) {
|
|
160
|
-
handleComponent[side] = sideHandleComponent;
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
var className = classnames(richMediaClassName, "image-".concat(layout), this.props.className, {
|
|
164
|
-
'is-resizing': isResizing,
|
|
165
|
-
'not-resized': !pctWidth,
|
|
166
|
-
'richMedia-selected': selected,
|
|
167
|
-
'rich-media-wrapped': layout === 'wrap-left' || layout === 'wrap-right'
|
|
168
|
-
});
|
|
169
|
-
var handleWrapperStyle;
|
|
170
|
-
if (ratio) {
|
|
171
|
-
handleWrapperStyle = {
|
|
172
|
-
position: 'absolute',
|
|
173
|
-
width: '100%',
|
|
174
|
-
paddingBottom: "".concat(ratio, "%"),
|
|
175
|
-
top: 0,
|
|
176
|
-
pointerEvents: 'none'
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// Ideally, Resizable would let you pass in the component rather than
|
|
181
|
-
// the div. For now, we just apply the same styles using CSS
|
|
182
|
-
return /*#__PURE__*/React.createElement(Resizable, {
|
|
183
|
-
ref: this.resizable,
|
|
184
|
-
size: {
|
|
185
|
-
width: width,
|
|
186
|
-
// just content itself (no paddings)
|
|
187
|
-
height: 'auto'
|
|
188
|
-
},
|
|
189
|
-
className: className,
|
|
190
|
-
handleClasses: handles,
|
|
191
|
-
handleStyles: handleStyles,
|
|
192
|
-
handleWrapperStyle: handleWrapperStyle,
|
|
193
|
-
handleComponent: handleComponent,
|
|
194
|
-
enable: enable,
|
|
195
|
-
onResize: this.handleResize,
|
|
196
|
-
onResizeStop: this.handleResizeStop,
|
|
197
|
-
onResizeStart: this.handleResizeStart
|
|
198
|
-
}, children);
|
|
199
|
-
}
|
|
200
|
-
}]);
|
|
201
|
-
return Resizer;
|
|
202
|
-
}(React.Component);
|
|
203
|
-
export { Resizer as default };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject;
|
|
3
|
-
import { css } from '@emotion/react';
|
|
4
|
-
import { MediaSingleDimensionHelper } from '@atlaskit/editor-common/ui';
|
|
5
|
-
export var wrapperStyle = function wrapperStyle(props) {
|
|
6
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n & > div {\n ", ";\n position: relative;\n clear: both;\n\n > div {\n position: absolute;\n height: 100%;\n width: 100%;\n }\n }\n"])), MediaSingleDimensionHelper(props));
|
|
7
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export var snapTo = function snapTo(target, points) {
|
|
2
|
-
return points.length === 0 ?
|
|
3
|
-
// extreme last case if there are no points somehow
|
|
4
|
-
target : points.reduce(function (point, closest) {
|
|
5
|
-
return Math.abs(closest - target) < Math.abs(point - target) ? closest : point;
|
|
6
|
-
});
|
|
7
|
-
};
|
|
8
|
-
export var handleSides = ['left', 'right'];
|
|
9
|
-
export var imageAlignmentMap = {
|
|
10
|
-
left: 'start',
|
|
11
|
-
right: 'end'
|
|
12
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
import { traverse } from '@atlaskit/adf-utils/traverse';
|
|
5
|
-
import { isResolvingMentionProvider } from '@atlaskit/mention/resource';
|
|
6
|
-
/**
|
|
7
|
-
* Sanitises a document where some content should not be in the document (e.g. mention names).
|
|
8
|
-
*
|
|
9
|
-
* It is expected that these names we be resolved separately (e.g. when rendering
|
|
10
|
-
* a node view).
|
|
11
|
-
*/
|
|
12
|
-
export function sanitizeNodeForPrivacy(json, providerFactory) {
|
|
13
|
-
var mentionNames = new Map();
|
|
14
|
-
var hasCacheableMentions = false;
|
|
15
|
-
var sanitizedJSON = traverse(json, {
|
|
16
|
-
mention: function mention(node) {
|
|
17
|
-
if (node.attrs && node.attrs.text) {
|
|
18
|
-
hasCacheableMentions = true;
|
|
19
|
-
// Remove @ prefix
|
|
20
|
-
var text = node.attrs.text;
|
|
21
|
-
var name = text.startsWith('@') ? text.slice(1) : text;
|
|
22
|
-
mentionNames.set(node.attrs.id, name);
|
|
23
|
-
}
|
|
24
|
-
return _objectSpread(_objectSpread({}, node), {}, {
|
|
25
|
-
attrs: _objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
26
|
-
text: ''
|
|
27
|
-
})
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
if (hasCacheableMentions && providerFactory) {
|
|
32
|
-
var handler = function handler(_name, providerPromise) {
|
|
33
|
-
if (providerPromise) {
|
|
34
|
-
providerPromise.then(function (provider) {
|
|
35
|
-
if (isResolvingMentionProvider(provider)) {
|
|
36
|
-
mentionNames.forEach(function (name, id) {
|
|
37
|
-
provider.cacheMentionName(id, name);
|
|
38
|
-
});
|
|
39
|
-
mentionNames.clear();
|
|
40
|
-
providerFactory.unsubscribe('mentionProvider', handler);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
providerFactory.subscribe('mentionProvider', handler);
|
|
46
|
-
}
|
|
47
|
-
return sanitizedJSON;
|
|
48
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
export var buildEditLinkPayload = function buildEditLinkPayload(type) {
|
|
3
|
-
return {
|
|
4
|
-
action: ACTION.CLICKED,
|
|
5
|
-
actionSubject: type === ACTION_SUBJECT_ID.HYPERLINK ? ACTION_SUBJECT.HYPERLINK : ACTION_SUBJECT.SMART_LINK,
|
|
6
|
-
actionSubjectId: ACTION_SUBJECT_ID.EDIT_LINK,
|
|
7
|
-
attributes: type !== ACTION_SUBJECT_ID.HYPERLINK ? {
|
|
8
|
-
display: type
|
|
9
|
-
} : {},
|
|
10
|
-
eventType: EVENT_TYPE.UI
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
var mapLinkTypeToCardAppearance = function mapLinkTypeToCardAppearance(type) {
|
|
14
|
-
switch (type) {
|
|
15
|
-
case ACTION_SUBJECT_ID.CARD_INLINE:
|
|
16
|
-
{
|
|
17
|
-
return 'inline';
|
|
18
|
-
}
|
|
19
|
-
case ACTION_SUBJECT_ID.CARD_BLOCK:
|
|
20
|
-
{
|
|
21
|
-
return 'block';
|
|
22
|
-
}
|
|
23
|
-
case ACTION_SUBJECT_ID.EMBEDS:
|
|
24
|
-
{
|
|
25
|
-
return 'embed';
|
|
26
|
-
}
|
|
27
|
-
default:
|
|
28
|
-
{
|
|
29
|
-
return 'url';
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
export var buildVisitedLinkPayload = function buildVisitedLinkPayload(type) {
|
|
34
|
-
return type === ACTION_SUBJECT_ID.HYPERLINK ? {
|
|
35
|
-
action: ACTION.VISITED,
|
|
36
|
-
actionSubject: ACTION_SUBJECT.HYPERLINK,
|
|
37
|
-
actionSubjectId: undefined,
|
|
38
|
-
attributes: {
|
|
39
|
-
inputMethod: INPUT_METHOD.TOOLBAR
|
|
40
|
-
},
|
|
41
|
-
eventType: EVENT_TYPE.TRACK
|
|
42
|
-
} : {
|
|
43
|
-
action: ACTION.VISITED,
|
|
44
|
-
actionSubject: ACTION_SUBJECT.SMART_LINK,
|
|
45
|
-
actionSubjectId: type,
|
|
46
|
-
attributes: {
|
|
47
|
-
inputMethod: INPUT_METHOD.TOOLBAR
|
|
48
|
-
},
|
|
49
|
-
eventType: EVENT_TYPE.TRACK
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
export var buildOpenedSettingsPayload = function buildOpenedSettingsPayload(type) {
|
|
53
|
-
return {
|
|
54
|
-
action: ACTION.CLICKED,
|
|
55
|
-
actionSubject: ACTION_SUBJECT.BUTTON,
|
|
56
|
-
actionSubjectId: ACTION_SUBJECT_ID.GOTO_SMART_LINK_SETTINGS,
|
|
57
|
-
attributes: {
|
|
58
|
-
inputMethod: INPUT_METHOD.TOOLBAR,
|
|
59
|
-
display: mapLinkTypeToCardAppearance(type)
|
|
60
|
-
},
|
|
61
|
-
eventType: EVENT_TYPE.UI
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
export var unlinkPayload = function unlinkPayload(type) {
|
|
65
|
-
return {
|
|
66
|
-
action: ACTION.UNLINK,
|
|
67
|
-
actionSubject: type === ACTION_SUBJECT_ID.HYPERLINK ? ACTION_SUBJECT.HYPERLINK : ACTION_SUBJECT.SMART_LINK,
|
|
68
|
-
actionSubjectId: type === ACTION_SUBJECT_ID.HYPERLINK ? undefined : type,
|
|
69
|
-
attributes: {
|
|
70
|
-
inputMethod: INPUT_METHOD.TOOLBAR
|
|
71
|
-
},
|
|
72
|
-
eventType: EVENT_TYPE.TRACK
|
|
73
|
-
};
|
|
74
|
-
};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
import { wrappedLayouts, shouldAddDefaultWrappedWidth, calcPxFromColumns } from '@atlaskit/editor-common/ui';
|
|
5
|
-
import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
|
|
6
|
-
import { akEditorBreakoutPadding } from '@atlaskit/editor-shared-styles';
|
|
7
|
-
export var nonWrappedLayouts = ['center', 'wide', 'full-width'];
|
|
8
|
-
export var floatingLayouts = ['wrap-left', 'wrap-right'];
|
|
9
|
-
export var isRichMediaInsideOfBlockNode = function isRichMediaInsideOfBlockNode(view, pos) {
|
|
10
|
-
if (typeof pos !== 'number' || isNaN(pos) || !view) {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
var $pos = view.state.doc.resolve(pos);
|
|
14
|
-
var _view$state$schema$no = view.state.schema.nodes,
|
|
15
|
-
expand = _view$state$schema$no.expand,
|
|
16
|
-
nestedExpand = _view$state$schema$no.nestedExpand,
|
|
17
|
-
layoutColumn = _view$state$schema$no.layoutColumn;
|
|
18
|
-
return !!findParentNodeOfTypeClosestToPos($pos, [expand, nestedExpand, layoutColumn]);
|
|
19
|
-
};
|
|
20
|
-
export var alignAttributes = function alignAttributes(layout, oldAttrs) {
|
|
21
|
-
var gridSize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 12;
|
|
22
|
-
var originalWidth = arguments.length > 3 ? arguments[3] : undefined;
|
|
23
|
-
var lineLength = arguments.length > 4 ? arguments[4] : undefined;
|
|
24
|
-
var width = oldAttrs.width;
|
|
25
|
-
var oldLayout = oldAttrs.layout;
|
|
26
|
-
var oldLayoutIsNonWrapped = nonWrappedLayouts.indexOf(oldLayout) > -1;
|
|
27
|
-
var newLayoutIsNonWrapped = nonWrappedLayouts.indexOf(layout) > -1;
|
|
28
|
-
var newLayoutIsWrapped = wrappedLayouts.indexOf(layout) > -1;
|
|
29
|
-
var oldLayoutIsWrapped = wrappedLayouts.indexOf(oldLayout) > -1;
|
|
30
|
-
if (oldLayoutIsNonWrapped && shouldAddDefaultWrappedWidth(layout, originalWidth, lineLength)) {
|
|
31
|
-
// 'full-width' or 'wide' or 'center' -> 'wrap-left' or 'wrap-right' or 'align-end' or 'align-start'
|
|
32
|
-
if (!width || width >= 100 || oldLayout !== 'center' // == 'full-width' or 'wide'
|
|
33
|
-
) {
|
|
34
|
-
width = 50;
|
|
35
|
-
}
|
|
36
|
-
} else if (layout !== oldLayout && ['full-width', 'wide'].indexOf(oldLayout) > -1) {
|
|
37
|
-
// 'full-width' -> 'center' or 'wide'
|
|
38
|
-
// 'wide' -> 'center' or 'full-width'
|
|
39
|
-
// unset width
|
|
40
|
-
width = undefined;
|
|
41
|
-
} else if (width) {
|
|
42
|
-
var cols = Math.round(width / 100 * gridSize);
|
|
43
|
-
var targetCols = cols;
|
|
44
|
-
if (oldLayoutIsWrapped && newLayoutIsNonWrapped) {
|
|
45
|
-
// wrap -> center needs to align to even grid
|
|
46
|
-
targetCols = Math.floor(targetCols / 2) * 2;
|
|
47
|
-
width = undefined;
|
|
48
|
-
} else if (oldLayoutIsNonWrapped && newLayoutIsWrapped) {
|
|
49
|
-
// Can be here only if
|
|
50
|
-
// 'full-width' or 'wide' or 'center' -> 'wrap-left' or 'wrap-right' or 'align-end' or 'align-start'
|
|
51
|
-
// AND
|
|
52
|
-
// !originalWidth || !lineLength || small image
|
|
53
|
-
// AND
|
|
54
|
-
// width defined!
|
|
55
|
-
|
|
56
|
-
// cannot resize to full column width, and cannot resize to 1 column
|
|
57
|
-
if (cols <= 1) {
|
|
58
|
-
targetCols = 2;
|
|
59
|
-
} else if (cols >= gridSize) {
|
|
60
|
-
targetCols = 10;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (targetCols !== cols) {
|
|
64
|
-
width = targetCols / gridSize * 100;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return _objectSpread(_objectSpread({}, oldAttrs), {}, {
|
|
68
|
-
layout: layout,
|
|
69
|
-
width: width
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
export function calculateSnapPoints(_ref) {
|
|
73
|
-
var $pos = _ref.$pos,
|
|
74
|
-
akEditorWideLayoutWidth = _ref.akEditorWideLayoutWidth,
|
|
75
|
-
allowBreakoutSnapPoints = _ref.allowBreakoutSnapPoints,
|
|
76
|
-
containerWidth = _ref.containerWidth,
|
|
77
|
-
gridSize = _ref.gridSize,
|
|
78
|
-
gridWidth = _ref.gridWidth,
|
|
79
|
-
insideInlineLike = _ref.insideInlineLike,
|
|
80
|
-
insideLayout = _ref.insideLayout,
|
|
81
|
-
isVideoFile = _ref.isVideoFile,
|
|
82
|
-
lineLength = _ref.lineLength,
|
|
83
|
-
offsetLeft = _ref.offsetLeft,
|
|
84
|
-
wrappedLayout = _ref.wrappedLayout;
|
|
85
|
-
var snapTargets = [];
|
|
86
|
-
for (var i = 0; i < gridWidth; i++) {
|
|
87
|
-
var pxFromColumns = calcPxFromColumns(i, lineLength, gridWidth);
|
|
88
|
-
snapTargets.push(insideLayout ? pxFromColumns : pxFromColumns - offsetLeft);
|
|
89
|
-
}
|
|
90
|
-
// full width
|
|
91
|
-
snapTargets.push(lineLength - offsetLeft);
|
|
92
|
-
var columns = wrappedLayout || insideInlineLike ? 1 : 2;
|
|
93
|
-
var minimumWidth = calcPxFromColumns(columns, lineLength, gridSize);
|
|
94
|
-
var snapPoints = snapTargets.filter(function (width) {
|
|
95
|
-
return width >= minimumWidth;
|
|
96
|
-
});
|
|
97
|
-
if (!$pos) {
|
|
98
|
-
return snapPoints;
|
|
99
|
-
}
|
|
100
|
-
snapPoints = isVideoFile ? snapPoints.filter(function (width) {
|
|
101
|
-
return width > 320;
|
|
102
|
-
}) : snapPoints;
|
|
103
|
-
var isTopLevel = $pos.parent.type.name === 'doc';
|
|
104
|
-
if (isTopLevel && allowBreakoutSnapPoints) {
|
|
105
|
-
snapPoints.push(akEditorWideLayoutWidth);
|
|
106
|
-
var fullWidthPoint = containerWidth - akEditorBreakoutPadding;
|
|
107
|
-
if (fullWidthPoint > akEditorWideLayoutWidth) {
|
|
108
|
-
snapPoints.push(fullWidthPoint);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// EDM-1107: Ensure new snapPoints are sorted with existing points
|
|
113
|
-
snapPoints = snapPoints.sort(function (a, b) {
|
|
114
|
-
return a - b;
|
|
115
|
-
});
|
|
116
|
-
return snapPoints;
|
|
117
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { EditorProps, EditorView } from 'prosemirror-view';
|
|
3
|
-
import { Node as PMNode } from 'prosemirror-model';
|
|
4
|
-
import type { PMPluginFactoryParams } from '../types';
|
|
5
|
-
export type InlineNodeViewComponentProps = {
|
|
6
|
-
view: EditorView;
|
|
7
|
-
getPos: NodeViewParams['getPos'];
|
|
8
|
-
node: PMNode;
|
|
9
|
-
};
|
|
10
|
-
type InlineNodeViewComponent<ExtraComponentProps> = React.ComponentType<InlineNodeViewComponentProps & ExtraComponentProps>;
|
|
11
|
-
export declare const inlineNodeViewClassname = "inlineNodeView";
|
|
12
|
-
type NodeViewProducer = NonNullable<EditorProps['nodeViews']>[string];
|
|
13
|
-
type NodeViewParams = {
|
|
14
|
-
node: Parameters<NodeViewProducer>[0];
|
|
15
|
-
view: Parameters<NodeViewProducer>[1];
|
|
16
|
-
getPos: Parameters<NodeViewProducer>[2];
|
|
17
|
-
decorations: Parameters<NodeViewProducer>[3];
|
|
18
|
-
};
|
|
19
|
-
export declare function getInlineNodeViewProducer<ExtraComponentProps>({ pmPluginFactoryParams, Component, extraComponentProps, }: {
|
|
20
|
-
pmPluginFactoryParams: PMPluginFactoryParams;
|
|
21
|
-
Component: InlineNodeViewComponent<ExtraComponentProps>;
|
|
22
|
-
extraComponentProps?: ExtraComponentProps;
|
|
23
|
-
}): NodeViewProducer;
|
|
24
|
-
export {};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { CardOptions } from '@atlaskit/editor-common/card';
|
|
2
|
-
import { LinkPickerProps } from '@atlaskit/link-picker';
|
|
3
|
-
import { INPUT_METHOD } from '../analytics/types';
|
|
4
|
-
import { EditorAppearance } from '@atlaskit/editor-common/types';
|
|
5
|
-
export type LinkInputType = INPUT_METHOD.MANUAL | INPUT_METHOD.TYPEAHEAD;
|
|
6
|
-
/**
|
|
7
|
-
* Configuration for the link picker
|
|
8
|
-
* Extends `LinkPickerProps` to provide future extensibility out-of-the-box
|
|
9
|
-
*/
|
|
10
|
-
export interface LinkPickerOptions extends Partial<LinkPickerProps> {
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Configuration for editor linking behaviours
|
|
14
|
-
*/
|
|
15
|
-
export interface LinkingOptions {
|
|
16
|
-
/**
|
|
17
|
-
* Initial props to configure the link picker component with. Primarily used to provide link search and suggestions capabilities.
|
|
18
|
-
* @see https://atlaskit.atlassian.com/packages/editor/editor-core/example/full-page-with-link-picker
|
|
19
|
-
* @see https://atlaskit.atlassian.com/packages/linking-platform/link-picker
|
|
20
|
-
*/
|
|
21
|
-
linkPicker?: LinkPickerOptions;
|
|
22
|
-
/**
|
|
23
|
-
* Enables and configure smart link behaviour
|
|
24
|
-
*/
|
|
25
|
-
smartLinks?: CardOptions;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Configuration for the Hyperlink plugin
|
|
29
|
-
*/
|
|
30
|
-
export interface HyperlinkPluginOptions {
|
|
31
|
-
cardOptions?: CardOptions;
|
|
32
|
-
linkPicker?: LinkPickerOptions;
|
|
33
|
-
platform?: 'mobile' | 'web';
|
|
34
|
-
editorAppearance?: EditorAppearance;
|
|
35
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { EditorState } from 'prosemirror-state';
|
|
2
|
-
import { IntlShape } from 'react-intl-next';
|
|
3
|
-
import { NodeType } from 'prosemirror-model';
|
|
4
|
-
import { FloatingToolbarItem } from '../../plugins/floating-toolbar/types';
|
|
5
|
-
import { Command } from '../../types';
|
|
6
|
-
import type { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
7
|
-
import type { PluginDependenciesAPI } from '@atlaskit/editor-common/types';
|
|
8
|
-
declare const buildLayoutButtons: (state: EditorState, intl: IntlShape, nodeType: NodeType, widthPluginDependencyApi: PluginDependenciesAPI<typeof widthPlugin> | undefined, allowResizing?: boolean, allowResizingInTables?: boolean, allowWrapping?: boolean, allowAlignment?: boolean) => FloatingToolbarItem<Command>[];
|
|
9
|
-
export default buildLayoutButtons;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { RefObject } from 'react';
|
|
3
|
-
import { Resizable } from 're-resizable';
|
|
4
|
-
import { RichMediaLayout } from '@atlaskit/adf-schema';
|
|
5
|
-
import { Props as ResizableMediaSingleProps, EnabledHandles } from './types';
|
|
6
|
-
import { DispatchAnalyticsEvent } from '../../plugins/analytics';
|
|
7
|
-
export interface ResizableNumberSize {
|
|
8
|
-
width: number;
|
|
9
|
-
height: number;
|
|
10
|
-
}
|
|
11
|
-
export type ResizerProps = Omit<ResizableMediaSingleProps, 'height' | 'width'> & {
|
|
12
|
-
selected?: boolean;
|
|
13
|
-
enable: EnabledHandles;
|
|
14
|
-
calcNewSize: (newWidth: number, stop: boolean) => {
|
|
15
|
-
layout: RichMediaLayout;
|
|
16
|
-
width: number | null;
|
|
17
|
-
};
|
|
18
|
-
snapPoints: number[];
|
|
19
|
-
scaleFactor?: number;
|
|
20
|
-
highlights: (width: number, snapPoints: number[]) => number[] | string[];
|
|
21
|
-
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
22
|
-
nodeType?: 'media' | 'embed';
|
|
23
|
-
innerPadding?: number;
|
|
24
|
-
height?: number;
|
|
25
|
-
width: number;
|
|
26
|
-
ratio?: string;
|
|
27
|
-
handleComponentFunc?: (side: string) => React.ReactElement<any> | undefined;
|
|
28
|
-
};
|
|
29
|
-
export type ResizerState = {
|
|
30
|
-
isResizing: boolean;
|
|
31
|
-
};
|
|
32
|
-
export default class Resizer extends React.Component<ResizerProps, ResizerState> {
|
|
33
|
-
resizable: RefObject<Resizable>;
|
|
34
|
-
state: {
|
|
35
|
-
isResizing: boolean;
|
|
36
|
-
};
|
|
37
|
-
private handleResizeStart;
|
|
38
|
-
private handleResize;
|
|
39
|
-
private handleResizeStop;
|
|
40
|
-
render(): JSX.Element;
|
|
41
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { RichMediaLayout } from '@atlaskit/adf-schema';
|
|
2
|
-
import type { MediaSingleProps } from '@atlaskit/editor-common/ui';
|
|
3
|
-
import { MediaClientConfig } from '@atlaskit/media-core';
|
|
4
|
-
import type { GridType } from '@atlaskit/editor-common/types';
|
|
5
|
-
import { EditorView } from 'prosemirror-view';
|
|
6
|
-
import { getPosHandler } from '../../nodeviews/types';
|
|
7
|
-
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
8
|
-
export type EnabledHandles = {
|
|
9
|
-
left?: boolean;
|
|
10
|
-
right?: boolean;
|
|
11
|
-
};
|
|
12
|
-
export type Props = MediaSingleProps & {
|
|
13
|
-
updateSize: (width: number | null, layout: RichMediaLayout) => void;
|
|
14
|
-
displayGrid: ((show: boolean, type: GridType, highlight: number[] | string[]) => void) | undefined;
|
|
15
|
-
getPos: getPosHandler;
|
|
16
|
-
view: EditorView;
|
|
17
|
-
lineLength: number;
|
|
18
|
-
gridSize: number;
|
|
19
|
-
containerWidth: number;
|
|
20
|
-
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
21
|
-
allowBreakoutSnapPoints?: boolean;
|
|
22
|
-
selected?: boolean;
|
|
23
|
-
viewMediaClientConfig?: MediaClientConfig;
|
|
24
|
-
fullWidthMode?: boolean;
|
|
25
|
-
updateWidth?: (newWidth: number) => void;
|
|
26
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
2
|
-
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
-
/**
|
|
4
|
-
* Sanitises a document where some content should not be in the document (e.g. mention names).
|
|
5
|
-
*
|
|
6
|
-
* It is expected that these names we be resolved separately (e.g. when rendering
|
|
7
|
-
* a node view).
|
|
8
|
-
*/
|
|
9
|
-
export declare function sanitizeNodeForPrivacy(json: JSONDocNode, providerFactory?: ProviderFactory): JSONDocNode;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, AnalyticsEventPayload, ACTION_SUBJECT_ID, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
export declare const buildEditLinkPayload: (type: LinkType) => AnalyticsEventPayload;
|
|
3
|
-
export type LinkType = ACTION_SUBJECT_ID.CARD_INLINE | ACTION_SUBJECT_ID.CARD_BLOCK | ACTION_SUBJECT_ID.EMBEDS | ACTION_SUBJECT_ID.HYPERLINK;
|
|
4
|
-
export declare const buildVisitedLinkPayload: (type: LinkType) => AnalyticsEventPayload;
|
|
5
|
-
export declare const buildOpenedSettingsPayload: (type: LinkType) => AnalyticsEventPayload;
|
|
6
|
-
export declare const unlinkPayload: (type: LinkType) => {
|
|
7
|
-
action: ACTION;
|
|
8
|
-
actionSubject: ACTION_SUBJECT;
|
|
9
|
-
actionSubjectId: ACTION_SUBJECT_ID.CARD_INLINE | undefined;
|
|
10
|
-
attributes: {
|
|
11
|
-
inputMethod: INPUT_METHOD;
|
|
12
|
-
};
|
|
13
|
-
eventType: EVENT_TYPE;
|
|
14
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { SnapPointsProps } from './../plugins/media/ui/ResizableMediaSingle/types';
|
|
2
|
-
import { RichMediaAttributes, RichMediaLayout } from '@atlaskit/adf-schema';
|
|
3
|
-
import { EditorView } from 'prosemirror-view';
|
|
4
|
-
export declare const nonWrappedLayouts: RichMediaLayout[];
|
|
5
|
-
export declare const floatingLayouts: string[];
|
|
6
|
-
export declare const isRichMediaInsideOfBlockNode: (view: EditorView, pos: number | boolean) => boolean;
|
|
7
|
-
export declare const alignAttributes: (layout: RichMediaLayout, oldAttrs: RichMediaAttributes, gridSize: number | undefined, originalWidth: number, lineLength?: number) => RichMediaAttributes;
|
|
8
|
-
export declare function calculateSnapPoints({ $pos, akEditorWideLayoutWidth, allowBreakoutSnapPoints, containerWidth, gridSize, gridWidth, insideInlineLike, insideLayout, isVideoFile, lineLength, offsetLeft, wrappedLayout, }: SnapPointsProps): number[];
|