@atlaskit/editor-core 187.17.1 → 187.17.3
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/labs/next/presets/default.js +2 -1
- package/dist/cjs/plugins/base/index.js +5 -12
- package/dist/cjs/plugins/media/index.js +3 -2
- package/dist/cjs/plugins/media/next-plugin-type.js +5 -0
- package/dist/cjs/plugins/media/ui/MediaPicker/index.js +35 -26
- package/dist/cjs/plugins/placeholder/index.js +10 -9
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/labs/next/presets/default.js +2 -1
- package/dist/es2019/plugins/base/index.js +0 -6
- package/dist/es2019/plugins/media/index.js +3 -2
- package/dist/es2019/plugins/media/next-plugin-type.js +1 -0
- package/dist/es2019/plugins/media/ui/MediaPicker/index.js +37 -26
- package/dist/es2019/plugins/placeholder/index.js +13 -11
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/labs/next/presets/default.js +2 -1
- package/dist/esm/plugins/base/index.js +5 -12
- package/dist/esm/plugins/media/index.js +3 -2
- package/dist/esm/plugins/media/next-plugin-type.js +1 -0
- package/dist/esm/plugins/media/ui/MediaPicker/index.js +35 -26
- package/dist/esm/plugins/placeholder/index.js +11 -11
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/media/index.d.ts +3 -26
- package/dist/types/plugins/media/next-plugin-type.d.ts +27 -0
- package/dist/types/plugins/media/ui/MediaPicker/index.d.ts +4 -2
- package/dist/types/plugins/placeholder/index.d.ts +4 -2
- package/dist/types-ts4.5/plugins/media/index.d.ts +3 -26
- package/dist/types-ts4.5/plugins/media/next-plugin-type.d.ts +27 -0
- package/dist/types-ts4.5/plugins/media/ui/MediaPicker/index.d.ts +4 -2
- package/dist/types-ts4.5/plugins/placeholder/index.d.ts +6 -2
- package/package.json +3 -2
- package/report.api.md +23 -18
- package/tmp/api-report-tmp.d.ts +20 -15
- package/dist/cjs/plugins/base/pm-plugins/focus-handler.js +0 -56
- package/dist/es2019/plugins/base/pm-plugins/focus-handler.js +0 -44
- package/dist/esm/plugins/base/pm-plugins/focus-handler.js +0 -48
- package/dist/types/plugins/base/pm-plugins/focus-handler.d.ts +0 -6
- package/dist/types-ts4.5/plugins/base/pm-plugins/focus-handler.d.ts +0 -6
|
@@ -11,8 +11,33 @@ import React from 'react';
|
|
|
11
11
|
import { ClipboardWrapper } from './ClipboardWrapper';
|
|
12
12
|
import { DropzoneWrapper } from './DropzoneWrapper';
|
|
13
13
|
import { BrowserWrapper } from './BrowserWrapper';
|
|
14
|
-
import
|
|
15
|
-
|
|
14
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
15
|
+
var MediaPicker = function MediaPicker(_ref) {
|
|
16
|
+
var api = _ref.api,
|
|
17
|
+
isPopupOpened = _ref.isPopupOpened,
|
|
18
|
+
appearance = _ref.appearance,
|
|
19
|
+
mediaState = _ref.mediaState,
|
|
20
|
+
onBrowseFn = _ref.onBrowseFn,
|
|
21
|
+
editorDomElement = _ref.editorDomElement;
|
|
22
|
+
var _useSharedPluginState = useSharedPluginState(api, ['focus']),
|
|
23
|
+
focusState = _useSharedPluginState.focusState;
|
|
24
|
+
var featureFlags = mediaState.mediaOptions && mediaState.mediaOptions.featureFlags;
|
|
25
|
+
var clipboard = focusState !== null && focusState !== void 0 && focusState.hasFocus ? /*#__PURE__*/React.createElement(ClipboardWrapper, {
|
|
26
|
+
mediaState: mediaState,
|
|
27
|
+
featureFlags: featureFlags
|
|
28
|
+
}) : null;
|
|
29
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, clipboard, /*#__PURE__*/React.createElement(DropzoneWrapper, {
|
|
30
|
+
mediaState: mediaState,
|
|
31
|
+
isActive: !isPopupOpened,
|
|
32
|
+
featureFlags: featureFlags,
|
|
33
|
+
editorDomElement: editorDomElement,
|
|
34
|
+
appearance: appearance
|
|
35
|
+
}), /*#__PURE__*/React.createElement(BrowserWrapper, {
|
|
36
|
+
onBrowseFn: onBrowseFn,
|
|
37
|
+
mediaState: mediaState,
|
|
38
|
+
featureFlags: featureFlags
|
|
39
|
+
}));
|
|
40
|
+
};
|
|
16
41
|
export var MediaPickerComponents = /*#__PURE__*/function (_React$Component) {
|
|
17
42
|
_inherits(MediaPickerComponents, _React$Component);
|
|
18
43
|
var _super = _createSuper(MediaPickerComponents);
|
|
@@ -46,35 +71,19 @@ export var MediaPickerComponents = /*#__PURE__*/function (_React$Component) {
|
|
|
46
71
|
}, {
|
|
47
72
|
key: "render",
|
|
48
73
|
value: function render() {
|
|
49
|
-
var _this3 = this;
|
|
50
74
|
var _this$props = this.props,
|
|
75
|
+
api = _this$props.api,
|
|
51
76
|
mediaState = _this$props.mediaState,
|
|
52
77
|
editorDomElement = _this$props.editorDomElement,
|
|
53
78
|
appearance = _this$props.appearance;
|
|
54
79
|
var isPopupOpened = this.state.isPopupOpened;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
var clipboard = focus ? /*#__PURE__*/React.createElement(ClipboardWrapper, {
|
|
63
|
-
mediaState: mediaState,
|
|
64
|
-
featureFlags: featureFlags
|
|
65
|
-
}) : null;
|
|
66
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, clipboard, /*#__PURE__*/React.createElement(DropzoneWrapper, {
|
|
67
|
-
mediaState: mediaState,
|
|
68
|
-
isActive: !isPopupOpened,
|
|
69
|
-
featureFlags: featureFlags,
|
|
70
|
-
editorDomElement: editorDomElement,
|
|
71
|
-
appearance: appearance
|
|
72
|
-
}), /*#__PURE__*/React.createElement(BrowserWrapper, {
|
|
73
|
-
onBrowseFn: _this3.onBrowseFn,
|
|
74
|
-
mediaState: mediaState,
|
|
75
|
-
featureFlags: featureFlags
|
|
76
|
-
}));
|
|
77
|
-
}
|
|
80
|
+
return /*#__PURE__*/React.createElement(MediaPicker, {
|
|
81
|
+
mediaState: mediaState,
|
|
82
|
+
editorDomElement: editorDomElement,
|
|
83
|
+
appearance: appearance,
|
|
84
|
+
isPopupOpened: isPopupOpened,
|
|
85
|
+
onBrowseFn: this.onBrowseFn,
|
|
86
|
+
api: api
|
|
78
87
|
});
|
|
79
88
|
}
|
|
80
89
|
}]);
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { browser } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { browser, isEmptyDocument, bracketTyped } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { DecorationSet, Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import { isEmptyDocument, bracketTyped } from '@atlaskit/editor-common/utils';
|
|
6
5
|
export var pluginKey = new PluginKey('placeholderPlugin');
|
|
7
|
-
import { focusStateKey } from '../base/pm-plugins/focus-handler';
|
|
8
6
|
import { isTypeAheadOpen } from '../type-ahead/utils';
|
|
9
7
|
import { isComposing } from '../base/pm-plugins/composition';
|
|
10
8
|
function getPlaceholderState(editorState) {
|
|
@@ -53,8 +51,7 @@ function setPlaceHolderState(placeholderText, pos) {
|
|
|
53
51
|
var emptyPlaceholder = {
|
|
54
52
|
hasPlaceholder: false
|
|
55
53
|
};
|
|
56
|
-
function createPlaceHolderStateFrom(editorState, defaultPlaceholderText, bracketPlaceholderText) {
|
|
57
|
-
var isEditorFocused = focusStateKey.getState(editorState);
|
|
54
|
+
function createPlaceHolderStateFrom(isEditorFocused, editorState, defaultPlaceholderText, bracketPlaceholderText) {
|
|
58
55
|
if (isTypeAheadOpen(editorState)) {
|
|
59
56
|
return emptyPlaceholder;
|
|
60
57
|
}
|
|
@@ -69,7 +66,7 @@ function createPlaceHolderStateFrom(editorState, defaultPlaceholderText, bracket
|
|
|
69
66
|
}
|
|
70
67
|
return emptyPlaceholder;
|
|
71
68
|
}
|
|
72
|
-
export function createPlugin(defaultPlaceholderText, bracketPlaceholderText) {
|
|
69
|
+
export function createPlugin(defaultPlaceholderText, bracketPlaceholderText, api) {
|
|
73
70
|
if (!defaultPlaceholderText && !bracketPlaceholderText) {
|
|
74
71
|
return;
|
|
75
72
|
}
|
|
@@ -77,19 +74,22 @@ export function createPlugin(defaultPlaceholderText, bracketPlaceholderText) {
|
|
|
77
74
|
key: pluginKey,
|
|
78
75
|
state: {
|
|
79
76
|
init: function init(_, state) {
|
|
80
|
-
|
|
77
|
+
var _api$dependencies$foc;
|
|
78
|
+
return createPlaceHolderStateFrom(Boolean(api === null || api === void 0 ? void 0 : (_api$dependencies$foc = api.dependencies.focus.sharedState.currentState()) === null || _api$dependencies$foc === void 0 ? void 0 : _api$dependencies$foc.hasFocus), state, defaultPlaceholderText, bracketPlaceholderText);
|
|
81
79
|
},
|
|
82
80
|
apply: function apply(tr, _oldPluginState, _oldEditorState, newEditorState) {
|
|
81
|
+
var _api$dependencies$foc2;
|
|
83
82
|
var meta = tr.getMeta(pluginKey);
|
|
83
|
+
var isEditorFocused = Boolean(api === null || api === void 0 ? void 0 : (_api$dependencies$foc2 = api.dependencies.focus.sharedState.currentState()) === null || _api$dependencies$foc2 === void 0 ? void 0 : _api$dependencies$foc2.hasFocus);
|
|
84
84
|
if (meta) {
|
|
85
85
|
if (meta.removePlaceholder) {
|
|
86
86
|
return emptyPlaceholder;
|
|
87
87
|
}
|
|
88
88
|
if (meta.applyPlaceholderIfEmpty) {
|
|
89
|
-
return createPlaceHolderStateFrom(newEditorState, defaultPlaceholderText, bracketPlaceholderText);
|
|
89
|
+
return createPlaceHolderStateFrom(isEditorFocused, newEditorState, defaultPlaceholderText, bracketPlaceholderText);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
return createPlaceHolderStateFrom(newEditorState, defaultPlaceholderText, bracketPlaceholderText);
|
|
92
|
+
return createPlaceHolderStateFrom(isEditorFocused, newEditorState, defaultPlaceholderText, bracketPlaceholderText);
|
|
93
93
|
}
|
|
94
94
|
},
|
|
95
95
|
props: {
|
|
@@ -106,14 +106,14 @@ export function createPlugin(defaultPlaceholderText, bracketPlaceholderText) {
|
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
|
-
var placeholderPlugin = function placeholderPlugin(options) {
|
|
109
|
+
var placeholderPlugin = function placeholderPlugin(options, api) {
|
|
110
110
|
return {
|
|
111
111
|
name: 'placeholder',
|
|
112
112
|
pmPlugins: function pmPlugins() {
|
|
113
113
|
return [{
|
|
114
114
|
name: 'placeholder',
|
|
115
115
|
plugin: function plugin() {
|
|
116
|
-
return createPlugin(options && options.placeholder, options && options.placeholderBracketHint);
|
|
116
|
+
return createPlugin(options && options.placeholder, options && options.placeholderBracketHint, api);
|
|
117
117
|
}
|
|
118
118
|
}];
|
|
119
119
|
}
|
package/dist/esm/version.json
CHANGED
|
@@ -1,31 +1,8 @@
|
|
|
1
1
|
import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
|
|
2
|
-
import type { NextEditorPlugin } from '../../types';
|
|
3
|
-
import type { OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
4
2
|
import type { MediaState } from './pm-plugins/main';
|
|
5
|
-
import type { CustomMediaPicker
|
|
6
|
-
import type {
|
|
7
|
-
import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
8
|
-
import type { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
9
|
-
import type { gridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
10
|
-
import type { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
11
|
-
import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
12
|
-
import type { MediaPluginState } from './pm-plugins/types';
|
|
13
|
-
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
14
|
-
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
3
|
+
import type { CustomMediaPicker } from './types';
|
|
4
|
+
import type { MediaNextEditorPluginType } from './next-plugin-type';
|
|
15
5
|
export type { MediaState, MediaProvider, CustomMediaPicker };
|
|
16
6
|
export { insertMediaSingleNode } from './utils/media-single';
|
|
17
|
-
declare const mediaPlugin:
|
|
18
|
-
pluginConfiguration: MediaOptions | undefined;
|
|
19
|
-
dependencies: [
|
|
20
|
-
typeof featureFlagsPlugin,
|
|
21
|
-
OptionalPlugin<typeof analyticsPlugin>,
|
|
22
|
-
typeof guidelinePlugin,
|
|
23
|
-
typeof gridPlugin,
|
|
24
|
-
typeof widthPlugin,
|
|
25
|
-
typeof decorationsPlugin,
|
|
26
|
-
FloatingToolbarPlugin,
|
|
27
|
-
EditorDisabledPlugin
|
|
28
|
-
];
|
|
29
|
-
sharedState: MediaPluginState | null;
|
|
30
|
-
}>;
|
|
7
|
+
declare const mediaPlugin: MediaNextEditorPluginType;
|
|
31
8
|
export default mediaPlugin;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
2
|
+
import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
3
|
+
import type { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
4
|
+
import type { gridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
5
|
+
import type { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
6
|
+
import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
7
|
+
import type { MediaPluginState } from './pm-plugins/types';
|
|
8
|
+
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
9
|
+
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
10
|
+
import type { FocusPlugin } from '@atlaskit/editor-plugin-focus';
|
|
11
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
12
|
+
import type { MediaOptions } from './types';
|
|
13
|
+
export type MediaNextEditorPluginType = NextEditorPlugin<'media', {
|
|
14
|
+
pluginConfiguration: MediaOptions | undefined;
|
|
15
|
+
dependencies: [
|
|
16
|
+
typeof featureFlagsPlugin,
|
|
17
|
+
OptionalPlugin<typeof analyticsPlugin>,
|
|
18
|
+
typeof guidelinePlugin,
|
|
19
|
+
typeof gridPlugin,
|
|
20
|
+
typeof widthPlugin,
|
|
21
|
+
typeof decorationsPlugin,
|
|
22
|
+
FloatingToolbarPlugin,
|
|
23
|
+
EditorDisabledPlugin,
|
|
24
|
+
FocusPlugin
|
|
25
|
+
];
|
|
26
|
+
sharedState: MediaPluginState | null;
|
|
27
|
+
}>;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { MediaPluginState } from '../../pm-plugins/types';
|
|
3
|
-
import { EditorAppearance } from '
|
|
2
|
+
import type { MediaPluginState } from '../../pm-plugins/types';
|
|
3
|
+
import type { EditorAppearance, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { MediaNextEditorPluginType } from '../../next-plugin-type';
|
|
4
5
|
type Props = {
|
|
5
6
|
mediaState: MediaPluginState;
|
|
6
7
|
editorDomElement: Element;
|
|
7
8
|
appearance: EditorAppearance;
|
|
9
|
+
api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
|
|
8
10
|
};
|
|
9
11
|
type State = {
|
|
10
12
|
isPopupOpened: boolean;
|
|
@@ -2,16 +2,18 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { NextEditorPlugin, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
6
|
+
import type { focusPlugin } from '@atlaskit/editor-plugin-focus';
|
|
6
7
|
export declare const pluginKey: PluginKey<any>;
|
|
7
8
|
export declare const placeholderTestId = "placeholder-test-id";
|
|
8
9
|
export declare function createPlaceholderDecoration(editorState: EditorState, placeholderText: string, pos?: number): DecorationSet;
|
|
9
|
-
export declare function createPlugin(defaultPlaceholderText?: string, bracketPlaceholderText?: string): SafePlugin | undefined;
|
|
10
|
+
export declare function createPlugin(defaultPlaceholderText?: string, bracketPlaceholderText?: string, api?: ExtractInjectionAPI<typeof placeholderPlugin>): SafePlugin | undefined;
|
|
10
11
|
export interface PlaceholderPluginOptions {
|
|
11
12
|
placeholder?: string;
|
|
12
13
|
placeholderBracketHint?: string;
|
|
13
14
|
}
|
|
14
15
|
declare const placeholderPlugin: NextEditorPlugin<'placeholder', {
|
|
15
16
|
pluginConfiguration: PlaceholderPluginOptions | undefined;
|
|
17
|
+
dependencies: [typeof focusPlugin];
|
|
16
18
|
}>;
|
|
17
19
|
export default placeholderPlugin;
|
|
@@ -1,31 +1,8 @@
|
|
|
1
1
|
import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
|
|
2
|
-
import type { NextEditorPlugin } from '../../types';
|
|
3
|
-
import type { OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
4
2
|
import type { MediaState } from './pm-plugins/main';
|
|
5
|
-
import type { CustomMediaPicker
|
|
6
|
-
import type {
|
|
7
|
-
import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
8
|
-
import type { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
9
|
-
import type { gridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
10
|
-
import type { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
11
|
-
import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
12
|
-
import type { MediaPluginState } from './pm-plugins/types';
|
|
13
|
-
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
14
|
-
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
3
|
+
import type { CustomMediaPicker } from './types';
|
|
4
|
+
import type { MediaNextEditorPluginType } from './next-plugin-type';
|
|
15
5
|
export type { MediaState, MediaProvider, CustomMediaPicker };
|
|
16
6
|
export { insertMediaSingleNode } from './utils/media-single';
|
|
17
|
-
declare const mediaPlugin:
|
|
18
|
-
pluginConfiguration: MediaOptions | undefined;
|
|
19
|
-
dependencies: [
|
|
20
|
-
typeof featureFlagsPlugin,
|
|
21
|
-
OptionalPlugin<typeof analyticsPlugin>,
|
|
22
|
-
typeof guidelinePlugin,
|
|
23
|
-
typeof gridPlugin,
|
|
24
|
-
typeof widthPlugin,
|
|
25
|
-
typeof decorationsPlugin,
|
|
26
|
-
FloatingToolbarPlugin,
|
|
27
|
-
EditorDisabledPlugin
|
|
28
|
-
];
|
|
29
|
-
sharedState: MediaPluginState | null;
|
|
30
|
-
}>;
|
|
7
|
+
declare const mediaPlugin: MediaNextEditorPluginType;
|
|
31
8
|
export default mediaPlugin;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
2
|
+
import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
3
|
+
import type { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
4
|
+
import type { gridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
5
|
+
import type { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
6
|
+
import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
7
|
+
import type { MediaPluginState } from './pm-plugins/types';
|
|
8
|
+
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
9
|
+
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
10
|
+
import type { FocusPlugin } from '@atlaskit/editor-plugin-focus';
|
|
11
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
12
|
+
import type { MediaOptions } from './types';
|
|
13
|
+
export type MediaNextEditorPluginType = NextEditorPlugin<'media', {
|
|
14
|
+
pluginConfiguration: MediaOptions | undefined;
|
|
15
|
+
dependencies: [
|
|
16
|
+
typeof featureFlagsPlugin,
|
|
17
|
+
OptionalPlugin<typeof analyticsPlugin>,
|
|
18
|
+
typeof guidelinePlugin,
|
|
19
|
+
typeof gridPlugin,
|
|
20
|
+
typeof widthPlugin,
|
|
21
|
+
typeof decorationsPlugin,
|
|
22
|
+
FloatingToolbarPlugin,
|
|
23
|
+
EditorDisabledPlugin,
|
|
24
|
+
FocusPlugin
|
|
25
|
+
];
|
|
26
|
+
sharedState: MediaPluginState | null;
|
|
27
|
+
}>;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { MediaPluginState } from '../../pm-plugins/types';
|
|
3
|
-
import { EditorAppearance } from '
|
|
2
|
+
import type { MediaPluginState } from '../../pm-plugins/types';
|
|
3
|
+
import type { EditorAppearance, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { MediaNextEditorPluginType } from '../../next-plugin-type';
|
|
4
5
|
type Props = {
|
|
5
6
|
mediaState: MediaPluginState;
|
|
6
7
|
editorDomElement: Element;
|
|
7
8
|
appearance: EditorAppearance;
|
|
9
|
+
api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
|
|
8
10
|
};
|
|
9
11
|
type State = {
|
|
10
12
|
isPopupOpened: boolean;
|
|
@@ -2,16 +2,20 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { NextEditorPlugin, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
6
|
+
import type { focusPlugin } from '@atlaskit/editor-plugin-focus';
|
|
6
7
|
export declare const pluginKey: PluginKey<any>;
|
|
7
8
|
export declare const placeholderTestId = "placeholder-test-id";
|
|
8
9
|
export declare function createPlaceholderDecoration(editorState: EditorState, placeholderText: string, pos?: number): DecorationSet;
|
|
9
|
-
export declare function createPlugin(defaultPlaceholderText?: string, bracketPlaceholderText?: string): SafePlugin | undefined;
|
|
10
|
+
export declare function createPlugin(defaultPlaceholderText?: string, bracketPlaceholderText?: string, api?: ExtractInjectionAPI<typeof placeholderPlugin>): SafePlugin | undefined;
|
|
10
11
|
export interface PlaceholderPluginOptions {
|
|
11
12
|
placeholder?: string;
|
|
12
13
|
placeholderBracketHint?: string;
|
|
13
14
|
}
|
|
14
15
|
declare const placeholderPlugin: NextEditorPlugin<'placeholder', {
|
|
15
16
|
pluginConfiguration: PlaceholderPluginOptions | undefined;
|
|
17
|
+
dependencies: [
|
|
18
|
+
typeof focusPlugin
|
|
19
|
+
];
|
|
16
20
|
}>;
|
|
17
21
|
export default placeholderPlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "187.17.
|
|
3
|
+
"version": "187.17.3",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@atlaskit/activity-provider": "^2.4.0",
|
|
43
|
-
"@atlaskit/adf-schema": "^28.
|
|
43
|
+
"@atlaskit/adf-schema": "^28.1.0",
|
|
44
44
|
"@atlaskit/adf-utils": "^19.0.0",
|
|
45
45
|
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
46
46
|
"@atlaskit/analytics-listeners": "^8.7.0",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"@atlaskit/editor-plugin-editor-disabled": "^0.1.0",
|
|
68
68
|
"@atlaskit/editor-plugin-feature-flags": "^0.1.0",
|
|
69
69
|
"@atlaskit/editor-plugin-floating-toolbar": "^0.3.0",
|
|
70
|
+
"@atlaskit/editor-plugin-focus": "^0.1.0",
|
|
70
71
|
"@atlaskit/editor-plugin-grid": "^0.1.0",
|
|
71
72
|
"@atlaskit/editor-plugin-guideline": "^0.3.4",
|
|
72
73
|
"@atlaskit/editor-plugin-hyperlink": "^0.3.0",
|
package/report.api.md
CHANGED
|
@@ -77,6 +77,7 @@ import { FC } from 'react';
|
|
|
77
77
|
import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
78
78
|
import type { FireAnalyticsCallback } from '@atlaskit/editor-common/analytics';
|
|
79
79
|
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
80
|
+
import type { FocusPlugin } from '@atlaskit/editor-plugin-focus';
|
|
80
81
|
import { FULL_WIDTH_MODE } from '@atlaskit/editor-common/analytics';
|
|
81
82
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
82
83
|
import { Side as GapCursorSide } from '@atlaskit/editor-common/selection';
|
|
@@ -109,7 +110,7 @@ import { MentionResource } from '@atlaskit/mention/resource';
|
|
|
109
110
|
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
110
111
|
import type { MessageDescriptor } from 'react-intl-next';
|
|
111
112
|
import { default as messages } from '@atlaskit/editor-common/messages';
|
|
112
|
-
import { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
113
|
+
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
113
114
|
import { Node as Node_2 } from '@atlaskit/editor-prosemirror/model';
|
|
114
115
|
import { NodeConfig } from '@atlaskit/editor-common/types';
|
|
115
116
|
import type { NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -1245,6 +1246,26 @@ export const measurements: {
|
|
|
1245
1246
|
PASTE: string;
|
|
1246
1247
|
};
|
|
1247
1248
|
|
|
1249
|
+
// @public (undocumented)
|
|
1250
|
+
type MediaNextEditorPluginType = NextEditorPlugin<
|
|
1251
|
+
'media',
|
|
1252
|
+
{
|
|
1253
|
+
pluginConfiguration: MediaOptions | undefined;
|
|
1254
|
+
dependencies: [
|
|
1255
|
+
typeof featureFlagsPlugin,
|
|
1256
|
+
OptionalPlugin<typeof analyticsPlugin>,
|
|
1257
|
+
typeof guidelinePlugin,
|
|
1258
|
+
typeof gridPlugin,
|
|
1259
|
+
typeof widthPlugin,
|
|
1260
|
+
typeof decorationsPlugin,
|
|
1261
|
+
FloatingToolbarPlugin,
|
|
1262
|
+
EditorDisabledPlugin,
|
|
1263
|
+
FocusPlugin,
|
|
1264
|
+
];
|
|
1265
|
+
sharedState: MediaPluginState | null;
|
|
1266
|
+
}
|
|
1267
|
+
>;
|
|
1268
|
+
|
|
1248
1269
|
// @public (undocumented)
|
|
1249
1270
|
interface MediaNodeWithPosHandler {
|
|
1250
1271
|
// (undocumented)
|
|
@@ -1314,23 +1335,7 @@ export interface MediaOptions {
|
|
|
1314
1335
|
}
|
|
1315
1336
|
|
|
1316
1337
|
// @public (undocumented)
|
|
1317
|
-
export const mediaPlugin:
|
|
1318
|
-
'media',
|
|
1319
|
-
{
|
|
1320
|
-
pluginConfiguration: MediaOptions | undefined;
|
|
1321
|
-
dependencies: [
|
|
1322
|
-
typeof featureFlagsPlugin,
|
|
1323
|
-
OptionalPlugin<typeof analyticsPlugin>,
|
|
1324
|
-
typeof guidelinePlugin,
|
|
1325
|
-
typeof gridPlugin,
|
|
1326
|
-
typeof widthPlugin,
|
|
1327
|
-
typeof decorationsPlugin,
|
|
1328
|
-
FloatingToolbarPlugin,
|
|
1329
|
-
EditorDisabledPlugin,
|
|
1330
|
-
];
|
|
1331
|
-
sharedState: MediaPluginState | null;
|
|
1332
|
-
}
|
|
1333
|
-
>;
|
|
1338
|
+
export const mediaPlugin: MediaNextEditorPluginType;
|
|
1334
1339
|
|
|
1335
1340
|
// @public (undocumented)
|
|
1336
1341
|
export const mediaPluginKey: PluginKey<MediaPluginState>;
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ import { FC } from 'react';
|
|
|
66
66
|
import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
67
67
|
import type { FireAnalyticsCallback } from '@atlaskit/editor-common/analytics';
|
|
68
68
|
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
69
|
+
import type { FocusPlugin } from '@atlaskit/editor-plugin-focus';
|
|
69
70
|
import { FULL_WIDTH_MODE } from '@atlaskit/editor-common/analytics';
|
|
70
71
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
71
72
|
import { Side as GapCursorSide } from '@atlaskit/editor-common/selection';
|
|
@@ -98,7 +99,7 @@ import { MentionResource } from '@atlaskit/mention/resource';
|
|
|
98
99
|
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
99
100
|
import type { MessageDescriptor } from 'react-intl-next';
|
|
100
101
|
import { default as messages } from '@atlaskit/editor-common/messages';
|
|
101
|
-
import { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
102
|
+
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
102
103
|
import { Node as Node_2 } from '@atlaskit/editor-prosemirror/model';
|
|
103
104
|
import { NodeConfig } from '@atlaskit/editor-common/types';
|
|
104
105
|
import type { NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -1109,6 +1110,23 @@ export const measurements: {
|
|
|
1109
1110
|
PASTE: string;
|
|
1110
1111
|
};
|
|
1111
1112
|
|
|
1113
|
+
// @public (undocumented)
|
|
1114
|
+
type MediaNextEditorPluginType = NextEditorPlugin<'media', {
|
|
1115
|
+
pluginConfiguration: MediaOptions | undefined;
|
|
1116
|
+
dependencies: [
|
|
1117
|
+
typeof featureFlagsPlugin,
|
|
1118
|
+
OptionalPlugin<typeof analyticsPlugin>,
|
|
1119
|
+
typeof guidelinePlugin,
|
|
1120
|
+
typeof gridPlugin,
|
|
1121
|
+
typeof widthPlugin,
|
|
1122
|
+
typeof decorationsPlugin,
|
|
1123
|
+
FloatingToolbarPlugin,
|
|
1124
|
+
EditorDisabledPlugin,
|
|
1125
|
+
FocusPlugin
|
|
1126
|
+
];
|
|
1127
|
+
sharedState: MediaPluginState | null;
|
|
1128
|
+
}>;
|
|
1129
|
+
|
|
1112
1130
|
// @public (undocumented)
|
|
1113
1131
|
interface MediaNodeWithPosHandler {
|
|
1114
1132
|
// (undocumented)
|
|
@@ -1178,20 +1196,7 @@ export interface MediaOptions {
|
|
|
1178
1196
|
}
|
|
1179
1197
|
|
|
1180
1198
|
// @public (undocumented)
|
|
1181
|
-
export const mediaPlugin:
|
|
1182
|
-
pluginConfiguration: MediaOptions | undefined;
|
|
1183
|
-
dependencies: [
|
|
1184
|
-
typeof featureFlagsPlugin,
|
|
1185
|
-
OptionalPlugin<typeof analyticsPlugin>,
|
|
1186
|
-
typeof guidelinePlugin,
|
|
1187
|
-
typeof gridPlugin,
|
|
1188
|
-
typeof widthPlugin,
|
|
1189
|
-
typeof decorationsPlugin,
|
|
1190
|
-
FloatingToolbarPlugin,
|
|
1191
|
-
EditorDisabledPlugin
|
|
1192
|
-
];
|
|
1193
|
-
sharedState: MediaPluginState | null;
|
|
1194
|
-
}>;
|
|
1199
|
+
export const mediaPlugin: MediaNextEditorPluginType;
|
|
1195
1200
|
|
|
1196
1201
|
// @public (undocumented)
|
|
1197
1202
|
export const mediaPluginKey: PluginKey<MediaPluginState>;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.focusStateKey = exports.default = void 0;
|
|
7
|
-
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
|
-
var focusStateKey = new _state.PluginKey('focusStatePlugin');
|
|
10
|
-
exports.focusStateKey = focusStateKey;
|
|
11
|
-
var _default = function _default(dispatch) {
|
|
12
|
-
return new _safePlugin.SafePlugin({
|
|
13
|
-
key: focusStateKey,
|
|
14
|
-
state: {
|
|
15
|
-
init: function init() {
|
|
16
|
-
return true;
|
|
17
|
-
},
|
|
18
|
-
apply: function apply(tr, wasEditorFocused) {
|
|
19
|
-
var meta = tr.getMeta(focusStateKey);
|
|
20
|
-
if (typeof meta === 'boolean') {
|
|
21
|
-
if (meta !== wasEditorFocused) {
|
|
22
|
-
dispatch(focusStateKey, meta);
|
|
23
|
-
return meta;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return wasEditorFocused;
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
props: {
|
|
30
|
-
handleDOMEvents: {
|
|
31
|
-
click: function click(view) {
|
|
32
|
-
var isEditorFocused = focusStateKey.getState(view.state);
|
|
33
|
-
if (!isEditorFocused) {
|
|
34
|
-
view.dispatch(view.state.tr.setMeta(focusStateKey, view.hasFocus()));
|
|
35
|
-
}
|
|
36
|
-
return false;
|
|
37
|
-
},
|
|
38
|
-
focus: function focus(view) {
|
|
39
|
-
var isEditorFocused = focusStateKey.getState(view.state);
|
|
40
|
-
if (!isEditorFocused) {
|
|
41
|
-
view.dispatch(view.state.tr.setMeta(focusStateKey, true));
|
|
42
|
-
}
|
|
43
|
-
return false;
|
|
44
|
-
},
|
|
45
|
-
blur: function blur(view) {
|
|
46
|
-
var isEditorFocused = focusStateKey.getState(view.state);
|
|
47
|
-
if (isEditorFocused) {
|
|
48
|
-
view.dispatch(view.state.tr.setMeta(focusStateKey, false));
|
|
49
|
-
}
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
exports.default = _default;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
export const focusStateKey = new PluginKey('focusStatePlugin');
|
|
4
|
-
export default (dispatch => new SafePlugin({
|
|
5
|
-
key: focusStateKey,
|
|
6
|
-
state: {
|
|
7
|
-
init: () => true,
|
|
8
|
-
apply: (tr, wasEditorFocused) => {
|
|
9
|
-
const meta = tr.getMeta(focusStateKey);
|
|
10
|
-
if (typeof meta === 'boolean') {
|
|
11
|
-
if (meta !== wasEditorFocused) {
|
|
12
|
-
dispatch(focusStateKey, meta);
|
|
13
|
-
return meta;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return wasEditorFocused;
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
props: {
|
|
20
|
-
handleDOMEvents: {
|
|
21
|
-
click: view => {
|
|
22
|
-
const isEditorFocused = focusStateKey.getState(view.state);
|
|
23
|
-
if (!isEditorFocused) {
|
|
24
|
-
view.dispatch(view.state.tr.setMeta(focusStateKey, view.hasFocus()));
|
|
25
|
-
}
|
|
26
|
-
return false;
|
|
27
|
-
},
|
|
28
|
-
focus: view => {
|
|
29
|
-
const isEditorFocused = focusStateKey.getState(view.state);
|
|
30
|
-
if (!isEditorFocused) {
|
|
31
|
-
view.dispatch(view.state.tr.setMeta(focusStateKey, true));
|
|
32
|
-
}
|
|
33
|
-
return false;
|
|
34
|
-
},
|
|
35
|
-
blur: view => {
|
|
36
|
-
const isEditorFocused = focusStateKey.getState(view.state);
|
|
37
|
-
if (isEditorFocused) {
|
|
38
|
-
view.dispatch(view.state.tr.setMeta(focusStateKey, false));
|
|
39
|
-
}
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}));
|