@atlaskit/editor-core 188.13.6 → 189.0.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 +10 -0
- package/dist/cjs/labs/next/presets/default.js +2 -2
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/labs/next/presets/default.js +1 -1
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/labs/next/presets/default.js +1 -1
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/labs/next/presets/default.d.ts +4 -4
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +4 -4
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/package.json +3 -2
- package/dist/cjs/plugins/submit-editor/index.js +0 -64
- package/dist/es2019/plugins/submit-editor/index.js +0 -53
- package/dist/esm/plugins/submit-editor/index.js +0 -56
- package/dist/types/plugins/submit-editor/index.d.ts +0 -14
- package/dist/types-ts4.5/plugins/submit-editor/index.d.ts +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 189.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#42052](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42052) [`12b16804202`](https://bitbucket.org/atlassian/atlassian-frontend/commits/12b16804202) - Decoupled submit-editor plugin, used to allow mod+Enter keyboard shortcut to trigger saving the editor content, from editor-core
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 188.13.6
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -18,7 +18,7 @@ var _editorPluginBase = require("@atlaskit/editor-plugin-base");
|
|
|
18
18
|
var _editorPluginFocus = require("@atlaskit/editor-plugin-focus");
|
|
19
19
|
var _editorPluginEditorDisabled = require("@atlaskit/editor-plugin-editor-disabled");
|
|
20
20
|
var _editorPluginTypeAhead = require("@atlaskit/editor-plugin-type-ahead");
|
|
21
|
-
var
|
|
21
|
+
var _editorPluginSubmitEditor = require("@atlaskit/editor-plugin-submit-editor");
|
|
22
22
|
var _fakeTextCursor = _interopRequireDefault(require("../../../plugins/fake-text-cursor"));
|
|
23
23
|
var _editorPluginFeatureFlags = require("@atlaskit/editor-plugin-feature-flags");
|
|
24
24
|
var _editorPluginCopyButton = require("@atlaskit/editor-plugin-copy-button");
|
|
@@ -78,7 +78,7 @@ function createDefaultPreset(options) {
|
|
|
78
78
|
return builder;
|
|
79
79
|
}).add([_editorPluginHyperlink.hyperlinkPlugin, options.hyperlinkOptions]).add([_editorPluginTextFormatting.textFormattingPlugin, options.textFormatting]).add(_editorPluginWidth.widthPlugin).add([_editorPluginQuickInsert.quickInsertPlugin, options.quickInsert]).add([_editorPluginTypeAhead.typeAheadPlugin, options.typeAhead || {
|
|
80
80
|
createAnalyticsEvent: options.createAnalyticsEvent
|
|
81
|
-
}]).add([_editorPluginPlaceholder.placeholderPlugin, options.placeholder]).add(_editorPluginUnsupportedContent.unsupportedContentPlugin).add(_editorPluginEditorDisabled.editorDisabledPlugin).add([
|
|
81
|
+
}]).add([_editorPluginPlaceholder.placeholderPlugin, options.placeholder]).add(_editorPluginUnsupportedContent.unsupportedContentPlugin).add(_editorPluginEditorDisabled.editorDisabledPlugin).add([_editorPluginSubmitEditor.submitEditorPlugin, options.submitEditor]).add(_fakeTextCursor.default).add(_editorPluginCopyButton.copyButtonPlugin).add(_editorPluginFloatingToolbar.floatingToolbarPlugin).add([_editorPluginSelection.selectionPlugin, options.selection]).add([_codeBlock.default, options.codeBlock || {
|
|
82
82
|
appearance: 'full-page'
|
|
83
83
|
}]);
|
|
84
84
|
return preset;
|
|
@@ -185,12 +185,6 @@ Object.defineProperty(exports, "placeholderTextPlugin", {
|
|
|
185
185
|
return _placeholderText.default;
|
|
186
186
|
}
|
|
187
187
|
});
|
|
188
|
-
Object.defineProperty(exports, "submitEditorPlugin", {
|
|
189
|
-
enumerable: true,
|
|
190
|
-
get: function get() {
|
|
191
|
-
return _submitEditor.default;
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
188
|
Object.defineProperty(exports, "tasksAndDecisionsPlugin", {
|
|
195
189
|
enumerable: true,
|
|
196
190
|
get: function get() {
|
|
@@ -235,7 +229,6 @@ var _maxContentSize = _interopRequireDefault(require("./max-content-size"));
|
|
|
235
229
|
var _panel = _interopRequireDefault(require("./panel"));
|
|
236
230
|
var _paste = _interopRequireDefault(require("./paste"));
|
|
237
231
|
var _placeholderText = _interopRequireDefault(require("./placeholder-text"));
|
|
238
|
-
var _submitEditor = _interopRequireDefault(require("./submit-editor"));
|
|
239
232
|
var _tasksAndDecisions = _interopRequireDefault(require("./tasks-and-decisions"));
|
|
240
233
|
var _textColor = _interopRequireDefault(require("./text-color"));
|
|
241
234
|
var _breakout = _interopRequireDefault(require("./breakout"));
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = exports.name = "@atlaskit/editor-core";
|
|
8
|
-
var version = exports.version = "
|
|
8
|
+
var version = exports.version = "189.0.0";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|
|
@@ -12,7 +12,7 @@ import { basePlugin } from '@atlaskit/editor-plugin-base';
|
|
|
12
12
|
import { focusPlugin } from '@atlaskit/editor-plugin-focus';
|
|
13
13
|
import { editorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
14
14
|
import { typeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
15
|
-
import submitEditorPlugin from '
|
|
15
|
+
import { submitEditorPlugin } from '@atlaskit/editor-plugin-submit-editor';
|
|
16
16
|
import fakeTextCursorPlugin from '../../../plugins/fake-text-cursor';
|
|
17
17
|
import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
18
18
|
import { copyButtonPlugin } from '@atlaskit/editor-plugin-copy-button';
|
|
@@ -12,7 +12,6 @@ export { default as maxContentSizePlugin } from './max-content-size';
|
|
|
12
12
|
export { default as panelPlugin } from './panel';
|
|
13
13
|
export { default as pastePlugin } from './paste';
|
|
14
14
|
export { default as placeholderTextPlugin } from './placeholder-text';
|
|
15
|
-
export { default as submitEditorPlugin } from './submit-editor';
|
|
16
15
|
export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
|
|
17
16
|
export { default as textColorPlugin } from './text-color';
|
|
18
17
|
export { default as breakoutPlugin } from './breakout';
|
|
@@ -12,7 +12,7 @@ import { basePlugin } from '@atlaskit/editor-plugin-base';
|
|
|
12
12
|
import { focusPlugin } from '@atlaskit/editor-plugin-focus';
|
|
13
13
|
import { editorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
14
14
|
import { typeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
15
|
-
import submitEditorPlugin from '
|
|
15
|
+
import { submitEditorPlugin } from '@atlaskit/editor-plugin-submit-editor';
|
|
16
16
|
import fakeTextCursorPlugin from '../../../plugins/fake-text-cursor';
|
|
17
17
|
import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
18
18
|
import { copyButtonPlugin } from '@atlaskit/editor-plugin-copy-button';
|
|
@@ -12,7 +12,6 @@ export { default as maxContentSizePlugin } from './max-content-size';
|
|
|
12
12
|
export { default as panelPlugin } from './panel';
|
|
13
13
|
export { default as pastePlugin } from './paste';
|
|
14
14
|
export { default as placeholderTextPlugin } from './placeholder-text';
|
|
15
|
-
export { default as submitEditorPlugin } from './submit-editor';
|
|
16
15
|
export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
|
|
17
16
|
export { default as textColorPlugin } from './text-color';
|
|
18
17
|
export { default as breakoutPlugin } from './breakout';
|
|
@@ -144,7 +144,7 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
144
144
|
processCopyButtonItems: (state: import("prosemirror-state").EditorState) => (items: import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[], hoverDecoration: ((nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command) | undefined) => import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[];
|
|
145
145
|
};
|
|
146
146
|
}, undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"fakeTextCursor", {}, undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"submitEditor", {
|
|
147
|
-
pluginConfiguration:
|
|
147
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-submit-editor").SubmitEditorPluginOptions | undefined;
|
|
148
148
|
dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"media", {
|
|
149
149
|
pluginConfiguration: import("@atlaskit/editor-plugin-media/types").MediaOptions | undefined;
|
|
150
150
|
dependencies: [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
@@ -270,7 +270,7 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
270
270
|
insertMediaAsMediaSingle: import("@atlaskit/editor-plugin-media/types").InsertMediaAsMediaSingle;
|
|
271
271
|
};
|
|
272
272
|
}, import("@atlaskit/editor-plugin-media/types").MediaOptions | undefined>>];
|
|
273
|
-
},
|
|
273
|
+
}, import("@atlaskit/editor-plugin-submit-editor").SubmitEditorPluginOptions | undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorDisabled", {
|
|
274
274
|
sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
|
|
275
275
|
}, undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"unsupportedContent", {}, undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"placeholder", {
|
|
276
276
|
pluginConfiguration: PlaceholderPluginOptions | undefined;
|
|
@@ -595,7 +595,7 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
595
595
|
processCopyButtonItems: (state: import("prosemirror-state").EditorState) => (items: import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[], hoverDecoration: ((nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command) | undefined) => import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[];
|
|
596
596
|
};
|
|
597
597
|
}, undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"fakeTextCursor", {}, undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"submitEditor", {
|
|
598
|
-
pluginConfiguration:
|
|
598
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-submit-editor").SubmitEditorPluginOptions | undefined;
|
|
599
599
|
dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"media", {
|
|
600
600
|
pluginConfiguration: import("@atlaskit/editor-plugin-media/types").MediaOptions | undefined;
|
|
601
601
|
dependencies: [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
@@ -721,7 +721,7 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
721
721
|
insertMediaAsMediaSingle: import("@atlaskit/editor-plugin-media/types").InsertMediaAsMediaSingle;
|
|
722
722
|
};
|
|
723
723
|
}, import("@atlaskit/editor-plugin-media/types").MediaOptions | undefined>>];
|
|
724
|
-
},
|
|
724
|
+
}, import("@atlaskit/editor-plugin-submit-editor").SubmitEditorPluginOptions | undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorDisabled", {
|
|
725
725
|
sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
|
|
726
726
|
}, undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"unsupportedContent", {}, undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"placeholder", {
|
|
727
727
|
pluginConfiguration: PlaceholderPluginOptions | undefined;
|
|
@@ -12,7 +12,6 @@ export { default as maxContentSizePlugin } from './max-content-size';
|
|
|
12
12
|
export { default as panelPlugin } from './panel';
|
|
13
13
|
export { default as pastePlugin } from './paste';
|
|
14
14
|
export { default as placeholderTextPlugin } from './placeholder-text';
|
|
15
|
-
export { default as submitEditorPlugin } from './submit-editor';
|
|
16
15
|
export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
|
|
17
16
|
export { default as textColorPlugin } from './text-color';
|
|
18
17
|
export { default as breakoutPlugin } from './breakout';
|
|
@@ -192,7 +192,7 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
192
192
|
}, undefined>,
|
|
193
193
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"fakeTextCursor", {}, undefined>,
|
|
194
194
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"submitEditor", {
|
|
195
|
-
pluginConfiguration:
|
|
195
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-submit-editor").SubmitEditorPluginOptions | undefined;
|
|
196
196
|
dependencies: [
|
|
197
197
|
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"media", {
|
|
198
198
|
pluginConfiguration: import("@atlaskit/editor-plugin-media/types").MediaOptions | undefined;
|
|
@@ -353,7 +353,7 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
353
353
|
};
|
|
354
354
|
}, import("@atlaskit/editor-plugin-media/types").MediaOptions | undefined>>
|
|
355
355
|
];
|
|
356
|
-
},
|
|
356
|
+
}, import("@atlaskit/editor-plugin-submit-editor").SubmitEditorPluginOptions | undefined>,
|
|
357
357
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorDisabled", {
|
|
358
358
|
sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
|
|
359
359
|
}, undefined>,
|
|
@@ -763,7 +763,7 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
763
763
|
}, undefined>,
|
|
764
764
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"fakeTextCursor", {}, undefined>,
|
|
765
765
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"submitEditor", {
|
|
766
|
-
pluginConfiguration:
|
|
766
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-submit-editor").SubmitEditorPluginOptions | undefined;
|
|
767
767
|
dependencies: [
|
|
768
768
|
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"media", {
|
|
769
769
|
pluginConfiguration: import("@atlaskit/editor-plugin-media/types").MediaOptions | undefined;
|
|
@@ -924,7 +924,7 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
924
924
|
};
|
|
925
925
|
}, import("@atlaskit/editor-plugin-media/types").MediaOptions | undefined>>
|
|
926
926
|
];
|
|
927
|
-
},
|
|
927
|
+
}, import("@atlaskit/editor-plugin-submit-editor").SubmitEditorPluginOptions | undefined>,
|
|
928
928
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorDisabled", {
|
|
929
929
|
sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
|
|
930
930
|
}, undefined>,
|
|
@@ -12,7 +12,6 @@ export { default as maxContentSizePlugin } from './max-content-size';
|
|
|
12
12
|
export { default as panelPlugin } from './panel';
|
|
13
13
|
export { default as pastePlugin } from './paste';
|
|
14
14
|
export { default as placeholderTextPlugin } from './placeholder-text';
|
|
15
|
-
export { default as submitEditorPlugin } from './submit-editor';
|
|
16
15
|
export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
|
|
17
16
|
export { default as textColorPlugin } from './text-color';
|
|
18
17
|
export { default as breakoutPlugin } from './breakout';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "189.0.0",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -95,6 +95,7 @@
|
|
|
95
95
|
"@atlaskit/editor-plugin-selection": "^0.1.0",
|
|
96
96
|
"@atlaskit/editor-plugin-selection-toolbar": "^0.1.0",
|
|
97
97
|
"@atlaskit/editor-plugin-status": "^0.1.0",
|
|
98
|
+
"@atlaskit/editor-plugin-submit-editor": "^0.1.0",
|
|
98
99
|
"@atlaskit/editor-plugin-table": "^5.3.0",
|
|
99
100
|
"@atlaskit/editor-plugin-text-formatting": "^0.4.0",
|
|
100
101
|
"@atlaskit/editor-plugin-type-ahead": "^0.7.0",
|
|
@@ -163,7 +164,7 @@
|
|
|
163
164
|
"@atlaskit/inline-dialog": "^13.6.0",
|
|
164
165
|
"@atlaskit/link-analytics": "^8.3.0",
|
|
165
166
|
"@atlaskit/link-provider": "^1.6.0",
|
|
166
|
-
"@atlaskit/link-test-helpers": "^6.
|
|
167
|
+
"@atlaskit/link-test-helpers": "^6.2.0",
|
|
167
168
|
"@atlaskit/media-core": "^34.1.0",
|
|
168
169
|
"@atlaskit/media-integration-test-helpers": "^3.0.0",
|
|
169
170
|
"@atlaskit/media-test-helpers": "^33.0.0",
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createPlugin = createPlugin;
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
-
var _keymap2 = require("@atlaskit/editor-prosemirror/keymap");
|
|
11
|
-
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
12
|
-
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
13
|
-
var _consts = require("../analytics/consts");
|
|
14
|
-
function createPlugin(eventDispatch, api, onSave) {
|
|
15
|
-
if (!onSave) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
return (0, _keymap2.keymap)((0, _defineProperty2.default)({}, "".concat(_keymaps.submit.common), function _(state, _dispatch, editorView) {
|
|
19
|
-
var _api$media;
|
|
20
|
-
var mediaState = api === null || api === void 0 || (_api$media = api.media) === null || _api$media === void 0 || (_api$media = _api$media.sharedState) === null || _api$media === void 0 ? void 0 : _api$media.currentState();
|
|
21
|
-
if (mediaState && mediaState.waitForMediaUpload && !mediaState.allUploadsFinished) {
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
if (!editorView) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
eventDispatch(_consts.analyticsEventKey, analyticsPayload(state));
|
|
28
|
-
onSave(editorView);
|
|
29
|
-
return true;
|
|
30
|
-
}));
|
|
31
|
-
}
|
|
32
|
-
var analyticsPayload = function analyticsPayload(state) {
|
|
33
|
-
return {
|
|
34
|
-
payload: {
|
|
35
|
-
action: _analytics.ACTION.STOPPED,
|
|
36
|
-
actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
|
|
37
|
-
actionSubjectId: _analytics.ACTION_SUBJECT_ID.SAVE,
|
|
38
|
-
attributes: {
|
|
39
|
-
inputMethod: _analytics.INPUT_METHOD.SHORTCUT,
|
|
40
|
-
documentSize: state.doc.nodeSize
|
|
41
|
-
// TODO add individual node counts - tables, headings, lists, mediaSingles, mediaGroups, mediaCards, panels, extensions, decisions, action, codeBlocks
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
eventType: _analytics.EVENT_TYPE.UI
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
var submitEditorPlugin = function submitEditorPlugin(_ref) {
|
|
49
|
-
var onSave = _ref.config,
|
|
50
|
-
api = _ref.api;
|
|
51
|
-
return {
|
|
52
|
-
name: 'submitEditor',
|
|
53
|
-
pmPlugins: function pmPlugins() {
|
|
54
|
-
return [{
|
|
55
|
-
name: 'submitEditor',
|
|
56
|
-
plugin: function plugin(_ref2) {
|
|
57
|
-
var dispatch = _ref2.dispatch;
|
|
58
|
-
return createPlugin(dispatch, api, onSave);
|
|
59
|
-
}
|
|
60
|
-
}];
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
var _default = exports.default = submitEditorPlugin;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
|
-
import { submit } from '@atlaskit/editor-common/keymaps';
|
|
3
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { analyticsEventKey } from '../analytics/consts';
|
|
5
|
-
export function createPlugin(eventDispatch, api, onSave) {
|
|
6
|
-
if (!onSave) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
return keymap({
|
|
10
|
-
[`${submit.common}`]: (state, _dispatch, editorView) => {
|
|
11
|
-
var _api$media, _api$media$sharedStat;
|
|
12
|
-
const mediaState = api === null || api === void 0 ? void 0 : (_api$media = api.media) === null || _api$media === void 0 ? void 0 : (_api$media$sharedStat = _api$media.sharedState) === null || _api$media$sharedStat === void 0 ? void 0 : _api$media$sharedStat.currentState();
|
|
13
|
-
if (mediaState && mediaState.waitForMediaUpload && !mediaState.allUploadsFinished) {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
if (!editorView) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
eventDispatch(analyticsEventKey, analyticsPayload(state));
|
|
20
|
-
onSave(editorView);
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
const analyticsPayload = state => ({
|
|
26
|
-
payload: {
|
|
27
|
-
action: ACTION.STOPPED,
|
|
28
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
29
|
-
actionSubjectId: ACTION_SUBJECT_ID.SAVE,
|
|
30
|
-
attributes: {
|
|
31
|
-
inputMethod: INPUT_METHOD.SHORTCUT,
|
|
32
|
-
documentSize: state.doc.nodeSize
|
|
33
|
-
// TODO add individual node counts - tables, headings, lists, mediaSingles, mediaGroups, mediaCards, panels, extensions, decisions, action, codeBlocks
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
eventType: EVENT_TYPE.UI
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
const submitEditorPlugin = ({
|
|
40
|
-
config: onSave,
|
|
41
|
-
api
|
|
42
|
-
}) => ({
|
|
43
|
-
name: 'submitEditor',
|
|
44
|
-
pmPlugins() {
|
|
45
|
-
return [{
|
|
46
|
-
name: 'submitEditor',
|
|
47
|
-
plugin: ({
|
|
48
|
-
dispatch
|
|
49
|
-
}) => createPlugin(dispatch, api, onSave)
|
|
50
|
-
}];
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
export default submitEditorPlugin;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
3
|
-
import { submit } from '@atlaskit/editor-common/keymaps';
|
|
4
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
|
-
import { analyticsEventKey } from '../analytics/consts';
|
|
6
|
-
export function createPlugin(eventDispatch, api, onSave) {
|
|
7
|
-
if (!onSave) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
return keymap(_defineProperty({}, "".concat(submit.common), function _(state, _dispatch, editorView) {
|
|
11
|
-
var _api$media;
|
|
12
|
-
var mediaState = api === null || api === void 0 || (_api$media = api.media) === null || _api$media === void 0 || (_api$media = _api$media.sharedState) === null || _api$media === void 0 ? void 0 : _api$media.currentState();
|
|
13
|
-
if (mediaState && mediaState.waitForMediaUpload && !mediaState.allUploadsFinished) {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
if (!editorView) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
eventDispatch(analyticsEventKey, analyticsPayload(state));
|
|
20
|
-
onSave(editorView);
|
|
21
|
-
return true;
|
|
22
|
-
}));
|
|
23
|
-
}
|
|
24
|
-
var analyticsPayload = function analyticsPayload(state) {
|
|
25
|
-
return {
|
|
26
|
-
payload: {
|
|
27
|
-
action: ACTION.STOPPED,
|
|
28
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
29
|
-
actionSubjectId: ACTION_SUBJECT_ID.SAVE,
|
|
30
|
-
attributes: {
|
|
31
|
-
inputMethod: INPUT_METHOD.SHORTCUT,
|
|
32
|
-
documentSize: state.doc.nodeSize
|
|
33
|
-
// TODO add individual node counts - tables, headings, lists, mediaSingles, mediaGroups, mediaCards, panels, extensions, decisions, action, codeBlocks
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
eventType: EVENT_TYPE.UI
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
var submitEditorPlugin = function submitEditorPlugin(_ref) {
|
|
41
|
-
var onSave = _ref.config,
|
|
42
|
-
api = _ref.api;
|
|
43
|
-
return {
|
|
44
|
-
name: 'submitEditor',
|
|
45
|
-
pmPlugins: function pmPlugins() {
|
|
46
|
-
return [{
|
|
47
|
-
name: 'submitEditor',
|
|
48
|
-
plugin: function plugin(_ref2) {
|
|
49
|
-
var dispatch = _ref2.dispatch;
|
|
50
|
-
return createPlugin(dispatch, api, onSave);
|
|
51
|
-
}
|
|
52
|
-
}];
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
export default submitEditorPlugin;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import type { Dispatch } from '../../event-dispatcher';
|
|
4
|
-
import type { EditorProps } from '../../types/editor-props';
|
|
5
|
-
import type { NextEditorPlugin, OptionalPlugin, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
6
|
-
import type { MediaPlugin } from '@atlaskit/editor-plugin-media';
|
|
7
|
-
export declare function createPlugin(eventDispatch: Dispatch, api: ExtractInjectionAPI<SubmitEditorPlugin> | undefined, onSave?: (editorView: EditorView) => void): SafePlugin | undefined;
|
|
8
|
-
type Config = EditorProps['onSave'];
|
|
9
|
-
type SubmitEditorPlugin = NextEditorPlugin<'submitEditor', {
|
|
10
|
-
pluginConfiguration: Config | undefined;
|
|
11
|
-
dependencies: [OptionalPlugin<MediaPlugin>];
|
|
12
|
-
}>;
|
|
13
|
-
declare const submitEditorPlugin: SubmitEditorPlugin;
|
|
14
|
-
export default submitEditorPlugin;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import type { Dispatch } from '../../event-dispatcher';
|
|
4
|
-
import type { EditorProps } from '../../types/editor-props';
|
|
5
|
-
import type { NextEditorPlugin, OptionalPlugin, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
6
|
-
import type { MediaPlugin } from '@atlaskit/editor-plugin-media';
|
|
7
|
-
export declare function createPlugin(eventDispatch: Dispatch, api: ExtractInjectionAPI<SubmitEditorPlugin> | undefined, onSave?: (editorView: EditorView) => void): SafePlugin | undefined;
|
|
8
|
-
type Config = EditorProps['onSave'];
|
|
9
|
-
type SubmitEditorPlugin = NextEditorPlugin<'submitEditor', {
|
|
10
|
-
pluginConfiguration: Config | undefined;
|
|
11
|
-
dependencies: [
|
|
12
|
-
OptionalPlugin<MediaPlugin>
|
|
13
|
-
];
|
|
14
|
-
}>;
|
|
15
|
-
declare const submitEditorPlugin: SubmitEditorPlugin;
|
|
16
|
-
export default submitEditorPlugin;
|