@atlaskit/editor-core 187.14.8 → 187.14.11
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 +13 -0
- package/dist/cjs/commands/index.js +35 -120
- package/dist/cjs/plugins/media/commands/captions.js +29 -27
- package/dist/cjs/plugins/media/commands/linking.js +21 -17
- package/dist/cjs/plugins/media/index.js +4 -3
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +4 -2
- package/dist/cjs/plugins/media/pm-plugins/keymap.js +17 -15
- package/dist/cjs/plugins/media/pm-plugins/main.js +7 -5
- package/dist/cjs/plugins/media/toolbar/commands.js +149 -141
- package/dist/cjs/plugins/media/toolbar/index.js +20 -16
- package/dist/cjs/plugins/media/toolbar/linking.js +4 -3
- package/dist/cjs/plugins/media/utils/media-files.js +78 -75
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/commands/index.js +1 -115
- package/dist/es2019/plugins/media/commands/captions.js +4 -4
- package/dist/es2019/plugins/media/commands/linking.js +12 -11
- package/dist/es2019/plugins/media/index.js +6 -3
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +4 -2
- package/dist/es2019/plugins/media/pm-plugins/keymap.js +5 -5
- package/dist/es2019/plugins/media/pm-plugins/main.js +7 -5
- package/dist/es2019/plugins/media/toolbar/commands.js +15 -15
- package/dist/es2019/plugins/media/toolbar/index.js +20 -16
- package/dist/es2019/plugins/media/toolbar/linking.js +6 -3
- package/dist/es2019/plugins/media/utils/media-files.js +5 -6
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/commands/index.js +1 -113
- package/dist/esm/plugins/media/commands/captions.js +29 -27
- package/dist/esm/plugins/media/commands/linking.js +21 -17
- package/dist/esm/plugins/media/index.js +4 -3
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +4 -2
- package/dist/esm/plugins/media/pm-plugins/keymap.js +17 -15
- package/dist/esm/plugins/media/pm-plugins/main.js +7 -5
- package/dist/esm/plugins/media/toolbar/commands.js +148 -140
- package/dist/esm/plugins/media/toolbar/index.js +20 -16
- package/dist/esm/plugins/media/toolbar/linking.js +4 -3
- package/dist/esm/plugins/media/utils/media-files.js +78 -75
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/commands/index.d.ts +1 -17
- package/dist/types/plugins/media/commands/captions.d.ts +2 -1
- package/dist/types/plugins/media/commands/linking.d.ts +3 -3
- package/dist/types/plugins/media/pm-plugins/keymap.d.ts +2 -1
- package/dist/types/plugins/media/pm-plugins/main.d.ts +1 -1
- package/dist/types/plugins/media/toolbar/commands.d.ts +5 -4
- package/dist/types/plugins/media/utils/media-files.d.ts +3 -2
- package/dist/types-ts4.5/commands/index.d.ts +1 -17
- package/dist/types-ts4.5/plugins/media/commands/captions.d.ts +2 -1
- package/dist/types-ts4.5/plugins/media/commands/linking.d.ts +3 -3
- package/dist/types-ts4.5/plugins/media/pm-plugins/keymap.d.ts +2 -1
- package/dist/types-ts4.5/plugins/media/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/toolbar/commands.d.ts +5 -4
- package/dist/types-ts4.5/plugins/media/utils/media-files.d.ts +3 -2
- package/package.json +4 -4
- package/report.api.md +2 -2
- package/tmp/api-report-tmp.d.ts +2 -2
|
@@ -5,7 +5,6 @@ import { posOfPrecedingMediaGroup, posOfMediaGroupNearby, posOfParentMediaGroup,
|
|
|
5
5
|
import { canInsert, safeInsert, hasParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
6
6
|
import { atTheBeginningOfBlock, atTheEndOfBlock, atTheEndOfDoc, endPositionOfParent, startPositionOfParent } from '../../../utils/prosemirror/position';
|
|
7
7
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
8
|
-
import { addAnalytics } from '../../analytics';
|
|
9
8
|
export var canInsertMediaInline = function canInsertMediaInline(state) {
|
|
10
9
|
var node = state.schema.nodes.mediaInline.create({});
|
|
11
10
|
return canInsert(state.selection.$to, Fragment.from(node));
|
|
@@ -72,41 +71,43 @@ function shouldAppendParagraph(state, node) {
|
|
|
72
71
|
* @param mediaState Media file to be added to the editor
|
|
73
72
|
* @param collection Collection for the media to be added
|
|
74
73
|
*/
|
|
75
|
-
export var insertMediaInlineNode = function insertMediaInlineNode(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
74
|
+
export var insertMediaInlineNode = function insertMediaInlineNode(editorAnalyticsAPI) {
|
|
75
|
+
return function (view, mediaState, collection, inputMethod) {
|
|
76
|
+
var state = view.state,
|
|
77
|
+
dispatch = view.dispatch;
|
|
78
|
+
var schema = state.schema,
|
|
79
|
+
tr = state.tr;
|
|
80
|
+
var mediaInline = schema.nodes.mediaInline;
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
82
|
+
// Do nothing if no media found
|
|
83
|
+
if (!mediaInline || !mediaState || collection === undefined) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
var id = mediaState.id;
|
|
87
|
+
var mediaInlineNode = mediaInline.create({
|
|
88
|
+
id: id,
|
|
89
|
+
collection: collection
|
|
90
|
+
});
|
|
91
|
+
var space = state.schema.text(' ');
|
|
92
|
+
var pos = state.selection.$to.pos;
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
// If the selection is inside an empty list item set pos inside paragraph
|
|
95
|
+
if (isInListItem(state) && isInsidePotentialEmptyParagraph(state)) {
|
|
96
|
+
pos = pos + 1;
|
|
97
|
+
}
|
|
98
|
+
var content = Fragment.from([mediaInlineNode, space]);
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
100
|
+
// Delete the selection if a selection is made
|
|
101
|
+
var deleteRange = findDeleteRange(state);
|
|
102
|
+
if (!deleteRange) {
|
|
103
|
+
tr.insert(pos, content);
|
|
104
|
+
} else {
|
|
105
|
+
tr.insert(pos, content).deleteRange(deleteRange.start, deleteRange.end);
|
|
106
|
+
}
|
|
107
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaInlineAnalytics(mediaState, inputMethod))(tr);
|
|
108
|
+
dispatch(tr);
|
|
109
|
+
return true;
|
|
110
|
+
};
|
|
110
111
|
};
|
|
111
112
|
|
|
112
113
|
/**
|
|
@@ -116,51 +117,53 @@ export var insertMediaInlineNode = function insertMediaInlineNode(view, mediaSta
|
|
|
116
117
|
* @param mediaStates Media files to be added to the editor
|
|
117
118
|
* @param collection Collection for the media to be added
|
|
118
119
|
*/
|
|
119
|
-
export var insertMediaGroupNode = function insertMediaGroupNode(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
export var insertMediaGroupNode = function insertMediaGroupNode(editorAnalyticsAPI) {
|
|
121
|
+
return function (view, mediaStates, collection, inputMethod) {
|
|
122
|
+
var state = view.state,
|
|
123
|
+
dispatch = view.dispatch;
|
|
124
|
+
var tr = state.tr,
|
|
125
|
+
schema = state.schema;
|
|
126
|
+
var _schema$nodes = schema.nodes,
|
|
127
|
+
media = _schema$nodes.media,
|
|
128
|
+
paragraph = _schema$nodes.paragraph;
|
|
127
129
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
130
|
+
// Do nothing if no media found
|
|
131
|
+
if (!media || !mediaStates.length) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
var mediaNodes = createMediaFileNodes(mediaStates, collection, media);
|
|
135
|
+
var mediaInsertPos = findMediaInsertPos(state);
|
|
136
|
+
var resolvedInsertPos = tr.doc.resolve(mediaInsertPos);
|
|
137
|
+
var parent = resolvedInsertPos.parent;
|
|
138
|
+
var nodeAtInsertionPoint = tr.doc.nodeAt(mediaInsertPos);
|
|
139
|
+
var shouldSplit = !isSelectionMediaGroup(state) && isSupportedInParent(state, Fragment.from(state.schema.nodes.mediaGroup.createChecked({}, mediaNodes)));
|
|
140
|
+
var withParagraph = shouldAppendParagraph(state, nodeAtInsertionPoint);
|
|
141
|
+
var content = parent.type === schema.nodes.mediaGroup ? mediaNodes // If parent is a mediaGroup do not wrap items again.
|
|
142
|
+
: [schema.nodes.mediaGroup.createChecked({}, mediaNodes)];
|
|
143
|
+
if (shouldSplit) {
|
|
144
|
+
content = withParagraph ? content.concat(paragraph.create()) : content;
|
|
145
|
+
// delete the selection or empty paragraph
|
|
146
|
+
var deleteRange = findDeleteRange(state);
|
|
147
|
+
if (!deleteRange) {
|
|
148
|
+
tr.insert(mediaInsertPos, content);
|
|
149
|
+
} else if (mediaInsertPos <= deleteRange.start) {
|
|
150
|
+
tr.deleteRange(deleteRange.start, deleteRange.end).insert(mediaInsertPos, content);
|
|
151
|
+
} else {
|
|
152
|
+
tr.insert(mediaInsertPos, content).deleteRange(deleteRange.start, deleteRange.end);
|
|
153
|
+
}
|
|
154
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaGroupAnalytics(mediaStates, inputMethod))(tr);
|
|
155
|
+
dispatch(tr);
|
|
156
|
+
setSelectionAfterMediaInsertion(view);
|
|
157
|
+
return;
|
|
151
158
|
}
|
|
152
|
-
addAnalytics(state, tr, getInsertMediaGroupAnalytics(mediaStates, inputMethod));
|
|
153
|
-
dispatch(tr);
|
|
154
|
-
setSelectionAfterMediaInsertion(view);
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
159
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
// Don't append new paragraph when adding media to a existing mediaGroup
|
|
161
|
+
if (withParagraph && parent.type !== schema.nodes.mediaGroup) {
|
|
162
|
+
content.push(paragraph.create());
|
|
163
|
+
}
|
|
164
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaGroupAnalytics(mediaStates, inputMethod))(tr);
|
|
165
|
+
dispatch(safeInsert(Fragment.fromArray(content), mediaInsertPos)(tr));
|
|
166
|
+
};
|
|
164
167
|
};
|
|
165
168
|
var createMediaFileNodes = function createMediaFileNodes(mediaStates, collection, media) {
|
|
166
169
|
var nodes = mediaStates.map(function (mediaState) {
|
package/dist/esm/version.json
CHANGED
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import type { AlignmentState } from '../plugins/alignment/pm-plugins/types';
|
|
4
|
-
import type { Command } from '../types';
|
|
5
|
-
export declare function addParagraphAtEnd(tr: Transaction): void;
|
|
6
|
-
export declare function createParagraphAtEnd(): Command;
|
|
7
|
-
export declare const changeImageAlignment: (align?: AlignmentState) => Command;
|
|
8
|
-
export declare const createToggleBlockMarkOnRange: <T extends {} = object>(markType: MarkType, getAttrs: (prevAttrs?: T | undefined, node?: PMNode) => false | T | undefined, allowedBlocks?: NodeType[] | ((schema: Schema, node: PMNode, parent: PMNode | null) => boolean) | undefined) => (from: number, to: number, tr: Transaction, state: EditorState) => boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Toggles block mark based on the return type of `getAttrs`.
|
|
11
|
-
* This is similar to ProseMirror's `getAttrs` from `AttributeSpec`
|
|
12
|
-
* return `false` to remove the mark.
|
|
13
|
-
* return `undefined for no-op.
|
|
14
|
-
* return an `object` to update the mark.
|
|
15
|
-
*/
|
|
16
|
-
export declare const toggleBlockMark: <T extends {} = object>(markType: MarkType, getAttrs: (prevAttrs?: T | undefined, node?: PMNode) => false | T | undefined, allowedBlocks?: NodeType[] | ((schema: Schema, node: PMNode, parent: PMNode | null) => boolean) | undefined) => Command;
|
|
17
|
-
export declare const clearEditorContent: Command;
|
|
1
|
+
export { addParagraphAtEnd, createParagraphAtEnd, changeImageAlignment, createToggleBlockMarkOnRange, toggleBlockMark, clearEditorContent, } from '@atlaskit/editor-common/commands';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { Command } from '../../../types';
|
|
3
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
export declare const selectCaptionFromMediaSinglePos: (mediaSingleNodePos: number, mediaSingleNode: PMNode) => Command;
|
|
4
|
-
export declare const insertAndSelectCaptionFromMediaSinglePos: (mediaSingleNodePos: number | undefined, mediaSingleNode: PMNode) => Command;
|
|
5
|
+
export declare const insertAndSelectCaptionFromMediaSinglePos: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (mediaSingleNodePos: number | undefined, mediaSingleNode: PMNode) => Command;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
2
|
import type { CommandDispatch } from '../../../types/command';
|
|
3
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import type { INPUT_METHOD } from '../../analytics';
|
|
5
4
|
import type { Command } from '../../../types';
|
|
5
|
+
import type { INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
export declare const showLinkingToolbar: import("@atlaskit/editor-common/types").Command;
|
|
7
7
|
export declare const showLinkingToolbarWithMediaTypeCheck: Command;
|
|
8
8
|
export declare const hideLinkingToolbar: (state: EditorState, dispatch?: CommandDispatch, view?: EditorView, focusFloatingToolbar?: boolean) => void;
|
|
9
|
-
export declare const unlink: import("@atlaskit/editor-common/types").Command;
|
|
10
|
-
export declare const setUrlToMedia: (url: string, inputMethod: INPUT_METHOD.TYPEAHEAD | INPUT_METHOD.MANUAL) => import("@atlaskit/editor-common/types").Command;
|
|
9
|
+
export declare const unlink: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
10
|
+
export declare const setUrlToMedia: (url: string, inputMethod: INPUT_METHOD.TYPEAHEAD | INPUT_METHOD.MANUAL, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import type { MediaOptions } from '../types';
|
|
3
|
-
|
|
3
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
export declare function keymapPlugin(options?: MediaOptions, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined): SafePlugin;
|
|
4
5
|
export default keymapPlugin;
|
|
@@ -65,7 +65,7 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
|
|
|
65
65
|
*
|
|
66
66
|
* called when we insert a new file via the picker (connected via pickerfacade)
|
|
67
67
|
*/
|
|
68
|
-
insertFile: (mediaState: MediaState, onMediaStateChanged: MediaStateEventSubscriber, pickerType?: string) => void;
|
|
68
|
+
insertFile: (mediaState: MediaState, onMediaStateChanged: MediaStateEventSubscriber, pickerType?: string, pluginInjectionApi?: ExtractInjectionAPI<typeof mediaPlugin> | undefined) => void;
|
|
69
69
|
addPendingTask: (task: Promise<any>) => void;
|
|
70
70
|
splitMediaGroup: () => boolean;
|
|
71
71
|
onPopupPickerClose: () => void;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { BorderMarkAttributes } from '@atlaskit/adf-schema';
|
|
2
2
|
import type { Command } from '../../../types';
|
|
3
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
export declare const DEFAULT_BORDER_COLOR = "#091e4224";
|
|
4
5
|
export declare const DEFAULT_BORDER_SIZE = 2;
|
|
5
|
-
export declare const changeInlineToMediaCard: Command;
|
|
6
|
-
export declare const changeMediaCardToInline: Command;
|
|
6
|
+
export declare const changeInlineToMediaCard: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => Command;
|
|
7
|
+
export declare const changeMediaCardToInline: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => Command;
|
|
7
8
|
export declare const removeInlineCard: Command;
|
|
8
|
-
export declare const toggleBorderMark: Command;
|
|
9
|
-
export declare const setBorderMark: (attrs: Partial<BorderMarkAttributes>) => Command;
|
|
9
|
+
export declare const toggleBorderMark: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => Command;
|
|
10
|
+
export declare const setBorderMark: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => (attrs: Partial<BorderMarkAttributes>) => Command;
|
|
@@ -2,6 +2,7 @@ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import type { MediaState } from '../types';
|
|
4
4
|
import type { InputMethodInsertMedia } from '@atlaskit/editor-common/analytics';
|
|
5
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
5
6
|
export interface Range {
|
|
6
7
|
start: number;
|
|
7
8
|
end: number;
|
|
@@ -13,7 +14,7 @@ export declare const canInsertMediaInline: (state: EditorState) => boolean;
|
|
|
13
14
|
* @param mediaState Media file to be added to the editor
|
|
14
15
|
* @param collection Collection for the media to be added
|
|
15
16
|
*/
|
|
16
|
-
export declare const insertMediaInlineNode: (view: EditorView, mediaState: MediaState, collection: string, inputMethod?: InputMethodInsertMedia) => boolean;
|
|
17
|
+
export declare const insertMediaInlineNode: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaState: MediaState, collection: string, inputMethod?: InputMethodInsertMedia) => boolean;
|
|
17
18
|
/**
|
|
18
19
|
* Insert a media into an existing media group
|
|
19
20
|
* or create a new media group to insert the new media.
|
|
@@ -21,7 +22,7 @@ export declare const insertMediaInlineNode: (view: EditorView, mediaState: Media
|
|
|
21
22
|
* @param mediaStates Media files to be added to the editor
|
|
22
23
|
* @param collection Collection for the media to be added
|
|
23
24
|
*/
|
|
24
|
-
export declare const insertMediaGroupNode: (view: EditorView, mediaStates: MediaState[], collection: string, inputMethod?: InputMethodInsertMedia) => void;
|
|
25
|
+
export declare const insertMediaGroupNode: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaStates: MediaState[], collection: string, inputMethod?: InputMethodInsertMedia) => void;
|
|
25
26
|
/**
|
|
26
27
|
* Return position of media to be inserted, if it is inside a list
|
|
27
28
|
* @param content Content to be inserted
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import type { AlignmentState } from '../plugins/alignment/pm-plugins/types';
|
|
4
|
-
import type { Command } from '../types';
|
|
5
|
-
export declare function addParagraphAtEnd(tr: Transaction): void;
|
|
6
|
-
export declare function createParagraphAtEnd(): Command;
|
|
7
|
-
export declare const changeImageAlignment: (align?: AlignmentState) => Command;
|
|
8
|
-
export declare const createToggleBlockMarkOnRange: <T extends {} = object>(markType: MarkType, getAttrs: (prevAttrs?: T | undefined, node?: PMNode) => false | T | undefined, allowedBlocks?: NodeType[] | ((schema: Schema, node: PMNode, parent: PMNode | null) => boolean) | undefined) => (from: number, to: number, tr: Transaction, state: EditorState) => boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Toggles block mark based on the return type of `getAttrs`.
|
|
11
|
-
* This is similar to ProseMirror's `getAttrs` from `AttributeSpec`
|
|
12
|
-
* return `false` to remove the mark.
|
|
13
|
-
* return `undefined for no-op.
|
|
14
|
-
* return an `object` to update the mark.
|
|
15
|
-
*/
|
|
16
|
-
export declare const toggleBlockMark: <T extends {} = object>(markType: MarkType, getAttrs: (prevAttrs?: T | undefined, node?: PMNode) => false | T | undefined, allowedBlocks?: NodeType[] | ((schema: Schema, node: PMNode, parent: PMNode | null) => boolean) | undefined) => Command;
|
|
17
|
-
export declare const clearEditorContent: Command;
|
|
1
|
+
export { addParagraphAtEnd, createParagraphAtEnd, changeImageAlignment, createToggleBlockMarkOnRange, toggleBlockMark, clearEditorContent, } from '@atlaskit/editor-common/commands';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { Command } from '../../../types';
|
|
3
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
export declare const selectCaptionFromMediaSinglePos: (mediaSingleNodePos: number, mediaSingleNode: PMNode) => Command;
|
|
4
|
-
export declare const insertAndSelectCaptionFromMediaSinglePos: (mediaSingleNodePos: number | undefined, mediaSingleNode: PMNode) => Command;
|
|
5
|
+
export declare const insertAndSelectCaptionFromMediaSinglePos: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (mediaSingleNodePos: number | undefined, mediaSingleNode: PMNode) => Command;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
2
|
import type { CommandDispatch } from '../../../types/command';
|
|
3
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import type { INPUT_METHOD } from '../../analytics';
|
|
5
4
|
import type { Command } from '../../../types';
|
|
5
|
+
import type { INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
export declare const showLinkingToolbar: import("@atlaskit/editor-common/types").Command;
|
|
7
7
|
export declare const showLinkingToolbarWithMediaTypeCheck: Command;
|
|
8
8
|
export declare const hideLinkingToolbar: (state: EditorState, dispatch?: CommandDispatch, view?: EditorView, focusFloatingToolbar?: boolean) => void;
|
|
9
|
-
export declare const unlink: import("@atlaskit/editor-common/types").Command;
|
|
10
|
-
export declare const setUrlToMedia: (url: string, inputMethod: INPUT_METHOD.TYPEAHEAD | INPUT_METHOD.MANUAL) => import("@atlaskit/editor-common/types").Command;
|
|
9
|
+
export declare const unlink: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
10
|
+
export declare const setUrlToMedia: (url: string, inputMethod: INPUT_METHOD.TYPEAHEAD | INPUT_METHOD.MANUAL, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import type { MediaOptions } from '../types';
|
|
3
|
-
|
|
3
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
export declare function keymapPlugin(options?: MediaOptions, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined): SafePlugin;
|
|
4
5
|
export default keymapPlugin;
|
|
@@ -65,7 +65,7 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
|
|
|
65
65
|
*
|
|
66
66
|
* called when we insert a new file via the picker (connected via pickerfacade)
|
|
67
67
|
*/
|
|
68
|
-
insertFile: (mediaState: MediaState, onMediaStateChanged: MediaStateEventSubscriber, pickerType?: string) => void;
|
|
68
|
+
insertFile: (mediaState: MediaState, onMediaStateChanged: MediaStateEventSubscriber, pickerType?: string, pluginInjectionApi?: ExtractInjectionAPI<typeof mediaPlugin> | undefined) => void;
|
|
69
69
|
addPendingTask: (task: Promise<any>) => void;
|
|
70
70
|
splitMediaGroup: () => boolean;
|
|
71
71
|
onPopupPickerClose: () => void;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { BorderMarkAttributes } from '@atlaskit/adf-schema';
|
|
2
2
|
import type { Command } from '../../../types';
|
|
3
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
export declare const DEFAULT_BORDER_COLOR = "#091e4224";
|
|
4
5
|
export declare const DEFAULT_BORDER_SIZE = 2;
|
|
5
|
-
export declare const changeInlineToMediaCard: Command;
|
|
6
|
-
export declare const changeMediaCardToInline: Command;
|
|
6
|
+
export declare const changeInlineToMediaCard: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => Command;
|
|
7
|
+
export declare const changeMediaCardToInline: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => Command;
|
|
7
8
|
export declare const removeInlineCard: Command;
|
|
8
|
-
export declare const toggleBorderMark: Command;
|
|
9
|
-
export declare const setBorderMark: (attrs: Partial<BorderMarkAttributes>) => Command;
|
|
9
|
+
export declare const toggleBorderMark: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => Command;
|
|
10
|
+
export declare const setBorderMark: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => (attrs: Partial<BorderMarkAttributes>) => Command;
|
|
@@ -2,6 +2,7 @@ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import type { MediaState } from '../types';
|
|
4
4
|
import type { InputMethodInsertMedia } from '@atlaskit/editor-common/analytics';
|
|
5
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
5
6
|
export interface Range {
|
|
6
7
|
start: number;
|
|
7
8
|
end: number;
|
|
@@ -13,7 +14,7 @@ export declare const canInsertMediaInline: (state: EditorState) => boolean;
|
|
|
13
14
|
* @param mediaState Media file to be added to the editor
|
|
14
15
|
* @param collection Collection for the media to be added
|
|
15
16
|
*/
|
|
16
|
-
export declare const insertMediaInlineNode: (view: EditorView, mediaState: MediaState, collection: string, inputMethod?: InputMethodInsertMedia) => boolean;
|
|
17
|
+
export declare const insertMediaInlineNode: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaState: MediaState, collection: string, inputMethod?: InputMethodInsertMedia) => boolean;
|
|
17
18
|
/**
|
|
18
19
|
* Insert a media into an existing media group
|
|
19
20
|
* or create a new media group to insert the new media.
|
|
@@ -21,7 +22,7 @@ export declare const insertMediaInlineNode: (view: EditorView, mediaState: Media
|
|
|
21
22
|
* @param mediaStates Media files to be added to the editor
|
|
22
23
|
* @param collection Collection for the media to be added
|
|
23
24
|
*/
|
|
24
|
-
export declare const insertMediaGroupNode: (view: EditorView, mediaStates: MediaState[], collection: string, inputMethod?: InputMethodInsertMedia) => void;
|
|
25
|
+
export declare const insertMediaGroupNode: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaStates: MediaState[], collection: string, inputMethod?: InputMethodInsertMedia) => void;
|
|
25
26
|
/**
|
|
26
27
|
* Return position of media to be inserted, if it is inside a list
|
|
27
28
|
* @param content Content to be inserted
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "187.14.
|
|
3
|
+
"version": "187.14.11",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@atlaskit/code": "^14.6.0",
|
|
56
56
|
"@atlaskit/date": "^0.10.0",
|
|
57
57
|
"@atlaskit/datetime-picker": "^12.7.0",
|
|
58
|
-
"@atlaskit/editor-common": "^74.
|
|
58
|
+
"@atlaskit/editor-common": "^74.40.0",
|
|
59
59
|
"@atlaskit/editor-json-transformer": "^8.10.0",
|
|
60
60
|
"@atlaskit/editor-markdown-transformer": "^5.2.5",
|
|
61
61
|
"@atlaskit/editor-palette": "1.5.1",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@atlaskit/editor-plugin-grid": "^0.1.0",
|
|
71
71
|
"@atlaskit/editor-plugin-guideline": "^0.3.4",
|
|
72
72
|
"@atlaskit/editor-plugin-hyperlink": "^0.3.0",
|
|
73
|
-
"@atlaskit/editor-plugin-table": "^2.
|
|
73
|
+
"@atlaskit/editor-plugin-table": "^2.7.0",
|
|
74
74
|
"@atlaskit/editor-plugin-width": "^0.1.0",
|
|
75
75
|
"@atlaskit/editor-prosemirror": "1.0.2",
|
|
76
76
|
"@atlaskit/editor-shared-styles": "^2.6.0",
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
"@atlaskit/collab-provider": "9.9.0",
|
|
144
144
|
"@atlaskit/dropdown-menu": "^11.11.0",
|
|
145
145
|
"@atlaskit/editor-extension-dropbox": "^0.4.0",
|
|
146
|
-
"@atlaskit/editor-plugin-table": "^2.
|
|
146
|
+
"@atlaskit/editor-plugin-table": "^2.7.0",
|
|
147
147
|
"@atlaskit/editor-test-helpers": "^18.10.0",
|
|
148
148
|
"@atlaskit/flag": "^15.2.0",
|
|
149
149
|
"@atlaskit/icon-object": "^6.3.0",
|
package/report.api.md
CHANGED
|
@@ -32,6 +32,7 @@ import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
|
32
32
|
import { BrowserFreezetracking } from '@atlaskit/editor-common/types';
|
|
33
33
|
import { CardOptions } from '@atlaskit/editor-common/card';
|
|
34
34
|
import { CardProvider } from '@atlaskit/editor-common/provider-factory';
|
|
35
|
+
import { clearEditorContent } from '@atlaskit/editor-common/commands';
|
|
35
36
|
import type { CollabEditOptions } from '@atlaskit/editor-common/collab';
|
|
36
37
|
import { Color } from '@atlaskit/status/element';
|
|
37
38
|
import { Command as Command_2 } from '@atlaskit/editor-common/types';
|
|
@@ -340,8 +341,7 @@ interface CellSelectionData {
|
|
|
340
341
|
// @public (undocumented)
|
|
341
342
|
export const changeColor: (color: string) => Command;
|
|
342
343
|
|
|
343
|
-
|
|
344
|
-
export const clearEditorContent: Command;
|
|
344
|
+
export { clearEditorContent };
|
|
345
345
|
|
|
346
346
|
// @public (undocumented)
|
|
347
347
|
type CloseOptions = {
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
|
21
21
|
import { BrowserFreezetracking } from '@atlaskit/editor-common/types';
|
|
22
22
|
import { CardOptions } from '@atlaskit/editor-common/card';
|
|
23
23
|
import { CardProvider } from '@atlaskit/editor-common/provider-factory';
|
|
24
|
+
import { clearEditorContent } from '@atlaskit/editor-common/commands';
|
|
24
25
|
import type { CollabEditOptions } from '@atlaskit/editor-common/collab';
|
|
25
26
|
import { Color } from '@atlaskit/status/element';
|
|
26
27
|
import { Command as Command_2 } from '@atlaskit/editor-common/types';
|
|
@@ -323,8 +324,7 @@ interface CellSelectionData {
|
|
|
323
324
|
// @public (undocumented)
|
|
324
325
|
export const changeColor: (color: string) => Command;
|
|
325
326
|
|
|
326
|
-
|
|
327
|
-
export const clearEditorContent: Command;
|
|
327
|
+
export { clearEditorContent }
|
|
328
328
|
|
|
329
329
|
// @public (undocumented)
|
|
330
330
|
type CloseOptions = {
|