@atlaskit/editor-core 191.6.1 → 191.7.2
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/composable-editor/editor-internal.js +4 -0
- package/dist/cjs/composable-editor/hooks/useProviders.js +57 -0
- package/dist/cjs/presets/default.js +4 -1
- package/dist/cjs/ui/ToolbarFeedback/index.js +6 -7
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/composable-editor/editor-internal.js +4 -0
- package/dist/es2019/composable-editor/hooks/useProviders.js +28 -0
- package/dist/es2019/presets/default.js +4 -1
- package/dist/es2019/ui/ToolbarFeedback/index.js +2 -3
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/composable-editor/editor-internal.js +4 -0
- package/dist/esm/composable-editor/hooks/useProviders.js +50 -0
- package/dist/esm/presets/default.js +4 -1
- package/dist/esm/ui/ToolbarFeedback/index.js +6 -7
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/composable-editor/hooks/useProviders.d.ts +14 -0
- package/dist/types/create-editor/create-preset.d.ts +155 -23
- package/dist/types/presets/default.d.ts +146 -36
- package/dist/types/presets/universal.d.ts +155 -23
- package/dist/types/presets/useUniversalPreset.d.ts +155 -23
- package/dist/types-ts4.5/composable-editor/hooks/useProviders.d.ts +14 -0
- package/dist/types-ts4.5/create-editor/create-preset.d.ts +171 -16
- package/dist/types-ts4.5/presets/default.d.ts +158 -28
- package/dist/types-ts4.5/presets/universal.d.ts +171 -16
- package/dist/types-ts4.5/presets/useUniversalPreset.d.ts +171 -16
- package/package.json +18 -22
- package/tsconfig.json +9 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 191.7.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#68372](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68372) [`17f42e77e826`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/17f42e77e826) - add allowMediaInlineImage media option to support new media inline image feature
|
|
8
|
+
- [#70084](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/70084) [`4d651eb93ab5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4d651eb93ab5) - Add editor-plugin-annotation pr and create shared utils for it in editor-test-helpers
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 191.7.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#68640](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68640) [`6a3ea210641a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6a3ea210641a) - Create new context identifier plugin which contains the provider.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 191.6.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -20,6 +20,7 @@ var _contextAdapter = require("../nodeviews/context-adapter");
|
|
|
20
20
|
var _context = require("../presets/context");
|
|
21
21
|
var _EditorContext = _interopRequireDefault(require("../ui/EditorContext"));
|
|
22
22
|
var _RenderTracking = require("../utils/performance/components/RenderTracking");
|
|
23
|
+
var _useProviders = require("./hooks/useProviders");
|
|
23
24
|
var _getBaseFontSize = require("./utils/getBaseFontSize");
|
|
24
25
|
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; }
|
|
25
26
|
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; } /** @jsx jsx */
|
|
@@ -161,6 +162,9 @@ function ReactEditorViewContextWrapper(props) {
|
|
|
161
162
|
setInternalEditorAPI === null || setInternalEditorAPI === void 0 || setInternalEditorAPI(api);
|
|
162
163
|
setExternalEditorAPI === null || setExternalEditorAPI === void 0 || setExternalEditorAPI(api);
|
|
163
164
|
}, [setInternalEditorAPI, setExternalEditorAPI]);
|
|
165
|
+
(0, _useProviders.useProviders)({
|
|
166
|
+
contextIdentifierProvider: props.editorProps.contextIdentifierProvider
|
|
167
|
+
});
|
|
164
168
|
return (0, _react2.jsx)(_ReactEditorView.default, (0, _extends2.default)({}, props, {
|
|
165
169
|
setEditorApi: setEditorAPI
|
|
166
170
|
}));
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useProviders = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
var _context2 = require("../../presets/context");
|
|
12
|
+
/**
|
|
13
|
+
* This hook is used to replace the old approach of using the `providerFactory`.
|
|
14
|
+
*
|
|
15
|
+
* Because plugins can't update their initial configuration, this hook listens to changes
|
|
16
|
+
* and calls a command to push the update to the plugins shared state.
|
|
17
|
+
*
|
|
18
|
+
* In the future ideally consumers implement this behaviour themselves.
|
|
19
|
+
*/
|
|
20
|
+
var useProviders = exports.useProviders = function useProviders(_ref) {
|
|
21
|
+
var contextIdentifierProvider = _ref.contextIdentifierProvider;
|
|
22
|
+
var editorApi = (0, _context2.usePresetContext)();
|
|
23
|
+
(0, _react.useEffect)(function () {
|
|
24
|
+
function setProvider() {
|
|
25
|
+
return _setProvider.apply(this, arguments);
|
|
26
|
+
}
|
|
27
|
+
function _setProvider() {
|
|
28
|
+
_setProvider = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
29
|
+
var _editorApi$core, _editorApi$contextIde;
|
|
30
|
+
var provider;
|
|
31
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
32
|
+
while (1) switch (_context.prev = _context.next) {
|
|
33
|
+
case 0:
|
|
34
|
+
if (contextIdentifierProvider) {
|
|
35
|
+
_context.next = 2;
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
return _context.abrupt("return");
|
|
39
|
+
case 2:
|
|
40
|
+
_context.next = 4;
|
|
41
|
+
return contextIdentifierProvider;
|
|
42
|
+
case 4:
|
|
43
|
+
provider = _context.sent;
|
|
44
|
+
editorApi === null || editorApi === void 0 || (_editorApi$core = editorApi.core) === null || _editorApi$core === void 0 || _editorApi$core.actions.execute(editorApi === null || editorApi === void 0 || (_editorApi$contextIde = editorApi.contextIdentifier) === null || _editorApi$contextIde === void 0 ? void 0 : _editorApi$contextIde.commands.setProvider({
|
|
45
|
+
contextIdentifierProvider: provider
|
|
46
|
+
}));
|
|
47
|
+
case 6:
|
|
48
|
+
case "end":
|
|
49
|
+
return _context.stop();
|
|
50
|
+
}
|
|
51
|
+
}, _callee);
|
|
52
|
+
}));
|
|
53
|
+
return _setProvider.apply(this, arguments);
|
|
54
|
+
}
|
|
55
|
+
setProvider();
|
|
56
|
+
}, [contextIdentifierProvider, editorApi]);
|
|
57
|
+
};
|
|
@@ -15,6 +15,7 @@ var _clearMarksOnEmptyDoc = require("@atlaskit/editor-plugins/clear-marks-on-emp
|
|
|
15
15
|
var _clipboard = require("@atlaskit/editor-plugins/clipboard");
|
|
16
16
|
var _codeBlock = require("@atlaskit/editor-plugins/code-block");
|
|
17
17
|
var _composition = require("@atlaskit/editor-plugins/composition");
|
|
18
|
+
var _contextIdentifier = require("@atlaskit/editor-plugins/context-identifier");
|
|
18
19
|
var _copyButton = require("@atlaskit/editor-plugins/copy-button");
|
|
19
20
|
var _decorations = require("@atlaskit/editor-plugins/decorations");
|
|
20
21
|
var _editorDisabled = require("@atlaskit/editor-plugins/editor-disabled");
|
|
@@ -49,7 +50,9 @@ function createDefaultPreset(options) {
|
|
|
49
50
|
var preset = new _preset.EditorPresetBuilder().add([_featureFlags.featureFlagsPlugin, options.featureFlags || {}]).maybeAdd([_analytics.analyticsPlugin, {
|
|
50
51
|
createAnalyticsEvent: options.createAnalyticsEvent,
|
|
51
52
|
performanceTracking: options.performanceTracking
|
|
52
|
-
}], Boolean(options.allowAnalyticsGASV3)).add(_betterTypeHistory.betterTypeHistoryPlugin).add([_paste.pastePlugin, options.paste]).add(_clipboard.clipboardPlugin).add(_focus.focusPlugin).add(_composition.compositionPlugin).add([
|
|
53
|
+
}], Boolean(options.allowAnalyticsGASV3)).add(_betterTypeHistory.betterTypeHistoryPlugin).add([_paste.pastePlugin, options.paste]).add(_clipboard.clipboardPlugin).add(_focus.focusPlugin).add(_composition.compositionPlugin).add([_contextIdentifier.contextIdentifierPlugin, {
|
|
54
|
+
contextIdentifierProvider: options.contextIdentifierProvider
|
|
55
|
+
}]).add([_base.basePlugin, options.base]).add(_decorations.decorationsPlugin).add([_typeAhead.typeAheadPlugin, options.typeAhead || {
|
|
53
56
|
createAnalyticsEvent: options.createAnalyticsEvent
|
|
54
57
|
}]).maybeAdd(_history.historyPlugin, Boolean(isMobile || options.allowUndoRedoButtons)).maybeAdd(_undoRedo.undoRedoPlugin, Boolean((_options$featureFlags = options.featureFlags) === null || _options$featureFlags === void 0 ? void 0 : _options$featureFlags.undoRedoButtons)).add([_blockType.blockTypePlugin, options.blockType]).add(_clearMarksOnEmptyDoc.clearMarksOnEmptyDocPlugin).maybeAdd([_annotation.annotationPlugin, options.annotationProviders], Boolean(options.annotationProviders)).maybeAdd([_selectionToolbar.selectionToolbarPlugin, {
|
|
55
58
|
preferenceToolbarAboveSelection: false
|
|
@@ -102,8 +102,8 @@ var ToolbarFeedbackInternal = /*#__PURE__*/function (_PureComponent) {
|
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
104
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "openJiraIssueCollector", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
105
|
-
var _this$props$api, _window$localStorage$,
|
|
106
|
-
var
|
|
105
|
+
var _this$props$api, _window$localStorage$, _this$props$api2;
|
|
106
|
+
var contentId, sessionId, tabId;
|
|
107
107
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
108
108
|
while (1) switch (_context.prev = _context.next) {
|
|
109
109
|
case 0:
|
|
@@ -111,21 +111,20 @@ var ToolbarFeedbackInternal = /*#__PURE__*/function (_PureComponent) {
|
|
|
111
111
|
jiraIssueCollectorScriptLoading: true,
|
|
112
112
|
showOptOutOption: false
|
|
113
113
|
});
|
|
114
|
-
|
|
114
|
+
contentId = (_this$props$api = _this.props.api) === null || _this$props$api === void 0 || (_this$props$api = _this$props$api.contextIdentifier) === null || _this$props$api === void 0 || (_this$props$api = _this$props$api.sharedState.currentState()) === null || _this$props$api === void 0 || (_this$props$api = _this$props$api.contextIdentifierProvider) === null || _this$props$api === void 0 ? void 0 : _this$props$api.objectId;
|
|
115
115
|
sessionId = (_window$localStorage$ = window.localStorage.getItem('awc.session.id')) === null || _window$localStorage$ === void 0 ? void 0 : _window$localStorage$.toString();
|
|
116
|
-
contentId = basePluginState === null || basePluginState === void 0 || (_basePluginState$cont = basePluginState.contextIdentifier) === null || _basePluginState$cont === void 0 ? void 0 : _basePluginState$cont.objectId;
|
|
117
116
|
tabId = window.sessionStorage['awc.tab.id'];
|
|
118
|
-
_context.next =
|
|
117
|
+
_context.next = 6;
|
|
119
118
|
return (_this$props$api2 = _this.props.api) === null || _this$props$api2 === void 0 || (_this$props$api2 = _this$props$api2.feedbackDialog) === null || _this$props$api2 === void 0 ? void 0 : _this$props$api2.actions.openFeedbackDialog(_objectSpread(_objectSpread({}, _this.getFeedbackInfo()), {}, {
|
|
120
119
|
sessionId: sessionId,
|
|
121
120
|
contentId: contentId,
|
|
122
121
|
tabId: tabId
|
|
123
122
|
}));
|
|
124
|
-
case
|
|
123
|
+
case 6:
|
|
125
124
|
_this.setState({
|
|
126
125
|
jiraIssueCollectorScriptLoading: false
|
|
127
126
|
});
|
|
128
|
-
case
|
|
127
|
+
case 7:
|
|
129
128
|
case "end":
|
|
130
129
|
return _context.stop();
|
|
131
130
|
}
|
|
@@ -13,6 +13,7 @@ import { ContextAdapter } from '../nodeviews/context-adapter';
|
|
|
13
13
|
import { useSetPresetContext } from '../presets/context';
|
|
14
14
|
import EditorContext from '../ui/EditorContext';
|
|
15
15
|
import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
16
|
+
import { useProviders } from './hooks/useProviders';
|
|
16
17
|
import { getBaseFontSize } from './utils/getBaseFontSize';
|
|
17
18
|
/**
|
|
18
19
|
* EditorInternalComponent is used to capture the common component
|
|
@@ -155,6 +156,9 @@ function ReactEditorViewContextWrapper(props) {
|
|
|
155
156
|
setInternalEditorAPI === null || setInternalEditorAPI === void 0 ? void 0 : setInternalEditorAPI(api);
|
|
156
157
|
setExternalEditorAPI === null || setExternalEditorAPI === void 0 ? void 0 : setExternalEditorAPI(api);
|
|
157
158
|
}, [setInternalEditorAPI, setExternalEditorAPI]);
|
|
159
|
+
useProviders({
|
|
160
|
+
contextIdentifierProvider: props.editorProps.contextIdentifierProvider
|
|
161
|
+
});
|
|
158
162
|
return jsx(ReactEditorView, _extends({}, props, {
|
|
159
163
|
setEditorApi: setEditorAPI
|
|
160
164
|
}));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { usePresetContext } from '../../presets/context';
|
|
3
|
+
/**
|
|
4
|
+
* This hook is used to replace the old approach of using the `providerFactory`.
|
|
5
|
+
*
|
|
6
|
+
* Because plugins can't update their initial configuration, this hook listens to changes
|
|
7
|
+
* and calls a command to push the update to the plugins shared state.
|
|
8
|
+
*
|
|
9
|
+
* In the future ideally consumers implement this behaviour themselves.
|
|
10
|
+
*/
|
|
11
|
+
export const useProviders = ({
|
|
12
|
+
contextIdentifierProvider
|
|
13
|
+
}) => {
|
|
14
|
+
const editorApi = usePresetContext();
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
async function setProvider() {
|
|
17
|
+
var _editorApi$core, _editorApi$contextIde;
|
|
18
|
+
if (!contextIdentifierProvider) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const provider = await contextIdentifierProvider;
|
|
22
|
+
editorApi === null || editorApi === void 0 ? void 0 : (_editorApi$core = editorApi.core) === null || _editorApi$core === void 0 ? void 0 : _editorApi$core.actions.execute(editorApi === null || editorApi === void 0 ? void 0 : (_editorApi$contextIde = editorApi.contextIdentifier) === null || _editorApi$contextIde === void 0 ? void 0 : _editorApi$contextIde.commands.setProvider({
|
|
23
|
+
contextIdentifierProvider: provider
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
setProvider();
|
|
27
|
+
}, [contextIdentifierProvider, editorApi]);
|
|
28
|
+
};
|
|
@@ -10,6 +10,7 @@ import { clearMarksOnEmptyDocPlugin } from '@atlaskit/editor-plugins/clear-marks
|
|
|
10
10
|
import { clipboardPlugin } from '@atlaskit/editor-plugins/clipboard';
|
|
11
11
|
import { codeBlockPlugin } from '@atlaskit/editor-plugins/code-block';
|
|
12
12
|
import { compositionPlugin } from '@atlaskit/editor-plugins/composition';
|
|
13
|
+
import { contextIdentifierPlugin } from '@atlaskit/editor-plugins/context-identifier';
|
|
13
14
|
import { copyButtonPlugin } from '@atlaskit/editor-plugins/copy-button';
|
|
14
15
|
import { decorationsPlugin } from '@atlaskit/editor-plugins/decorations';
|
|
15
16
|
import { editorDisabledPlugin } from '@atlaskit/editor-plugins/editor-disabled';
|
|
@@ -43,7 +44,9 @@ export function createDefaultPreset(options) {
|
|
|
43
44
|
const preset = new EditorPresetBuilder().add([featureFlagsPlugin, options.featureFlags || {}]).maybeAdd([analyticsPlugin, {
|
|
44
45
|
createAnalyticsEvent: options.createAnalyticsEvent,
|
|
45
46
|
performanceTracking: options.performanceTracking
|
|
46
|
-
}], Boolean(options.allowAnalyticsGASV3)).add(betterTypeHistoryPlugin).add([pastePlugin, options.paste]).add(clipboardPlugin).add(focusPlugin).add(compositionPlugin).add([
|
|
47
|
+
}], Boolean(options.allowAnalyticsGASV3)).add(betterTypeHistoryPlugin).add([pastePlugin, options.paste]).add(clipboardPlugin).add(focusPlugin).add(compositionPlugin).add([contextIdentifierPlugin, {
|
|
48
|
+
contextIdentifierProvider: options.contextIdentifierProvider
|
|
49
|
+
}]).add([basePlugin, options.base]).add(decorationsPlugin).add([typeAheadPlugin, options.typeAhead || {
|
|
47
50
|
createAnalyticsEvent: options.createAnalyticsEvent
|
|
48
51
|
}]).maybeAdd(historyPlugin, Boolean(isMobile || options.allowUndoRedoButtons)).maybeAdd(undoRedoPlugin, Boolean((_options$featureFlags = options.featureFlags) === null || _options$featureFlags === void 0 ? void 0 : _options$featureFlags.undoRedoButtons)).add([blockTypePlugin, options.blockType]).add(clearMarksOnEmptyDocPlugin).maybeAdd([annotationPlugin, options.annotationProviders], Boolean(options.annotationProviders)).maybeAdd([selectionToolbarPlugin, {
|
|
49
52
|
preferenceToolbarAboveSelection: false
|
|
@@ -86,14 +86,13 @@ class ToolbarFeedbackInternal extends PureComponent {
|
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
88
|
_defineProperty(this, "openJiraIssueCollector", async () => {
|
|
89
|
-
var _this$props$api, _this$props$api$
|
|
89
|
+
var _this$props$api, _this$props$api$conte, _this$props$api$conte2, _this$props$api$conte3, _window$localStorage$, _this$props$api2, _this$props$api2$feed;
|
|
90
90
|
this.setState({
|
|
91
91
|
jiraIssueCollectorScriptLoading: true,
|
|
92
92
|
showOptOutOption: false
|
|
93
93
|
});
|
|
94
|
-
const
|
|
94
|
+
const contentId = (_this$props$api = this.props.api) === null || _this$props$api === void 0 ? void 0 : (_this$props$api$conte = _this$props$api.contextIdentifier) === null || _this$props$api$conte === void 0 ? void 0 : (_this$props$api$conte2 = _this$props$api$conte.sharedState.currentState()) === null || _this$props$api$conte2 === void 0 ? void 0 : (_this$props$api$conte3 = _this$props$api$conte2.contextIdentifierProvider) === null || _this$props$api$conte3 === void 0 ? void 0 : _this$props$api$conte3.objectId;
|
|
95
95
|
const sessionId = (_window$localStorage$ = window.localStorage.getItem('awc.session.id')) === null || _window$localStorage$ === void 0 ? void 0 : _window$localStorage$.toString();
|
|
96
|
-
const contentId = basePluginState === null || basePluginState === void 0 ? void 0 : (_basePluginState$cont = basePluginState.contextIdentifier) === null || _basePluginState$cont === void 0 ? void 0 : _basePluginState$cont.objectId;
|
|
97
96
|
const tabId = window.sessionStorage['awc.tab.id'];
|
|
98
97
|
await ((_this$props$api2 = this.props.api) === null || _this$props$api2 === void 0 ? void 0 : (_this$props$api2$feed = _this$props$api2.feedbackDialog) === null || _this$props$api2$feed === void 0 ? void 0 : _this$props$api2$feed.actions.openFeedbackDialog({
|
|
99
98
|
...this.getFeedbackInfo(),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "191.
|
|
2
|
+
export const version = "191.7.2";
|
|
@@ -16,6 +16,7 @@ import { ContextAdapter } from '../nodeviews/context-adapter';
|
|
|
16
16
|
import { useSetPresetContext } from '../presets/context';
|
|
17
17
|
import EditorContext from '../ui/EditorContext';
|
|
18
18
|
import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
19
|
+
import { useProviders } from './hooks/useProviders';
|
|
19
20
|
import { getBaseFontSize } from './utils/getBaseFontSize';
|
|
20
21
|
/**
|
|
21
22
|
* EditorInternalComponent is used to capture the common component
|
|
@@ -155,6 +156,9 @@ function ReactEditorViewContextWrapper(props) {
|
|
|
155
156
|
setInternalEditorAPI === null || setInternalEditorAPI === void 0 || setInternalEditorAPI(api);
|
|
156
157
|
setExternalEditorAPI === null || setExternalEditorAPI === void 0 || setExternalEditorAPI(api);
|
|
157
158
|
}, [setInternalEditorAPI, setExternalEditorAPI]);
|
|
159
|
+
useProviders({
|
|
160
|
+
contextIdentifierProvider: props.editorProps.contextIdentifierProvider
|
|
161
|
+
});
|
|
158
162
|
return jsx(ReactEditorView, _extends({}, props, {
|
|
159
163
|
setEditorApi: setEditorAPI
|
|
160
164
|
}));
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { usePresetContext } from '../../presets/context';
|
|
5
|
+
/**
|
|
6
|
+
* This hook is used to replace the old approach of using the `providerFactory`.
|
|
7
|
+
*
|
|
8
|
+
* Because plugins can't update their initial configuration, this hook listens to changes
|
|
9
|
+
* and calls a command to push the update to the plugins shared state.
|
|
10
|
+
*
|
|
11
|
+
* In the future ideally consumers implement this behaviour themselves.
|
|
12
|
+
*/
|
|
13
|
+
export var useProviders = function useProviders(_ref) {
|
|
14
|
+
var contextIdentifierProvider = _ref.contextIdentifierProvider;
|
|
15
|
+
var editorApi = usePresetContext();
|
|
16
|
+
useEffect(function () {
|
|
17
|
+
function setProvider() {
|
|
18
|
+
return _setProvider.apply(this, arguments);
|
|
19
|
+
}
|
|
20
|
+
function _setProvider() {
|
|
21
|
+
_setProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
22
|
+
var _editorApi$core, _editorApi$contextIde;
|
|
23
|
+
var provider;
|
|
24
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
25
|
+
while (1) switch (_context.prev = _context.next) {
|
|
26
|
+
case 0:
|
|
27
|
+
if (contextIdentifierProvider) {
|
|
28
|
+
_context.next = 2;
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
return _context.abrupt("return");
|
|
32
|
+
case 2:
|
|
33
|
+
_context.next = 4;
|
|
34
|
+
return contextIdentifierProvider;
|
|
35
|
+
case 4:
|
|
36
|
+
provider = _context.sent;
|
|
37
|
+
editorApi === null || editorApi === void 0 || (_editorApi$core = editorApi.core) === null || _editorApi$core === void 0 || _editorApi$core.actions.execute(editorApi === null || editorApi === void 0 || (_editorApi$contextIde = editorApi.contextIdentifier) === null || _editorApi$contextIde === void 0 ? void 0 : _editorApi$contextIde.commands.setProvider({
|
|
38
|
+
contextIdentifierProvider: provider
|
|
39
|
+
}));
|
|
40
|
+
case 6:
|
|
41
|
+
case "end":
|
|
42
|
+
return _context.stop();
|
|
43
|
+
}
|
|
44
|
+
}, _callee);
|
|
45
|
+
}));
|
|
46
|
+
return _setProvider.apply(this, arguments);
|
|
47
|
+
}
|
|
48
|
+
setProvider();
|
|
49
|
+
}, [contextIdentifierProvider, editorApi]);
|
|
50
|
+
};
|
|
@@ -10,6 +10,7 @@ import { clearMarksOnEmptyDocPlugin } from '@atlaskit/editor-plugins/clear-marks
|
|
|
10
10
|
import { clipboardPlugin } from '@atlaskit/editor-plugins/clipboard';
|
|
11
11
|
import { codeBlockPlugin } from '@atlaskit/editor-plugins/code-block';
|
|
12
12
|
import { compositionPlugin } from '@atlaskit/editor-plugins/composition';
|
|
13
|
+
import { contextIdentifierPlugin } from '@atlaskit/editor-plugins/context-identifier';
|
|
13
14
|
import { copyButtonPlugin } from '@atlaskit/editor-plugins/copy-button';
|
|
14
15
|
import { decorationsPlugin } from '@atlaskit/editor-plugins/decorations';
|
|
15
16
|
import { editorDisabledPlugin } from '@atlaskit/editor-plugins/editor-disabled';
|
|
@@ -43,7 +44,9 @@ export function createDefaultPreset(options) {
|
|
|
43
44
|
var preset = new EditorPresetBuilder().add([featureFlagsPlugin, options.featureFlags || {}]).maybeAdd([analyticsPlugin, {
|
|
44
45
|
createAnalyticsEvent: options.createAnalyticsEvent,
|
|
45
46
|
performanceTracking: options.performanceTracking
|
|
46
|
-
}], Boolean(options.allowAnalyticsGASV3)).add(betterTypeHistoryPlugin).add([pastePlugin, options.paste]).add(clipboardPlugin).add(focusPlugin).add(compositionPlugin).add([
|
|
47
|
+
}], Boolean(options.allowAnalyticsGASV3)).add(betterTypeHistoryPlugin).add([pastePlugin, options.paste]).add(clipboardPlugin).add(focusPlugin).add(compositionPlugin).add([contextIdentifierPlugin, {
|
|
48
|
+
contextIdentifierProvider: options.contextIdentifierProvider
|
|
49
|
+
}]).add([basePlugin, options.base]).add(decorationsPlugin).add([typeAheadPlugin, options.typeAhead || {
|
|
47
50
|
createAnalyticsEvent: options.createAnalyticsEvent
|
|
48
51
|
}]).maybeAdd(historyPlugin, Boolean(isMobile || options.allowUndoRedoButtons)).maybeAdd(undoRedoPlugin, Boolean((_options$featureFlags = options.featureFlags) === null || _options$featureFlags === void 0 ? void 0 : _options$featureFlags.undoRedoButtons)).add([blockTypePlugin, options.blockType]).add(clearMarksOnEmptyDocPlugin).maybeAdd([annotationPlugin, options.annotationProviders], Boolean(options.annotationProviders)).maybeAdd([selectionToolbarPlugin, {
|
|
49
52
|
preferenceToolbarAboveSelection: false
|
|
@@ -96,8 +96,8 @@ var ToolbarFeedbackInternal = /*#__PURE__*/function (_PureComponent) {
|
|
|
96
96
|
});
|
|
97
97
|
});
|
|
98
98
|
_defineProperty(_assertThisInitialized(_this), "openJiraIssueCollector", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
99
|
-
var _this$props$api, _window$localStorage$,
|
|
100
|
-
var
|
|
99
|
+
var _this$props$api, _window$localStorage$, _this$props$api2;
|
|
100
|
+
var contentId, sessionId, tabId;
|
|
101
101
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
102
102
|
while (1) switch (_context.prev = _context.next) {
|
|
103
103
|
case 0:
|
|
@@ -105,21 +105,20 @@ var ToolbarFeedbackInternal = /*#__PURE__*/function (_PureComponent) {
|
|
|
105
105
|
jiraIssueCollectorScriptLoading: true,
|
|
106
106
|
showOptOutOption: false
|
|
107
107
|
});
|
|
108
|
-
|
|
108
|
+
contentId = (_this$props$api = _this.props.api) === null || _this$props$api === void 0 || (_this$props$api = _this$props$api.contextIdentifier) === null || _this$props$api === void 0 || (_this$props$api = _this$props$api.sharedState.currentState()) === null || _this$props$api === void 0 || (_this$props$api = _this$props$api.contextIdentifierProvider) === null || _this$props$api === void 0 ? void 0 : _this$props$api.objectId;
|
|
109
109
|
sessionId = (_window$localStorage$ = window.localStorage.getItem('awc.session.id')) === null || _window$localStorage$ === void 0 ? void 0 : _window$localStorage$.toString();
|
|
110
|
-
contentId = basePluginState === null || basePluginState === void 0 || (_basePluginState$cont = basePluginState.contextIdentifier) === null || _basePluginState$cont === void 0 ? void 0 : _basePluginState$cont.objectId;
|
|
111
110
|
tabId = window.sessionStorage['awc.tab.id'];
|
|
112
|
-
_context.next =
|
|
111
|
+
_context.next = 6;
|
|
113
112
|
return (_this$props$api2 = _this.props.api) === null || _this$props$api2 === void 0 || (_this$props$api2 = _this$props$api2.feedbackDialog) === null || _this$props$api2 === void 0 ? void 0 : _this$props$api2.actions.openFeedbackDialog(_objectSpread(_objectSpread({}, _this.getFeedbackInfo()), {}, {
|
|
114
113
|
sessionId: sessionId,
|
|
115
114
|
contentId: contentId,
|
|
116
115
|
tabId: tabId
|
|
117
116
|
}));
|
|
118
|
-
case
|
|
117
|
+
case 6:
|
|
119
118
|
_this.setState({
|
|
120
119
|
jiraIssueCollectorScriptLoading: false
|
|
121
120
|
});
|
|
122
|
-
case
|
|
121
|
+
case 7:
|
|
123
122
|
case "end":
|
|
124
123
|
return _context.stop();
|
|
125
124
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export var name = "@atlaskit/editor-core";
|
|
2
|
-
export var version = "191.
|
|
2
|
+
export var version = "191.7.2";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
|
|
2
|
+
interface UseProvidersProps {
|
|
3
|
+
contextIdentifierProvider: Promise<ContextIdentifierProvider> | undefined;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* This hook is used to replace the old approach of using the `providerFactory`.
|
|
7
|
+
*
|
|
8
|
+
* Because plugins can't update their initial configuration, this hook listens to changes
|
|
9
|
+
* and calls a command to push the update to the plugins shared state.
|
|
10
|
+
*
|
|
11
|
+
* In the future ideally consumers implement this behaviour themselves.
|
|
12
|
+
*/
|
|
13
|
+
export declare const useProviders: ({ contextIdentifierProvider, }: UseProvidersProps) => void;
|
|
14
|
+
export {};
|