@atlaskit/editor-core 204.6.2 → 204.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/utils/extensions.js +38 -4
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/utils/extensions.js +28 -4
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/utils/extensions.js +38 -4
- package/dist/esm/version-wrapper.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 204.6.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#130479](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/130479)
|
|
8
|
+
[`e78bc5ec9103d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e78bc5ec9103d) -
|
|
9
|
+
Call quick insert get items with dummy extension API if extension plugin is not enabled.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 204.6.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#127093](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/127093)
|
|
17
|
+
[`1378ea7a99ce1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1378ea7a99ce1) -
|
|
18
|
+
Upgrades `jscodeshift` to handle generics properly.
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 204.6.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -52,6 +52,31 @@ function sendExtensionQuickInsertAnalytics(item, selection, createAnalyticsEvent
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
+
var showDummyAPIWarning = function showDummyAPIWarning(location) {
|
|
56
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
57
|
+
// eslint-disable-next-line no-console
|
|
58
|
+
console.warn("Extension plugin not attached to editor - cannot use extension API in ".concat(location));
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var dummyExtensionAPI = {
|
|
62
|
+
editInContextPanel: function editInContextPanel() {
|
|
63
|
+
return showDummyAPIWarning('editInContextPanel');
|
|
64
|
+
},
|
|
65
|
+
_editInLegacyMacroBrowser: function _editInLegacyMacroBrowser() {
|
|
66
|
+
return showDummyAPIWarning('_editInLegacyMacroBrowser');
|
|
67
|
+
},
|
|
68
|
+
doc: {
|
|
69
|
+
insertAfter: function insertAfter() {
|
|
70
|
+
return showDummyAPIWarning('doc:insertAfter');
|
|
71
|
+
},
|
|
72
|
+
scrollTo: function scrollTo() {
|
|
73
|
+
return showDummyAPIWarning('doc:scrollTo');
|
|
74
|
+
},
|
|
75
|
+
update: function update() {
|
|
76
|
+
return showDummyAPIWarning('doc:update');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
55
80
|
function extensionProviderToQuickInsertProvider(_x, _x2, _x3, _x4) {
|
|
56
81
|
return _extensionProviderToQuickInsertProvider.apply(this, arguments);
|
|
57
82
|
} // Ignored via go/ees005
|
|
@@ -92,10 +117,8 @@ function _extensionProviderToQuickInsertProvider() {
|
|
|
92
117
|
if ((0, _platformFeatureFlags.fg)('platform_editor_add_extension_api_to_quick_insert')) {
|
|
93
118
|
var _apiRef$current;
|
|
94
119
|
var extensionAPI = apiRef === null || apiRef === void 0 || (_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 || (_apiRef$current = _apiRef$current.extension) === null || _apiRef$current === void 0 || (_apiRef$current = _apiRef$current.actions) === null || _apiRef$current === void 0 ? void 0 : _apiRef$current.api();
|
|
95
|
-
// While
|
|
96
|
-
//
|
|
97
|
-
// - The extension module handler can only be called from an active editor with the extension plugin
|
|
98
|
-
// Therefore this should always be run unless there is something very wrong.
|
|
120
|
+
// While this should only run when the extension some setups of editor
|
|
121
|
+
// may not have the extension API
|
|
99
122
|
if (extensionAPI) {
|
|
100
123
|
(0, _extensions.resolveImport)(item.node(extensionAPI)).then(function (node) {
|
|
101
124
|
sendExtensionQuickInsertAnalytics(item, state.selection, createAnalyticsEvent, source);
|
|
@@ -103,6 +126,17 @@ function _extensionProviderToQuickInsertProvider() {
|
|
|
103
126
|
editorActions.replaceSelection(node);
|
|
104
127
|
}
|
|
105
128
|
});
|
|
129
|
+
} else {
|
|
130
|
+
// Originally it was understood we could only use this if we were using the extension plugin
|
|
131
|
+
// However there are some edge cases where this is not true (ie. in jira)
|
|
132
|
+
// Since making it optional now would be a breaking change - instead we can just pass a dummy
|
|
133
|
+
// extension API to consumers that warns them of using the methods.
|
|
134
|
+
(0, _extensions.resolveImport)(item.node(dummyExtensionAPI)).then(function (node) {
|
|
135
|
+
sendExtensionQuickInsertAnalytics(item, state.selection, createAnalyticsEvent, source);
|
|
136
|
+
if (node) {
|
|
137
|
+
editorActions.replaceSelection(node);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
106
140
|
}
|
|
107
141
|
} else {
|
|
108
142
|
// @ts-expect-error No longer supported without extension API - this will be removed once we cleanup the FG.
|
|
@@ -40,6 +40,21 @@ function sendExtensionQuickInsertAnalytics(item, selection, createAnalyticsEvent
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
+
const showDummyAPIWarning = location => {
|
|
44
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
45
|
+
// eslint-disable-next-line no-console
|
|
46
|
+
console.warn(`Extension plugin not attached to editor - cannot use extension API in ${location}`);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const dummyExtensionAPI = {
|
|
50
|
+
editInContextPanel: () => showDummyAPIWarning('editInContextPanel'),
|
|
51
|
+
_editInLegacyMacroBrowser: () => showDummyAPIWarning('_editInLegacyMacroBrowser'),
|
|
52
|
+
doc: {
|
|
53
|
+
insertAfter: () => showDummyAPIWarning('doc:insertAfter'),
|
|
54
|
+
scrollTo: () => showDummyAPIWarning('doc:scrollTo'),
|
|
55
|
+
update: () => showDummyAPIWarning('doc:update')
|
|
56
|
+
}
|
|
57
|
+
};
|
|
43
58
|
export async function extensionProviderToQuickInsertProvider(extensionProvider, editorActions, apiRef, createAnalyticsEvent) {
|
|
44
59
|
const extensions = await extensionProvider.getExtensions();
|
|
45
60
|
return {
|
|
@@ -64,10 +79,8 @@ export async function extensionProviderToQuickInsertProvider(extensionProvider,
|
|
|
64
79
|
if (fg('platform_editor_add_extension_api_to_quick_insert')) {
|
|
65
80
|
var _apiRef$current, _apiRef$current$exten, _apiRef$current$exten2;
|
|
66
81
|
const extensionAPI = apiRef === null || apiRef === void 0 ? void 0 : (_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 ? void 0 : (_apiRef$current$exten = _apiRef$current.extension) === null || _apiRef$current$exten === void 0 ? void 0 : (_apiRef$current$exten2 = _apiRef$current$exten.actions) === null || _apiRef$current$exten2 === void 0 ? void 0 : _apiRef$current$exten2.api();
|
|
67
|
-
// While
|
|
68
|
-
//
|
|
69
|
-
// - The extension module handler can only be called from an active editor with the extension plugin
|
|
70
|
-
// Therefore this should always be run unless there is something very wrong.
|
|
82
|
+
// While this should only run when the extension some setups of editor
|
|
83
|
+
// may not have the extension API
|
|
71
84
|
if (extensionAPI) {
|
|
72
85
|
resolveImport(item.node(extensionAPI)).then(node => {
|
|
73
86
|
sendExtensionQuickInsertAnalytics(item, state.selection, createAnalyticsEvent, source);
|
|
@@ -75,6 +88,17 @@ export async function extensionProviderToQuickInsertProvider(extensionProvider,
|
|
|
75
88
|
editorActions.replaceSelection(node);
|
|
76
89
|
}
|
|
77
90
|
});
|
|
91
|
+
} else {
|
|
92
|
+
// Originally it was understood we could only use this if we were using the extension plugin
|
|
93
|
+
// However there are some edge cases where this is not true (ie. in jira)
|
|
94
|
+
// Since making it optional now would be a breaking change - instead we can just pass a dummy
|
|
95
|
+
// extension API to consumers that warns them of using the methods.
|
|
96
|
+
resolveImport(item.node(dummyExtensionAPI)).then(node => {
|
|
97
|
+
sendExtensionQuickInsertAnalytics(item, state.selection, createAnalyticsEvent, source);
|
|
98
|
+
if (node) {
|
|
99
|
+
editorActions.replaceSelection(node);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
78
102
|
}
|
|
79
103
|
} else {
|
|
80
104
|
// @ts-expect-error No longer supported without extension API - this will be removed once we cleanup the FG.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "204.6.
|
|
2
|
+
export const version = "204.6.4";
|
|
@@ -44,6 +44,31 @@ function sendExtensionQuickInsertAnalytics(item, selection, createAnalyticsEvent
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
+
var showDummyAPIWarning = function showDummyAPIWarning(location) {
|
|
48
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
49
|
+
// eslint-disable-next-line no-console
|
|
50
|
+
console.warn("Extension plugin not attached to editor - cannot use extension API in ".concat(location));
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var dummyExtensionAPI = {
|
|
54
|
+
editInContextPanel: function editInContextPanel() {
|
|
55
|
+
return showDummyAPIWarning('editInContextPanel');
|
|
56
|
+
},
|
|
57
|
+
_editInLegacyMacroBrowser: function _editInLegacyMacroBrowser() {
|
|
58
|
+
return showDummyAPIWarning('_editInLegacyMacroBrowser');
|
|
59
|
+
},
|
|
60
|
+
doc: {
|
|
61
|
+
insertAfter: function insertAfter() {
|
|
62
|
+
return showDummyAPIWarning('doc:insertAfter');
|
|
63
|
+
},
|
|
64
|
+
scrollTo: function scrollTo() {
|
|
65
|
+
return showDummyAPIWarning('doc:scrollTo');
|
|
66
|
+
},
|
|
67
|
+
update: function update() {
|
|
68
|
+
return showDummyAPIWarning('doc:update');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
47
72
|
export function extensionProviderToQuickInsertProvider(_x, _x2, _x3, _x4) {
|
|
48
73
|
return _extensionProviderToQuickInsertProvider.apply(this, arguments);
|
|
49
74
|
}
|
|
@@ -86,10 +111,8 @@ function _extensionProviderToQuickInsertProvider() {
|
|
|
86
111
|
if (fg('platform_editor_add_extension_api_to_quick_insert')) {
|
|
87
112
|
var _apiRef$current;
|
|
88
113
|
var extensionAPI = apiRef === null || apiRef === void 0 || (_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 || (_apiRef$current = _apiRef$current.extension) === null || _apiRef$current === void 0 || (_apiRef$current = _apiRef$current.actions) === null || _apiRef$current === void 0 ? void 0 : _apiRef$current.api();
|
|
89
|
-
// While
|
|
90
|
-
//
|
|
91
|
-
// - The extension module handler can only be called from an active editor with the extension plugin
|
|
92
|
-
// Therefore this should always be run unless there is something very wrong.
|
|
114
|
+
// While this should only run when the extension some setups of editor
|
|
115
|
+
// may not have the extension API
|
|
93
116
|
if (extensionAPI) {
|
|
94
117
|
resolveImport(item.node(extensionAPI)).then(function (node) {
|
|
95
118
|
sendExtensionQuickInsertAnalytics(item, state.selection, createAnalyticsEvent, source);
|
|
@@ -97,6 +120,17 @@ function _extensionProviderToQuickInsertProvider() {
|
|
|
97
120
|
editorActions.replaceSelection(node);
|
|
98
121
|
}
|
|
99
122
|
});
|
|
123
|
+
} else {
|
|
124
|
+
// Originally it was understood we could only use this if we were using the extension plugin
|
|
125
|
+
// However there are some edge cases where this is not true (ie. in jira)
|
|
126
|
+
// Since making it optional now would be a breaking change - instead we can just pass a dummy
|
|
127
|
+
// extension API to consumers that warns them of using the methods.
|
|
128
|
+
resolveImport(item.node(dummyExtensionAPI)).then(function (node) {
|
|
129
|
+
sendExtensionQuickInsertAnalytics(item, state.selection, createAnalyticsEvent, source);
|
|
130
|
+
if (node) {
|
|
131
|
+
editorActions.replaceSelection(node);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
100
134
|
}
|
|
101
135
|
} else {
|
|
102
136
|
// @ts-expect-error No longer supported without extension API - this will be removed once we cleanup the FG.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export var name = "@atlaskit/editor-core";
|
|
2
|
-
export var version = "204.6.
|
|
2
|
+
export var version = "204.6.4";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "204.6.
|
|
3
|
+
"version": "204.6.4",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
"@types/is-number": "^7.0.0",
|
|
118
118
|
"diff": "^4.0.1",
|
|
119
119
|
"enzyme": "^3.10.0",
|
|
120
|
-
"jscodeshift": "^0.
|
|
120
|
+
"jscodeshift": "^0.16.1",
|
|
121
121
|
"mockdate": "^3.0.5",
|
|
122
122
|
"raf-stub": "^2.0.1",
|
|
123
123
|
"react": "^18.2.0",
|