@atlaskit/editor-core 187.31.7 → 187.32.1
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 +40 -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/ScrollButtons.js +29 -24
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +5 -5
- 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/media/utils/media-single.js +19 -4
- 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/ScrollButtons.js +9 -4
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +4 -4
- 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/media/utils/media-single.js +22 -4
- 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/ScrollButtons.js +28 -23
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +4 -4
- 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/media/utils/media-single.js +19 -4
- 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/floating-toolbar/ui/ScrollButtons.d.ts +3 -3
- package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +1 -2
- 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/floating-toolbar/ui/ScrollButtons.d.ts +3 -3
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +1 -2
- 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
|
@@ -81,7 +81,10 @@ const blockquotePluginOptions = ({
|
|
|
81
81
|
}
|
|
82
82
|
}];
|
|
83
83
|
};
|
|
84
|
-
const blockTypePlugin = (
|
|
84
|
+
const blockTypePlugin = ({
|
|
85
|
+
config: options,
|
|
86
|
+
api
|
|
87
|
+
}) => ({
|
|
85
88
|
name: 'blockType',
|
|
86
89
|
nodes() {
|
|
87
90
|
const nodes = [{
|
|
@@ -106,8 +109,8 @@ const blockTypePlugin = (options, api) => ({
|
|
|
106
109
|
plugin: ({
|
|
107
110
|
dispatch
|
|
108
111
|
}) => {
|
|
109
|
-
var _api$
|
|
110
|
-
return createPlugin(api === null || api === void 0 ? void 0 : (_api$
|
|
112
|
+
var _api$analytics;
|
|
113
|
+
return createPlugin(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, dispatch, options && options.lastNodeMustBeParagraph);
|
|
111
114
|
}
|
|
112
115
|
}, {
|
|
113
116
|
name: 'blockTypeInputRule',
|
|
@@ -115,8 +118,8 @@ const blockTypePlugin = (options, api) => ({
|
|
|
115
118
|
schema,
|
|
116
119
|
featureFlags
|
|
117
120
|
}) => {
|
|
118
|
-
var _api$
|
|
119
|
-
return inputRulePlugin(api === null || api === void 0 ? void 0 : (_api$
|
|
121
|
+
var _api$analytics2;
|
|
122
|
+
return inputRulePlugin(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, schema, featureFlags);
|
|
120
123
|
}
|
|
121
124
|
},
|
|
122
125
|
// Needs to be lower priority than editor-tables.tableEditing
|
|
@@ -127,8 +130,8 @@ const blockTypePlugin = (options, api) => ({
|
|
|
127
130
|
schema,
|
|
128
131
|
featureFlags
|
|
129
132
|
}) => {
|
|
130
|
-
var _api$
|
|
131
|
-
return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$
|
|
133
|
+
var _api$analytics3;
|
|
134
|
+
return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, schema, featureFlags);
|
|
132
135
|
}
|
|
133
136
|
}];
|
|
134
137
|
},
|
|
@@ -144,8 +147,8 @@ const blockTypePlugin = (options, api) => ({
|
|
|
144
147
|
}) {
|
|
145
148
|
const isSmall = options && options.isUndoRedoButtonsEnabled ? toolbarSize < ToolbarSize.XXL : toolbarSize < ToolbarSize.XL;
|
|
146
149
|
const boundSetBlockType = name => {
|
|
147
|
-
var _api$
|
|
148
|
-
return setBlockTypeWithAnalytics(name, INPUT_METHOD.TOOLBAR, api === null || api === void 0 ? void 0 : (_api$
|
|
150
|
+
var _api$analytics4;
|
|
151
|
+
return setBlockTypeWithAnalytics(name, INPUT_METHOD.TOOLBAR, api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions)(editorView.state, editorView.dispatch);
|
|
149
152
|
};
|
|
150
153
|
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
151
154
|
editorView: editorView,
|
|
@@ -171,9 +174,9 @@ const blockTypePlugin = (options, api) => ({
|
|
|
171
174
|
},
|
|
172
175
|
pluginsOptions: {
|
|
173
176
|
quickInsert: intl => {
|
|
174
|
-
var _api$
|
|
177
|
+
var _api$analytics5, _api$analytics6;
|
|
175
178
|
const exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
|
|
176
|
-
return [...blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 ? void 0 : (_api$
|
|
179
|
+
return [...blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions), ...headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 ? void 0 : (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions)];
|
|
177
180
|
}
|
|
178
181
|
}
|
|
179
182
|
});
|
|
@@ -80,10 +80,10 @@ class BreakoutView {
|
|
|
80
80
|
this.mark = mark;
|
|
81
81
|
this.view = view;
|
|
82
82
|
this.contentDOM = contentDOM;
|
|
83
|
-
this.unsubscribe = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
83
|
+
this.unsubscribe = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width.sharedState.onChange(({
|
|
84
84
|
nextSharedState
|
|
85
85
|
}) => this.updateWidth(nextSharedState));
|
|
86
|
-
this.updateWidth(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
86
|
+
this.updateWidth(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width.sharedState.currentState());
|
|
87
87
|
}
|
|
88
88
|
// NOTE: Lifecycle events doesn't work for mark NodeView. So currently this is a no-op.
|
|
89
89
|
// @see https://github.com/ProseMirror/prosemirror/issues/1082
|
|
@@ -155,7 +155,10 @@ const LayoutButtonWrapper = ({
|
|
|
155
155
|
node: (_breakoutState$breako = breakoutState === null || breakoutState === void 0 ? void 0 : (_breakoutState$breako2 = breakoutState.breakoutNode) === null || _breakoutState$breako2 === void 0 ? void 0 : _breakoutState$breako2.node) !== null && _breakoutState$breako !== void 0 ? _breakoutState$breako : null
|
|
156
156
|
});
|
|
157
157
|
};
|
|
158
|
-
const breakoutPlugin = (
|
|
158
|
+
const breakoutPlugin = ({
|
|
159
|
+
config: options,
|
|
160
|
+
api
|
|
161
|
+
}) => ({
|
|
159
162
|
name: 'breakout',
|
|
160
163
|
pmPlugins() {
|
|
161
164
|
return [{
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { caption } from '@atlaskit/adf-schema';
|
|
2
2
|
import { default as createCaptionPlugin } from './pm-plugins/main';
|
|
3
3
|
import { captionKeymap } from './pm-plugins/keymap';
|
|
4
|
-
const captionPlugin = (
|
|
4
|
+
const captionPlugin = ({
|
|
5
|
+
api
|
|
6
|
+
}) => {
|
|
5
7
|
return {
|
|
6
8
|
name: 'caption',
|
|
7
9
|
nodes() {
|
|
@@ -12,8 +12,8 @@ const fireAnalytics = (tr, action, analyticsApi) => {
|
|
|
12
12
|
})(tr);
|
|
13
13
|
};
|
|
14
14
|
export default ((portalProviderAPI, eventDispatcher, providerFactory, dispatch, pluginInjectionApi) => {
|
|
15
|
-
var _pluginInjectionApi$
|
|
16
|
-
const analyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
15
|
+
var _pluginInjectionApi$a;
|
|
16
|
+
const analyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
|
|
17
17
|
return new SafePlugin({
|
|
18
18
|
appendTransaction(transactions, oldState, newState) {
|
|
19
19
|
// only run for transactions that change selection
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { createPlugin } from './pm-plugins/main';
|
|
2
2
|
const codeBidiWarning = ({
|
|
3
|
-
|
|
3
|
+
config
|
|
4
4
|
}) => ({
|
|
5
5
|
name: 'codeBidiWarning',
|
|
6
6
|
pmPlugins() {
|
|
7
7
|
return [{
|
|
8
8
|
name: 'codeBidiWarning',
|
|
9
9
|
plugin: options => {
|
|
10
|
-
return createPlugin(options,
|
|
11
|
-
appearance
|
|
12
|
-
});
|
|
10
|
+
return createPlugin(options, config);
|
|
13
11
|
}
|
|
14
12
|
}];
|
|
15
13
|
}
|
|
@@ -13,7 +13,10 @@ import refreshBrowserSelectionOnChange from './refresh-browser-selection';
|
|
|
13
13
|
// Insertions via the drop down menu
|
|
14
14
|
// tslint-ignore-next-line
|
|
15
15
|
import { createInsertCodeBlockTransaction } from '../block-type/commands/block-type';
|
|
16
|
-
const codeBlockPlugin = (
|
|
16
|
+
const codeBlockPlugin = ({
|
|
17
|
+
config: options,
|
|
18
|
+
api
|
|
19
|
+
}) => ({
|
|
17
20
|
name: 'codeBlock',
|
|
18
21
|
nodes() {
|
|
19
22
|
return [{
|
|
@@ -26,11 +29,14 @@ const codeBlockPlugin = (options, api) => ({
|
|
|
26
29
|
name: 'codeBlock',
|
|
27
30
|
plugin: ({
|
|
28
31
|
getIntl
|
|
29
|
-
}) =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
}) => {
|
|
33
|
+
var _options$appearance;
|
|
34
|
+
return createPlugin({
|
|
35
|
+
...options,
|
|
36
|
+
getIntl,
|
|
37
|
+
appearance: (_options$appearance = options === null || options === void 0 ? void 0 : options.appearance) !== null && _options$appearance !== void 0 ? _options$appearance : 'comment'
|
|
38
|
+
});
|
|
39
|
+
}
|
|
34
40
|
}, {
|
|
35
41
|
name: 'codeBlockIDEKeyBindings',
|
|
36
42
|
plugin: () => ideUX(api)
|
|
@@ -61,11 +67,11 @@ const codeBlockPlugin = (options, api) => ({
|
|
|
61
67
|
keyshortcut: '```',
|
|
62
68
|
icon: () => /*#__PURE__*/React.createElement(IconCode, null),
|
|
63
69
|
action(insert, state) {
|
|
64
|
-
var _api$
|
|
70
|
+
var _api$analytics;
|
|
65
71
|
const tr = createInsertCodeBlockTransaction({
|
|
66
72
|
state
|
|
67
73
|
});
|
|
68
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
74
|
+
api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.attachAnalyticsEvent({
|
|
69
75
|
action: ACTION.INSERTED,
|
|
70
76
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
71
77
|
actionSubjectId: ACTION_SUBJECT_ID.CODE_BLOCK,
|
|
@@ -77,7 +83,7 @@ const codeBlockPlugin = (options, api) => ({
|
|
|
77
83
|
return tr;
|
|
78
84
|
}
|
|
79
85
|
}],
|
|
80
|
-
floatingToolbar: getToolbarConfig(options.allowCopyToClipboard, api === null || api === void 0 ? void 0 : api.
|
|
86
|
+
floatingToolbar: getToolbarConfig(options === null || options === void 0 ? void 0 : options.allowCopyToClipboard, api === null || api === void 0 ? void 0 : api.decorations.actions.hoverDecoration)
|
|
81
87
|
}
|
|
82
88
|
});
|
|
83
89
|
export default codeBlockPlugin;
|
|
@@ -13,12 +13,12 @@ const ideUX = pluginInjectionApi => {
|
|
|
13
13
|
return new SafePlugin({
|
|
14
14
|
props: {
|
|
15
15
|
handleTextInput(view, from, to, text) {
|
|
16
|
-
var _pluginInjectionApi$
|
|
16
|
+
var _pluginInjectionApi$c;
|
|
17
17
|
const {
|
|
18
18
|
state,
|
|
19
19
|
dispatch
|
|
20
20
|
} = view;
|
|
21
|
-
const compositionPluginState = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
21
|
+
const compositionPluginState = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.composition) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.sharedState.currentState();
|
|
22
22
|
if (isCursorInsideCodeBlock(state) && !(compositionPluginState !== null && compositionPluginState !== void 0 && compositionPluginState.isComposing)) {
|
|
23
23
|
const beforeText = getStartOfCurrentLine(state).text;
|
|
24
24
|
const afterText = getEndOfCurrentLine(state).text;
|
|
@@ -19,9 +19,12 @@ const providerBuilder = collabEditProviderPromise => async (codeToExecute, onErr
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
const collabEditPlugin = (
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const collabEditPlugin = ({
|
|
23
|
+
config: options,
|
|
24
|
+
api
|
|
25
|
+
}) => {
|
|
26
|
+
var _api$featureFlags;
|
|
27
|
+
const featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
25
28
|
let providerResolver = () => {};
|
|
26
29
|
const collabEditProviderPromise = new Promise(_providerResolver => {
|
|
27
30
|
providerResolver = _providerResolver;
|
|
@@ -55,14 +58,14 @@ const collabEditPlugin = (options, api) => {
|
|
|
55
58
|
}];
|
|
56
59
|
},
|
|
57
60
|
onEditorViewStateUpdated(props) {
|
|
58
|
-
var _api$
|
|
59
|
-
const addErrorAnalytics = addSynchronyErrorAnalytics(props.newEditorState, props.newEditorState.tr, featureFlags, api === null || api === void 0 ? void 0 : (_api$
|
|
61
|
+
var _api$analytics, _options$useNativePlu;
|
|
62
|
+
const addErrorAnalytics = addSynchronyErrorAnalytics(props.newEditorState, props.newEditorState.tr, featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
60
63
|
executeProviderCode(sendTransaction({
|
|
61
64
|
originalTransaction: props.originalTransaction,
|
|
62
65
|
transactions: props.transactions,
|
|
63
66
|
oldEditorState: props.oldEditorState,
|
|
64
67
|
newEditorState: props.newEditorState,
|
|
65
|
-
useNativePlugin: options
|
|
68
|
+
useNativePlugin: (_options$useNativePlu = options === null || options === void 0 ? void 0 : options.useNativePlugin) !== null && _options$useNativePlu !== void 0 ? _options$useNativePlu : false
|
|
66
69
|
}), addErrorAnalytics);
|
|
67
70
|
}
|
|
68
71
|
};
|
|
@@ -39,11 +39,11 @@ export const createPlugin = (dispatch, providerFactory, providerResolver, collab
|
|
|
39
39
|
return true;
|
|
40
40
|
},
|
|
41
41
|
view(view) {
|
|
42
|
-
var _pluginInjectionApi$
|
|
43
|
-
const addErrorAnalytics = addSynchronyErrorAnalytics(view.state, view.state.tr, featureFlags, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
42
|
+
var _pluginInjectionApi$a, _pluginInjectionApi$a5;
|
|
43
|
+
const addErrorAnalytics = addSynchronyErrorAnalytics(view.state, view.state.tr, featureFlags, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions);
|
|
44
44
|
const onSyncUpError = attributes => {
|
|
45
|
-
var _pluginInjectionApi$
|
|
46
|
-
const fireAnalyticsCallback = fireAnalyticsEvent((_pluginInjectionApi$
|
|
45
|
+
var _pluginInjectionApi$a2, _pluginInjectionApi$a3, _pluginInjectionApi$a4;
|
|
46
|
+
const fireAnalyticsCallback = fireAnalyticsEvent((_pluginInjectionApi$a2 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : (_pluginInjectionApi$a4 = _pluginInjectionApi$a3.sharedState.currentState()) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.createAnalyticsEvent) !== null && _pluginInjectionApi$a2 !== void 0 ? _pluginInjectionApi$a2 : undefined);
|
|
47
47
|
fireAnalyticsCallback({
|
|
48
48
|
payload: {
|
|
49
49
|
action: ACTION.NEW_COLLAB_SYNC_UP_ERROR_NO_STEPS,
|
|
@@ -59,7 +59,7 @@ export const createPlugin = (dispatch, providerFactory, providerResolver, collab
|
|
|
59
59
|
options,
|
|
60
60
|
providerFactory,
|
|
61
61
|
featureFlags,
|
|
62
|
-
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
62
|
+
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions
|
|
63
63
|
}), addErrorAnalytics);
|
|
64
64
|
providerFactory && providerFactory.subscribe('collabEditProvider', (_name, providerPromise) => {
|
|
65
65
|
if (providerPromise) {
|
|
@@ -80,7 +80,10 @@ function ContentComponent({
|
|
|
80
80
|
weekStartDay: weekStartDay
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
-
const datePlugin = (
|
|
83
|
+
const datePlugin = ({
|
|
84
|
+
config: options = {},
|
|
85
|
+
api
|
|
86
|
+
}) => ({
|
|
84
87
|
name: 'date',
|
|
85
88
|
getSharedState(editorState) {
|
|
86
89
|
if (!editorState) {
|
|
@@ -151,9 +154,9 @@ const datePlugin = (options = {}, api) => ({
|
|
|
151
154
|
keyshortcut: '//',
|
|
152
155
|
icon: () => /*#__PURE__*/React.createElement(IconDate, null),
|
|
153
156
|
action(insert, state) {
|
|
154
|
-
var _api$
|
|
157
|
+
var _api$analytics, _api$analytics$action, _api$analytics$action2;
|
|
155
158
|
const tr = createDate(true)(insert, state);
|
|
156
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
159
|
+
api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : (_api$analytics$action = _api$analytics.actions) === null || _api$analytics$action === void 0 ? void 0 : (_api$analytics$action2 = _api$analytics$action.attachAnalyticsEvent) === null || _api$analytics$action2 === void 0 ? void 0 : _api$analytics$action2.call(_api$analytics$action, {
|
|
157
160
|
action: ACTION.INSERTED,
|
|
158
161
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
159
162
|
actionSubjectId: ACTION_SUBJECT_ID.DATE,
|
|
@@ -54,8 +54,11 @@ const memoizedToItem = memoize(emojiToTypeaheadItem);
|
|
|
54
54
|
export const defaultListLimit = 50;
|
|
55
55
|
const isFullShortName = query => query && query.length > 1 && query.charAt(0) === ':' && query.charAt(query.length - 1) === ':';
|
|
56
56
|
const TRIGGER = ':';
|
|
57
|
-
export const emojiPlugin = (
|
|
58
|
-
|
|
57
|
+
export const emojiPlugin = ({
|
|
58
|
+
config: options,
|
|
59
|
+
api
|
|
60
|
+
}) => {
|
|
61
|
+
var _api$analytics5;
|
|
59
62
|
const typeAhead = {
|
|
60
63
|
id: TypeAheadAvailableNodes.EMOJI,
|
|
61
64
|
trigger: TRIGGER,
|
|
@@ -117,7 +120,7 @@ export const emojiPlugin = (options, api) => {
|
|
|
117
120
|
selectItem(state, item, insert, {
|
|
118
121
|
mode
|
|
119
122
|
}) {
|
|
120
|
-
var _api$
|
|
123
|
+
var _api$analytics3;
|
|
121
124
|
const {
|
|
122
125
|
id = '',
|
|
123
126
|
fallback,
|
|
@@ -126,11 +129,11 @@ export const emojiPlugin = (options, api) => {
|
|
|
126
129
|
const text = fallback || shortName;
|
|
127
130
|
const emojiPluginState = emojiPluginKey.getState(state);
|
|
128
131
|
if (emojiPluginState.emojiProvider && emojiPluginState.emojiProvider.recordSelection && item.emoji) {
|
|
129
|
-
var _api$
|
|
132
|
+
var _api$analytics$shared, _api$analytics, _api$analytics$shared2, _api$analytics$shared3, _api$analytics2, _api$analytics2$share;
|
|
130
133
|
emojiPluginState.emojiProvider.recordSelection(item.emoji).then(recordSelectionSucceededSli({
|
|
131
|
-
createAnalyticsEvent: (_api$
|
|
134
|
+
createAnalyticsEvent: (_api$analytics$shared = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : (_api$analytics$shared2 = _api$analytics.sharedState.currentState()) === null || _api$analytics$shared2 === void 0 ? void 0 : _api$analytics$shared2.createAnalyticsEvent) !== null && _api$analytics$shared !== void 0 ? _api$analytics$shared : undefined
|
|
132
135
|
})).catch(recordSelectionFailedSli({
|
|
133
|
-
createAnalyticsEvent: (_api$
|
|
136
|
+
createAnalyticsEvent: (_api$analytics$shared3 = api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : (_api$analytics2$share = _api$analytics2.sharedState.currentState()) === null || _api$analytics2$share === void 0 ? void 0 : _api$analytics2$share.createAnalyticsEvent) !== null && _api$analytics$shared3 !== void 0 ? _api$analytics$shared3 : undefined
|
|
134
137
|
}));
|
|
135
138
|
}
|
|
136
139
|
const emojiNode = state.schema.nodes.emoji.createChecked({
|
|
@@ -140,7 +143,7 @@ export const emojiPlugin = (options, api) => {
|
|
|
140
143
|
});
|
|
141
144
|
const space = state.schema.text(' ');
|
|
142
145
|
const tr = insert(Fragment.from([emojiNode, space]));
|
|
143
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
146
|
+
api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.attachAnalyticsEvent({
|
|
144
147
|
action: ACTION.INSERTED,
|
|
145
148
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
146
149
|
actionSubjectId: ACTION_SUBJECT_ID.EMOJI,
|
|
@@ -171,8 +174,8 @@ export const emojiPlugin = (options, api) => {
|
|
|
171
174
|
providerFactory,
|
|
172
175
|
featureFlags
|
|
173
176
|
}) => {
|
|
174
|
-
var _api$
|
|
175
|
-
return asciiInputRulePlugin(schema, providerFactory, featureFlags, api === null || api === void 0 ? void 0 : (_api$
|
|
177
|
+
var _api$analytics4;
|
|
178
|
+
return asciiInputRulePlugin(schema, providerFactory, featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
|
|
176
179
|
}
|
|
177
180
|
}];
|
|
178
181
|
},
|
|
@@ -183,7 +186,7 @@ export const emojiPlugin = (options, api) => {
|
|
|
183
186
|
return emojiPluginKey.getState(editorState);
|
|
184
187
|
},
|
|
185
188
|
commands: {
|
|
186
|
-
insertEmoji: insertEmoji(api === null || api === void 0 ? void 0 : (_api$
|
|
189
|
+
insertEmoji: insertEmoji(api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions)
|
|
187
190
|
},
|
|
188
191
|
pluginsOptions: {
|
|
189
192
|
quickInsert: ({
|
|
@@ -196,15 +199,15 @@ export const emojiPlugin = (options, api) => {
|
|
|
196
199
|
keyshortcut: ':',
|
|
197
200
|
icon: () => /*#__PURE__*/React.createElement(IconEmoji, null),
|
|
198
201
|
action(insert, state) {
|
|
199
|
-
var _api$
|
|
202
|
+
var _api$analytics6;
|
|
200
203
|
const tr = insert(undefined);
|
|
201
|
-
api === null || api === void 0 ? void 0 : api.
|
|
204
|
+
api === null || api === void 0 ? void 0 : api.typeAhead.commands.openTypeAheadAtCursor({
|
|
202
205
|
triggerHandler: typeAhead,
|
|
203
206
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
204
207
|
})({
|
|
205
208
|
tr
|
|
206
209
|
});
|
|
207
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
210
|
+
api === null || api === void 0 ? void 0 : (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions.attachAnalyticsEvent({
|
|
208
211
|
action: ACTION.INVOKED,
|
|
209
212
|
actionSubject: ACTION_SUBJECT.TYPEAHEAD,
|
|
210
213
|
actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_EMOJI,
|
|
@@ -8,9 +8,12 @@ import { getToolbarConfig } from './toolbar';
|
|
|
8
8
|
import { createExpandNode } from './commands';
|
|
9
9
|
import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
10
10
|
import { createWrapSelectionTransaction } from '../block-type/commands/block-type';
|
|
11
|
-
const expandPlugin = (
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const expandPlugin = ({
|
|
12
|
+
config: options = {},
|
|
13
|
+
api
|
|
14
|
+
}) => {
|
|
15
|
+
var _api$featureFlags;
|
|
16
|
+
const featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
14
17
|
return {
|
|
15
18
|
name: 'expand',
|
|
16
19
|
nodes() {
|
|
@@ -37,7 +40,7 @@ const expandPlugin = (options = {}, api) => {
|
|
|
37
40
|
}];
|
|
38
41
|
},
|
|
39
42
|
pluginsOptions: {
|
|
40
|
-
floatingToolbar: getToolbarConfig(api === null || api === void 0 ? void 0 : api.
|
|
43
|
+
floatingToolbar: getToolbarConfig(api === null || api === void 0 ? void 0 : api.decorations.actions.hoverDecoration),
|
|
41
44
|
quickInsert: ({
|
|
42
45
|
formatMessage
|
|
43
46
|
}) => {
|
|
@@ -4,9 +4,12 @@ import keymapPlugin from './pm-plugins/keymap';
|
|
|
4
4
|
import { createPlugin as createUniqueIdPlugin } from './pm-plugins/unique-id';
|
|
5
5
|
import { getToolbarConfig } from './toolbar';
|
|
6
6
|
import { getContextPanel } from './context-panel';
|
|
7
|
-
const extensionPlugin = (
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const extensionPlugin = ({
|
|
8
|
+
config: options = {},
|
|
9
|
+
api
|
|
10
|
+
}) => {
|
|
11
|
+
var _api$featureFlags, _api$contextPanel2, _api$contextPanel3;
|
|
12
|
+
const featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
10
13
|
return {
|
|
11
14
|
name: 'extension',
|
|
12
15
|
nodes() {
|
|
@@ -38,8 +41,8 @@ const extensionPlugin = (options = {}, api) => {
|
|
|
38
41
|
}, {
|
|
39
42
|
name: 'extensionKeymap',
|
|
40
43
|
plugin: () => {
|
|
41
|
-
var _api$
|
|
42
|
-
return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$
|
|
44
|
+
var _api$contextPanel;
|
|
45
|
+
return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$contextPanel = api.contextPanel) === null || _api$contextPanel === void 0 ? void 0 : _api$contextPanel.actions.applyChange);
|
|
43
46
|
}
|
|
44
47
|
}, {
|
|
45
48
|
name: 'extensionUniqueId',
|
|
@@ -49,10 +52,10 @@ const extensionPlugin = (options = {}, api) => {
|
|
|
49
52
|
pluginsOptions: {
|
|
50
53
|
floatingToolbar: getToolbarConfig({
|
|
51
54
|
breakoutEnabled: options.breakoutEnabled,
|
|
52
|
-
hoverDecoration: api === null || api === void 0 ? void 0 : api.
|
|
53
|
-
applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$
|
|
55
|
+
hoverDecoration: api === null || api === void 0 ? void 0 : api.decorations.actions.hoverDecoration,
|
|
56
|
+
applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$contextPanel2 = api.contextPanel) === null || _api$contextPanel2 === void 0 ? void 0 : _api$contextPanel2.actions.applyChange
|
|
54
57
|
}),
|
|
55
|
-
contextPanel: getContextPanel(options.allowAutoSave, featureFlags, api === null || api === void 0 ? void 0 : (_api$
|
|
58
|
+
contextPanel: getContextPanel(options.allowAutoSave, featureFlags, api === null || api === void 0 ? void 0 : (_api$contextPanel3 = api.contextPanel) === null || _api$contextPanel3 === void 0 ? void 0 : _api$contextPanel3.actions.applyChange)
|
|
56
59
|
}
|
|
57
60
|
};
|
|
58
61
|
};
|
|
@@ -130,11 +130,11 @@ export const handleUpdate = ({
|
|
|
130
130
|
return true;
|
|
131
131
|
};
|
|
132
132
|
const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, pluginInjectionApi, useLongPressSelection = false, options = {}) => {
|
|
133
|
-
var _pluginInjectionApi$
|
|
133
|
+
var _pluginInjectionApi$c;
|
|
134
134
|
const state = createPluginState(dispatch, {
|
|
135
135
|
showEditButton: false,
|
|
136
136
|
showContextPanel: false,
|
|
137
|
-
applyChangeToContextPanel: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
137
|
+
applyChangeToContextPanel: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.contextPanel) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.applyChange
|
|
138
138
|
});
|
|
139
139
|
const extensionNodeViewOptions = {
|
|
140
140
|
appearance: options.appearance
|
|
@@ -149,13 +149,13 @@ const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProvid
|
|
|
149
149
|
providerFactory.subscribe('contextIdentificationProvider', contextIdentificationProviderHandler);
|
|
150
150
|
return {
|
|
151
151
|
update: (view, prevState) => {
|
|
152
|
-
var _pluginInjectionApi$
|
|
152
|
+
var _pluginInjectionApi$c2;
|
|
153
153
|
handleUpdate({
|
|
154
154
|
view,
|
|
155
155
|
prevState,
|
|
156
156
|
domAtPos,
|
|
157
157
|
extensionHandlers,
|
|
158
|
-
applyChange: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
158
|
+
applyChange: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c2 = pluginInjectionApi.contextPanel) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.applyChange
|
|
159
159
|
});
|
|
160
160
|
},
|
|
161
161
|
destroy: () => {
|
|
@@ -44,8 +44,10 @@ export const openFeedbackDialog = async feedbackInfo => new Promise(async (resol
|
|
|
44
44
|
// Return the timoutId for consumers to call clearTimeout if they need to.
|
|
45
45
|
resolve(timeoutId);
|
|
46
46
|
});
|
|
47
|
-
const feedbackDialog =
|
|
48
|
-
|
|
47
|
+
const feedbackDialog = ({
|
|
48
|
+
config: feedbackInfo
|
|
49
|
+
}) => {
|
|
50
|
+
defaultFeedbackInfo = feedbackInfo !== null && feedbackInfo !== void 0 ? feedbackInfo : {};
|
|
49
51
|
return {
|
|
50
52
|
name: 'feedbackDialog',
|
|
51
53
|
pluginsOptions: {
|
|
@@ -2,9 +2,12 @@ import React from 'react';
|
|
|
2
2
|
import { createPlugin } from './plugin';
|
|
3
3
|
import keymapPlugin from './keymap';
|
|
4
4
|
import FindReplaceToolbarButtonWithState from './FindReplaceToolbarButtonWithState';
|
|
5
|
-
export const findReplacePlugin = (
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
export const findReplacePlugin = ({
|
|
6
|
+
config: props,
|
|
7
|
+
api
|
|
8
|
+
}) => {
|
|
9
|
+
var _api$featureFlags;
|
|
10
|
+
const featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
8
11
|
return {
|
|
9
12
|
name: 'findReplace',
|
|
10
13
|
pmPlugins() {
|
|
@@ -27,7 +30,7 @@ export const findReplacePlugin = (props, api) => {
|
|
|
27
30
|
containerElement,
|
|
28
31
|
dispatchAnalyticsEvent
|
|
29
32
|
}) {
|
|
30
|
-
if (props.twoLineEditorToolbar) {
|
|
33
|
+
if (props !== null && props !== void 0 && props.twoLineEditorToolbar) {
|
|
31
34
|
return null;
|
|
32
35
|
} else {
|
|
33
36
|
return /*#__PURE__*/React.createElement(FindReplaceToolbarButtonWithState, {
|
|
@@ -38,7 +41,7 @@ export const findReplacePlugin = (props, api) => {
|
|
|
38
41
|
editorView: editorView,
|
|
39
42
|
containerElement: containerElement,
|
|
40
43
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
41
|
-
takeFullWidth: props.takeFullWidth,
|
|
44
|
+
takeFullWidth: props === null || props === void 0 ? void 0 : props.takeFullWidth,
|
|
42
45
|
featureFlags: featureFlags
|
|
43
46
|
});
|
|
44
47
|
}
|
|
@@ -109,7 +109,9 @@ const getDomRefFromSelection = (view, dispatchAnalyticsEvent) => {
|
|
|
109
109
|
function filterUndefined(x) {
|
|
110
110
|
return !!x;
|
|
111
111
|
}
|
|
112
|
-
const floatingToolbarPlugin = (
|
|
112
|
+
const floatingToolbarPlugin = ({
|
|
113
|
+
api
|
|
114
|
+
}) => {
|
|
113
115
|
return {
|
|
114
116
|
name: 'floatingToolbar',
|
|
115
117
|
pmPlugins(floatingToolbarHandlers = []) {
|
|
@@ -180,8 +182,8 @@ function ContentComponent({
|
|
|
180
182
|
providerFactory,
|
|
181
183
|
dispatchAnalyticsEvent
|
|
182
184
|
}) {
|
|
183
|
-
var _pluginInjectionApi$
|
|
184
|
-
const featureFlags = (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
185
|
+
var _pluginInjectionApi$f, _configWithNodeInfo$c, _configWithNodeInfo$c2;
|
|
186
|
+
const featureFlags = (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$f = pluginInjectionApi.featureFlags) === null || _pluginInjectionApi$f === void 0 ? void 0 : _pluginInjectionApi$f.sharedState.currentState()) || {};
|
|
185
187
|
const {
|
|
186
188
|
floatingToolbarState,
|
|
187
189
|
editorDisabledState
|
|
@@ -217,7 +219,7 @@ function ContentComponent({
|
|
|
217
219
|
return null;
|
|
218
220
|
}
|
|
219
221
|
let customPositionCalculation;
|
|
220
|
-
const toolbarItems = processCopyButtonItems(editorView.state)(Array.isArray(items) ? items : items(node), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
222
|
+
const toolbarItems = processCopyButtonItems(editorView.state)(Array.isArray(items) ? items : items(node), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.decorations.actions.hoverDecoration);
|
|
221
223
|
if (onPositionCalculated) {
|
|
222
224
|
customPositionCalculation = nextPos => {
|
|
223
225
|
return onPositionCalculated(editorView, nextPos);
|
|
@@ -18,7 +18,7 @@ const toolbarScrollButtons = css`
|
|
|
18
18
|
`;
|
|
19
19
|
const LeftIcon = ChevronLeftLargeIcon;
|
|
20
20
|
const RightIcon = ChevronRightLargeIcon;
|
|
21
|
-
export
|
|
21
|
+
export const ScrollButtons = ({
|
|
22
22
|
intl,
|
|
23
23
|
scrollContainerRef,
|
|
24
24
|
node,
|
|
@@ -28,7 +28,11 @@ export default (({
|
|
|
28
28
|
const [needScroll, setNeedScroll] = useState(false);
|
|
29
29
|
const [canScrollLeft, setCanScrollLeft] = useState(true);
|
|
30
30
|
const [canScrollRight, setCanScrollRight] = useState(true);
|
|
31
|
-
const
|
|
31
|
+
const setCanScrollDebounced = rafSchedule(() => {
|
|
32
|
+
// Refs are null before mounting and after unmount
|
|
33
|
+
if (!scrollContainerRef.current) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
32
36
|
const {
|
|
33
37
|
scrollLeft,
|
|
34
38
|
scrollWidth,
|
|
@@ -38,7 +42,7 @@ export default (({
|
|
|
38
42
|
setCanScrollRight(scrollLeft + offsetWidth < scrollWidth - 1); // -1 to account for half pixel
|
|
39
43
|
});
|
|
40
44
|
|
|
41
|
-
const onScroll = () =>
|
|
45
|
+
const onScroll = () => setCanScrollDebounced();
|
|
42
46
|
const scrollLeft = () => {
|
|
43
47
|
var _scrollContainerRef$c, _scrollContainerRef$c2, _scrollContainerRef$c3;
|
|
44
48
|
const {
|
|
@@ -95,6 +99,7 @@ export default (({
|
|
|
95
99
|
scrollContainerRefCurrent.removeEventListener('scroll', onScroll);
|
|
96
100
|
resizeObserver.unobserve(scrollContainerRefCurrent);
|
|
97
101
|
}
|
|
102
|
+
setCanScrollDebounced.cancel();
|
|
98
103
|
};
|
|
99
104
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
100
105
|
}, []);
|
|
@@ -127,4 +132,4 @@ export default (({
|
|
|
127
132
|
onClick: scrollRight,
|
|
128
133
|
disabled: !canScrollRight || disabled
|
|
129
134
|
})) : null;
|
|
130
|
-
}
|
|
135
|
+
};
|