@atlaskit/editor-core 185.6.5 → 185.8.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 +20 -0
- package/dist/cjs/plugins/card/index.js +14 -0
- package/dist/cjs/plugins/card/nodeviews/datasource.js +2 -4
- package/dist/cjs/plugins/card/pm-plugins/main.js +2 -1
- package/dist/cjs/plugins/card/pm-plugins/mountHyperlink.js +46 -0
- package/dist/cjs/plugins/card/toolbar.js +4 -5
- package/dist/cjs/plugins/{hyperlink → card/ui}/HyperlinkToolbarAppearance.js +5 -3
- package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +24 -20
- package/dist/cjs/plugins/card/ui/ResizableEmbedCard.js +2 -2
- package/dist/cjs/plugins/card/ui/SmallerEditIcon.js +2 -2
- package/dist/cjs/plugins/card/utils.js +2 -30
- package/dist/cjs/plugins/hyperlink/Toolbar.js +18 -30
- package/dist/cjs/plugins/hyperlink/commands.js +7 -3
- package/dist/cjs/plugins/hyperlink/index.js +9 -2
- package/dist/cjs/plugins/hyperlink/pm-plugins/toolbar-buttons.js +41 -0
- package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/index.js +6 -3
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +8 -4
- package/dist/cjs/plugins/media/index.js +9 -1
- package/dist/cjs/plugins/media/toolbar/index.js +3 -3
- package/dist/cjs/plugins/media/utils/media-common.js +1 -1
- package/dist/cjs/plugins/paste/handlers.js +12 -12
- package/dist/cjs/plugins/paste/index.js +1 -1
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +12 -8
- package/dist/cjs/plugins/paste/pm-plugins/main.js +18 -17
- package/dist/cjs/plugins/paste/util/index.js +29 -2
- package/dist/cjs/ui/ContentStyles/index.js +2 -4
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/card/index.js +12 -0
- package/dist/es2019/plugins/card/nodeviews/datasource.js +1 -2
- package/dist/es2019/plugins/card/pm-plugins/main.js +2 -1
- package/dist/es2019/plugins/card/pm-plugins/mountHyperlink.js +36 -0
- package/dist/es2019/plugins/card/toolbar.js +4 -3
- package/dist/es2019/plugins/{hyperlink → card/ui}/HyperlinkToolbarAppearance.js +5 -3
- package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +12 -13
- package/dist/es2019/plugins/card/ui/ResizableEmbedCard.js +1 -1
- package/dist/es2019/plugins/card/ui/SmallerEditIcon.js +1 -1
- package/dist/es2019/plugins/card/utils.js +0 -28
- package/dist/es2019/plugins/hyperlink/Toolbar.js +21 -30
- package/dist/es2019/plugins/hyperlink/commands.js +6 -3
- package/dist/es2019/plugins/hyperlink/index.js +9 -2
- package/dist/es2019/plugins/hyperlink/pm-plugins/toolbar-buttons.js +37 -0
- package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/index.js +11 -4
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +13 -5
- package/dist/es2019/plugins/media/index.js +10 -2
- package/dist/es2019/plugins/media/toolbar/index.js +1 -1
- package/dist/es2019/plugins/media/utils/media-common.js +1 -1
- package/dist/es2019/plugins/paste/handlers.js +12 -13
- package/dist/es2019/plugins/paste/index.js +1 -1
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +24 -12
- package/dist/es2019/plugins/paste/pm-plugins/main.js +11 -10
- package/dist/es2019/plugins/paste/util/index.js +28 -1
- package/dist/es2019/ui/ContentStyles/index.js +1 -3
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/card/index.js +14 -0
- package/dist/esm/plugins/card/nodeviews/datasource.js +1 -2
- package/dist/esm/plugins/card/pm-plugins/main.js +2 -1
- package/dist/esm/plugins/card/pm-plugins/mountHyperlink.js +38 -0
- package/dist/esm/plugins/card/toolbar.js +4 -3
- package/dist/esm/plugins/{hyperlink → card/ui}/HyperlinkToolbarAppearance.js +5 -3
- package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +14 -13
- package/dist/esm/plugins/card/ui/ResizableEmbedCard.js +1 -1
- package/dist/esm/plugins/card/ui/SmallerEditIcon.js +1 -1
- package/dist/esm/plugins/card/utils.js +0 -27
- package/dist/esm/plugins/hyperlink/Toolbar.js +19 -30
- package/dist/esm/plugins/hyperlink/commands.js +6 -3
- package/dist/esm/plugins/hyperlink/index.js +9 -2
- package/dist/esm/plugins/hyperlink/pm-plugins/toolbar-buttons.js +32 -0
- package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/index.js +7 -4
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +9 -5
- package/dist/esm/plugins/media/index.js +10 -2
- package/dist/esm/plugins/media/toolbar/index.js +1 -1
- package/dist/esm/plugins/media/utils/media-common.js +1 -1
- package/dist/esm/plugins/paste/handlers.js +12 -13
- package/dist/esm/plugins/paste/index.js +1 -1
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +12 -8
- package/dist/esm/plugins/paste/pm-plugins/main.js +11 -10
- package/dist/esm/plugins/paste/util/index.js +27 -1
- package/dist/esm/ui/ContentStyles/index.js +1 -3
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/labs/next/presets/cxhtml.d.ts +6 -0
- package/dist/types/labs/next/presets/default.d.ts +12 -0
- package/dist/types/labs/next/presets/mobile.d.ts +6 -0
- package/dist/types/plugins/card/index.d.ts +5 -1
- package/dist/types/plugins/card/nodeviews/datasource.d.ts +0 -1
- package/dist/types/plugins/card/pm-plugins/doc.d.ts +2 -1
- package/dist/types/plugins/card/pm-plugins/mountHyperlink.d.ts +5 -0
- package/dist/types/plugins/card/pm-plugins/util/state.d.ts +1 -1
- package/dist/types/plugins/card/types.d.ts +2 -3
- package/dist/types/plugins/{hyperlink → card/ui}/HyperlinkToolbarAppearance.d.ts +2 -0
- package/dist/types/plugins/card/ui/LinkToolbarAppearance.d.ts +7 -5
- package/dist/types/plugins/card/utils.d.ts +1 -3
- package/dist/types/plugins/hyperlink/Toolbar.d.ts +3 -2
- package/dist/types/plugins/hyperlink/commands.d.ts +2 -0
- package/dist/types/plugins/hyperlink/index.d.ts +11 -0
- package/dist/types/plugins/hyperlink/pm-plugins/toolbar-buttons.d.ts +19 -0
- package/dist/types/plugins/paste/handlers.d.ts +6 -5
- package/dist/types/plugins/paste/index.d.ts +6 -2
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +6 -5
- package/dist/types/plugins/paste/pm-plugins/main.d.ts +3 -2
- package/dist/types/plugins/paste/util/index.d.ts +2 -0
- package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +6 -0
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +12 -0
- package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +6 -0
- package/dist/types-ts4.5/plugins/card/index.d.ts +5 -1
- package/dist/types-ts4.5/plugins/card/nodeviews/datasource.d.ts +0 -1
- package/dist/types-ts4.5/plugins/card/pm-plugins/doc.d.ts +2 -1
- package/dist/types-ts4.5/plugins/card/pm-plugins/mountHyperlink.d.ts +5 -0
- package/dist/types-ts4.5/plugins/card/pm-plugins/util/state.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/types.d.ts +2 -3
- package/dist/types-ts4.5/plugins/{hyperlink → card/ui}/HyperlinkToolbarAppearance.d.ts +2 -0
- package/dist/types-ts4.5/plugins/card/ui/LinkToolbarAppearance.d.ts +7 -5
- package/dist/types-ts4.5/plugins/card/utils.d.ts +1 -3
- package/dist/types-ts4.5/plugins/hyperlink/Toolbar.d.ts +3 -2
- package/dist/types-ts4.5/plugins/hyperlink/commands.d.ts +2 -0
- package/dist/types-ts4.5/plugins/hyperlink/index.d.ts +11 -0
- package/dist/types-ts4.5/plugins/hyperlink/pm-plugins/toolbar-buttons.d.ts +19 -0
- package/dist/types-ts4.5/plugins/paste/handlers.d.ts +6 -5
- package/dist/types-ts4.5/plugins/paste/index.d.ts +4 -2
- package/dist/types-ts4.5/plugins/paste/pm-plugins/analytics.d.ts +6 -5
- package/dist/types-ts4.5/plugins/paste/pm-plugins/main.d.ts +3 -2
- package/dist/types-ts4.5/plugins/paste/util/index.d.ts +2 -0
- package/package.json +12 -9
- package/dist/cjs/plugins/card/messages.js +0 -90
- package/dist/cjs/plugins/card/styles.js +0 -18
- package/dist/cjs/plugins/card/ui/LinkToolbarButtonGroup.js +0 -63
- package/dist/cjs/plugins/card/ui/assets/card.js +0 -30
- package/dist/cjs/plugins/card/ui/assets/embed.js +0 -30
- package/dist/cjs/plugins/card/ui/assets/inline.js +0 -30
- package/dist/cjs/plugins/card/ui/assets/url.js +0 -32
- package/dist/cjs/plugins/card/ui/link-toolbar-button-group-options.js +0 -52
- package/dist/cjs/plugins/card/ui/styled.js +0 -16
- package/dist/cjs/plugins/card/ui/types.js +0 -5
- package/dist/es2019/plugins/card/messages.js +0 -83
- package/dist/es2019/plugins/card/styles.js +0 -132
- package/dist/es2019/plugins/card/ui/LinkToolbarButtonGroup.js +0 -61
- package/dist/es2019/plugins/card/ui/assets/card.js +0 -22
- package/dist/es2019/plugins/card/ui/assets/embed.js +0 -22
- package/dist/es2019/plugins/card/ui/assets/inline.js +0 -22
- package/dist/es2019/plugins/card/ui/assets/url.js +0 -24
- package/dist/es2019/plugins/card/ui/link-toolbar-button-group-options.js +0 -45
- package/dist/es2019/plugins/card/ui/styled.js +0 -27
- package/dist/es2019/plugins/card/ui/types.js +0 -1
- package/dist/esm/plugins/card/messages.js +0 -83
- package/dist/esm/plugins/card/styles.js +0 -10
- package/dist/esm/plugins/card/ui/LinkToolbarButtonGroup.js +0 -56
- package/dist/esm/plugins/card/ui/assets/card.js +0 -22
- package/dist/esm/plugins/card/ui/assets/embed.js +0 -22
- package/dist/esm/plugins/card/ui/assets/inline.js +0 -22
- package/dist/esm/plugins/card/ui/assets/url.js +0 -24
- package/dist/esm/plugins/card/ui/link-toolbar-button-group-options.js +0 -45
- package/dist/esm/plugins/card/ui/styled.js +0 -6
- package/dist/esm/plugins/card/ui/types.js +0 -1
- package/dist/types/plugins/card/messages.d.ts +0 -82
- package/dist/types/plugins/card/styles.d.ts +0 -2
- package/dist/types/plugins/card/ui/LinkToolbarButtonGroup.d.ts +0 -16
- package/dist/types/plugins/card/ui/assets/card.d.ts +0 -3
- package/dist/types/plugins/card/ui/assets/embed.d.ts +0 -3
- package/dist/types/plugins/card/ui/assets/inline.d.ts +0 -3
- package/dist/types/plugins/card/ui/assets/url.d.ts +0 -3
- package/dist/types/plugins/card/ui/link-toolbar-button-group-options.d.ts +0 -5
- package/dist/types/plugins/card/ui/styled.d.ts +0 -3
- package/dist/types/plugins/card/ui/types.d.ts +0 -12
- package/dist/types-ts4.5/plugins/card/messages.d.ts +0 -82
- package/dist/types-ts4.5/plugins/card/styles.d.ts +0 -2
- package/dist/types-ts4.5/plugins/card/ui/LinkToolbarButtonGroup.d.ts +0 -16
- package/dist/types-ts4.5/plugins/card/ui/assets/card.d.ts +0 -3
- package/dist/types-ts4.5/plugins/card/ui/assets/embed.d.ts +0 -3
- package/dist/types-ts4.5/plugins/card/ui/assets/inline.d.ts +0 -3
- package/dist/types-ts4.5/plugins/card/ui/assets/url.d.ts +0 -3
- package/dist/types-ts4.5/plugins/card/ui/link-toolbar-button-group-options.d.ts +0 -5
- package/dist/types-ts4.5/plugins/card/ui/styled.d.ts +0 -3
- package/dist/types-ts4.5/plugins/card/ui/types.d.ts +0 -12
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.toolbarKey = exports.toolbarButtonsPlugin = exports.prependToolbarButtons = void 0;
|
|
7
|
+
var _prosemirrorState = require("prosemirror-state");
|
|
8
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
9
|
+
var toolbarKey = new _prosemirrorState.PluginKey('hyperlinkToolbarItems');
|
|
10
|
+
exports.toolbarKey = toolbarKey;
|
|
11
|
+
var prependToolbarButtons = function prependToolbarButtons(_ref) {
|
|
12
|
+
var items = _ref.items,
|
|
13
|
+
onEscapeCallback = _ref.onEscapeCallback,
|
|
14
|
+
view = _ref.view;
|
|
15
|
+
var tr = view.state.tr,
|
|
16
|
+
dispatch = view.dispatch;
|
|
17
|
+
tr.setMeta(toolbarKey, {
|
|
18
|
+
items: items,
|
|
19
|
+
onEscapeCallback: onEscapeCallback
|
|
20
|
+
});
|
|
21
|
+
dispatch(tr);
|
|
22
|
+
};
|
|
23
|
+
exports.prependToolbarButtons = prependToolbarButtons;
|
|
24
|
+
var toolbarButtonsPlugin = function toolbarButtonsPlugin() {
|
|
25
|
+
return new _safePlugin.SafePlugin({
|
|
26
|
+
key: toolbarKey,
|
|
27
|
+
state: {
|
|
28
|
+
init: function init(_, state) {
|
|
29
|
+
return undefined;
|
|
30
|
+
},
|
|
31
|
+
apply: function apply(tr, pluginState) {
|
|
32
|
+
var metaState = tr.getMeta(toolbarKey);
|
|
33
|
+
if (metaState) {
|
|
34
|
+
return metaState;
|
|
35
|
+
}
|
|
36
|
+
return pluginState;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
exports.toolbarButtonsPlugin = toolbarButtonsPlugin;
|
|
@@ -10,8 +10,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _linkPicker = require("@atlaskit/link-picker");
|
|
13
|
-
var _actions = require("../../../card/pm-plugins/actions");
|
|
14
13
|
var _commands = require("../../commands");
|
|
14
|
+
var _toolbarButtons = require("../../pm-plugins/toolbar-buttons");
|
|
15
15
|
var _useEscapeClickaway = require("./useEscapeClickaway");
|
|
16
16
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
17
17
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
@@ -52,8 +52,11 @@ var EditorLinkPicker = function EditorLinkPicker(_ref) {
|
|
|
52
52
|
};
|
|
53
53
|
}, []);
|
|
54
54
|
var onEscape = (0, _react.useCallback)(function () {
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
var _toolbarKey$getState, _toolbarKey$getState$;
|
|
56
|
+
var tr = view.state.tr;
|
|
57
|
+
(0, _commands.hideLinkToolbarSetMeta)(tr);
|
|
58
|
+
(_toolbarKey$getState = _toolbarButtons.toolbarKey.getState(view.state)) === null || _toolbarKey$getState === void 0 ? void 0 : (_toolbarKey$getState$ = _toolbarKey$getState.onEscapeCallback) === null || _toolbarKey$getState$ === void 0 ? void 0 : _toolbarKey$getState$.call(_toolbarKey$getState, tr);
|
|
59
|
+
view.dispatch(tr);
|
|
57
60
|
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
58
61
|
}, [view, onCancel]);
|
|
59
62
|
var onClickAway = (0, _react.useCallback)(function () {
|
|
@@ -29,7 +29,7 @@ var _ = _interopRequireDefault(require("@atlaskit/icon-object/glyph/page/16"));
|
|
|
29
29
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
30
30
|
var _reactIntlNext = require("react-intl-next");
|
|
31
31
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
32
|
-
var _messages = require("
|
|
32
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
33
33
|
var _PanelTextInput = _interopRequireDefault(require("../../../../ui/PanelTextInput"));
|
|
34
34
|
var _LinkSearchList = _interopRequireDefault(require("../../../../ui/LinkSearch/LinkSearchList"));
|
|
35
35
|
var _ToolbarComponents = require("../../../../ui/LinkSearch/ToolbarComponents");
|
|
@@ -39,10 +39,10 @@ var _array = require("../../../../utils/array");
|
|
|
39
39
|
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
40
40
|
var _utils2 = require("./utils");
|
|
41
41
|
var _commands = require("../../commands");
|
|
42
|
-
var _actions = require("../../../card/pm-plugins/actions");
|
|
43
42
|
var _styles = require("../../styles");
|
|
44
43
|
var _transformTimeStamp = require("../../../../ui/LinkSearch/transformTimeStamp");
|
|
45
44
|
var _announcer = _interopRequireDefault(require("../../../../utils/announcer/announcer"));
|
|
45
|
+
var _toolbarButtons = require("../../pm-plugins/toolbar-buttons");
|
|
46
46
|
var _templateObject, _templateObject2, _templateObject3;
|
|
47
47
|
/** @jsx jsx */
|
|
48
48
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -509,10 +509,14 @@ var HyperlinkLinkAddToolbar = /*#__PURE__*/function (_PureComponent) {
|
|
|
509
509
|
var KEY_CODE_ARROW_DOWN = 40;
|
|
510
510
|
var KEY_CODE_ARROW_UP = 38;
|
|
511
511
|
if (keyCode === KEY_CODE_ESCAPE) {
|
|
512
|
+
var _toolbarKey$getState, _toolbarKey$getState$;
|
|
512
513
|
// escape
|
|
513
514
|
event.preventDefault();
|
|
514
|
-
|
|
515
|
-
|
|
515
|
+
var tr = view.state.tr,
|
|
516
|
+
dispatch = view.dispatch;
|
|
517
|
+
(0, _commands.hideLinkToolbarSetMeta)(tr);
|
|
518
|
+
(_toolbarKey$getState = _toolbarButtons.toolbarKey.getState(view.state)) === null || _toolbarKey$getState === void 0 ? void 0 : (_toolbarKey$getState$ = _toolbarKey$getState.onEscapeCallback) === null || _toolbarKey$getState$ === void 0 ? void 0 : _toolbarKey$getState$.call(_toolbarKey$getState, tr);
|
|
519
|
+
dispatch(tr);
|
|
516
520
|
return;
|
|
517
521
|
}
|
|
518
522
|
if (!items || !items.length) {
|
|
@@ -35,6 +35,7 @@ var _messages = require("../insert-block/ui/ToolbarInsertBlock/messages");
|
|
|
35
35
|
var _mediaNodeView = require("./nodeviews/mediaNodeView");
|
|
36
36
|
var _mediaInline = require("./nodeviews/mediaInline");
|
|
37
37
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
38
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
38
39
|
var _mediaSingle2 = require("./utils/media-single");
|
|
39
40
|
var mediaPlugin = function mediaPlugin() {
|
|
40
41
|
var _api$dependencies, _api$dependencies$fea;
|
|
@@ -58,7 +59,14 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
58
59
|
mediaFeatureFlags = _ref.featureFlags;
|
|
59
60
|
var captions = (0, _mediaCommon.getMediaFeatureFlag)('captions', mediaFeatureFlags);
|
|
60
61
|
var allowMediaInline = (0, _mediaCommon.getMediaFeatureFlag)('mediaInline', mediaFeatureFlags);
|
|
61
|
-
var
|
|
62
|
+
var mediaSingleOption = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.extended-resize-experience') ? {
|
|
63
|
+
withCaption: captions,
|
|
64
|
+
withExtendedWidthTypes: true
|
|
65
|
+
} : {
|
|
66
|
+
withCaption: captions,
|
|
67
|
+
withExtendedWidthTypes: false
|
|
68
|
+
};
|
|
69
|
+
var mediaSingleNode = (0, _adfSchema.mediaSingleSpec)(mediaSingleOption);
|
|
62
70
|
return [{
|
|
63
71
|
name: 'mediaGroup',
|
|
64
72
|
node: _adfSchema.mediaGroup
|
|
@@ -24,7 +24,7 @@ var _linking3 = require("../commands/linking");
|
|
|
24
24
|
var _linkingToolbarAppearance = require("./linking-toolbar-appearance");
|
|
25
25
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
26
26
|
var _mediaUi = require("@atlaskit/media-ui");
|
|
27
|
-
var _messages2 = require("
|
|
27
|
+
var _messages2 = require("@atlaskit/editor-common/messages");
|
|
28
28
|
var _filePreviewItem = require("./filePreviewItem");
|
|
29
29
|
var _utils = require("./utils");
|
|
30
30
|
var _commands = require("./commands");
|
|
@@ -55,7 +55,7 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
|
|
|
55
55
|
title: intl.formatMessage(_mediaUi.messages.changeView),
|
|
56
56
|
options: [{
|
|
57
57
|
id: 'editor.media.view.switcher.inline',
|
|
58
|
-
title: intl.formatMessage(_messages2.
|
|
58
|
+
title: intl.formatMessage(_messages2.cardMessages.inline),
|
|
59
59
|
selected: false,
|
|
60
60
|
disabled: false,
|
|
61
61
|
onClick: _commands.changeMediaCardToInline,
|
|
@@ -128,7 +128,7 @@ var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToo
|
|
|
128
128
|
title: intl.formatMessage(_mediaUi.messages.changeView),
|
|
129
129
|
options: [{
|
|
130
130
|
id: 'editor.media.view.switcher.inline',
|
|
131
|
-
title: intl.formatMessage(_messages2.
|
|
131
|
+
title: intl.formatMessage(_messages2.cardMessages.inline),
|
|
132
132
|
selected: true,
|
|
133
133
|
disabled: false,
|
|
134
134
|
onClick: function onClick() {
|
|
@@ -13,7 +13,7 @@ var _slice = require("../../../utils/slice");
|
|
|
13
13
|
var _dom = require("../../../utils/dom");
|
|
14
14
|
var _isImage = require("./is-image");
|
|
15
15
|
var _position = require("../../../utils/prosemirror/position");
|
|
16
|
-
var _selection = require("
|
|
16
|
+
var _selection = require("@atlaskit/editor-common/selection");
|
|
17
17
|
var _mediaClient = require("@atlaskit/media-client");
|
|
18
18
|
var isMediaBlobUrlFromAttrs = function isMediaBlobUrlFromAttrs(attrs) {
|
|
19
19
|
return !!(attrs && attrs.type === 'external' && (0, _mediaClient.isMediaBlobUrl)(attrs.url));
|
|
@@ -33,7 +33,6 @@ var _utils = require("@atlaskit/editor-tables/utils");
|
|
|
33
33
|
var _utils2 = require("../../utils");
|
|
34
34
|
var _slice = require("../../utils/slice");
|
|
35
35
|
var _analytics = require("../analytics");
|
|
36
|
-
var _doc = require("../card/pm-plugins/doc");
|
|
37
36
|
var _gapCursorSelection = require("../selection/gap-cursor-selection");
|
|
38
37
|
var _utils3 = require("@atlaskit/editor-common/utils");
|
|
39
38
|
var _macro = require("../macro");
|
|
@@ -63,7 +62,7 @@ function handleMention(slice, schema) {
|
|
|
63
62
|
return node;
|
|
64
63
|
});
|
|
65
64
|
}
|
|
66
|
-
function handlePasteIntoTaskOrDecisionOrPanel(slice) {
|
|
65
|
+
function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
|
|
67
66
|
return function (state, dispatch) {
|
|
68
67
|
var _slice$content$firstC, _transformedSlice$con;
|
|
69
68
|
var schema = state.schema,
|
|
@@ -128,7 +127,7 @@ function handlePasteIntoTaskOrDecisionOrPanel(slice) {
|
|
|
128
127
|
// This maintains both the selection (destination) and the slice (paste content).
|
|
129
128
|
(0, _prosemirrorUtils.safeInsert)(transformedSlice.content)(tr).scrollIntoView();
|
|
130
129
|
}
|
|
131
|
-
|
|
130
|
+
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 ? void 0 : queueCardsFromChangedTr(state, tr, _analytics.INPUT_METHOD.CLIPBOARD);
|
|
132
131
|
if (dispatch) {
|
|
133
132
|
dispatch(tr);
|
|
134
133
|
}
|
|
@@ -350,7 +349,7 @@ function handlePasteAsPlainText(slice, _event) {
|
|
|
350
349
|
return false;
|
|
351
350
|
};
|
|
352
351
|
}
|
|
353
|
-
function handlePastePreservingMarks(slice) {
|
|
352
|
+
function handlePastePreservingMarks(slice, queueCardsFromChangedTr) {
|
|
354
353
|
return function (state, dispatch) {
|
|
355
354
|
var schema = state.schema,
|
|
356
355
|
selection = state.tr.selection;
|
|
@@ -386,7 +385,7 @@ function handlePastePreservingMarks(slice) {
|
|
|
386
385
|
// special case for plainTextSlice & linkMark: merge into existing link
|
|
387
386
|
if (isPlainTextSlice && linkMark.isInSet(selectionMarks) && selectionMarks.length === 1) {
|
|
388
387
|
var tr = (0, _prosemirrorHistory.closeHistory)(state.tr).replaceSelectionWith(slice.content.firstChild.firstChild, true).setStoredMarks(selectionMarks).scrollIntoView();
|
|
389
|
-
|
|
388
|
+
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 ? void 0 : queueCardsFromChangedTr(state, tr, _analytics.INPUT_METHOD.CLIPBOARD);
|
|
390
389
|
if (dispatch) {
|
|
391
390
|
dispatch(tr);
|
|
392
391
|
}
|
|
@@ -398,7 +397,7 @@ function handlePastePreservingMarks(slice) {
|
|
|
398
397
|
if ((0, _util.hasOnlyNodesOfType)(bulletList, hardBreak, heading, listItem, paragraph, text, emoji, mention, orderedList)(slice)) {
|
|
399
398
|
var transformedSlice = (0, _util.applyTextMarksToSlice)(schema, selectionMarks)(slice);
|
|
400
399
|
var _tr2 = (0, _prosemirrorHistory.closeHistory)(state.tr).replaceSelection(transformedSlice).setStoredMarks(selectionMarks).scrollIntoView();
|
|
401
|
-
|
|
400
|
+
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 ? void 0 : queueCardsFromChangedTr(state, _tr2, _analytics.INPUT_METHOD.CLIPBOARD);
|
|
402
401
|
if (dispatch) {
|
|
403
402
|
dispatch(_tr2);
|
|
404
403
|
}
|
|
@@ -460,7 +459,7 @@ function insertAutoMacro(slice, macro, view, from, to) {
|
|
|
460
459
|
}
|
|
461
460
|
return false;
|
|
462
461
|
}
|
|
463
|
-
function handleMacroAutoConvert(text, slice, cardsOptions, extensionAutoConverter) {
|
|
462
|
+
function handleMacroAutoConvert(text, slice, queueCardsFromChangedTr, cardsOptions, extensionAutoConverter) {
|
|
464
463
|
return function (state, dispatch, view) {
|
|
465
464
|
var macro = null;
|
|
466
465
|
|
|
@@ -498,7 +497,7 @@ function handleMacroAutoConvert(text, slice, cardsOptions, extensionAutoConverte
|
|
|
498
497
|
var _getPastePluginState = (0, _pluginFactory.getPluginState)(view.state),
|
|
499
498
|
pastedMacroPositions = _getPastePluginState.pastedMacroPositions;
|
|
500
499
|
if (dispatch) {
|
|
501
|
-
handleMarkdown(slice, pastedMacroPositions[trackingFrom], pastedMacroPositions[trackingTo])(view.state, dispatch);
|
|
500
|
+
handleMarkdown(slice, queueCardsFromChangedTr, pastedMacroPositions[trackingFrom], pastedMacroPositions[trackingTo])(view.state, dispatch);
|
|
502
501
|
}
|
|
503
502
|
}).catch(function () {
|
|
504
503
|
var _getPastePluginState2 = (0, _pluginFactory.getPluginState)(view.state),
|
|
@@ -604,7 +603,7 @@ function handleExpandPasteInTable(slice) {
|
|
|
604
603
|
return false;
|
|
605
604
|
};
|
|
606
605
|
}
|
|
607
|
-
function handleMarkdown(markdownSlice, from, to) {
|
|
606
|
+
function handleMarkdown(markdownSlice, queueCardsFromChangedTr, from, to) {
|
|
608
607
|
return function (state, dispatch) {
|
|
609
608
|
var tr = (0, _prosemirrorHistory.closeHistory)(state.tr);
|
|
610
609
|
var pastesFrom = typeof from === 'number' ? from : tr.selection.from;
|
|
@@ -614,7 +613,7 @@ function handleMarkdown(markdownSlice, from, to) {
|
|
|
614
613
|
tr.replaceSelection(markdownSlice);
|
|
615
614
|
}
|
|
616
615
|
tr.setSelection(_prosemirrorState.TextSelection.near(tr.doc.resolve(pastesFrom + markdownSlice.size), -1));
|
|
617
|
-
|
|
616
|
+
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 ? void 0 : queueCardsFromChangedTr(state, tr, _analytics.INPUT_METHOD.CLIPBOARD);
|
|
618
617
|
if (dispatch) {
|
|
619
618
|
dispatch(tr.scrollIntoView());
|
|
620
619
|
}
|
|
@@ -766,7 +765,7 @@ function flattenNestedListInSlice(slice) {
|
|
|
766
765
|
var contentWithFlattenedList = slice.content.replaceChild(0, listToFlatten.type.createChecked(listToFlatten.attrs, leafListItems));
|
|
767
766
|
return new _prosemirrorModel.Slice(contentWithFlattenedList, slice.openEnd, slice.openEnd);
|
|
768
767
|
}
|
|
769
|
-
function handleRichText(slice) {
|
|
768
|
+
function handleRichText(slice, queueCardsFromChangedTr) {
|
|
770
769
|
return function (state, dispatch) {
|
|
771
770
|
var _slice$content, _slice$content2, _firstChildOfSlice$ty, _lastChildOfSlice$typ, _panelParentOverCurre;
|
|
772
771
|
var _state$schema$nodes3 = state.schema.nodes,
|
|
@@ -840,8 +839,9 @@ function handleRichText(slice) {
|
|
|
840
839
|
tr.scrollIntoView();
|
|
841
840
|
|
|
842
841
|
// queue link cards, ignoring any errors
|
|
842
|
+
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 ? void 0 : queueCardsFromChangedTr(state, tr, _analytics.INPUT_METHOD.CLIPBOARD);
|
|
843
843
|
if (dispatch) {
|
|
844
|
-
dispatch(
|
|
844
|
+
dispatch(tr);
|
|
845
845
|
}
|
|
846
846
|
return true;
|
|
847
847
|
};
|
|
@@ -20,7 +20,7 @@ var pastePlugin = function pastePlugin(_ref, api) {
|
|
|
20
20
|
providerFactory = _ref2.providerFactory,
|
|
21
21
|
dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
|
|
22
22
|
dispatch = _ref2.dispatch;
|
|
23
|
-
return (0, _main.createPlugin)(schema, dispatchAnalyticsEvent, dispatch, featureFlags, cardOptions, sanitizePrivateContent, providerFactory);
|
|
23
|
+
return (0, _main.createPlugin)(schema, dispatchAnalyticsEvent, dispatch, featureFlags, api, cardOptions, sanitizePrivateContent, providerFactory);
|
|
24
24
|
}
|
|
25
25
|
}];
|
|
26
26
|
}
|
|
@@ -238,10 +238,11 @@ var handlePasteAsPlainTextWithAnalytics = function handlePasteAsPlainTextWithAna
|
|
|
238
238
|
}))((0, _handlers.handlePasteAsPlainText)(slice, event));
|
|
239
239
|
};
|
|
240
240
|
exports.handlePasteAsPlainTextWithAnalytics = handlePasteAsPlainTextWithAnalytics;
|
|
241
|
-
var handlePasteIntoTaskAndDecisionWithAnalytics = function handlePasteIntoTaskAndDecisionWithAnalytics(view, event, slice, type) {
|
|
241
|
+
var handlePasteIntoTaskAndDecisionWithAnalytics = function handlePasteIntoTaskAndDecisionWithAnalytics(view, event, slice, type, pluginInjectionApi) {
|
|
242
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2;
|
|
242
243
|
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
243
244
|
type: type
|
|
244
|
-
}))((0, _handlers.handlePasteIntoTaskOrDecisionOrPanel)(slice));
|
|
245
|
+
}))((0, _handlers.handlePasteIntoTaskOrDecisionOrPanel)(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.actions) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.queueCardsFromChangedTr));
|
|
245
246
|
};
|
|
246
247
|
exports.handlePasteIntoTaskAndDecisionWithAnalytics = handlePasteIntoTaskAndDecisionWithAnalytics;
|
|
247
248
|
var handlePasteIntoCaptionWithAnalytics = function handlePasteIntoCaptionWithAnalytics(view, event, slice, type) {
|
|
@@ -262,22 +263,25 @@ var handleMediaSingleWithAnalytics = function handleMediaSingleWithAnalytics(vie
|
|
|
262
263
|
}))((0, _handlers.handleMediaSingle)(_analytics.INPUT_METHOD.CLIPBOARD)(slice));
|
|
263
264
|
};
|
|
264
265
|
exports.handleMediaSingleWithAnalytics = handleMediaSingleWithAnalytics;
|
|
265
|
-
var handlePastePreservingMarksWithAnalytics = function handlePastePreservingMarksWithAnalytics(view, event, slice, type) {
|
|
266
|
+
var handlePastePreservingMarksWithAnalytics = function handlePastePreservingMarksWithAnalytics(view, event, slice, type, pluginInjectionApi) {
|
|
267
|
+
var _pluginInjectionApi$d3, _pluginInjectionApi$d4;
|
|
266
268
|
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
267
269
|
type: type
|
|
268
|
-
}))((0, _handlers.handlePastePreservingMarks)(slice));
|
|
270
|
+
}))((0, _handlers.handlePastePreservingMarks)(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : (_pluginInjectionApi$d4 = _pluginInjectionApi$d3.actions) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.queueCardsFromChangedTr));
|
|
269
271
|
};
|
|
270
272
|
exports.handlePastePreservingMarksWithAnalytics = handlePastePreservingMarksWithAnalytics;
|
|
271
|
-
var handleMarkdownWithAnalytics = function handleMarkdownWithAnalytics(view, event, slice) {
|
|
273
|
+
var handleMarkdownWithAnalytics = function handleMarkdownWithAnalytics(view, event, slice, pluginInjectionApi) {
|
|
274
|
+
var _pluginInjectionApi$d5, _pluginInjectionApi$d6;
|
|
272
275
|
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
273
276
|
type: _analytics.PasteTypes.markdown
|
|
274
|
-
}))((0, _handlers.handleMarkdown)(slice));
|
|
277
|
+
}))((0, _handlers.handleMarkdown)(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d5 = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d5 === void 0 ? void 0 : (_pluginInjectionApi$d6 = _pluginInjectionApi$d5.actions) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : _pluginInjectionApi$d6.queueCardsFromChangedTr));
|
|
275
278
|
};
|
|
276
279
|
exports.handleMarkdownWithAnalytics = handleMarkdownWithAnalytics;
|
|
277
|
-
var handleRichTextWithAnalytics = function handleRichTextWithAnalytics(view, event, slice) {
|
|
280
|
+
var handleRichTextWithAnalytics = function handleRichTextWithAnalytics(view, event, slice, pluginInjectionApi) {
|
|
281
|
+
var _pluginInjectionApi$d7, _pluginInjectionApi$d8;
|
|
278
282
|
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
279
283
|
type: _analytics.PasteTypes.richText
|
|
280
|
-
}))((0, _handlers.handleRichText)(slice));
|
|
284
|
+
}))((0, _handlers.handleRichText)(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d7 = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d7 === void 0 ? void 0 : (_pluginInjectionApi$d8 = _pluginInjectionApi$d7.actions) === null || _pluginInjectionApi$d8 === void 0 ? void 0 : _pluginInjectionApi$d8.queueCardsFromChangedTr));
|
|
281
285
|
};
|
|
282
286
|
exports.handleRichTextWithAnalytics = handleRichTextWithAnalytics;
|
|
283
287
|
function injectAnalyticsPayloadBeforeCommand(createPayloadByTransaction) {
|
|
@@ -34,19 +34,18 @@ var _utils4 = require("../../../utils");
|
|
|
34
34
|
var _mediaCommon = require("../../media/utils/media-common");
|
|
35
35
|
var _transforms = require("../../list/transforms");
|
|
36
36
|
var _paste = require("@atlaskit/editor-common/paste");
|
|
37
|
-
var _utils5 = require("../../
|
|
38
|
-
var _utils6 = require("../../
|
|
39
|
-
var _utils7 = require("../../annotation/utils");
|
|
37
|
+
var _utils5 = require("../../tasks-and-decisions/utils");
|
|
38
|
+
var _utils6 = require("../../annotation/utils");
|
|
40
39
|
var _betterTypeHistory = require("../../base/pm-plugins/better-type-history");
|
|
41
40
|
var _clipboardTextSerializer = require("./clipboard-text-serializer");
|
|
42
41
|
var _tinyMCE = require("../util/tinyMCE");
|
|
43
|
-
var
|
|
42
|
+
var _utils7 = require("@atlaskit/editor-tables/utils");
|
|
44
43
|
var _step = require("../../../utils/step");
|
|
45
44
|
var _pluginFactory = require("./plugin-factory");
|
|
46
45
|
var _prosemirrorUtils = require("prosemirror-utils");
|
|
47
46
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
48
47
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
49
|
-
function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, cardOptions, sanitizePrivateContent, providerFactory) {
|
|
48
|
+
function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pluginInjectionApi, cardOptions, sanitizePrivateContent, providerFactory) {
|
|
50
49
|
var atlassianMarkDownParser = new _editorMarkdownTransformer.MarkdownTransformer(schema, _paste.md);
|
|
51
50
|
function getMarkdownSlice(text, openStart, openEnd) {
|
|
52
51
|
var textInput = text;
|
|
@@ -242,13 +241,14 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, ca
|
|
|
242
241
|
// force a "paste as plain text" action by clearing the markdownSlice.
|
|
243
242
|
markdownSlice = !((_markdownSlice = markdownSlice) !== null && _markdownSlice !== void 0 && _markdownSlice.size) ? undefined : markdownSlice;
|
|
244
243
|
if (markdownSlice) {
|
|
244
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2;
|
|
245
245
|
// linkify text prior to converting to macro
|
|
246
246
|
if ((0, _analytics.handlePasteLinkOnSelectedTextWithAnalytics)(view, event, markdownSlice, _analytics2.PasteTypes.markdown)(state, dispatch)) {
|
|
247
247
|
return true;
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
// run macro autoconvert prior to other conversions
|
|
251
|
-
if ((0, _handlers.handleMacroAutoConvert)(text, markdownSlice, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
251
|
+
if ((0, _handlers.handleMacroAutoConvert)(text, markdownSlice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.actions) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.queueCardsFromChangedTr, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
252
252
|
// TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
253
253
|
(0, _analytics.sendPasteAnalyticsEvent)(view, event, markdownSlice, {
|
|
254
254
|
type: _analytics2.PasteTypes.markdown
|
|
@@ -257,7 +257,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, ca
|
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
slice = (0,
|
|
260
|
+
slice = (0, _util.transformUnsupportedBlockCardToInline)(slice, state, cardOptions);
|
|
261
261
|
|
|
262
262
|
// Handles edge case so that when copying text from the top level of the document
|
|
263
263
|
// it can be pasted into nodes like panels/actions/decisions without removing them.
|
|
@@ -271,7 +271,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, ca
|
|
|
271
271
|
if (slice.openStart === 0 && selectionParentNode && edgeCaseNodeTypes.includes(selectionParentType)) {
|
|
272
272
|
slice.openStart = 1;
|
|
273
273
|
}
|
|
274
|
-
if ((0, _analytics.handlePasteIntoTaskAndDecisionWithAnalytics)(view, event, slice, isPlainText ? _analytics2.PasteTypes.plain : _analytics2.PasteTypes.richText)(state, dispatch)) {
|
|
274
|
+
if ((0, _analytics.handlePasteIntoTaskAndDecisionWithAnalytics)(view, event, slice, isPlainText ? _analytics2.PasteTypes.plain : _analytics2.PasteTypes.richText, pluginInjectionApi)(state, dispatch)) {
|
|
275
275
|
return true;
|
|
276
276
|
}
|
|
277
277
|
|
|
@@ -288,10 +288,10 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, ca
|
|
|
288
288
|
|
|
289
289
|
// If the clipboard only contains plain text, attempt to parse it as Markdown
|
|
290
290
|
if (isPlainText && markdownSlice) {
|
|
291
|
-
if ((0, _analytics.handlePastePreservingMarksWithAnalytics)(view, event, markdownSlice, _analytics2.PasteTypes.markdown)(state, dispatch)) {
|
|
291
|
+
if ((0, _analytics.handlePastePreservingMarksWithAnalytics)(view, event, markdownSlice, _analytics2.PasteTypes.markdown, pluginInjectionApi)(state, dispatch)) {
|
|
292
292
|
return true;
|
|
293
293
|
}
|
|
294
|
-
return (0, _analytics.handleMarkdownWithAnalytics)(view, event, markdownSlice)(state, dispatch);
|
|
294
|
+
return (0, _analytics.handleMarkdownWithAnalytics)(view, event, markdownSlice, pluginInjectionApi)(state, dispatch);
|
|
295
295
|
}
|
|
296
296
|
if (isRichText && (0, _utils4.isInsideBlockQuote)(state)) {
|
|
297
297
|
//If pasting inside blockquote
|
|
@@ -312,6 +312,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, ca
|
|
|
312
312
|
|
|
313
313
|
// finally, handle rich-text copy-paste
|
|
314
314
|
if (isRichText) {
|
|
315
|
+
var _pluginInjectionApi$d3, _pluginInjectionApi$d4;
|
|
315
316
|
// linkify the text where possible
|
|
316
317
|
slice = (0, _utils.linkifyContent)(state.schema)(slice);
|
|
317
318
|
if ((0, _analytics.handlePasteLinkOnSelectedTextWithAnalytics)(view, event, slice, _analytics2.PasteTypes.richText)(state, dispatch)) {
|
|
@@ -319,7 +320,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, ca
|
|
|
319
320
|
}
|
|
320
321
|
|
|
321
322
|
// run macro autoconvert prior to other conversions
|
|
322
|
-
if ((0, _handlers.handleMacroAutoConvert)(text, slice, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
323
|
+
if ((0, _handlers.handleMacroAutoConvert)(text, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : (_pluginInjectionApi$d4 = _pluginInjectionApi$d3.actions) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.queueCardsFromChangedTr, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
323
324
|
// TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
324
325
|
(0, _analytics.sendPasteAnalyticsEvent)(view, event, slice, {
|
|
325
326
|
type: _analytics2.PasteTypes.richText
|
|
@@ -329,7 +330,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, ca
|
|
|
329
330
|
|
|
330
331
|
// get editor-tables to handle pasting tables if it can
|
|
331
332
|
// otherwise, just the replace the selection with the content
|
|
332
|
-
if ((0,
|
|
333
|
+
if ((0, _utils7.handlePaste)(view, null, slice)) {
|
|
333
334
|
(0, _analytics.sendPasteAnalyticsEvent)(view, event, slice, {
|
|
334
335
|
type: _analytics2.PasteTypes.richText
|
|
335
336
|
});
|
|
@@ -338,12 +339,12 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, ca
|
|
|
338
339
|
|
|
339
340
|
// remove annotation marks from the pasted data if they are not present in the document
|
|
340
341
|
// for the cases when they are pasted from external pages
|
|
341
|
-
if (slice.content.size && (0,
|
|
342
|
-
(0,
|
|
342
|
+
if (slice.content.size && (0, _utils6.containsAnyAnnotations)(slice, state)) {
|
|
343
|
+
(0, _utils6.stripNonExistingAnnotations)(slice, state);
|
|
343
344
|
}
|
|
344
345
|
|
|
345
346
|
// ED-4732
|
|
346
|
-
if ((0, _analytics.handlePastePreservingMarksWithAnalytics)(view, event, slice, _analytics2.PasteTypes.richText)(state, dispatch)) {
|
|
347
|
+
if ((0, _analytics.handlePastePreservingMarksWithAnalytics)(view, event, slice, _analytics2.PasteTypes.richText, pluginInjectionApi)(state, dispatch)) {
|
|
347
348
|
return true;
|
|
348
349
|
}
|
|
349
350
|
|
|
@@ -381,7 +382,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, ca
|
|
|
381
382
|
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && (0, _analytics.handlePasteNonNestableBlockNodesIntoListWithAnalytics)(view, event, slice)(state, dispatch)) {
|
|
382
383
|
return true;
|
|
383
384
|
}
|
|
384
|
-
return (0, _analytics.handleRichTextWithAnalytics)(view, event, slice)(state, dispatch);
|
|
385
|
+
return (0, _analytics.handleRichTextWithAnalytics)(view, event, slice, pluginInjectionApi)(state, dispatch);
|
|
385
386
|
}
|
|
386
387
|
return false;
|
|
387
388
|
},
|
|
@@ -397,7 +398,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, ca
|
|
|
397
398
|
}
|
|
398
399
|
slice = (0, _utils3.transformSingleLineCodeBlockToCodeMark)(slice, schema);
|
|
399
400
|
slice = (0, _mediaCommon.transformSliceToCorrectMediaWrapper)(slice, schema);
|
|
400
|
-
slice = (0,
|
|
401
|
+
slice = (0, _utils5.transformSliceToDecisionList)(slice, schema);
|
|
401
402
|
|
|
402
403
|
// splitting linebreaks into paragraphs must happen before upgrading text to lists
|
|
403
404
|
slice = (0, _transforms.splitParagraphs)(slice, schema);
|
|
@@ -17,7 +17,7 @@ exports.isPanelNode = isPanelNode;
|
|
|
17
17
|
exports.isPastedFromExcel = isPastedFromExcel;
|
|
18
18
|
exports.isPastedFromWord = isPastedFromWord;
|
|
19
19
|
exports.isSelectionInsidePanel = isSelectionInsidePanel;
|
|
20
|
-
exports.removeDuplicateInvalidLinks = exports.isSingleLine = void 0;
|
|
20
|
+
exports.transformUnsupportedBlockCardToInline = exports.removeDuplicateInvalidLinks = exports.isSingleLine = void 0;
|
|
21
21
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
22
22
|
var _prosemirrorModel = require("prosemirror-model");
|
|
23
23
|
var _mediaClient = require("@atlaskit/media-client");
|
|
@@ -26,6 +26,7 @@ var _prosemirrorState = require("prosemirror-state");
|
|
|
26
26
|
var _prosemirrorUtils = require("prosemirror-utils");
|
|
27
27
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
28
28
|
var _sortByOrder = require("../../../create-editor/sort-by-order");
|
|
29
|
+
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
29
30
|
function isPastedFromWord(html) {
|
|
30
31
|
return !!html && html.indexOf('urn:schemas-microsoft-com:office:word') >= 0;
|
|
31
32
|
}
|
|
@@ -189,4 +190,30 @@ var addReplaceSelectedTableAnalytics = function addReplaceSelectedTableAnalytics
|
|
|
189
190
|
}
|
|
190
191
|
return state.tr;
|
|
191
192
|
};
|
|
192
|
-
exports.addReplaceSelectedTableAnalytics = addReplaceSelectedTableAnalytics;
|
|
193
|
+
exports.addReplaceSelectedTableAnalytics = addReplaceSelectedTableAnalytics;
|
|
194
|
+
var transformUnsupportedBlockCardToInline = function transformUnsupportedBlockCardToInline(slice, state, cardOptions) {
|
|
195
|
+
var _state$schema$nodes = state.schema.nodes,
|
|
196
|
+
blockCard = _state$schema$nodes.blockCard,
|
|
197
|
+
inlineCard = _state$schema$nodes.inlineCard;
|
|
198
|
+
var children = [];
|
|
199
|
+
(0, _utils2.mapChildren)(slice.content, function (node, i, frag) {
|
|
200
|
+
var _cardOptions$allowBlo;
|
|
201
|
+
if (node.type === blockCard && !isBlockCardSupported(state, frag, (_cardOptions$allowBlo = cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowBlockCards) !== null && _cardOptions$allowBlo !== void 0 ? _cardOptions$allowBlo : false)) {
|
|
202
|
+
children.push(inlineCard.createChecked(node.attrs, node.content, node.marks));
|
|
203
|
+
} else {
|
|
204
|
+
children.push(node);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
return new _prosemirrorModel.Slice(_prosemirrorModel.Fragment.fromArray(children), slice.openStart, slice.openEnd);
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* Function to determine if a block card is supported by the editor
|
|
211
|
+
* @param state
|
|
212
|
+
* @param frag
|
|
213
|
+
* @param allowBlockCards
|
|
214
|
+
* @returns
|
|
215
|
+
*/
|
|
216
|
+
exports.transformUnsupportedBlockCardToInline = transformUnsupportedBlockCardToInline;
|
|
217
|
+
var isBlockCardSupported = function isBlockCardSupported(state, frag, allowBlockCards) {
|
|
218
|
+
return allowBlockCards && (0, _utils2.isSupportedInParent)(state, frag);
|
|
219
|
+
};
|
|
@@ -35,9 +35,7 @@ var _style = require("../../plugins/media/pm-plugins/alt-text/style");
|
|
|
35
35
|
var _styles21 = require("../../plugins/find-replace/styles");
|
|
36
36
|
var _styles22 = require("../../plugins/tasks-and-decisions/styles");
|
|
37
37
|
var _styles23 = require("../../plugins/status/styles");
|
|
38
|
-
var _styles24 = require("../../plugins/
|
|
39
|
-
var _styles25 = require("../../plugins/date/styles");
|
|
40
|
-
var _styled = require("../../plugins/card/ui/styled");
|
|
38
|
+
var _styles24 = require("../../plugins/date/styles");
|
|
41
39
|
var _getInlineNodeViewProducer = require("../../nodeviews/getInlineNodeViewProducer.styles");
|
|
42
40
|
var _templateObject;
|
|
43
41
|
/** @jsx jsx */
|
|
@@ -46,7 +44,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
46
44
|
var contentStyles = function contentStyles(props) {
|
|
47
45
|
return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n outline: none;\n font-size: ", "px;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n }\n\n .ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n pointer-events: none;\n opacity: 0.7;\n }\n\n .ProseMirror-hideselection *::selection {\n background: transparent;\n }\n\n .ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n }\n\n .ProseMirror-selectednode {\n outline: none;\n }\n\n .ProseMirror-selectednode:empty {\n outline: 2px solid ", ";\n }\n\n ", "\n ", "\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n box-sizing: border-box;\n }\n\n .mediaGroupView-content-wrap ul {\n padding: 0;\n }\n\n /** Needed to override any cleared floats, e.g. image wrapping */\n\n div.fabric-editor-block-mark[class^='fabric-editor-align'] {\n clear: none !important;\n }\n\n .fabric-editor-align-end {\n text-align: right;\n }\n\n .fabric-editor-align-start {\n text-align: left;\n }\n\n .fabric-editor-align-center {\n text-align: center;\n }\n\n .pm-table-header-content-wrap :not(.fabric-editor-alignment),\n .pm-table-header-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark,\n .pm-table-cell-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark {\n p:first-of-type {\n margin-top: 0;\n }\n }\n\n .hyperlink-floating-toolbar,\n .", " {\n padding: 0;\n }\n\n /* Link icon in the Atlaskit package\n is bigger than the others\n */\n .hyperlink-open-link {\n svg {\n max-width: 18px;\n }\n &[href] {\n padding: 0 4px;\n }\n }\n"])), (0, _editorSharedStyles.editorFontSize)({
|
|
48
46
|
theme: props.theme
|
|
49
|
-
}), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)", _styles17.placeholderTextStyles, _styles5.placeholderStyles, (0, _styles7.codeBlockStyles)(props), (0, _styles6.blocktypeStyles)(props), (0, _styles16.textFormattingStyles)(props), _styles.textColorStyles, _styles8.listsStyles, (0, _styles9.ruleStyles)(props), _styles10.mediaStyles, (0, _styles11.layoutStyles)(props), _styles3.telepointerStyle, _styles4.gapCursorStyles, (0, _commonStyles.tableStyles)(props), (0, _styles12.panelStyles)(props), _styles13.fakeCursorStyles, _styles14.mentionsStyles, _styles15.emojiStyles, _styles.tasksAndDecisionsStyles, _styles.gridStyles, _styles18.linkStyles, _styles.blockMarksSharedStyles, _styles.dateSharedStyle, _styles19.extensionStyles, (0, _styles20.expandStyles)(props), _styles21.findReplaceStyles, _styles22.taskDecisionStyles, _styles23.statusStyles, (0, _styles.annotationSharedStyles)(props),
|
|
47
|
+
}), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)", _styles17.placeholderTextStyles, _styles5.placeholderStyles, (0, _styles7.codeBlockStyles)(props), (0, _styles6.blocktypeStyles)(props), (0, _styles16.textFormattingStyles)(props), _styles.textColorStyles, _styles8.listsStyles, (0, _styles9.ruleStyles)(props), _styles10.mediaStyles, (0, _styles11.layoutStyles)(props), _styles3.telepointerStyle, _styles4.gapCursorStyles, (0, _commonStyles.tableStyles)(props), (0, _styles12.panelStyles)(props), _styles13.fakeCursorStyles, _styles14.mentionsStyles, _styles15.emojiStyles, _styles.tasksAndDecisionsStyles, _styles.gridStyles, _styles18.linkStyles, _styles.blockMarksSharedStyles, _styles.dateSharedStyle, _styles19.extensionStyles, (0, _styles20.expandStyles)(props), _styles21.findReplaceStyles, _styles22.taskDecisionStyles, _styles23.statusStyles, (0, _styles.annotationSharedStyles)(props), _styles.smartCardStyles, _styles.smartCardSharedStyles, _styles24.dateStyles, _styles.embedCardStyles, _styles2.unsupportedStyles, _styles.resizerStyles, _style.ClassNames.FLOATING_TOOLBAR_COMPONENT);
|
|
50
48
|
};
|
|
51
49
|
var createEditorContentStyle = function createEditorContentStyle(styles) {
|
|
52
50
|
return /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "185.
|
|
9
|
+
var version = "185.8.0";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/cjs/version.json
CHANGED
|
@@ -4,9 +4,12 @@ import { createPlugin } from './pm-plugins/main';
|
|
|
4
4
|
import { floatingToolbar } from './toolbar';
|
|
5
5
|
import { EditorSmartCardEvents } from './ui/EditorSmartCardEvents';
|
|
6
6
|
import { cardKeymap } from './pm-plugins/keymap';
|
|
7
|
+
import { queueCardsFromChangedTr, changeSelectedCardToLink, setSelectedCardAppearance } from './pm-plugins/doc';
|
|
8
|
+
import { hideLinkToolbar } from './pm-plugins/actions';
|
|
7
9
|
import { EditorSmartCardEventsNext } from './ui/EditorSmartCardEventsNext';
|
|
8
10
|
import LayoutButton from './ui/LayoutButton';
|
|
9
11
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
12
|
+
import { mountHyperlinkPlugin } from './pm-plugins/mountHyperlink';
|
|
10
13
|
const cardPlugin = (options, api) => {
|
|
11
14
|
var _api$dependencies, _api$dependencies$fea;
|
|
12
15
|
const featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
|
|
@@ -51,6 +54,9 @@ const cardPlugin = (options, api) => {
|
|
|
51
54
|
allowWrapping,
|
|
52
55
|
allowAlignment
|
|
53
56
|
}, api)
|
|
57
|
+
}, {
|
|
58
|
+
name: 'cardHyperlink',
|
|
59
|
+
plugin: () => mountHyperlinkPlugin(api, options)
|
|
54
60
|
}];
|
|
55
61
|
plugins.push({
|
|
56
62
|
name: 'cardKeymap',
|
|
@@ -83,6 +89,12 @@ const cardPlugin = (options, api) => {
|
|
|
83
89
|
boundariesElement: popupsBoundariesElement
|
|
84
90
|
}));
|
|
85
91
|
},
|
|
92
|
+
actions: {
|
|
93
|
+
hideLinkToolbar,
|
|
94
|
+
queueCardsFromChangedTr,
|
|
95
|
+
changeSelectedCardToLink,
|
|
96
|
+
setSelectedCardAppearance
|
|
97
|
+
},
|
|
86
98
|
pluginsOptions: {
|
|
87
99
|
floatingToolbar: floatingToolbar(options, featureFlags, options.platform, options.linkPicker, api)
|
|
88
100
|
}
|
|
@@ -5,9 +5,8 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
7
7
|
import { DatasourceTableView } from '@atlaskit/link-datasource';
|
|
8
|
-
import { SmartCardSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
8
|
+
import { SmartCardSharedCssClassName, DATASOURCE_INNER_CONTAINER_CLASSNAME } from '@atlaskit/editor-common/styles';
|
|
9
9
|
import { calcBreakoutWidthPx } from '@atlaskit/editor-common/utils';
|
|
10
|
-
export const DATASOURCE_INNER_CONTAINER_CLASSNAME = 'datasourceView-content-inner-wrap';
|
|
11
10
|
const containerStyles = css({
|
|
12
11
|
height: '500px',
|
|
13
12
|
overflow: 'auto'
|
|
@@ -10,7 +10,8 @@ import reducer from './reducers';
|
|
|
10
10
|
import { handleProvider, resolveWithProvider } from './util/resolve';
|
|
11
11
|
import { getNewRequests, getPluginState, getPluginStateWithUpdatedPos } from './util/state';
|
|
12
12
|
import { createAnalyticsQueue, eventsFromTransaction } from './analytics';
|
|
13
|
-
import {
|
|
13
|
+
import { Datasource } from '../nodeviews/datasource';
|
|
14
|
+
import { DATASOURCE_INNER_CONTAINER_CLASSNAME } from '@atlaskit/editor-common/styles';
|
|
14
15
|
import { setDatasourceTableRef, setCardLayoutAndDatasourceTableRef } from './actions';
|
|
15
16
|
import { findDomRefAtPos } from 'prosemirror-utils';
|
|
16
17
|
export { pluginKey } from './plugin-key';
|