@atlaskit/editor-plugin-extension 1.18.6 → 2.0.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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-plugin-extension
2
2
 
3
+ ## 2.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#166906](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/166906)
8
+ [`aac76c4a54baf`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/aac76c4a54baf) -
9
+ added **rendererExtensionOptions option to pass renderer extension handlers to extensions in
10
+ editor to allow displaying of renderer view for bodiedExtensions—optional not required. To use for
11
+ extension plugin, pass **rendererExtensionOptions to universal preset via its
12
+ initialPluginConfiguration prop. To use for referentialityPlugin, use \_\_rendererExtensionOptions
13
+ option. In a future release, changes will be added to use this new option. Note: option is not
14
+ fully supported currently and is intended for use for confluence live pages
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
3
20
  ## 1.18.6
4
21
 
5
22
  ### Patch Changes
@@ -70,7 +70,7 @@ var extensionPlugin = exports.extensionPlugin = function extensionPlugin(_ref) {
70
70
  var extensionHandlers = options.extensionHandlers || {};
71
71
  return (0, _main.createPlugin)(dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, _api, options.useLongPressSelection, {
72
72
  appearance: options.appearance
73
- }, featureFlags, options.allowDragAndDrop, options === null || options === void 0 ? void 0 : options.__livePage);
73
+ }, featureFlags, options.allowDragAndDrop, options === null || options === void 0 ? void 0 : options.__rendererExtensionOptions);
74
74
  }
