@atlaskit/editor-core 183.1.6 → 184.0.4
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/.eslintrc.js +7 -3
- package/CHANGELOG.md +29 -0
- package/dist/cjs/labs/next/full-page.js +2 -6
- package/dist/cjs/labs/next/presets/create-stub-internal-apis.js +4 -2
- package/dist/cjs/labs/next/presets/default.js +2 -2
- package/dist/cjs/labs/next/presets/universal.js +2 -1
- package/dist/cjs/plugins/breakout/index.js +54 -35
- package/dist/cjs/plugins/card/toolbar.js +4 -3
- package/dist/cjs/plugins/collab-edit/plugin-state.js +2 -3
- package/dist/cjs/plugins/copy-button/commands.js +8 -1
- package/dist/cjs/plugins/extension/index.js +1 -1
- package/dist/cjs/plugins/extension/nodeviews/extension.js +5 -3
- package/dist/cjs/plugins/extension/pm-plugins/main.js +6 -6
- package/dist/cjs/plugins/extension/ui/Extension/Extension/index.js +34 -4
- package/dist/cjs/plugins/extension/ui/Extension/ExtensionComponent.js +4 -2
- package/dist/cjs/plugins/extension/ui/Extension/index.js +4 -2
- package/dist/cjs/plugins/help-dialog/index.js +12 -8
- package/dist/cjs/plugins/index.js +0 -14
- package/dist/cjs/plugins/layout/pm-plugins/main.js +0 -1
- package/dist/cjs/plugins/media/index.js +15 -5
- package/dist/cjs/plugins/media/nodeviews/mediaNodeView/index.js +22 -14
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +53 -34
- package/dist/cjs/plugins/media/styles.js +1 -1
- package/dist/cjs/plugins/media/toolbar/index.js +4 -3
- package/dist/cjs/plugins/paste/pm-plugins/main.js +7 -1
- package/dist/cjs/test-utils.js +6 -1
- package/dist/cjs/ui/Appearance/Comment/Comment.js +2 -2
- package/dist/cjs/ui/Appearance/FullPage/FullPage.js +2 -2
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +1 -2
- package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +2 -2
- package/dist/cjs/ui/ColorPickerButton/index.js +2 -2
- package/dist/cjs/ui/ConfigPanel/Fields/ColorPicker.js +6 -10
- package/dist/cjs/ui/ContentStyles/index.js +9 -10
- package/dist/cjs/ui/ContextPanel/index.js +67 -56
- package/dist/cjs/ui/MediaAndEmbedsToolbar/index.js +10 -11
- package/dist/cjs/ui/Resizer/index.js +8 -8
- package/dist/cjs/ui/WidthEmitter/index.js +10 -4
- package/dist/cjs/ui/styles.js +6 -0
- package/dist/cjs/utils/clipboard.js +18 -11
- package/dist/cjs/utils/performance/instrumented-plugin.js +14 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/labs/next/full-page.js +2 -5
- package/dist/es2019/labs/next/presets/create-stub-internal-apis.js +4 -2
- package/dist/es2019/labs/next/presets/default.js +1 -1
- package/dist/es2019/labs/next/presets/universal.js +2 -1
- package/dist/es2019/plugins/breakout/index.js +48 -31
- package/dist/es2019/plugins/card/toolbar.js +4 -3
- package/dist/es2019/plugins/collab-edit/plugin-state.js +2 -4
- package/dist/es2019/plugins/copy-button/commands.js +9 -2
- package/dist/es2019/plugins/extension/index.js +1 -1
- package/dist/es2019/plugins/extension/nodeviews/extension.js +5 -3
- package/dist/es2019/plugins/extension/pm-plugins/main.js +4 -4
- package/dist/es2019/plugins/extension/ui/Extension/Extension/index.js +38 -2
- package/dist/es2019/plugins/extension/ui/Extension/ExtensionComponent.js +4 -2
- package/dist/es2019/plugins/extension/ui/Extension/index.js +4 -2
- package/dist/es2019/plugins/help-dialog/index.js +14 -9
- package/dist/es2019/plugins/index.js +0 -2
- package/dist/es2019/plugins/layout/pm-plugins/main.js +0 -1
- package/dist/es2019/plugins/media/index.js +15 -5
- package/dist/es2019/plugins/media/nodeviews/mediaNodeView/index.js +21 -10
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +53 -33
- package/dist/es2019/plugins/media/styles.js +1 -7
- package/dist/es2019/plugins/media/toolbar/index.js +4 -4
- package/dist/es2019/plugins/paste/pm-plugins/main.js +7 -1
- package/dist/es2019/test-utils.js +6 -1
- package/dist/es2019/ui/Appearance/Comment/Comment.js +1 -1
- package/dist/es2019/ui/Appearance/FullPage/FullPage.js +1 -1
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +1 -1
- package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +1 -1
- package/dist/es2019/ui/ColorPickerButton/index.js +2 -2
- package/dist/es2019/ui/ConfigPanel/Fields/ColorPicker.js +5 -10
- package/dist/es2019/ui/ContentStyles/index.js +1 -2
- package/dist/es2019/ui/ContextPanel/index.js +66 -43
- package/dist/es2019/ui/MediaAndEmbedsToolbar/index.js +8 -9
- package/dist/es2019/ui/Resizer/index.js +1 -1
- package/dist/es2019/ui/WidthEmitter/index.js +10 -4
- package/dist/es2019/ui/styles.js +6 -0
- package/dist/es2019/utils/clipboard.js +12 -7
- package/dist/es2019/utils/performance/instrumented-plugin.js +15 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/labs/next/full-page.js +2 -5
- package/dist/esm/labs/next/presets/create-stub-internal-apis.js +4 -2
- package/dist/esm/labs/next/presets/default.js +1 -1
- package/dist/esm/labs/next/presets/universal.js +2 -1
- package/dist/esm/plugins/breakout/index.js +54 -35
- package/dist/esm/plugins/card/toolbar.js +4 -3
- package/dist/esm/plugins/collab-edit/plugin-state.js +2 -3
- package/dist/esm/plugins/copy-button/commands.js +9 -2
- package/dist/esm/plugins/extension/index.js +1 -1
- package/dist/esm/plugins/extension/nodeviews/extension.js +5 -3
- package/dist/esm/plugins/extension/pm-plugins/main.js +6 -6
- package/dist/esm/plugins/extension/ui/Extension/Extension/index.js +33 -2
- package/dist/esm/plugins/extension/ui/Extension/ExtensionComponent.js +4 -2
- package/dist/esm/plugins/extension/ui/Extension/index.js +4 -2
- package/dist/esm/plugins/help-dialog/index.js +12 -8
- package/dist/esm/plugins/index.js +0 -2
- package/dist/esm/plugins/layout/pm-plugins/main.js +0 -1
- package/dist/esm/plugins/media/index.js +15 -5
- package/dist/esm/plugins/media/nodeviews/mediaNodeView/index.js +22 -14
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +54 -35
- package/dist/esm/plugins/media/styles.js +2 -2
- package/dist/esm/plugins/media/toolbar/index.js +4 -3
- package/dist/esm/plugins/paste/pm-plugins/main.js +7 -1
- package/dist/esm/test-utils.js +6 -1
- package/dist/esm/ui/Appearance/Comment/Comment.js +1 -1
- package/dist/esm/ui/Appearance/FullPage/FullPage.js +1 -1
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +1 -1
- package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +1 -1
- package/dist/esm/ui/ColorPickerButton/index.js +2 -2
- package/dist/esm/ui/ConfigPanel/Fields/ColorPicker.js +5 -10
- package/dist/esm/ui/ContentStyles/index.js +1 -2
- package/dist/esm/ui/ContextPanel/index.js +64 -53
- package/dist/esm/ui/MediaAndEmbedsToolbar/index.js +10 -11
- package/dist/esm/ui/Resizer/index.js +1 -1
- package/dist/esm/ui/WidthEmitter/index.js +10 -4
- package/dist/esm/ui/styles.js +6 -0
- package/dist/esm/utils/clipboard.js +16 -10
- package/dist/esm/utils/performance/instrumented-plugin.js +14 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/actions/index.d.ts +1 -1
- package/dist/types/create-editor/get-plugins.d.ts +2 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/plugins/breakout/index.d.ts +4 -0
- package/dist/types/plugins/breakout/ui/LayoutButton.d.ts +1 -1
- package/dist/types/plugins/card/index.d.ts +2 -2
- package/dist/types/plugins/collab-edit/actions.d.ts +3 -2
- package/dist/types/plugins/collab-edit/events/handlers.d.ts +3 -3
- package/dist/types/plugins/collab-edit/events/initialize.d.ts +1 -1
- package/dist/types/plugins/collab-edit/events/send-transaction.d.ts +1 -1
- package/dist/types/plugins/collab-edit/index.d.ts +0 -1
- package/dist/types/plugins/collab-edit/native-collab-provider-plugin.d.ts +2 -2
- package/dist/types/plugins/collab-edit/participants.d.ts +1 -1
- package/dist/types/plugins/collab-edit/plugin.d.ts +0 -2
- package/dist/types/plugins/collab-edit/types.d.ts +1 -3
- package/dist/types/plugins/collab-edit/ui/to-avatar.d.ts +1 -1
- package/dist/types/plugins/collab-edit/utils.d.ts +2 -1
- package/dist/types/plugins/extension/index.d.ts +2 -1
- package/dist/types/plugins/extension/nodeviews/extension.d.ts +4 -1
- package/dist/types/plugins/extension/pm-plugins/main.d.ts +3 -1
- package/dist/types/plugins/extension/ui/Extension/Extension/index.d.ts +6 -0
- package/dist/types/plugins/extension/ui/Extension/ExtensionComponent.d.ts +3 -0
- package/dist/types/plugins/extension/ui/Extension/index.d.ts +3 -0
- package/dist/types/plugins/help-dialog/index.d.ts +3 -1
- package/dist/types/plugins/index.d.ts +0 -3
- package/dist/types/plugins/media/index.d.ts +12 -2
- package/dist/types/plugins/media/nodeviews/mediaNodeView/index.d.ts +4 -2
- package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +1 -1
- package/dist/types/plugins/media/nodeviews/types.d.ts +2 -1
- package/dist/types/plugins/media/toolbar/index.d.ts +3 -1
- package/dist/types/plugins/media/ui/ResizableMediaSingle/types.d.ts +2 -2
- package/dist/types/test-utils.d.ts +3 -1
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types/ui/ColorPickerButton/index.d.ts +3 -3
- package/dist/types/ui/ContextPanel/index.d.ts +3 -4
- package/dist/types/ui/MediaAndEmbedsToolbar/index.d.ts +3 -1
- package/dist/types/ui/PluginSlot/index.d.ts +1 -1
- package/dist/types/ui/Resizer/types.d.ts +2 -2
- package/dist/types/utils/clipboard.d.ts +1 -0
- package/dist/types-ts4.5/actions/index.d.ts +1 -1
- package/dist/types-ts4.5/create-editor/get-plugins.d.ts +2 -0
- package/dist/types-ts4.5/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/breakout/index.d.ts +6 -0
- package/dist/types-ts4.5/plugins/breakout/ui/LayoutButton.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/collab-edit/actions.d.ts +3 -2
- package/dist/types-ts4.5/plugins/collab-edit/events/handlers.d.ts +3 -3
- package/dist/types-ts4.5/plugins/collab-edit/events/initialize.d.ts +1 -1
- package/dist/types-ts4.5/plugins/collab-edit/events/send-transaction.d.ts +1 -1
- package/dist/types-ts4.5/plugins/collab-edit/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/collab-edit/native-collab-provider-plugin.d.ts +2 -2
- package/dist/types-ts4.5/plugins/collab-edit/participants.d.ts +1 -1
- package/dist/types-ts4.5/plugins/collab-edit/plugin.d.ts +0 -2
- package/dist/types-ts4.5/plugins/collab-edit/types.d.ts +1 -3
- package/dist/types-ts4.5/plugins/collab-edit/ui/to-avatar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/collab-edit/utils.d.ts +2 -1
- package/dist/types-ts4.5/plugins/extension/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/extension/nodeviews/extension.d.ts +4 -1
- package/dist/types-ts4.5/plugins/extension/pm-plugins/main.d.ts +3 -1
- package/dist/types-ts4.5/plugins/extension/ui/Extension/Extension/index.d.ts +6 -0
- package/dist/types-ts4.5/plugins/extension/ui/Extension/ExtensionComponent.d.ts +3 -0
- package/dist/types-ts4.5/plugins/extension/ui/Extension/index.d.ts +3 -0
- package/dist/types-ts4.5/plugins/help-dialog/index.d.ts +5 -1
- package/dist/types-ts4.5/plugins/index.d.ts +0 -3
- package/dist/types-ts4.5/plugins/media/index.d.ts +9 -2
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaNodeView/index.d.ts +4 -2
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaSingle.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/nodeviews/types.d.ts +2 -1
- package/dist/types-ts4.5/plugins/media/toolbar/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/types.d.ts +2 -2
- package/dist/types-ts4.5/test-utils.d.ts +3 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types-ts4.5/ui/ColorPickerButton/index.d.ts +3 -3
- package/dist/types-ts4.5/ui/ContextPanel/index.d.ts +3 -4
- package/dist/types-ts4.5/ui/MediaAndEmbedsToolbar/index.d.ts +3 -1
- package/dist/types-ts4.5/ui/PluginSlot/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/Resizer/types.d.ts +2 -2
- package/dist/types-ts4.5/utils/clipboard.d.ts +1 -0
- package/package.json +25 -23
- package/report.api.md +15 -63
- package/dist/cjs/plugins/collab-edit/provider/index.js +0 -5
- package/dist/cjs/plugins/collab-edit/provider/types.js +0 -5
- package/dist/cjs/plugins/grid/index.js +0 -207
- package/dist/cjs/plugins/grid/styles.js +0 -16
- package/dist/cjs/plugins/grid/types.js +0 -5
- package/dist/cjs/plugins/width/index.js +0 -88
- package/dist/cjs/ui/ContextPanel/context.js +0 -89
- package/dist/es2019/plugins/collab-edit/provider/index.js +0 -1
- package/dist/es2019/plugins/collab-edit/provider/types.js +0 -1
- package/dist/es2019/plugins/grid/index.js +0 -168
- package/dist/es2019/plugins/grid/styles.js +0 -36
- package/dist/es2019/plugins/grid/types.js +0 -1
- package/dist/es2019/plugins/width/index.js +0 -72
- package/dist/es2019/ui/ContextPanel/context.js +0 -65
- package/dist/esm/plugins/collab-edit/provider/index.js +0 -1
- package/dist/esm/plugins/collab-edit/provider/types.js +0 -1
- package/dist/esm/plugins/grid/index.js +0 -191
- package/dist/esm/plugins/grid/styles.js +0 -7
- package/dist/esm/plugins/grid/types.js +0 -1
- package/dist/esm/plugins/width/index.js +0 -78
- package/dist/esm/ui/ContextPanel/context.js +0 -79
- package/dist/types/plugins/collab-edit/provider/index.d.ts +0 -1
- package/dist/types/plugins/collab-edit/provider/types.d.ts +0 -1
- package/dist/types/plugins/grid/index.d.ts +0 -25
- package/dist/types/plugins/grid/styles.d.ts +0 -2
- package/dist/types/plugins/grid/types.d.ts +0 -7
- package/dist/types/plugins/width/index.d.ts +0 -18
- package/dist/types/ui/ContextPanel/context.d.ts +0 -24
- package/dist/types-ts4.5/plugins/collab-edit/provider/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/collab-edit/provider/types.d.ts +0 -1
- package/dist/types-ts4.5/plugins/grid/index.d.ts +0 -27
- package/dist/types-ts4.5/plugins/grid/styles.d.ts +0 -2
- package/dist/types-ts4.5/plugins/grid/types.d.ts +0 -7
- package/dist/types-ts4.5/plugins/width/index.d.ts +0 -18
- package/dist/types-ts4.5/ui/ContextPanel/context.d.ts +0 -24
|
@@ -39,18 +39,31 @@ export class InstrumentedPlugin extends SafePlugin {
|
|
|
39
39
|
return result;
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
+
const {
|
|
43
|
+
samplingRate: uiTrackingSamplingRate = 100
|
|
44
|
+
} = uiTracking;
|
|
42
45
|
if (uiTracking.enabled && spec.view) {
|
|
43
46
|
const originalView = spec.view.bind(spec);
|
|
44
47
|
spec.view = editorView => {
|
|
45
48
|
const self = this;
|
|
46
49
|
const measure = `🦉${self.key}::view::update`;
|
|
47
50
|
const view = originalView(editorView);
|
|
51
|
+
let uiTrackingSamplingCounter = 0;
|
|
48
52
|
if (view.update) {
|
|
49
53
|
const originalUpdate = view.update;
|
|
50
54
|
view.update = (view, state) => {
|
|
51
|
-
|
|
55
|
+
const shouldTrack = uiTrackingSamplingRate && uiTrackingSamplingCounter === 0;
|
|
56
|
+
if (shouldTrack) {
|
|
57
|
+
startMeasure(measure);
|
|
58
|
+
}
|
|
52
59
|
originalUpdate(view, state);
|
|
53
|
-
|
|
60
|
+
if (shouldTrack) {
|
|
61
|
+
stopMeasure(measure, () => {});
|
|
62
|
+
}
|
|
63
|
+
uiTrackingSamplingCounter++;
|
|
64
|
+
if (uiTrackingSamplingRate && uiTrackingSamplingCounter >= uiTrackingSamplingRate) {
|
|
65
|
+
uiTrackingSamplingCounter = 0;
|
|
66
|
+
}
|
|
54
67
|
};
|
|
55
68
|
}
|
|
56
69
|
return view;
|
package/dist/es2019/version.json
CHANGED
|
@@ -11,7 +11,6 @@ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
|
11
11
|
import { BaseTheme } from '@atlaskit/editor-common/ui';
|
|
12
12
|
import { akEditorMenuZIndex, akEditorToolbarKeylineHeight } from '@atlaskit/editor-shared-styles';
|
|
13
13
|
import ContentStyles from '../../ui/ContentStyles';
|
|
14
|
-
import WidthEmitter from '../../ui/WidthEmitter';
|
|
15
14
|
import { ClickAreaBlock } from '../../ui/Addon';
|
|
16
15
|
import { scrollbarStyles } from '../../ui/styles';
|
|
17
16
|
import { tableFullPageEditorStyles } from '@atlaskit/editor-plugin-table/ui/common-styles';
|
|
@@ -20,7 +19,7 @@ import { Editor, EditorContent, useEditorSharedConfig } from './Editor';
|
|
|
20
19
|
import { Toolbar } from './Toolbar';
|
|
21
20
|
import { ContentComponents } from './ContentComponents';
|
|
22
21
|
import { useCreateAnalyticsHandler } from './internal/hooks/use-analytics';
|
|
23
|
-
import { ContextPanelWidthProvider } from '
|
|
22
|
+
import { ContextPanelWidthProvider } from '@atlaskit/editor-common/ui';
|
|
24
23
|
var fullPageEditorWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n min-width: 340px;\n height: 100%;\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n"])));
|
|
25
24
|
var scrollContainer = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex-grow: 1;\n overflow-y: scroll;\n position: relative;\n display: flex;\n flex-direction: column;\n scroll-behavior: smooth;\n ", ";\n"])), scrollbarStyles);
|
|
26
25
|
var GUTTER_PADDING = 32;
|
|
@@ -115,9 +114,7 @@ function FullPage(props) {
|
|
|
115
114
|
containerElement: scrollContainerRef.current
|
|
116
115
|
}))))), contextPanel && jsx("div", {
|
|
117
116
|
css: sidebarArea
|
|
118
|
-
}, contextPanel)
|
|
119
|
-
editorView: config === null || config === void 0 ? void 0 : config.editorView
|
|
120
|
-
}))))));
|
|
117
|
+
}, contextPanel))))));
|
|
121
118
|
}
|
|
122
119
|
FullPage.displayName = 'FullPageEditor';
|
|
123
120
|
var FullPageWithAnalytics = withAnalyticsEvents()(FullPage);
|
|
@@ -23,8 +23,10 @@ export var createStubInternalApis = function createStubInternalApis() {
|
|
|
23
23
|
// That means, there is no createAnalyticsEvent available at all.
|
|
24
24
|
// This should not happen, but if it does, we will send a mock function to avoid
|
|
25
25
|
// regression on SmartLinks (they are the only one using this function directly)
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
if (process.env.NODE_ENV === 'development') {
|
|
27
|
+
// eslint-disable-next-line no-console
|
|
28
|
+
console.error('This should never be called, if it does we have a problem');
|
|
29
|
+
}
|
|
28
30
|
return {
|
|
29
31
|
fire: function fire() {}
|
|
30
32
|
};
|
|
@@ -5,7 +5,7 @@ import blockTypePlugin from '../../../plugins/block-type';
|
|
|
5
5
|
import clearMarksOnChangeToEmptyDocumentPlugin from '../../../plugins/clear-marks-on-change-to-empty-document';
|
|
6
6
|
import hyperlinkPlugin from '../../../plugins/hyperlink';
|
|
7
7
|
import textFormattingPlugin from '../../../plugins/text-formatting';
|
|
8
|
-
import widthPlugin from '
|
|
8
|
+
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
9
9
|
import unsupportedContentPlugin from '../../../plugins/unsupported-content';
|
|
10
10
|
import basePlugin from '../../../plugins/base';
|
|
11
11
|
import editorDisabledPlugin from '../../../plugins/editor-disabled';
|
|
@@ -2,7 +2,8 @@ import _typeof from "@babel/runtime/helpers/typeof";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
4
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
-
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, emojiPlugin, extensionPlugin, fragmentMarkPlugin, helpDialogPlugin, imageUploadPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, listPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, rulePlugin, saveOnEnterPlugin, tasksAndDecisionsPlugin, textColorPlugin,
|
|
5
|
+
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, emojiPlugin, extensionPlugin, fragmentMarkPlugin, helpDialogPlugin, imageUploadPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, listPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, rulePlugin, saveOnEnterPlugin, tasksAndDecisionsPlugin, textColorPlugin, statusPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, contextPanelPlugin, mobileSelectionPlugin, annotationPlugin, captionPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin, copyButtonPlugin, borderPlugin } from '../../../plugins';
|
|
6
|
+
import { gridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
6
7
|
import cardPlugin from '../../../plugins/card';
|
|
7
8
|
import { tablesPlugin } from '@atlaskit/editor-plugin-table';
|
|
8
9
|
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
@@ -7,13 +7,12 @@ import React from 'react';
|
|
|
7
7
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
8
8
|
import { breakout } from '@atlaskit/adf-schema';
|
|
9
9
|
import { calcBreakoutWidthPx } from '@atlaskit/editor-common/utils';
|
|
10
|
-
import WithPluginState from '../../ui/WithPluginState';
|
|
11
|
-
import { pluginKey as widthPluginKey } from '../width';
|
|
12
10
|
import LayoutButton from './ui/LayoutButton';
|
|
13
11
|
import { BreakoutCssClassName } from './constants';
|
|
14
12
|
import { pluginKey } from './plugin-key';
|
|
15
13
|
import { findSupportedNodeForBreakout } from './utils/find-breakout-node';
|
|
16
14
|
import { akEditorSwoopCubicBezier } from '@atlaskit/editor-shared-styles';
|
|
15
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
17
16
|
var BreakoutView = /*#__PURE__*/function () {
|
|
18
17
|
function BreakoutView(
|
|
19
18
|
/**
|
|
@@ -21,14 +20,14 @@ var BreakoutView = /*#__PURE__*/function () {
|
|
|
21
20
|
* of the prosemirror and prosemirror types mean using PMNode
|
|
22
21
|
* is not problematic.
|
|
23
22
|
*/
|
|
24
|
-
mark, view,
|
|
23
|
+
mark, view, pluginInjectionApi) {
|
|
25
24
|
var _this = this;
|
|
26
25
|
_classCallCheck(this, BreakoutView);
|
|
27
26
|
_defineProperty(this, "updateWidth", function (widthState) {
|
|
28
27
|
// we skip updating the width of breakout nodes if the editorView dom
|
|
29
28
|
// element was hidden (to avoid breakout width and button thrashing
|
|
30
29
|
// when an editor is hidden, re-rendered and unhidden).
|
|
31
|
-
if (widthState.width === 0) {
|
|
30
|
+
if (widthState === undefined || widthState.width === 0) {
|
|
32
31
|
return;
|
|
33
32
|
}
|
|
34
33
|
var containerStyle = "";
|
|
@@ -80,9 +79,11 @@ var BreakoutView = /*#__PURE__*/function () {
|
|
|
80
79
|
this.mark = mark;
|
|
81
80
|
this.view = view;
|
|
82
81
|
this.contentDOM = contentDOM;
|
|
83
|
-
this.
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
this.unsubscribe = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.width.sharedState.onChange(function (_ref) {
|
|
83
|
+
var nextSharedState = _ref.nextSharedState;
|
|
84
|
+
return _this.updateWidth(nextSharedState);
|
|
85
|
+
});
|
|
86
|
+
this.updateWidth(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.width.sharedState.currentState());
|
|
86
87
|
}
|
|
87
88
|
_createClass(BreakoutView, [{
|
|
88
89
|
key: "destroy",
|
|
@@ -90,7 +91,8 @@ var BreakoutView = /*#__PURE__*/function () {
|
|
|
90
91
|
// NOTE: Lifecycle events doesn't work for mark NodeView. So currently this is a no-op.
|
|
91
92
|
// @see https://github.com/ProseMirror/prosemirror/issues/1082
|
|
92
93
|
function destroy() {
|
|
93
|
-
|
|
94
|
+
var _this$unsubscribe;
|
|
95
|
+
(_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 ? void 0 : _this$unsubscribe.call(this);
|
|
94
96
|
}
|
|
95
97
|
}]);
|
|
96
98
|
return BreakoutView;
|
|
@@ -101,9 +103,8 @@ function shouldPluginStateUpdate(newBreakoutNode, currentBreakoutNode) {
|
|
|
101
103
|
}
|
|
102
104
|
return newBreakoutNode || currentBreakoutNode ? true : false;
|
|
103
105
|
}
|
|
104
|
-
function createPlugin(
|
|
105
|
-
var dispatch =
|
|
106
|
-
eventDispatcher = _ref.eventDispatcher;
|
|
106
|
+
function createPlugin(pluginInjectionApi, _ref2) {
|
|
107
|
+
var dispatch = _ref2.dispatch;
|
|
107
108
|
return new SafePlugin({
|
|
108
109
|
state: {
|
|
109
110
|
init: function init() {
|
|
@@ -132,19 +133,39 @@ function createPlugin(_ref) {
|
|
|
132
133
|
// See the following link for more details:
|
|
133
134
|
// https://prosemirror.net/docs/ref/#view.EditorProps.nodeViews.
|
|
134
135
|
breakout: function breakout(mark, view) {
|
|
135
|
-
return new BreakoutView(mark, view,
|
|
136
|
+
return new BreakoutView(mark, view, pluginInjectionApi);
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
});
|
|
140
141
|
}
|
|
141
|
-
var
|
|
142
|
+
var LayoutButtonWrapper = function LayoutButtonWrapper(_ref3) {
|
|
143
|
+
var _breakoutState$breako;
|
|
144
|
+
var api = _ref3.api,
|
|
145
|
+
editorView = _ref3.editorView,
|
|
146
|
+
boundariesElement = _ref3.boundariesElement,
|
|
147
|
+
scrollableElement = _ref3.scrollableElement,
|
|
148
|
+
mountPoint = _ref3.mountPoint;
|
|
149
|
+
// Re-render with `width` (but don't use state) due to https://bitbucket.org/atlassian/%7Bc8e2f021-38d2-46d0-9b7a-b3f7b428f724%7D/pull-requests/24272
|
|
150
|
+
var _useSharedPluginState = useSharedPluginState(api, ['width', 'breakout']),
|
|
151
|
+
breakoutState = _useSharedPluginState.breakoutState;
|
|
152
|
+
return /*#__PURE__*/React.createElement(LayoutButton, {
|
|
153
|
+
editorView: editorView,
|
|
154
|
+
mountPoint: mountPoint,
|
|
155
|
+
boundariesElement: boundariesElement,
|
|
156
|
+
scrollableElement: scrollableElement,
|
|
157
|
+
node: (_breakoutState$breako = breakoutState === null || breakoutState === void 0 ? void 0 : breakoutState.breakoutNode) !== null && _breakoutState$breako !== void 0 ? _breakoutState$breako : null
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
var breakoutPlugin = function breakoutPlugin(options, api) {
|
|
142
161
|
return {
|
|
143
162
|
name: 'breakout',
|
|
144
163
|
pmPlugins: function pmPlugins() {
|
|
145
164
|
return [{
|
|
146
165
|
name: 'breakout',
|
|
147
|
-
plugin:
|
|
166
|
+
plugin: function plugin(props) {
|
|
167
|
+
return createPlugin(api, props);
|
|
168
|
+
}
|
|
148
169
|
}];
|
|
149
170
|
},
|
|
150
171
|
marks: function marks() {
|
|
@@ -153,31 +174,29 @@ var breakoutPlugin = function breakoutPlugin(options) {
|
|
|
153
174
|
mark: breakout
|
|
154
175
|
}];
|
|
155
176
|
},
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
177
|
+
getSharedState: function getSharedState(editorState) {
|
|
178
|
+
if (!editorState) {
|
|
179
|
+
return {
|
|
180
|
+
breakoutNode: undefined
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
return pluginKey.getState(editorState);
|
|
184
|
+
},
|
|
185
|
+
contentComponent: function contentComponent(_ref4) {
|
|
186
|
+
var editorView = _ref4.editorView,
|
|
187
|
+
popupsMountPoint = _ref4.popupsMountPoint,
|
|
188
|
+
popupsBoundariesElement = _ref4.popupsBoundariesElement,
|
|
189
|
+
popupsScrollableElement = _ref4.popupsScrollableElement;
|
|
161
190
|
// This is a bit crappy, but should be resolved once we move to a static schema.
|
|
162
191
|
if (options && !options.allowBreakoutButton) {
|
|
163
192
|
return null;
|
|
164
193
|
}
|
|
165
|
-
return /*#__PURE__*/React.createElement(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
var _breakoutPluginState$;
|
|
172
|
-
var breakoutPluginState = _ref3.breakoutPluginState;
|
|
173
|
-
return /*#__PURE__*/React.createElement(LayoutButton, {
|
|
174
|
-
editorView: editorView,
|
|
175
|
-
mountPoint: popupsMountPoint,
|
|
176
|
-
boundariesElement: popupsBoundariesElement,
|
|
177
|
-
scrollableElement: popupsScrollableElement,
|
|
178
|
-
node: (_breakoutPluginState$ = breakoutPluginState === null || breakoutPluginState === void 0 ? void 0 : breakoutPluginState.breakoutNode) !== null && _breakoutPluginState$ !== void 0 ? _breakoutPluginState$ : null
|
|
179
|
-
});
|
|
180
|
-
}
|
|
194
|
+
return /*#__PURE__*/React.createElement(LayoutButtonWrapper, {
|
|
195
|
+
api: api,
|
|
196
|
+
mountPoint: popupsMountPoint,
|
|
197
|
+
editorView: editorView,
|
|
198
|
+
boundariesElement: popupsBoundariesElement,
|
|
199
|
+
scrollableElement: popupsScrollableElement
|
|
181
200
|
});
|
|
182
201
|
}
|
|
183
202
|
};
|
|
@@ -153,8 +153,8 @@ var unlinkCard = function unlinkCard(node, state, editorAnalyticsApi) {
|
|
|
153
153
|
return false;
|
|
154
154
|
};
|
|
155
155
|
};
|
|
156
|
-
var buildAlignmentOptions = function buildAlignmentOptions(state, intl, cardOptions) {
|
|
157
|
-
return buildLayoutButtons(state, intl, state.schema.nodes.embedCard, true, true, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowWrapping, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowAlignment);
|
|
156
|
+
var buildAlignmentOptions = function buildAlignmentOptions(state, intl, widthPluginDependencyApi, cardOptions) {
|
|
157
|
+
return buildLayoutButtons(state, intl, state.schema.nodes.embedCard, widthPluginDependencyApi, true, true, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowWrapping, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowAlignment);
|
|
158
158
|
};
|
|
159
159
|
var withToolbarMetadata = function withToolbarMetadata(command) {
|
|
160
160
|
return commandWithMetadata(command, {
|
|
@@ -238,7 +238,8 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
|
|
|
238
238
|
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
239
239
|
}]);
|
|
240
240
|
if (currentAppearance === 'embed') {
|
|
241
|
-
var
|
|
241
|
+
var _pluginInjectionApi$d5;
|
|
242
|
+
var alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d5 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d5 === void 0 ? void 0 : _pluginInjectionApi$d5.width, cardOptions);
|
|
242
243
|
if (alignmentOptions.length) {
|
|
243
244
|
alignmentOptions.push({
|
|
244
245
|
type: 'separator'
|
|
@@ -107,9 +107,8 @@ export var PluginState = /*#__PURE__*/function () {
|
|
|
107
107
|
remove = remove.concat(oldPointers);
|
|
108
108
|
}
|
|
109
109
|
var endOfDocPos = tr.doc.nodeSize - 2;
|
|
110
|
-
var
|
|
111
|
-
|
|
112
|
-
head = _telepointerData$sele.head;
|
|
110
|
+
var anchor = telepointerData.selection.anchor;
|
|
111
|
+
var head = telepointerData.selection.head;
|
|
113
112
|
var rawFrom = anchor < head ? anchor : head;
|
|
114
113
|
var rawTo = anchor >= head ? anchor : head;
|
|
115
114
|
if (rawFrom > endOfDocPos) {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { copyButtonPluginKey } from './pm-plugins/plugin-key';
|
|
2
2
|
import { hoverDecoration } from '../base/pm-plugins/decoration';
|
|
3
|
-
import {
|
|
3
|
+
import { NodeSelection } from 'prosemirror-state';
|
|
4
|
+
import { copyHTMLToClipboard, copyHTMLToClipboardPolyfill } from '../../utils/clipboard';
|
|
4
5
|
import { getSelectedNodeOrNodeParentByNodeType, toDOM } from './utils';
|
|
5
6
|
import { addAnalytics, ACTION, INPUT_METHOD } from '../analytics';
|
|
6
7
|
import { getAnalyticsPayload } from '../clipboard/pm-plugins/main';
|
|
8
|
+
import { browser } from '@atlaskit/editor-common/utils';
|
|
7
9
|
export function createToolbarCopyCommandForMark(markType) {
|
|
8
10
|
function command(state, dispatch) {
|
|
9
11
|
var textNode = state.tr.selection.$head.parent.maybeChild(state.tr.selection.$head.index());
|
|
@@ -120,7 +122,12 @@ export var createToolbarCopyCommandForNode = function createToolbarCopyCommandFo
|
|
|
120
122
|
// https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
|
|
121
123
|
div.firstChild.setAttribute('data-pm-slice', '0 0 []');
|
|
122
124
|
}
|
|
123
|
-
|
|
125
|
+
// ED-17083 safari seems have bugs for extension copy because exntension do not have a child text(innerText) and it will not recognized as html in clipboard, this could be merge into one if this extension fixed children issue or safari fix the copy bug
|
|
126
|
+
if (browser.safari && state.selection instanceof NodeSelection && state.selection.node.type === state.schema.nodes.extension) {
|
|
127
|
+
copyHTMLToClipboardPolyfill(div);
|
|
128
|
+
} else {
|
|
129
|
+
copyHTMLToClipboard(div);
|
|
130
|
+
}
|
|
124
131
|
}
|
|
125
132
|
copyToClipboardTr.setMeta('scrollIntoView', false);
|
|
126
133
|
dispatch(copyToClipboardTr);
|
|
@@ -32,7 +32,7 @@ var extensionPlugin = function extensionPlugin() {
|
|
|
32
32
|
portalProviderAPI = _ref.portalProviderAPI,
|
|
33
33
|
eventDispatcher = _ref.eventDispatcher;
|
|
34
34
|
var extensionHandlers = options.extensionHandlers || {};
|
|
35
|
-
return createPlugin(dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, options.useLongPressSelection, {
|
|
35
|
+
return createPlugin(dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, api, options.useLongPressSelection, {
|
|
36
36
|
appearance: options.appearance
|
|
37
37
|
});
|
|
38
38
|
}
|
|
@@ -62,19 +62,21 @@ export var ExtensionNode = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
62
62
|
providerFactory: props.providerFactory,
|
|
63
63
|
handleContentDOMRef: forwardRef,
|
|
64
64
|
extensionHandlers: props.extensionHandlers,
|
|
65
|
-
editorAppearance: (_props$extensionNodeV = props.extensionNodeViewOptions) === null || _props$extensionNodeV === void 0 ? void 0 : _props$extensionNodeV.appearance
|
|
65
|
+
editorAppearance: (_props$extensionNodeV = props.extensionNodeViewOptions) === null || _props$extensionNodeV === void 0 ? void 0 : _props$extensionNodeV.appearance,
|
|
66
|
+
pluginInjectionApi: props.pluginInjectionApi
|
|
66
67
|
}));
|
|
67
68
|
}
|
|
68
69
|
}]);
|
|
69
70
|
return ExtensionNode;
|
|
70
71
|
}(ReactNodeView);
|
|
71
|
-
export default function ExtensionNodeView(portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions) {
|
|
72
|
+
export default function ExtensionNodeView(portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi) {
|
|
72
73
|
return function (node, view, getPos) {
|
|
73
74
|
var hasIntlContext = true;
|
|
74
75
|
return new ExtensionNode(node, view, getPos, portalProviderAPI, eventDispatcher, {
|
|
75
76
|
providerFactory: providerFactory,
|
|
76
77
|
extensionHandlers: extensionHandlers,
|
|
77
|
-
extensionNodeViewOptions: extensionNodeViewOptions
|
|
78
|
+
extensionNodeViewOptions: extensionNodeViewOptions,
|
|
79
|
+
pluginInjectionApi: pluginInjectionApi
|
|
78
80
|
}, undefined, undefined, undefined, hasIntlContext).init();
|
|
79
81
|
};
|
|
80
82
|
}
|
|
@@ -194,9 +194,9 @@ export var handleUpdate = function handleUpdate(_ref4) {
|
|
|
194
194
|
}
|
|
195
195
|
return true;
|
|
196
196
|
};
|
|
197
|
-
var createPlugin = function createPlugin(dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher) {
|
|
198
|
-
var useLongPressSelection = arguments.length >
|
|
199
|
-
var options = arguments.length >
|
|
197
|
+
var createPlugin = function createPlugin(dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, pluginInjectionApi) {
|
|
198
|
+
var useLongPressSelection = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
199
|
+
var options = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : {};
|
|
200
200
|
var state = createPluginState(dispatch, {
|
|
201
201
|
showEditButton: false,
|
|
202
202
|
showContextPanel: false
|
|
@@ -231,11 +231,11 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
|
|
|
231
231
|
props: {
|
|
232
232
|
nodeViews: {
|
|
233
233
|
// WARNING: referentiality-plugin also creates these nodeviews
|
|
234
|
-
extension: ExtensionNodeView(portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions),
|
|
234
|
+
extension: ExtensionNodeView(portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi),
|
|
235
235
|
// WARNING: referentiality-plugin also creates these nodeviews
|
|
236
|
-
bodiedExtension: ExtensionNodeView(portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions),
|
|
236
|
+
bodiedExtension: ExtensionNodeView(portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi),
|
|
237
237
|
// WARNING: referentiality-plugin also creates these nodeviews
|
|
238
|
-
inlineExtension: ExtensionNodeView(portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions)
|
|
238
|
+
inlineExtension: ExtensionNodeView(portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi)
|
|
239
239
|
},
|
|
240
240
|
handleClickOn: createSelectionClickHandler(['extension', 'bodiedExtension'], function (target) {
|
|
241
241
|
return !target.closest('.extension-content');
|
|
@@ -12,9 +12,8 @@ import { calculateBreakoutStyles } from '@atlaskit/editor-common/utils';
|
|
|
12
12
|
import { wrapperStyle, header, content, contentWrapper, widerLayoutClassName } from './styles';
|
|
13
13
|
import { overlay } from '../styles';
|
|
14
14
|
import ExtensionLozenge from '../Lozenge';
|
|
15
|
-
import { pluginKey as widthPluginKey } from '../../../../width';
|
|
16
|
-
import WithPluginState from '../../../../../ui/WithPluginState';
|
|
17
15
|
import classnames from 'classnames';
|
|
16
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
18
17
|
function ExtensionWithPluginState(props) {
|
|
19
18
|
var node = props.node,
|
|
20
19
|
handleContentDOMRef = props.handleContentDOMRef,
|
|
@@ -89,6 +88,34 @@ function ExtensionWithPluginState(props) {
|
|
|
89
88
|
}))));
|
|
90
89
|
}
|
|
91
90
|
var Extension = function Extension(props) {
|
|
91
|
+
// TODO: ED-17836 This code is here because confluence injects
|
|
92
|
+
// the `editor-referentiality` plugin via `dangerouslyAppendPlugins`
|
|
93
|
+
// which cannot access the `pluginInjectionApi`. When we move
|
|
94
|
+
// Confluence to using presets we can remove this workaround.
|
|
95
|
+
var pluginInjectionApi = props.pluginInjectionApi;
|
|
96
|
+
return pluginInjectionApi === undefined ? jsx(ExtensionDeprecated, props) : jsx(ExtensionWithSharedState, props);
|
|
97
|
+
};
|
|
98
|
+
var ExtensionWithSharedState = function ExtensionWithSharedState(props) {
|
|
99
|
+
var pluginInjectionApi = props.pluginInjectionApi;
|
|
100
|
+
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['width']),
|
|
101
|
+
widthState = _useSharedPluginState.widthState;
|
|
102
|
+
return jsx(ExtensionWithPluginState, _extends({
|
|
103
|
+
widthState: widthState
|
|
104
|
+
}, props));
|
|
105
|
+
};
|
|
106
|
+
import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
|
|
107
|
+
// TODO: ED-17836 This code is here because Confluence injects
|
|
108
|
+
// the `editor-referentiality` plugin via `dangerouslyAppendPlugins`
|
|
109
|
+
// which cannot access the `pluginInjectionApi`. When we move
|
|
110
|
+
// Confluence to using presets we can remove this workaround.
|
|
111
|
+
// @ts-ignore
|
|
112
|
+
var widthPluginKey = {
|
|
113
|
+
key: 'widthPlugin$',
|
|
114
|
+
getState: function getState(state) {
|
|
115
|
+
return state['widthPlugin$'];
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
var ExtensionDeprecated = function ExtensionDeprecated(props) {
|
|
92
119
|
return jsx(WithPluginState, {
|
|
93
120
|
editorView: props.view,
|
|
94
121
|
plugins: {
|
|
@@ -102,6 +129,10 @@ var Extension = function Extension(props) {
|
|
|
102
129
|
}
|
|
103
130
|
});
|
|
104
131
|
};
|
|
132
|
+
/**
|
|
133
|
+
* End workaround
|
|
134
|
+
*/
|
|
135
|
+
|
|
105
136
|
export default overflowShadow(Extension, {
|
|
106
137
|
overflowSelector: '.extension-overflow-wrapper'
|
|
107
138
|
});
|
|
@@ -172,7 +172,8 @@ var ExtensionComponent = /*#__PURE__*/function (_Component) {
|
|
|
172
172
|
handleContentDOMRef = _this$props2.handleContentDOMRef,
|
|
173
173
|
editorView = _this$props2.editorView,
|
|
174
174
|
references = _this$props2.references,
|
|
175
|
-
editorAppearance = _this$props2.editorAppearance
|
|
175
|
+
editorAppearance = _this$props2.editorAppearance,
|
|
176
|
+
pluginInjectionApi = _this$props2.pluginInjectionApi;
|
|
176
177
|
var extensionHandlerResult = this.tryExtensionHandler();
|
|
177
178
|
switch (node.type.name) {
|
|
178
179
|
case 'extension':
|
|
@@ -185,7 +186,8 @@ var ExtensionComponent = /*#__PURE__*/function (_Component) {
|
|
|
185
186
|
handleContentDOMRef: handleContentDOMRef,
|
|
186
187
|
view: editorView,
|
|
187
188
|
editorAppearance: editorAppearance,
|
|
188
|
-
hideFrame: (_this$state$_privateP = this.state._privateProps) === null || _this$state$_privateP === void 0 ? void 0 : _this$state$_privateP.__hideFrame
|
|
189
|
+
hideFrame: (_this$state$_privateP = this.state._privateProps) === null || _this$state$_privateP === void 0 ? void 0 : _this$state$_privateP.__hideFrame,
|
|
190
|
+
pluginInjectionApi: pluginInjectionApi
|
|
189
191
|
}, extensionHandlerResult);
|
|
190
192
|
case 'inlineExtension':
|
|
191
193
|
return /*#__PURE__*/React.createElement(InlineExtension, {
|
|
@@ -27,7 +27,8 @@ var Extension = /*#__PURE__*/function (_Component) {
|
|
|
27
27
|
handleContentDOMRef = _this$props.handleContentDOMRef,
|
|
28
28
|
extensionHandlers = _this$props.extensionHandlers,
|
|
29
29
|
references = _this$props.references,
|
|
30
|
-
editorAppearance = _this$props.editorAppearance
|
|
30
|
+
editorAppearance = _this$props.editorAppearance,
|
|
31
|
+
pluginInjectionApi = _this$props.pluginInjectionApi;
|
|
31
32
|
return /*#__PURE__*/React.createElement(ExtensionComponent, {
|
|
32
33
|
editorView: editorView,
|
|
33
34
|
node: node,
|
|
@@ -36,7 +37,8 @@ var Extension = /*#__PURE__*/function (_Component) {
|
|
|
36
37
|
extensionProvider: extensionProvider,
|
|
37
38
|
handleContentDOMRef: handleContentDOMRef,
|
|
38
39
|
extensionHandlers: extensionHandlers,
|
|
39
|
-
editorAppearance: editorAppearance
|
|
40
|
+
editorAppearance: editorAppearance,
|
|
41
|
+
pluginInjectionApi: pluginInjectionApi
|
|
40
42
|
});
|
|
41
43
|
});
|
|
42
44
|
_this.providerFactory = props.providerFactory || new ProviderFactory();
|
|
@@ -9,7 +9,7 @@ import { openHelp, tooltip } from '../../keymaps';
|
|
|
9
9
|
import WithPluginState from '../../ui/WithPluginState';
|
|
10
10
|
import { HelpDialogLoader } from './ui/HelpDialogLoader';
|
|
11
11
|
import { pluginKey as quickInsertPluginKey } from '../quick-insert';
|
|
12
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID,
|
|
12
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
13
13
|
import QuestionCircleIcon from '@atlaskit/icon/glyph/question-circle';
|
|
14
14
|
import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
15
15
|
import { openHelpCommand } from './commands';
|
|
@@ -41,6 +41,7 @@ export function createPlugin(dispatch, imageEnabled) {
|
|
|
41
41
|
}
|
|
42
42
|
var helpDialog = function helpDialog() {
|
|
43
43
|
var imageUploadProviderExists = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
44
|
+
var api = arguments.length > 1 ? arguments[1] : undefined;
|
|
44
45
|
return {
|
|
45
46
|
name: 'helpDialog',
|
|
46
47
|
pmPlugins: function pmPlugins() {
|
|
@@ -53,7 +54,8 @@ var helpDialog = function helpDialog() {
|
|
|
53
54
|
}, {
|
|
54
55
|
name: 'helpDialogKeymap',
|
|
55
56
|
plugin: function plugin() {
|
|
56
|
-
|
|
57
|
+
var _api$dependencies$ana;
|
|
58
|
+
return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions);
|
|
57
59
|
}
|
|
58
60
|
}];
|
|
59
61
|
},
|
|
@@ -72,10 +74,11 @@ var helpDialog = function helpDialog() {
|
|
|
72
74
|
label: ""
|
|
73
75
|
});
|
|
74
76
|
},
|
|
75
|
-
action: function action(insert
|
|
77
|
+
action: function action(insert) {
|
|
78
|
+
var _api$dependencies$ana2;
|
|
76
79
|
var tr = insert('');
|
|
77
80
|
openHelpCommand(tr);
|
|
78
|
-
|
|
81
|
+
api === null || api === void 0 ? void 0 : (_api$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.actions.attachAnalyticsEvent({
|
|
79
82
|
action: ACTION.HELP_OPENED,
|
|
80
83
|
actionSubject: ACTION_SUBJECT.HELP,
|
|
81
84
|
actionSubjectId: ACTION_SUBJECT_ID.HELP_QUICK_INSERT,
|
|
@@ -83,7 +86,8 @@ var helpDialog = function helpDialog() {
|
|
|
83
86
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
84
87
|
},
|
|
85
88
|
eventType: EVENT_TYPE.UI
|
|
86
|
-
});
|
|
89
|
+
})(tr);
|
|
90
|
+
return tr;
|
|
87
91
|
}
|
|
88
92
|
}];
|
|
89
93
|
}
|
|
@@ -110,13 +114,13 @@ var helpDialog = function helpDialog() {
|
|
|
110
114
|
}
|
|
111
115
|
};
|
|
112
116
|
};
|
|
113
|
-
var keymapPlugin = function keymapPlugin() {
|
|
117
|
+
var keymapPlugin = function keymapPlugin(editorAnalyticsAPI) {
|
|
114
118
|
var list = {};
|
|
115
119
|
keymaps.bindKeymapWithCommand(keymaps.openHelp.common, function (state, dispatch) {
|
|
116
120
|
var tr = state.tr;
|
|
117
121
|
var isVisible = tr.getMeta(pluginKey);
|
|
118
122
|
if (!isVisible) {
|
|
119
|
-
|
|
123
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
120
124
|
action: ACTION.CLICKED,
|
|
121
125
|
actionSubject: ACTION_SUBJECT.BUTTON,
|
|
122
126
|
actionSubjectId: ACTION_SUBJECT_ID.BUTTON_HELP,
|
|
@@ -124,7 +128,7 @@ var keymapPlugin = function keymapPlugin() {
|
|
|
124
128
|
inputMethod: INPUT_METHOD.SHORTCUT
|
|
125
129
|
},
|
|
126
130
|
eventType: EVENT_TYPE.UI
|
|
127
|
-
});
|
|
131
|
+
})(tr);
|
|
128
132
|
openHelpCommand(tr, dispatch);
|
|
129
133
|
}
|
|
130
134
|
return true;
|
|
@@ -33,11 +33,9 @@ export { default as textColorPlugin } from './text-color';
|
|
|
33
33
|
export { default as textFormattingPlugin } from './text-formatting';
|
|
34
34
|
export { default as typeAheadPlugin } from './type-ahead';
|
|
35
35
|
export { default as unsupportedContentPlugin } from './unsupported-content';
|
|
36
|
-
export { default as widthPlugin } from './width';
|
|
37
36
|
export { default as cardPlugin } from './card';
|
|
38
37
|
export { default as floatingToolbarPlugin } from './floating-toolbar';
|
|
39
38
|
export { default as statusPlugin } from './status';
|
|
40
|
-
export { default as gridPlugin } from './grid';
|
|
41
39
|
export { default as breakoutPlugin } from './breakout';
|
|
42
40
|
export { default as alignmentPlugin } from './alignment';
|
|
43
41
|
export { default as dataConsumerMarkPlugin } from './data-consumer';
|