@atlaskit/editor-core 197.2.7 → 197.3.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 +27 -0
- package/dist/cjs/actions/index.js +3 -2
- package/dist/cjs/composable-editor/editor-internal.js +2 -1
- package/dist/cjs/composable-editor/hooks/useProviders.js +11 -1
- package/dist/cjs/composable-editor/utils/handleProviders.js +3 -1
- package/dist/cjs/create-editor/ReactEditorView.js +11 -8
- package/dist/cjs/presets/universal.js +8 -2
- package/dist/cjs/ui/ContentStyles/expand.js +9 -4
- package/dist/cjs/ui/ContentStyles/layout.js +8 -2
- package/dist/cjs/ui/Toolbar/ToolbarWithSizeDetector.js +3 -1
- package/dist/cjs/utils/getNodesCount.js +13 -0
- package/dist/cjs/utils/index.js +2 -2
- package/dist/cjs/utils/performance/getTimeSince.js +16 -0
- package/dist/cjs/utils/performance/track-transactions.js +5 -4
- package/dist/cjs/utils/{document.js → processRawFragmentValue.js} +2 -10
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/actions/index.js +3 -2
- package/dist/es2019/composable-editor/editor-internal.js +2 -1
- package/dist/es2019/composable-editor/hooks/useProviders.js +11 -1
- package/dist/es2019/composable-editor/utils/handleProviders.js +3 -1
- package/dist/es2019/create-editor/ReactEditorView.js +6 -3
- package/dist/es2019/presets/universal.js +8 -2
- package/dist/es2019/ui/ContentStyles/expand.js +16 -2
- package/dist/es2019/ui/ContentStyles/layout.js +25 -15
- package/dist/es2019/ui/Toolbar/ToolbarWithSizeDetector.js +3 -1
- package/dist/es2019/utils/getNodesCount.js +7 -0
- package/dist/es2019/utils/index.js +1 -1
- package/dist/es2019/utils/performance/getTimeSince.js +8 -0
- package/dist/es2019/utils/performance/track-transactions.js +2 -1
- package/dist/es2019/utils/{document.js → processRawFragmentValue.js} +1 -8
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/actions/index.js +3 -2
- package/dist/esm/composable-editor/editor-internal.js +2 -1
- package/dist/esm/composable-editor/hooks/useProviders.js +11 -1
- package/dist/esm/composable-editor/utils/handleProviders.js +3 -1
- package/dist/esm/create-editor/ReactEditorView.js +6 -3
- package/dist/esm/presets/universal.js +8 -2
- package/dist/esm/ui/ContentStyles/expand.js +9 -4
- package/dist/esm/ui/ContentStyles/layout.js +7 -2
- package/dist/esm/ui/Toolbar/ToolbarWithSizeDetector.js +3 -1
- package/dist/esm/utils/getNodesCount.js +7 -0
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/performance/getTimeSince.js +10 -0
- package/dist/esm/utils/performance/track-transactions.js +2 -1
- package/dist/esm/utils/{document.js → processRawFragmentValue.js} +1 -8
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/composable-editor/hooks/useProviders.d.ts +3 -1
- package/dist/types/create-editor/ReactEditorView.d.ts +2 -1
- package/dist/types/create-editor/create-universal-preset.d.ts +1453 -77
- package/dist/types/presets/default.d.ts +1295 -45
- package/dist/types/presets/universal.d.ts +1453 -77
- package/dist/types/presets/useUniversalPreset.d.ts +2202 -826
- package/dist/types/utils/getNodesCount.d.ts +2 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/performance/getTimeSince.d.ts +8 -0
- package/dist/{types-ts4.5/utils/document.d.ts → types/utils/processRawFragmentValue.d.ts} +1 -2
- package/dist/types-ts4.5/composable-editor/hooks/useProviders.d.ts +3 -1
- package/dist/types-ts4.5/create-editor/ReactEditorView.d.ts +2 -1
- package/dist/types-ts4.5/create-editor/create-universal-preset.d.ts +1645 -60
- package/dist/types-ts4.5/presets/default.d.ts +1464 -24
- package/dist/types-ts4.5/presets/universal.d.ts +1645 -60
- package/dist/types-ts4.5/presets/useUniversalPreset.d.ts +2421 -836
- package/dist/types-ts4.5/utils/getNodesCount.d.ts +2 -0
- package/dist/types-ts4.5/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/utils/performance/getTimeSince.d.ts +8 -0
- package/dist/{types/utils/document.d.ts → types-ts4.5/utils/processRawFragmentValue.d.ts} +1 -2
- package/package.json +13 -13
|
@@ -4,12 +4,24 @@ import { BreakoutCssClassName, expandClassNames, sharedExpandStyles } from '@atl
|
|
|
4
4
|
import { akEditorSelectedNodeClassName, akLayoutGutterOffset, getSelectionStyles, SelectionStyle } from '@atlaskit/editor-shared-styles';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import { N100A, N40A, N50A, R300, R50 } from '@atlaskit/theme/colors';
|
|
7
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
8
|
const EXPAND_SELECTED_BACKGROUND = "var(--ds-background-neutral-subtle, rgba(255, 255, 255, 0.6))";
|
|
8
9
|
const EXPAND_ICON_COLOR = () => css({
|
|
9
10
|
color: `var(--ds-icon-subtle, ${N100A})`
|
|
10
11
|
});
|
|
11
12
|
const DANGER_STATE_BACKGROUND_COLOR = `var(--ds-background-danger, ${R50})`;
|
|
12
13
|
const DANGER_STATE_BORDER_COLOR = `var(--ds-border-danger, ${R300})`;
|
|
14
|
+
const firstNodeWithNotMarginTop = () => editorExperiment('nested-dnd', true) ?
|
|
15
|
+
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
16
|
+
css`
|
|
17
|
+
> :nth-child(1 of :not(style, .ProseMirror-gapcursor, .ProseMirror-widget, span)) {
|
|
18
|
+
margin-top: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
> div.ak-editor-expand[data-node-type='nestedExpand'] {
|
|
22
|
+
margin-top: ${"var(--ds-space-050, 0.25rem)"};
|
|
23
|
+
}
|
|
24
|
+
` : '';
|
|
13
25
|
|
|
14
26
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
15
27
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation
|
|
@@ -50,8 +62,8 @@ export const expandStyles = () => css`
|
|
|
50
62
|
> .${expandClassNames.type('expand')},
|
|
51
63
|
.${BreakoutCssClassName.BREAKOUT_MARK_DOM}
|
|
52
64
|
> .${expandClassNames.type('expand')} {
|
|
53
|
-
margin-left: -${akLayoutGutterOffset}px;
|
|
54
|
-
margin-right: -${akLayoutGutterOffset}px;
|
|
65
|
+
margin-left: -${akLayoutGutterOffset + (editorExperiment('nested-dnd', true) ? 8 : 0)}px;
|
|
66
|
+
margin-right: -${akLayoutGutterOffset + (editorExperiment('nested-dnd', true) ? 8 : 0)}px;
|
|
55
67
|
}
|
|
56
68
|
|
|
57
69
|
.${expandClassNames.content} {
|
|
@@ -80,6 +92,8 @@ export const expandStyles = () => css`
|
|
|
80
92
|
|
|
81
93
|
.${expandClassNames.content} {
|
|
82
94
|
padding-top: ${"var(--ds-space-100, 8px)"};
|
|
95
|
+
|
|
96
|
+
${firstNodeWithNotMarginTop()}
|
|
83
97
|
}
|
|
84
98
|
}
|
|
85
99
|
|
|
@@ -7,6 +7,29 @@ import { akEditorDeleteBackground, akEditorDeleteBorder, akEditorSelectedBorderS
|
|
|
7
7
|
import { N40A, N50A } from '@atlaskit/theme/colors';
|
|
8
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
9
|
export { LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN };
|
|
10
|
+
const firstNodeWithNotMarginTop = () => editorExperiment('nested-dnd', true) ?
|
|
11
|
+
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
12
|
+
css`
|
|
13
|
+
> :nth-child(1 of :not(style, .ProseMirror-gapcursor, .ProseMirror-widget, span)) {
|
|
14
|
+
margin-top: 0;
|
|
15
|
+
}
|
|
16
|
+
` :
|
|
17
|
+
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
18
|
+
css`
|
|
19
|
+
> :not(style):first-child,
|
|
20
|
+
> style:first-child + * {
|
|
21
|
+
margin-top: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
> .ProseMirror-gapcursor:first-child + *,
|
|
25
|
+
> style:first-child + .ProseMirror-gapcursor + * {
|
|
26
|
+
margin-top: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
> .ProseMirror-gapcursor:first-child + span + * {
|
|
30
|
+
margin-top: 0;
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
10
33
|
|
|
11
34
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation
|
|
12
35
|
export const layoutStyles = viewMode => css`
|
|
@@ -25,25 +48,12 @@ export const layoutStyles = viewMode => css`
|
|
|
25
48
|
border: ${viewMode === 'view' ? 0 : akEditorSelectedBorderSize}px solid
|
|
26
49
|
${`var(--ds-border, ${N40A})`};
|
|
27
50
|
border-radius: 4px;
|
|
28
|
-
padding: ${LAYOUT_COLUMN_PADDING}px
|
|
51
|
+
padding: ${LAYOUT_COLUMN_PADDING}px
|
|
29
52
|
${LAYOUT_COLUMN_PADDING + (editorExperiment('nested-dnd', true) ? 8 : 0)}px;
|
|
30
53
|
box-sizing: border-box;
|
|
31
54
|
|
|
32
55
|
> div {
|
|
33
|
-
|
|
34
|
-
> style:first-child + * {
|
|
35
|
-
margin-top: 0;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
> .ProseMirror-gapcursor:first-child + *,
|
|
39
|
-
> style:first-child + .ProseMirror-gapcursor + * {
|
|
40
|
-
margin-top: 0;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
> .ProseMirror-gapcursor:first-child + span + *,
|
|
44
|
-
> style:first-child + .ProseMirror-gapcursor:first-child + span + * {
|
|
45
|
-
margin-top: 0;
|
|
46
|
-
}
|
|
56
|
+
${firstNodeWithNotMarginTop()}
|
|
47
57
|
|
|
48
58
|
> .embedCardView-content-wrap:first-of-type .rich-media-item {
|
|
49
59
|
margin-top: 0;
|
|
@@ -7,6 +7,7 @@ import React, { useMemo } from 'react';
|
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
|
+
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
10
11
|
import { akEditorMobileMaxWidth } from '@atlaskit/editor-shared-styles';
|
|
11
12
|
import { WidthObserver } from '@atlaskit/width-detector';
|
|
12
13
|
import { isFullPage } from '../../utils/is-full-page';
|
|
@@ -31,7 +32,8 @@ export const ToolbarWithSizeDetector = props => {
|
|
|
31
32
|
const elementWidth = useElementWidth(ref, {
|
|
32
33
|
skip: typeof width !== 'undefined'
|
|
33
34
|
});
|
|
34
|
-
const
|
|
35
|
+
const defaultToolbarSize = isSSR() && isFullPage(props.appearance) ? ToolbarSize.XXL : undefined;
|
|
36
|
+
const toolbarSize = typeof width === 'undefined' && typeof elementWidth === 'undefined' ? defaultToolbarSize : widthToToolbarSize(width || elementWidth, props.appearance);
|
|
35
37
|
const toolbarStyle = useMemo(() => {
|
|
36
38
|
const toolbarWidth = isFullPage(props.appearance) && props.twoLineEditorToolbar ? ToolbarSize.S : ToolbarSize.M;
|
|
37
39
|
const toolbarMinWidth = toolbarSizeToWidth(toolbarWidth, props.appearance);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculate the difference between performance.now() and the given startTime.
|
|
3
|
+
* This allows for the timing to be overridable during tests.
|
|
4
|
+
*
|
|
5
|
+
* @param startTime DOMHighResTimeStamp
|
|
6
|
+
* @returns DOMHighResTimeStamp
|
|
7
|
+
*/
|
|
8
|
+
export const getTimeSince = startTime => performance.now() - startTime;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { isPerformanceAPIAvailable } from '@atlaskit/editor-common/is-performance-api-available';
|
|
2
3
|
import { startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
|
|
3
|
-
import { getTimeSince
|
|
4
|
+
import { getTimeSince } from './getTimeSince';
|
|
4
5
|
export const EVENT_NAME_STATE_APPLY = `🦉 EditorView::state::apply`;
|
|
5
6
|
export const EVENT_NAME_UPDATE_STATE = `🦉 EditorView::updateState`;
|
|
6
7
|
export const EVENT_NAME_VIEW_STATE_UPDATED = `🦉 EditorView::onEditorViewStateUpdated`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { processRawValue } from '@atlaskit/editor-common/
|
|
1
|
+
import { processRawValue } from '@atlaskit/editor-common/process-raw-value';
|
|
2
2
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
export function processRawFragmentValue(schema, value, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent) {
|
|
4
4
|
if (!value) {
|
|
@@ -9,11 +9,4 @@ export function processRawFragmentValue(schema, value, providerFactory, sanitize
|
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
11
|
return Fragment.from(adfEntities);
|
|
12
|
-
}
|
|
13
|
-
export function getNodesCount(node) {
|
|
14
|
-
let count = {};
|
|
15
|
-
node.nodesBetween(0, node.nodeSize - 2, node => {
|
|
16
|
-
count[node.type.name] = (count[node.type.name] || 0) + 1;
|
|
17
|
-
});
|
|
18
|
-
return count;
|
|
19
12
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "197.
|
|
2
|
+
export const version = "197.3.0";
|
|
@@ -3,7 +3,8 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
|
-
import {
|
|
6
|
+
import { processRawValue } from '@atlaskit/editor-common/process-raw-value';
|
|
7
|
+
import { findNodePosByLocalIds, isEmptyDocument, toJSON } from '@atlaskit/editor-common/utils';
|
|
7
8
|
import { analyticsEventKey } from '@atlaskit/editor-common/utils/analytics';
|
|
8
9
|
import { Node } from '@atlaskit/editor-prosemirror/model';
|
|
9
10
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -11,8 +12,8 @@ import { findParentNode, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
|
11
12
|
import { createDispatch } from '../event-dispatcher';
|
|
12
13
|
import { __temporaryFixForConfigPanel as _temporaryFixForConfigPanel, getEditorValueWithMedia } from '../utils/action';
|
|
13
14
|
import deprecationWarnings from '../utils/deprecation-warnings';
|
|
14
|
-
import { processRawFragmentValue } from '../utils/document';
|
|
15
15
|
import { findNodePosByFragmentLocalIds } from '../utils/nodes-by-localIds';
|
|
16
|
+
import { processRawFragmentValue } from '../utils/processRawFragmentValue';
|
|
16
17
|
|
|
17
18
|
// TODO: ED-21786
|
|
18
19
|
// Please, do not copy or use this kind of code below
|
|
@@ -173,7 +173,8 @@ function ReactEditorViewContextWrapper(props) {
|
|
|
173
173
|
useProviders({
|
|
174
174
|
contextIdentifierProvider: props.editorProps.contextIdentifierProvider,
|
|
175
175
|
mediaProvider: (_props$editorProps$me = props.editorProps.media) === null || _props$editorProps$me === void 0 ? void 0 : _props$editorProps$me.provider,
|
|
176
|
-
cardProvider: ((_props$editorProps$li = props.editorProps.linking) === null || _props$editorProps$li === void 0 || (_props$editorProps$li = _props$editorProps$li.smartLinks) === null || _props$editorProps$li === void 0 ? void 0 : _props$editorProps$li.provider) || smartLinks && smartLinks.provider || UNSAFE_cards && UNSAFE_cards.provider
|
|
176
|
+
cardProvider: ((_props$editorProps$li = props.editorProps.linking) === null || _props$editorProps$li === void 0 || (_props$editorProps$li = _props$editorProps$li.smartLinks) === null || _props$editorProps$li === void 0 ? void 0 : _props$editorProps$li.provider) || smartLinks && smartLinks.provider || UNSAFE_cards && UNSAFE_cards.provider,
|
|
177
|
+
emojiProvider: props.editorProps.emojiProvider
|
|
177
178
|
});
|
|
178
179
|
return jsx(ReactEditorView, _extends({}, props, {
|
|
179
180
|
setEditorApi: setEditorAPI
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { usePresetContext } from '../../presets/context';
|
|
5
6
|
/**
|
|
6
7
|
* This hook is used to replace the old approach of using the `providerFactory`.
|
|
@@ -13,7 +14,8 @@ import { usePresetContext } from '../../presets/context';
|
|
|
13
14
|
export var useProviders = function useProviders(_ref) {
|
|
14
15
|
var contextIdentifierProvider = _ref.contextIdentifierProvider,
|
|
15
16
|
mediaProvider = _ref.mediaProvider,
|
|
16
|
-
cardProvider = _ref.cardProvider
|
|
17
|
+
cardProvider = _ref.cardProvider,
|
|
18
|
+
emojiProvider = _ref.emojiProvider;
|
|
17
19
|
var editorApi = usePresetContext();
|
|
18
20
|
useEffect(function () {
|
|
19
21
|
function setProvider() {
|
|
@@ -61,4 +63,12 @@ export var useProviders = function useProviders(_ref) {
|
|
|
61
63
|
editorApi === null || editorApi === void 0 || (_editorApi$card = editorApi.card) === null || _editorApi$card === void 0 || _editorApi$card.actions.setProvider(cardProvider);
|
|
62
64
|
}
|
|
63
65
|
}, [cardProvider, editorApi]);
|
|
66
|
+
useEffect(function () {
|
|
67
|
+
if (fg('platform_editor_get_emoji_provider_from_config')) {
|
|
68
|
+
if (emojiProvider) {
|
|
69
|
+
var _editorApi$emoji;
|
|
70
|
+
editorApi === null || editorApi === void 0 || (_editorApi$emoji = editorApi.emoji) === null || _editorApi$emoji === void 0 || _editorApi$emoji.actions.setProvider(emojiProvider);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}, [emojiProvider, editorApi]);
|
|
64
74
|
};
|
|
@@ -23,7 +23,9 @@ export default function handleProviders(providerFactory, _ref, extensionProvider
|
|
|
23
23
|
autoformattingProvider = _ref.autoformattingProvider,
|
|
24
24
|
searchProvider = _ref.searchProvider,
|
|
25
25
|
cardProvider = _ref.cardProvider;
|
|
26
|
-
|
|
26
|
+
if (!fg('platform_editor_get_emoji_provider_from_config')) {
|
|
27
|
+
providerFactory.setProvider('emojiProvider', emojiProvider);
|
|
28
|
+
}
|
|
27
29
|
providerFactory.setProvider('mentionProvider', mentionProvider);
|
|
28
30
|
providerFactory.setProvider('taskDecisionProvider', taskDecisionProvider);
|
|
29
31
|
providerFactory.setProvider('contextIdentifierProvider', contextIdentifierProvider);
|
|
@@ -16,18 +16,21 @@ import { injectIntl } from 'react-intl-next';
|
|
|
16
16
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent, FULL_WIDTH_MODE, getAnalyticsEventsFromTransaction, PLATFORMS } from '@atlaskit/editor-common/analytics';
|
|
17
17
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
18
18
|
import { getDocStructure } from '@atlaskit/editor-common/core-utils';
|
|
19
|
+
import { countNodes as _countNodes } from '@atlaskit/editor-common/count-nodes';
|
|
19
20
|
import { getEnabledFeatureFlagKeys } from '@atlaskit/editor-common/normalize-feature-flags';
|
|
20
21
|
import { startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
|
|
22
|
+
import { measureRender } from '@atlaskit/editor-common/performance/measure-render';
|
|
23
|
+
import { getResponseEndTime } from '@atlaskit/editor-common/performance/navigation';
|
|
21
24
|
import { EditorPluginInjectionAPI } from '@atlaskit/editor-common/preset';
|
|
25
|
+
import { processRawValue } from '@atlaskit/editor-common/process-raw-value';
|
|
22
26
|
import { EditorExperience, ExperienceStore, RELIABILITY_INTERVAL } from '@atlaskit/editor-common/ufo';
|
|
23
|
-
import { countNodes as _countNodes, getResponseEndTime, measureRender, processRawValue, shouldForceTracking } from '@atlaskit/editor-common/utils';
|
|
24
27
|
import { analyticsEventKey, getAnalyticsEventSeverity } from '@atlaskit/editor-common/utils/analytics';
|
|
25
28
|
import { EditorState, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
26
29
|
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
27
30
|
import { createDispatch, EventDispatcher } from '../event-dispatcher';
|
|
28
31
|
import { EditorAPIContext } from '../presets/context';
|
|
29
|
-
import { getNodesCount } from '../utils/document';
|
|
30
32
|
import { findChangedNodesFromTransaction } from '../utils/findChangedNodesFromTransaction';
|
|
33
|
+
import { getNodesCount } from '../utils/getNodesCount';
|
|
31
34
|
import { isFullPage } from '../utils/is-full-page';
|
|
32
35
|
import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
33
36
|
import measurements from '../utils/performance/measure-enum';
|
|
@@ -405,7 +408,7 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
405
408
|
startTime = _ref3.startTime,
|
|
406
409
|
distortedDuration = _ref3.distortedDuration;
|
|
407
410
|
var proseMirrorRenderedTracking = (_this$props$editorPro4 = _this.props.editorProps) === null || _this$props$editorPro4 === void 0 || (_this$props$editorPro4 = _this$props$editorPro4.performanceTracking) === null || _this$props$editorPro4 === void 0 ? void 0 : _this$props$editorPro4.proseMirrorRenderedTracking;
|
|
408
|
-
var forceSeverityTracking = typeof proseMirrorRenderedTracking === 'undefined'
|
|
411
|
+
var forceSeverityTracking = typeof proseMirrorRenderedTracking === 'undefined';
|
|
409
412
|
_this.proseMirrorRenderedSeverity = !!forceSeverityTracking || proseMirrorRenderedTracking !== null && proseMirrorRenderedTracking !== void 0 && proseMirrorRenderedTracking.trackSeverity ? getAnalyticsEventSeverity(duration, (_proseMirrorRenderedT = proseMirrorRenderedTracking === null || proseMirrorRenderedTracking === void 0 ? void 0 : proseMirrorRenderedTracking.severityNormalThreshold) !== null && _proseMirrorRenderedT !== void 0 ? _proseMirrorRenderedT : PROSEMIRROR_RENDERED_NORMAL_SEVERITY_THRESHOLD, (_proseMirrorRenderedT2 = proseMirrorRenderedTracking === null || proseMirrorRenderedTracking === void 0 ? void 0 : proseMirrorRenderedTracking.severityDegradedThreshold) !== null && _proseMirrorRenderedT2 !== void 0 ? _proseMirrorRenderedT2 : PROSEMIRROR_RENDERED_DEGRADED_SEVERITY_THRESHOLD) : undefined;
|
|
410
413
|
if (_this.view) {
|
|
411
414
|
var _this$pluginInjection2, _this$experienceStore10;
|
|
@@ -50,6 +50,7 @@ import { tasksAndDecisionsPlugin } from '@atlaskit/editor-plugins/tasks-and-deci
|
|
|
50
50
|
import { textColorPlugin } from '@atlaskit/editor-plugins/text-color';
|
|
51
51
|
import { toolbarListsIndentationPlugin } from '@atlaskit/editor-plugins/toolbar-lists-indentation';
|
|
52
52
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
53
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
53
54
|
import { isFullPage as fullPageCheck } from '../utils/is-full-page';
|
|
54
55
|
import { version as coreVersion } from '../version-wrapper';
|
|
55
56
|
import { createDefaultPreset } from './default';
|
|
@@ -136,11 +137,16 @@ export default function createUniversalPresetInternal(_ref) {
|
|
|
136
137
|
HighlightComponent: (_props$mention2 = props.mention) === null || _props$mention2 === void 0 ? void 0 : _props$mention2.HighlightComponent,
|
|
137
138
|
profilecardProvider: (_props$mention3 = props.mention) === null || _props$mention3 === void 0 ? void 0 : _props$mention3.profilecardProvider
|
|
138
139
|
}, initialPluginConfiguration === null || initialPluginConfiguration === void 0 ? void 0 : initialPluginConfiguration.mentionsPlugin)], Boolean(props.mentionProvider)).maybeAdd([emojiPlugin, {
|
|
140
|
+
emojiProvider: props.emojiProvider,
|
|
139
141
|
emojiNodeDataProvider: initialPluginConfiguration === null || initialPluginConfiguration === void 0 || (_initialPluginConfigu = initialPluginConfiguration.emoji) === null || _initialPluginConfigu === void 0 ? void 0 : _initialPluginConfigu.emojiNodeDataProvider
|
|
140
142
|
}], Boolean(props.emojiProvider)).maybeAdd([tablesPlugin, _objectSpread({
|
|
141
143
|
tableOptions: !props.allowTables || typeof props.allowTables === 'boolean' ? {} : props.allowTables,
|
|
142
|
-
dragAndDropEnabled: (featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.tableDragAndDrop) && (isFullPage || (isComment || isChromeless) &&
|
|
143
|
-
|
|
144
|
+
dragAndDropEnabled: (featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.tableDragAndDrop) && (isFullPage || (isComment || isChromeless) && editorExperiment('support_table_in_comment', true, {
|
|
145
|
+
exposure: true
|
|
146
|
+
})),
|
|
147
|
+
isTableScalingEnabled: (featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.tablePreserveWidth) && (isFullPage || isComment && editorExperiment('support_table_in_comment', true, {
|
|
148
|
+
exposure: true
|
|
149
|
+
})),
|
|
144
150
|
allowContextualMenu: !isMobile,
|
|
145
151
|
fullWidthEnabled: appearance === 'full-width',
|
|
146
152
|
wasFullWidthEnabled: prevAppearance && prevAppearance === 'full-width',
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject;
|
|
2
|
+
var _templateObject, _templateObject2;
|
|
3
3
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
5
|
import { BreakoutCssClassName, expandClassNames, sharedExpandStyles } from '@atlaskit/editor-common/styles';
|
|
6
6
|
import { akEditorSelectedNodeClassName, akLayoutGutterOffset, getSelectionStyles, SelectionStyle } from '@atlaskit/editor-shared-styles';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import { N100A, N40A, N50A, R300, R50 } from '@atlaskit/theme/colors';
|
|
9
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
10
|
var EXPAND_SELECTED_BACKGROUND = "var(--ds-background-neutral-subtle, rgba(255, 255, 255, 0.6))";
|
|
10
11
|
var EXPAND_ICON_COLOR = function EXPAND_ICON_COLOR() {
|
|
11
12
|
return css({
|
|
@@ -14,15 +15,19 @@ var EXPAND_ICON_COLOR = function EXPAND_ICON_COLOR() {
|
|
|
14
15
|
};
|
|
15
16
|
var DANGER_STATE_BACKGROUND_COLOR = "var(--ds-background-danger, ".concat(R50, ")");
|
|
16
17
|
var DANGER_STATE_BORDER_COLOR = "var(--ds-border-danger, ".concat(R300, ")");
|
|
18
|
+
var firstNodeWithNotMarginTop = function firstNodeWithNotMarginTop() {
|
|
19
|
+
return editorExperiment('nested-dnd', true) ? // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
20
|
+
css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t\t\t\t> :nth-child(1 of :not(style, .ProseMirror-gapcursor, .ProseMirror-widget, span)) {\n\t\t\t\t\tmargin-top: 0;\n\t\t\t\t}\n\n\t\t\t\t> div.ak-editor-expand[data-node-type='nestedExpand'] {\n\t\t\t\t\tmargin-top: ", ";\n\t\t\t\t}\n\t\t\t"])), "var(--ds-space-050, 0.25rem)") : '';
|
|
21
|
+
};
|
|
17
22
|
|
|
18
23
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
19
24
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation
|
|
20
25
|
export var expandStyles = function expandStyles() {
|
|
21
|
-
return css(
|
|
26
|
+
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n\t.", " > div {\n\t\tdisplay: flex;\n\t}\n\n\t.", " {\n\t\t", "\n\n\t\tcursor: pointer;\n\t\tbox-sizing: border-box;\n\n\t\ttd > & {\n\t\t\tmargin-top: 0;\n\t\t}\n\n\t\t.", " svg {\n\t\t\t", ";\n\t\t\ttransform: rotate(90deg);\n\t\t}\n\n\t\t&.", ":not(.danger) {\n\t\t\t", "\n\t\t}\n\n\t\t&.danger {\n\t\t\tbackground: ", ";\n\t\t\tborder-color: ", ";\n\t\t}\n\t}\n\n\t.ProseMirror\n\t\t> .", ",\n\t\t.", "\n\t\t> .", " {\n\t\tmargin-left: -", "px;\n\t\tmargin-right: -", "px;\n\t}\n\n\t.", " {\n\t\t", "\n\t\tcursor: text;\n\t\tpadding-top: 0px;\n\t\t", "\n\t}\n\n\t.", " {\n\t\t", "\n\t}\n\n\t.", " {\n\t\t", ";\n\t\talign-items: center;\n\t\toverflow: visible;\n\t}\n\n\t.", " {\n\t\tbackground: ", ";\n\t\tborder-color: ", ";\n\n\t\t.", " {\n\t\t\tpadding-top: ", ";\n\n\t\t\t", "\n\t\t}\n\t}\n\n\t.", " {\n\t\twidth: 100%;\n\t}\n\n\t/* stylelint-disable property-no-unknown, value-keyword-case */\n\t.", ":(.", ") {\n\t\t.expand-content-wrapper {\n\t\t\theight: auto;\n\t\t}\n\t}\n\t/* stylelint-enable property-no-unknown, value-keyword-case */\n\n\t.", ":not(.", ") {\n\t\t.ak-editor-expand__content {\n\t\t\tposition: absolute;\n\t\t\theight: 1px;\n\t\t\twidth: 1px;\n\t\t\toverflow: hidden;\n\t\t\tclip: rect(1px, 1px, 1px, 1px);\n\t\t\twhite-space: nowrap;\n\t\t}\n\n\t\t.", " svg {\n\t\t\t", ";\n\t\t\ttransform: rotate(0deg);\n\t\t}\n\n\t\t&:not(.", "):not(.danger) {\n\t\t\tbackground: transparent;\n\t\t\tborder-color: transparent;\n\n\t\t\t&:hover {\n\t\t\t\tborder-color: ", ";\n\t\t\t\tbackground: ", ";\n\t\t\t}\n\t\t}\n\t}\n"])), expandClassNames.icon, expandClassNames.prefix, sharedExpandStyles.containerStyles({
|
|
22
27
|
expanded: false,
|
|
23
28
|
focused: false
|
|
24
|
-
})(), expandClassNames.iconContainer, EXPAND_ICON_COLOR(), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.Blanket, SelectionStyle.Border]), DANGER_STATE_BACKGROUND_COLOR, DANGER_STATE_BORDER_COLOR, expandClassNames.type('expand'), BreakoutCssClassName.BREAKOUT_MARK_DOM, expandClassNames.type('expand'), akLayoutGutterOffset, akLayoutGutterOffset, expandClassNames.content, sharedExpandStyles.contentStyles({
|
|
29
|
+
})(), expandClassNames.iconContainer, EXPAND_ICON_COLOR(), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.Blanket, SelectionStyle.Border]), DANGER_STATE_BACKGROUND_COLOR, DANGER_STATE_BORDER_COLOR, expandClassNames.type('expand'), BreakoutCssClassName.BREAKOUT_MARK_DOM, expandClassNames.type('expand'), akLayoutGutterOffset + (editorExperiment('nested-dnd', true) ? 8 : 0), akLayoutGutterOffset + (editorExperiment('nested-dnd', true) ? 8 : 0), expandClassNames.content, sharedExpandStyles.contentStyles({
|
|
25
30
|
expanded: false,
|
|
26
31
|
focused: false
|
|
27
|
-
})(), fg('platform_editor_drag_and_drop_expand_style_fix') && "overflow-x: clip;", expandClassNames.titleInput, sharedExpandStyles.titleInputStyles(), expandClassNames.titleContainer, sharedExpandStyles.titleContainerStyles(), expandClassNames.expanded, EXPAND_SELECTED_BACKGROUND, "var(--ds-border, ".concat(N40A, ")"), expandClassNames.content, "var(--ds-space-100, 8px)", expandClassNames.inputContainer, expandClassNames.prefix, expandClassNames.expanded, expandClassNames.prefix, expandClassNames.expanded, expandClassNames.iconContainer, EXPAND_ICON_COLOR(), akEditorSelectedNodeClassName, "var(--ds-border, ".concat(N50A, ")"), EXPAND_SELECTED_BACKGROUND);
|
|
32
|
+
})(), fg('platform_editor_drag_and_drop_expand_style_fix') && "overflow-x: clip;", expandClassNames.titleInput, sharedExpandStyles.titleInputStyles(), expandClassNames.titleContainer, sharedExpandStyles.titleContainerStyles(), expandClassNames.expanded, EXPAND_SELECTED_BACKGROUND, "var(--ds-border, ".concat(N40A, ")"), expandClassNames.content, "var(--ds-space-100, 8px)", firstNodeWithNotMarginTop(), expandClassNames.inputContainer, expandClassNames.prefix, expandClassNames.expanded, expandClassNames.prefix, expandClassNames.expanded, expandClassNames.iconContainer, EXPAND_ICON_COLOR(), akEditorSelectedNodeClassName, "var(--ds-border, ".concat(N50A, ")"), EXPAND_SELECTED_BACKGROUND);
|
|
28
33
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
3
3
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
5
|
import { columnLayoutSharedStyle, LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN } from '@atlaskit/editor-common/styles';
|
|
@@ -9,8 +9,13 @@ import { akEditorDeleteBackground, akEditorDeleteBorder, akEditorSelectedBorderS
|
|
|
9
9
|
import { N40A, N50A } from '@atlaskit/theme/colors';
|
|
10
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
11
|
export { LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN };
|
|
12
|
+
var firstNodeWithNotMarginTop = function firstNodeWithNotMarginTop() {
|
|
13
|
+
return editorExperiment('nested-dnd', true) ? // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
14
|
+
css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t\t\t\t> :nth-child(1 of :not(style, .ProseMirror-gapcursor, .ProseMirror-widget, span)) {\n\t\t\t\t\tmargin-top: 0;\n\t\t\t\t}\n\t\t\t"]))) : // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
15
|
+
css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n\t\t\t\t> :not(style):first-child,\n\t\t\t\t> style:first-child + * {\n\t\t\t\t\tmargin-top: 0;\n\t\t\t\t}\n\n\t\t\t\t> .ProseMirror-gapcursor:first-child + *,\n\t\t\t\t> style:first-child + .ProseMirror-gapcursor + * {\n\t\t\t\t\tmargin-top: 0;\n\t\t\t\t}\n\n\t\t\t\t> .ProseMirror-gapcursor:first-child + span + * {\n\t\t\t\t\tmargin-top: 0;\n\t\t\t\t}\n\t\t\t"])));
|
|
16
|
+
};
|
|
12
17
|
|
|
13
18
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation
|
|
14
19
|
export var layoutStyles = function layoutStyles(viewMode) {
|
|
15
|
-
return css(
|
|
20
|
+
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n\t.ProseMirror {\n\t\t", " [data-layout-section] {\n\t\t\t// TODO: Migrate away from gridSize\n\t\t\t// Recommendation: Replace directly with 7px\n\t\t\tmargin: ", " -", "px 0;\n\t\t\ttransition: border-color 0.3s ", ";\n\t\t\tcursor: ", ";\n\n\t\t\t/* Inner cursor located 26px from left */\n\t\t\t[data-layout-column] {\n\t\t\t\tflex: 1;\n\t\t\t\tmin-width: 0;\n\t\t\t\tborder: ", "px solid\n\t\t\t\t\t", ";\n\t\t\t\tborder-radius: 4px;\n\t\t\t\tpadding: ", "px\n\t\t\t\t\t", "px;\n\t\t\t\tbox-sizing: border-box;\n\n\t\t\t\t> div {\n\t\t\t\t\t", "\n\n\t\t\t\t\t> .embedCardView-content-wrap:first-of-type .rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .mediaSingleView-content-wrap:first-of-type .rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .ProseMirror-gapcursor.-right:first-child\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> style:first-child\n\t\t\t\t\t\t+ .ProseMirror-gapcursor.-right\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> .ProseMirror-gapcursor.-right:first-of-type\n\t\t\t\t\t\t+ .embedCardView-content-wrap\n\t\t\t\t\t\t.rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .ProseMirror-gapcursor:first-child\n\t\t\t\t\t\t+ span\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> style:first-child\n\t\t\t\t\t\t+ .ProseMirror-gapcursor\n\t\t\t\t\t\t+ span\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t/* Prevent first DecisionWrapper's margin-top: 8px from shifting decisions down\n and shrinking layout's node selectable area (leniency margin) */\n\t\t\t\t\t> [data-node-type='decisionList'] {\n\t\t\t\t\t\tli:first-of-type [data-decision-wrapper] {\n\t\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/* Make the 'content' fill the entire height of the layout column to allow click\n handler of layout section nodeview to target only data-layout-column */\n\t\t\t\t[data-layout-content] {\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tcursor: text;\n\t\t\t\t\t.mediaGroupView-content-wrap {\n\t\t\t\t\t\tclear: both;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t[data-layout-column] + [data-layout-column] {\n\t\t\t\tmargin-left: ", "px;\n\t\t\t}\n\n\t\t\t@media screen and (max-width: ", "px) {\n\t\t\t\t[data-layout-column] + [data-layout-column] {\n\t\t\t\t\tmargin-left: 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// TODO: Remove the border styles below once design tokens have been enabled and fallbacks are no longer triggered.\n\t\t\t// This is because the default state already uses the same token and, as such, the hover style won't change anything.\n\t\t\t// https://product-fabric.atlassian.net/browse/DSP-4441\n\t\t\t/* Shows the border when cursor is inside a layout */\n\t\t\t&.selected [data-layout-column],\n\t\t\t&:hover [data-layout-column] {\n\t\t\t\tborder: ", "px solid\n\t\t\t\t\t", ";\n\t\t\t}\n\n\t\t\t&.selected.danger > [data-layout-column] {\n\t\t\t\tbackground-color: ", ";\n\t\t\t\tborder-color: ", ";\n\t\t\t}\n\n\t\t\t&.", ":not(.danger) {\n\t\t\t\t[data-layout-column] {\n\t\t\t\t\t", "\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t.fabric-editor--full-width-mode .ProseMirror {\n\t\t[data-layout-section] {\n\t\t\t.", " {\n\t\t\t\tmargin: 0 ", "px;\n\t\t\t}\n\t\t}\n\t}\n"])), columnLayoutSharedStyle, "var(--ds-space-100, 8px)", akLayoutGutterOffset + (editorExperiment('nested-dnd', true) ? 8 : 0), akEditorSwoopCubicBezier, viewMode === 'view' ? 'default' : 'pointer', viewMode === 'view' ? 0 : akEditorSelectedBorderSize, "var(--ds-border, ".concat(N40A, ")"), LAYOUT_COLUMN_PADDING, LAYOUT_COLUMN_PADDING + (editorExperiment('nested-dnd', true) ? 8 : 0), firstNodeWithNotMarginTop(), LAYOUT_SECTION_MARGIN, gridMediumMaxWidth, viewMode === 'view' ? 0 : akEditorSelectedBorderSize, "var(--ds-border, ".concat(N50A, ")"), "var(--ds-background-danger, ".concat(akEditorDeleteBackground, ")"), "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.Border, SelectionStyle.Blanket]), TableCssClassName.TABLE_CONTAINER, tableMarginFullWidthMode);
|
|
16
21
|
};
|
|
@@ -9,6 +9,7 @@ import React, { useMemo } from 'react';
|
|
|
9
9
|
|
|
10
10
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
11
11
|
import { css, jsx } from '@emotion/react';
|
|
12
|
+
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
12
13
|
import { akEditorMobileMaxWidth } from '@atlaskit/editor-shared-styles';
|
|
13
14
|
import { WidthObserver } from '@atlaskit/width-detector';
|
|
14
15
|
import { isFullPage } from '../../utils/is-full-page';
|
|
@@ -34,7 +35,8 @@ export var ToolbarWithSizeDetector = function ToolbarWithSizeDetector(props) {
|
|
|
34
35
|
var elementWidth = useElementWidth(ref, {
|
|
35
36
|
skip: typeof width !== 'undefined'
|
|
36
37
|
});
|
|
37
|
-
var
|
|
38
|
+
var defaultToolbarSize = isSSR() && isFullPage(props.appearance) ? ToolbarSize.XXL : undefined;
|
|
39
|
+
var toolbarSize = typeof width === 'undefined' && typeof elementWidth === 'undefined' ? defaultToolbarSize : widthToToolbarSize(width || elementWidth, props.appearance);
|
|
38
40
|
var toolbarStyle = useMemo(function () {
|
|
39
41
|
var toolbarWidth = isFullPage(props.appearance) && props.twoLineEditorToolbar ? ToolbarSize.S : ToolbarSize.M;
|
|
40
42
|
var toolbarMinWidth = toolbarSizeToWidth(toolbarWidth, props.appearance);
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculate the difference between performance.now() and the given startTime.
|
|
3
|
+
* This allows for the timing to be overridable during tests.
|
|
4
|
+
*
|
|
5
|
+
* @param startTime DOMHighResTimeStamp
|
|
6
|
+
* @returns DOMHighResTimeStamp
|
|
7
|
+
*/
|
|
8
|
+
export var getTimeSince = function getTimeSince(startTime) {
|
|
9
|
+
return performance.now() - startTime;
|
|
10
|
+
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
import { isPerformanceAPIAvailable } from '@atlaskit/editor-common/is-performance-api-available';
|
|
4
5
|
import { startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
|
|
5
|
-
import { getTimeSince
|
|
6
|
+
import { getTimeSince } from './getTimeSince';
|
|
6
7
|
export var EVENT_NAME_STATE_APPLY = "\uD83E\uDD89 EditorView::state::apply";
|
|
7
8
|
export var EVENT_NAME_UPDATE_STATE = "\uD83E\uDD89 EditorView::updateState";
|
|
8
9
|
export var EVENT_NAME_VIEW_STATE_UPDATED = "\uD83E\uDD89 EditorView::onEditorViewStateUpdated";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { processRawValue } from '@atlaskit/editor-common/
|
|
1
|
+
import { processRawValue } from '@atlaskit/editor-common/process-raw-value';
|
|
2
2
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
export function processRawFragmentValue(schema, value, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent) {
|
|
4
4
|
if (!value) {
|
|
@@ -13,11 +13,4 @@ export function processRawFragmentValue(schema, value, providerFactory, sanitize
|
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
return Fragment.from(adfEntities);
|
|
16
|
-
}
|
|
17
|
-
export function getNodesCount(node) {
|
|
18
|
-
var count = {};
|
|
19
|
-
node.nodesBetween(0, node.nodeSize - 2, function (node) {
|
|
20
|
-
count[node.type.name] = (count[node.type.name] || 0) + 1;
|
|
21
|
-
});
|
|
22
|
-
return count;
|
|
23
16
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export var name = "@atlaskit/editor-core";
|
|
2
|
-
export var version = "197.
|
|
2
|
+
export var version = "197.3.0";
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { CardProvider, ContextIdentifierProvider, MediaProvider } from '@atlaskit/editor-common/provider-factory';
|
|
2
|
+
import { type EmojiProvider } from '@atlaskit/emoji';
|
|
2
3
|
interface UseProvidersProps {
|
|
3
4
|
contextIdentifierProvider: Promise<ContextIdentifierProvider> | undefined;
|
|
4
5
|
mediaProvider: Promise<MediaProvider> | undefined;
|
|
5
6
|
cardProvider: Promise<CardProvider> | undefined;
|
|
7
|
+
emojiProvider: Promise<EmojiProvider> | undefined;
|
|
6
8
|
}
|
|
7
9
|
/**
|
|
8
10
|
* This hook is used to replace the old approach of using the `providerFactory`.
|
|
@@ -12,5 +14,5 @@ interface UseProvidersProps {
|
|
|
12
14
|
*
|
|
13
15
|
* In the future ideally consumers implement this behaviour themselves.
|
|
14
16
|
*/
|
|
15
|
-
export declare const useProviders: ({ contextIdentifierProvider, mediaProvider, cardProvider, }: UseProvidersProps) => void;
|
|
17
|
+
export declare const useProviders: ({ contextIdentifierProvider, mediaProvider, cardProvider, emojiProvider, }: UseProvidersProps) => void;
|
|
16
18
|
export {};
|
|
@@ -9,7 +9,8 @@ import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
|
9
9
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/src/portal';
|
|
10
10
|
import type { PublicPluginAPI, Transformer } from '@atlaskit/editor-common/types';
|
|
11
11
|
import { ExperienceStore } from '@atlaskit/editor-common/ufo';
|
|
12
|
-
import type { ErrorReporter
|
|
12
|
+
import type { ErrorReporter } from '@atlaskit/editor-common/utils';
|
|
13
|
+
import { type SEVERITY } from '@atlaskit/editor-common/utils/analytics';
|
|
13
14
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
14
15
|
import { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
15
16
|
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|