@atlaskit/editor-core 187.28.0 → 187.28.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 +14 -0
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +3 -3
- package/dist/cjs/create-editor/create-plugins-list.js +2 -2
- package/dist/cjs/index.js +0 -7
- package/dist/cjs/labs/next/presets/default.js +2 -2
- package/dist/cjs/plugins/base/index.js +7 -126
- package/dist/cjs/plugins/base/plugin.js +140 -0
- package/dist/cjs/plugins/base/pm-plugins/scroll-gutter.js +3 -9
- package/dist/cjs/plugins/index.js +2 -2
- package/dist/cjs/plugins/list/index.js +17 -0
- package/dist/cjs/plugins/list/utils/find.js +4 -3
- package/dist/cjs/plugins/media/toolbar/index.js +1 -1
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +7 -2
- package/dist/cjs/plugins/media/utils/media-single.js +7 -5
- package/dist/cjs/plugins/paste/handlers.js +27 -3
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +2 -2
- package/dist/cjs/plugins/paste/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/toolbar-lists-indentation/index.js +58 -36
- package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +6 -6
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/index.js +3 -3
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +8 -9
- package/dist/cjs/test-utils.js +2 -2
- package/dist/cjs/ui/ContentStyles/index.js +19 -18
- package/dist/cjs/ui/ToolbarFeedback/index.js +22 -16
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +3 -3
- package/dist/es2019/create-editor/create-plugins-list.js +1 -1
- package/dist/es2019/index.js +0 -1
- package/dist/es2019/labs/next/presets/default.js +1 -1
- package/dist/es2019/plugins/base/index.js +2 -104
- package/dist/es2019/plugins/base/plugin.js +109 -0
- package/dist/es2019/plugins/base/pm-plugins/scroll-gutter.js +1 -4
- package/dist/es2019/plugins/index.js +1 -1
- package/dist/es2019/plugins/list/index.js +19 -0
- package/dist/es2019/plugins/list/utils/find.js +2 -2
- package/dist/es2019/plugins/media/toolbar/index.js +2 -2
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +9 -4
- package/dist/es2019/plugins/media/utils/media-single.js +3 -4
- package/dist/es2019/plugins/paste/handlers.js +27 -3
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +2 -2
- package/dist/es2019/plugins/paste/pm-plugins/main.js +2 -2
- package/dist/es2019/plugins/toolbar-lists-indentation/index.js +62 -38
- package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +6 -6
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/index.js +3 -3
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +5 -6
- package/dist/es2019/test-utils.js +1 -1
- package/dist/es2019/ui/ContentStyles/index.js +25 -3
- package/dist/es2019/ui/ToolbarFeedback/index.js +14 -9
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/create-editor/ReactEditorViewInternal.js +3 -3
- package/dist/esm/create-editor/create-plugins-list.js +1 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/labs/next/presets/default.js +1 -1
- package/dist/esm/plugins/base/index.js +2 -123
- package/dist/esm/plugins/base/plugin.js +128 -0
- package/dist/esm/plugins/base/pm-plugins/scroll-gutter.js +1 -4
- package/dist/esm/plugins/index.js +1 -1
- package/dist/esm/plugins/list/index.js +19 -0
- package/dist/esm/plugins/list/utils/find.js +2 -2
- package/dist/esm/plugins/media/toolbar/index.js +2 -2
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +9 -4
- package/dist/esm/plugins/media/utils/media-single.js +5 -4
- package/dist/esm/plugins/paste/handlers.js +25 -3
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +2 -2
- package/dist/esm/plugins/paste/pm-plugins/main.js +2 -2
- package/dist/esm/plugins/toolbar-lists-indentation/index.js +60 -37
- package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +6 -6
- package/dist/esm/plugins/toolbar-lists-indentation/ui/index.js +3 -3
- package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +5 -6
- package/dist/esm/test-utils.js +1 -1
- package/dist/esm/ui/ContentStyles/index.js +6 -5
- package/dist/esm/ui/ToolbarFeedback/index.js +20 -14
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/plugins/base/index.d.ts +4 -16
- package/dist/types/plugins/base/plugin.d.ts +23 -0
- package/dist/types/plugins/base/pm-plugins/scroll-gutter.d.ts +0 -3
- package/dist/types/plugins/index.d.ts +1 -1
- package/dist/types/plugins/list/types.d.ts +1 -8
- package/dist/types/plugins/list/utils/find.d.ts +1 -1
- package/dist/types/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +1 -0
- package/dist/types/plugins/media/utils/media-single.d.ts +1 -0
- package/dist/types/plugins/paste/handlers.d.ts +4 -2
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +2 -1
- package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +5 -2
- package/dist/types/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +4 -1
- package/dist/types/plugins/toolbar-lists-indentation/ui/index.d.ts +3 -3
- package/dist/types/plugins/toolbar-lists-indentation/ui/onItemActivated.d.ts +3 -2
- package/dist/types/ui/ToolbarFeedback/index.d.ts +1 -19
- package/dist/types-ts4.5/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/base/index.d.ts +4 -18
- package/dist/types-ts4.5/plugins/base/plugin.d.ts +25 -0
- package/dist/types-ts4.5/plugins/base/pm-plugins/scroll-gutter.d.ts +0 -3
- package/dist/types-ts4.5/plugins/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/list/types.d.ts +1 -8
- package/dist/types-ts4.5/plugins/list/utils/find.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +1 -0
- package/dist/types-ts4.5/plugins/media/utils/media-single.d.ts +1 -0
- package/dist/types-ts4.5/plugins/paste/handlers.d.ts +4 -2
- package/dist/types-ts4.5/plugins/paste/pm-plugins/analytics.d.ts +2 -1
- package/dist/types-ts4.5/plugins/toolbar-lists-indentation/index.d.ts +5 -2
- package/dist/types-ts4.5/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +4 -1
- package/dist/types-ts4.5/plugins/toolbar-lists-indentation/ui/index.d.ts +3 -3
- package/dist/types-ts4.5/plugins/toolbar-lists-indentation/ui/onItemActivated.d.ts +3 -2
- package/dist/types-ts4.5/ui/ToolbarFeedback/index.d.ts +1 -19
- package/package.json +2 -2
- package/report.api.md +4 -58
- package/tmp/api-report-tmp.d.ts +4 -47
- package/dist/cjs/plugins/list/styles.js +0 -15
- package/dist/cjs/utils/list-commands.js +0 -17
- package/dist/cjs/utils/lists.js +0 -31
- package/dist/es2019/plugins/list/styles.js +0 -26
- package/dist/es2019/utils/list-commands.js +0 -11
- package/dist/es2019/utils/lists.js +0 -26
- package/dist/esm/plugins/list/styles.js +0 -7
- package/dist/esm/utils/list-commands.js +0 -11
- package/dist/esm/utils/lists.js +0 -24
- package/dist/types/plugins/list/styles.d.ts +0 -1
- package/dist/types/utils/list-commands.d.ts +0 -6
- package/dist/types/utils/lists.d.ts +0 -2
- package/dist/types-ts4.5/plugins/list/styles.d.ts +0 -1
- package/dist/types-ts4.5/utils/list-commands.d.ts +0 -6
- package/dist/types-ts4.5/utils/lists.d.ts +0 -2
|
@@ -17,12 +17,12 @@ import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit
|
|
|
17
17
|
import { getMediaClient } from '@atlaskit/media-client';
|
|
18
18
|
import { calcPctFromPx, wrappedLayouts, handleSides, imageAlignmentMap } from '@atlaskit/editor-common/ui';
|
|
19
19
|
import { nonWrappedLayouts, setNodeSelection } from '@atlaskit/editor-common/utils';
|
|
20
|
-
import { akEditorFullWidthLayoutWidth, akEditorGutterPadding } from '@atlaskit/editor-shared-styles';
|
|
20
|
+
import { akEditorFullWidthLayoutWidth, akEditorGutterPadding, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
21
21
|
import { wrapperStyle } from './styled';
|
|
22
22
|
import { ResizerNext } from '@atlaskit/editor-common/resizer';
|
|
23
23
|
import classnames from 'classnames';
|
|
24
24
|
import { richMediaClassName, resizerStyles } from '@atlaskit/editor-common/styles';
|
|
25
|
-
import {
|
|
25
|
+
import { MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_RESIZE_THROTTLE_TIME, calculateOffsetLeft, DEFAULT_IMAGE_WIDTH, calcMediaSingleMaxWidth } from '@atlaskit/editor-common/media-single';
|
|
26
26
|
import { findClosestSnap, getGuidelinesWithHighlights, generateDefaultGuidelines, generateDynamicGuidelines, getGuidelineSnaps, getGuidelineTypeFromKey, getRelativeGuideSnaps, getRelativeGuidelines } from '@atlaskit/editor-common/guideline';
|
|
27
27
|
import memoizeOne from 'memoize-one';
|
|
28
28
|
import { getMediaResizeAnalyticsEvent } from '../../utils/analytics';
|
|
@@ -142,6 +142,9 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
142
142
|
}
|
|
143
143
|
return calcMediaSingleMaxWidth(containerWidth);
|
|
144
144
|
}));
|
|
145
|
+
_defineProperty(_assertThisInitialized(_this), "calcMinWidth", memoizeOne(function (isVideoFile, contentWidth) {
|
|
146
|
+
return Math.min(contentWidth || akEditorDefaultLayoutWidth, isVideoFile ? MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH : MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH);
|
|
147
|
+
}));
|
|
145
148
|
_defineProperty(_assertThisInitialized(_this), "getRelativeGuides", function () {
|
|
146
149
|
var $pos = _this.$pos;
|
|
147
150
|
var relativeGuides = $pos && $pos.nodeAfter && _this.state.size.width ? getRelativeGuidelines(_this.state.relativeGuides, {
|
|
@@ -485,7 +488,8 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
485
488
|
lineLength = _this$props8.lineLength;
|
|
486
489
|
var _this$state = this.state,
|
|
487
490
|
isResizing = _this$state.isResizing,
|
|
488
|
-
size = _this$state.size
|
|
491
|
+
size = _this$state.size,
|
|
492
|
+
isVideoFile = _this$state.isVideoFile;
|
|
489
493
|
var enable = {};
|
|
490
494
|
handleSides.forEach(function (side) {
|
|
491
495
|
var oppositeSide = side === 'left' ? 'right' : 'left';
|
|
@@ -503,6 +507,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
503
507
|
});
|
|
504
508
|
var resizerNextClassName = classnames(className, resizerStyles);
|
|
505
509
|
var maxWidth = this.calcMaxWidth(lineLength, containerWidth, fullWidthMode);
|
|
510
|
+
var minWidth = this.calcMinWidth(isVideoFile, lineLength);
|
|
506
511
|
return jsx("div", {
|
|
507
512
|
ref: this.saveWrapper,
|
|
508
513
|
css: wrapperStyle({
|
|
@@ -515,7 +520,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
515
520
|
isExtendedResizeExperienceOn: true
|
|
516
521
|
})
|
|
517
522
|
}, jsx(ResizerNext, {
|
|
518
|
-
minWidth:
|
|
523
|
+
minWidth: minWidth,
|
|
519
524
|
maxWidth: maxWidth,
|
|
520
525
|
className: resizerNextClassName,
|
|
521
526
|
snapGap: MEDIA_SINGLE_SNAP_GAP,
|
|
@@ -4,8 +4,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import { safeInsert as pmSafeInsert, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
6
6
|
import { checkNodeDown } from '../../../utils';
|
|
7
|
+
import { getMediaSingleInitialWidth, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH } from '@atlaskit/editor-common/media-single';
|
|
7
8
|
import { isEmptyParagraph, floatingLayouts } from '@atlaskit/editor-common/utils';
|
|
8
|
-
import { getMediaSingleInitialWidth } from '@atlaskit/editor-common/media-single';
|
|
9
9
|
import { copyOptionalAttrsFromMediaState } from '../utils/media-common';
|
|
10
10
|
import { mapSlice } from '../../../utils/slice';
|
|
11
11
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
@@ -92,9 +92,7 @@ export var insertMediaSingleNode = function insertMediaSingleNode(view, mediaSta
|
|
|
92
92
|
// add undefined as fallback as we don't want media single width to have upper limit as 0
|
|
93
93
|
// if widthPluginState.width is 0, default 760 will be used
|
|
94
94
|
var contentWidth = (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.lineLength) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.width) || undefined;
|
|
95
|
-
var node = createMediaSingleNode(state.schema, collection, contentWidth,
|
|
96
|
-
// pass undefined to use default min width
|
|
97
|
-
undefined, alignLeftOnInsert)(mediaState);
|
|
95
|
+
var node = createMediaSingleNode(state.schema, collection, contentWidth, mediaState.status !== 'error' && isVideo(mediaState.fileMimeType) ? MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH : MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, alignLeftOnInsert)(mediaState);
|
|
98
96
|
var fileExtension;
|
|
99
97
|
if (mediaState.fileName) {
|
|
100
98
|
var extensionIdx = mediaState.fileName.lastIndexOf('.');
|
|
@@ -210,6 +208,9 @@ export function isCaptionNode(editorView) {
|
|
|
210
208
|
}
|
|
211
209
|
return false;
|
|
212
210
|
}
|
|
211
|
+
export var isVideo = function isVideo(fileType) {
|
|
212
|
+
return !!fileType && fileType.includes('video');
|
|
213
|
+
};
|
|
213
214
|
export var getParentWidthForNestedMediaSingleNode = function getParentWidthForNestedMediaSingleNode(resolvedPos, view) {
|
|
214
215
|
var domNode = view.nodeDOM(resolvedPos.pos);
|
|
215
216
|
if (resolvedPos.nodeAfter && floatingLayouts.includes(resolvedPos.nodeAfter.attrs.layout) && domNode && domNode.parentElement) {
|
|
@@ -23,7 +23,6 @@ import { linkifyContent, isListItemNode, isListNode, canLinkBeCreatedInRange } f
|
|
|
23
23
|
import { insertSliceForLists } from './edge-cases';
|
|
24
24
|
import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from './commands';
|
|
25
25
|
import { getPluginState as getPastePluginState } from './pm-plugins/plugin-factory';
|
|
26
|
-
import { doesSelectionWhichStartsOrEndsInListContainEntireList } from '../../utils/lists';
|
|
27
26
|
import { anyMarkActive } from '@atlaskit/editor-common/mark';
|
|
28
27
|
// remove text attribute from mention for copy/paste (GDPR)
|
|
29
28
|
export function handleMention(slice, schema) {
|
|
@@ -224,7 +223,30 @@ export function handlePasteNonNestableBlockNodesIntoList(slice) {
|
|
|
224
223
|
return false;
|
|
225
224
|
};
|
|
226
225
|
}
|
|
227
|
-
export function
|
|
226
|
+
export var doesSelectionWhichStartsOrEndsInListContainEntireList = function doesSelectionWhichStartsOrEndsInListContainEntireList(selection, findRootParentListNode) {
|
|
227
|
+
var $from = selection.$from,
|
|
228
|
+
$to = selection.$to,
|
|
229
|
+
from = selection.from,
|
|
230
|
+
to = selection.to;
|
|
231
|
+
var selectionParentListItemNodeResolvedPos = findRootParentListNode ? findRootParentListNode($from) || findRootParentListNode($to) : null;
|
|
232
|
+
var selectionParentListNode = selectionParentListItemNodeResolvedPos === null || selectionParentListItemNodeResolvedPos === void 0 ? void 0 : selectionParentListItemNodeResolvedPos.parent;
|
|
233
|
+
if (!selectionParentListItemNodeResolvedPos || !selectionParentListNode) {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
var startOfEntireList = $from.pos < $to.pos ? selectionParentListItemNodeResolvedPos.pos + $from.depth - 1 : selectionParentListItemNodeResolvedPos.pos + $to.depth - 1;
|
|
237
|
+
var endOfEntireList = $from.pos < $to.pos ? selectionParentListItemNodeResolvedPos.pos + selectionParentListNode.nodeSize - $to.depth - 1 : selectionParentListItemNodeResolvedPos.pos + selectionParentListNode.nodeSize - $from.depth - 1;
|
|
238
|
+
if (!startOfEntireList || !endOfEntireList) {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
if (from < to) {
|
|
242
|
+
return startOfEntireList >= $from.pos && endOfEntireList <= $to.pos;
|
|
243
|
+
} else if (from > to) {
|
|
244
|
+
return startOfEntireList >= $to.pos && endOfEntireList <= $from.pos;
|
|
245
|
+
} else {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
export function handlePastePanelOrDecisionContentIntoList(slice, findRootParentListNode) {
|
|
228
250
|
return function (state, dispatch) {
|
|
229
251
|
var schema = state.schema,
|
|
230
252
|
tr = state.tr;
|
|
@@ -233,7 +255,7 @@ export function handlePastePanelOrDecisionContentIntoList(slice) {
|
|
|
233
255
|
var blockNode = slice.content.firstChild;
|
|
234
256
|
var isSliceWholeNode = slice.openStart === 0 && slice.openEnd === 0;
|
|
235
257
|
var selectionParentListItemNode = selection.$to.node(selection.$to.depth - 1);
|
|
236
|
-
var sliceIsWholeNodeButShouldNotReplaceSelection = isSliceWholeNode && !doesSelectionWhichStartsOrEndsInListContainEntireList(selection);
|
|
258
|
+
var sliceIsWholeNodeButShouldNotReplaceSelection = isSliceWholeNode && !doesSelectionWhichStartsOrEndsInListContainEntireList(selection, findRootParentListNode);
|
|
237
259
|
if (!selectionParentListItemNode || (selectionParentListItemNode === null || selectionParentListItemNode === void 0 ? void 0 : selectionParentListItemNode.type) !== schema.nodes.listItem || !blockNode || !['panel', 'decisionList'].includes(blockNode === null || blockNode === void 0 ? void 0 : blockNode.type.name) || slice.content.childCount > 1 || (blockNode === null || blockNode === void 0 ? void 0 : blockNode.content.firstChild) === undefined || sliceIsWholeNodeButShouldNotReplaceSelection) {
|
|
238
260
|
return false;
|
|
239
261
|
}
|
|
@@ -283,10 +283,10 @@ function injectAnalyticsPayloadBeforeCommand(createPayloadByTransaction) {
|
|
|
283
283
|
};
|
|
284
284
|
};
|
|
285
285
|
}
|
|
286
|
-
export var handlePastePanelOrDecisionIntoListWithAnalytics = function handlePastePanelOrDecisionIntoListWithAnalytics(view, event, slice) {
|
|
286
|
+
export var handlePastePanelOrDecisionIntoListWithAnalytics = function handlePastePanelOrDecisionIntoListWithAnalytics(view, event, slice, findRootParentListNode) {
|
|
287
287
|
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
288
288
|
type: PasteTypes.richText
|
|
289
|
-
}))(handlePastePanelOrDecisionContentIntoList(slice));
|
|
289
|
+
}))(handlePastePanelOrDecisionContentIntoList(slice, findRootParentListNode));
|
|
290
290
|
};
|
|
291
291
|
export var handlePasteNonNestableBlockNodesIntoListWithAnalytics = function handlePasteNonNestableBlockNodesIntoListWithAnalytics(view, event, slice) {
|
|
292
292
|
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
@@ -299,7 +299,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
299
299
|
|
|
300
300
|
// finally, handle rich-text copy-paste
|
|
301
301
|
if (isRichText) {
|
|
302
|
-
var _pluginInjectionApi$d6, _pluginInjectionApi$d7;
|
|
302
|
+
var _pluginInjectionApi$d6, _pluginInjectionApi$d7, _pluginInjectionApi$d8;
|
|
303
303
|
// linkify the text where possible
|
|
304
304
|
slice = linkifyContent(state.schema)(slice);
|
|
305
305
|
if (handlePasteLinkOnSelectedTextWithAnalytics(view, event, slice, PasteTypes.richText)(state, dispatch)) {
|
|
@@ -364,7 +364,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
364
364
|
if (handlePasteIntoCaptionWithAnalytics(view, event, slice, PasteTypes.richText)(state, dispatch)) {
|
|
365
365
|
return true;
|
|
366
366
|
}
|
|
367
|
-
if (handlePastePanelOrDecisionIntoListWithAnalytics(view, event, slice)(state, dispatch)) {
|
|
367
|
+
if (handlePastePanelOrDecisionIntoListWithAnalytics(view, event, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d8 = pluginInjectionApi.dependencies.list) === null || _pluginInjectionApi$d8 === void 0 ? void 0 : _pluginInjectionApi$d8.actions.findRootParentListNode)(state, dispatch)) {
|
|
368
368
|
return true;
|
|
369
369
|
}
|
|
370
370
|
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && handlePasteNonNestableBlockNodesIntoListWithAnalytics(view, event, slice)(state, dispatch)) {
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
2
3
|
import ToolbarListsIndentation from './ui';
|
|
3
|
-
import WithPluginState from '../../ui/WithPluginState';
|
|
4
4
|
import { ToolbarSize } from '../../ui/Toolbar/types';
|
|
5
|
-
import {
|
|
6
|
-
import { pluginKey as
|
|
5
|
+
import { createPlugin as indentationButtonsPlugin } from './pm-plugins/indentation-buttons';
|
|
6
|
+
import { pluginKey as indentationButtonPluginKey } from './pm-plugins/indentation-buttons';
|
|
7
7
|
var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref, api) {
|
|
8
|
-
var _api$dependencies$
|
|
8
|
+
var _api$dependencies$fea;
|
|
9
9
|
var showIndentationButtons = _ref.showIndentationButtons,
|
|
10
10
|
allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation;
|
|
11
|
-
var featureFlags = (api === null || api === void 0 ? void 0 : api.dependencies.featureFlags.sharedState.currentState()) || {};
|
|
12
|
-
var editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions;
|
|
11
|
+
var featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies$fea = api.dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
|
|
13
12
|
return {
|
|
14
13
|
name: 'toolbarListsIndentation',
|
|
14
|
+
getSharedState: function getSharedState(editorState) {
|
|
15
|
+
if (!editorState) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
return indentationButtonPluginKey.getState(editorState);
|
|
19
|
+
},
|
|
15
20
|
pmPlugins: function pmPlugins() {
|
|
16
21
|
return [{
|
|
17
22
|
name: 'indentationButtons',
|
|
@@ -20,7 +25,8 @@ var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref,
|
|
|
20
25
|
return indentationButtonsPlugin({
|
|
21
26
|
dispatch: dispatch,
|
|
22
27
|
showIndentationButtons: showIndentationButtons,
|
|
23
|
-
allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation
|
|
28
|
+
allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation,
|
|
29
|
+
api: api
|
|
24
30
|
});
|
|
25
31
|
}
|
|
26
32
|
}];
|
|
@@ -34,38 +40,55 @@ var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref,
|
|
|
34
40
|
disabled = _ref3.disabled,
|
|
35
41
|
isToolbarReducedSpacing = _ref3.isToolbarReducedSpacing;
|
|
36
42
|
var isSmall = toolbarSize < ToolbarSize.L;
|
|
37
|
-
return /*#__PURE__*/React.createElement(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return /*#__PURE__*/React.createElement(ToolbarListsIndentation, {
|
|
49
|
-
featureFlags: featureFlags,
|
|
50
|
-
isSmall: isSmall,
|
|
51
|
-
isReducedSpacing: isToolbarReducedSpacing,
|
|
52
|
-
disabled: disabled,
|
|
53
|
-
editorView: editorView,
|
|
54
|
-
popupsMountPoint: popupsMountPoint,
|
|
55
|
-
popupsBoundariesElement: popupsBoundariesElement,
|
|
56
|
-
popupsScrollableElement: popupsScrollableElement,
|
|
57
|
-
bulletListActive: listState.bulletListActive,
|
|
58
|
-
bulletListDisabled: listState.bulletListDisabled,
|
|
59
|
-
orderedListActive: listState.orderedListActive,
|
|
60
|
-
orderedListDisabled: listState.orderedListDisabled,
|
|
61
|
-
showIndentationButtons: !!showIndentationButtons,
|
|
62
|
-
indentDisabled: indentationState.indentDisabled,
|
|
63
|
-
outdentDisabled: indentationState.outdentDisabled,
|
|
64
|
-
editorAnalyticsAPI: editorAnalyticsAPI
|
|
65
|
-
});
|
|
66
|
-
}
|
|
43
|
+
return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
|
|
44
|
+
featureFlags: featureFlags,
|
|
45
|
+
popupsMountPoint: popupsMountPoint,
|
|
46
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
47
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
48
|
+
isSmall: isSmall,
|
|
49
|
+
isToolbarReducedSpacing: isToolbarReducedSpacing,
|
|
50
|
+
disabled: disabled,
|
|
51
|
+
editorView: editorView,
|
|
52
|
+
showIndentationButtons: showIndentationButtons,
|
|
53
|
+
pluginInjectionApi: api
|
|
67
54
|
});
|
|
68
55
|
}
|
|
69
56
|
};
|
|
70
57
|
};
|
|
58
|
+
function PrimaryToolbarComponent(_ref4) {
|
|
59
|
+
var featureFlags = _ref4.featureFlags,
|
|
60
|
+
popupsMountPoint = _ref4.popupsMountPoint,
|
|
61
|
+
popupsBoundariesElement = _ref4.popupsBoundariesElement,
|
|
62
|
+
popupsScrollableElement = _ref4.popupsScrollableElement,
|
|
63
|
+
isSmall = _ref4.isSmall,
|
|
64
|
+
isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing,
|
|
65
|
+
disabled = _ref4.disabled,
|
|
66
|
+
editorView = _ref4.editorView,
|
|
67
|
+
showIndentationButtons = _ref4.showIndentationButtons,
|
|
68
|
+
pluginInjectionApi = _ref4.pluginInjectionApi;
|
|
69
|
+
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['list', 'toolbarListsIndentation']),
|
|
70
|
+
listState = _useSharedPluginState.listState,
|
|
71
|
+
toolbarListsIndentationState = _useSharedPluginState.toolbarListsIndentationState;
|
|
72
|
+
if (!listState) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
return /*#__PURE__*/React.createElement(ToolbarListsIndentation, {
|
|
76
|
+
featureFlags: featureFlags,
|
|
77
|
+
isSmall: isSmall,
|
|
78
|
+
isReducedSpacing: isToolbarReducedSpacing,
|
|
79
|
+
disabled: disabled,
|
|
80
|
+
editorView: editorView,
|
|
81
|
+
popupsMountPoint: popupsMountPoint,
|
|
82
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
83
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
84
|
+
bulletListActive: listState.bulletListActive,
|
|
85
|
+
bulletListDisabled: listState.bulletListDisabled,
|
|
86
|
+
orderedListActive: listState.orderedListActive,
|
|
87
|
+
orderedListDisabled: listState.orderedListDisabled,
|
|
88
|
+
showIndentationButtons: !!showIndentationButtons,
|
|
89
|
+
indentDisabled: toolbarListsIndentationState.indentDisabled,
|
|
90
|
+
outdentDisabled: toolbarListsIndentationState.outdentDisabled,
|
|
91
|
+
pluginInjectionApi: pluginInjectionApi
|
|
92
|
+
});
|
|
93
|
+
}
|
|
71
94
|
export default toolbarListsIndentationPlugin;
|
|
@@ -2,12 +2,11 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
|
2
2
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import { shallowEqual } from '@atlaskit/editor-common/utils';
|
|
5
|
-
import { isInsideListItem } from '../../list/utils/selection';
|
|
6
5
|
import { getCurrentIndentLevel as getTaskListIndentLevel, getTaskItemIndex, isInsideTask } from '../../tasks-and-decisions/pm-plugins/helpers';
|
|
7
6
|
import { isIndentationAllowed, MAX_INDENTATION_LEVEL } from '../../indentation/commands';
|
|
8
7
|
import { getListItemAttributes } from '@atlaskit/editor-common/lists';
|
|
9
8
|
export var pluginKey = new PluginKey('indentationButtonsPlugin');
|
|
10
|
-
function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndentation) {
|
|
9
|
+
function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndentation, api) {
|
|
11
10
|
var state = {
|
|
12
11
|
indentDisabled: true,
|
|
13
12
|
outdentDisabled: true,
|
|
@@ -20,7 +19,7 @@ function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndenta
|
|
|
20
19
|
// not use the indentation mark.
|
|
21
20
|
// Check for lists before paragraphs and headings in case
|
|
22
21
|
// the selection is in a list nested in a layout column.
|
|
23
|
-
if (isInsideListItem(editorState)) {
|
|
22
|
+
if (api !== null && api !== void 0 && api.dependencies.list.actions.isInsideListItem(editorState)) {
|
|
24
23
|
var _getListItemAttribute = getListItemAttributes(selection.$head),
|
|
25
24
|
indentLevel = _getListItemAttribute.indentLevel,
|
|
26
25
|
itemIndex = _getListItemAttribute.itemIndex;
|
|
@@ -69,7 +68,8 @@ function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndenta
|
|
|
69
68
|
export var createPlugin = function createPlugin(_ref) {
|
|
70
69
|
var dispatch = _ref.dispatch,
|
|
71
70
|
showIndentationButtons = _ref.showIndentationButtons,
|
|
72
|
-
allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation
|
|
71
|
+
allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation,
|
|
72
|
+
api = _ref.api;
|
|
73
73
|
return new SafePlugin({
|
|
74
74
|
state: {
|
|
75
75
|
init: function init(_config, state) {
|
|
@@ -78,11 +78,11 @@ export var createPlugin = function createPlugin(_ref) {
|
|
|
78
78
|
outdentDisabled: true,
|
|
79
79
|
node: null
|
|
80
80
|
};
|
|
81
|
-
return showIndentationButtons ? getIndentationButtonsState(state, allowHeadingAndParagraphIndentation) : initialState;
|
|
81
|
+
return showIndentationButtons ? getIndentationButtonsState(state, allowHeadingAndParagraphIndentation, api) : initialState;
|
|
82
82
|
},
|
|
83
83
|
apply: function apply(_tr, pluginState, _oldState, newState) {
|
|
84
84
|
if (showIndentationButtons) {
|
|
85
|
-
var state = getIndentationButtonsState(newState, allowHeadingAndParagraphIndentation);
|
|
85
|
+
var state = getIndentationButtonsState(newState, allowHeadingAndParagraphIndentation, api);
|
|
86
86
|
if (!shallowEqual(pluginState, state)) {
|
|
87
87
|
dispatch(pluginKey, state);
|
|
88
88
|
return state;
|
|
@@ -18,7 +18,7 @@ export default function ToolbarListsIndentation(props) {
|
|
|
18
18
|
indentDisabled = props.indentDisabled,
|
|
19
19
|
outdentDisabled = props.outdentDisabled,
|
|
20
20
|
featureFlags = props.featureFlags,
|
|
21
|
-
|
|
21
|
+
pluginInjectionApi = props.pluginInjectionApi;
|
|
22
22
|
if (isSmall) {
|
|
23
23
|
return jsx(ToolbarDropdown, {
|
|
24
24
|
editorView: props.editorView,
|
|
@@ -34,7 +34,7 @@ export default function ToolbarListsIndentation(props) {
|
|
|
34
34
|
indentDisabled: indentDisabled,
|
|
35
35
|
outdentDisabled: outdentDisabled,
|
|
36
36
|
disabled: disabled,
|
|
37
|
-
onItemActivated: onItemActivated(
|
|
37
|
+
onItemActivated: onItemActivated(pluginInjectionApi),
|
|
38
38
|
featureFlags: featureFlags
|
|
39
39
|
});
|
|
40
40
|
}
|
|
@@ -49,7 +49,7 @@ export default function ToolbarListsIndentation(props) {
|
|
|
49
49
|
indentDisabled: indentDisabled,
|
|
50
50
|
outdentDisabled: outdentDisabled,
|
|
51
51
|
disabled: disabled,
|
|
52
|
-
onItemActivated: onItemActivated(
|
|
52
|
+
onItemActivated: onItemActivated(pluginInjectionApi),
|
|
53
53
|
featureFlags: featureFlags
|
|
54
54
|
});
|
|
55
55
|
}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { indentList, outdentList, toggleBulletList, toggleOrderedList } from '../../list/commands';
|
|
2
1
|
import { getIndentCommand as indentParagraphOrHeading, getOutdentCommand as outdentParagraphOrHeading } from '../../indentation/commands';
|
|
3
2
|
import { getIndentCommand as indentTaskList, getUnindentCommand as outdentTaskList } from '../../tasks-and-decisions/pm-plugins/keymaps';
|
|
4
3
|
import { INPUT_METHOD } from '../../analytics';
|
|
5
4
|
import { pluginKey as indentationButtonsPluginKey } from '../pm-plugins/indentation-buttons';
|
|
6
|
-
export var onItemActivated = function onItemActivated(
|
|
5
|
+
export var onItemActivated = function onItemActivated(pluginInjectionApi) {
|
|
7
6
|
return function (_ref) {
|
|
8
7
|
var buttonName = _ref.buttonName,
|
|
9
8
|
editorView = _ref.editorView,
|
|
10
9
|
featureFlags = _ref.featureFlags;
|
|
11
10
|
switch (buttonName) {
|
|
12
11
|
case 'bullet_list':
|
|
13
|
-
toggleBulletList(
|
|
12
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.list.actions.toggleBulletList(editorView, INPUT_METHOD.TOOLBAR);
|
|
14
13
|
break;
|
|
15
14
|
case 'ordered_list':
|
|
16
|
-
toggleOrderedList(
|
|
15
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.list.actions.toggleOrderedList(editorView, INPUT_METHOD.TOOLBAR);
|
|
17
16
|
break;
|
|
18
17
|
case 'indent':
|
|
19
18
|
{
|
|
@@ -23,7 +22,7 @@ export var onItemActivated = function onItemActivated(editorAnalyticsAPI) {
|
|
|
23
22
|
indentParagraphOrHeading(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
24
23
|
}
|
|
25
24
|
if (node === 'list') {
|
|
26
|
-
indentList(
|
|
25
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.list.actions.indentList(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
27
26
|
}
|
|
28
27
|
if (node === 'taskList') {
|
|
29
28
|
indentTaskList(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
@@ -38,7 +37,7 @@ export var onItemActivated = function onItemActivated(editorAnalyticsAPI) {
|
|
|
38
37
|
outdentParagraphOrHeading(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
39
38
|
}
|
|
40
39
|
if (_node === 'list') {
|
|
41
|
-
outdentList(
|
|
40
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.list.actions.outdentList(INPUT_METHOD.TOOLBAR, featureFlags)(editorView.state, editorView.dispatch);
|
|
42
41
|
}
|
|
43
42
|
if (_node === 'taskList') {
|
|
44
43
|
outdentTaskList(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
package/dist/esm/test-utils.js
CHANGED
|
@@ -7,7 +7,7 @@ import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
|
7
7
|
import { createSchema } from './create-editor/create-schema';
|
|
8
8
|
import { sortByOrder } from './create-editor/sort-by-order';
|
|
9
9
|
import { analyticsPluginKey } from './plugins/analytics/plugin-key';
|
|
10
|
-
import basePlugin from './plugins/base';
|
|
10
|
+
import { basePlugin } from './plugins/base';
|
|
11
11
|
export { createTypeAheadTools } from './plugins/type-ahead/api';
|
|
12
12
|
export function getFireAnalytics(editorView) {
|
|
13
13
|
var _analyticsPluginKey$g;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import React, { useMemo } from 'react';
|
|
5
5
|
import { jsx, css, useTheme } from '@emotion/react';
|
|
6
|
-
import { whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, shadowSharedStyle, dateSharedStyle, tasksAndDecisionsStyles, annotationSharedStyles, smartCardSharedStyles, textColorStyles, resizerStyles, gridStyles, smartCardStyles, embedCardStyles } from '@atlaskit/editor-common/styles';
|
|
7
|
-
import { editorFontSize } from '@atlaskit/editor-shared-styles';
|
|
6
|
+
import { whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, shadowSharedStyle, dateSharedStyle, tasksAndDecisionsStyles, annotationSharedStyles, smartCardSharedStyles, textColorStyles, resizerStyles, gridStyles, smartCardStyles, embedCardStyles, codeBlockInListSafariFix } from '@atlaskit/editor-common/styles';
|
|
7
|
+
import { blockNodesVerticalMargin, editorFontSize } from '@atlaskit/editor-shared-styles';
|
|
8
8
|
import { unsupportedStyles } from '../../plugins/unsupported-content/styles';
|
|
9
9
|
import { telepointerStyle } from '../../plugins/collab-edit/styles';
|
|
10
10
|
import { gapCursorStyles } from '../../plugins/selection/gap-cursor/styles';
|
|
@@ -12,7 +12,6 @@ import { tableStyles } from '@atlaskit/editor-plugin-table/ui/common-styles';
|
|
|
12
12
|
import { placeholderStyles } from '../../plugins/placeholder/styles';
|
|
13
13
|
import { blocktypeStyles } from '../../plugins/block-type/styles';
|
|
14
14
|
import { codeBlockStyles } from '../../plugins/code-block/styles';
|
|
15
|
-
import { listsStyles } from '../../plugins/list/styles';
|
|
16
15
|
import { ruleStyles } from '../../plugins/rule/styles';
|
|
17
16
|
import { mediaStyles } from '../../plugins/media/styles';
|
|
18
17
|
import { layoutStyles } from '../../plugins/layout/styles';
|
|
@@ -30,9 +29,11 @@ import { statusStyles } from '../../plugins/status/styles';
|
|
|
30
29
|
import { dateStyles } from '../../plugins/date/styles';
|
|
31
30
|
import { InlineNodeViewSharedStyles } from '../../nodeviews/getInlineNodeViewProducer.styles';
|
|
32
31
|
import { linkSharedStyle, codeMarkSharedStyles } from '@atlaskit/editor-common/styles';
|
|
32
|
+
import { browser } from '@atlaskit/editor-common/utils';
|
|
33
33
|
export var linkStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror {\n ", "\n }\n"])), linkSharedStyle);
|
|
34
|
+
var listsStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .ProseMirror {\n li {\n position: relative;\n\n > p:not(:first-child) {\n margin: 4px 0 0 0;\n }\n\n // In SSR the above rule will apply to all p tags because first-child would be a style tag.\n // The following rule resets the first p tag back to its original margin\n // defined in packages/editor/editor-common/src/styles/shared/paragraph.ts\n > style:first-child + p {\n margin-top: ", ";\n }\n }\n\n & :not([data-node-type='decisionList']) > li {\n ", "\n }\n }\n"])), blockNodesVerticalMargin, browser.safari ? codeBlockInListSafariFix : '');
|
|
34
35
|
var contentStyles = function contentStyles(props) {
|
|
35
|
-
return css(
|
|
36
|
+
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .ProseMirror {\n outline: none;\n font-size: ", "px;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n }\n\n .ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n pointer-events: none;\n opacity: 0.7;\n }\n\n .ProseMirror-hideselection *::selection {\n background: transparent;\n }\n\n .ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n }\n\n .ProseMirror-selectednode {\n outline: none;\n }\n\n .ProseMirror-selectednode:empty {\n outline: 2px solid ", ";\n }\n\n ", "\n ", "\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n box-sizing: border-box;\n }\n\n .mediaGroupView-content-wrap ul {\n padding: 0;\n }\n\n /** Needed to override any cleared floats, e.g. image wrapping */\n\n div.fabric-editor-block-mark[class^='fabric-editor-align'] {\n clear: none !important;\n }\n\n .fabric-editor-align-end {\n text-align: right;\n }\n\n .fabric-editor-align-start {\n text-align: left;\n }\n\n .fabric-editor-align-center {\n text-align: center;\n }\n\n .pm-table-header-content-wrap :not(.fabric-editor-alignment),\n .pm-table-header-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark,\n .pm-table-cell-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark {\n p:first-of-type {\n margin-top: 0;\n }\n }\n\n .hyperlink-floating-toolbar,\n .", " {\n padding: 0;\n }\n\n /* Link icon in the Atlaskit package\n is bigger than the others\n */\n .hyperlink-open-link {\n svg {\n max-width: 18px;\n }\n &[href] {\n padding: 0 4px;\n }\n }\n"])), editorFontSize({
|
|
36
37
|
theme: props.theme
|
|
37
38
|
}), whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, shadowSharedStyle, InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)", placeholderTextStyles, placeholderStyles, codeBlockStyles(props), blocktypeStyles(props), codeMarkSharedStyles(props), textColorStyles, listsStyles, ruleStyles(props), mediaStyles, layoutStyles(props), telepointerStyle, gapCursorStyles, tableStyles(props), panelStyles(props), fakeCursorStyles, mentionsStyles, emojiStyles, tasksAndDecisionsStyles, gridStyles, linkStyles, blockMarksSharedStyles, dateSharedStyle, extensionStyles, expandStyles(props), findReplaceStyles, taskDecisionStyles, statusStyles, annotationSharedStyles(props), smartCardStyles, smartCardSharedStyles, dateStyles, embedCardStyles, unsupportedStyles, resizerStyles, ClassNames.FLOATING_TOOLBAR_COMPONENT);
|
|
38
39
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
@@ -29,7 +30,7 @@ import { openFeedbackDialog } from '../../plugins/feedback-dialog';
|
|
|
29
30
|
import deprecationWarnings from '../../utils/deprecation-warnings';
|
|
30
31
|
import pickBy from '../../utils/pick-by';
|
|
31
32
|
import { analyticsEventKey } from '../../plugins/analytics/consts';
|
|
32
|
-
import {
|
|
33
|
+
import { usePresetContext } from '../../presets/context';
|
|
33
34
|
var PopupWithOutsideListeners = withOuterListeners(Popup);
|
|
34
35
|
var POPUP_HEIGHT = 388;
|
|
35
36
|
var POPUP_WIDTH = 280;
|
|
@@ -50,12 +51,12 @@ var deprecations = [{
|
|
|
50
51
|
var isNullOrUndefined = function isNullOrUndefined(attr) {
|
|
51
52
|
return attr === null || attr === undefined;
|
|
52
53
|
};
|
|
53
|
-
var
|
|
54
|
-
_inherits(
|
|
55
|
-
var _super = _createSuper(
|
|
56
|
-
function
|
|
54
|
+
var ToolbarFeedbackInternal = /*#__PURE__*/function (_PureComponent) {
|
|
55
|
+
_inherits(ToolbarFeedbackInternal, _PureComponent);
|
|
56
|
+
var _super = _createSuper(ToolbarFeedbackInternal);
|
|
57
|
+
function ToolbarFeedbackInternal(props) {
|
|
57
58
|
var _this;
|
|
58
|
-
_classCallCheck(this,
|
|
59
|
+
_classCallCheck(this, ToolbarFeedbackInternal);
|
|
59
60
|
_this = _super.call(this, props);
|
|
60
61
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
61
62
|
jiraIssueCollectorScriptLoading: false,
|
|
@@ -92,8 +93,8 @@ var ToolbarFeedback = /*#__PURE__*/function (_PureComponent) {
|
|
|
92
93
|
});
|
|
93
94
|
});
|
|
94
95
|
_defineProperty(_assertThisInitialized(_this), "openJiraIssueCollector", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
95
|
-
var _window$localStorage$,
|
|
96
|
-
var
|
|
96
|
+
var _this$props$api, _window$localStorage$, _basePluginState$cont;
|
|
97
|
+
var basePluginState, sessionId, contentId, tabId;
|
|
97
98
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
98
99
|
while (1) switch (_context.prev = _context.next) {
|
|
99
100
|
case 0:
|
|
@@ -101,9 +102,9 @@ var ToolbarFeedback = /*#__PURE__*/function (_PureComponent) {
|
|
|
101
102
|
jiraIssueCollectorScriptLoading: true,
|
|
102
103
|
showOptOutOption: false
|
|
103
104
|
});
|
|
104
|
-
|
|
105
|
+
basePluginState = (_this$props$api = _this.props.api) === null || _this$props$api === void 0 ? void 0 : _this$props$api.dependencies.base.sharedState.currentState();
|
|
105
106
|
sessionId = (_window$localStorage$ = window.localStorage.getItem('awc.session.id')) === null || _window$localStorage$ === void 0 ? void 0 : _window$localStorage$.toString();
|
|
106
|
-
contentId =
|
|
107
|
+
contentId = basePluginState === null || basePluginState === void 0 ? void 0 : (_basePluginState$cont = basePluginState.contextIdentifier) === null || _basePluginState$cont === void 0 ? void 0 : _basePluginState$cont.objectId;
|
|
107
108
|
tabId = window.sessionStorage['awc.tab.id'];
|
|
108
109
|
_context.next = 7;
|
|
109
110
|
return openFeedbackDialog(_objectSpread(_objectSpread({}, _this.getFeedbackInfo()), {}, {
|
|
@@ -144,7 +145,7 @@ var ToolbarFeedback = /*#__PURE__*/function (_PureComponent) {
|
|
|
144
145
|
deprecationWarnings(ToolbarFeedback.name, props, deprecations);
|
|
145
146
|
return _this;
|
|
146
147
|
}
|
|
147
|
-
_createClass(
|
|
148
|
+
_createClass(ToolbarFeedbackInternal, [{
|
|
148
149
|
key: "render",
|
|
149
150
|
value: function render() {
|
|
150
151
|
var _this$props = this.props,
|
|
@@ -191,9 +192,14 @@ var ToolbarFeedback = /*#__PURE__*/function (_PureComponent) {
|
|
|
191
192
|
}, "Learn more")))))) : null;
|
|
192
193
|
}
|
|
193
194
|
}]);
|
|
194
|
-
return
|
|
195
|
+
return ToolbarFeedbackInternal;
|
|
195
196
|
}(PureComponent);
|
|
196
|
-
_defineProperty(
|
|
197
|
+
_defineProperty(ToolbarFeedbackInternal, "contextTypes", {
|
|
197
198
|
editorActions: PropTypes.object.isRequired
|
|
198
199
|
});
|
|
199
|
-
export
|
|
200
|
+
export default function ToolbarFeedback(props) {
|
|
201
|
+
var api = usePresetContext();
|
|
202
|
+
return jsx(ToolbarFeedbackInternal, _extends({
|
|
203
|
+
api: api
|
|
204
|
+
}, props));
|
|
205
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -63,7 +63,6 @@ export { INPUT_METHOD, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, }
|
|
|
63
63
|
export type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
64
64
|
export { setKeyboardHeight, setMobilePaddingTop, setIsExpanded, } from './plugins/mobile-dimensions/commands';
|
|
65
65
|
export { setTextSelection, dedupe, getNodesCount, measurements } from './utils';
|
|
66
|
-
export { getListCommands } from './utils/list-commands';
|
|
67
66
|
export { ReactEditorView, BaseReactEditorView } from './create-editor';
|
|
68
67
|
export { getDefaultPresetOptionsFromEditorProps } from './create-editor';
|
|
69
68
|
export type { Command, EditorPlugin, EditorProps, EditorInstance, CommandDispatch, } from './types';
|
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import basePlugin from './plugin';
|
|
2
|
+
import type { BasePlugin, BasePluginState, BasePluginOptions } from './plugin';
|
|
2
3
|
import type { ScrollGutterPluginOptions } from './pm-plugins/scroll-gutter';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export interface BasePluginOptions {
|
|
6
|
-
allowScrollGutter?: ScrollGutterPluginOptions;
|
|
7
|
-
allowInlineCursorTarget?: boolean;
|
|
8
|
-
inputTracking?: InputTracking;
|
|
9
|
-
browserFreezeTracking?: BrowserFreezetracking;
|
|
10
|
-
ufo?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare const isChromeWithSelectionBug: any;
|
|
13
|
-
declare const basePlugin: NextEditorPlugin<'base', {
|
|
14
|
-
pluginConfiguration: BasePluginOptions | undefined;
|
|
15
|
-
dependencies: [typeof featureFlagsPlugin];
|
|
16
|
-
}>;
|
|
17
|
-
export default basePlugin;
|
|
4
|
+
export { basePlugin };
|
|
5
|
+
export type { BasePlugin, BasePluginState, BasePluginOptions, ScrollGutterPluginOptions, };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { NextEditorPlugin } from '../../types';
|
|
2
|
+
import type { ScrollGutterPluginOptions } from './pm-plugins/scroll-gutter';
|
|
3
|
+
import type { InputTracking, BrowserFreezetracking } from '../../types/performance-tracking';
|
|
4
|
+
import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
5
|
+
import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
|
|
6
|
+
export interface BasePluginOptions {
|
|
7
|
+
allowScrollGutter?: ScrollGutterPluginOptions;
|
|
8
|
+
allowInlineCursorTarget?: boolean;
|
|
9
|
+
inputTracking?: InputTracking;
|
|
10
|
+
browserFreezeTracking?: BrowserFreezetracking;
|
|
11
|
+
ufo?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export type BasePluginState = {
|
|
14
|
+
contextIdentifier: ContextIdentifierProvider | undefined;
|
|
15
|
+
};
|
|
16
|
+
export type BasePlugin = NextEditorPlugin<'base', {
|
|
17
|
+
pluginConfiguration: BasePluginOptions | undefined;
|
|
18
|
+
dependencies: [typeof featureFlagsPlugin];
|
|
19
|
+
sharedState: BasePluginState;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const isChromeWithSelectionBug: any;
|
|
22
|
+
declare const basePlugin: BasePlugin;
|
|
23
|
+
export default basePlugin;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
export declare const GUTTER_SIZE_IN_PX = 120;
|
|
4
|
-
export declare const GUTTER_SIZE_MOBILE_IN_PX = 36;
|
|
5
|
-
export declare const GUTTER_SELECTOR = "#editor-scroll-gutter";
|
|
6
3
|
export type ScrollGutterPluginOptions = {
|
|
7
4
|
/** Element the page uses for scrolling */
|
|
8
5
|
getScrollElement?: (view: EditorView) => HTMLElement | null;
|