75
75
  }, {
76
76
  name: 'extensionKeymap',
@@ -192,7 +192,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
192
192
  var options = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : {};
193
193
  var featureFlags = arguments.length > 8 ? arguments[8] : undefined;
194
194
  var allowDragAndDrop = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : true;
195
- var __livePage = arguments.length > 10 ? arguments[10] : undefined;
195
+ var __rendererExtensionOptions = arguments.length > 10 ? arguments[10] : undefined;
196
196
  var state = (0, _pluginFactory.createPluginState)(dispatch, {
197
197
  showEditButton: false,
198
198
  showContextPanel: false
@@ -204,7 +204,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
204
204
  showMacroInteractionDesignUpdates: (_featureFlags$macroIn = featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.macroInteractionUpdates) !== null && _featureFlags$macroIn !== void 0 ? _featureFlags$macroIn : false,
205
205
  showMacroButtonUpdates: (_featureFlags$macroIn2 = featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.macroInteractionButtonUpdates) !== null && _featureFlags$macroIn2 !== void 0 ? _featureFlags$macroIn2 : false
206
206
  };
207
- var showLivePagesBodiedMacrosRendererView = !!(__livePage && featureFlags !== null && featureFlags !== void 0 && featureFlags.livePagesBodiedMacrosRendererView);
207
+ var showLivePagesBodiedMacrosRendererView = __rendererExtensionOptions === null || __rendererExtensionOptions === void 0 ? void 0 : __rendererExtensionOptions.isAllowedToUseRendererView;
208
208
  return new _safePlugin.SafePlugin({
209
209
  state: state,
210
210
  view: function view(editorView) {
@@ -317,7 +317,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
317
317
  // WARNING: referentiality-plugin also creates these nodeviews
318
318
  extension: (0, _lazyExtension.lazyExtensionNodeView)('extension', portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi, macroInteractionDesignFeatureFlags),
319
319
  // WARNING: referentiality-plugin also creates these nodeviews
320
- bodiedExtension: (0, _lazyExtension.lazyExtensionNodeView)('bodiedExtension', portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi, macroInteractionDesignFeatureFlags, showLivePagesBodiedMacrosRendererView),
320
+ bodiedExtension: (0, _lazyExtension.lazyExtensionNodeView)('bodiedExtension', portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi, macroInteractionDesignFeatureFlags, showLivePagesBodiedMacrosRendererView, __rendererExtensionOptions === null || __rendererExtensionOptions === void 0 ? void 0 : __rendererExtensionOptions.rendererExtensionHandlers),
321
321
  // WARNING: referentiality-plugin also creates these nodeviews
322
322
  inlineExtension: (0, _lazyExtension.lazyExtensionNodeView)('inlineExtension', portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi, macroInteractionDesignFeatureFlags),
323
323
  multiBodiedExtension: (0, _lazyExtension.lazyExtensionNodeView)('multiBodiedExtension', portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi, macroInteractionDesignFeatureFlags)
@@ -64,7 +64,7 @@ export const extensionPlugin = ({
64
64
  const extensionHandlers = options.extensionHandlers || {};
65
65
  return createPlugin(dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, api, options.useLongPressSelection, {
66
66
  appearance: options.appearance
67
- }, featureFlags, options.allowDragAndDrop, options === null || options === void 0 ? void 0 : options.__livePage);
67
+ }, featureFlags, options.allowDragAndDrop, options === null || options === void 0 ? void 0 : options.__rendererExtensionOptions);
68
68
  }
69
69
  }, {
70
70
  name: 'extensionKeymap',
@@ -115,7 +115,7 @@ export const handleUpdate = ({
115
115
  }
116
116
  return true;
117
117
  };
118
- const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, pluginInjectionApi, useLongPressSelection = false, options = {}, featureFlags, allowDragAndDrop = true, __livePage) => {
118
+ const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, pluginInjectionApi, useLongPressSelection = false, options = {}, featureFlags, allowDragAndDrop = true, __rendererExtensionOptions) => {
119
119
  var _featureFlags$macroIn, _featureFlags$macroIn2;
120
120
  const state = createPluginState(dispatch, {
121
121
  showEditButton: false,
@@ -128,7 +128,7 @@ const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProvid
128
128
  showMacroInteractionDesignUpdates: (_featureFlags$macroIn = featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.macroInteractionUpdates) !== null && _featureFlags$macroIn !== void 0 ? _featureFlags$macroIn : false,
129
129
  showMacroButtonUpdates: (_featureFlags$macroIn2 = featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.macroInteractionButtonUpdates) !== null && _featureFlags$macroIn2 !== void 0 ? _featureFlags$macroIn2 : false
130
130
  };
131
- const showLivePagesBodiedMacrosRendererView = !!(__livePage && featureFlags !== null && featureFlags !== void 0 && featureFlags.livePagesBodiedMacrosRendererView);
131
+ const showLivePagesBodiedMacrosRendererView = __rendererExtensionOptions === null || __rendererExtensionOptions === void 0 ? void 0 : __rendererExtensionOptions.isAllowedToUseRendererView;
132
132
  return new SafePlugin({
133
133
  state,
134
134
  view: editorView => {
@@ -250,7 +250,7 @@ const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProvid
250
250
  // WARNING: referentiality-plugin also creates these nodeviews
251
251
  extension: lazyExtensionNodeView('extension', portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi, macroInteractionDesignFeatureFlags),
252
252
  // WARNING: referentiality-plugin also creates these nodeviews
253
- bodiedExtension: lazyExtensionNodeView('bodiedExtension', portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi, macroInteractionDesignFeatureFlags, showLivePagesBodiedMacrosRendererView),
253
+ bodiedExtension: lazyExtensionNodeView('bodiedExtension', portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi, macroInteractionDesignFeatureFlags, showLivePagesBodiedMacrosRendererView, __rendererExtensionOptions === null || __rendererExtensionOptions === void 0 ? void 0 : __rendererExtensionOptions.rendererExtensionHandlers),
254
254
  // WARNING: referentiality-plugin also creates these nodeviews
255
255
  inlineExtension: lazyExtensionNodeView('inlineExtension', portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi, macroInteractionDesignFeatureFlags),
256
256
  multiBodiedExtension: lazyExtensionNodeView('multiBodiedExtension', portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi, macroInteractionDesignFeatureFlags)
@@ -63,7 +63,7 @@ export var extensionPlugin = function extensionPlugin(_ref) {
63
63
  var extensionHandlers = options.extensionHandlers || {};
64
64
  return createPlugin(dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, _api, options.useLongPressSelection, {
65
65
  appearance: options.appearance
66
- }, featureFlags, options.allowDragAndDrop, options === null || options === void 0 ? void 0 : options.__livePage);
66
+ }, featureFlags, options.allowDragAndDrop, options === null || options === void 0 ? void 0 : options.__rendererExtensionOptions);
67
67
  }
68
68
  }, {
69
69
  name: 'extensionKeymap',
@@ -166,7 +166,7 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
166
166
  var options = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : {};
167
167
  var featureFlags = arguments.length > 8 ? arguments[8] : undefined;
168
168
  var allowDragAndDrop = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : true;
169
- var __livePage = arguments.length > 10 ? arguments[10] : undefined;
169
+ var __rendererExtensionOptions = arguments.length > 10 ? arguments[10] : undefined;
170
170
  var state = createPluginState(dispatch, {
171
171
  showEditButton: false,
172
172
  showContextPanel: false
@@ -178,7 +178,7 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
178
178
  showMacroInteractionDesignUpdates: (_featureFlags$macroIn = featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.macroInteractionUpdates) !== null && _featureFlags$macroIn !== void 0 ? _featureFlags$macroIn : false,
179
179
  showMacroButtonUpdates: (_featureFlags$macroIn2 = featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.macroInteractionButtonUpdates) !== null && _featureFlags$macroIn2 !== void 0 ? _featureFlags$macroIn2 : false
180
180
  };
181
- var showLivePagesBodiedMacrosRendererView = !!(__livePage && featureFlags !== null && featureFlags !== void 0 && featureFlags.livePagesBodiedMacrosRendererView);
181
+ var showLivePagesBodiedMacrosRendererView = __rendererExtensionOptions === null || __rendererExtensionOptions === void 0 ? void 0 : __rendererExtensionOptions.isAllowedToUseRendererView;
182
182
  return new SafePlugin({
183
183
  state: state,
184
184
  view: function view(editorView) {
@@ -291,7 +291,7 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
291
291
  // WARNING: referentiality-plugin also creates these nodeviews
292
292
  extension: lazyExtensionNodeView('extension', portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi, macroInteractionDesignFeatureFlags),
293
293
  // WARNING: referentiality-plugin also creates these nodeviews
294
- bodiedExtension: lazyExtensionNodeView('bodiedExtension', portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi, macroInteractionDesignFeatureFlags, showLivePagesBodiedMacrosRendererView),
294
+ bodiedExtension: lazyExtensionNodeView('bodiedExtension', portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi, macroInteractionDesignFeatureFlags, showLivePagesBodiedMacrosRendererView, __rendererExtensionOptions === null || __rendererExtensionOptions === void 0 ? void 0 : __rendererExtensionOptions.rendererExtensionHandlers),
295
295
  // WARNING: referentiality-plugin also creates these nodeviews
296
296
  inlineExtension: lazyExtensionNodeView('inlineExtension', portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi, macroInteractionDesignFeatureFlags),
297
297
  multiBodiedExtension: lazyExtensionNodeView('multiBodiedExtension', portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi, macroInteractionDesignFeatureFlags)
@@ -9,7 +9,7 @@ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
9
9
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
10
10
  import { createCommand, getPluginState } from '../plugin-factory';
11
11
  import { pluginKey } from '../plugin-key';
12
- import type { ExtensionPlugin } from '../types';
12
+ import type { ExtensionPlugin, ExtensionPluginOptions } from '../types';
13
13
  export declare const createExtensionProviderHandler: (view: EditorView) => (name: string, provider?: Promise<ExtensionProvider>) => Promise<void>;
14
14
  export declare const handleUpdate: ({ view, prevState, domAtPos, extensionHandlers, applyChange, }: {
15
15
  view: EditorView;
@@ -20,5 +20,5 @@ export declare const handleUpdate: ({ view, prevState, domAtPos, extensionHandle
20
20
  }) => true | undefined;
21
21
  declare const createPlugin: (dispatch: Dispatch, providerFactory: ProviderFactory, extensionHandlers: ExtensionHandlers, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginInjectionApi: ExtractInjectionAPI<ExtensionPlugin> | undefined, useLongPressSelection?: boolean, options?: {
22
22
  appearance?: EditorAppearance;
23
- }, featureFlags?: FeatureFlags, allowDragAndDrop?: boolean, __livePage?: boolean) => SafePlugin<import("../types").ExtensionState>;
23
+ }, featureFlags?: FeatureFlags, allowDragAndDrop?: boolean, __rendererExtensionOptions?: ExtensionPluginOptions['__rendererExtensionOptions']) => SafePlugin<import("../types").ExtensionState>;
24
24
  export { pluginKey, createPlugin, createCommand, getPluginState };
@@ -1,3 +1,4 @@
1
+ import type { ADFEntity } from '@atlaskit/adf-utils/types';
1
2
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
3
  import type { ExtensionAPI, ExtensionHandlers, ExtensionProvider, Parameters, TransformAfter, TransformBefore, UpdateExtension } from '@atlaskit/editor-common/extensions';
3
4
  import type { MacroProvider } from '@atlaskit/editor-common/provider-factory';
@@ -42,7 +43,10 @@ export interface ExtensionPluginOptions extends LongPressSelectionPluginOptions
42
43
  extensionHandlers?: ExtensionHandlers;
43
44
  appearance?: EditorAppearance;
44
45
  allowDragAndDrop?: boolean;
45
- __livePage?: boolean;
46
+ __rendererExtensionOptions?: {
47
+ rendererExtensionHandlers?: ExtensionHandlers;
48
+ isAllowedToUseRendererView: (node: ADFEntity) => boolean;
49
+ };
46
50
  }
47
51
  type InsertMacroFromMacroBrowser = (macroProvider: MacroProvider, macroNode?: PmNode, isEditing?: boolean) => (view: EditorView) => Promise<boolean>;
48
52
  export type RunMacroAutoConvert = (state: EditorState, text: string) => PmNode | null;
@@ -9,7 +9,7 @@ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
9
9
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
10
10
  import { createCommand, getPluginState } from '../plugin-factory';
11
11
  import { pluginKey } from '../plugin-key';
12
- import type { ExtensionPlugin } from '../types';
12
+ import type { ExtensionPlugin, ExtensionPluginOptions } from '../types';
13
13
  export declare const createExtensionProviderHandler: (view: EditorView) => (name: string, provider?: Promise<ExtensionProvider>) => Promise<void>;
14
14
  export declare const handleUpdate: ({ view, prevState, domAtPos, extensionHandlers, applyChange, }: {
15
15
  view: EditorView;
@@ -20,5 +20,5 @@ export declare const handleUpdate: ({ view, prevState, domAtPos, extensionHandle
20
20
  }) => true | undefined;
21
21
  declare const createPlugin: (dispatch: Dispatch, providerFactory: ProviderFactory, extensionHandlers: ExtensionHandlers, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginInjectionApi: ExtractInjectionAPI<ExtensionPlugin> | undefined, useLongPressSelection?: boolean, options?: {
22
22
  appearance?: EditorAppearance;
23
- }, featureFlags?: FeatureFlags, allowDragAndDrop?: boolean, __livePage?: boolean) => SafePlugin<import("../types").ExtensionState>;
23
+ }, featureFlags?: FeatureFlags, allowDragAndDrop?: boolean, __rendererExtensionOptions?: ExtensionPluginOptions['__rendererExtensionOptions']) => SafePlugin<import("../types").ExtensionState>;
24
24
  export { pluginKey, createPlugin, createCommand, getPluginState };
@@ -1,3 +1,4 @@
1
+ import type { ADFEntity } from '@atlaskit/adf-utils/types';
1
2
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
3
  import type { ExtensionAPI, ExtensionHandlers, ExtensionProvider, Parameters, TransformAfter, TransformBefore, UpdateExtension } from '@atlaskit/editor-common/extensions';
3
4
  import type { MacroProvider } from '@atlaskit/editor-common/provider-factory';
@@ -42,7 +43,10 @@ export interface ExtensionPluginOptions extends LongPressSelectionPluginOptions
42
43
  extensionHandlers?: ExtensionHandlers;
43
44
  appearance?: EditorAppearance;
44
45
  allowDragAndDrop?: boolean;
45
- __livePage?: boolean;
46
+ __rendererExtensionOptions?: {
47
+ rendererExtensionHandlers?: ExtensionHandlers;
48
+ isAllowedToUseRendererView: (node: ADFEntity) => boolean;
49
+ };
46
50
  }
47
51
  type InsertMacroFromMacroBrowser = (macroProvider: MacroProvider, macroNode?: PmNode, isEditing?: boolean) => (view: EditorView) => Promise<boolean>;
48
52
  export type RunMacroAutoConvert = (state: EditorState, text: string) => PmNode | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-extension",
3
- "version": "1.18.6",
3
+ "version": "2.0.0",
4
4
  "description": "editor-plugin-extension plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -30,7 +30,7 @@
30
30
  "@atlaskit/button": "^20.3.0",
31
31
  "@atlaskit/checkbox": "^15.2.0",
32
32
  "@atlaskit/datetime-picker": "^15.9.0",
33
- "@atlaskit/editor-common": "^95.10.0",
33
+ "@atlaskit/editor-common": "^96.0.0",
34
34
  "@atlaskit/editor-json-transformer": "^8.21.0",
35
35
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
36
36
  "@atlaskit/editor-plugin-context-identifier": "^1.3.0",