@atlaskit/editor-core 187.31.7 → 187.32.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 +33 -0
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +1 -1
- package/dist/cjs/plugins/analytics/plugin.js +14 -12
- package/dist/cjs/plugins/annotation/index.js +15 -13
- package/dist/cjs/plugins/avatar-group/index.js +16 -14
- package/dist/cjs/plugins/base/plugin.js +12 -10
- package/dist/cjs/plugins/before-primaryToolbar/index.js +3 -2
- package/dist/cjs/plugins/block-type/index.js +32 -30
- package/dist/cjs/plugins/breakout/index.js +10 -8
- package/dist/cjs/plugins/caption/index.js +7 -6
- package/dist/cjs/plugins/caption/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/code-bidi-warning/index.js +2 -4
- package/dist/cjs/plugins/code-block/index.js +14 -11
- package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +2 -2
- package/dist/cjs/plugins/collab-edit/index.js +16 -14
- package/dist/cjs/plugins/collab-edit/plugin.js +5 -5
- package/dist/cjs/plugins/date/index.js +18 -17
- package/dist/cjs/plugins/emoji/index.js +35 -33
- package/dist/cjs/plugins/expand/index.js +14 -13
- package/dist/cjs/plugins/extension/index.js +16 -15
- package/dist/cjs/plugins/extension/pm-plugins/main.js +4 -4
- package/dist/cjs/plugins/feedback-dialog/index.js +5 -4
- package/dist/cjs/plugins/find-replace/index.js +17 -15
- package/dist/cjs/plugins/floating-toolbar/index.js +31 -30
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +3 -3
- package/dist/cjs/plugins/help-dialog/index.js +18 -17
- package/dist/cjs/plugins/insert-block/index.js +52 -51
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +11 -11
- package/dist/cjs/plugins/layout/index.js +15 -14
- package/dist/cjs/plugins/max-content-size/index.js +4 -3
- package/dist/cjs/plugins/media/index.js +49 -47
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +2 -2
- package/dist/cjs/plugins/media/pm-plugins/main.js +7 -7
- package/dist/cjs/plugins/media/toolbar/index.js +29 -24
- package/dist/cjs/plugins/media/toolbar/linking.js +4 -4
- package/dist/cjs/plugins/media/toolbar/utils.js +22 -2
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +4 -4
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +2 -2
- package/dist/cjs/plugins/mentions/index.js +17 -15
- package/dist/cjs/plugins/panel/index.js +13 -12
- package/dist/cjs/plugins/paste/index.js +13 -10
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +8 -8
- package/dist/cjs/plugins/paste/pm-plugins/main.js +10 -10
- package/dist/cjs/plugins/placeholder/index.js +9 -7
- package/dist/cjs/plugins/placeholder-text/index.js +23 -16
- package/dist/cjs/plugins/quick-insert/index.js +13 -12
- package/dist/cjs/plugins/rule/index.js +8 -7
- package/dist/cjs/plugins/save-on-enter/index.js +4 -3
- package/dist/cjs/plugins/selection/index.js +5 -4
- package/dist/cjs/plugins/status/index.js +20 -14
- package/dist/cjs/plugins/submit-editor/index.js +4 -3
- package/dist/cjs/plugins/tasks-and-decisions/index.js +6 -5
- package/dist/cjs/plugins/text-color/index.js +17 -15
- package/dist/cjs/plugins/toolbar-lists-indentation/index.js +31 -26
- package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +1 -1
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -4
- package/dist/cjs/plugins/type-ahead/index.js +21 -20
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +11 -11
- package/dist/cjs/ui/ToolbarFeedback/index.js +1 -1
- package/dist/cjs/use-preset.js +2 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +1 -1
- package/dist/es2019/plugins/analytics/plugin.js +11 -8
- package/dist/es2019/plugins/annotation/index.js +4 -1
- package/dist/es2019/plugins/avatar-group/index.js +8 -5
- package/dist/es2019/plugins/base/plugin.js +6 -3
- package/dist/es2019/plugins/before-primaryToolbar/index.js +4 -2
- package/dist/es2019/plugins/block-type/index.js +14 -11
- package/dist/es2019/plugins/breakout/index.js +6 -3
- package/dist/es2019/plugins/caption/index.js +3 -1
- package/dist/es2019/plugins/caption/pm-plugins/main.js +2 -2
- package/dist/es2019/plugins/code-bidi-warning/index.js +2 -4
- package/dist/es2019/plugins/code-block/index.js +15 -9
- package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +2 -2
- package/dist/es2019/plugins/collab-edit/index.js +9 -6
- package/dist/es2019/plugins/collab-edit/plugin.js +5 -5
- package/dist/es2019/plugins/date/index.js +6 -3
- package/dist/es2019/plugins/emoji/index.js +16 -13
- package/dist/es2019/plugins/expand/index.js +7 -4
- package/dist/es2019/plugins/extension/index.js +11 -8
- package/dist/es2019/plugins/extension/pm-plugins/main.js +4 -4
- package/dist/es2019/plugins/feedback-dialog/index.js +4 -2
- package/dist/es2019/plugins/find-replace/index.js +8 -5
- package/dist/es2019/plugins/floating-toolbar/index.js +6 -4
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +3 -3
- package/dist/es2019/plugins/help-dialog/index.js +9 -6
- package/dist/es2019/plugins/insert-block/index.js +12 -9
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +11 -11
- package/dist/es2019/plugins/layout/index.js +8 -5
- package/dist/es2019/plugins/max-content-size/index.js +3 -1
- package/dist/es2019/plugins/media/index.js +14 -10
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +2 -2
- package/dist/es2019/plugins/media/pm-plugins/main.js +7 -7
- package/dist/es2019/plugins/media/toolbar/index.js +29 -25
- package/dist/es2019/plugins/media/toolbar/linking.js +4 -4
- package/dist/es2019/plugins/media/toolbar/utils.js +18 -0
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +4 -4
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +2 -2
- package/dist/es2019/plugins/mentions/index.js +9 -6
- package/dist/es2019/plugins/panel/index.js +5 -2
- package/dist/es2019/plugins/paste/index.js +9 -5
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +8 -8
- package/dist/es2019/plugins/paste/pm-plugins/main.js +10 -10
- package/dist/es2019/plugins/placeholder/index.js +10 -7
- package/dist/es2019/plugins/placeholder-text/index.js +12 -4
- package/dist/es2019/plugins/quick-insert/index.js +3 -1
- package/dist/es2019/plugins/rule/index.js +5 -3
- package/dist/es2019/plugins/save-on-enter/index.js +3 -1
- package/dist/es2019/plugins/selection/index.js +3 -1
- package/dist/es2019/plugins/status/index.js +11 -3
- package/dist/es2019/plugins/submit-editor/index.js +3 -1
- package/dist/es2019/plugins/tasks-and-decisions/index.js +6 -4
- package/dist/es2019/plugins/text-color/index.js +6 -3
- package/dist/es2019/plugins/toolbar-lists-indentation/index.js +9 -5
- package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +1 -1
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -4
- package/dist/es2019/plugins/type-ahead/index.js +3 -1
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +11 -11
- package/dist/es2019/ui/ToolbarFeedback/index.js +1 -1
- package/dist/es2019/use-preset.js +2 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/create-editor/ReactEditorViewInternal.js +1 -1
- package/dist/esm/plugins/analytics/plugin.js +14 -12
- package/dist/esm/plugins/annotation/index.js +15 -13
- package/dist/esm/plugins/avatar-group/index.js +16 -14
- package/dist/esm/plugins/base/plugin.js +12 -10
- package/dist/esm/plugins/before-primaryToolbar/index.js +3 -2
- package/dist/esm/plugins/block-type/index.js +32 -30
- package/dist/esm/plugins/breakout/index.js +10 -8
- package/dist/esm/plugins/caption/index.js +7 -6
- package/dist/esm/plugins/caption/pm-plugins/main.js +2 -2
- package/dist/esm/plugins/code-bidi-warning/index.js +2 -4
- package/dist/esm/plugins/code-block/index.js +14 -11
- package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +2 -2
- package/dist/esm/plugins/collab-edit/index.js +16 -14
- package/dist/esm/plugins/collab-edit/plugin.js +5 -5
- package/dist/esm/plugins/date/index.js +18 -17
- package/dist/esm/plugins/emoji/index.js +35 -33
- package/dist/esm/plugins/expand/index.js +14 -13
- package/dist/esm/plugins/extension/index.js +16 -15
- package/dist/esm/plugins/extension/pm-plugins/main.js +4 -4
- package/dist/esm/plugins/feedback-dialog/index.js +5 -4
- package/dist/esm/plugins/find-replace/index.js +17 -15
- package/dist/esm/plugins/floating-toolbar/index.js +31 -30
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +3 -3
- package/dist/esm/plugins/help-dialog/index.js +18 -17
- package/dist/esm/plugins/insert-block/index.js +52 -51
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +11 -11
- package/dist/esm/plugins/layout/index.js +15 -14
- package/dist/esm/plugins/max-content-size/index.js +4 -3
- package/dist/esm/plugins/media/index.js +49 -47
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +2 -2
- package/dist/esm/plugins/media/pm-plugins/main.js +7 -7
- package/dist/esm/plugins/media/toolbar/index.js +30 -25
- package/dist/esm/plugins/media/toolbar/linking.js +4 -4
- package/dist/esm/plugins/media/toolbar/utils.js +19 -0
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +4 -4
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +2 -2
- package/dist/esm/plugins/mentions/index.js +17 -15
- package/dist/esm/plugins/panel/index.js +13 -12
- package/dist/esm/plugins/paste/index.js +13 -10
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +8 -8
- package/dist/esm/plugins/paste/pm-plugins/main.js +10 -10
- package/dist/esm/plugins/placeholder/index.js +9 -7
- package/dist/esm/plugins/placeholder-text/index.js +23 -16
- package/dist/esm/plugins/quick-insert/index.js +13 -12
- package/dist/esm/plugins/rule/index.js +8 -7
- package/dist/esm/plugins/save-on-enter/index.js +4 -3
- package/dist/esm/plugins/selection/index.js +5 -4
- package/dist/esm/plugins/status/index.js +20 -14
- package/dist/esm/plugins/submit-editor/index.js +4 -3
- package/dist/esm/plugins/tasks-and-decisions/index.js +6 -5
- package/dist/esm/plugins/text-color/index.js +17 -15
- package/dist/esm/plugins/toolbar-lists-indentation/index.js +31 -26
- package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +1 -1
- package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -4
- package/dist/esm/plugins/type-ahead/index.js +21 -20
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +11 -11
- package/dist/esm/ui/ToolbarFeedback/index.js +1 -1
- package/dist/esm/use-preset.js +2 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/labs/next/presets/default.d.ts +62 -618
- package/dist/types/plugins/avatar-group/index.d.ts +1 -1
- package/dist/types/plugins/before-primaryToolbar/index.d.ts +1 -1
- package/dist/types/plugins/caption/index.d.ts +1 -1
- package/dist/types/plugins/media/toolbar/utils.d.ts +2 -1
- package/dist/types/plugins/media/types.d.ts +1 -0
- package/dist/types/plugins/selection/index.d.ts +2 -2
- package/dist/types/plugins/text-color/index.d.ts +3 -2
- package/dist/types/use-preset.d.ts +2 -2
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +96 -716
- package/dist/types-ts4.5/plugins/avatar-group/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/before-primaryToolbar/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/caption/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/toolbar/utils.d.ts +2 -1
- package/dist/types-ts4.5/plugins/media/types.d.ts +1 -0
- package/dist/types-ts4.5/plugins/selection/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/text-color/index.d.ts +3 -2
- package/dist/types-ts4.5/use-preset.d.ts +2 -2
- package/package.json +3 -3
|
@@ -125,8 +125,8 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
125
125
|
return _this.wrapper = wrapper;
|
|
126
126
|
});
|
|
127
127
|
_defineProperty(_assertThisInitialized(_this), "displayGuideline", function (guidelines) {
|
|
128
|
-
var _this$props$pluginInj, _this$props$pluginInj2, _this$props$pluginInj3
|
|
129
|
-
return (_this$props$pluginInj = _this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : (_this$props$pluginInj2 = _this$props$pluginInj.
|
|
128
|
+
var _this$props$pluginInj, _this$props$pluginInj2, _this$props$pluginInj3;
|
|
129
|
+
return (_this$props$pluginInj = _this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : (_this$props$pluginInj2 = _this$props$pluginInj.guideline) === null || _this$props$pluginInj2 === void 0 ? void 0 : (_this$props$pluginInj3 = _this$props$pluginInj2.actions) === null || _this$props$pluginInj3 === void 0 ? void 0 : _this$props$pluginInj3.displayGuideline(_this.props.view)({
|
|
130
130
|
guidelines: guidelines
|
|
131
131
|
});
|
|
132
132
|
});
|
|
@@ -156,8 +156,8 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
156
156
|
return Math.min(contentWidth || akEditorDefaultLayoutWidth, isVideoFile ? MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH : MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH);
|
|
157
157
|
}));
|
|
158
158
|
_defineProperty(_assertThisInitialized(_this), "getRelativeGuides", function () {
|
|
159
|
-
var _this$props$
|
|
160
|
-
var guidelinePluginState = (_this$props$
|
|
159
|
+
var _this$props$pluginInj4, _this$props$pluginInj5, _this$props$pluginInj6;
|
|
160
|
+
var guidelinePluginState = (_this$props$pluginInj4 = _this.props.pluginInjectionApi) === null || _this$props$pluginInj4 === void 0 ? void 0 : (_this$props$pluginInj5 = _this$props$pluginInj4.guideline) === null || _this$props$pluginInj5 === void 0 ? void 0 : (_this$props$pluginInj6 = _this$props$pluginInj5.sharedState) === null || _this$props$pluginInj6 === void 0 ? void 0 : _this$props$pluginInj6.currentState();
|
|
161
161
|
var _ref = (guidelinePluginState === null || guidelinePluginState === void 0 ? void 0 : guidelinePluginState.rect) || {
|
|
162
162
|
top: 0,
|
|
163
163
|
left: 0
|
|
@@ -36,11 +36,11 @@ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
|
|
|
36
36
|
isVideoFile: true
|
|
37
37
|
});
|
|
38
38
|
_defineProperty(_assertThisInitialized(_this), "displayGrid", function (visible, gridType, highlight) {
|
|
39
|
-
var _pluginInjectionApi$
|
|
39
|
+
var _pluginInjectionApi$g, _pluginInjectionApi$g2;
|
|
40
40
|
var _this$props = _this.props,
|
|
41
41
|
pluginInjectionApi = _this$props.pluginInjectionApi,
|
|
42
42
|
view = _this$props.view;
|
|
43
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
43
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$g = pluginInjectionApi.grid) === null || _pluginInjectionApi$g === void 0 ? void 0 : (_pluginInjectionApi$g2 = _pluginInjectionApi$g.actions) === null || _pluginInjectionApi$g2 === void 0 ? void 0 : _pluginInjectionApi$g2.displayGrid(view)({
|
|
44
44
|
visible: visible,
|
|
45
45
|
gridType: gridType,
|
|
46
46
|
highlight: highlight
|
|
@@ -18,12 +18,14 @@ var getSharedState = function getSharedState(editorState) {
|
|
|
18
18
|
}
|
|
19
19
|
return mentionPluginKey.getState(editorState);
|
|
20
20
|
};
|
|
21
|
-
var mentionsPlugin = function mentionsPlugin(
|
|
21
|
+
var mentionsPlugin = function mentionsPlugin(_ref) {
|
|
22
|
+
var options = _ref.config,
|
|
23
|
+
api = _ref.api;
|
|
22
24
|
var sessionId = uuid();
|
|
23
25
|
var fireEvent = function fireEvent(payload) {
|
|
24
|
-
var _api$
|
|
25
|
-
var
|
|
26
|
-
createAnalyticsEvent =
|
|
26
|
+
var _api$analytics$shared, _api$analytics;
|
|
27
|
+
var _ref2 = (_api$analytics$shared = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.sharedState.currentState()) !== null && _api$analytics$shared !== void 0 ? _api$analytics$shared : {},
|
|
28
|
+
createAnalyticsEvent = _ref2.createAnalyticsEvent;
|
|
27
29
|
if (!createAnalyticsEvent) {
|
|
28
30
|
return;
|
|
29
31
|
}
|
|
@@ -54,17 +56,17 @@ var mentionsPlugin = function mentionsPlugin(options, api) {
|
|
|
54
56
|
}
|
|
55
57
|
}];
|
|
56
58
|
},
|
|
57
|
-
secondaryToolbarComponent: function secondaryToolbarComponent(
|
|
58
|
-
var editorView =
|
|
59
|
-
disabled =
|
|
59
|
+
secondaryToolbarComponent: function secondaryToolbarComponent(_ref3) {
|
|
60
|
+
var editorView = _ref3.editorView,
|
|
61
|
+
disabled = _ref3.disabled;
|
|
60
62
|
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
61
63
|
editorView: editorView,
|
|
62
64
|
plugins: {
|
|
63
65
|
mentionState: mentionPluginKey
|
|
64
66
|
},
|
|
65
|
-
render: function render(
|
|
66
|
-
var
|
|
67
|
-
mentionState =
|
|
67
|
+
render: function render(_ref4) {
|
|
68
|
+
var _ref4$mentionState = _ref4.mentionState,
|
|
69
|
+
mentionState = _ref4$mentionState === void 0 ? {} : _ref4$mentionState;
|
|
68
70
|
return !mentionState.mentionProvider ? null : /*#__PURE__*/React.createElement(ToolbarMention, {
|
|
69
71
|
editorView: editorView,
|
|
70
72
|
isDisabled: disabled || isTypeAheadAllowed(editorView.state)
|
|
@@ -74,8 +76,8 @@ var mentionsPlugin = function mentionsPlugin(options, api) {
|
|
|
74
76
|
},
|
|
75
77
|
getSharedState: getSharedState,
|
|
76
78
|
pluginsOptions: {
|
|
77
|
-
quickInsert: function quickInsert(
|
|
78
|
-
var formatMessage =
|
|
79
|
+
quickInsert: function quickInsert(_ref5) {
|
|
80
|
+
var formatMessage = _ref5.formatMessage;
|
|
79
81
|
return [{
|
|
80
82
|
id: 'mention',
|
|
81
83
|
title: formatMessage(messages.mention),
|
|
@@ -87,19 +89,19 @@ var mentionsPlugin = function mentionsPlugin(options, api) {
|
|
|
87
89
|
return /*#__PURE__*/React.createElement(IconMention, null);
|
|
88
90
|
},
|
|
89
91
|
action: function action(insert, state) {
|
|
90
|
-
var _api$
|
|
92
|
+
var _api$analytics2;
|
|
91
93
|
var tr = insert(undefined);
|
|
92
94
|
var pluginState = getSharedState(state);
|
|
93
95
|
if (pluginState && pluginState.canInsertMention === false) {
|
|
94
96
|
return false;
|
|
95
97
|
}
|
|
96
|
-
api === null || api === void 0 ? void 0 : api.
|
|
98
|
+
api === null || api === void 0 ? void 0 : api.typeAhead.commands.openTypeAheadAtCursor({
|
|
97
99
|
triggerHandler: typeAhead,
|
|
98
100
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
99
101
|
})({
|
|
100
102
|
tr: tr
|
|
101
103
|
});
|
|
102
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
104
|
+
api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.attachAnalyticsEvent({
|
|
103
105
|
action: ACTION.INVOKED,
|
|
104
106
|
actionSubject: ACTION_SUBJECT.TYPEAHEAD,
|
|
105
107
|
actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_MENTION,
|
|
@@ -12,9 +12,10 @@ import { T50 } from '@atlaskit/theme/colors';
|
|
|
12
12
|
// Insertions via the drop down menu
|
|
13
13
|
// tslint-ignore-next-line
|
|
14
14
|
import { createWrapSelectionTransaction } from '../block-type/commands/block-type';
|
|
15
|
-
var panelPlugin = function panelPlugin() {
|
|
16
|
-
var
|
|
17
|
-
|
|
15
|
+
var panelPlugin = function panelPlugin(_ref) {
|
|
16
|
+
var _ref$config = _ref.config,
|
|
17
|
+
options = _ref$config === void 0 ? {} : _ref$config,
|
|
18
|
+
api = _ref.api;
|
|
18
19
|
return {
|
|
19
20
|
name: 'panel',
|
|
20
21
|
nodes: function nodes() {
|
|
@@ -27,9 +28,9 @@ var panelPlugin = function panelPlugin() {
|
|
|
27
28
|
pmPlugins: function pmPlugins() {
|
|
28
29
|
return [{
|
|
29
30
|
name: 'panel',
|
|
30
|
-
plugin: function plugin(
|
|
31
|
-
var providerFactory =
|
|
32
|
-
dispatch =
|
|
31
|
+
plugin: function plugin(_ref2) {
|
|
32
|
+
var providerFactory = _ref2.providerFactory,
|
|
33
|
+
dispatch = _ref2.dispatch;
|
|
33
34
|
return createPlugin(dispatch, providerFactory, options);
|
|
34
35
|
}
|
|
35
36
|
}, {
|
|
@@ -40,8 +41,8 @@ var panelPlugin = function panelPlugin() {
|
|
|
40
41
|
}];
|
|
41
42
|
},
|
|
42
43
|
pluginsOptions: {
|
|
43
|
-
quickInsert: function quickInsert(
|
|
44
|
-
var formatMessage =
|
|
44
|
+
quickInsert: function quickInsert(_ref3) {
|
|
45
|
+
var formatMessage = _ref3.formatMessage;
|
|
45
46
|
var quickInsertOptions = [{
|
|
46
47
|
id: 'infopanel',
|
|
47
48
|
title: formatMessage(messages.infoPanel),
|
|
@@ -153,7 +154,7 @@ var panelPlugin = function panelPlugin() {
|
|
|
153
154
|
return quickInsertOptions;
|
|
154
155
|
},
|
|
155
156
|
floatingToolbar: function floatingToolbar(state, intl, providerFactory) {
|
|
156
|
-
return getToolbarConfig(state, intl, options, providerFactory, api === null || api === void 0 ? void 0 : api.
|
|
157
|
+
return getToolbarConfig(state, intl, options, providerFactory, api === null || api === void 0 ? void 0 : api.decorations.actions.hoverDecoration);
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
};
|
|
@@ -171,9 +172,9 @@ var panelPlugin = function panelPlugin() {
|
|
|
171
172
|
* applyTransaction(tr);
|
|
172
173
|
* }
|
|
173
174
|
*/
|
|
174
|
-
function createPanelAction(
|
|
175
|
-
var state =
|
|
176
|
-
attributes =
|
|
175
|
+
function createPanelAction(_ref4) {
|
|
176
|
+
var state = _ref4.state,
|
|
177
|
+
attributes = _ref4.attributes;
|
|
177
178
|
var tr = createWrapSelectionTransaction({
|
|
178
179
|
state: state,
|
|
179
180
|
type: state.schema.nodes.panel,
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { createPlugin } from './pm-plugins/main';
|
|
2
|
-
var pastePlugin = function pastePlugin(_ref
|
|
3
|
-
var _api$
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
var
|
|
2
|
+
var pastePlugin = function pastePlugin(_ref) {
|
|
3
|
+
var _api$featureFlags;
|
|
4
|
+
var config = _ref.config,
|
|
5
|
+
api = _ref.api;
|
|
6
|
+
var _ref2 = config !== null && config !== void 0 ? config : {},
|
|
7
|
+
cardOptions = _ref2.cardOptions,
|
|
8
|
+
sanitizePrivateContent = _ref2.sanitizePrivateContent;
|
|
9
|
+
var featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
7
10
|
return {
|
|
8
11
|
name: 'paste',
|
|
9
12
|
pmPlugins: function pmPlugins() {
|
|
10
13
|
return [{
|
|
11
14
|
name: 'paste',
|
|
12
|
-
plugin: function plugin(
|
|
13
|
-
var schema =
|
|
14
|
-
providerFactory =
|
|
15
|
-
dispatchAnalyticsEvent =
|
|
16
|
-
dispatch =
|
|
15
|
+
plugin: function plugin(_ref3) {
|
|
16
|
+
var schema = _ref3.schema,
|
|
17
|
+
providerFactory = _ref3.providerFactory,
|
|
18
|
+
dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent,
|
|
19
|
+
dispatch = _ref3.dispatch;
|
|
17
20
|
return createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, api, cardOptions, sanitizePrivateContent, providerFactory);
|
|
18
21
|
}
|
|
19
22
|
}];
|
|
@@ -224,10 +224,10 @@ export var handlePasteAsPlainTextWithAnalytics = function handlePasteAsPlainText
|
|
|
224
224
|
}))(handlePasteAsPlainText(slice, event));
|
|
225
225
|
};
|
|
226
226
|
export var handlePasteIntoTaskAndDecisionWithAnalytics = function handlePasteIntoTaskAndDecisionWithAnalytics(view, event, slice, type, pluginInjectionApi) {
|
|
227
|
-
var _pluginInjectionApi$
|
|
227
|
+
var _pluginInjectionApi$c, _pluginInjectionApi$c2;
|
|
228
228
|
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
229
229
|
type: type
|
|
230
|
-
}))(handlePasteIntoTaskOrDecisionOrPanel(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
230
|
+
}))(handlePasteIntoTaskOrDecisionOrPanel(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 ? void 0 : (_pluginInjectionApi$c2 = _pluginInjectionApi$c.actions) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.queueCardsFromChangedTr));
|
|
231
231
|
};
|
|
232
232
|
export var handlePasteIntoCaptionWithAnalytics = function handlePasteIntoCaptionWithAnalytics(view, event, slice, type) {
|
|
233
233
|
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
@@ -245,22 +245,22 @@ export var handleMediaSingleWithAnalytics = function handleMediaSingleWithAnalyt
|
|
|
245
245
|
}))(handleMediaSingle(INPUT_METHOD.CLIPBOARD, editorAnalyticsAPI)(slice));
|
|
246
246
|
};
|
|
247
247
|
export var handlePastePreservingMarksWithAnalytics = function handlePastePreservingMarksWithAnalytics(view, event, slice, type, pluginInjectionApi) {
|
|
248
|
-
var _pluginInjectionApi$
|
|
248
|
+
var _pluginInjectionApi$c3, _pluginInjectionApi$c4;
|
|
249
249
|
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
250
250
|
type: type
|
|
251
|
-
}))(handlePastePreservingMarks(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
251
|
+
}))(handlePastePreservingMarks(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c3 = pluginInjectionApi.card) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : (_pluginInjectionApi$c4 = _pluginInjectionApi$c3.actions) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.queueCardsFromChangedTr));
|
|
252
252
|
};
|
|
253
253
|
export var handleMarkdownWithAnalytics = function handleMarkdownWithAnalytics(view, event, slice, pluginInjectionApi) {
|
|
254
|
-
var _pluginInjectionApi$
|
|
254
|
+
var _pluginInjectionApi$c5, _pluginInjectionApi$c6;
|
|
255
255
|
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
256
256
|
type: PasteTypes.markdown
|
|
257
|
-
}))(handleMarkdown(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
257
|
+
}))(handleMarkdown(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c5 = pluginInjectionApi.card) === null || _pluginInjectionApi$c5 === void 0 ? void 0 : (_pluginInjectionApi$c6 = _pluginInjectionApi$c5.actions) === null || _pluginInjectionApi$c6 === void 0 ? void 0 : _pluginInjectionApi$c6.queueCardsFromChangedTr));
|
|
258
258
|
};
|
|
259
259
|
export var handleRichTextWithAnalytics = function handleRichTextWithAnalytics(view, event, slice, pluginInjectionApi) {
|
|
260
|
-
var _pluginInjectionApi$
|
|
260
|
+
var _pluginInjectionApi$c7, _pluginInjectionApi$c8;
|
|
261
261
|
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
262
262
|
type: PasteTypes.richText
|
|
263
|
-
}))(handleRichText(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
263
|
+
}))(handleRichText(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c7 = pluginInjectionApi.card) === null || _pluginInjectionApi$c7 === void 0 ? void 0 : (_pluginInjectionApi$c8 = _pluginInjectionApi$c7.actions) === null || _pluginInjectionApi$c8 === void 0 ? void 0 : _pluginInjectionApi$c8.queueCardsFromChangedTr));
|
|
264
264
|
};
|
|
265
265
|
function injectAnalyticsPayloadBeforeCommand(createPayloadByTransaction) {
|
|
266
266
|
return function (mainCommand) {
|
|
@@ -102,7 +102,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
104
|
handlePaste: function handlePaste(view, rawEvent, slice) {
|
|
105
|
-
var _text, _analyticsPlugin$perf, _analyticsPlugin$perf2, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$
|
|
105
|
+
var _text, _analyticsPlugin$perf, _analyticsPlugin$perf2, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$a;
|
|
106
106
|
var event = rawEvent;
|
|
107
107
|
if (!event.clipboardData) {
|
|
108
108
|
return false;
|
|
@@ -197,9 +197,9 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
197
197
|
});
|
|
198
198
|
return tableExists;
|
|
199
199
|
});
|
|
200
|
-
if (!isPastingTextInsidePlaceholderText && !isPastingTable && !isPastingOverLayoutColumns && pluginInjectionApi !== null && pluginInjectionApi !== void 0 && pluginInjectionApi.
|
|
201
|
-
var _pluginInjectionApi$
|
|
202
|
-
tr = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
200
|
+
if (!isPastingTextInsidePlaceholderText && !isPastingTable && !isPastingOverLayoutColumns && pluginInjectionApi !== null && pluginInjectionApi !== void 0 && pluginInjectionApi.betterTypeHistory) {
|
|
201
|
+
var _pluginInjectionApi$b;
|
|
202
|
+
tr = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$b = pluginInjectionApi.betterTypeHistory) === null || _pluginInjectionApi$b === void 0 ? void 0 : _pluginInjectionApi$b.actions.flagPasteEvent(tr);
|
|
203
203
|
}
|
|
204
204
|
addLinkMetadata(view.state.selection, tr, {
|
|
205
205
|
action: isPlainText ? ACTION.PASTED_AS_PLAIN : ACTION.PASTED,
|
|
@@ -227,14 +227,14 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
227
227
|
// force a "paste as plain text" action by clearing the markdownSlice.
|
|
228
228
|
markdownSlice = !((_markdownSlice = markdownSlice) !== null && _markdownSlice !== void 0 && _markdownSlice.size) ? undefined : markdownSlice;
|
|
229
229
|
if (markdownSlice) {
|
|
230
|
-
var _pluginInjectionApi$
|
|
230
|
+
var _pluginInjectionApi$c, _pluginInjectionApi$c2;
|
|
231
231
|
// linkify text prior to converting to macro
|
|
232
232
|
if (handlePasteLinkOnSelectedTextWithAnalytics(view, event, markdownSlice, PasteTypes.markdown)(state, dispatch)) {
|
|
233
233
|
return true;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
// run macro autoconvert prior to other conversions
|
|
237
|
-
if (handleMacroAutoConvert(text, markdownSlice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
237
|
+
if (handleMacroAutoConvert(text, markdownSlice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 ? void 0 : (_pluginInjectionApi$c2 = _pluginInjectionApi$c.actions) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.queueCardsFromChangedTr, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
238
238
|
// TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
239
239
|
sendPasteAnalyticsEvent(view, event, markdownSlice, {
|
|
240
240
|
type: PasteTypes.markdown
|
|
@@ -266,7 +266,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
266
266
|
if (handleCodeBlockWithAnalytics(view, event, slice, text)(state, dispatch)) {
|
|
267
267
|
return true;
|
|
268
268
|
}
|
|
269
|
-
if (handleMediaSingleWithAnalytics(view, event, slice, isPastedFile ? PasteTypes.binary : PasteTypes.richText, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
269
|
+
if (handleMediaSingleWithAnalytics(view, event, slice, isPastedFile ? PasteTypes.binary : PasteTypes.richText, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(state, dispatch, view)) {
|
|
270
270
|
return true;
|
|
271
271
|
}
|
|
272
272
|
if (handleSelectedTableWithAnalytics(view, event, slice)(state, dispatch)) {
|
|
@@ -299,7 +299,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
299
299
|
|
|
300
300
|
// finally, handle rich-text copy-paste
|
|
301
301
|
if (isRichText) {
|
|
302
|
-
var _pluginInjectionApi$
|
|
302
|
+
var _pluginInjectionApi$c3, _pluginInjectionApi$c4, _pluginInjectionApi$l;
|
|
303
303
|
// linkify the text where possible
|
|
304
304
|
slice = linkifyContent(state.schema)(slice);
|
|
305
305
|
if (handlePasteLinkOnSelectedTextWithAnalytics(view, event, slice, PasteTypes.richText)(state, dispatch)) {
|
|
@@ -307,7 +307,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
// run macro autoconvert prior to other conversions
|
|
310
|
-
if (handleMacroAutoConvert(text, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
310
|
+
if (handleMacroAutoConvert(text, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c3 = pluginInjectionApi.card) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : (_pluginInjectionApi$c4 = _pluginInjectionApi$c3.actions) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.queueCardsFromChangedTr, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
311
311
|
// TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
312
312
|
sendPasteAnalyticsEvent(view, event, slice, {
|
|
313
313
|
type: PasteTypes.richText
|
|
@@ -364,7 +364,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
364
364
|
if (handlePasteIntoCaptionWithAnalytics(view, event, slice, PasteTypes.richText)(state, dispatch)) {
|
|
365
365
|
return true;
|
|
366
366
|
}
|
|
367
|
-
if (handlePastePanelOrDecisionIntoListWithAnalytics(view, event, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
367
|
+
if (handlePastePanelOrDecisionIntoListWithAnalytics(view, event, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$l = pluginInjectionApi.list) === null || _pluginInjectionApi$l === void 0 ? void 0 : _pluginInjectionApi$l.actions.findRootParentListNode)(state, dispatch)) {
|
|
368
368
|
return true;
|
|
369
369
|
}
|
|
370
370
|
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && handlePasteNonNestableBlockNodesIntoListWithAnalytics(view, event, slice)(state, dispatch)) {
|
|
@@ -73,13 +73,13 @@ export function createPlugin(defaultPlaceholderText, bracketPlaceholderText, api
|
|
|
73
73
|
key: pluginKey,
|
|
74
74
|
state: {
|
|
75
75
|
init: function init(_, state) {
|
|
76
|
-
var _api$
|
|
77
|
-
return createPlaceHolderStateFrom(Boolean(api === null || api === void 0 ? void 0 : (_api$
|
|
76
|
+
var _api$focus, _api$focus$sharedStat;
|
|
77
|
+
return createPlaceHolderStateFrom(Boolean(api === null || api === void 0 ? void 0 : (_api$focus = api.focus) === null || _api$focus === void 0 ? void 0 : (_api$focus$sharedStat = _api$focus.sharedState.currentState()) === null || _api$focus$sharedStat === void 0 ? void 0 : _api$focus$sharedStat.hasFocus), state, defaultPlaceholderText, bracketPlaceholderText);
|
|
78
78
|
},
|
|
79
79
|
apply: function apply(tr, _oldPluginState, _oldEditorState, newEditorState) {
|
|
80
|
-
var _api$
|
|
80
|
+
var _api$focus2, _api$focus2$sharedSta;
|
|
81
81
|
var meta = tr.getMeta(pluginKey);
|
|
82
|
-
var isEditorFocused = Boolean(api === null || api === void 0 ? void 0 : (_api$
|
|
82
|
+
var isEditorFocused = Boolean(api === null || api === void 0 ? void 0 : (_api$focus2 = api.focus) === null || _api$focus2 === void 0 ? void 0 : (_api$focus2$sharedSta = _api$focus2.sharedState.currentState()) === null || _api$focus2$sharedSta === void 0 ? void 0 : _api$focus2$sharedSta.hasFocus);
|
|
83
83
|
if (meta) {
|
|
84
84
|
if (meta.removePlaceholder) {
|
|
85
85
|
return emptyPlaceholder;
|
|
@@ -93,12 +93,12 @@ export function createPlugin(defaultPlaceholderText, bracketPlaceholderText, api
|
|
|
93
93
|
},
|
|
94
94
|
props: {
|
|
95
95
|
decorations: function decorations(editorState) {
|
|
96
|
-
var _api$
|
|
96
|
+
var _api$composition;
|
|
97
97
|
var _getPlaceholderState = getPlaceholderState(editorState),
|
|
98
98
|
hasPlaceholder = _getPlaceholderState.hasPlaceholder,
|
|
99
99
|
placeholderText = _getPlaceholderState.placeholderText,
|
|
100
100
|
pos = _getPlaceholderState.pos;
|
|
101
|
-
var compositionPluginState = api === null || api === void 0 ? void 0 : (_api$
|
|
101
|
+
var compositionPluginState = api === null || api === void 0 ? void 0 : (_api$composition = api.composition) === null || _api$composition === void 0 ? void 0 : _api$composition.sharedState.currentState();
|
|
102
102
|
if (hasPlaceholder && placeholderText && pos !== undefined && !(compositionPluginState !== null && compositionPluginState !== void 0 && compositionPluginState.isComposing)) {
|
|
103
103
|
return createPlaceholderDecoration(editorState, placeholderText, pos);
|
|
104
104
|
}
|
|
@@ -107,7 +107,9 @@ export function createPlugin(defaultPlaceholderText, bracketPlaceholderText, api
|
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
-
var placeholderPlugin = function placeholderPlugin(
|
|
110
|
+
var placeholderPlugin = function placeholderPlugin(_ref) {
|
|
111
|
+
var options = _ref.config,
|
|
112
|
+
api = _ref.api;
|
|
111
113
|
return {
|
|
112
114
|
name: 'placeholder',
|
|
113
115
|
pmPlugins: function pmPlugins() {
|
|
@@ -123,7 +123,8 @@ export function createPlugin(dispatch, options) {
|
|
|
123
123
|
}
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
|
-
var basePlaceholderTextPlugin = function basePlaceholderTextPlugin(
|
|
126
|
+
var basePlaceholderTextPlugin = function basePlaceholderTextPlugin(_ref) {
|
|
127
|
+
var options = _ref.config;
|
|
127
128
|
return {
|
|
128
129
|
name: 'placeholderText',
|
|
129
130
|
nodes: function nodes() {
|
|
@@ -135,16 +136,16 @@ var basePlaceholderTextPlugin = function basePlaceholderTextPlugin(options) {
|
|
|
135
136
|
pmPlugins: function pmPlugins() {
|
|
136
137
|
return [{
|
|
137
138
|
name: 'placeholderText',
|
|
138
|
-
plugin: function plugin(
|
|
139
|
-
var dispatch =
|
|
139
|
+
plugin: function plugin(_ref2) {
|
|
140
|
+
var dispatch = _ref2.dispatch;
|
|
140
141
|
return createPlugin(dispatch, options);
|
|
141
142
|
}
|
|
142
143
|
}];
|
|
143
144
|
},
|
|
144
|
-
contentComponent: function contentComponent(
|
|
145
|
-
var editorView =
|
|
146
|
-
popupsMountPoint =
|
|
147
|
-
popupsBoundariesElement =
|
|
145
|
+
contentComponent: function contentComponent(_ref3) {
|
|
146
|
+
var editorView = _ref3.editorView,
|
|
147
|
+
popupsMountPoint = _ref3.popupsMountPoint,
|
|
148
|
+
popupsBoundariesElement = _ref3.popupsBoundariesElement;
|
|
148
149
|
var insertPlaceholderText = function insertPlaceholderText(value) {
|
|
149
150
|
return insertPlaceholderTextAtSelection(value)(editorView.state, editorView.dispatch);
|
|
150
151
|
};
|
|
@@ -164,9 +165,9 @@ var basePlaceholderTextPlugin = function basePlaceholderTextPlugin(options) {
|
|
|
164
165
|
plugins: {
|
|
165
166
|
placeholderTextState: pluginKey
|
|
166
167
|
},
|
|
167
|
-
render: function render(
|
|
168
|
-
var
|
|
169
|
-
placeholderTextState =
|
|
168
|
+
render: function render(_ref4) {
|
|
169
|
+
var _ref4$placeholderText = _ref4.placeholderTextState,
|
|
170
|
+
placeholderTextState = _ref4$placeholderText === void 0 ? {} : _ref4$placeholderText;
|
|
170
171
|
if (placeholderTextState.showInsertPanelAt) {
|
|
171
172
|
return /*#__PURE__*/React.createElement(PlaceholderFloatingToolbar, {
|
|
172
173
|
editorViewDOM: editorView.dom,
|
|
@@ -191,8 +192,8 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
|
|
|
191
192
|
return plugin;
|
|
192
193
|
}
|
|
193
194
|
plugin.pluginsOptions = {
|
|
194
|
-
quickInsert: function quickInsert(
|
|
195
|
-
var formatMessage =
|
|
195
|
+
quickInsert: function quickInsert(_ref5) {
|
|
196
|
+
var formatMessage = _ref5.formatMessage;
|
|
196
197
|
return [{
|
|
197
198
|
id: 'placeholderText',
|
|
198
199
|
title: formatMessage(messages.placeholderText),
|
|
@@ -205,12 +206,12 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
|
|
|
205
206
|
});
|
|
206
207
|
},
|
|
207
208
|
action: function action(insert, state) {
|
|
208
|
-
var _api$
|
|
209
|
+
var _api$analytics;
|
|
209
210
|
var tr = state.tr;
|
|
210
211
|
tr.setMeta(pluginKey, {
|
|
211
212
|
showInsertPanelAt: tr.selection.anchor
|
|
212
213
|
});
|
|
213
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
214
|
+
api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.attachAnalyticsEvent({
|
|
214
215
|
action: ACTION.INSERTED,
|
|
215
216
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
216
217
|
actionSubjectId: ACTION_SUBJECT_ID.PLACEHOLDER_TEXT,
|
|
@@ -226,7 +227,13 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
|
|
|
226
227
|
};
|
|
227
228
|
return plugin;
|
|
228
229
|
};
|
|
229
|
-
var placeholderTextPlugin = function placeholderTextPlugin(
|
|
230
|
-
|
|
230
|
+
var placeholderTextPlugin = function placeholderTextPlugin(_ref6) {
|
|
231
|
+
var _ref6$config = _ref6.config,
|
|
232
|
+
options = _ref6$config === void 0 ? {} : _ref6$config,
|
|
233
|
+
api = _ref6.api;
|
|
234
|
+
return decorateWithPluginOptions(basePlaceholderTextPlugin({
|
|
235
|
+
config: options,
|
|
236
|
+
api: api
|
|
237
|
+
}), options, api);
|
|
231
238
|
};
|
|
232
239
|
export default placeholderTextPlugin;
|
|
@@ -11,17 +11,18 @@ import { search } from './search';
|
|
|
11
11
|
import ModalElementBrowser from './ui/ModalElementBrowser';
|
|
12
12
|
import { openElementBrowserModal, insertItem } from './commands';
|
|
13
13
|
import { memoProcessQuickInsertItems, getQuickInsertSuggestions } from '@atlaskit/editor-common/quick-insert';
|
|
14
|
-
var quickInsertPlugin = function quickInsertPlugin(
|
|
14
|
+
var quickInsertPlugin = function quickInsertPlugin(_ref) {
|
|
15
|
+
var options = _ref.config;
|
|
15
16
|
return {
|
|
16
17
|
name: 'quickInsert',
|
|
17
18
|
pmPlugins: function pmPlugins(defaultItems) {
|
|
18
19
|
return [{
|
|
19
20
|
name: 'quickInsert',
|
|
20
21
|
// It's important that this plugin is above TypeAheadPlugin
|
|
21
|
-
plugin: function plugin(
|
|
22
|
-
var providerFactory =
|
|
23
|
-
getIntl =
|
|
24
|
-
dispatch =
|
|
22
|
+
plugin: function plugin(_ref2) {
|
|
23
|
+
var providerFactory = _ref2.providerFactory,
|
|
24
|
+
getIntl = _ref2.getIntl,
|
|
25
|
+
dispatch = _ref2.dispatch;
|
|
25
26
|
return quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispatch, options === null || options === void 0 ? void 0 : options.emptyStateHandler);
|
|
26
27
|
}
|
|
27
28
|
}];
|
|
@@ -31,9 +32,9 @@ var quickInsertPlugin = function quickInsertPlugin(options) {
|
|
|
31
32
|
id: TypeAheadAvailableNodes.QUICK_INSERT,
|
|
32
33
|
trigger: '/',
|
|
33
34
|
headless: options === null || options === void 0 ? void 0 : options.headless,
|
|
34
|
-
getItems: function getItems(
|
|
35
|
-
var query =
|
|
36
|
-
editorState =
|
|
35
|
+
getItems: function getItems(_ref3) {
|
|
36
|
+
var query = _ref3.query,
|
|
37
|
+
editorState = _ref3.editorState;
|
|
37
38
|
var quickInsertState = pluginKey.getState(editorState);
|
|
38
39
|
return Promise.resolve(getQuickInsertSuggestions({
|
|
39
40
|
searchOptions: {
|
|
@@ -49,8 +50,8 @@ var quickInsertPlugin = function quickInsertPlugin(options) {
|
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
},
|
|
52
|
-
contentComponent: function contentComponent(
|
|
53
|
-
var editorView =
|
|
53
|
+
contentComponent: function contentComponent(_ref4) {
|
|
54
|
+
var editorView = _ref4.editorView;
|
|
54
55
|
if (options !== null && options !== void 0 && options.enableElementBrowser) {
|
|
55
56
|
return /*#__PURE__*/React.createElement(ModalElementBrowser, {
|
|
56
57
|
editorView: editorView,
|
|
@@ -134,7 +135,7 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
|
|
|
134
135
|
},
|
|
135
136
|
view: function view(editorView) {
|
|
136
137
|
var providerHandler = /*#__PURE__*/function () {
|
|
137
|
-
var
|
|
138
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_name, providerPromise) {
|
|
138
139
|
var provider, providedItems;
|
|
139
140
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
140
141
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -170,7 +171,7 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
|
|
|
170
171
|
}, _callee, null, [[1, 11]]);
|
|
171
172
|
}));
|
|
172
173
|
return function providerHandler(_x, _x2) {
|
|
173
|
-
return
|
|
174
|
+
return _ref5.apply(this, arguments);
|
|
174
175
|
};
|
|
175
176
|
}();
|
|
176
177
|
providerFactory.subscribe('quickInsertProvider', providerHandler);
|
|
@@ -5,9 +5,10 @@ import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
|
5
5
|
import { IconDivider } from '@atlaskit/editor-common/quick-insert';
|
|
6
6
|
import inputRulePlugin from './pm-plugins/input-rule';
|
|
7
7
|
import keymapPlugin from './pm-plugins/keymap';
|
|
8
|
-
var rulePlugin = function rulePlugin(
|
|
9
|
-
var _api$
|
|
10
|
-
var
|
|
8
|
+
var rulePlugin = function rulePlugin(_ref) {
|
|
9
|
+
var _api$featureFlags;
|
|
10
|
+
var api = _ref.api;
|
|
11
|
+
var featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
11
12
|
return {
|
|
12
13
|
name: 'rule',
|
|
13
14
|
nodes: function nodes() {
|
|
@@ -19,8 +20,8 @@ var rulePlugin = function rulePlugin(_, api) {
|
|
|
19
20
|
pmPlugins: function pmPlugins() {
|
|
20
21
|
return [{
|
|
21
22
|
name: 'ruleInputRule',
|
|
22
|
-
plugin: function plugin(
|
|
23
|
-
var schema =
|
|
23
|
+
plugin: function plugin(_ref2) {
|
|
24
|
+
var schema = _ref2.schema;
|
|
24
25
|
return inputRulePlugin(schema, featureFlags);
|
|
25
26
|
}
|
|
26
27
|
}, {
|
|
@@ -31,8 +32,8 @@ var rulePlugin = function rulePlugin(_, api) {
|
|
|
31
32
|
}];
|
|
32
33
|
},
|
|
33
34
|
pluginsOptions: {
|
|
34
|
-
quickInsert: function quickInsert(
|
|
35
|
-
var formatMessage =
|
|
35
|
+
quickInsert: function quickInsert(_ref3) {
|
|
36
|
+
var formatMessage = _ref3.formatMessage;
|
|
36
37
|
return [{
|
|
37
38
|
id: 'rule',
|
|
38
39
|
title: formatMessage(messages.horizontalRule),
|
|
@@ -45,14 +45,15 @@ var analyticsPayload = function analyticsPayload(state) {
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
|
-
var saveOnEnterPlugin = function saveOnEnterPlugin(
|
|
48
|
+
var saveOnEnterPlugin = function saveOnEnterPlugin(_ref2) {
|
|
49
|
+
var onSave = _ref2.config;
|
|
49
50
|
return {
|
|
50
51
|
name: 'saveOnEnter',
|
|
51
52
|
pmPlugins: function pmPlugins() {
|
|
52
53
|
return [{
|
|
53
54
|
name: 'saveOnEnter',
|
|
54
|
-
plugin: function plugin(
|
|
55
|
-
var dispatch =
|
|
55
|
+
plugin: function plugin(_ref3) {
|
|
56
|
+
var dispatch = _ref3.dispatch;
|
|
56
57
|
return createPlugin(dispatch, onSave);
|
|
57
58
|
}
|
|
58
59
|
}];
|
|
@@ -2,15 +2,16 @@ import { createPlugin } from './pm-plugins/selection-main';
|
|
|
2
2
|
import selectionKeymapPlugin from './pm-plugins/keymap';
|
|
3
3
|
import gapCursorPlugin from './pm-plugins/gap-cursor-main';
|
|
4
4
|
import gapCursorKeymapPlugin from './pm-plugins/gap-cursor-keymap';
|
|
5
|
-
export var selectionPlugin = function selectionPlugin(
|
|
5
|
+
export var selectionPlugin = function selectionPlugin(_ref) {
|
|
6
|
+
var options = _ref.config;
|
|
6
7
|
return {
|
|
7
8
|
name: 'selection',
|
|
8
9
|
pmPlugins: function pmPlugins() {
|
|
9
10
|
return [{
|
|
10
11
|
name: 'selection',
|
|
11
|
-
plugin: function plugin(
|
|
12
|
-
var dispatch =
|
|
13
|
-
dispatchAnalyticsEvent =
|
|
12
|
+
plugin: function plugin(_ref2) {
|
|
13
|
+
var dispatch = _ref2.dispatch,
|
|
14
|
+
dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent;
|
|
14
15
|
return createPlugin(dispatch, dispatchAnalyticsEvent, options);
|
|
15
16
|
}
|
|
16
17
|
}, {
|