@atlaskit/editor-plugin-extension 33.0.19 → 33.1.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 +12 -0
- package/dist/cjs/extensionPlugin.js +54 -35
- package/dist/cjs/pm-plugins/main.js +13 -3
- package/dist/es2019/extensionPlugin.js +15 -0
- package/dist/es2019/pm-plugins/main.js +9 -1
- package/dist/esm/extensionPlugin.js +54 -33
- package/dist/esm/pm-plugins/main.js +13 -3
- package/dist/types/extensionPluginType.d.ts +7 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-extension
|
|
2
2
|
|
|
3
|
+
## 33.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`8bcfd4cbc0135`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8bcfd4cbc0135) -
|
|
8
|
+
Scope generated media and native embed entrance animations to the final Rovo create insertion
|
|
9
|
+
using existing media and extension plugin state behind cwr_remix_animate_stream_only.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 33.0.19
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -5,11 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.extensionPlugin = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
8
9
|
var _uuid = require("uuid");
|
|
9
10
|
var _extension = require("@atlaskit/adf-schema/extension");
|
|
10
11
|
var _inlineExtension = require("@atlaskit/adf-schema/inline-extension");
|
|
11
12
|
var _multiBodiedExtension = require("@atlaskit/adf-schema/multi-bodied-extension");
|
|
12
13
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
14
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
13
15
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
14
16
|
var _actions = require("./editor-actions/actions");
|
|
15
17
|
var _commands = require("./editor-commands/commands");
|
|
@@ -25,8 +27,8 @@ var _uniqueId = require("./pm-plugins/unique-id");
|
|
|
25
27
|
var _constants = require("./ui/ConfigPanel/constants");
|
|
26
28
|
var _contextPanel = require("./ui/context-panel");
|
|
27
29
|
var _useConfigPanelPluginHook = require("./ui/useConfigPanelPluginHook");
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
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; }
|
|
31
|
+
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; } // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
30
32
|
var extensionPlugin = exports.extensionPlugin = function extensionPlugin(_ref) {
|
|
31
33
|
var _api$featureFlags, _api$contextPanel, _api$analytics2, _api$analytics3, _api$contextPanel4;
|
|
32
34
|
var _ref$config = _ref.config,
|
|
@@ -64,25 +66,42 @@ var extensionPlugin = exports.extensionPlugin = function extensionPlugin(_ref) {
|
|
|
64
66
|
return extensionNodes;
|
|
65
67
|
},
|
|
66
68
|
getSharedState: function getSharedState(state) {
|
|
69
|
+
var _pluginState$shouldAn;
|
|
67
70
|
if (!state) {
|
|
68
71
|
return undefined;
|
|
69
72
|
}
|
|
70
73
|
var pluginState = _pluginKey.pluginKey.getState(state);
|
|
71
|
-
return {
|
|
72
|
-
showContextPanel: pluginState === null || pluginState === void 0 ? void 0 : pluginState.showContextPanel
|
|
74
|
+
return _objectSpread(_objectSpread({
|
|
75
|
+
showContextPanel: pluginState === null || pluginState === void 0 ? void 0 : pluginState.showContextPanel
|
|
76
|
+
}, (0, _isExperimentEnabled.isExperimentEnabled)('cwr_remix_animate_stream_only') && {
|
|
77
|
+
shouldAnimateInsertedContent: (_pluginState$shouldAn = pluginState === null || pluginState === void 0 ? void 0 : pluginState.shouldAnimateInsertedContent) !== null && _pluginState$shouldAn !== void 0 ? _pluginState$shouldAn : false
|
|
78
|
+
}), {}, {
|
|
73
79
|
extensionProvider: pluginState === null || pluginState === void 0 ? void 0 : pluginState.extensionProvider,
|
|
74
80
|
processParametersAfter: pluginState === null || pluginState === void 0 ? void 0 : pluginState.processParametersAfter
|
|
75
|
-
};
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
commands: {
|
|
84
|
+
setInsertAnimationEnabled: function setInsertAnimationEnabled(enabled) {
|
|
85
|
+
return function (_ref2) {
|
|
86
|
+
var tr = _ref2.tr;
|
|
87
|
+
return (0, _isExperimentEnabled.isExperimentEnabled)('cwr_remix_animate_stream_only') ? tr.setMeta(_pluginKey.pluginKey, {
|
|
88
|
+
type: 'UPDATE_STATE',
|
|
89
|
+
data: {
|
|
90
|
+
shouldAnimateInsertedContent: enabled
|
|
91
|
+
}
|
|
92
|
+
}).setMeta('addToHistory', false) : null;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
76
95
|
},
|
|
77
96
|
pmPlugins: function pmPlugins() {
|
|
78
97
|
return [{
|
|
79
98
|
name: 'extension',
|
|
80
|
-
plugin: function plugin(
|
|
81
|
-
var dispatch =
|
|
82
|
-
providerFactory =
|
|
83
|
-
portalProviderAPI =
|
|
84
|
-
eventDispatcher =
|
|
85
|
-
getIntl =
|
|
99
|
+
plugin: function plugin(_ref3) {
|
|
100
|
+
var dispatch = _ref3.dispatch,
|
|
101
|
+
providerFactory = _ref3.providerFactory,
|
|
102
|
+
portalProviderAPI = _ref3.portalProviderAPI,
|
|
103
|
+
eventDispatcher = _ref3.eventDispatcher,
|
|
104
|
+
getIntl = _ref3.getIntl;
|
|
86
105
|
var extensionHandlers = options.extensionHandlers || {};
|
|
87
106
|
return (0, _main.createPlugin)(dispatch, providerFactory, extensionHandlers, extensionLoadingHandlers, portalProviderAPI, eventDispatcher, _api, options.useLongPressSelection, {
|
|
88
107
|
appearance: options.appearance,
|
|
@@ -119,9 +138,9 @@ var extensionPlugin = exports.extensionPlugin = function extensionPlugin(_ref) {
|
|
|
119
138
|
}
|
|
120
139
|
}, {
|
|
121
140
|
name: 'macro',
|
|
122
|
-
plugin: function plugin(
|
|
123
|
-
var dispatch =
|
|
124
|
-
providerFactory =
|
|
141
|
+
plugin: function plugin(_ref4) {
|
|
142
|
+
var dispatch = _ref4.dispatch,
|
|
143
|
+
providerFactory = _ref4.providerFactory;
|
|
125
144
|
return (0, _plugin.createPlugin)(dispatch, providerFactory);
|
|
126
145
|
}
|
|
127
146
|
}];
|
|
@@ -141,14 +160,14 @@ var extensionPlugin = exports.extensionPlugin = function extensionPlugin(_ref) {
|
|
|
141
160
|
return extensionLoadingHandlers;
|
|
142
161
|
},
|
|
143
162
|
insertMacroFromMacroBrowser: (0, _actions2.insertMacroFromMacroBrowser)(_api === null || _api === void 0 || (_api$analytics2 = _api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions),
|
|
144
|
-
insertOrReplaceExtension: function insertOrReplaceExtension(
|
|
145
|
-
var editorView =
|
|
146
|
-
action =
|
|
147
|
-
attrs =
|
|
148
|
-
content =
|
|
149
|
-
position =
|
|
150
|
-
size =
|
|
151
|
-
tr =
|
|
163
|
+
insertOrReplaceExtension: function insertOrReplaceExtension(_ref5) {
|
|
164
|
+
var editorView = _ref5.editorView,
|
|
165
|
+
action = _ref5.action,
|
|
166
|
+
attrs = _ref5.attrs,
|
|
167
|
+
content = _ref5.content,
|
|
168
|
+
position = _ref5.position,
|
|
169
|
+
size = _ref5.size,
|
|
170
|
+
tr = _ref5.tr;
|
|
152
171
|
return (0, _actions.insertOrReplaceExtension)({
|
|
153
172
|
editorView: editorView,
|
|
154
173
|
action: action,
|
|
@@ -159,14 +178,14 @@ var extensionPlugin = exports.extensionPlugin = function extensionPlugin(_ref) {
|
|
|
159
178
|
tr: tr
|
|
160
179
|
});
|
|
161
180
|
},
|
|
162
|
-
insertOrReplaceBodiedExtension: function insertOrReplaceBodiedExtension(
|
|
163
|
-
var editorView =
|
|
164
|
-
action =
|
|
165
|
-
attrs =
|
|
166
|
-
content =
|
|
167
|
-
position =
|
|
168
|
-
size =
|
|
169
|
-
tr =
|
|
181
|
+
insertOrReplaceBodiedExtension: function insertOrReplaceBodiedExtension(_ref6) {
|
|
182
|
+
var editorView = _ref6.editorView,
|
|
183
|
+
action = _ref6.action,
|
|
184
|
+
attrs = _ref6.attrs,
|
|
185
|
+
content = _ref6.content,
|
|
186
|
+
position = _ref6.position,
|
|
187
|
+
size = _ref6.size,
|
|
188
|
+
tr = _ref6.tr;
|
|
170
189
|
return (0, _actions.insertOrReplaceBodiedExtension)({
|
|
171
190
|
editorView: editorView,
|
|
172
191
|
action: action,
|
|
@@ -182,9 +201,9 @@ var extensionPlugin = exports.extensionPlugin = function extensionPlugin(_ref) {
|
|
|
182
201
|
editorAnalyticsAPI: _api === null || _api === void 0 || (_api$analytics3 = _api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions,
|
|
183
202
|
applyChangeToContextPanel: _api === null || _api === void 0 || (_api$contextPanel4 = _api.contextPanel) === null || _api$contextPanel4 === void 0 ? void 0 : _api$contextPanel4.actions.applyChange
|
|
184
203
|
}),
|
|
185
|
-
registerExtensionLoadingHandler: function registerExtensionLoadingHandler(
|
|
186
|
-
var extensionType =
|
|
187
|
-
handler =
|
|
204
|
+
registerExtensionLoadingHandler: function registerExtensionLoadingHandler(_ref7) {
|
|
205
|
+
var extensionType = _ref7.extensionType,
|
|
206
|
+
handler = _ref7.handler;
|
|
188
207
|
extensionLoadingHandlers[extensionType] = handler;
|
|
189
208
|
return function () {
|
|
190
209
|
if (extensionLoadingHandlers[extensionType] === handler) {
|
|
@@ -208,8 +227,8 @@ var extensionPlugin = exports.extensionPlugin = function extensionPlugin(_ref) {
|
|
|
208
227
|
return (_editorViewRef$curren = editorViewRef.current) !== null && _editorViewRef$curren !== void 0 ? _editorViewRef$curren : undefined;
|
|
209
228
|
})(_api, featureFlags) : undefined
|
|
210
229
|
},
|
|
211
|
-
usePluginHook: showContextPanel ? function (
|
|
212
|
-
var editorView =
|
|
230
|
+
usePluginHook: showContextPanel ? function (_ref8) {
|
|
231
|
+
var editorView = _ref8.editorView;
|
|
213
232
|
(0, _useConfigPanelPluginHook.useConfigPanelPluginHook)({
|
|
214
233
|
api: _api,
|
|
215
234
|
configPanelId: configPanelId,
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.handleUpdate = exports.createPlugin = exports.createExtensionProviderHandler = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
11
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
12
|
var _extensionNodeView = _interopRequireDefault(require("@atlaskit/editor-common/extensionNodeView"));
|
|
@@ -14,12 +15,15 @@ var _selection2 = require("@atlaskit/editor-common/selection");
|
|
|
14
15
|
var _selection3 = require("@atlaskit/editor-common/selection/gap-cursor/selection");
|
|
15
16
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
16
17
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
18
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
17
19
|
var _commands = require("../editor-commands/commands");
|
|
18
20
|
var _blockTransforms = require("./block-transforms");
|
|
19
21
|
var _pluginFactory = require("./plugin-factory");
|
|
20
22
|
var _pluginKey = require("./plugin-key");
|
|
21
23
|
var _updateEditButton = require("./update-edit-button");
|
|
22
24
|
var _utils2 = require("./utils");
|
|
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; }
|
|
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; }
|
|
23
27
|
var shouldShowEditButton = function shouldShowEditButton(extensionHandler, extensionProvider) {
|
|
24
28
|
var usesLegacyMacroBrowser = !extensionHandler && !extensionProvider || typeof extensionHandler === 'function';
|
|
25
29
|
var usesModernUpdateMethod = (0, _typeof2.default)(extensionHandler) === 'object' && typeof extensionHandler.update === 'function';
|
|
@@ -191,15 +195,21 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
|
|
|
191
195
|
var featureFlags = arguments.length > 9 ? arguments[9] : undefined;
|
|
192
196
|
var __rendererExtensionOptions = arguments.length > 10 ? arguments[10] : undefined;
|
|
193
197
|
var intl = arguments.length > 11 ? arguments[11] : undefined;
|
|
194
|
-
var state = (0, _pluginFactory.createPluginState)(dispatch, {
|
|
198
|
+
var state = (0, _pluginFactory.createPluginState)(dispatch, _objectSpread(_objectSpread({}, (0, _isExperimentEnabled.isExperimentEnabled)('cwr_remix_animate_stream_only') && {
|
|
199
|
+
shouldAnimateInsertedContent: false
|
|
200
|
+
}), {}, {
|
|
195
201
|
showEditButton: false,
|
|
196
202
|
showCopyButton: true,
|
|
197
203
|
showContextPanel: false
|
|
198
|
-
});
|
|
204
|
+
}));
|
|
199
205
|
var extensionNodeViewOptions = {
|
|
200
206
|
appearance: options.appearance,
|
|
201
207
|
getExtensionHeight: options.getExtensionHeight,
|
|
202
|
-
allowAIGeneratedContentMotion: options.allowAIGeneratedContentMotion
|
|
208
|
+
allowAIGeneratedContentMotion: options.allowAIGeneratedContentMotion,
|
|
209
|
+
shouldAnimateGeneratedContent: function shouldAnimateGeneratedContent() {
|
|
210
|
+
var _pluginInjectionApi$e, _pluginInjectionApi$e2;
|
|
211
|
+
return (_pluginInjectionApi$e = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e2 = pluginInjectionApi.extension) === null || _pluginInjectionApi$e2 === void 0 || (_pluginInjectionApi$e2 = _pluginInjectionApi$e2.sharedState.currentState()) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.shouldAnimateInsertedContent) !== null && _pluginInjectionApi$e !== void 0 ? _pluginInjectionApi$e : false;
|
|
212
|
+
}
|
|
203
213
|
};
|
|
204
214
|
var macroInteractionDesignFeatureFlags = {
|
|
205
215
|
showMacroInteractionDesignUpdates: (_featureFlags$macroIn = featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.macroInteractionUpdates) !== null && _featureFlags$macroIn !== void 0 ? _featureFlags$macroIn : false
|
|
@@ -4,6 +4,7 @@ import { extension, extensionWithAnnotationStage0 } from '@atlaskit/adf-schema/e
|
|
|
4
4
|
import { inlineExtension } from '@atlaskit/adf-schema/inline-extension';
|
|
5
5
|
import { extensionFrame, multiBodiedExtension } from '@atlaskit/adf-schema/multi-bodied-extension';
|
|
6
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
7
8
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
8
9
|
import { createEditSelectedExtensionAction, insertOrReplaceBodiedExtension, insertOrReplaceExtension } from './editor-actions/actions';
|
|
9
10
|
import { forceAutoSave } from './editor-commands/commands';
|
|
@@ -56,16 +57,30 @@ export const extensionPlugin = ({
|
|
|
56
57
|
return extensionNodes;
|
|
57
58
|
},
|
|
58
59
|
getSharedState(state) {
|
|
60
|
+
var _pluginState$shouldAn;
|
|
59
61
|
if (!state) {
|
|
60
62
|
return undefined;
|
|
61
63
|
}
|
|
62
64
|
const pluginState = pluginKey.getState(state);
|
|
63
65
|
return {
|
|
64
66
|
showContextPanel: pluginState === null || pluginState === void 0 ? void 0 : pluginState.showContextPanel,
|
|
67
|
+
...(isExperimentEnabled('cwr_remix_animate_stream_only') && {
|
|
68
|
+
shouldAnimateInsertedContent: (_pluginState$shouldAn = pluginState === null || pluginState === void 0 ? void 0 : pluginState.shouldAnimateInsertedContent) !== null && _pluginState$shouldAn !== void 0 ? _pluginState$shouldAn : false
|
|
69
|
+
}),
|
|
65
70
|
extensionProvider: pluginState === null || pluginState === void 0 ? void 0 : pluginState.extensionProvider,
|
|
66
71
|
processParametersAfter: pluginState === null || pluginState === void 0 ? void 0 : pluginState.processParametersAfter
|
|
67
72
|
};
|
|
68
73
|
},
|
|
74
|
+
commands: {
|
|
75
|
+
setInsertAnimationEnabled: enabled => ({
|
|
76
|
+
tr
|
|
77
|
+
}) => isExperimentEnabled('cwr_remix_animate_stream_only') ? tr.setMeta(pluginKey, {
|
|
78
|
+
type: 'UPDATE_STATE',
|
|
79
|
+
data: {
|
|
80
|
+
shouldAnimateInsertedContent: enabled
|
|
81
|
+
}
|
|
82
|
+
}).setMeta('addToHistory', false) : null
|
|
83
|
+
},
|
|
69
84
|
pmPlugins() {
|
|
70
85
|
return [{
|
|
71
86
|
name: 'extension',
|
|
@@ -4,6 +4,7 @@ import { createSelectionClickHandler, isSelectionAtEndOfNode, isSelectionAtStart
|
|
|
4
4
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection/gap-cursor/selection';
|
|
5
5
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { findParentNodeOfTypeClosestToPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
7
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
7
8
|
import { clearEditingContext, updateState } from '../editor-commands/commands';
|
|
8
9
|
import { buildExtensionBlockTransforms } from './block-transforms';
|
|
9
10
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
@@ -130,6 +131,9 @@ export const handleUpdate = ({
|
|
|
130
131
|
export const createPlugin = (dispatch, providerFactory, extensionHandlers, extensionLoadingHandlers, portalProviderAPI, eventDispatcher, pluginInjectionApi, useLongPressSelection = false, options = {}, featureFlags, __rendererExtensionOptions, intl) => {
|
|
131
132
|
var _featureFlags$macroIn;
|
|
132
133
|
const state = createPluginState(dispatch, {
|
|
134
|
+
...(isExperimentEnabled('cwr_remix_animate_stream_only') && {
|
|
135
|
+
shouldAnimateInsertedContent: false
|
|
136
|
+
}),
|
|
133
137
|
showEditButton: false,
|
|
134
138
|
showCopyButton: true,
|
|
135
139
|
showContextPanel: false
|
|
@@ -137,7 +141,11 @@ export const createPlugin = (dispatch, providerFactory, extensionHandlers, exten
|
|
|
137
141
|
const extensionNodeViewOptions = {
|
|
138
142
|
appearance: options.appearance,
|
|
139
143
|
getExtensionHeight: options.getExtensionHeight,
|
|
140
|
-
allowAIGeneratedContentMotion: options.allowAIGeneratedContentMotion
|
|
144
|
+
allowAIGeneratedContentMotion: options.allowAIGeneratedContentMotion,
|
|
145
|
+
shouldAnimateGeneratedContent: () => {
|
|
146
|
+
var _pluginInjectionApi$e, _pluginInjectionApi$e2, _pluginInjectionApi$e3;
|
|
147
|
+
return (_pluginInjectionApi$e = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$e2 = pluginInjectionApi.extension) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : (_pluginInjectionApi$e3 = _pluginInjectionApi$e2.sharedState.currentState()) === null || _pluginInjectionApi$e3 === void 0 ? void 0 : _pluginInjectionApi$e3.shouldAnimateInsertedContent) !== null && _pluginInjectionApi$e !== void 0 ? _pluginInjectionApi$e : false;
|
|
148
|
+
}
|
|
141
149
|
};
|
|
142
150
|
const macroInteractionDesignFeatureFlags = {
|
|
143
151
|
showMacroInteractionDesignUpdates: (_featureFlags$macroIn = featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.macroInteractionUpdates) !== null && _featureFlags$macroIn !== void 0 ? _featureFlags$macroIn : false
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
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; }
|
|
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; }
|
|
1
4
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
2
5
|
import { v4 as uuid } from 'uuid';
|
|
3
6
|
import { extension, extensionWithAnnotationStage0 } from '@atlaskit/adf-schema/extension';
|
|
4
7
|
import { inlineExtension } from '@atlaskit/adf-schema/inline-extension';
|
|
5
8
|
import { extensionFrame, multiBodiedExtension } from '@atlaskit/adf-schema/multi-bodied-extension';
|
|
6
9
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
10
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
7
11
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
8
12
|
import { createEditSelectedExtensionAction, insertOrReplaceBodiedExtension as _insertOrReplaceBodiedExtension, insertOrReplaceExtension as _insertOrReplaceExtension } from './editor-actions/actions';
|
|
9
13
|
import { forceAutoSave } from './editor-commands/commands';
|
|
@@ -56,25 +60,42 @@ export var extensionPlugin = function extensionPlugin(_ref) {
|
|
|
56
60
|
return extensionNodes;
|
|
57
61
|
},
|
|
58
62
|
getSharedState: function getSharedState(state) {
|
|
63
|
+
var _pluginState$shouldAn;
|
|
59
64
|
if (!state) {
|
|
60
65
|
return undefined;
|
|
61
66
|
}
|
|
62
67
|
var pluginState = pluginKey.getState(state);
|
|
63
|
-
return {
|
|
64
|
-
showContextPanel: pluginState === null || pluginState === void 0 ? void 0 : pluginState.showContextPanel
|
|
68
|
+
return _objectSpread(_objectSpread({
|
|
69
|
+
showContextPanel: pluginState === null || pluginState === void 0 ? void 0 : pluginState.showContextPanel
|
|
70
|
+
}, isExperimentEnabled('cwr_remix_animate_stream_only') && {
|
|
71
|
+
shouldAnimateInsertedContent: (_pluginState$shouldAn = pluginState === null || pluginState === void 0 ? void 0 : pluginState.shouldAnimateInsertedContent) !== null && _pluginState$shouldAn !== void 0 ? _pluginState$shouldAn : false
|
|
72
|
+
}), {}, {
|
|
65
73
|
extensionProvider: pluginState === null || pluginState === void 0 ? void 0 : pluginState.extensionProvider,
|
|
66
74
|
processParametersAfter: pluginState === null || pluginState === void 0 ? void 0 : pluginState.processParametersAfter
|
|
67
|
-
};
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
commands: {
|
|
78
|
+
setInsertAnimationEnabled: function setInsertAnimationEnabled(enabled) {
|
|
79
|
+
return function (_ref2) {
|
|
80
|
+
var tr = _ref2.tr;
|
|
81
|
+
return isExperimentEnabled('cwr_remix_animate_stream_only') ? tr.setMeta(pluginKey, {
|
|
82
|
+
type: 'UPDATE_STATE',
|
|
83
|
+
data: {
|
|
84
|
+
shouldAnimateInsertedContent: enabled
|
|
85
|
+
}
|
|
86
|
+
}).setMeta('addToHistory', false) : null;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
68
89
|
},
|
|
69
90
|
pmPlugins: function pmPlugins() {
|
|
70
91
|
return [{
|
|
71
92
|
name: 'extension',
|
|
72
|
-
plugin: function plugin(
|
|
73
|
-
var dispatch =
|
|
74
|
-
providerFactory =
|
|
75
|
-
portalProviderAPI =
|
|
76
|
-
eventDispatcher =
|
|
77
|
-
getIntl =
|
|
93
|
+
plugin: function plugin(_ref3) {
|
|
94
|
+
var dispatch = _ref3.dispatch,
|
|
95
|
+
providerFactory = _ref3.providerFactory,
|
|
96
|
+
portalProviderAPI = _ref3.portalProviderAPI,
|
|
97
|
+
eventDispatcher = _ref3.eventDispatcher,
|
|
98
|
+
getIntl = _ref3.getIntl;
|
|
78
99
|
var extensionHandlers = options.extensionHandlers || {};
|
|
79
100
|
return createPlugin(dispatch, providerFactory, extensionHandlers, extensionLoadingHandlers, portalProviderAPI, eventDispatcher, _api, options.useLongPressSelection, {
|
|
80
101
|
appearance: options.appearance,
|
|
@@ -111,9 +132,9 @@ export var extensionPlugin = function extensionPlugin(_ref) {
|
|
|
111
132
|
}
|
|
112
133
|
}, {
|
|
113
134
|
name: 'macro',
|
|
114
|
-
plugin: function plugin(
|
|
115
|
-
var dispatch =
|
|
116
|
-
providerFactory =
|
|
135
|
+
plugin: function plugin(_ref4) {
|
|
136
|
+
var dispatch = _ref4.dispatch,
|
|
137
|
+
providerFactory = _ref4.providerFactory;
|
|
117
138
|
return createMacroPlugin(dispatch, providerFactory);
|
|
118
139
|
}
|
|
119
140
|
}];
|
|
@@ -133,14 +154,14 @@ export var extensionPlugin = function extensionPlugin(_ref) {
|
|
|
133
154
|
return extensionLoadingHandlers;
|
|
134
155
|
},
|
|
135
156
|
insertMacroFromMacroBrowser: insertMacroFromMacroBrowser(_api === null || _api === void 0 || (_api$analytics2 = _api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions),
|
|
136
|
-
insertOrReplaceExtension: function insertOrReplaceExtension(
|
|
137
|
-
var editorView =
|
|
138
|
-
action =
|
|
139
|
-
attrs =
|
|
140
|
-
content =
|
|
141
|
-
position =
|
|
142
|
-
size =
|
|
143
|
-
tr =
|
|
157
|
+
insertOrReplaceExtension: function insertOrReplaceExtension(_ref5) {
|
|
158
|
+
var editorView = _ref5.editorView,
|
|
159
|
+
action = _ref5.action,
|
|
160
|
+
attrs = _ref5.attrs,
|
|
161
|
+
content = _ref5.content,
|
|
162
|
+
position = _ref5.position,
|
|
163
|
+
size = _ref5.size,
|
|
164
|
+
tr = _ref5.tr;
|
|
144
165
|
return _insertOrReplaceExtension({
|
|
145
166
|
editorView: editorView,
|
|
146
167
|
action: action,
|
|
@@ -151,14 +172,14 @@ export var extensionPlugin = function extensionPlugin(_ref) {
|
|
|
151
172
|
tr: tr
|
|
152
173
|
});
|
|
153
174
|
},
|
|
154
|
-
insertOrReplaceBodiedExtension: function insertOrReplaceBodiedExtension(
|
|
155
|
-
var editorView =
|
|
156
|
-
action =
|
|
157
|
-
attrs =
|
|
158
|
-
content =
|
|
159
|
-
position =
|
|
160
|
-
size =
|
|
161
|
-
tr =
|
|
175
|
+
insertOrReplaceBodiedExtension: function insertOrReplaceBodiedExtension(_ref6) {
|
|
176
|
+
var editorView = _ref6.editorView,
|
|
177
|
+
action = _ref6.action,
|
|
178
|
+
attrs = _ref6.attrs,
|
|
179
|
+
content = _ref6.content,
|
|
180
|
+
position = _ref6.position,
|
|
181
|
+
size = _ref6.size,
|
|
182
|
+
tr = _ref6.tr;
|
|
162
183
|
return _insertOrReplaceBodiedExtension({
|
|
163
184
|
editorView: editorView,
|
|
164
185
|
action: action,
|
|
@@ -174,9 +195,9 @@ export var extensionPlugin = function extensionPlugin(_ref) {
|
|
|
174
195
|
editorAnalyticsAPI: _api === null || _api === void 0 || (_api$analytics3 = _api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions,
|
|
175
196
|
applyChangeToContextPanel: _api === null || _api === void 0 || (_api$contextPanel4 = _api.contextPanel) === null || _api$contextPanel4 === void 0 ? void 0 : _api$contextPanel4.actions.applyChange
|
|
176
197
|
}),
|
|
177
|
-
registerExtensionLoadingHandler: function registerExtensionLoadingHandler(
|
|
178
|
-
var extensionType =
|
|
179
|
-
handler =
|
|
198
|
+
registerExtensionLoadingHandler: function registerExtensionLoadingHandler(_ref7) {
|
|
199
|
+
var extensionType = _ref7.extensionType,
|
|
200
|
+
handler = _ref7.handler;
|
|
180
201
|
extensionLoadingHandlers[extensionType] = handler;
|
|
181
202
|
return function () {
|
|
182
203
|
if (extensionLoadingHandlers[extensionType] === handler) {
|
|
@@ -200,8 +221,8 @@ export var extensionPlugin = function extensionPlugin(_ref) {
|
|
|
200
221
|
return (_editorViewRef$curren = editorViewRef.current) !== null && _editorViewRef$curren !== void 0 ? _editorViewRef$curren : undefined;
|
|
201
222
|
})(_api, featureFlags) : undefined
|
|
202
223
|
},
|
|
203
|
-
usePluginHook: showContextPanel ? function (
|
|
204
|
-
var editorView =
|
|
224
|
+
usePluginHook: showContextPanel ? function (_ref8) {
|
|
225
|
+
var editorView = _ref8.editorView;
|
|
205
226
|
useConfigPanelPluginHook({
|
|
206
227
|
api: _api,
|
|
207
228
|
configPanelId: configPanelId,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
3
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
3
6
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
7
|
import ExtensionNodeView from '@atlaskit/editor-common/extensionNodeView';
|
|
5
8
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
@@ -7,6 +10,7 @@ import { createSelectionClickHandler, isSelectionAtEndOfNode, isSelectionAtStart
|
|
|
7
10
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection/gap-cursor/selection';
|
|
8
11
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
9
12
|
import { findParentNodeOfTypeClosestToPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
13
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
10
14
|
import { clearEditingContext, updateState } from '../editor-commands/commands';
|
|
11
15
|
import { buildExtensionBlockTransforms } from './block-transforms';
|
|
12
16
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
@@ -184,15 +188,21 @@ export var createPlugin = function createPlugin(dispatch, providerFactory, exten
|
|
|
184
188
|
var featureFlags = arguments.length > 9 ? arguments[9] : undefined;
|
|
185
189
|
var __rendererExtensionOptions = arguments.length > 10 ? arguments[10] : undefined;
|
|
186
190
|
var intl = arguments.length > 11 ? arguments[11] : undefined;
|
|
187
|
-
var state = createPluginState(dispatch, {
|
|
191
|
+
var state = createPluginState(dispatch, _objectSpread(_objectSpread({}, isExperimentEnabled('cwr_remix_animate_stream_only') && {
|
|
192
|
+
shouldAnimateInsertedContent: false
|
|
193
|
+
}), {}, {
|
|
188
194
|
showEditButton: false,
|
|
189
195
|
showCopyButton: true,
|
|
190
196
|
showContextPanel: false
|
|
191
|
-
});
|
|
197
|
+
}));
|
|
192
198
|
var extensionNodeViewOptions = {
|
|
193
199
|
appearance: options.appearance,
|
|
194
200
|
getExtensionHeight: options.getExtensionHeight,
|
|
195
|
-
allowAIGeneratedContentMotion: options.allowAIGeneratedContentMotion
|
|
201
|
+
allowAIGeneratedContentMotion: options.allowAIGeneratedContentMotion,
|
|
202
|
+
shouldAnimateGeneratedContent: function shouldAnimateGeneratedContent() {
|
|
203
|
+
var _pluginInjectionApi$e, _pluginInjectionApi$e2;
|
|
204
|
+
return (_pluginInjectionApi$e = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e2 = pluginInjectionApi.extension) === null || _pluginInjectionApi$e2 === void 0 || (_pluginInjectionApi$e2 = _pluginInjectionApi$e2.sharedState.currentState()) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.shouldAnimateInsertedContent) !== null && _pluginInjectionApi$e !== void 0 ? _pluginInjectionApi$e : false;
|
|
205
|
+
}
|
|
196
206
|
};
|
|
197
207
|
var macroInteractionDesignFeatureFlags = {
|
|
198
208
|
showMacroInteractionDesignUpdates: (_featureFlags$macroIn = featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.macroInteractionUpdates) !== null && _featureFlags$macroIn !== void 0 ? _featureFlags$macroIn : false
|
|
@@ -6,6 +6,7 @@ import type { Parameters } from '@atlaskit/editor-common/extensions/extension-pa
|
|
|
6
6
|
import type { ExtensionProvider } from '@atlaskit/editor-common/extensions/extension-provider';
|
|
7
7
|
import type { MacroProvider } from '@atlaskit/editor-common/provider-factory/macro-provider';
|
|
8
8
|
import type { EditorAppearance } from '@atlaskit/editor-common/types/editor-appearance';
|
|
9
|
+
import type { EditorCommand } from '@atlaskit/editor-common/types/editor-command';
|
|
9
10
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types/next-editor-plugin';
|
|
10
11
|
import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types/selection';
|
|
11
12
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer/types';
|
|
@@ -35,6 +36,7 @@ export type ExtensionState<T extends Parameters = Parameters> = {
|
|
|
35
36
|
positions?: Record<number, number>;
|
|
36
37
|
processParametersAfter?: TransformAfter<T>;
|
|
37
38
|
processParametersBefore?: TransformBefore<T>;
|
|
39
|
+
shouldAnimateInsertedContent?: boolean;
|
|
38
40
|
showContextPanel: boolean;
|
|
39
41
|
showCopyButton: boolean;
|
|
40
42
|
showEditButton: boolean;
|
|
@@ -135,11 +137,16 @@ export type ExtensionPluginActions = {
|
|
|
135
137
|
};
|
|
136
138
|
export type ExtensionPlugin = NextEditorPlugin<'extension', {
|
|
137
139
|
actions: ExtensionPluginActions;
|
|
140
|
+
commands: {
|
|
141
|
+
/** Controls entrance motion for node views created while enabled. */
|
|
142
|
+
setInsertAnimationEnabled: (enabled: boolean) => EditorCommand;
|
|
143
|
+
};
|
|
138
144
|
dependencies: ExtensionPluginDependencies;
|
|
139
145
|
pluginConfiguration: ExtensionPluginOptions | undefined;
|
|
140
146
|
sharedState: {
|
|
141
147
|
extensionProvider?: ExtensionState['extensionProvider'];
|
|
142
148
|
processParametersAfter?: ExtensionState['processParametersAfter'];
|
|
149
|
+
shouldAnimateInsertedContent?: boolean;
|
|
143
150
|
showContextPanel: boolean | undefined;
|
|
144
151
|
} | undefined;
|
|
145
152
|
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-extension",
|
|
3
|
-
"version": "33.0
|
|
3
|
+
"version": "33.1.0",
|
|
4
4
|
"description": "editor-plugin-extension plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@atlaskit/editor-plugin-decorations": "^30.0.0",
|
|
46
46
|
"@atlaskit/editor-plugin-feature-flags": "^29.0.0",
|
|
47
47
|
"@atlaskit/editor-plugin-mentions": "^32.2.0",
|
|
48
|
-
"@atlaskit/editor-plugin-toolbar": "^27.
|
|
48
|
+
"@atlaskit/editor-plugin-toolbar": "^27.1.0",
|
|
49
49
|
"@atlaskit/editor-plugin-width": "^31.0.0",
|
|
50
50
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
51
51
|
"@atlaskit/editor-shared-styles": "^5.1.0",
|
|
@@ -85,12 +85,12 @@
|
|
|
85
85
|
"uuid": "^11.1.1"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
|
-
"@atlaskit/editor-common": "^134.
|
|
88
|
+
"@atlaskit/editor-common": "^134.18.0",
|
|
89
89
|
"react": "^18.2.0 || ^19.2.0",
|
|
90
90
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
|
-
"@atlaskit/editor-common": "^134.
|
|
93
|
+
"@atlaskit/editor-common": "^134.18.0",
|
|
94
94
|
"@atlassian/structured-docs-types": "workspace:^",
|
|
95
95
|
"@atlassian/workbench": "workspace:*",
|
|
96
96
|
"react": "^19.2.0",
|