@atlaskit/editor-plugin-extension 5.3.7 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/pm-plugins/toolbar.js +5 -0
- package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +15 -4
- package/dist/cjs/ui/ConfigPanel/HelpLink.js +16 -10
- package/dist/cjs/ui/useConfigPanelPluginHook.js +34 -18
- package/dist/es2019/pm-plugins/toolbar.js +5 -0
- package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +16 -5
- package/dist/es2019/ui/ConfigPanel/HelpLink.js +16 -10
- package/dist/es2019/ui/useConfigPanelPluginHook.js +35 -20
- package/dist/esm/pm-plugins/toolbar.js +5 -0
- package/dist/esm/ui/ConfigPanel/ConfigPanel.js +16 -5
- package/dist/esm/ui/ConfigPanel/HelpLink.js +16 -10
- package/dist/esm/ui/useConfigPanelPluginHook.js +35 -19
- package/dist/types/extensionPluginType.d.ts +1 -1
- package/dist/types/pm-plugins/toolbar.d.ts +1 -1
- package/dist/types-ts4.5/extensionPluginType.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/toolbar.d.ts +1 -1
- package/package.json +15 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-extension
|
|
2
2
|
|
|
3
|
+
## 5.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#157075](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/157075)
|
|
8
|
+
[`bd3036802949a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bd3036802949a) -
|
|
9
|
+
We are testing the migration to the ADS Link component behind a feature flag. If this fix is
|
|
10
|
+
successful it will be available in a later release.
|
|
11
|
+
|
|
12
|
+
## 5.3.8
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#147357](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/147357)
|
|
17
|
+
[`1eab8cfeaf029`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1eab8cfeaf029) -
|
|
18
|
+
Migrate extensions and floating toolbar plugins to use useSharedPluginStateSelector hook
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 5.3.7
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -221,6 +221,11 @@ var editButton = function editButton(formatMessage, extensionState, applyChangeT
|
|
|
221
221
|
|
|
222
222
|
/**
|
|
223
223
|
* Calculates the position for the toolbar when dealing with nested extensions
|
|
224
|
+
* @param editorView
|
|
225
|
+
* @param nextPos
|
|
226
|
+
* @param state
|
|
227
|
+
* @param extensionNode
|
|
228
|
+
* @example
|
|
224
229
|
*/
|
|
225
230
|
var calculateToolbarPosition = function calculateToolbarPosition(editorView, nextPos, state, extensionNode) {
|
|
226
231
|
var _editorView$state = editorView.state,
|
|
@@ -26,6 +26,7 @@ var _new = _interopRequireDefault(require("@atlaskit/button/new"));
|
|
|
26
26
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
27
27
|
var _extensions = require("@atlaskit/editor-common/extensions");
|
|
28
28
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
29
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
29
30
|
var _form = _interopRequireWildcard(require("@atlaskit/form"));
|
|
30
31
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
31
32
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
@@ -488,6 +489,18 @@ var ConfigPanel = /*#__PURE__*/function (_React$Component) {
|
|
|
488
489
|
}
|
|
489
490
|
}]);
|
|
490
491
|
}(_react.default.Component);
|
|
492
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
493
|
+
var contextIdentifierProvider = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'contextIdentifier.contextIdentifierProvider');
|
|
494
|
+
return {
|
|
495
|
+
contextIdentifierProvider: contextIdentifierProvider
|
|
496
|
+
};
|
|
497
|
+
}, function (api) {
|
|
498
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['contextIdentifier']),
|
|
499
|
+
contextIdentifierState = _useSharedPluginState.contextIdentifierState;
|
|
500
|
+
return {
|
|
501
|
+
contextIdentifierProvider: contextIdentifierState === null || contextIdentifierState === void 0 ? void 0 : contextIdentifierState.contextIdentifierProvider
|
|
502
|
+
};
|
|
503
|
+
});
|
|
491
504
|
function ConfigFormIntlWithBoundary(_ref6) {
|
|
492
505
|
var api = _ref6.api,
|
|
493
506
|
fields = _ref6.fields,
|
|
@@ -503,10 +516,8 @@ function ConfigFormIntlWithBoundary(_ref6) {
|
|
|
503
516
|
firstVisibleFieldName = _ref6.firstVisibleFieldName,
|
|
504
517
|
errorMessage = _ref6.errorMessage,
|
|
505
518
|
disableFields = _ref6.disableFields;
|
|
506
|
-
var
|
|
507
|
-
|
|
508
|
-
var _ref7 = contextIdentifierState !== null && contextIdentifierState !== void 0 ? contextIdentifierState : {},
|
|
509
|
-
contextIdentifierProvider = _ref7.contextIdentifierProvider;
|
|
519
|
+
var _useSharedState = useSharedState(api),
|
|
520
|
+
contextIdentifierProvider = _useSharedState.contextIdentifierProvider;
|
|
510
521
|
return /*#__PURE__*/_react.default.createElement(_FormErrorBoundary.FormErrorBoundary, {
|
|
511
522
|
contextIdentifierProvider: contextIdentifierProvider,
|
|
512
523
|
extensionKey: extensionManifest.key,
|
|
@@ -6,17 +6,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.HelpLink = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _link = _interopRequireDefault(require("@atlaskit/link"));
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
11
|
var HelpLink = exports.HelpLink = function HelpLink(_ref) {
|
|
10
12
|
var documentationUrl = _ref.documentationUrl,
|
|
11
13
|
label = _ref.label;
|
|
12
|
-
return (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
return (0, _platformFeatureFlags.fg)('dst-a11y__replace-anchor-with-link__editor-core-ex') ? /*#__PURE__*/_react.default.createElement(_link.default, {
|
|
15
|
+
target: "_blank",
|
|
16
|
+
rel: "noopener noreferrer",
|
|
17
|
+
href: documentationUrl,
|
|
18
|
+
"data-testid": "config-panel-header-documentation-link"
|
|
19
|
+
}, label) :
|
|
20
|
+
/*#__PURE__*/
|
|
21
|
+
// eslint-disable-next-line @atlaskit/design-system/no-html-anchor
|
|
22
|
+
_react.default.createElement("a", {
|
|
23
|
+
target: "_blank",
|
|
24
|
+
rel: "noopener noreferrer",
|
|
25
|
+
href: documentationUrl,
|
|
26
|
+
"data-testid": "config-panel-header-documentation-link"
|
|
27
|
+
}, label);
|
|
22
28
|
};
|
|
@@ -16,6 +16,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
16
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
17
|
var _extensions = require("@atlaskit/editor-common/extensions");
|
|
18
18
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
19
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
19
20
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
20
21
|
var _commands = require("../editor-commands/commands");
|
|
21
22
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
@@ -28,35 +29,50 @@ var _contextPanel = require("./context-panel");
|
|
|
28
29
|
var _SaveIndicator = require("./SaveIndicator/SaveIndicator");
|
|
29
30
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
30
31
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
32
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
33
|
+
var showContextPanel = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'extension.showContextPanel');
|
|
34
|
+
var extensionProvider = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'extension.extensionProvider');
|
|
35
|
+
var processParametersAfter = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'extension.processParametersAfter');
|
|
36
|
+
return {
|
|
37
|
+
showContextPanel: showContextPanel,
|
|
38
|
+
extensionProvider: extensionProvider,
|
|
39
|
+
processParametersAfter: processParametersAfter
|
|
40
|
+
};
|
|
41
|
+
}, function (api) {
|
|
42
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['extension']),
|
|
43
|
+
extensionState = _useSharedPluginState.extensionState;
|
|
44
|
+
return {
|
|
45
|
+
showContextPanel: extensionState === null || extensionState === void 0 ? void 0 : extensionState.showContextPanel,
|
|
46
|
+
extensionProvider: extensionState === null || extensionState === void 0 ? void 0 : extensionState.extensionProvider,
|
|
47
|
+
processParametersAfter: extensionState === null || extensionState === void 0 ? void 0 : extensionState.processParametersAfter
|
|
48
|
+
};
|
|
49
|
+
});
|
|
31
50
|
function useConfigPanelPluginHook(_ref) {
|
|
32
51
|
var editorView = _ref.editorView,
|
|
33
52
|
api = _ref.api;
|
|
34
53
|
var editorState = editorView.state;
|
|
35
|
-
var
|
|
36
|
-
|
|
54
|
+
var _useSharedState = useSharedState(api),
|
|
55
|
+
showContextPanel = _useSharedState.showContextPanel,
|
|
56
|
+
extensionProvider = _useSharedState.extensionProvider,
|
|
57
|
+
processParametersAfter = _useSharedState.processParametersAfter;
|
|
37
58
|
(0, _react.useEffect)(function () {
|
|
38
59
|
var nodeWithPos = (0, _utils.getSelectedExtension)(editorState, true);
|
|
39
60
|
// Adding checks to bail out early
|
|
40
|
-
if (!nodeWithPos
|
|
61
|
+
if (!nodeWithPos) {
|
|
41
62
|
hideConfigPanel(api);
|
|
42
63
|
return;
|
|
43
64
|
}
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
nodeWithPos: nodeWithPos
|
|
54
|
-
});
|
|
55
|
-
} else {
|
|
56
|
-
hideConfigPanel(api);
|
|
57
|
-
}
|
|
65
|
+
if (showContextPanel && extensionProvider && processParametersAfter) {
|
|
66
|
+
showConfigPanel({
|
|
67
|
+
api: api,
|
|
68
|
+
editorView: editorView,
|
|
69
|
+
extensionProvider: extensionProvider,
|
|
70
|
+
nodeWithPos: nodeWithPos
|
|
71
|
+
});
|
|
72
|
+
} else {
|
|
73
|
+
hideConfigPanel(api);
|
|
58
74
|
}
|
|
59
|
-
}, [api, editorState, editorView,
|
|
75
|
+
}, [api, editorState, editorView, showContextPanel, extensionProvider, processParametersAfter]);
|
|
60
76
|
(0, _react.useEffect)(function () {
|
|
61
77
|
return function () {
|
|
62
78
|
hideConfigPanel(api);
|
|
@@ -217,6 +217,11 @@ const editButton = (formatMessage, extensionState, applyChangeToContextPanel, ed
|
|
|
217
217
|
|
|
218
218
|
/**
|
|
219
219
|
* Calculates the position for the toolbar when dealing with nested extensions
|
|
220
|
+
* @param editorView
|
|
221
|
+
* @param nextPos
|
|
222
|
+
* @param state
|
|
223
|
+
* @param extensionNode
|
|
224
|
+
* @example
|
|
220
225
|
*/
|
|
221
226
|
const calculateToolbarPosition = (editorView, nextPos, state, extensionNode) => {
|
|
222
227
|
const {
|
|
@@ -10,7 +10,8 @@ import ButtonGroup from '@atlaskit/button/button-group';
|
|
|
10
10
|
import Button from '@atlaskit/button/new';
|
|
11
11
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
12
12
|
import { isTabGroup, configPanelMessages as messages } from '@atlaskit/editor-common/extensions';
|
|
13
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
13
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
14
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
14
15
|
import Form, { FormFooter } from '@atlaskit/form';
|
|
15
16
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
17
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -425,6 +426,19 @@ class ConfigPanel extends React.Component {
|
|
|
425
426
|
});
|
|
426
427
|
}
|
|
427
428
|
}
|
|
429
|
+
const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
430
|
+
const contextIdentifierProvider = useSharedPluginStateSelector(api, 'contextIdentifier.contextIdentifierProvider');
|
|
431
|
+
return {
|
|
432
|
+
contextIdentifierProvider
|
|
433
|
+
};
|
|
434
|
+
}, api => {
|
|
435
|
+
const {
|
|
436
|
+
contextIdentifierState
|
|
437
|
+
} = useSharedPluginState(api, ['contextIdentifier']);
|
|
438
|
+
return {
|
|
439
|
+
contextIdentifierProvider: contextIdentifierState === null || contextIdentifierState === void 0 ? void 0 : contextIdentifierState.contextIdentifierProvider
|
|
440
|
+
};
|
|
441
|
+
});
|
|
428
442
|
function ConfigFormIntlWithBoundary({
|
|
429
443
|
api,
|
|
430
444
|
fields,
|
|
@@ -441,12 +455,9 @@ function ConfigFormIntlWithBoundary({
|
|
|
441
455
|
errorMessage,
|
|
442
456
|
disableFields
|
|
443
457
|
}) {
|
|
444
|
-
const {
|
|
445
|
-
contextIdentifierState
|
|
446
|
-
} = useSharedPluginState(api, ['contextIdentifier']);
|
|
447
458
|
const {
|
|
448
459
|
contextIdentifierProvider
|
|
449
|
-
} =
|
|
460
|
+
} = useSharedState(api);
|
|
450
461
|
return /*#__PURE__*/React.createElement(FormErrorBoundary, {
|
|
451
462
|
contextIdentifierProvider: contextIdentifierProvider,
|
|
452
463
|
extensionKey: extensionManifest.key,
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import Link from '@atlaskit/link';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
4
|
export const HelpLink = ({
|
|
3
5
|
documentationUrl,
|
|
4
6
|
label
|
|
5
7
|
}) => {
|
|
6
|
-
return (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
return fg('dst-a11y__replace-anchor-with-link__editor-core-ex') ? /*#__PURE__*/React.createElement(Link, {
|
|
9
|
+
target: "_blank",
|
|
10
|
+
rel: "noopener noreferrer",
|
|
11
|
+
href: documentationUrl,
|
|
12
|
+
"data-testid": "config-panel-header-documentation-link"
|
|
13
|
+
}, label) :
|
|
14
|
+
/*#__PURE__*/
|
|
15
|
+
// eslint-disable-next-line @atlaskit/design-system/no-html-anchor
|
|
16
|
+
React.createElement("a", {
|
|
17
|
+
target: "_blank",
|
|
18
|
+
rel: "noopener noreferrer",
|
|
19
|
+
href: documentationUrl,
|
|
20
|
+
"data-testid": "config-panel-header-documentation-link"
|
|
21
|
+
}, label);
|
|
16
22
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { getExtensionKeyAndNodeKey } from '@atlaskit/editor-common/extensions';
|
|
3
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
4
5
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
5
6
|
import { clearEditingContext, forceAutoSave } from '../editor-commands/commands';
|
|
6
7
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
@@ -11,39 +12,53 @@ import HeaderAfterIconElement from './ConfigPanel/Header/HeaderAfterIconElement'
|
|
|
11
12
|
import HeaderIcon from './ConfigPanel/Header/HeaderIcon';
|
|
12
13
|
import { onChangeAction } from './context-panel';
|
|
13
14
|
import { SaveIndicator } from './SaveIndicator/SaveIndicator';
|
|
15
|
+
const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
16
|
+
const showContextPanel = useSharedPluginStateSelector(api, 'extension.showContextPanel');
|
|
17
|
+
const extensionProvider = useSharedPluginStateSelector(api, 'extension.extensionProvider');
|
|
18
|
+
const processParametersAfter = useSharedPluginStateSelector(api, 'extension.processParametersAfter');
|
|
19
|
+
return {
|
|
20
|
+
showContextPanel,
|
|
21
|
+
extensionProvider,
|
|
22
|
+
processParametersAfter
|
|
23
|
+
};
|
|
24
|
+
}, api => {
|
|
25
|
+
const {
|
|
26
|
+
extensionState
|
|
27
|
+
} = useSharedPluginState(api, ['extension']);
|
|
28
|
+
return {
|
|
29
|
+
showContextPanel: extensionState === null || extensionState === void 0 ? void 0 : extensionState.showContextPanel,
|
|
30
|
+
extensionProvider: extensionState === null || extensionState === void 0 ? void 0 : extensionState.extensionProvider,
|
|
31
|
+
processParametersAfter: extensionState === null || extensionState === void 0 ? void 0 : extensionState.processParametersAfter
|
|
32
|
+
};
|
|
33
|
+
});
|
|
14
34
|
export function useConfigPanelPluginHook({
|
|
15
35
|
editorView,
|
|
16
36
|
api
|
|
17
37
|
}) {
|
|
18
38
|
const editorState = editorView.state;
|
|
19
39
|
const {
|
|
20
|
-
|
|
21
|
-
|
|
40
|
+
showContextPanel,
|
|
41
|
+
extensionProvider,
|
|
42
|
+
processParametersAfter
|
|
43
|
+
} = useSharedState(api);
|
|
22
44
|
useEffect(() => {
|
|
23
45
|
const nodeWithPos = getSelectedExtension(editorState, true);
|
|
24
46
|
// Adding checks to bail out early
|
|
25
|
-
if (!nodeWithPos
|
|
47
|
+
if (!nodeWithPos) {
|
|
26
48
|
hideConfigPanel(api);
|
|
27
49
|
return;
|
|
28
50
|
}
|
|
29
|
-
if (
|
|
30
|
-
|
|
31
|
-
|
|
51
|
+
if (showContextPanel && extensionProvider && processParametersAfter) {
|
|
52
|
+
showConfigPanel({
|
|
53
|
+
api,
|
|
54
|
+
editorView,
|
|
32
55
|
extensionProvider,
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
api,
|
|
38
|
-
editorView,
|
|
39
|
-
extensionProvider,
|
|
40
|
-
nodeWithPos
|
|
41
|
-
});
|
|
42
|
-
} else {
|
|
43
|
-
hideConfigPanel(api);
|
|
44
|
-
}
|
|
56
|
+
nodeWithPos
|
|
57
|
+
});
|
|
58
|
+
} else {
|
|
59
|
+
hideConfigPanel(api);
|
|
45
60
|
}
|
|
46
|
-
}, [api, editorState, editorView,
|
|
61
|
+
}, [api, editorState, editorView, showContextPanel, extensionProvider, processParametersAfter]);
|
|
47
62
|
useEffect(() => {
|
|
48
63
|
return () => {
|
|
49
64
|
hideConfigPanel(api);
|
|
@@ -215,6 +215,11 @@ var editButton = function editButton(formatMessage, extensionState, applyChangeT
|
|
|
215
215
|
|
|
216
216
|
/**
|
|
217
217
|
* Calculates the position for the toolbar when dealing with nested extensions
|
|
218
|
+
* @param editorView
|
|
219
|
+
* @param nextPos
|
|
220
|
+
* @param state
|
|
221
|
+
* @param extensionNode
|
|
222
|
+
* @example
|
|
218
223
|
*/
|
|
219
224
|
var calculateToolbarPosition = function calculateToolbarPosition(editorView, nextPos, state, extensionNode) {
|
|
220
225
|
var _editorView$state = editorView.state,
|
|
@@ -21,7 +21,8 @@ import ButtonGroup from '@atlaskit/button/button-group';
|
|
|
21
21
|
import Button from '@atlaskit/button/new';
|
|
22
22
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
23
23
|
import { isTabGroup, configPanelMessages as messages } from '@atlaskit/editor-common/extensions';
|
|
24
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
24
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
25
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
25
26
|
import Form, { FormFooter } from '@atlaskit/form';
|
|
26
27
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
27
28
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -478,6 +479,18 @@ var ConfigPanel = /*#__PURE__*/function (_React$Component) {
|
|
|
478
479
|
}
|
|
479
480
|
}]);
|
|
480
481
|
}(React.Component);
|
|
482
|
+
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
483
|
+
var contextIdentifierProvider = useSharedPluginStateSelector(api, 'contextIdentifier.contextIdentifierProvider');
|
|
484
|
+
return {
|
|
485
|
+
contextIdentifierProvider: contextIdentifierProvider
|
|
486
|
+
};
|
|
487
|
+
}, function (api) {
|
|
488
|
+
var _useSharedPluginState = useSharedPluginState(api, ['contextIdentifier']),
|
|
489
|
+
contextIdentifierState = _useSharedPluginState.contextIdentifierState;
|
|
490
|
+
return {
|
|
491
|
+
contextIdentifierProvider: contextIdentifierState === null || contextIdentifierState === void 0 ? void 0 : contextIdentifierState.contextIdentifierProvider
|
|
492
|
+
};
|
|
493
|
+
});
|
|
481
494
|
function ConfigFormIntlWithBoundary(_ref6) {
|
|
482
495
|
var api = _ref6.api,
|
|
483
496
|
fields = _ref6.fields,
|
|
@@ -493,10 +506,8 @@ function ConfigFormIntlWithBoundary(_ref6) {
|
|
|
493
506
|
firstVisibleFieldName = _ref6.firstVisibleFieldName,
|
|
494
507
|
errorMessage = _ref6.errorMessage,
|
|
495
508
|
disableFields = _ref6.disableFields;
|
|
496
|
-
var
|
|
497
|
-
|
|
498
|
-
var _ref7 = contextIdentifierState !== null && contextIdentifierState !== void 0 ? contextIdentifierState : {},
|
|
499
|
-
contextIdentifierProvider = _ref7.contextIdentifierProvider;
|
|
509
|
+
var _useSharedState = useSharedState(api),
|
|
510
|
+
contextIdentifierProvider = _useSharedState.contextIdentifierProvider;
|
|
500
511
|
return /*#__PURE__*/React.createElement(FormErrorBoundary, {
|
|
501
512
|
contextIdentifierProvider: contextIdentifierProvider,
|
|
502
513
|
extensionKey: extensionManifest.key,
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import Link from '@atlaskit/link';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
4
|
export var HelpLink = function HelpLink(_ref) {
|
|
3
5
|
var documentationUrl = _ref.documentationUrl,
|
|
4
6
|
label = _ref.label;
|
|
5
|
-
return (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
return fg('dst-a11y__replace-anchor-with-link__editor-core-ex') ? /*#__PURE__*/React.createElement(Link, {
|
|
8
|
+
target: "_blank",
|
|
9
|
+
rel: "noopener noreferrer",
|
|
10
|
+
href: documentationUrl,
|
|
11
|
+
"data-testid": "config-panel-header-documentation-link"
|
|
12
|
+
}, label) :
|
|
13
|
+
/*#__PURE__*/
|
|
14
|
+
// eslint-disable-next-line @atlaskit/design-system/no-html-anchor
|
|
15
|
+
React.createElement("a", {
|
|
16
|
+
target: "_blank",
|
|
17
|
+
rel: "noopener noreferrer",
|
|
18
|
+
href: documentationUrl,
|
|
19
|
+
"data-testid": "config-panel-header-documentation-link"
|
|
20
|
+
}, label);
|
|
15
21
|
};
|
|
@@ -3,7 +3,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
import React, { useEffect } from 'react';
|
|
5
5
|
import { getExtensionKeyAndNodeKey } from '@atlaskit/editor-common/extensions';
|
|
6
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
6
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
7
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
7
8
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
8
9
|
import { clearEditingContext, forceAutoSave } from '../editor-commands/commands';
|
|
9
10
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
@@ -14,35 +15,50 @@ import HeaderAfterIconElement from './ConfigPanel/Header/HeaderAfterIconElement'
|
|
|
14
15
|
import HeaderIcon from './ConfigPanel/Header/HeaderIcon';
|
|
15
16
|
import { onChangeAction } from './context-panel';
|
|
16
17
|
import { SaveIndicator } from './SaveIndicator/SaveIndicator';
|
|
18
|
+
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
19
|
+
var showContextPanel = useSharedPluginStateSelector(api, 'extension.showContextPanel');
|
|
20
|
+
var extensionProvider = useSharedPluginStateSelector(api, 'extension.extensionProvider');
|
|
21
|
+
var processParametersAfter = useSharedPluginStateSelector(api, 'extension.processParametersAfter');
|
|
22
|
+
return {
|
|
23
|
+
showContextPanel: showContextPanel,
|
|
24
|
+
extensionProvider: extensionProvider,
|
|
25
|
+
processParametersAfter: processParametersAfter
|
|
26
|
+
};
|
|
27
|
+
}, function (api) {
|
|
28
|
+
var _useSharedPluginState = useSharedPluginState(api, ['extension']),
|
|
29
|
+
extensionState = _useSharedPluginState.extensionState;
|
|
30
|
+
return {
|
|
31
|
+
showContextPanel: extensionState === null || extensionState === void 0 ? void 0 : extensionState.showContextPanel,
|
|
32
|
+
extensionProvider: extensionState === null || extensionState === void 0 ? void 0 : extensionState.extensionProvider,
|
|
33
|
+
processParametersAfter: extensionState === null || extensionState === void 0 ? void 0 : extensionState.processParametersAfter
|
|
34
|
+
};
|
|
35
|
+
});
|
|
17
36
|
export function useConfigPanelPluginHook(_ref) {
|
|
18
37
|
var editorView = _ref.editorView,
|
|
19
38
|
api = _ref.api;
|
|
20
39
|
var editorState = editorView.state;
|
|
21
|
-
var
|
|
22
|
-
|
|
40
|
+
var _useSharedState = useSharedState(api),
|
|
41
|
+
showContextPanel = _useSharedState.showContextPanel,
|
|
42
|
+
extensionProvider = _useSharedState.extensionProvider,
|
|
43
|
+
processParametersAfter = _useSharedState.processParametersAfter;
|
|
23
44
|
useEffect(function () {
|
|
24
45
|
var nodeWithPos = getSelectedExtension(editorState, true);
|
|
25
46
|
// Adding checks to bail out early
|
|
26
|
-
if (!nodeWithPos
|
|
47
|
+
if (!nodeWithPos) {
|
|
27
48
|
hideConfigPanel(api);
|
|
28
49
|
return;
|
|
29
50
|
}
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
nodeWithPos: nodeWithPos
|
|
40
|
-
});
|
|
41
|
-
} else {
|
|
42
|
-
hideConfigPanel(api);
|
|
43
|
-
}
|
|
51
|
+
if (showContextPanel && extensionProvider && processParametersAfter) {
|
|
52
|
+
showConfigPanel({
|
|
53
|
+
api: api,
|
|
54
|
+
editorView: editorView,
|
|
55
|
+
extensionProvider: extensionProvider,
|
|
56
|
+
nodeWithPos: nodeWithPos
|
|
57
|
+
});
|
|
58
|
+
} else {
|
|
59
|
+
hideConfigPanel(api);
|
|
44
60
|
}
|
|
45
|
-
}, [api, editorState, editorView,
|
|
61
|
+
}, [api, editorState, editorView, showContextPanel, extensionProvider, processParametersAfter]);
|
|
46
62
|
useEffect(function () {
|
|
47
63
|
return function () {
|
|
48
64
|
hideConfigPanel(api);
|
|
@@ -4,7 +4,7 @@ import type { ExtensionAPI, ExtensionHandlers, ExtensionProvider, Parameters, Tr
|
|
|
4
4
|
import type { MacroProvider } from '@atlaskit/editor-common/provider-factory';
|
|
5
5
|
import type { EditorAppearance, LongPressSelectionPluginOptions, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
6
6
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
7
|
-
import { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
|
|
7
|
+
import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
|
|
8
8
|
import type { ContextIdentifierPlugin } from '@atlaskit/editor-plugin-context-identifier';
|
|
9
9
|
import type { ApplyChangeHandler, ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
|
|
10
10
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FloatingToolbarHandler, PublicPluginAPI } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
-
import { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
|
|
3
|
+
import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
|
|
4
4
|
import type { ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
|
|
5
5
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
6
6
|
interface GetToolbarConfigProps {
|
|
@@ -4,7 +4,7 @@ import type { ExtensionAPI, ExtensionHandlers, ExtensionProvider, Parameters, Tr
|
|
|
4
4
|
import type { MacroProvider } from '@atlaskit/editor-common/provider-factory';
|
|
5
5
|
import type { EditorAppearance, LongPressSelectionPluginOptions, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
6
6
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
7
|
-
import { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
|
|
7
|
+
import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
|
|
8
8
|
import type { ContextIdentifierPlugin } from '@atlaskit/editor-plugin-context-identifier';
|
|
9
9
|
import type { ApplyChangeHandler, ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
|
|
10
10
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FloatingToolbarHandler, PublicPluginAPI } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
-
import { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
|
|
3
|
+
import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
|
|
4
4
|
import type { ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
|
|
5
5
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
6
6
|
interface GetToolbarConfigProps {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-extension",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"description": "editor-plugin-extension plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
29
29
|
"@atlaskit/adf-utils": "^19.19.0",
|
|
30
30
|
"@atlaskit/analytics-next": "^11.0.0",
|
|
31
|
-
"@atlaskit/avatar": "^25.
|
|
32
|
-
"@atlaskit/button": "^23.
|
|
31
|
+
"@atlaskit/avatar": "^25.1.0",
|
|
32
|
+
"@atlaskit/button": "^23.2.0",
|
|
33
33
|
"@atlaskit/checkbox": "^17.1.0",
|
|
34
34
|
"@atlaskit/datetime-picker": "^17.0.0",
|
|
35
|
-
"@atlaskit/editor-common": "^105.
|
|
35
|
+
"@atlaskit/editor-common": "^105.6.0",
|
|
36
36
|
"@atlaskit/editor-json-transformer": "^8.24.0",
|
|
37
|
-
"@atlaskit/editor-plugin-analytics": "^2.
|
|
37
|
+
"@atlaskit/editor-plugin-analytics": "^2.3.0",
|
|
38
38
|
"@atlaskit/editor-plugin-connectivity": "^2.0.0",
|
|
39
39
|
"@atlaskit/editor-plugin-context-identifier": "^2.1.0",
|
|
40
40
|
"@atlaskit/editor-plugin-context-panel": "^4.1.0",
|
|
@@ -47,21 +47,22 @@
|
|
|
47
47
|
"@atlaskit/empty-state": "^10.0.0",
|
|
48
48
|
"@atlaskit/form": "^12.0.0",
|
|
49
49
|
"@atlaskit/heading": "^5.2.0",
|
|
50
|
-
"@atlaskit/icon": "^26.
|
|
50
|
+
"@atlaskit/icon": "^26.1.0",
|
|
51
|
+
"@atlaskit/link": "^3.2.0",
|
|
51
52
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
52
|
-
"@atlaskit/primitives": "^14.
|
|
53
|
+
"@atlaskit/primitives": "^14.8.0",
|
|
53
54
|
"@atlaskit/radio": "^8.1.0",
|
|
54
55
|
"@atlaskit/section-message": "^8.2.0",
|
|
55
|
-
"@atlaskit/select": "^20.
|
|
56
|
+
"@atlaskit/select": "^20.6.0",
|
|
56
57
|
"@atlaskit/smart-user-picker": "^8.0.0",
|
|
57
58
|
"@atlaskit/spinner": "^18.0.0",
|
|
58
|
-
"@atlaskit/tabs": "^18.
|
|
59
|
+
"@atlaskit/tabs": "^18.1.0",
|
|
59
60
|
"@atlaskit/textarea": "^8.0.0",
|
|
60
61
|
"@atlaskit/textfield": "^8.0.0",
|
|
61
62
|
"@atlaskit/theme": "^18.0.0",
|
|
62
|
-
"@atlaskit/tmp-editor-statsig": "^4.
|
|
63
|
+
"@atlaskit/tmp-editor-statsig": "^4.22.0",
|
|
63
64
|
"@atlaskit/toggle": "^15.0.0",
|
|
64
|
-
"@atlaskit/tokens": "^4.
|
|
65
|
+
"@atlaskit/tokens": "^4.9.0",
|
|
65
66
|
"@atlaskit/tooltip": "^20.0.0",
|
|
66
67
|
"@babel/runtime": "^7.0.0",
|
|
67
68
|
"@emotion/react": "^11.7.1",
|
|
@@ -130,6 +131,9 @@
|
|
|
130
131
|
},
|
|
131
132
|
"platform_editor_controls_patch_8": {
|
|
132
133
|
"type": "boolean"
|
|
134
|
+
},
|
|
135
|
+
"dst-a11y__replace-anchor-with-link__editor-core-ex": {
|
|
136
|
+
"type": "boolean"
|
|
133
137
|
}
|
|
134
138
|
},
|
|
135
139
|
"stricter": {
|