@atlaskit/editor-common 74.5.2 → 74.7.0
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 +12 -0
- package/dist/cjs/analytics/index.js +26 -1
- package/dist/cjs/analytics/linking-utils.js +84 -0
- package/dist/cjs/card/MediaAndEmbedsToolbar/index.js +156 -0
- package/dist/cjs/card/index.js +9 -1
- package/dist/cjs/messages/index.js +14 -0
- package/dist/cjs/messages/link-toolbar.js +60 -0
- package/dist/cjs/messages/media-and-embed-toolbar.js +20 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/node-width/index.js +16 -2
- package/dist/cjs/react-node-view/getInlineNodeViewProducer.js +225 -0
- package/dist/cjs/react-node-view/index.js +13 -0
- package/dist/cjs/{ui/Resizer/index.js → resizer/Resizer.js} +6 -3
- package/dist/cjs/{resizer.js → resizer/index.js} +1 -1
- package/dist/cjs/resizer/utils.js +21 -0
- package/dist/cjs/styles/shared/resizer.js +1 -1
- package/dist/cjs/styles/shared/table.js +5 -4
- package/dist/cjs/types/hyperlink.js +5 -0
- package/dist/cjs/types/resizable-media-single.js +5 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/LinkSearch/const.js +14 -0
- package/dist/cjs/ui/ResizerLegacy/index.js +210 -0
- package/dist/cjs/ui/ResizerLegacy/styled.js +15 -0
- package/dist/cjs/ui/ResizerLegacy/types.js +5 -0
- package/dist/cjs/ui/ResizerLegacy/utils.js +21 -0
- package/dist/cjs/ui/index.js +58 -0
- package/dist/cjs/utils/document.js +258 -0
- package/dist/cjs/utils/editor-core-utils.js +7 -2
- package/dist/cjs/utils/filter/privacy-filter.js +55 -0
- package/dist/cjs/utils/index.js +75 -0
- package/dist/cjs/utils/rich-media-utils.js +131 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics/index.js +2 -1
- package/dist/es2019/analytics/linking-utils.js +74 -0
- package/dist/es2019/card/MediaAndEmbedsToolbar/index.js +161 -0
- package/dist/es2019/card/index.js +2 -1
- package/dist/es2019/messages/index.js +2 -0
- package/dist/es2019/messages/link-toolbar.js +53 -0
- package/dist/es2019/messages/media-and-embed-toolbar.js +13 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/node-width/index.js +12 -1
- package/dist/es2019/react-node-view/getInlineNodeViewProducer.js +219 -0
- package/dist/es2019/react-node-view/index.js +1 -0
- package/dist/es2019/{ui/Resizer/index.js → resizer/Resizer.js} +5 -3
- package/dist/es2019/resizer/index.js +1 -0
- package/dist/es2019/resizer/utils.js +12 -0
- package/dist/es2019/styles/shared/resizer.js +8 -4
- package/dist/es2019/styles/shared/table.js +5 -4
- package/dist/es2019/types/resizable-media-single.js +1 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/LinkSearch/const.js +4 -0
- package/dist/es2019/ui/ResizerLegacy/index.js +191 -0
- package/dist/es2019/ui/ResizerLegacy/styled.js +15 -0
- package/dist/es2019/ui/ResizerLegacy/types.js +1 -0
- package/dist/es2019/ui/ResizerLegacy/utils.js +12 -0
- package/dist/es2019/ui/index.js +5 -1
- package/dist/es2019/utils/document.js +253 -0
- package/dist/es2019/utils/editor-core-utils.js +4 -0
- package/dist/es2019/utils/filter/privacy-filter.js +47 -0
- package/dist/es2019/utils/index.js +5 -2
- package/dist/es2019/utils/rich-media-utils.js +109 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/index.js +2 -1
- package/dist/esm/analytics/linking-utils.js +74 -0
- package/dist/esm/card/MediaAndEmbedsToolbar/index.js +146 -0
- package/dist/esm/card/index.js +2 -1
- package/dist/esm/messages/index.js +2 -0
- package/dist/esm/messages/link-toolbar.js +53 -0
- package/dist/esm/messages/media-and-embed-toolbar.js +13 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/node-width/index.js +12 -1
- package/dist/esm/react-node-view/getInlineNodeViewProducer.js +215 -0
- package/dist/esm/react-node-view/index.js +1 -0
- package/dist/esm/{ui/Resizer/index.js → resizer/Resizer.js} +6 -3
- package/dist/esm/resizer/index.js +1 -0
- package/dist/esm/resizer/types.js +1 -0
- package/dist/esm/resizer/utils.js +12 -0
- package/dist/esm/styles/shared/resizer.js +1 -1
- package/dist/esm/styles/shared/table.js +5 -4
- package/dist/esm/types/hyperlink.js +1 -0
- package/dist/esm/types/resizable-media-single.js +1 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/LinkSearch/const.js +4 -0
- package/dist/esm/ui/ResizerLegacy/index.js +203 -0
- package/dist/esm/ui/ResizerLegacy/styled.js +7 -0
- package/dist/esm/ui/ResizerLegacy/types.js +1 -0
- package/dist/esm/ui/ResizerLegacy/utils.js +12 -0
- package/dist/esm/ui/index.js +5 -1
- package/dist/esm/utils/document.js +246 -0
- package/dist/esm/utils/editor-core-utils.js +4 -0
- package/dist/esm/utils/filter/privacy-filter.js +48 -0
- package/dist/esm/utils/index.js +5 -2
- package/dist/esm/utils/rich-media-utils.js +118 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/index.d.ts +2 -0
- package/dist/types/analytics/linking-utils.d.ts +14 -0
- package/dist/types/card/MediaAndEmbedsToolbar/index.d.ts +11 -0
- package/dist/types/card/index.d.ts +1 -0
- package/dist/types/messages/index.d.ts +2 -0
- package/dist/types/messages/link-toolbar.d.ts +52 -0
- package/dist/types/messages/media-and-embed-toolbar.d.ts +12 -0
- package/dist/types/node-width/index.d.ts +7 -0
- package/dist/types/react-node-view/getInlineNodeViewProducer.d.ts +25 -0
- package/dist/types/react-node-view/index.d.ts +3 -0
- package/dist/types/{ui/Resizer/index.d.ts → resizer/Resizer.d.ts} +1 -0
- package/dist/types/resizer/index.d.ts +2 -0
- package/dist/types/resizer/utils.d.ts +6 -0
- package/dist/types/styles/shared/table.d.ts +2 -1
- package/dist/types/types/hyperlink.d.ts +35 -0
- package/dist/types/types/index.d.ts +2 -0
- package/dist/types/types/resizable-media-single.d.ts +15 -0
- package/dist/types/ui/DropList/index.d.ts +1 -1
- package/dist/types/ui/LinkSearch/const.d.ts +4 -0
- package/dist/types/ui/ResizerLegacy/index.d.ts +40 -0
- package/dist/types/ui/ResizerLegacy/styled.d.ts +2 -0
- package/dist/types/ui/ResizerLegacy/types.d.ts +26 -0
- package/dist/types/ui/ResizerLegacy/utils.d.ts +6 -0
- package/dist/types/ui/index.d.ts +6 -0
- package/dist/types/utils/document.d.ts +19 -0
- package/dist/types/utils/editor-core-utils.d.ts +1 -0
- package/dist/types/utils/filter/privacy-filter.d.ts +9 -0
- package/dist/types/utils/index.d.ts +4 -1
- package/dist/types/utils/rich-media-utils.d.ts +8 -0
- package/dist/types-ts4.5/analytics/index.d.ts +2 -0
- package/dist/types-ts4.5/analytics/linking-utils.d.ts +14 -0
- package/dist/types-ts4.5/card/MediaAndEmbedsToolbar/index.d.ts +11 -0
- package/dist/types-ts4.5/card/index.d.ts +1 -0
- package/dist/types-ts4.5/messages/index.d.ts +2 -0
- package/dist/types-ts4.5/messages/link-toolbar.d.ts +52 -0
- package/dist/types-ts4.5/messages/media-and-embed-toolbar.d.ts +12 -0
- package/dist/types-ts4.5/node-width/index.d.ts +7 -0
- package/dist/types-ts4.5/react-node-view/getInlineNodeViewProducer.d.ts +25 -0
- package/dist/types-ts4.5/react-node-view/index.d.ts +3 -0
- package/dist/types-ts4.5/{ui/Resizer/index.d.ts → resizer/Resizer.d.ts} +1 -0
- package/dist/types-ts4.5/resizer/index.d.ts +2 -0
- package/dist/types-ts4.5/resizer/utils.d.ts +6 -0
- package/dist/types-ts4.5/styles/shared/table.d.ts +2 -1
- package/dist/types-ts4.5/types/hyperlink.d.ts +35 -0
- package/dist/types-ts4.5/types/index.d.ts +2 -0
- package/dist/types-ts4.5/types/resizable-media-single.d.ts +15 -0
- package/dist/types-ts4.5/ui/DropList/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/LinkSearch/const.d.ts +4 -0
- package/dist/types-ts4.5/ui/ResizerLegacy/index.d.ts +40 -0
- package/dist/types-ts4.5/ui/ResizerLegacy/styled.d.ts +2 -0
- package/dist/types-ts4.5/ui/ResizerLegacy/types.d.ts +26 -0
- package/dist/types-ts4.5/ui/ResizerLegacy/utils.d.ts +6 -0
- package/dist/types-ts4.5/ui/index.d.ts +6 -0
- package/dist/types-ts4.5/utils/document.d.ts +19 -0
- package/dist/types-ts4.5/utils/editor-core-utils.d.ts +1 -0
- package/dist/types-ts4.5/utils/filter/privacy-filter.d.ts +9 -0
- package/dist/types-ts4.5/utils/index.d.ts +4 -1
- package/dist/types-ts4.5/utils/rich-media-utils.d.ts +8 -0
- package/package.json +9 -9
- package/resizer/package.json +5 -5
- package/dist/cjs/ui/Resizer/utils.js +0 -8
- package/dist/es2019/resizer.js +0 -1
- package/dist/es2019/ui/Resizer/utils.js +0 -1
- package/dist/esm/resizer.js +0 -1
- package/dist/esm/ui/Resizer/utils.js +0 -1
- package/dist/types/resizer.d.ts +0 -2
- package/dist/types/ui/Resizer/utils.d.ts +0 -1
- package/dist/types-ts4.5/resizer.d.ts +0 -2
- package/dist/types-ts4.5/ui/Resizer/utils.d.ts +0 -1
- /package/dist/cjs/{ui/Resizer → resizer}/types.js +0 -0
- /package/dist/es2019/{ui/Resizer → resizer}/types.js +0 -0
- /package/dist/{esm/ui/Resizer/types.js → es2019/types/hyperlink.js} +0 -0
- /package/dist/types/{ui/Resizer → resizer}/types.d.ts +0 -0
- /package/dist/types-ts4.5/{ui/Resizer → resizer}/types.d.ts +0 -0
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { defineMessages } from 'react-intl-next';
|
|
2
2
|
export { codeBidiWarningMessages } from './codeBidiWarning';
|
|
3
3
|
export { linkMessages } from './link';
|
|
4
|
+
export { linkToolbarMessages } from './link-toolbar';
|
|
4
5
|
export { unsupportedContentMessages } from './unsupportedContent';
|
|
5
6
|
export { codeBlockButtonMessages } from './codeBlockButton';
|
|
6
7
|
export { toolbarInsertBlockMessages } from './insert-block';
|
|
8
|
+
export { toolbarMessages as mediaAndEmbedToolbarMessages } from './media-and-embed-toolbar';
|
|
7
9
|
export default defineMessages({
|
|
8
10
|
layoutFixedWidth: {
|
|
9
11
|
id: 'fabric.editor.layoutFixedWidth',
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl-next';
|
|
2
|
+
export var linkToolbarMessages = defineMessages({
|
|
3
|
+
addLink: {
|
|
4
|
+
id: 'fabric.editor.mediaAddLink',
|
|
5
|
+
defaultMessage: 'Add link',
|
|
6
|
+
description: 'Add link'
|
|
7
|
+
},
|
|
8
|
+
unableToOpenLink: {
|
|
9
|
+
id: 'fabric.editor.unableToOpenLink',
|
|
10
|
+
defaultMessage: 'Unable to open this link',
|
|
11
|
+
description: 'Unable to open this link'
|
|
12
|
+
},
|
|
13
|
+
unlink: {
|
|
14
|
+
id: 'fabric.editor.unlink',
|
|
15
|
+
defaultMessage: 'Unlink',
|
|
16
|
+
description: 'Removes the hyperlink but keeps your text.'
|
|
17
|
+
},
|
|
18
|
+
editLink: {
|
|
19
|
+
id: 'fabric.editor.editLink',
|
|
20
|
+
defaultMessage: 'Edit link',
|
|
21
|
+
description: 'Edit the link, update display text'
|
|
22
|
+
},
|
|
23
|
+
placeholder: {
|
|
24
|
+
id: 'fabric.editor.hyperlinkToolbarPlaceholder',
|
|
25
|
+
defaultMessage: 'Paste or search for link',
|
|
26
|
+
description: 'Paste or search for link'
|
|
27
|
+
},
|
|
28
|
+
linkPlaceholder: {
|
|
29
|
+
id: 'fabric.editor.linkPlaceholder',
|
|
30
|
+
defaultMessage: 'Paste link',
|
|
31
|
+
description: 'Create a new link by pasting a URL.'
|
|
32
|
+
},
|
|
33
|
+
linkAddress: {
|
|
34
|
+
id: 'fabric.editor.linkAddress',
|
|
35
|
+
defaultMessage: 'Link address',
|
|
36
|
+
description: 'Insert the address of the link'
|
|
37
|
+
},
|
|
38
|
+
invalidLink: {
|
|
39
|
+
id: 'fabric.editor.invalidLink',
|
|
40
|
+
defaultMessage: 'Please enter a valid link.',
|
|
41
|
+
description: 'Please enter a valid link.'
|
|
42
|
+
},
|
|
43
|
+
emptyLink: {
|
|
44
|
+
id: 'fabric.editor.emptyLink',
|
|
45
|
+
defaultMessage: 'Please enter a link.',
|
|
46
|
+
description: 'Please enter a link.'
|
|
47
|
+
},
|
|
48
|
+
settingsLink: {
|
|
49
|
+
id: 'fabric.editor.settingsLinks',
|
|
50
|
+
defaultMessage: 'Go to Link Preferences',
|
|
51
|
+
description: 'Go to Link Preferences'
|
|
52
|
+
}
|
|
53
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl-next';
|
|
2
|
+
export var toolbarMessages = defineMessages({
|
|
3
|
+
wrapLeft: {
|
|
4
|
+
id: 'fabric.editor.wrapLeft',
|
|
5
|
+
defaultMessage: 'Wrap left',
|
|
6
|
+
description: 'Aligns your image to the left and wraps text around it.'
|
|
7
|
+
},
|
|
8
|
+
wrapRight: {
|
|
9
|
+
id: 'fabric.editor.wrapRight',
|
|
10
|
+
defaultMessage: 'Wrap right',
|
|
11
|
+
description: 'Aligns your image to the right and wraps text around it.'
|
|
12
|
+
}
|
|
13
|
+
});
|
|
@@ -6,7 +6,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
6
6
|
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; }
|
|
7
7
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
8
8
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
9
|
-
var packageVersion = "74.
|
|
9
|
+
var packageVersion = "74.7.0";
|
|
10
10
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
11
11
|
// Remove URL as it has UGC
|
|
12
12
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
|
|
2
|
-
import { akEditorFullWidthLayoutWidth, akLayoutGutterOffset, gridMediumMaxWidth } from '@atlaskit/editor-shared-styles';
|
|
2
|
+
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorWideLayoutWidth, akLayoutGutterOffset, gridMediumMaxWidth } from '@atlaskit/editor-shared-styles';
|
|
3
3
|
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
4
4
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
5
5
|
import { BODIED_EXT_PADDING } from '../styles/shared/extension';
|
|
6
6
|
import { LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN } from '../styles/shared/layout';
|
|
7
7
|
import { absoluteBreakoutWidth } from '../utils/breakout';
|
|
8
|
+
export var layoutToWidth = {
|
|
9
|
+
default: akEditorDefaultLayoutWidth,
|
|
10
|
+
wide: akEditorWideLayoutWidth,
|
|
11
|
+
'full-width': akEditorFullWidthLayoutWidth
|
|
12
|
+
};
|
|
8
13
|
|
|
9
14
|
/**
|
|
10
15
|
* Calculates width of parent node of a nested node (inside layouts, extension)
|
|
@@ -76,4 +81,10 @@ var getNestedParentNode = function getNestedParentNode(tablePos, state) {
|
|
|
76
81
|
};
|
|
77
82
|
var calcBreakoutNodeWidth = function calcBreakoutNodeWidth(layout, containerWidth, isFullWidthModeEnabled) {
|
|
78
83
|
return isFullWidthModeEnabled ? Math.min(containerWidth.lineLength, akEditorFullWidthLayoutWidth) : absoluteBreakoutWidth(layout, containerWidth.width);
|
|
84
|
+
};
|
|
85
|
+
export var getTableContainerWidth = function getTableContainerWidth(node) {
|
|
86
|
+
if (node.attrs.width) {
|
|
87
|
+
return node.attrs.width;
|
|
88
|
+
}
|
|
89
|
+
return layoutToWidth[node.attrs.layout];
|
|
79
90
|
};
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
5
|
+
import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
|
|
6
|
+
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
7
|
+
import { analyticsEventKey, getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered, ZERO_WIDTH_SPACE } from '../utils';
|
|
8
|
+
export var inlineNodeViewClassname = 'inlineNodeView';
|
|
9
|
+
function createNodeView(_ref) {
|
|
10
|
+
var nodeViewParams = _ref.nodeViewParams,
|
|
11
|
+
pmPluginFactoryParams = _ref.pmPluginFactoryParams,
|
|
12
|
+
Component = _ref.Component,
|
|
13
|
+
extraComponentProps = _ref.extraComponentProps;
|
|
14
|
+
// We set a variable for the current node which is
|
|
15
|
+
// used for comparisions when doing updates, before being
|
|
16
|
+
// overwritten to the updated node.
|
|
17
|
+
var currentNode = nodeViewParams.node;
|
|
18
|
+
|
|
19
|
+
// First we setup the dom element which will be rendered and "tracked" by prosemirror
|
|
20
|
+
// and also used as a "editor portal" (not react portal) target by the editor
|
|
21
|
+
// portal provider api, for rendering the Component passed.
|
|
22
|
+
|
|
23
|
+
var domRef = document.createElement('span');
|
|
24
|
+
domRef.contentEditable = 'false';
|
|
25
|
+
setDomAttrs(nodeViewParams.node, domRef);
|
|
26
|
+
|
|
27
|
+
// @see ED-3790
|
|
28
|
+
// something gets messed up during mutation processing inside of a
|
|
29
|
+
// nodeView if DOM structure has nested plain "div"s, it doesn't see the
|
|
30
|
+
// difference between them and it kills the nodeView
|
|
31
|
+
domRef.classList.add("".concat(nodeViewParams.node.type.name, "View-content-wrap"), "".concat(inlineNodeViewClassname));
|
|
32
|
+
|
|
33
|
+
// This util is shared for tracking rendering, and the ErrorBoundary that
|
|
34
|
+
// is setup to wrap the Component when rendering
|
|
35
|
+
// NOTE: This is not a prosemirror dispatch
|
|
36
|
+
function dispatchAnalyticsEvent(payload) {
|
|
37
|
+
pmPluginFactoryParams.eventDispatcher.emit(analyticsEventKey, {
|
|
38
|
+
payload: payload
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// This is called to render the Component into domRef which is inside the
|
|
43
|
+
// prosemirror View.
|
|
44
|
+
// Internally it uses the unstable_renderSubtreeIntoContainer api to render,
|
|
45
|
+
// to the passed dom element (domRef) which means it is automatically
|
|
46
|
+
// "cleaned up" when you do a "re render".
|
|
47
|
+
function renderComponent() {
|
|
48
|
+
pmPluginFactoryParams.portalProviderAPI.render(getPortalChildren({
|
|
49
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
50
|
+
currentNode: currentNode,
|
|
51
|
+
nodeViewParams: nodeViewParams,
|
|
52
|
+
Component: Component,
|
|
53
|
+
extraComponentProps: extraComponentProps
|
|
54
|
+
}), domRef, false,
|
|
55
|
+
// node views should be rendered with intl context
|
|
56
|
+
true);
|
|
57
|
+
}
|
|
58
|
+
var _getPerformanceOption = getPerformanceOptions(nodeViewParams.view),
|
|
59
|
+
samplingRate = _getPerformanceOption.samplingRate,
|
|
60
|
+
slowThreshold = _getPerformanceOption.slowThreshold,
|
|
61
|
+
trackingEnabled = _getPerformanceOption.trackingEnabled;
|
|
62
|
+
trackingEnabled && startMeasureReactNodeViewRendered({
|
|
63
|
+
nodeTypeName: currentNode.type.name
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// We render the component while creating the node view
|
|
67
|
+
renderComponent();
|
|
68
|
+
trackingEnabled && stopMeasureReactNodeViewRendered({
|
|
69
|
+
nodeTypeName: currentNode.type.name,
|
|
70
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
71
|
+
editorState: nodeViewParams.view.state,
|
|
72
|
+
samplingRate: samplingRate,
|
|
73
|
+
slowThreshold: slowThreshold
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// https://prosemirror.net/docs/ref/#view.NodeView
|
|
77
|
+
var nodeView = {
|
|
78
|
+
get dom() {
|
|
79
|
+
return domRef;
|
|
80
|
+
},
|
|
81
|
+
update: function update(nextNode, _decorations) {
|
|
82
|
+
// Let ProseMirror handle the update if node types are different.
|
|
83
|
+
// This prevents an issue where it was not possible to select the
|
|
84
|
+
// inline node view then replace it by entering text - the node
|
|
85
|
+
// view contents would be deleted but the node view itself would
|
|
86
|
+
// stay in the view and become uneditable.
|
|
87
|
+
if (currentNode.type !== nextNode.type) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
// On updates, we only set the new attributes if the type, attributes, and marks
|
|
91
|
+
// have changed on the node.
|
|
92
|
+
|
|
93
|
+
// NOTE: this could mean attrs changes aren't reflected in the dom,
|
|
94
|
+
// when an attribute key which was previously present is no longer
|
|
95
|
+
// present.
|
|
96
|
+
// ie.
|
|
97
|
+
// -> Original attributes { text: "hello world", color: "red" }
|
|
98
|
+
// -> Updated attributes { color: "blue" }
|
|
99
|
+
// in this case, the dom text attribute will not be cleared.
|
|
100
|
+
//
|
|
101
|
+
// This may not be an issue with any of our current node schemas.
|
|
102
|
+
if (!currentNode.sameMarkup(nextNode)) {
|
|
103
|
+
setDomAttrs(nextNode, domRef);
|
|
104
|
+
}
|
|
105
|
+
currentNode = nextNode;
|
|
106
|
+
renderComponent();
|
|
107
|
+
return true;
|
|
108
|
+
},
|
|
109
|
+
destroy: function destroy() {
|
|
110
|
+
// When prosemirror destroys the node view, we need to clean up
|
|
111
|
+
// what we have previously rendered using the editor portal
|
|
112
|
+
// provider api.
|
|
113
|
+
pmPluginFactoryParams.portalProviderAPI.remove(domRef);
|
|
114
|
+
// @ts-expect-error Expect an error as domRef is expected to be
|
|
115
|
+
// of HTMLSpanElement type however once the node view has
|
|
116
|
+
// been destroyed no other consumers should still be using it.
|
|
117
|
+
domRef = undefined;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
return nodeView;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Copies the attributes from a ProseMirror Node to a DOM node.
|
|
125
|
+
* @param node The Prosemirror Node from which to source the attributes
|
|
126
|
+
*/
|
|
127
|
+
function setDomAttrs(node, element) {
|
|
128
|
+
Object.keys(node.attrs || {}).forEach(function (attr) {
|
|
129
|
+
element.setAttribute(attr, node.attrs[attr]);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function getPortalChildren(_ref2) {
|
|
133
|
+
var dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
|
|
134
|
+
currentNode = _ref2.currentNode,
|
|
135
|
+
nodeViewParams = _ref2.nodeViewParams,
|
|
136
|
+
Component = _ref2.Component,
|
|
137
|
+
extraComponentProps = _ref2.extraComponentProps;
|
|
138
|
+
return function portalChildren() {
|
|
139
|
+
var _currentNode$type$nam, _currentNode$type;
|
|
140
|
+
// All inline nodes use `display: inline` to allow for multi-line
|
|
141
|
+
// wrapping. This does produce an issue in Chrome where it is not
|
|
142
|
+
// possible to click select the position after the node,
|
|
143
|
+
// see: https://product-fabric.atlassian.net/browse/ED-12003
|
|
144
|
+
// however this is only a problem for node views that use
|
|
145
|
+
// `display: inline-block` somewhere within the Component.
|
|
146
|
+
// Looking at the below structure, spans with className
|
|
147
|
+
// `inlineNodeViewAddZeroWidthSpace` have pseudo elements that
|
|
148
|
+
// add a zero width space which fixes the problem.
|
|
149
|
+
// Without the additional zero width space before the Component,
|
|
150
|
+
// it is not possible to use the keyboard to range select in Safari.
|
|
151
|
+
//
|
|
152
|
+
// Zero width spaces on either side of the Component also prevent
|
|
153
|
+
// the cursor from appearing inside the node view on all browsers.
|
|
154
|
+
//
|
|
155
|
+
// Note:
|
|
156
|
+
// In future it is worth considering prohibiting the use of `display: inline-block`
|
|
157
|
+
// within inline node view Components however would require a sizable
|
|
158
|
+
// refactor. A test suite to catch any instances of this is ideal however
|
|
159
|
+
// the refactor required is currently out of scope for https://product-fabric.atlassian.net/browse/ED-14176
|
|
160
|
+
|
|
161
|
+
return jsx(ErrorBoundary, {
|
|
162
|
+
component: ACTION_SUBJECT.REACT_NODE_VIEW,
|
|
163
|
+
componentId: (_currentNode$type$nam = currentNode === null || currentNode === void 0 ? void 0 : (_currentNode$type = currentNode.type) === null || _currentNode$type === void 0 ? void 0 : _currentNode$type.name) !== null && _currentNode$type$nam !== void 0 ? _currentNode$type$nam : ACTION_SUBJECT_ID.UNKNOWN_NODE,
|
|
164
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
165
|
+
}, jsx("span", {
|
|
166
|
+
"aria-hidden": "true",
|
|
167
|
+
className: "zeroWidthSpaceContainer"
|
|
168
|
+
}, jsx("span", {
|
|
169
|
+
className: "".concat(inlineNodeViewClassname, "AddZeroWidthSpace")
|
|
170
|
+
}), ZERO_WIDTH_SPACE), jsx(Component, _extends({
|
|
171
|
+
view: nodeViewParams.view,
|
|
172
|
+
getPos: nodeViewParams.getPos,
|
|
173
|
+
node: currentNode
|
|
174
|
+
}, extraComponentProps)), jsx("span", {
|
|
175
|
+
"aria-hidden": "true",
|
|
176
|
+
className: "".concat(inlineNodeViewClassname, "AddZeroWidthSpace")
|
|
177
|
+
}));
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// https://prosemirror.net/docs/ref/#view.EditorProps.nodeViews
|
|
182
|
+
// The prosemirror EditorProps has a nodeViews key which has the rough shape:
|
|
183
|
+
// type nodeViews: {
|
|
184
|
+
// [nodeViewName: string]: (node, editorView, getPos, decorations, innerDecorations) => NodeView
|
|
185
|
+
// }
|
|
186
|
+
// So the value of the keys on the nodeViews object, are a function which should return a NodeView.
|
|
187
|
+
// The following type NodeViewProducer, refers to these functions which return a NodeView.
|
|
188
|
+
//
|
|
189
|
+
// So the above type could also be described as
|
|
190
|
+
// type NodeViewProducer = (node, editorView, getPos, decorations, innerDecorations) => NodeView
|
|
191
|
+
// nodeViews: {
|
|
192
|
+
// [nodeViewName: string]: NodeViewProducer
|
|
193
|
+
// }
|
|
194
|
+
// This return of this function is intended to be the value of a key
|
|
195
|
+
// in a ProseMirror nodeViews object.
|
|
196
|
+
export function getInlineNodeViewProducer(_ref3) {
|
|
197
|
+
var pmPluginFactoryParams = _ref3.pmPluginFactoryParams,
|
|
198
|
+
Component = _ref3.Component,
|
|
199
|
+
extraComponentProps = _ref3.extraComponentProps;
|
|
200
|
+
function nodeViewProducer() {
|
|
201
|
+
var nodeView = createNodeView({
|
|
202
|
+
nodeViewParams: {
|
|
203
|
+
node: arguments.length <= 0 ? undefined : arguments[0],
|
|
204
|
+
view: arguments.length <= 1 ? undefined : arguments[1],
|
|
205
|
+
getPos: arguments.length <= 2 ? undefined : arguments[2],
|
|
206
|
+
decorations: arguments.length <= 3 ? undefined : arguments[3]
|
|
207
|
+
},
|
|
208
|
+
pmPluginFactoryParams: pmPluginFactoryParams,
|
|
209
|
+
Component: Component,
|
|
210
|
+
extraComponentProps: extraComponentProps
|
|
211
|
+
});
|
|
212
|
+
return nodeView;
|
|
213
|
+
}
|
|
214
|
+
return nodeViewProducer;
|
|
215
|
+
}
|
|
@@ -8,6 +8,7 @@ import { createDispatch } from '../event-dispatcher';
|
|
|
8
8
|
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
9
9
|
import { getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from '../utils';
|
|
10
10
|
import { analyticsEventKey } from '../utils/analytics';
|
|
11
|
+
export { getInlineNodeViewProducer, inlineNodeViewClassname } from './getInlineNodeViewProducer';
|
|
11
12
|
var ReactNodeView = /*#__PURE__*/function () {
|
|
12
13
|
function ReactNodeView(_node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent) {
|
|
13
14
|
var _this = this;
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { Resizable } from 're-resizable';
|
|
5
|
-
import { resizerHandleLeftClassName, resizerHandlePadding, resizerHandlerClassName, resizerHandleRightClassName, resizerHandleStickyClassName, resizerHandleZIndex, resizerItemClassName } from '
|
|
5
|
+
import { resizerHandleLeftClassName, resizerHandlePadding, resizerHandlerClassName, resizerHandleRightClassName, resizerHandleStickyClassName, resizerHandleZIndex, resizerItemClassName } from '../styles/shared/resizer';
|
|
6
6
|
export default function ResizerNext(props) {
|
|
7
7
|
var _classnames, _classnames2;
|
|
8
8
|
var resizable = React.useRef(null);
|
|
@@ -12,7 +12,9 @@ export default function ResizerNext(props) {
|
|
|
12
12
|
_props$handlerHeightS = props.handlerHeightSize,
|
|
13
13
|
handlerHeightSize = _props$handlerHeightS === void 0 ? 'medium' : _props$handlerHeightS,
|
|
14
14
|
_props$handleAlignmen = props.handleAlignmentMethod,
|
|
15
|
-
handleAlignmentMethod = _props$handleAlignmen === void 0 ? 'center' : _props$handleAlignmen
|
|
15
|
+
handleAlignmentMethod = _props$handleAlignmen === void 0 ? 'center' : _props$handleAlignmen,
|
|
16
|
+
_props$resizeRatio = props.resizeRatio,
|
|
17
|
+
resizeRatio = _props$resizeRatio === void 0 ? 1 : _props$resizeRatio;
|
|
16
18
|
var onResizeStart = React.useCallback(function (event) {
|
|
17
19
|
// prevent creating a drag event on Firefox
|
|
18
20
|
event.preventDefault();
|
|
@@ -83,6 +85,7 @@ export default function ResizerNext(props) {
|
|
|
83
85
|
,
|
|
84
86
|
onResizeStart: onResizeStart,
|
|
85
87
|
onResize: onResize,
|
|
86
|
-
onResizeStop: onResizeStop
|
|
88
|
+
onResizeStop: onResizeStop,
|
|
89
|
+
resizeRatio: resizeRatio
|
|
87
90
|
}, props.children);
|
|
88
91
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ResizerNext } from './Resizer';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
};
|
|
@@ -24,4 +24,4 @@ export var resizerHandlerClassName = {
|
|
|
24
24
|
medium: resizerHandlerMediumClassName,
|
|
25
25
|
large: resizerHandlerLargeClassName
|
|
26
26
|
};
|
|
27
|
-
export var resizerStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", "
|
|
27
|
+
export var resizerStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", ", .", " {\n display: flex;\n visibility: hidden;\n flex-direction: column;\n justify-content: center;\n }\n\n .", " {\n align-items: flex-end;\n }\n\n .", " {\n align-items: flex-start;\n }\n\n .", "::after,\n .", "::after {\n content: ' ';\n display: flex;\n width: 3px;\n height: 64px;\n\n border-radius: 6px;\n }\n\n .", ":hover\n .", ",\n .", ":hover\n .", " {\n visibility: visible;\n }\n\n .", ":hover\n .", "::after,\n .", ":hover\n .", "::after {\n background: ", ";\n }\n\n .", "\n .", "::after,\n .", "\n .", "::after,\n .", "\n .", ":hover::after,\n .", "\n .", ":hover::after,\n .", ".is-resizing\n .", "::after,\n .", ".is-resizing\n .", "::after {\n background: ", ";\n }\n\n .", ".", "::after,\n .", ".", "::after {\n height: 64px;\n }\n\n .", ".", "::after,\n .", ".", "::after {\n height: 43px;\n }\n\n .", ".", "::after,\n .", ".", "::after {\n height: 96px;\n }\n\n .", ".", "::after,\n .", ".", "::after {\n position: sticky;\n top: 10px;\n bottom: 10px;\n }\n"])), resizerHandleRightClassName, resizerHandleLeftClassName, resizerHandleRightClassName, resizerHandleLeftClassName, resizerHandleRightClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleRightClassName, "var(--ds-border, ".concat(N60, ")"), akEditorSelectedNodeClassName, resizerHandleRightClassName, akEditorSelectedNodeClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleLeftClassName, "var(--ds-border-focused, ".concat(B200, ")"), resizerHandleRightClassName, resizerHandlerClassName.medium, resizerHandleLeftClassName, resizerHandlerClassName.medium, resizerHandleRightClassName, resizerHandlerClassName.small, resizerHandleLeftClassName, resizerHandlerClassName.small, resizerHandleRightClassName, resizerHandlerClassName.large, resizerHandleLeftClassName, resizerHandlerClassName.large, resizerHandleRightClassName, resizerHandleStickyClassName, resizerHandleLeftClassName, resizerHandleStickyClassName);
|
|
@@ -34,7 +34,8 @@ export var TableSharedCssClassName = {
|
|
|
34
34
|
TABLE_CELL_WRAPPER: tableCellSelector,
|
|
35
35
|
TABLE_HEADER_CELL_WRAPPER: tableHeaderSelector,
|
|
36
36
|
TABLE_ROW_CONTROLS_WRAPPER: "".concat(tablePrefixSelector, "-row-controls-wrapper"),
|
|
37
|
-
TABLE_COLUMN_CONTROLS_DECORATIONS: "".concat(tablePrefixSelector, "-column-controls-decoration")
|
|
37
|
+
TABLE_COLUMN_CONTROLS_DECORATIONS: "".concat(tablePrefixSelector, "-column-controls-decoration"),
|
|
38
|
+
TABLE_RESIZER_CONTAINER: "".concat(tablePrefixSelector, "-resizer-container")
|
|
38
39
|
};
|
|
39
40
|
var tableSharedStyle = function tableSharedStyle(props) {
|
|
40
41
|
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n .", " {\n position: relative;\n margin: 0 auto ", "px;\n box-sizing: border-box;\n\n /**\n * Fix block top alignment inside table cells.\n */\n .decisionItemView-content-wrap:first-of-type > div {\n margin-top: 0;\n }\n }\n .", "[data-number-column='true'] {\n padding-left: ", "px;\n clear: both;\n }\n .", " > table {\n margin: ", "px 0 0 0;\n }\n\n .", " > table,\n .", " > table {\n margin: ", "px ", "px 0 0;\n }\n\n /* avoid applying styles to nested tables (possible via extensions) */\n .", " > table,\n .", " > table,\n .", " > table {\n border-collapse: collapse;\n border: ", "px solid\n ", ";\n table-layout: fixed;\n font-size: 1em;\n width: 100%;\n\n &[data-autosize='true'] {\n table-layout: auto;\n }\n\n & {\n * {\n box-sizing: border-box;\n }\n hr {\n box-sizing: content-box;\n }\n\n tbody {\n border-bottom: none;\n }\n th td {\n background-color: ", ";\n }\n th,\n td {\n min-width: ", "px;\n font-weight: normal;\n vertical-align: top;\n border: 1px solid\n ", ";\n border-right-width: 0;\n border-bottom-width: 0;\n padding: ", "px;\n /* https://stackoverflow.com/questions/7517127/borders-not-shown-in-firefox-with-border-collapse-on-table-position-relative-o */\n ", "\n\n ", ";\n\n > :first-child:not(style),\n > style:first-child + * {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-child + *,\n > style:first-child + .ProseMirror-gapcursor + * {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-child + span + *,\n > style:first-child + .ProseMirror-gapcursor + span + * {\n margin-top: 0;\n }\n\n th p:not(:first-of-type),\n td p:not(:first-of-type) {\n margin-top: 12px;\n }\n }\n th {\n background-color: ", ";\n text-align: left;\n\n /* only apply this styling to codeblocks in default background headercells */\n /* TODO this needs to be overhauled as it relies on unsafe selectors */\n &:not([style]):not(.danger) {\n .", ":not(.danger) {\n background-color: ", ";\n\n :not(.", ") {\n box-shadow: 0px 0px 0px 1px\n ", ";\n }\n\n .", " {\n background-image: ", ";\n\n background-color: ", ";\n }\n\n .", " {\n background-color: ", ";\n }\n\n /* this is only relevant to the element taken care of by renderer */\n > [data-ds--code--code-block] {\n background-image: ", "!important;\n\n background-color: ", "!important;\n\n // selector lives inside @atlaskit/code\n --ds--code--line-number-bg-color: ", ";\n }\n }\n }\n }\n }\n }\n"])), tableCellBackgroundStyleOverride(), TableSharedCssClassName.TABLE_CONTAINER, tableMarginBottom, TableSharedCssClassName.TABLE_CONTAINER, akEditorTableNumberColumnWidth - 1, TableSharedCssClassName.TABLE_NODE_WRAPPER, tableMarginTop, TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, tableMarginTop, tableMarginSides, TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_NODE_WRAPPER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, tableCellBorderWidth, themed({
|
|
@@ -81,12 +82,12 @@ export var calcTableWidth = function calcTableWidth(layout, containerWidth) {
|
|
|
81
82
|
var addControllerPadding = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
82
83
|
switch (layout) {
|
|
83
84
|
case 'full-width':
|
|
84
|
-
return containerWidth ?
|
|
85
|
+
return containerWidth ? Math.min(containerWidth - (addControllerPadding ? akEditorBreakoutPadding : 0), akEditorFullWidthLayoutWidth) : akEditorFullWidthLayoutWidth;
|
|
85
86
|
case 'wide':
|
|
86
87
|
if (containerWidth) {
|
|
87
|
-
return
|
|
88
|
+
return Math.min(containerWidth - (addControllerPadding ? akEditorBreakoutPadding : 0), akEditorWideLayoutWidth);
|
|
88
89
|
}
|
|
89
|
-
return
|
|
90
|
+
return akEditorWideLayoutWidth;
|
|
90
91
|
default:
|
|
91
92
|
return 'inherit';
|
|
92
93
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -18,7 +18,7 @@ import { themed } from '@atlaskit/theme/components';
|
|
|
18
18
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
19
19
|
import Layer from '../Layer';
|
|
20
20
|
var packageName = "@atlaskit/editor-common";
|
|
21
|
-
var packageVersion = "74.
|
|
21
|
+
var packageVersion = "74.7.0";
|
|
22
22
|
var halfFocusRing = 1;
|
|
23
23
|
var dropOffset = '0, 8';
|
|
24
24
|
var DropList = /*#__PURE__*/function (_Component) {
|