@atlaskit/editor-core 172.0.4 → 172.1.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 +56 -0
- package/dist/cjs/create-editor/ReactEditorView.js +11 -2
- package/dist/cjs/create-editor/ReactEditorViewContext.js +15 -0
- package/dist/cjs/create-editor/create-plugins-list.js +2 -1
- package/dist/cjs/editor.js +7 -1
- package/dist/cjs/labs/next/mobile.js +5 -3
- package/dist/cjs/messages.js +5 -0
- package/dist/cjs/plugins/analytics/types/enums.js +1 -0
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +1 -1
- package/dist/cjs/plugins/card/nodeviews/inlineCard.js +8 -0
- package/dist/cjs/plugins/card/pm-plugins/doc.js +2 -26
- package/dist/cjs/plugins/card/toolbar.js +118 -86
- package/dist/cjs/plugins/code-block/nodeviews/code-block.js +9 -2
- package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +37 -1
- package/dist/cjs/plugins/code-block/toolbar.js +3 -1
- package/dist/cjs/plugins/code-block/ui/class-names.js +2 -0
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +4 -3
- package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +3 -1
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +42 -2
- package/dist/cjs/plugins/hyperlink/Toolbar.js +43 -8
- package/dist/cjs/plugins/media/commands/helpers.js +1 -8
- package/dist/cjs/plugins/media/index.js +1 -1
- package/dist/cjs/plugins/media/nodeviews/mediaNodeView/index.js +0 -10
- package/dist/cjs/plugins/media/nodeviews/mediaNodeView/media.js +2 -3
- package/dist/cjs/plugins/media/picker-facade.js +1 -0
- package/dist/cjs/plugins/media/pm-plugins/main.js +3 -13
- package/dist/cjs/plugins/panel/pm-plugins/keymaps.js +1 -1
- package/dist/cjs/plugins/paste/handlers.js +9 -20
- package/dist/cjs/plugins/paste/md.js +8 -2
- package/dist/cjs/plugins/paste/newline-md-plugin.js +67 -0
- package/dist/cjs/plugins/paste/paragraph-md-plugin.js +72 -0
- package/dist/cjs/plugins/table/commands/hover.js +4 -4
- package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/table/utils/decoration.js +53 -3
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -0
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +3 -2
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +78 -53
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +1 -1
- package/dist/cjs/ui/Addon/ClickAreaBlock/index.js +7 -2
- package/dist/cjs/ui/Addon/ClickAreaMobile/index.js +8 -2
- package/dist/cjs/ui/Appearance/Comment/Comment.js +13 -13
- package/dist/cjs/ui/Appearance/FullPage/FullPage.js +8 -7
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
- package/dist/cjs/ui/Appearance/Mobile.js +4 -2
- package/dist/cjs/ui/AppearanceComponents/Mobile.js +5 -4
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/DropdownMenu/index.js +5 -5
- package/dist/cjs/ui/with-outer-listeners.js +105 -50
- package/dist/cjs/utils/deprecation-warnings.js +4 -0
- package/dist/cjs/utils/linking-utils.js +40 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +11 -2
- package/dist/es2019/create-editor/ReactEditorViewContext.js +3 -0
- package/dist/es2019/create-editor/create-plugins-list.js +2 -1
- package/dist/es2019/editor.js +7 -1
- package/dist/es2019/labs/next/mobile.js +5 -3
- package/dist/es2019/messages.js +5 -0
- package/dist/es2019/plugins/analytics/types/enums.js +1 -0
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +1 -1
- package/dist/es2019/plugins/card/nodeviews/inlineCard.js +10 -0
- package/dist/es2019/plugins/card/pm-plugins/doc.js +1 -24
- package/dist/es2019/plugins/card/toolbar.js +114 -86
- package/dist/es2019/plugins/code-block/nodeviews/code-block.js +9 -2
- package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +40 -2
- package/dist/es2019/plugins/code-block/toolbar.js +2 -1
- package/dist/es2019/plugins/code-block/ui/class-names.js +2 -0
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +4 -3
- package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +3 -2
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +37 -0
- package/dist/es2019/plugins/hyperlink/Toolbar.js +40 -9
- package/dist/es2019/plugins/media/commands/helpers.js +0 -2
- package/dist/es2019/plugins/media/index.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaNodeView/index.js +0 -7
- package/dist/es2019/plugins/media/nodeviews/mediaNodeView/media.js +2 -3
- package/dist/es2019/plugins/media/picker-facade.js +1 -0
- package/dist/es2019/plugins/media/pm-plugins/main.js +3 -13
- package/dist/es2019/plugins/panel/pm-plugins/keymaps.js +1 -1
- package/dist/es2019/plugins/paste/handlers.js +7 -19
- package/dist/es2019/plugins/paste/md.js +6 -2
- package/dist/es2019/plugins/paste/newline-md-plugin.js +56 -0
- package/dist/es2019/plugins/paste/paragraph-md-plugin.js +61 -0
- package/dist/es2019/plugins/table/commands/hover.js +4 -4
- package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
- package/dist/es2019/plugins/table/ui/common-styles.js +39 -2
- package/dist/es2019/plugins/table/utils/decoration.js +60 -24
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -0
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +4 -3
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +78 -59
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +2 -2
- package/dist/es2019/ui/Addon/ClickAreaBlock/index.js +6 -2
- package/dist/es2019/ui/Addon/ClickAreaMobile/index.js +7 -2
- package/dist/es2019/ui/Appearance/Comment/Comment.js +12 -6
- package/dist/es2019/ui/Appearance/FullPage/FullPage.js +7 -2
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
- package/dist/es2019/ui/Appearance/Mobile.js +4 -2
- package/dist/es2019/ui/AppearanceComponents/Mobile.js +5 -4
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/DropdownMenu/index.js +10 -6
- package/dist/es2019/ui/with-outer-listeners.js +83 -33
- package/dist/es2019/utils/deprecation-warnings.js +4 -0
- package/dist/es2019/utils/linking-utils.js +37 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +11 -2
- package/dist/esm/create-editor/ReactEditorViewContext.js +3 -0
- package/dist/esm/create-editor/create-plugins-list.js +2 -1
- package/dist/esm/editor.js +7 -1
- package/dist/esm/labs/next/mobile.js +5 -3
- package/dist/esm/messages.js +5 -0
- package/dist/esm/plugins/analytics/types/enums.js +1 -0
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +1 -1
- package/dist/esm/plugins/card/nodeviews/inlineCard.js +9 -0
- package/dist/esm/plugins/card/pm-plugins/doc.js +1 -20
- package/dist/esm/plugins/card/toolbar.js +108 -83
- package/dist/esm/plugins/code-block/nodeviews/code-block.js +9 -2
- package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +37 -2
- package/dist/esm/plugins/code-block/toolbar.js +2 -1
- package/dist/esm/plugins/code-block/ui/class-names.js +2 -0
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +4 -3
- package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +3 -2
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +41 -2
- package/dist/esm/plugins/hyperlink/Toolbar.js +43 -10
- package/dist/esm/plugins/media/commands/helpers.js +0 -4
- package/dist/esm/plugins/media/index.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaNodeView/index.js +0 -8
- package/dist/esm/plugins/media/nodeviews/mediaNodeView/media.js +2 -3
- package/dist/esm/plugins/media/picker-facade.js +1 -0
- package/dist/esm/plugins/media/pm-plugins/main.js +3 -15
- package/dist/esm/plugins/panel/pm-plugins/keymaps.js +1 -1
- package/dist/esm/plugins/paste/handlers.js +11 -22
- package/dist/esm/plugins/paste/md.js +6 -2
- package/dist/esm/plugins/paste/newline-md-plugin.js +58 -0
- package/dist/esm/plugins/paste/paragraph-md-plugin.js +63 -0
- package/dist/esm/plugins/table/commands/hover.js +4 -4
- package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
- package/dist/esm/plugins/table/ui/common-styles.js +1 -1
- package/dist/esm/plugins/table/utils/decoration.js +50 -3
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -0
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +4 -3
- package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +77 -51
- package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +2 -2
- package/dist/esm/ui/Addon/ClickAreaBlock/index.js +7 -2
- package/dist/esm/ui/Addon/ClickAreaMobile/index.js +8 -2
- package/dist/esm/ui/Appearance/Comment/Comment.js +12 -12
- package/dist/esm/ui/Appearance/FullPage/FullPage.js +7 -6
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
- package/dist/esm/ui/Appearance/Mobile.js +4 -2
- package/dist/esm/ui/AppearanceComponents/Mobile.js +5 -4
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/DropdownMenu/index.js +5 -5
- package/dist/esm/ui/with-outer-listeners.js +105 -51
- package/dist/esm/utils/deprecation-warnings.js +4 -0
- package/dist/esm/utils/linking-utils.js +37 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/ReactEditorView.d.ts +3 -0
- package/dist/types/create-editor/ReactEditorViewContext.d.ts +8 -0
- package/dist/types/messages.d.ts +5 -0
- package/dist/types/plugins/analytics/types/enums.d.ts +1 -0
- package/dist/types/plugins/analytics/types/events.d.ts +2 -2
- package/dist/types/plugins/analytics/types/link-tool-bar-events.d.ts +1 -0
- package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +3 -0
- package/dist/types/plugins/card/pm-plugins/doc.d.ts +1 -2
- package/dist/types/plugins/card/toolbar.d.ts +1 -0
- package/dist/types/plugins/card/ui/ResizableEmbedCard.d.ts +1 -1
- package/dist/types/plugins/code-block/pm-plugins/ide-ux.d.ts +4 -1
- package/dist/types/plugins/code-block/ui/class-names.d.ts +2 -0
- package/dist/types/plugins/hyperlink/types.d.ts +1 -0
- package/dist/types/plugins/media/commands/helpers.d.ts +0 -1
- package/dist/types/plugins/media/nodeviews/mediaNodeView/index.d.ts +0 -1
- package/dist/types/plugins/media/nodeviews/mediaNodeView/media.d.ts +0 -1
- package/dist/types/plugins/media/pm-plugins/main.d.ts +0 -2
- package/dist/types/plugins/media/pm-plugins/types.d.ts +0 -2
- package/dist/types/plugins/media/ui/ResizableMediaSingle/index.d.ts +1 -1
- package/dist/types/plugins/paste/newline-md-plugin.d.ts +2 -0
- package/dist/types/plugins/paste/paragraph-md-plugin.d.ts +2 -0
- package/dist/types/plugins/table/utils/decoration.d.ts +1 -1
- package/dist/types/types/editor-appearance-component.d.ts +1 -0
- package/dist/types/types/feature-flags.d.ts +9 -0
- package/dist/types/ui/Addon/ClickAreaBlock/index.d.ts +1 -0
- package/dist/types/ui/Addon/ClickAreaMobile/index.d.ts +1 -0
- package/dist/types/ui/Appearance/FullPage/FullPage.d.ts +1 -0
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +3 -3
- package/dist/types/ui/Appearance/Mobile.d.ts +1 -1
- package/dist/types/ui/AppearanceComponents/Mobile.d.ts +2 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/Dropdown/index.d.ts +1 -1
- package/dist/types/ui/with-outer-listeners.d.ts +2 -1
- package/dist/types/utils/linking-utils.d.ts +1 -0
- package/package.json +37 -39
- package/dist/cjs/plugins/type-ahead/ui/DynamicHeightListItem.js +0 -77
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +0 -118
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-resize-observer.js +0 -70
- package/dist/es2019/plugins/type-ahead/ui/DynamicHeightListItem.js +0 -51
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +0 -97
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-resize-observer.js +0 -53
- package/dist/esm/plugins/type-ahead/ui/DynamicHeightListItem.js +0 -51
- package/dist/esm/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +0 -101
- package/dist/esm/plugins/type-ahead/ui/hooks/use-resize-observer.js +0 -48
- package/dist/types/plugins/type-ahead/ui/DynamicHeightListItem.d.ts +0 -21
- package/dist/types/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.d.ts +0 -25
- package/dist/types/plugins/type-ahead/ui/hooks/use-resize-observer.d.ts +0 -8
|
@@ -46,6 +46,7 @@ import { TransactionTracker } from '../utils/performance/track-transactions';
|
|
|
46
46
|
import { EVENT_NAME_DISPATCH_TRANSACTION, EVENT_NAME_STATE_APPLY, EVENT_NAME_UPDATE_STATE, EVENT_NAME_VIEW_STATE_UPDATED, EVENT_NAME_ON_CHANGE } from '../utils/performance/track-transactions';
|
|
47
47
|
import { PROSEMIRROR_RENDERED_NORMAL_SEVERITY_THRESHOLD, PROSEMIRROR_RENDERED_DEGRADED_SEVERITY_THRESHOLD, DEFAULT_SAMPLING_RATE_VALID_TRANSACTIONS } from './consts';
|
|
48
48
|
import { getContextIdentifier } from '../plugins/base/pm-plugins/context-identifier';
|
|
49
|
+
import ReactEditorViewContext from './ReactEditorViewContext';
|
|
49
50
|
|
|
50
51
|
function handleEditorFocus(view) {
|
|
51
52
|
if (view.hasFocus()) {
|
|
@@ -90,6 +91,8 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
90
91
|
|
|
91
92
|
_this = _super.call(this, _props, context);
|
|
92
93
|
|
|
94
|
+
_defineProperty(_assertThisInitialized(_this), "editorRef", /*#__PURE__*/React.createRef());
|
|
95
|
+
|
|
93
96
|
_defineProperty(_assertThisInitialized(_this), "canDispatchTransactions", true);
|
|
94
97
|
|
|
95
98
|
_defineProperty(_assertThisInitialized(_this), "onPluginObservation", function (report, editorState) {
|
|
@@ -820,7 +823,12 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
820
823
|
var renderTracking = (_this$props$editorPro9 = this.props.editorProps.performanceTracking) === null || _this$props$editorPro9 === void 0 ? void 0 : (_this$props$editorPro10 = _this$props$editorPro9.renderTracking) === null || _this$props$editorPro10 === void 0 ? void 0 : _this$props$editorPro10.reactEditorView;
|
|
821
824
|
var renderTrackingEnabled = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.enabled;
|
|
822
825
|
var useShallow = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.useShallow;
|
|
823
|
-
return /*#__PURE__*/React.createElement(
|
|
826
|
+
return /*#__PURE__*/React.createElement(ReactEditorViewContext.Provider, {
|
|
827
|
+
value: {
|
|
828
|
+
editorRef: this.editorRef,
|
|
829
|
+
editorView: this.view
|
|
830
|
+
}
|
|
831
|
+
}, renderTrackingEnabled && /*#__PURE__*/React.createElement(RenderTracking, {
|
|
824
832
|
componentProps: this.props,
|
|
825
833
|
action: ACTION.RE_RENDERED,
|
|
826
834
|
actionSubject: ACTION_SUBJECT.REACT_EDITOR_VIEW,
|
|
@@ -832,7 +840,8 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
832
840
|
config: this.config,
|
|
833
841
|
eventDispatcher: this.eventDispatcher,
|
|
834
842
|
transformer: this.contentTransformer,
|
|
835
|
-
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent
|
|
843
|
+
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
844
|
+
editorRef: this.editorRef
|
|
836
845
|
}) : this.editor);
|
|
837
846
|
}
|
|
838
847
|
}]);
|
|
@@ -99,7 +99,8 @@ export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEve
|
|
|
99
99
|
cardOptions: cardOptions,
|
|
100
100
|
hyperlinkOptions: {
|
|
101
101
|
linkPicker: (_props$linking2 = props.linking) === null || _props$linking2 === void 0 ? void 0 : _props$linking2.linkPicker,
|
|
102
|
-
cardOptions: cardOptions
|
|
102
|
+
cardOptions: cardOptions,
|
|
103
|
+
platform: isMobile ? 'mobile' : 'web'
|
|
103
104
|
},
|
|
104
105
|
codeBlock: _objectSpread(_objectSpread({}, props.codeBlock), {}, {
|
|
105
106
|
useLongPressSelection: false,
|
package/dist/esm/editor.js
CHANGED
|
@@ -401,6 +401,10 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
401
401
|
}, {
|
|
402
402
|
key: "deprecationWarnings",
|
|
403
403
|
value: function deprecationWarnings(props) {
|
|
404
|
+
if (process.env.NODE_ENV === 'production') {
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
|
|
404
408
|
var nextVersion = nextMajorVersion();
|
|
405
409
|
var deprecatedProperties = {
|
|
406
410
|
allowTasksAndDecisions: {
|
|
@@ -570,10 +574,12 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
570
574
|
view = _ref3.view,
|
|
571
575
|
eventDispatcher = _ref3.eventDispatcher,
|
|
572
576
|
config = _ref3.config,
|
|
573
|
-
dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent
|
|
577
|
+
dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent,
|
|
578
|
+
editorRef = _ref3.editorRef;
|
|
574
579
|
return jsx(BaseTheme, {
|
|
575
580
|
baseFontSize: _this5.getBaseFontSize()
|
|
576
581
|
}, jsx(Component, {
|
|
582
|
+
innerRef: editorRef,
|
|
577
583
|
appearance: _this5.props.appearance,
|
|
578
584
|
disabled: _this5.props.disabled,
|
|
579
585
|
editorActions: _this5.editorActions,
|
|
@@ -7,14 +7,16 @@ import { useCreateAnalyticsHandler } from './internal/hooks/use-analytics';
|
|
|
7
7
|
import { ContextAdapter } from '../../nodeviews/context-adapter';
|
|
8
8
|
export function MobileEditor(props) {
|
|
9
9
|
var maxHeight = props.maxHeight,
|
|
10
|
-
createAnalyticsEvent = props.createAnalyticsEvent
|
|
10
|
+
createAnalyticsEvent = props.createAnalyticsEvent,
|
|
11
|
+
disabled = props.disabled;
|
|
11
12
|
var handleAnalyticsEvent = useCreateAnalyticsHandler(createAnalyticsEvent);
|
|
12
13
|
var renderWithConfig = useCallback(function (config) {
|
|
13
14
|
return /*#__PURE__*/React.createElement(MobileAppearance, {
|
|
14
15
|
editorView: config && config.editorView,
|
|
15
|
-
maxHeight: maxHeight
|
|
16
|
+
maxHeight: maxHeight,
|
|
17
|
+
editorDisabled: disabled
|
|
16
18
|
}, /*#__PURE__*/React.createElement(EditorContent, null));
|
|
17
|
-
}, [maxHeight]);
|
|
19
|
+
}, [maxHeight, disabled]);
|
|
18
20
|
return /*#__PURE__*/React.createElement(ContextAdapter, null, /*#__PURE__*/React.createElement(Editor, _extends({}, props, {
|
|
19
21
|
onAnalyticsEvent: handleAnalyticsEvent
|
|
20
22
|
}), /*#__PURE__*/React.createElement(EditorSharedConfigConsumer, null, renderWithConfig)));
|
package/dist/esm/messages.js
CHANGED
|
@@ -51,6 +51,11 @@ export var linkToolbarMessages = defineMessages({
|
|
|
51
51
|
id: 'fabric.editor.emptyLink',
|
|
52
52
|
defaultMessage: 'Please enter a link.',
|
|
53
53
|
description: 'Please enter a link.'
|
|
54
|
+
},
|
|
55
|
+
settingsLink: {
|
|
56
|
+
id: 'fabric.editor.settingsLinks',
|
|
57
|
+
defaultMessage: 'Go to Link Preferences',
|
|
58
|
+
description: 'Go to Link Preferences'
|
|
54
59
|
}
|
|
55
60
|
});
|
|
56
61
|
export default defineMessages({
|
|
@@ -309,6 +309,7 @@ export var ACTION_SUBJECT_ID;
|
|
|
309
309
|
ACTION_SUBJECT_ID["EDIT_LINK"] = "editLink";
|
|
310
310
|
ACTION_SUBJECT_ID["UNLINK"] = "unlink";
|
|
311
311
|
ACTION_SUBJECT_ID["OPEN_LINK"] = "openLink";
|
|
312
|
+
ACTION_SUBJECT_ID["GOTO_SMART_LINK_SETTINGS"] = "goToSmartLinkSettings";
|
|
312
313
|
ACTION_SUBJECT_ID["EMBEDS"] = "embeds";
|
|
313
314
|
ACTION_SUBJECT_ID["HYPERLINK"] = "hyperlink";
|
|
314
315
|
})(ACTION_SUBJECT_ID || (ACTION_SUBJECT_ID = {}));
|
|
@@ -10,7 +10,7 @@ import { shortcutStyle } from '../../../../ui/styles';
|
|
|
10
10
|
import { token } from '@atlaskit/tokens';
|
|
11
11
|
export var blockTypeMenuItemStyle = function blockTypeMenuItemStyle(tagName, selected) {
|
|
12
12
|
// TEMP FIX: See https://product-fabric.atlassian.net/browse/ED-13878
|
|
13
|
-
var selectedStyle = selected ? "".concat(tagName, " { color: ").concat(token('color.text
|
|
13
|
+
var selectedStyle = selected ? "".concat(tagName, " { color: ").concat(token('color.text', 'white'), " !important; }") : '';
|
|
14
14
|
return function (themeProps) {
|
|
15
15
|
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", ";\n > {\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-top: 0;\n }\n }\n ", ";\n "])), headingsSharedStyles(themeProps), selectedStyle);
|
|
16
16
|
};
|
|
@@ -58,6 +58,14 @@ export var InlineCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
58
58
|
})();
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
+
_defineProperty(_assertThisInitialized(_this), "onError", function (data) {
|
|
62
|
+
var url = data.url;
|
|
63
|
+
|
|
64
|
+
_this.onResolve({
|
|
65
|
+
url: url
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
61
69
|
return _this;
|
|
62
70
|
}
|
|
63
71
|
|
|
@@ -88,6 +96,7 @@ export var InlineCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
88
96
|
onClick: this.onClick,
|
|
89
97
|
container: this.scrollContainer,
|
|
90
98
|
onResolve: this.onResolve,
|
|
99
|
+
onError: this.onError,
|
|
91
100
|
inlinePreloaderStyle: useAlternativePreloader ? 'on-right-without-skeleton' : undefined
|
|
92
101
|
})); // [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
93
102
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
@@ -6,7 +6,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
6
6
|
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; }
|
|
7
7
|
|
|
8
8
|
import { NodeSelection } from 'prosemirror-state';
|
|
9
|
-
import { Fragment, Slice } from 'prosemirror-model';
|
|
10
9
|
import { closeHistory } from 'prosemirror-history';
|
|
11
10
|
import { pluginKey } from './plugin-key';
|
|
12
11
|
import { queueCards, resolveCard } from './actions';
|
|
@@ -20,23 +19,11 @@ import { SMART_LINK_TYPE } from '../../../plugins/analytics/types/node-events';
|
|
|
20
19
|
import { getLinkCreationAnalyticsEvent } from '../../../plugins/hyperlink/analytics';
|
|
21
20
|
import { unlinkPayload } from '../../../utils/linking-utils';
|
|
22
21
|
import { getFeatureFlags } from '../../feature-flags-context';
|
|
23
|
-
export function insertCard(tr, cardAdf, schema) {
|
|
24
|
-
var inlineCard = schema.nodes.inlineCard; // ED-5638: add an extra space after inline cards to avoid re-rendering them
|
|
25
|
-
|
|
26
|
-
var nodes = [cardAdf];
|
|
27
|
-
|
|
28
|
-
if (cardAdf.type === inlineCard) {
|
|
29
|
-
nodes.push(schema.text(' '));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return tr.replaceSelection(new Slice(Fragment.fromArray(nodes), 0, 0));
|
|
33
|
-
}
|
|
34
22
|
/**
|
|
35
23
|
* Attempt to replace the link into the respective card.
|
|
36
24
|
*/
|
|
37
25
|
|
|
38
26
|
function replaceLinksToCards(tr, cardAdf, schema, request) {
|
|
39
|
-
var inlineCard = schema.nodes.inlineCard;
|
|
40
27
|
var url = request.url;
|
|
41
28
|
|
|
42
29
|
if (!isSafeUrl(url)) {
|
|
@@ -56,15 +43,9 @@ function replaceLinksToCards(tr, cardAdf, schema, request) {
|
|
|
56
43
|
|
|
57
44
|
if (!replaceLink) {
|
|
58
45
|
return;
|
|
59
|
-
} // ED-5638: add an extra space after inline cards to avoid re-rendering them
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
var nodes = [cardAdf];
|
|
63
|
-
|
|
64
|
-
if (cardAdf.type === inlineCard) {
|
|
65
|
-
nodes.push(schema.text(' '));
|
|
66
46
|
}
|
|
67
47
|
|
|
48
|
+
var nodes = [cardAdf];
|
|
68
49
|
tr.replaceWith(pos, pos + (node.text || url).length, nodes);
|
|
69
50
|
return $pos.node($pos.depth - 1).type.name;
|
|
70
51
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
|
|
4
4
|
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; }
|
|
5
5
|
|
|
@@ -10,6 +10,7 @@ import { NodeSelection } from 'prosemirror-state';
|
|
|
10
10
|
import { removeSelectedNode, findDomRefAtPos } from 'prosemirror-utils';
|
|
11
11
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
12
12
|
import UnlinkIcon from '@atlaskit/icon/glyph/editor/unlink';
|
|
13
|
+
import CogIcon from '@atlaskit/icon/glyph/editor/settings';
|
|
13
14
|
import OpenIcon from '@atlaskit/icon/glyph/shortcut';
|
|
14
15
|
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, addAnalytics } from '../analytics';
|
|
15
16
|
import { linkToolbarMessages, linkMessages } from '../../messages';
|
|
@@ -24,9 +25,10 @@ import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
|
24
25
|
import { LinkToolbarAppearance } from './ui/LinkToolbarAppearance';
|
|
25
26
|
import { messages } from './messages';
|
|
26
27
|
import buildLayoutButtons from '../../ui/MediaAndEmbedsToolbar';
|
|
27
|
-
import { buildVisitedLinkPayload } from '../../utils/linking-utils';
|
|
28
|
+
import { buildOpenedSettingsPayload, buildVisitedLinkPayload } from '../../utils/linking-utils';
|
|
28
29
|
import { FLOATING_TOOLBAR_LINKPICKER_CLASSNAME } from './styles';
|
|
29
30
|
import { getCopyButtonConfig, showCopyButton } from '../copy-button/toolbar';
|
|
31
|
+
import { getFeatureFlags } from '../feature-flags-context';
|
|
30
32
|
export var removeCard = function removeCard(state, dispatch) {
|
|
31
33
|
if (!(state.selection instanceof NodeSelection)) {
|
|
32
34
|
return false;
|
|
@@ -70,6 +72,69 @@ export var visitCardLink = function visitCardLink(state, dispatch) {
|
|
|
70
72
|
|
|
71
73
|
return true;
|
|
72
74
|
};
|
|
75
|
+
export var openLinkSettings = function openLinkSettings(state, dispatch) {
|
|
76
|
+
if (!(state.selection instanceof NodeSelection)) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
window.open('https://id.atlassian.com/manage-profile/link-preferences');
|
|
81
|
+
|
|
82
|
+
if (dispatch) {
|
|
83
|
+
var type = state.selection.node.type;
|
|
84
|
+
dispatch(addAnalytics(state, state.tr, buildOpenedSettingsPayload(type.name)));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return true;
|
|
88
|
+
};
|
|
89
|
+
export var floatingToolbar = function floatingToolbar(cardOptions, platform, linkPickerOptions) {
|
|
90
|
+
return function (state, intl, providerFactory) {
|
|
91
|
+
var _state$schema$nodes = state.schema.nodes,
|
|
92
|
+
inlineCard = _state$schema$nodes.inlineCard,
|
|
93
|
+
blockCard = _state$schema$nodes.blockCard,
|
|
94
|
+
embedCard = _state$schema$nodes.embedCard;
|
|
95
|
+
var nodeType = [inlineCard, blockCard, embedCard];
|
|
96
|
+
var pluginState = pluginKey.getState(state);
|
|
97
|
+
|
|
98
|
+
if (!(state.selection instanceof NodeSelection)) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
var selectedNode = state.selection.node;
|
|
103
|
+
|
|
104
|
+
if (!selectedNode) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
var isEmbedCard = appearanceForNodeType(selectedNode.type) === 'embed';
|
|
109
|
+
/* add an offset to embeds due to extra padding */
|
|
110
|
+
|
|
111
|
+
var toolbarOffset = isEmbedCard ? {
|
|
112
|
+
offset: [0, 24]
|
|
113
|
+
} : {}; // Applies padding override for when link picker is currently displayed
|
|
114
|
+
|
|
115
|
+
var className = pluginState.showLinkingToolbar ? FLOATING_TOOLBAR_LINKPICKER_CLASSNAME : undefined;
|
|
116
|
+
return _objectSpread(_objectSpread({
|
|
117
|
+
title: intl.formatMessage(messages.card),
|
|
118
|
+
className: className,
|
|
119
|
+
nodeType: nodeType
|
|
120
|
+
}, toolbarOffset), {}, {
|
|
121
|
+
getDomRef: function getDomRef(view) {
|
|
122
|
+
var element = findDomRefAtPos(view.state.selection.from, view.domAtPos.bind(view));
|
|
123
|
+
|
|
124
|
+
if (!element) {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (isEmbedCard) {
|
|
129
|
+
return element.querySelector(".".concat(richMediaClassName));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return element;
|
|
133
|
+
},
|
|
134
|
+
items: generateToolbarItems(state, intl, providerFactory, cardOptions, platform, linkPickerOptions)
|
|
135
|
+
}, pluginState.showLinkingToolbar ? editLinkToolbarConfig : {});
|
|
136
|
+
};
|
|
137
|
+
};
|
|
73
138
|
|
|
74
139
|
var unlinkCard = function unlinkCard(node, state) {
|
|
75
140
|
var displayInfo = displayInfoForCard(node, findCardInfo(state));
|
|
@@ -88,41 +153,6 @@ var buildAlignmentOptions = function buildAlignmentOptions(state, intl) {
|
|
|
88
153
|
return buildLayoutButtons(state, intl, state.schema.nodes.embedCard, true, true);
|
|
89
154
|
};
|
|
90
155
|
|
|
91
|
-
var generateDeleteButton = function generateDeleteButton(node, state, intl) {
|
|
92
|
-
var inlineCard = state.schema.nodes.inlineCard;
|
|
93
|
-
var removeButton = {
|
|
94
|
-
id: 'editor.link.delete',
|
|
95
|
-
type: 'button',
|
|
96
|
-
appearance: 'danger',
|
|
97
|
-
icon: RemoveIcon,
|
|
98
|
-
onMouseEnter: hoverDecoration(node.type, true),
|
|
99
|
-
onMouseLeave: hoverDecoration(node.type, false),
|
|
100
|
-
onFocus: hoverDecoration(node.type, true),
|
|
101
|
-
onBlur: hoverDecoration(node.type, false),
|
|
102
|
-
title: intl.formatMessage(commonMessages.remove),
|
|
103
|
-
onClick: removeCard
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
var copyButton = _toConsumableArray(state && showCopyButton(state) ? [getCopyButtonConfig(state, intl.formatMessage, node.type), {
|
|
107
|
-
type: 'separator'
|
|
108
|
-
}] : []);
|
|
109
|
-
|
|
110
|
-
if (node.type === inlineCard) {
|
|
111
|
-
var unlinkButtonWithSeparator = [{
|
|
112
|
-
id: 'editor.link.unlink',
|
|
113
|
-
type: 'button',
|
|
114
|
-
title: intl.formatMessage(linkToolbarMessages.unlink),
|
|
115
|
-
icon: UnlinkIcon,
|
|
116
|
-
onClick: unlinkCard(node, state)
|
|
117
|
-
}, {
|
|
118
|
-
type: 'separator'
|
|
119
|
-
}];
|
|
120
|
-
return [].concat(unlinkButtonWithSeparator, _toConsumableArray(copyButton), [removeButton]);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return [].concat(_toConsumableArray(copyButton), [removeButton]);
|
|
124
|
-
};
|
|
125
|
-
|
|
126
156
|
var generateToolbarItems = function generateToolbarItems(state, intl, providerFactory, cardOptions, platform, linkPicker) {
|
|
127
157
|
return function (node) {
|
|
128
158
|
var _titleUrlPairFromNode2 = titleUrlPairFromNode(node),
|
|
@@ -153,6 +183,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
153
183
|
node: node
|
|
154
184
|
})];
|
|
155
185
|
} else {
|
|
186
|
+
var inlineCard = state.schema.nodes.inlineCard;
|
|
156
187
|
var toolbarItems = [{
|
|
157
188
|
id: 'editor.link.edit',
|
|
158
189
|
type: 'button',
|
|
@@ -174,7 +205,18 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
174
205
|
onClick: visitCardLink
|
|
175
206
|
}, {
|
|
176
207
|
type: 'separator'
|
|
177
|
-
}].concat(_toConsumableArray(
|
|
208
|
+
}].concat(_toConsumableArray(getUnlinkButtonGroup(state, intl, node, inlineCard)), _toConsumableArray(getCopyButtonGroup(state, intl, node)), _toConsumableArray(getSettingsButtonGroup(state, intl)), [{
|
|
209
|
+
id: 'editor.link.delete',
|
|
210
|
+
type: 'button',
|
|
211
|
+
appearance: 'danger',
|
|
212
|
+
icon: RemoveIcon,
|
|
213
|
+
onMouseEnter: hoverDecoration(node.type, true),
|
|
214
|
+
onMouseLeave: hoverDecoration(node.type, false),
|
|
215
|
+
onFocus: hoverDecoration(node.type, true),
|
|
216
|
+
onBlur: hoverDecoration(node.type, false),
|
|
217
|
+
title: intl.formatMessage(commonMessages.remove),
|
|
218
|
+
onClick: removeCard
|
|
219
|
+
}]);
|
|
178
220
|
|
|
179
221
|
if (currentAppearance === 'embed') {
|
|
180
222
|
var alignmentOptions = buildAlignmentOptions(state, intl);
|
|
@@ -217,52 +259,35 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
217
259
|
};
|
|
218
260
|
};
|
|
219
261
|
|
|
220
|
-
|
|
221
|
-
return
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
var selectedNode = state.selection.node;
|
|
234
|
-
|
|
235
|
-
if (!selectedNode) {
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
var isEmbedCard = appearanceForNodeType(selectedNode.type) === 'embed';
|
|
240
|
-
/* add an offset to embeds due to extra padding */
|
|
241
|
-
|
|
242
|
-
var toolbarOffset = isEmbedCard ? {
|
|
243
|
-
offset: [0, 24]
|
|
244
|
-
} : {}; // Applies padding override for when link picker is currently displayed
|
|
245
|
-
|
|
246
|
-
var className = pluginState.showLinkingToolbar ? FLOATING_TOOLBAR_LINKPICKER_CLASSNAME : undefined;
|
|
247
|
-
return _objectSpread(_objectSpread({
|
|
248
|
-
title: intl.formatMessage(messages.card),
|
|
249
|
-
className: className,
|
|
250
|
-
nodeType: nodeType
|
|
251
|
-
}, toolbarOffset), {}, {
|
|
252
|
-
getDomRef: function getDomRef(view) {
|
|
253
|
-
var element = findDomRefAtPos(view.state.selection.from, view.domAtPos.bind(view));
|
|
262
|
+
var getUnlinkButtonGroup = function getUnlinkButtonGroup(state, intl, node, inlineCard) {
|
|
263
|
+
return node.type === inlineCard ? [{
|
|
264
|
+
id: 'editor.link.unlink',
|
|
265
|
+
type: 'button',
|
|
266
|
+
title: intl.formatMessage(linkToolbarMessages.unlink),
|
|
267
|
+
icon: UnlinkIcon,
|
|
268
|
+
onClick: unlinkCard(node, state)
|
|
269
|
+
}, {
|
|
270
|
+
type: 'separator'
|
|
271
|
+
}] : [];
|
|
272
|
+
};
|
|
254
273
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
274
|
+
var getSettingsButtonGroup = function getSettingsButtonGroup(state, intl) {
|
|
275
|
+
var _getFeatureFlags = getFeatureFlags(state),
|
|
276
|
+
floatingToolbarLinkSettingsButton = _getFeatureFlags.floatingToolbarLinkSettingsButton;
|
|
258
277
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
278
|
+
return floatingToolbarLinkSettingsButton === 'true' ? [{
|
|
279
|
+
id: 'editor.link.settings',
|
|
280
|
+
type: 'button',
|
|
281
|
+
icon: CogIcon,
|
|
282
|
+
title: intl.formatMessage(linkToolbarMessages.settingsLink),
|
|
283
|
+
onClick: openLinkSettings
|
|
284
|
+
}, {
|
|
285
|
+
type: 'separator'
|
|
286
|
+
}] : [];
|
|
287
|
+
};
|
|
262
288
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
};
|
|
289
|
+
var getCopyButtonGroup = function getCopyButtonGroup(state, intl, node) {
|
|
290
|
+
return state && showCopyButton(state) ? [getCopyButtonConfig(state, intl.formatMessage, node.type), {
|
|
291
|
+
type: 'separator'
|
|
292
|
+
}] : [];
|
|
268
293
|
};
|
|
@@ -14,6 +14,9 @@ var toDOM = function toDOM(node) {
|
|
|
14
14
|
return ['div', {
|
|
15
15
|
class: 'code-block'
|
|
16
16
|
}, ['div', {
|
|
17
|
+
class: codeBlockClassNames.start,
|
|
18
|
+
contenteditable: 'false'
|
|
19
|
+
}], ['div', {
|
|
17
20
|
class: codeBlockClassNames.gutter,
|
|
18
21
|
contenteditable: 'false'
|
|
19
22
|
}], ['div', {
|
|
@@ -21,8 +24,12 @@ var toDOM = function toDOM(node) {
|
|
|
21
24
|
}, ['code', {
|
|
22
25
|
'data-language': node.attrs.language || '',
|
|
23
26
|
spellcheck: 'false',
|
|
24
|
-
contenteditable: 'true'
|
|
25
|
-
|
|
27
|
+
contenteditable: 'true',
|
|
28
|
+
'data-testid': 'code-block--code'
|
|
29
|
+
}, 0]], ['div', {
|
|
30
|
+
class: codeBlockClassNames.end,
|
|
31
|
+
contenteditable: 'false'
|
|
32
|
+
}]];
|
|
26
33
|
};
|
|
27
34
|
|
|
28
35
|
export var CodeBlockView = /*#__PURE__*/function () {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { TextSelection } from 'prosemirror-state';
|
|
2
|
+
import { PluginKey, TextSelection } from 'prosemirror-state';
|
|
3
3
|
import { keydownHandler } from 'prosemirror-keymap';
|
|
4
4
|
import { setTextSelection } from 'prosemirror-utils';
|
|
5
5
|
import { getCursor } from '../../../utils';
|
|
@@ -9,13 +9,48 @@ import { getAutoClosingBracketInfo, shouldAutoCloseBracket } from '../ide-ux/bra
|
|
|
9
9
|
import { getAutoClosingQuoteInfo, shouldAutoCloseQuote } from '../ide-ux/quote-handling';
|
|
10
10
|
import { getEndOfCurrentLine, getStartOfCurrentLine, isCursorInsideCodeBlock, isSelectionEntirelyInsideCodeBlock, getLineInfo } from '../ide-ux/line-handling';
|
|
11
11
|
import { insertIndent, outdent, indent, insertNewlineWithIndent } from '../ide-ux/commands';
|
|
12
|
+
var codeBlockIDEKeyBindingsKey = new PluginKey('codeBlockIDEKeyBindings');
|
|
12
13
|
export default new SafePlugin({
|
|
14
|
+
key: codeBlockIDEKeyBindingsKey,
|
|
15
|
+
state: {
|
|
16
|
+
init: function init() {
|
|
17
|
+
return {
|
|
18
|
+
isComposing: false
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
apply: function apply(tr, value) {
|
|
22
|
+
var isComposing = tr.getMeta(codeBlockIDEKeyBindingsKey);
|
|
23
|
+
|
|
24
|
+
if (typeof isComposing === 'undefined') {
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
isComposing: isComposing
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
},
|
|
13
33
|
props: {
|
|
34
|
+
handleDOMEvents: {
|
|
35
|
+
compositionstart: function compositionstart(view, event) {
|
|
36
|
+
var tr = view.state.tr;
|
|
37
|
+
tr.setMeta(codeBlockIDEKeyBindingsKey, true);
|
|
38
|
+
view.dispatch(tr);
|
|
39
|
+
return false;
|
|
40
|
+
},
|
|
41
|
+
compositionend: function compositionend(view, event) {
|
|
42
|
+
var tr = view.state.tr;
|
|
43
|
+
tr.setMeta(codeBlockIDEKeyBindingsKey, false);
|
|
44
|
+
view.dispatch(tr);
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
},
|
|
14
48
|
handleTextInput: function handleTextInput(view, from, to, text) {
|
|
15
49
|
var state = view.state,
|
|
16
50
|
dispatch = view.dispatch;
|
|
51
|
+
var isComposing = codeBlockIDEKeyBindingsKey.getState(state).isComposing;
|
|
17
52
|
|
|
18
|
-
if (isCursorInsideCodeBlock(state)) {
|
|
53
|
+
if (isCursorInsideCodeBlock(state) && !isComposing) {
|
|
19
54
|
var beforeText = getStartOfCurrentLine(state).text;
|
|
20
55
|
var afterText = getEndOfCurrentLine(state).text; // If text is a closing bracket/quote and we've already inserted it, move the selection after
|
|
21
56
|
|
|
@@ -4,6 +4,7 @@ import CopyIcon from '@atlaskit/icon/glyph/copy';
|
|
|
4
4
|
import { findDomRefAtPos } from 'prosemirror-utils';
|
|
5
5
|
import { removeCodeBlock, changeLanguage, copyContentToClipboard, resetCopiedState } from './actions';
|
|
6
6
|
import commonMessages from '../../messages';
|
|
7
|
+
import { codeBlockCopyButtonMessages } from '@atlaskit/editor-common/messages';
|
|
7
8
|
import { provideVisualFeedbackForCopyButton, removeVisualFeedbackForCopyButton } from './pm-plugins/codeBlockCopySelectionPlugin';
|
|
8
9
|
import { hoverDecoration } from '../base/pm-plugins/decoration';
|
|
9
10
|
import { pluginKey } from './plugin-key';
|
|
@@ -73,7 +74,7 @@ export var getToolbarConfig = function getToolbarConfig() {
|
|
|
73
74
|
// note: copyContentToClipboard contains logic that also removes the
|
|
74
75
|
// visual feedback for the copy button
|
|
75
76
|
onClick: copyContentToClipboard,
|
|
76
|
-
title: formatMessage(codeBlockState.contentCopied ?
|
|
77
|
+
title: formatMessage(codeBlockState.contentCopied ? codeBlockCopyButtonMessages.copiedCodeToClipboard : codeBlockCopyButtonMessages.copyCodeToClipboard),
|
|
77
78
|
onMouseEnter: provideVisualFeedbackForCopyButton,
|
|
78
79
|
// note: resetCopiedState contains logic that also removes the
|
|
79
80
|
// visual feedback for the copy button
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { CodeBlockSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
2
2
|
export var codeBlockClassNames = {
|
|
3
|
+
start: CodeBlockSharedCssClassName.CODEBLOCK_START,
|
|
4
|
+
end: CodeBlockSharedCssClassName.CODEBLOCK_END,
|
|
3
5
|
gutter: CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER,
|
|
4
6
|
content: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT
|
|
5
7
|
};
|
|
@@ -33,7 +33,7 @@ function getSpellCheck(featureFlags) {
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
export function createFeatureFlagsFromProps(props) {
|
|
36
|
-
var _props$allowTextColor, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$featureFlags, _props$featureFlags2, _props$allowTables, _props$featureFlags3, _props$featureFlags4, _props$allowTables2, _props$featureFlags5, _props$featureFlags6, _props$allowTables3, _props$featureFlags7, _props$featureFlags8, _props$allowTables4, _props$featureFlags9, _props$featureFlags10, _props$
|
|
36
|
+
var _props$allowTextColor, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$featureFlags, _props$featureFlags2, _props$allowTables, _props$featureFlags3, _props$featureFlags4, _props$allowTables2, _props$featureFlags5, _props$featureFlags6, _props$allowTables3, _props$featureFlags7, _props$featureFlags8, _props$allowTables4, _props$allowTables5, _props$featureFlags9, _props$featureFlags10, _props$allowTables6, _props$allowExtension, _props$featureFlags11, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27, _props$featureFlags28, _props$featureFlags29, _props$featureFlags30, _props$collabEdit, _props$collabEdit2, _props$featureFlags31, _props$featureFlags32, _props$featureFlags33, _props$featureFlags34, _props$featureFlags35, _props$featureFlags36, _props$featureFlags37, _props$featureFlags38, _props$featureFlags39;
|
|
37
37
|
|
|
38
38
|
var normalizedFeatureFlags = normalizeFeatureFlags(props.featureFlags);
|
|
39
39
|
return _objectSpread(_objectSpread({}, normalizedFeatureFlags), {}, {
|
|
@@ -52,8 +52,8 @@ export function createFeatureFlagsFromProps(props) {
|
|
|
52
52
|
stickyHeadersOptimization: typeof ((_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags.stickyHeadersOptimization) === 'boolean' ? !!((_props$featureFlags2 = props.featureFlags) !== null && _props$featureFlags2 !== void 0 && _props$featureFlags2.stickyHeadersOptimization) : _typeof(props.allowTables) === 'object' && !!((_props$allowTables = props.allowTables) !== null && _props$allowTables !== void 0 && _props$allowTables.stickyHeadersOptimization),
|
|
53
53
|
initialRenderOptimization: typeof ((_props$featureFlags3 = props.featureFlags) === null || _props$featureFlags3 === void 0 ? void 0 : _props$featureFlags3.initialRenderOptimization) === 'boolean' ? !!((_props$featureFlags4 = props.featureFlags) !== null && _props$featureFlags4 !== void 0 && _props$featureFlags4.initialRenderOptimization) : _typeof(props.allowTables) === 'object' && !!((_props$allowTables2 = props.allowTables) !== null && _props$allowTables2 !== void 0 && _props$allowTables2.initialRenderOptimization),
|
|
54
54
|
mouseMoveOptimization: typeof ((_props$featureFlags5 = props.featureFlags) === null || _props$featureFlags5 === void 0 ? void 0 : _props$featureFlags5.mouseMoveOptimization) === 'boolean' ? !!((_props$featureFlags6 = props.featureFlags) !== null && _props$featureFlags6 !== void 0 && _props$featureFlags6.mouseMoveOptimization) : _typeof(props.allowTables) === 'object' && !!((_props$allowTables3 = props.allowTables) !== null && _props$allowTables3 !== void 0 && _props$allowTables3.mouseMoveOptimization),
|
|
55
|
-
tableRenderOptimization: typeof ((_props$featureFlags7 = props.featureFlags) === null || _props$featureFlags7 === void 0 ? void 0 : _props$featureFlags7.tableRenderOptimization) === 'boolean' ? !!((_props$featureFlags8 = props.featureFlags) !== null && _props$featureFlags8 !== void 0 && _props$featureFlags8.tableRenderOptimization) : _typeof(props.allowTables) === 'object' &&
|
|
56
|
-
tableOverflowShadowsOptimization: typeof ((_props$featureFlags9 = props.featureFlags) === null || _props$featureFlags9 === void 0 ? void 0 : _props$featureFlags9.tableOverflowShadowsOptimization) === 'boolean' ? !!((_props$featureFlags10 = props.featureFlags) !== null && _props$featureFlags10 !== void 0 && _props$featureFlags10.tableOverflowShadowsOptimization) : _typeof(props.allowTables) === 'object' && !!((_props$
|
|
55
|
+
tableRenderOptimization: typeof ((_props$featureFlags7 = props.featureFlags) === null || _props$featureFlags7 === void 0 ? void 0 : _props$featureFlags7.tableRenderOptimization) === 'boolean' ? !!((_props$featureFlags8 = props.featureFlags) !== null && _props$featureFlags8 !== void 0 && _props$featureFlags8.tableRenderOptimization) : _typeof(props.allowTables) === 'object' && typeof ((_props$allowTables4 = props.allowTables) === null || _props$allowTables4 === void 0 ? void 0 : _props$allowTables4.tableRenderOptimization) === 'boolean' ? (_props$allowTables5 = props.allowTables) === null || _props$allowTables5 === void 0 ? void 0 : _props$allowTables5.tableRenderOptimization : true,
|
|
56
|
+
tableOverflowShadowsOptimization: typeof ((_props$featureFlags9 = props.featureFlags) === null || _props$featureFlags9 === void 0 ? void 0 : _props$featureFlags9.tableOverflowShadowsOptimization) === 'boolean' ? !!((_props$featureFlags10 = props.featureFlags) !== null && _props$featureFlags10 !== void 0 && _props$featureFlags10.tableOverflowShadowsOptimization) : _typeof(props.allowTables) === 'object' && !!((_props$allowTables6 = props.allowTables) !== null && _props$allowTables6 !== void 0 && _props$allowTables6.tableOverflowShadowsOptimization),
|
|
57
57
|
extendFloatingToolbar: Boolean(_typeof(props.allowExtension) === 'object' && ((_props$allowExtension = props.allowExtension) === null || _props$allowExtension === void 0 ? void 0 : _props$allowExtension.allowExtendFloatingToolbars)),
|
|
58
58
|
useUnpredictableInputRule: Boolean(typeof ((_props$featureFlags11 = props.featureFlags) === null || _props$featureFlags11 === void 0 ? void 0 : _props$featureFlags11.useUnpredictableInputRule) === 'boolean' ? !!((_props$featureFlags12 = props.featureFlags) !== null && _props$featureFlags12 !== void 0 && _props$featureFlags12.useUnpredictableInputRule) : props.UNSAFE_allowUndoRedoButtons ? false : true),
|
|
59
59
|
showAvatarGroupAsPlugin: Boolean(typeof ((_props$featureFlags13 = props.featureFlags) === null || _props$featureFlags13 === void 0 ? void 0 : _props$featureFlags13.showAvatarGroupAsPlugin) === 'boolean' ? !!((_props$featureFlags14 = props.featureFlags) !== null && _props$featureFlags14 !== void 0 && _props$featureFlags14.showAvatarGroupAsPlugin) : false),
|
|
@@ -71,6 +71,7 @@ export function createFeatureFlagsFromProps(props) {
|
|
|
71
71
|
showHoverPreview: Boolean(typeof ((_props$featureFlags33 = props.featureFlags) === null || _props$featureFlags33 === void 0 ? void 0 : _props$featureFlags33.showHoverPreview) === 'boolean' ? !!((_props$featureFlags34 = props.featureFlags) !== null && _props$featureFlags34 !== void 0 && _props$featureFlags34.showHoverPreview) : false),
|
|
72
72
|
indentationButtonsInTheToolbar: Boolean(typeof normalizedFeatureFlags.indentationButtonsInTheToolbar === 'boolean' && !!normalizedFeatureFlags.indentationButtonsInTheToolbar || (typeof ((_props$featureFlags35 = props.featureFlags) === null || _props$featureFlags35 === void 0 ? void 0 : _props$featureFlags35.indentationButtonsInTheToolbar) === 'boolean' ? !!((_props$featureFlags36 = props.featureFlags) !== null && _props$featureFlags36 !== void 0 && _props$featureFlags36.indentationButtonsInTheToolbar) : false)),
|
|
73
73
|
floatingToolbarCopyButton: Boolean(typeof normalizedFeatureFlags.floatingToolbarCopyButton === 'boolean' && !!normalizedFeatureFlags.floatingToolbarCopyButton || (typeof ((_props$featureFlags37 = props.featureFlags) === null || _props$featureFlags37 === void 0 ? void 0 : _props$featureFlags37.floatingToolbarCopyButton) === 'boolean' ? !!((_props$featureFlags38 = props.featureFlags) !== null && _props$featureFlags38 !== void 0 && _props$featureFlags38.floatingToolbarCopyButton) : false)),
|
|
74
|
+
floatingToolbarLinkSettingsButton: typeof ((_props$featureFlags39 = props.featureFlags) === null || _props$featureFlags39 === void 0 ? void 0 : _props$featureFlags39['floating-toolbar-link-settings-button']) === 'string' ? props.featureFlags['floating-toolbar-link-settings-button'] || undefined : undefined,
|
|
74
75
|
disableSpellcheckByBrowser: getSpellCheck(props.featureFlags)
|
|
75
76
|
});
|
|
76
77
|
}
|
|
@@ -8,10 +8,11 @@ import { css, jsx } from '@emotion/react';
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import Button from '@atlaskit/button';
|
|
10
10
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
11
|
-
import { Popup
|
|
11
|
+
import { Popup } from '@atlaskit/editor-common/ui';
|
|
12
12
|
import { EmojiPicker } from '@atlaskit/emoji';
|
|
13
13
|
import Tooltip from '@atlaskit/tooltip';
|
|
14
|
-
import EditorEmojiAddIcon from './EditorEmojiAddIcon';
|
|
14
|
+
import EditorEmojiAddIcon from './EditorEmojiAddIcon';
|
|
15
|
+
import withOuterListeners from '../../../ui/with-outer-listeners'; // helps adjusts position of popup
|
|
15
16
|
|
|
16
17
|
var emojiPickerButtonWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n"]))); // helps to vertically align emoji picker
|
|
17
18
|
// both top and bottom margin should be 2px
|