@atlaskit/editor-plugin-help-dialog 2.1.5 → 2.1.7
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 +15 -0
- package/dist/cjs/helpDialogPlugin.js +41 -15
- package/dist/cjs/pm-plugins/main.js +3 -2
- package/dist/cjs/ui/formatting.js +22 -11
- package/dist/cjs/ui/index.js +8 -4
- package/dist/es2019/helpDialogPlugin.js +104 -74
- package/dist/es2019/pm-plugins/main.js +3 -2
- package/dist/es2019/ui/formatting.js +11 -3
- package/dist/es2019/ui/index.js +8 -4
- package/dist/esm/helpDialogPlugin.js +42 -15
- package/dist/esm/pm-plugins/main.js +3 -2
- package/dist/esm/ui/formatting.js +23 -12
- package/dist/esm/ui/index.js +8 -4
- package/dist/types/helpDialogPlugin.d.ts +1 -1
- package/dist/types/helpDialogPluginType.d.ts +5 -1
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/ui/formatting.d.ts +1 -1
- package/dist/types-ts4.5/helpDialogPlugin.d.ts +1 -1
- package/dist/types-ts4.5/helpDialogPluginType.d.ts +5 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/ui/formatting.d.ts +1 -1
- package/package.json +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-help-dialog
|
|
2
2
|
|
|
3
|
+
## 2.1.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 2.1.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#159336](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/159336)
|
|
14
|
+
[`0f0a3a5e7e218`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0f0a3a5e7e218) -
|
|
15
|
+
[EDITOR-793] Added changes to reflect experiment quickstart command
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 2.1.5
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -16,18 +16,44 @@ var _keymap = require("./pm-plugins/keymap");
|
|
|
16
16
|
var _main = require("./pm-plugins/main");
|
|
17
17
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
18
18
|
var _HelpDialogLoader = require("./ui/HelpDialogLoader");
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Normalise the caller-supplied config into a single, predictable shape.
|
|
21
|
+
* – Boolean → "image uploads on/off", AI always off
|
|
22
|
+
* – Object → pick the two feature flags with sane defaults (both false)
|
|
23
|
+
*/
|
|
24
|
+
function parseFeatureConfig(config) {
|
|
25
|
+
if (typeof config === 'boolean') {
|
|
26
|
+
return {
|
|
27
|
+
imageUploadProviderExists: config,
|
|
28
|
+
aiEnabled: false
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Object path – ensure we never return undefined
|
|
33
|
+
var _ref = config !== null && config !== void 0 ? config : {},
|
|
34
|
+
_ref$imageUploadProvi = _ref.imageUploadProviderExists,
|
|
35
|
+
imageUploadProviderExists = _ref$imageUploadProvi === void 0 ? false : _ref$imageUploadProvi,
|
|
36
|
+
_ref$aiEnabled = _ref.aiEnabled,
|
|
37
|
+
aiEnabled = _ref$aiEnabled === void 0 ? false : _ref$aiEnabled;
|
|
38
|
+
return {
|
|
39
|
+
imageUploadProviderExists: imageUploadProviderExists,
|
|
40
|
+
aiEnabled: aiEnabled
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
var helpDialogPlugin = exports.helpDialogPlugin = function helpDialogPlugin(_ref2) {
|
|
44
|
+
var config = _ref2.config,
|
|
45
|
+
api = _ref2.api;
|
|
46
|
+
var _parseFeatureConfig = parseFeatureConfig(config),
|
|
47
|
+
imageUploadProviderExists = _parseFeatureConfig.imageUploadProviderExists,
|
|
48
|
+
aiEnabled = _parseFeatureConfig.aiEnabled;
|
|
23
49
|
return {
|
|
24
50
|
name: 'helpDialog',
|
|
25
51
|
pmPlugins: function pmPlugins() {
|
|
26
52
|
return [{
|
|
27
53
|
name: 'helpDialog',
|
|
28
|
-
plugin: function plugin(
|
|
29
|
-
var dispatch =
|
|
30
|
-
return (0, _main.createPlugin)(dispatch, imageUploadProviderExists);
|
|
54
|
+
plugin: function plugin(_ref3) {
|
|
55
|
+
var dispatch = _ref3.dispatch;
|
|
56
|
+
return (0, _main.createPlugin)(dispatch, imageUploadProviderExists, aiEnabled);
|
|
31
57
|
}
|
|
32
58
|
}, {
|
|
33
59
|
name: 'helpDialogKeymap',
|
|
@@ -38,8 +64,8 @@ var helpDialogPlugin = exports.helpDialogPlugin = function helpDialogPlugin(_ref
|
|
|
38
64
|
}];
|
|
39
65
|
},
|
|
40
66
|
pluginsOptions: {
|
|
41
|
-
quickInsert: function quickInsert(
|
|
42
|
-
var formatMessage =
|
|
67
|
+
quickInsert: function quickInsert(_ref4) {
|
|
68
|
+
var formatMessage = _ref4.formatMessage;
|
|
43
69
|
return [{
|
|
44
70
|
id: 'helpdialog',
|
|
45
71
|
title: formatMessage(_messages.toolbarInsertBlockMessages.help),
|
|
@@ -72,8 +98,8 @@ var helpDialogPlugin = exports.helpDialogPlugin = function helpDialogPlugin(_ref
|
|
|
72
98
|
}];
|
|
73
99
|
}
|
|
74
100
|
},
|
|
75
|
-
contentComponent: function contentComponent(
|
|
76
|
-
var editorView =
|
|
101
|
+
contentComponent: function contentComponent(_ref5) {
|
|
102
|
+
var editorView = _ref5.editorView;
|
|
77
103
|
return /*#__PURE__*/_react.default.createElement(_HelpDialogLoader.HelpDialogLoader, {
|
|
78
104
|
pluginInjectionApi: api,
|
|
79
105
|
editorView: editorView,
|
|
@@ -88,14 +114,14 @@ var helpDialogPlugin = exports.helpDialogPlugin = function helpDialogPlugin(_ref
|
|
|
88
114
|
},
|
|
89
115
|
actions: {
|
|
90
116
|
openHelp: function openHelp() {
|
|
91
|
-
return api === null || api === void 0 ? void 0 : api.core.actions.execute(function (
|
|
92
|
-
var tr =
|
|
117
|
+
return api === null || api === void 0 ? void 0 : api.core.actions.execute(function (_ref6) {
|
|
118
|
+
var tr = _ref6.tr;
|
|
93
119
|
return (0, _actions.openHelpAction)(tr);
|
|
94
120
|
});
|
|
95
121
|
},
|
|
96
122
|
closeHelp: function closeHelp() {
|
|
97
|
-
return api === null || api === void 0 ? void 0 : api.core.actions.execute(function (
|
|
98
|
-
var tr =
|
|
123
|
+
return api === null || api === void 0 ? void 0 : api.core.actions.execute(function (_ref7) {
|
|
124
|
+
var tr = _ref7.tr;
|
|
99
125
|
return (0, _actions.closeHelpAction)(tr);
|
|
100
126
|
});
|
|
101
127
|
}
|
|
@@ -10,14 +10,15 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
|
10
10
|
var _pluginKey = require("./plugin-key");
|
|
11
11
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
12
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
|
-
function createPlugin(dispatch, imageEnabled) {
|
|
13
|
+
function createPlugin(dispatch, imageEnabled, aiEnabled) {
|
|
14
14
|
return new _safePlugin.SafePlugin({
|
|
15
15
|
key: _pluginKey.pluginKey,
|
|
16
16
|
state: {
|
|
17
17
|
init: function init() {
|
|
18
18
|
return {
|
|
19
19
|
isVisible: false,
|
|
20
|
-
imageEnabled: imageEnabled
|
|
20
|
+
imageEnabled: imageEnabled,
|
|
21
|
+
aiEnabled: aiEnabled
|
|
21
22
|
};
|
|
22
23
|
},
|
|
23
24
|
apply: function apply(tr, _value, state) {
|
|
@@ -13,6 +13,7 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
|
13
13
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
14
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
15
|
var _primitives = require("@atlaskit/primitives");
|
|
16
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
16
17
|
var _styles = require("./styles");
|
|
17
18
|
/**
|
|
18
19
|
* @jsxRuntime classic
|
|
@@ -382,8 +383,18 @@ var formatting = exports.formatting = function formatting(_ref2) {
|
|
|
382
383
|
}
|
|
383
384
|
}];
|
|
384
385
|
};
|
|
385
|
-
var
|
|
386
|
+
var quickInsertAskAI = function quickInsertAskAI(_ref3) {
|
|
386
387
|
var formatMessage = _ref3.formatMessage;
|
|
388
|
+
return {
|
|
389
|
+
name: formatMessage(_messages.toolbarMessages.askAI),
|
|
390
|
+
type: 'AI',
|
|
391
|
+
keymap: function keymap() {
|
|
392
|
+
return _keymaps.askAIQuickInsert;
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
};
|
|
396
|
+
var otherFormatting = function otherFormatting(_ref4) {
|
|
397
|
+
var formatMessage = _ref4.formatMessage;
|
|
387
398
|
return [{
|
|
388
399
|
name: formatMessage(_messages.toolbarMessages.clearFormatting),
|
|
389
400
|
type: 'clearFormatting',
|
|
@@ -579,8 +590,8 @@ var otherFormatting = function otherFormatting(_ref3) {
|
|
|
579
590
|
}
|
|
580
591
|
}]);
|
|
581
592
|
};
|
|
582
|
-
var resizeInformationFormatting = function resizeInformationFormatting(
|
|
583
|
-
var formatMessage =
|
|
593
|
+
var resizeInformationFormatting = function resizeInformationFormatting(_ref5) {
|
|
594
|
+
var formatMessage = _ref5.formatMessage;
|
|
584
595
|
return [{
|
|
585
596
|
name: formatMessage(_messages.helpDialogMessages.increaseSize),
|
|
586
597
|
type: 'media',
|
|
@@ -595,8 +606,8 @@ var resizeInformationFormatting = function resizeInformationFormatting(_ref4) {
|
|
|
595
606
|
}
|
|
596
607
|
}];
|
|
597
608
|
};
|
|
598
|
-
var focusTableResizeHandleFormatting = function focusTableResizeHandleFormatting(
|
|
599
|
-
var formatMessage =
|
|
609
|
+
var focusTableResizeHandleFormatting = function focusTableResizeHandleFormatting(_ref6) {
|
|
610
|
+
var formatMessage = _ref6.formatMessage;
|
|
600
611
|
return [{
|
|
601
612
|
name: formatMessage(_messages.helpDialogMessages.focusTableResizeHandle),
|
|
602
613
|
type: 'navigation',
|
|
@@ -605,8 +616,8 @@ var focusTableResizeHandleFormatting = function focusTableResizeHandleFormatting
|
|
|
605
616
|
}
|
|
606
617
|
}];
|
|
607
618
|
};
|
|
608
|
-
var openCellOptionsFormattingtoFormat = function openCellOptionsFormattingtoFormat(
|
|
609
|
-
var formatMessage =
|
|
619
|
+
var openCellOptionsFormattingtoFormat = function openCellOptionsFormattingtoFormat(_ref7) {
|
|
620
|
+
var formatMessage = _ref7.formatMessage;
|
|
610
621
|
return [{
|
|
611
622
|
name: formatMessage(_messages.helpDialogMessages.openCellOptions),
|
|
612
623
|
type: 'image',
|
|
@@ -628,8 +639,8 @@ var imageAutoFormat = {
|
|
|
628
639
|
, _messages.helpDialogMessages.altText), "](http://www.image.com)"));
|
|
629
640
|
}
|
|
630
641
|
};
|
|
631
|
-
var quickInsertAutoFormat = function quickInsertAutoFormat(
|
|
632
|
-
var formatMessage =
|
|
642
|
+
var quickInsertAutoFormat = function quickInsertAutoFormat(_ref8) {
|
|
643
|
+
var formatMessage = _ref8.formatMessage;
|
|
633
644
|
return {
|
|
634
645
|
name: formatMessage(_messages.helpDialogMessages.quickInsert),
|
|
635
646
|
type: 'quickInsert',
|
|
@@ -641,9 +652,9 @@ var quickInsertAutoFormat = function quickInsertAutoFormat(_ref7) {
|
|
|
641
652
|
}
|
|
642
653
|
};
|
|
643
654
|
};
|
|
644
|
-
var getSupportedFormatting = exports.getSupportedFormatting = function getSupportedFormatting(schema, intl, imageEnabled, quickInsertEnabled) {
|
|
655
|
+
var getSupportedFormatting = exports.getSupportedFormatting = function getSupportedFormatting(schema, intl, imageEnabled, quickInsertEnabled, aiEnabled) {
|
|
645
656
|
var supportedBySchema = formatting(intl).filter(function (format) {
|
|
646
657
|
return schema.nodes[format.type] || schema.marks[format.type];
|
|
647
658
|
});
|
|
648
|
-
return [].concat((0, _toConsumableArray2.default)(navigationKeymaps(intl)), (0, _toConsumableArray2.default)(otherFormatting(intl)), (0, _toConsumableArray2.default)(supportedBySchema), (0, _toConsumableArray2.default)(imageEnabled ? [imageAutoFormat] : []), (0, _toConsumableArray2.default)(quickInsertEnabled ? [quickInsertAutoFormat(intl)] : []), (0, _toConsumableArray2.default)(focusTableResizeHandleFormatting(intl)), (0, _toConsumableArray2.default)(resizeInformationFormatting(intl)), (0, _toConsumableArray2.default)(openCellOptionsFormattingtoFormat(intl)));
|
|
659
|
+
return [].concat((0, _toConsumableArray2.default)(aiEnabled && (0, _experiments.editorExperiment)('platform_editor_ai_quickstart_command', true) ? [quickInsertAskAI(intl)] : []), (0, _toConsumableArray2.default)(navigationKeymaps(intl)), (0, _toConsumableArray2.default)(otherFormatting(intl)), (0, _toConsumableArray2.default)(supportedBySchema), (0, _toConsumableArray2.default)(imageEnabled ? [imageAutoFormat] : []), (0, _toConsumableArray2.default)(quickInsertEnabled ? [quickInsertAutoFormat(intl)] : []), (0, _toConsumableArray2.default)(focusTableResizeHandleFormatting(intl)), (0, _toConsumableArray2.default)(resizeInformationFormatting(intl)), (0, _toConsumableArray2.default)(openCellOptionsFormattingtoFormat(intl)));
|
|
649
660
|
};
|
package/dist/cjs/ui/index.js
CHANGED
|
@@ -27,16 +27,19 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
27
27
|
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
28
28
|
var isVisible = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'helpDialog.isVisible');
|
|
29
29
|
var imageEnabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'helpDialog.imageEnabled');
|
|
30
|
+
var aiEnabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'helpDialog.aiEnabled');
|
|
30
31
|
return {
|
|
31
32
|
isVisible: isVisible,
|
|
32
|
-
imageEnabled: imageEnabled
|
|
33
|
+
imageEnabled: imageEnabled,
|
|
34
|
+
aiEnabled: aiEnabled
|
|
33
35
|
};
|
|
34
36
|
}, function (api) {
|
|
35
37
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['helpDialog']),
|
|
36
38
|
helpDialogState = _useSharedPluginState.helpDialogState;
|
|
37
39
|
return {
|
|
38
40
|
isVisible: helpDialogState === null || helpDialogState === void 0 ? void 0 : helpDialogState.isVisible,
|
|
39
|
-
imageEnabled: helpDialogState === null || helpDialogState === void 0 ? void 0 : helpDialogState.imageEnabled
|
|
41
|
+
imageEnabled: helpDialogState === null || helpDialogState === void 0 ? void 0 : helpDialogState.imageEnabled,
|
|
42
|
+
aiEnabled: helpDialogState === null || helpDialogState === void 0 ? void 0 : helpDialogState.aiEnabled
|
|
40
43
|
};
|
|
41
44
|
});
|
|
42
45
|
var HelpDialog = function HelpDialog(_ref) {
|
|
@@ -46,7 +49,8 @@ var HelpDialog = function HelpDialog(_ref) {
|
|
|
46
49
|
intl = _ref.intl;
|
|
47
50
|
var _useSharedState = useSharedState(pluginInjectionApi),
|
|
48
51
|
isVisible = _useSharedState.isVisible,
|
|
49
|
-
imageEnabled = _useSharedState.imageEnabled
|
|
52
|
+
imageEnabled = _useSharedState.imageEnabled,
|
|
53
|
+
aiEnabled = _useSharedState.aiEnabled;
|
|
50
54
|
var closeDialog = (0, _react.useCallback)(function () {
|
|
51
55
|
var tr = editorView.state.tr,
|
|
52
56
|
dispatch = editorView.dispatch;
|
|
@@ -67,7 +71,7 @@ var HelpDialog = function HelpDialog(_ref) {
|
|
|
67
71
|
document.removeEventListener('keydown', handleEsc);
|
|
68
72
|
};
|
|
69
73
|
}, [handleEsc]);
|
|
70
|
-
var formatting = (0, _formatting.getSupportedFormatting)(editorView.state.schema, intl, imageEnabled, quickInsertEnabled);
|
|
74
|
+
var formatting = (0, _formatting.getSupportedFormatting)(editorView.state.schema, intl, imageEnabled, quickInsertEnabled, aiEnabled);
|
|
71
75
|
return (0, _react2.jsx)(_modalDialog.ModalTransition, null, isVisible ? (0, _react2.jsx)(_modalDialog.default, {
|
|
72
76
|
width: "large",
|
|
73
77
|
onClose: closeDialog,
|
|
@@ -9,82 +9,112 @@ import { keymapPlugin } from './pm-plugins/keymap';
|
|
|
9
9
|
import { createPlugin } from './pm-plugins/main';
|
|
10
10
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
11
11
|
import { HelpDialogLoader } from './ui/HelpDialogLoader';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Normalise the caller-supplied config into a single, predictable shape.
|
|
15
|
+
* – Boolean → "image uploads on/off", AI always off
|
|
16
|
+
* – Object → pick the two feature flags with sane defaults (both false)
|
|
17
|
+
*/
|
|
18
|
+
function parseFeatureConfig(config) {
|
|
19
|
+
if (typeof config === 'boolean') {
|
|
20
|
+
return {
|
|
21
|
+
imageUploadProviderExists: config,
|
|
22
|
+
aiEnabled: false
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Object path – ensure we never return undefined
|
|
27
|
+
const {
|
|
28
|
+
imageUploadProviderExists = false,
|
|
29
|
+
aiEnabled = false
|
|
30
|
+
} = config !== null && config !== void 0 ? config : {};
|
|
31
|
+
return {
|
|
32
|
+
imageUploadProviderExists,
|
|
33
|
+
aiEnabled
|
|
34
|
+
};
|
|
35
|
+
}
|
|
12
36
|
export const helpDialogPlugin = ({
|
|
13
|
-
config
|
|
37
|
+
config,
|
|
14
38
|
api
|
|
15
|
-
}) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
39
|
+
}) => {
|
|
40
|
+
const {
|
|
41
|
+
imageUploadProviderExists,
|
|
42
|
+
aiEnabled
|
|
43
|
+
} = parseFeatureConfig(config);
|
|
44
|
+
return {
|
|
45
|
+
name: 'helpDialog',
|
|
46
|
+
pmPlugins() {
|
|
47
|
+
return [{
|
|
48
|
+
name: 'helpDialog',
|
|
49
|
+
plugin: ({
|
|
50
|
+
dispatch
|
|
51
|
+
}) => createPlugin(dispatch, imageUploadProviderExists, aiEnabled)
|
|
52
|
+
}, {
|
|
53
|
+
name: 'helpDialogKeymap',
|
|
54
|
+
plugin: () => {
|
|
55
|
+
var _api$analytics;
|
|
56
|
+
return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
57
|
+
}
|
|
58
|
+
}];
|
|
59
|
+
},
|
|
60
|
+
pluginsOptions: {
|
|
61
|
+
quickInsert: ({
|
|
62
|
+
formatMessage
|
|
63
|
+
}) => [{
|
|
64
|
+
id: 'helpdialog',
|
|
65
|
+
title: formatMessage(messages.help),
|
|
66
|
+
description: formatMessage(messages.helpDescription),
|
|
67
|
+
keywords: ['?'],
|
|
68
|
+
priority: 4000,
|
|
69
|
+
keyshortcut: tooltip(openHelp),
|
|
70
|
+
icon: () => /*#__PURE__*/React.createElement(QuestionCircleIcon, {
|
|
71
|
+
label: "",
|
|
72
|
+
color: "currentColor",
|
|
73
|
+
spacing: "spacious"
|
|
74
|
+
}),
|
|
75
|
+
action(insert) {
|
|
76
|
+
var _api$analytics2;
|
|
77
|
+
const tr = insert('');
|
|
78
|
+
openHelpCommand(tr);
|
|
79
|
+
api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.attachAnalyticsEvent({
|
|
80
|
+
action: ACTION.HELP_OPENED,
|
|
81
|
+
actionSubject: ACTION_SUBJECT.HELP,
|
|
82
|
+
actionSubjectId: ACTION_SUBJECT_ID.HELP_QUICK_INSERT,
|
|
83
|
+
attributes: {
|
|
84
|
+
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
85
|
+
},
|
|
86
|
+
eventType: EVENT_TYPE.UI
|
|
87
|
+
})(tr);
|
|
88
|
+
return tr;
|
|
89
|
+
}
|
|
90
|
+
}]
|
|
91
|
+
},
|
|
92
|
+
contentComponent({
|
|
93
|
+
editorView
|
|
94
|
+
}) {
|
|
95
|
+
return /*#__PURE__*/React.createElement(HelpDialogLoader, {
|
|
96
|
+
pluginInjectionApi: api,
|
|
97
|
+
editorView: editorView,
|
|
98
|
+
quickInsertEnabled: !!(api !== null && api !== void 0 && api.quickInsert)
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
getSharedState(editorState) {
|
|
102
|
+
if (!editorState) {
|
|
103
|
+
return null;
|
|
60
104
|
}
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
contentComponent({
|
|
64
|
-
editorView
|
|
65
|
-
}) {
|
|
66
|
-
return /*#__PURE__*/React.createElement(HelpDialogLoader, {
|
|
67
|
-
pluginInjectionApi: api,
|
|
68
|
-
editorView: editorView,
|
|
69
|
-
quickInsertEnabled: !!(api !== null && api !== void 0 && api.quickInsert)
|
|
70
|
-
});
|
|
71
|
-
},
|
|
72
|
-
getSharedState(editorState) {
|
|
73
|
-
if (!editorState) {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
return pluginKey.getState(editorState) || null;
|
|
77
|
-
},
|
|
78
|
-
actions: {
|
|
79
|
-
openHelp: () => {
|
|
80
|
-
return api === null || api === void 0 ? void 0 : api.core.actions.execute(({
|
|
81
|
-
tr
|
|
82
|
-
}) => openHelpAction(tr));
|
|
105
|
+
return pluginKey.getState(editorState) || null;
|
|
83
106
|
},
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
107
|
+
actions: {
|
|
108
|
+
openHelp: () => {
|
|
109
|
+
return api === null || api === void 0 ? void 0 : api.core.actions.execute(({
|
|
110
|
+
tr
|
|
111
|
+
}) => openHelpAction(tr));
|
|
112
|
+
},
|
|
113
|
+
closeHelp: () => {
|
|
114
|
+
return api === null || api === void 0 ? void 0 : api.core.actions.execute(({
|
|
115
|
+
tr
|
|
116
|
+
}) => closeHelpAction(tr));
|
|
117
|
+
}
|
|
88
118
|
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
119
|
+
};
|
|
120
|
+
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { pluginKey } from './plugin-key';
|
|
3
|
-
export function createPlugin(dispatch, imageEnabled) {
|
|
3
|
+
export function createPlugin(dispatch, imageEnabled, aiEnabled) {
|
|
4
4
|
return new SafePlugin({
|
|
5
5
|
key: pluginKey,
|
|
6
6
|
state: {
|
|
7
7
|
init() {
|
|
8
8
|
return {
|
|
9
9
|
isVisible: false,
|
|
10
|
-
imageEnabled
|
|
10
|
+
imageEnabled,
|
|
11
|
+
aiEnabled
|
|
11
12
|
};
|
|
12
13
|
},
|
|
13
14
|
apply(tr, _value, state) {
|
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
7
|
import { FormattedMessage } from 'react-intl-next';
|
|
8
8
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
9
|
-
import { addInlineComment, addLink, alignCenter, alignLeft, alignRight, clearFormatting, decreaseMediaSize, focusTableResizer, focusToContextMenuTrigger, increaseMediaSize, insertRule, navToEditorToolbar, navToFloatingToolbar, pastePlainText, redo, redoAlt, setNormalText, toggleBlockQuote, toggleBold, toggleBulletList, toggleCode, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleHighlightPalette, toggleItalic, toggleOrderedList, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleTaskItemCheckbox, toggleUnderline, undo } from '@atlaskit/editor-common/keymaps';
|
|
9
|
+
import { addInlineComment, addLink, alignCenter, alignLeft, alignRight, askAIQuickInsert, clearFormatting, decreaseMediaSize, focusTableResizer, focusToContextMenuTrigger, increaseMediaSize, insertRule, navToEditorToolbar, navToFloatingToolbar, pastePlainText, redo, redoAlt, setNormalText, toggleBlockQuote, toggleBold, toggleBulletList, toggleCode, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleHighlightPalette, toggleItalic, toggleOrderedList, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleTaskItemCheckbox, toggleUnderline, undo } from '@atlaskit/editor-common/keymaps';
|
|
10
10
|
import { alignmentMessages, annotationMessages, blockTypeMessages, listMessages, helpDialogMessages as messages, toolbarInsertBlockMessages, toolbarMessages, undoRedoMessages } from '@atlaskit/editor-common/messages';
|
|
11
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
12
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
13
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
13
14
|
import { shortcutsArray } from './styles';
|
|
14
15
|
const codeSm = xcss({
|
|
15
16
|
backgroundColor: 'color.background.neutral',
|
|
@@ -283,6 +284,13 @@ export const formatting = ({
|
|
|
283
284
|
type: 'alignment',
|
|
284
285
|
keymap: () => alignRight
|
|
285
286
|
}];
|
|
287
|
+
const quickInsertAskAI = ({
|
|
288
|
+
formatMessage
|
|
289
|
+
}) => ({
|
|
290
|
+
name: formatMessage(toolbarMessages.askAI),
|
|
291
|
+
type: 'AI',
|
|
292
|
+
keymap: () => askAIQuickInsert
|
|
293
|
+
});
|
|
286
294
|
const otherFormatting = ({
|
|
287
295
|
formatMessage
|
|
288
296
|
}) => [{
|
|
@@ -496,7 +504,7 @@ const quickInsertAutoFormat = ({
|
|
|
496
504
|
xcss: codeLg
|
|
497
505
|
}, "/"))
|
|
498
506
|
});
|
|
499
|
-
export const getSupportedFormatting = (schema, intl, imageEnabled, quickInsertEnabled) => {
|
|
507
|
+
export const getSupportedFormatting = (schema, intl, imageEnabled, quickInsertEnabled, aiEnabled) => {
|
|
500
508
|
const supportedBySchema = formatting(intl).filter(format => schema.nodes[format.type] || schema.marks[format.type]);
|
|
501
|
-
return [...navigationKeymaps(intl), ...otherFormatting(intl), ...supportedBySchema, ...(imageEnabled ? [imageAutoFormat] : []), ...(quickInsertEnabled ? [quickInsertAutoFormat(intl)] : []), ...focusTableResizeHandleFormatting(intl), ...resizeInformationFormatting(intl), ...openCellOptionsFormattingtoFormat(intl)];
|
|
509
|
+
return [...(aiEnabled && editorExperiment('platform_editor_ai_quickstart_command', true) ? [quickInsertAskAI(intl)] : []), ...navigationKeymaps(intl), ...otherFormatting(intl), ...supportedBySchema, ...(imageEnabled ? [imageAutoFormat] : []), ...(quickInsertEnabled ? [quickInsertAutoFormat(intl)] : []), ...focusTableResizeHandleFormatting(intl), ...resizeInformationFormatting(intl), ...openCellOptionsFormattingtoFormat(intl)];
|
|
502
510
|
};
|
package/dist/es2019/ui/index.js
CHANGED
|
@@ -16,9 +16,11 @@ import Modal from './Modal';
|
|
|
16
16
|
const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
17
17
|
const isVisible = useSharedPluginStateSelector(api, 'helpDialog.isVisible');
|
|
18
18
|
const imageEnabled = useSharedPluginStateSelector(api, 'helpDialog.imageEnabled');
|
|
19
|
+
const aiEnabled = useSharedPluginStateSelector(api, 'helpDialog.aiEnabled');
|
|
19
20
|
return {
|
|
20
21
|
isVisible,
|
|
21
|
-
imageEnabled
|
|
22
|
+
imageEnabled,
|
|
23
|
+
aiEnabled
|
|
22
24
|
};
|
|
23
25
|
}, api => {
|
|
24
26
|
const {
|
|
@@ -26,7 +28,8 @@ const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
|
26
28
|
} = useSharedPluginState(api, ['helpDialog']);
|
|
27
29
|
return {
|
|
28
30
|
isVisible: helpDialogState === null || helpDialogState === void 0 ? void 0 : helpDialogState.isVisible,
|
|
29
|
-
imageEnabled: helpDialogState === null || helpDialogState === void 0 ? void 0 : helpDialogState.imageEnabled
|
|
31
|
+
imageEnabled: helpDialogState === null || helpDialogState === void 0 ? void 0 : helpDialogState.imageEnabled,
|
|
32
|
+
aiEnabled: helpDialogState === null || helpDialogState === void 0 ? void 0 : helpDialogState.aiEnabled
|
|
30
33
|
};
|
|
31
34
|
});
|
|
32
35
|
const HelpDialog = ({
|
|
@@ -37,7 +40,8 @@ const HelpDialog = ({
|
|
|
37
40
|
}) => {
|
|
38
41
|
const {
|
|
39
42
|
isVisible,
|
|
40
|
-
imageEnabled
|
|
43
|
+
imageEnabled,
|
|
44
|
+
aiEnabled
|
|
41
45
|
} = useSharedState(pluginInjectionApi);
|
|
42
46
|
const closeDialog = useCallback(() => {
|
|
43
47
|
const {
|
|
@@ -63,7 +67,7 @@ const HelpDialog = ({
|
|
|
63
67
|
document.removeEventListener('keydown', handleEsc);
|
|
64
68
|
};
|
|
65
69
|
}, [handleEsc]);
|
|
66
|
-
const formatting = getSupportedFormatting(editorView.state.schema, intl, imageEnabled, quickInsertEnabled);
|
|
70
|
+
const formatting = getSupportedFormatting(editorView.state.schema, intl, imageEnabled, quickInsertEnabled, aiEnabled);
|
|
67
71
|
return jsx(ModalTransition, null, isVisible ? jsx(AkModalDialog, {
|
|
68
72
|
width: "large",
|
|
69
73
|
onClose: closeDialog,
|
|
@@ -9,18 +9,45 @@ import { keymapPlugin } from './pm-plugins/keymap';
|
|
|
9
9
|
import { createPlugin } from './pm-plugins/main';
|
|
10
10
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
11
11
|
import { HelpDialogLoader } from './ui/HelpDialogLoader';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Normalise the caller-supplied config into a single, predictable shape.
|
|
15
|
+
* – Boolean → "image uploads on/off", AI always off
|
|
16
|
+
* – Object → pick the two feature flags with sane defaults (both false)
|
|
17
|
+
*/
|
|
18
|
+
function parseFeatureConfig(config) {
|
|
19
|
+
if (typeof config === 'boolean') {
|
|
20
|
+
return {
|
|
21
|
+
imageUploadProviderExists: config,
|
|
22
|
+
aiEnabled: false
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Object path – ensure we never return undefined
|
|
27
|
+
var _ref = config !== null && config !== void 0 ? config : {},
|
|
28
|
+
_ref$imageUploadProvi = _ref.imageUploadProviderExists,
|
|
29
|
+
imageUploadProviderExists = _ref$imageUploadProvi === void 0 ? false : _ref$imageUploadProvi,
|
|
30
|
+
_ref$aiEnabled = _ref.aiEnabled,
|
|
31
|
+
aiEnabled = _ref$aiEnabled === void 0 ? false : _ref$aiEnabled;
|
|
32
|
+
return {
|
|
33
|
+
imageUploadProviderExists: imageUploadProviderExists,
|
|
34
|
+
aiEnabled: aiEnabled
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export var helpDialogPlugin = function helpDialogPlugin(_ref2) {
|
|
38
|
+
var config = _ref2.config,
|
|
39
|
+
api = _ref2.api;
|
|
40
|
+
var _parseFeatureConfig = parseFeatureConfig(config),
|
|
41
|
+
imageUploadProviderExists = _parseFeatureConfig.imageUploadProviderExists,
|
|
42
|
+
aiEnabled = _parseFeatureConfig.aiEnabled;
|
|
16
43
|
return {
|
|
17
44
|
name: 'helpDialog',
|
|
18
45
|
pmPlugins: function pmPlugins() {
|
|
19
46
|
return [{
|
|
20
47
|
name: 'helpDialog',
|
|
21
|
-
plugin: function plugin(
|
|
22
|
-
var dispatch =
|
|
23
|
-
return createPlugin(dispatch, imageUploadProviderExists);
|
|
48
|
+
plugin: function plugin(_ref3) {
|
|
49
|
+
var dispatch = _ref3.dispatch;
|
|
50
|
+
return createPlugin(dispatch, imageUploadProviderExists, aiEnabled);
|
|
24
51
|
}
|
|
25
52
|
}, {
|
|
26
53
|
name: 'helpDialogKeymap',
|
|
@@ -31,8 +58,8 @@ export var helpDialogPlugin = function helpDialogPlugin(_ref) {
|
|
|
31
58
|
}];
|
|
32
59
|
},
|
|
33
60
|
pluginsOptions: {
|
|
34
|
-
quickInsert: function quickInsert(
|
|
35
|
-
var formatMessage =
|
|
61
|
+
quickInsert: function quickInsert(_ref4) {
|
|
62
|
+
var formatMessage = _ref4.formatMessage;
|
|
36
63
|
return [{
|
|
37
64
|
id: 'helpdialog',
|
|
38
65
|
title: formatMessage(messages.help),
|
|
@@ -65,8 +92,8 @@ export var helpDialogPlugin = function helpDialogPlugin(_ref) {
|
|
|
65
92
|
}];
|
|
66
93
|
}
|
|
67
94
|
},
|
|
68
|
-
contentComponent: function contentComponent(
|
|
69
|
-
var editorView =
|
|
95
|
+
contentComponent: function contentComponent(_ref5) {
|
|
96
|
+
var editorView = _ref5.editorView;
|
|
70
97
|
return /*#__PURE__*/React.createElement(HelpDialogLoader, {
|
|
71
98
|
pluginInjectionApi: api,
|
|
72
99
|
editorView: editorView,
|
|
@@ -81,14 +108,14 @@ export var helpDialogPlugin = function helpDialogPlugin(_ref) {
|
|
|
81
108
|
},
|
|
82
109
|
actions: {
|
|
83
110
|
openHelp: function openHelp() {
|
|
84
|
-
return api === null || api === void 0 ? void 0 : api.core.actions.execute(function (
|
|
85
|
-
var tr =
|
|
111
|
+
return api === null || api === void 0 ? void 0 : api.core.actions.execute(function (_ref6) {
|
|
112
|
+
var tr = _ref6.tr;
|
|
86
113
|
return openHelpAction(tr);
|
|
87
114
|
});
|
|
88
115
|
},
|
|
89
116
|
closeHelp: function closeHelp() {
|
|
90
|
-
return api === null || api === void 0 ? void 0 : api.core.actions.execute(function (
|
|
91
|
-
var tr =
|
|
117
|
+
return api === null || api === void 0 ? void 0 : api.core.actions.execute(function (_ref7) {
|
|
118
|
+
var tr = _ref7.tr;
|
|
92
119
|
return closeHelpAction(tr);
|
|
93
120
|
});
|
|
94
121
|
}
|
|
@@ -3,14 +3,15 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
5
|
import { pluginKey } from './plugin-key';
|
|
6
|
-
export function createPlugin(dispatch, imageEnabled) {
|
|
6
|
+
export function createPlugin(dispatch, imageEnabled, aiEnabled) {
|
|
7
7
|
return new SafePlugin({
|
|
8
8
|
key: pluginKey,
|
|
9
9
|
state: {
|
|
10
10
|
init: function init() {
|
|
11
11
|
return {
|
|
12
12
|
isVisible: false,
|
|
13
|
-
imageEnabled: imageEnabled
|
|
13
|
+
imageEnabled: imageEnabled,
|
|
14
|
+
aiEnabled: aiEnabled
|
|
14
15
|
};
|
|
15
16
|
},
|
|
16
17
|
apply: function apply(tr, _value, state) {
|
|
@@ -7,10 +7,11 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
7
7
|
import { jsx } from '@emotion/react';
|
|
8
8
|
import { FormattedMessage } from 'react-intl-next';
|
|
9
9
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
10
|
-
import { addInlineComment, addLink, alignCenter, alignLeft, alignRight, clearFormatting, decreaseMediaSize, focusTableResizer, focusToContextMenuTrigger, increaseMediaSize, insertRule, navToEditorToolbar, navToFloatingToolbar, pastePlainText, redo, redoAlt, setNormalText, toggleBlockQuote, toggleBold, toggleBulletList, toggleCode, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleHighlightPalette, toggleItalic, toggleOrderedList, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleTaskItemCheckbox, toggleUnderline, undo } from '@atlaskit/editor-common/keymaps';
|
|
10
|
+
import { addInlineComment, addLink, alignCenter, alignLeft, alignRight, askAIQuickInsert, clearFormatting, decreaseMediaSize, focusTableResizer, focusToContextMenuTrigger, increaseMediaSize, insertRule, navToEditorToolbar, navToFloatingToolbar, pastePlainText, redo, redoAlt, setNormalText, toggleBlockQuote, toggleBold, toggleBulletList, toggleCode, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleHighlightPalette, toggleItalic, toggleOrderedList, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleTaskItemCheckbox, toggleUnderline, undo } from '@atlaskit/editor-common/keymaps';
|
|
11
11
|
import { alignmentMessages, annotationMessages, blockTypeMessages, listMessages, helpDialogMessages as messages, toolbarInsertBlockMessages, toolbarMessages, undoRedoMessages } from '@atlaskit/editor-common/messages';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
13
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
14
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
14
15
|
import { shortcutsArray } from './styles';
|
|
15
16
|
var codeSm = xcss({
|
|
16
17
|
backgroundColor: 'color.background.neutral',
|
|
@@ -374,8 +375,18 @@ export var formatting = function formatting(_ref2) {
|
|
|
374
375
|
}
|
|
375
376
|
}];
|
|
376
377
|
};
|
|
377
|
-
var
|
|
378
|
+
var quickInsertAskAI = function quickInsertAskAI(_ref3) {
|
|
378
379
|
var formatMessage = _ref3.formatMessage;
|
|
380
|
+
return {
|
|
381
|
+
name: formatMessage(toolbarMessages.askAI),
|
|
382
|
+
type: 'AI',
|
|
383
|
+
keymap: function keymap() {
|
|
384
|
+
return askAIQuickInsert;
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
};
|
|
388
|
+
var otherFormatting = function otherFormatting(_ref4) {
|
|
389
|
+
var formatMessage = _ref4.formatMessage;
|
|
379
390
|
return [{
|
|
380
391
|
name: formatMessage(toolbarMessages.clearFormatting),
|
|
381
392
|
type: 'clearFormatting',
|
|
@@ -571,8 +582,8 @@ var otherFormatting = function otherFormatting(_ref3) {
|
|
|
571
582
|
}
|
|
572
583
|
}]);
|
|
573
584
|
};
|
|
574
|
-
var resizeInformationFormatting = function resizeInformationFormatting(
|
|
575
|
-
var formatMessage =
|
|
585
|
+
var resizeInformationFormatting = function resizeInformationFormatting(_ref5) {
|
|
586
|
+
var formatMessage = _ref5.formatMessage;
|
|
576
587
|
return [{
|
|
577
588
|
name: formatMessage(messages.increaseSize),
|
|
578
589
|
type: 'media',
|
|
@@ -587,8 +598,8 @@ var resizeInformationFormatting = function resizeInformationFormatting(_ref4) {
|
|
|
587
598
|
}
|
|
588
599
|
}];
|
|
589
600
|
};
|
|
590
|
-
var focusTableResizeHandleFormatting = function focusTableResizeHandleFormatting(
|
|
591
|
-
var formatMessage =
|
|
601
|
+
var focusTableResizeHandleFormatting = function focusTableResizeHandleFormatting(_ref6) {
|
|
602
|
+
var formatMessage = _ref6.formatMessage;
|
|
592
603
|
return [{
|
|
593
604
|
name: formatMessage(messages.focusTableResizeHandle),
|
|
594
605
|
type: 'navigation',
|
|
@@ -597,8 +608,8 @@ var focusTableResizeHandleFormatting = function focusTableResizeHandleFormatting
|
|
|
597
608
|
}
|
|
598
609
|
}];
|
|
599
610
|
};
|
|
600
|
-
var openCellOptionsFormattingtoFormat = function openCellOptionsFormattingtoFormat(
|
|
601
|
-
var formatMessage =
|
|
611
|
+
var openCellOptionsFormattingtoFormat = function openCellOptionsFormattingtoFormat(_ref7) {
|
|
612
|
+
var formatMessage = _ref7.formatMessage;
|
|
602
613
|
return [{
|
|
603
614
|
name: formatMessage(messages.openCellOptions),
|
|
604
615
|
type: 'image',
|
|
@@ -620,8 +631,8 @@ var imageAutoFormat = {
|
|
|
620
631
|
, messages.altText), "](http://www.image.com)"));
|
|
621
632
|
}
|
|
622
633
|
};
|
|
623
|
-
var quickInsertAutoFormat = function quickInsertAutoFormat(
|
|
624
|
-
var formatMessage =
|
|
634
|
+
var quickInsertAutoFormat = function quickInsertAutoFormat(_ref8) {
|
|
635
|
+
var formatMessage = _ref8.formatMessage;
|
|
625
636
|
return {
|
|
626
637
|
name: formatMessage(messages.quickInsert),
|
|
627
638
|
type: 'quickInsert',
|
|
@@ -633,9 +644,9 @@ var quickInsertAutoFormat = function quickInsertAutoFormat(_ref7) {
|
|
|
633
644
|
}
|
|
634
645
|
};
|
|
635
646
|
};
|
|
636
|
-
export var getSupportedFormatting = function getSupportedFormatting(schema, intl, imageEnabled, quickInsertEnabled) {
|
|
647
|
+
export var getSupportedFormatting = function getSupportedFormatting(schema, intl, imageEnabled, quickInsertEnabled, aiEnabled) {
|
|
637
648
|
var supportedBySchema = formatting(intl).filter(function (format) {
|
|
638
649
|
return schema.nodes[format.type] || schema.marks[format.type];
|
|
639
650
|
});
|
|
640
|
-
return [].concat(_toConsumableArray(navigationKeymaps(intl)), _toConsumableArray(otherFormatting(intl)), _toConsumableArray(supportedBySchema), _toConsumableArray(imageEnabled ? [imageAutoFormat] : []), _toConsumableArray(quickInsertEnabled ? [quickInsertAutoFormat(intl)] : []), _toConsumableArray(focusTableResizeHandleFormatting(intl)), _toConsumableArray(resizeInformationFormatting(intl)), _toConsumableArray(openCellOptionsFormattingtoFormat(intl)));
|
|
651
|
+
return [].concat(_toConsumableArray(aiEnabled && editorExperiment('platform_editor_ai_quickstart_command', true) ? [quickInsertAskAI(intl)] : []), _toConsumableArray(navigationKeymaps(intl)), _toConsumableArray(otherFormatting(intl)), _toConsumableArray(supportedBySchema), _toConsumableArray(imageEnabled ? [imageAutoFormat] : []), _toConsumableArray(quickInsertEnabled ? [quickInsertAutoFormat(intl)] : []), _toConsumableArray(focusTableResizeHandleFormatting(intl)), _toConsumableArray(resizeInformationFormatting(intl)), _toConsumableArray(openCellOptionsFormattingtoFormat(intl)));
|
|
641
652
|
};
|
package/dist/esm/ui/index.js
CHANGED
|
@@ -16,16 +16,19 @@ import Modal from './Modal';
|
|
|
16
16
|
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
17
17
|
var isVisible = useSharedPluginStateSelector(api, 'helpDialog.isVisible');
|
|
18
18
|
var imageEnabled = useSharedPluginStateSelector(api, 'helpDialog.imageEnabled');
|
|
19
|
+
var aiEnabled = useSharedPluginStateSelector(api, 'helpDialog.aiEnabled');
|
|
19
20
|
return {
|
|
20
21
|
isVisible: isVisible,
|
|
21
|
-
imageEnabled: imageEnabled
|
|
22
|
+
imageEnabled: imageEnabled,
|
|
23
|
+
aiEnabled: aiEnabled
|
|
22
24
|
};
|
|
23
25
|
}, function (api) {
|
|
24
26
|
var _useSharedPluginState = useSharedPluginState(api, ['helpDialog']),
|
|
25
27
|
helpDialogState = _useSharedPluginState.helpDialogState;
|
|
26
28
|
return {
|
|
27
29
|
isVisible: helpDialogState === null || helpDialogState === void 0 ? void 0 : helpDialogState.isVisible,
|
|
28
|
-
imageEnabled: helpDialogState === null || helpDialogState === void 0 ? void 0 : helpDialogState.imageEnabled
|
|
30
|
+
imageEnabled: helpDialogState === null || helpDialogState === void 0 ? void 0 : helpDialogState.imageEnabled,
|
|
31
|
+
aiEnabled: helpDialogState === null || helpDialogState === void 0 ? void 0 : helpDialogState.aiEnabled
|
|
29
32
|
};
|
|
30
33
|
});
|
|
31
34
|
var HelpDialog = function HelpDialog(_ref) {
|
|
@@ -35,7 +38,8 @@ var HelpDialog = function HelpDialog(_ref) {
|
|
|
35
38
|
intl = _ref.intl;
|
|
36
39
|
var _useSharedState = useSharedState(pluginInjectionApi),
|
|
37
40
|
isVisible = _useSharedState.isVisible,
|
|
38
|
-
imageEnabled = _useSharedState.imageEnabled
|
|
41
|
+
imageEnabled = _useSharedState.imageEnabled,
|
|
42
|
+
aiEnabled = _useSharedState.aiEnabled;
|
|
39
43
|
var closeDialog = useCallback(function () {
|
|
40
44
|
var tr = editorView.state.tr,
|
|
41
45
|
dispatch = editorView.dispatch;
|
|
@@ -56,7 +60,7 @@ var HelpDialog = function HelpDialog(_ref) {
|
|
|
56
60
|
document.removeEventListener('keydown', handleEsc);
|
|
57
61
|
};
|
|
58
62
|
}, [handleEsc]);
|
|
59
|
-
var formatting = getSupportedFormatting(editorView.state.schema, intl, imageEnabled, quickInsertEnabled);
|
|
63
|
+
var formatting = getSupportedFormatting(editorView.state.schema, intl, imageEnabled, quickInsertEnabled, aiEnabled);
|
|
60
64
|
return jsx(ModalTransition, null, isVisible ? jsx(AkModalDialog, {
|
|
61
65
|
width: "large",
|
|
62
66
|
onClose: closeDialog,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { HelpDialogPlugin } from './helpDialogPluginType';
|
|
2
2
|
export declare const helpDialogPlugin: HelpDialogPlugin;
|
|
@@ -4,12 +4,16 @@ import type { QuickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
|
|
|
4
4
|
export interface HelpDialogSharedState {
|
|
5
5
|
isVisible: boolean;
|
|
6
6
|
imageEnabled: boolean;
|
|
7
|
+
aiEnabled: boolean;
|
|
7
8
|
}
|
|
8
9
|
export type HelpDialogDependencies = [
|
|
9
10
|
OptionalPlugin<AnalyticsPlugin>,
|
|
10
11
|
OptionalPlugin<QuickInsertPlugin>
|
|
11
12
|
];
|
|
12
|
-
export type HelpDialogPluginOptions = boolean
|
|
13
|
+
export type HelpDialogPluginOptions = boolean | {
|
|
14
|
+
imageUploadProviderExists?: boolean;
|
|
15
|
+
aiEnabled?: boolean;
|
|
16
|
+
};
|
|
13
17
|
export type HelpDialogPlugin = NextEditorPlugin<'helpDialog', {
|
|
14
18
|
dependencies: HelpDialogDependencies;
|
|
15
19
|
pluginConfiguration: HelpDialogPluginOptions;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
export declare function createPlugin(dispatch: Function, imageEnabled: boolean): SafePlugin<any>;
|
|
2
|
+
export declare function createPlugin(dispatch: Function, imageEnabled: boolean, aiEnabled: boolean): SafePlugin<any>;
|
|
@@ -2,4 +2,4 @@ import type { IntlShape } from 'react-intl-next';
|
|
|
2
2
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import type { Format } from './Format';
|
|
4
4
|
export declare const formatting: (intl: IntlShape) => Format[];
|
|
5
|
-
export declare const getSupportedFormatting: (schema: Schema, intl: IntlShape, imageEnabled?: boolean, quickInsertEnabled?: boolean) => Format[];
|
|
5
|
+
export declare const getSupportedFormatting: (schema: Schema, intl: IntlShape, imageEnabled?: boolean, quickInsertEnabled?: boolean, aiEnabled?: boolean) => Format[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { HelpDialogPlugin } from './helpDialogPluginType';
|
|
2
2
|
export declare const helpDialogPlugin: HelpDialogPlugin;
|
|
@@ -4,12 +4,16 @@ import type { QuickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
|
|
|
4
4
|
export interface HelpDialogSharedState {
|
|
5
5
|
isVisible: boolean;
|
|
6
6
|
imageEnabled: boolean;
|
|
7
|
+
aiEnabled: boolean;
|
|
7
8
|
}
|
|
8
9
|
export type HelpDialogDependencies = [
|
|
9
10
|
OptionalPlugin<AnalyticsPlugin>,
|
|
10
11
|
OptionalPlugin<QuickInsertPlugin>
|
|
11
12
|
];
|
|
12
|
-
export type HelpDialogPluginOptions = boolean
|
|
13
|
+
export type HelpDialogPluginOptions = boolean | {
|
|
14
|
+
imageUploadProviderExists?: boolean;
|
|
15
|
+
aiEnabled?: boolean;
|
|
16
|
+
};
|
|
13
17
|
export type HelpDialogPlugin = NextEditorPlugin<'helpDialog', {
|
|
14
18
|
dependencies: HelpDialogDependencies;
|
|
15
19
|
pluginConfiguration: HelpDialogPluginOptions;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
export declare function createPlugin(dispatch: Function, imageEnabled: boolean): SafePlugin<any>;
|
|
2
|
+
export declare function createPlugin(dispatch: Function, imageEnabled: boolean, aiEnabled: boolean): SafePlugin<any>;
|
|
@@ -2,4 +2,4 @@ import type { IntlShape } from 'react-intl-next';
|
|
|
2
2
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import type { Format } from './Format';
|
|
4
4
|
export declare const formatting: (intl: IntlShape) => Format[];
|
|
5
|
-
export declare const getSupportedFormatting: (schema: Schema, intl: IntlShape, imageEnabled?: boolean, quickInsertEnabled?: boolean) => Format[];
|
|
5
|
+
export declare const getSupportedFormatting: (schema: Schema, intl: IntlShape, imageEnabled?: boolean, quickInsertEnabled?: boolean, aiEnabled?: boolean) => Format[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-help-dialog",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.7",
|
|
4
4
|
"description": "Help Dialog plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,18 +33,19 @@
|
|
|
33
33
|
".": "./src/index.ts"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@atlaskit/editor-common": "^
|
|
37
|
-
"@atlaskit/editor-plugin-analytics": "^2.
|
|
36
|
+
"@atlaskit/editor-common": "^106.0.0",
|
|
37
|
+
"@atlaskit/editor-plugin-analytics": "^2.3.0",
|
|
38
38
|
"@atlaskit/editor-plugin-quick-insert": "^2.5.0",
|
|
39
39
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
40
40
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
41
41
|
"@atlaskit/heading": "^5.2.0",
|
|
42
|
-
"@atlaskit/icon": "^26.
|
|
43
|
-
"@atlaskit/modal-dialog": "^14.
|
|
42
|
+
"@atlaskit/icon": "^26.4.0",
|
|
43
|
+
"@atlaskit/modal-dialog": "^14.2.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
45
|
-
"@atlaskit/primitives": "^14.
|
|
45
|
+
"@atlaskit/primitives": "^14.8.0",
|
|
46
46
|
"@atlaskit/theme": "^18.0.0",
|
|
47
|
-
"@atlaskit/
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^5.2.0",
|
|
48
|
+
"@atlaskit/tokens": "^4.9.0",
|
|
48
49
|
"@babel/runtime": "^7.0.0",
|
|
49
50
|
"@emotion/react": "^11.7.1",
|
|
50
51
|
"react-intl-next": "npm:react-intl@^5.18.1",
|