@atlaskit/editor-common 74.32.1 → 74.34.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 +16 -0
- package/dist/cjs/card/MediaAndEmbedsToolbar/index.js +23 -7
- package/dist/cjs/guideline/index.js +13 -0
- package/dist/cjs/keymaps/index.js +8 -1
- package/dist/cjs/keymaps/keymap.js +38 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/styles/shared/media-single.js +2 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/MediaSingle/index.js +2 -7
- package/dist/cjs/ui/MediaSingle/styled.js +24 -2
- package/dist/cjs/ui/index.js +0 -6
- package/dist/cjs/utils/commands.js +180 -15
- package/dist/cjs/utils/editor-core-utils.js +53 -3
- package/dist/cjs/utils/index.js +54 -0
- package/dist/cjs/utils/input-rules.js +48 -2
- package/dist/cjs/utils/rich-media-utils.js +6 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/card/MediaAndEmbedsToolbar/index.js +23 -8
- package/dist/es2019/guideline/index.js +1 -0
- package/dist/es2019/keymaps/index.js +3 -2
- package/dist/es2019/keymaps/keymap.js +33 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/styles/shared/media-single.js +6 -5
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/MediaSingle/index.js +1 -4
- package/dist/es2019/ui/MediaSingle/styled.js +45 -2
- package/dist/es2019/ui/index.js +1 -1
- package/dist/es2019/utils/commands.js +173 -2
- package/dist/es2019/utils/editor-core-utils.js +46 -1
- package/dist/es2019/utils/index.js +4 -4
- package/dist/es2019/utils/input-rules.js +45 -0
- package/dist/es2019/utils/rich-media-utils.js +3 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/card/MediaAndEmbedsToolbar/index.js +24 -8
- package/dist/esm/guideline/index.js +1 -0
- package/dist/esm/keymaps/index.js +3 -2
- package/dist/esm/keymaps/keymap.js +33 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/styles/shared/media-single.js +2 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/MediaSingle/index.js +1 -4
- package/dist/esm/ui/MediaSingle/styled.js +25 -3
- package/dist/esm/ui/index.js +1 -1
- package/dist/esm/utils/commands.js +170 -14
- package/dist/esm/utils/editor-core-utils.js +47 -0
- package/dist/esm/utils/index.js +4 -4
- package/dist/esm/utils/input-rules.js +44 -0
- package/dist/esm/utils/rich-media-utils.js +3 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/card/MediaAndEmbedsToolbar/index.d.ts +1 -1
- package/dist/types/guideline/index.d.ts +1 -0
- package/dist/types/keymaps/index.d.ts +1 -0
- package/dist/types/keymaps/keymap.d.ts +11 -0
- package/dist/types/types/block-type.d.ts +1 -0
- package/dist/types/types/feature-flags.d.ts +8 -0
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/ui/DropList/index.d.ts +1 -1
- package/dist/types/ui/MediaSingle/index.d.ts +1 -2
- package/dist/types/ui/MediaSingle/styled.d.ts +3 -1
- package/dist/types/ui/index.d.ts +1 -1
- package/dist/types/utils/commands.d.ts +11 -5
- package/dist/types/utils/editor-core-utils.d.ts +7 -2
- package/dist/types/utils/index.d.ts +4 -4
- package/dist/types/utils/input-rules.d.ts +12 -4
- package/dist/types/utils/rich-media-utils.d.ts +1 -0
- package/dist/types-ts4.5/card/MediaAndEmbedsToolbar/index.d.ts +1 -1
- package/dist/types-ts4.5/guideline/index.d.ts +1 -0
- package/dist/types-ts4.5/keymaps/index.d.ts +1 -0
- package/dist/types-ts4.5/keymaps/keymap.d.ts +11 -0
- package/dist/types-ts4.5/types/block-type.d.ts +1 -0
- package/dist/types-ts4.5/types/feature-flags.d.ts +8 -0
- package/dist/types-ts4.5/types/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/DropList/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/MediaSingle/index.d.ts +1 -2
- package/dist/types-ts4.5/ui/MediaSingle/styled.d.ts +3 -1
- package/dist/types-ts4.5/ui/index.d.ts +1 -1
- package/dist/types-ts4.5/utils/commands.d.ts +11 -5
- package/dist/types-ts4.5/utils/editor-core-utils.d.ts +7 -2
- package/dist/types-ts4.5/utils/index.d.ts +4 -4
- package/dist/types-ts4.5/utils/input-rules.d.ts +12 -4
- package/dist/types-ts4.5/utils/rich-media-utils.d.ts +1 -0
- package/package.json +7 -3
|
@@ -416,6 +416,14 @@ export type FeatureFlags = {
|
|
|
416
416
|
* @default false
|
|
417
417
|
*/
|
|
418
418
|
useFragmentMarkBreakoutWidthStylingFix?: boolean;
|
|
419
|
+
/**
|
|
420
|
+
* @description
|
|
421
|
+
* Enable the new editor media resize experience.
|
|
422
|
+
*
|
|
423
|
+
* @see https://product-fabric.atlassian.net/browse/ED-18316
|
|
424
|
+
* @default false
|
|
425
|
+
*/
|
|
426
|
+
extendedMediaResizeExperience?: boolean | undefined;
|
|
419
427
|
};
|
|
420
428
|
export type FeatureFlagKey = keyof FeatureFlags;
|
|
421
429
|
export type GetEditorFeatureFlags = () => FeatureFlags;
|
|
@@ -39,6 +39,6 @@ export type { SnapPointsProps } from './resizable-media-single';
|
|
|
39
39
|
export type { BreakoutMode } from './breakout';
|
|
40
40
|
export type { DatasourceModalType } from './datasource';
|
|
41
41
|
export type { ImageUploadPluginReferenceEventBase, ImageUploadPluginReferenceEventDragEvent, ImageUploadPluginReferenceEventClipboardEvent, ImageUploadPluginReferenceEvent, } from './image-upload-reference-event';
|
|
42
|
-
export type { HeadingLevels, NormalTextLevel, HeadingLevelsAndNormalText, } from './block-type';
|
|
42
|
+
export type { AllowedBlockTypes, HeadingLevels, NormalTextLevel, HeadingLevelsAndNormalText, } from './block-type';
|
|
43
43
|
export type { ColumnResizingPluginState } from './tables';
|
|
44
44
|
export type { InputRuleHandler, OnHandlerApply, InputRuleWrapper, } from './input-rules';
|
|
@@ -16,5 +16,5 @@ export type OpenChangedEvent = {
|
|
|
16
16
|
isOpen: boolean;
|
|
17
17
|
event: MouseEvent | KeyboardEvent;
|
|
18
18
|
};
|
|
19
|
-
declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "key" | "id" | "children" | "
|
|
19
|
+
declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "key" | "id" | "children" | "testId" | "position" | "analyticsContext" | "shouldFitContainer" | "trigger" | "isOpen" | "onPositioned" | "onOpenChange"> & import("react").RefAttributes<any>>;
|
|
20
20
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
-
import { RichMediaLayout as MediaSingleLayout
|
|
4
|
+
import { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
|
|
5
5
|
import type { MediaSingleSize, MediaSingleWidthType } from './types';
|
|
6
6
|
export declare const DEFAULT_IMAGE_WIDTH = 250;
|
|
7
7
|
export declare const DEFAULT_IMAGE_HEIGHT = 200;
|
|
@@ -27,6 +27,5 @@ export interface Props {
|
|
|
27
27
|
hasFallbackContainer?: boolean;
|
|
28
28
|
handleMediaSingleRef?: React.RefObject<HTMLDivElement>;
|
|
29
29
|
}
|
|
30
|
-
export declare const shouldAddDefaultWrappedWidth: (layout: RichMediaLayout, width?: number, lineLength?: number) => boolean | 0 | undefined;
|
|
31
30
|
export type { MediaSingleWidthType, MediaSingleSize };
|
|
32
31
|
export default function MediaSingle({ layout, width, height, containerWidth, isLoading, pctWidth, size, className, children: propsChildren, nodeType, fullWidthMode, lineLength: editorWidth, hasFallbackContainer, handleMediaSingleRef, }: Props): jsx.JSX.Element;
|
|
@@ -31,12 +31,14 @@ export interface MediaSingleWrapperProps {
|
|
|
31
31
|
mediaSingleWidth?: number;
|
|
32
32
|
width?: number;
|
|
33
33
|
innerRef?: ((elem: HTMLDivElement) => void) | RefObject<HTMLDivElement>;
|
|
34
|
+
isExtendedResizeExperienceOn?: boolean;
|
|
35
|
+
isNestedNode?: boolean;
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
38
|
* Can't use `.attrs` to handle highly dynamic styles because we are still
|
|
37
39
|
* supporting `styled-components` v1.
|
|
38
40
|
*/
|
|
39
|
-
export declare const MediaSingleDimensionHelper: ({ containerWidth, fullWidthMode, isResized, layout, pctWidth, mediaSingleWidth, width, }: MediaSingleWrapperProps) => import("@emotion/react").SerializedStyles;
|
|
41
|
+
export declare const MediaSingleDimensionHelper: ({ containerWidth, fullWidthMode, isResized, layout, pctWidth, mediaSingleWidth, width, isExtendedResizeExperienceOn, isNestedNode, }: MediaSingleWrapperProps) => import("@emotion/react").SerializedStyles;
|
|
40
42
|
export interface MediaWrapperProps {
|
|
41
43
|
paddingBottom?: string;
|
|
42
44
|
height?: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default as Caption } from './Caption';
|
|
2
|
-
export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, IMAGE_AND_BORDER_ADJUSTMENT,
|
|
2
|
+
export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, IMAGE_AND_BORDER_ADJUSTMENT, } from './MediaSingle';
|
|
3
3
|
export type { Props as MediaSingleProps, MediaSingleWidthType, MediaSingleSize, } from './MediaSingle';
|
|
4
4
|
export { MediaSingleDimensionHelper } from './MediaSingle/styled';
|
|
5
5
|
export type { MediaSingleWrapperProps as MediaSingleDimensionHelperProps } from './MediaSingle/styled';
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Fragment, Node as PMNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import {
|
|
4
|
-
import type { Command } from '../types';
|
|
3
|
+
import { EditorAnalyticsAPI } from '../analytics';
|
|
4
|
+
import type { Command, Predicate } from '../types';
|
|
5
5
|
export type WalkNode = {
|
|
6
6
|
$pos: ResolvedPos;
|
|
7
7
|
foundNode: boolean;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
declare const filter: (predicates: Predicate[] | Predicate, cmd: Command) => Command;
|
|
9
|
+
export declare const filter: (predicates: Predicate[] | Predicate, cmd: Command) => Command;
|
|
11
10
|
/**
|
|
12
11
|
* Walk forwards from a position until we encounter the (inside) start of
|
|
13
12
|
* the next node, or reach the end of the document.
|
|
@@ -22,6 +21,13 @@ export declare const walkNextNode: ($startPos: ResolvedPos) => WalkNode;
|
|
|
22
21
|
* @param $startPos Position to start walking from.
|
|
23
22
|
*/
|
|
24
23
|
export declare const walkPrevNode: ($startPos: ResolvedPos) => WalkNode;
|
|
24
|
+
export declare function insertNewLine(): Command;
|
|
25
|
+
export declare const insertNewLineWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
26
|
+
export declare const createNewParagraphAbove: Command;
|
|
27
|
+
export declare const createNewParagraphBelow: Command;
|
|
28
|
+
export declare function createParagraphNear(append?: boolean): Command;
|
|
29
|
+
export declare function atTheEndOfDoc(state: EditorState): boolean;
|
|
30
|
+
export declare function atTheBeginningOfDoc(state: EditorState): boolean;
|
|
25
31
|
/**
|
|
26
32
|
* If the selection is empty, is inside a paragraph node and `canNextNodeMoveUp` is true then delete current paragraph
|
|
27
33
|
* and move the node below it up. The selection will be retained, to be placed in the moved node.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Node, NodeType, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import { EditorState, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
1
|
+
import { MarkType, Node, NodeType, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { EditorState, Selection, TextSelection, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
4
4
|
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
/**
|
|
@@ -27,3 +27,8 @@ export declare function setTextSelection(view: EditorView, anchor: number, head?
|
|
|
27
27
|
export declare function nonNullable<T>(value: T): value is NonNullable<T>;
|
|
28
28
|
export declare const isValidPosition: (pos: number | undefined, state: EditorState) => boolean;
|
|
29
29
|
export declare const isInLayoutColumn: (state: EditorState) => boolean;
|
|
30
|
+
export declare function filterChildrenBetween(doc: Node, from: number, to: number, predicate: (node: Node, pos: number, parent: Node | null) => boolean | undefined): {
|
|
31
|
+
node: Node;
|
|
32
|
+
pos: number;
|
|
33
|
+
}[];
|
|
34
|
+
export declare const removeBlockMarks: (state: EditorState, marks: Array<MarkType | undefined>) => Transaction | undefined;
|
|
@@ -6,7 +6,7 @@ export { default as ErrorReporter } from './error-reporter';
|
|
|
6
6
|
export type { ErrorReportingHandler } from './error-reporter';
|
|
7
7
|
export { isPastDate, timestampToIsoFormat, timestampToString, timestampToTaskContext, timestampToUTCDate, todayTimestampInUTC, } from './date';
|
|
8
8
|
export type { Date } from './date';
|
|
9
|
-
export { isElementInTableCell, isTextSelection, isLastItemMediaGroup, setNodeSelection, setTextSelection, nonNullable, stepAddsOneOf, stepHasSlice, extractSliceFromStep, isValidPosition, isEmptyParagraph, isInLayoutColumn, } from './editor-core-utils';
|
|
9
|
+
export { isElementInTableCell, isTextSelection, isLastItemMediaGroup, setNodeSelection, setTextSelection, nonNullable, stepAddsOneOf, stepHasSlice, extractSliceFromStep, isValidPosition, isEmptyParagraph, isInLayoutColumn, removeBlockMarks, filterChildrenBetween, } from './editor-core-utils';
|
|
10
10
|
export { withImageLoader } from './imageLoader';
|
|
11
11
|
export type { ImageLoaderProps, ImageLoaderState, ImageStatus, } from './imageLoader';
|
|
12
12
|
export { absoluteBreakoutWidth, calcBreakoutWidth, calcWideWidth, breakoutConsts, calculateBreakoutStyles, calcBreakoutWidthPx, getNextBreakoutMode, getTitle, } from './breakout';
|
|
@@ -52,10 +52,10 @@ export { isFromCurrentDomain, LinkMatcher, normalizeUrl, linkifyContent, getLink
|
|
|
52
52
|
export declare const pmHistoryPluginKey = "history$";
|
|
53
53
|
export { gridTypeForLayout } from './grid';
|
|
54
54
|
export { nodesBetweenChanged, getStepRange, isEmptyDocument, processRawValue, hasDocAsParent, bracketTyped, hasVisibleContent, } from './document';
|
|
55
|
-
export { floatingLayouts, isRichMediaInsideOfBlockNode, calculateSnapPoints, alignAttributes, } from './rich-media-utils';
|
|
55
|
+
export { floatingLayouts, isRichMediaInsideOfBlockNode, calculateSnapPoints, alignAttributes, nonWrappedLayouts, } from './rich-media-utils';
|
|
56
56
|
export { sanitizeNodeForPrivacy } from './filter/privacy-filter';
|
|
57
57
|
export { canRenderDatasource } from './datasource';
|
|
58
|
-
export { filterCommand,
|
|
58
|
+
export { filterCommand, isEmptySelectionAtStart, isEmptySelectionAtEnd, insertContentDeleteRange, deleteEmptyParagraphAndMoveBlockUp, insertNewLineWithAnalytics, createNewParagraphAbove, createNewParagraphBelow, createParagraphNear, walkNextNode, walkPrevNode, } from './commands';
|
|
59
59
|
export type { WalkNode } from './commands';
|
|
60
60
|
export declare function shallowEqual(obj1?: any, obj2?: any): boolean;
|
|
61
|
-
export { inputRuleWithAnalytics } from './input-rules';
|
|
61
|
+
export { inputRuleWithAnalytics, createWrappingJoinRule, createRule, } from './input-rules';
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type
|
|
4
|
-
import
|
|
1
|
+
import type { NodeType, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import { type AnalyticsEventPayload, type EditorAnalyticsAPI, JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST } from '../analytics';
|
|
4
|
+
import { InputRuleHandler, InputRuleWrapper } from '../types';
|
|
5
5
|
type GetPayload = AnalyticsEventPayload | ((state: EditorState, matchResult: RegExpExecArray) => AnalyticsEventPayload);
|
|
6
6
|
export declare const inputRuleWithAnalytics: (getPayload: GetPayload, analyticsApi: EditorAnalyticsAPI | undefined) => (originalRule: InputRuleWrapper) => InputRuleWrapper;
|
|
7
|
+
type WrappingRuleProps = {
|
|
8
|
+
match: RegExp;
|
|
9
|
+
nodeType: NodeType;
|
|
10
|
+
getAttrs?: Record<string, any> | ((matchResult: RegExpExecArray) => Record<string, any>);
|
|
11
|
+
joinPredicate?: (matchResult: RegExpExecArray, node: PMNode, joinScenario: JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST) => boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare const createWrappingJoinRule: ({ match, nodeType, getAttrs, joinPredicate, }: WrappingRuleProps) => InputRuleWrapper;
|
|
14
|
+
export declare const createRule: (match: RegExp, handler: InputRuleHandler) => InputRuleWrapper;
|
|
7
15
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RichMediaAttributes, RichMediaLayout } from '@atlaskit/adf-schema';
|
|
2
2
|
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import { SnapPointsProps } from '../types';
|
|
4
|
+
export declare const shouldAddDefaultWrappedWidth: (layout: RichMediaLayout, width?: number, lineLength?: number) => boolean | 0 | undefined;
|
|
4
5
|
export declare const nonWrappedLayouts: RichMediaLayout[];
|
|
5
6
|
export declare const floatingLayouts: string[];
|
|
6
7
|
export declare const isRichMediaInsideOfBlockNode: (view: EditorView, pos: number | boolean) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "74.
|
|
3
|
+
"version": "74.34.0",
|
|
4
4
|
"description": "A package that contains common classes and components for editor and renderer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"@atlaskit/spinner": "^15.5.0",
|
|
111
111
|
"@atlaskit/task-decision": "^17.7.0",
|
|
112
112
|
"@atlaskit/theme": "^12.5.0",
|
|
113
|
-
"@atlaskit/tokens": "^1.
|
|
113
|
+
"@atlaskit/tokens": "^1.14.0",
|
|
114
114
|
"@atlaskit/tooltip": "^17.8.0",
|
|
115
115
|
"@atlaskit/ufo": "^0.2.0",
|
|
116
116
|
"@atlaskit/width-detector": "^4.1.0",
|
|
@@ -131,7 +131,8 @@
|
|
|
131
131
|
"raf-schd": "^4.0.3",
|
|
132
132
|
"re-resizable": "6.0.0",
|
|
133
133
|
"react-loadable": "^5.1.0",
|
|
134
|
-
"rusha": "^0.8.13"
|
|
134
|
+
"rusha": "^0.8.13",
|
|
135
|
+
"w3c-keyname": "^2.1.0"
|
|
135
136
|
},
|
|
136
137
|
"peerDependencies": {
|
|
137
138
|
"@atlaskit/media-core": "^34.1.2",
|
|
@@ -191,6 +192,9 @@
|
|
|
191
192
|
"platform.linking-platform.datasource-jira_issues": {
|
|
192
193
|
"type": "boolean"
|
|
193
194
|
},
|
|
195
|
+
"platform.editor.media.extended-resize-experience": {
|
|
196
|
+
"type": "boolean"
|
|
197
|
+
},
|
|
194
198
|
"platform.linking-platform.datasource-assets_objects": {
|
|
195
199
|
"type": "boolean"
|
|
196
200
|
}
|