@atlaskit/editor-plugin-extension 3.3.0 → 3.5.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,30 @@
1
1
  # @atlaskit/editor-plugin-extension
2
2
 
3
+ ## 3.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#113205](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/113205)
8
+ [`74786973d6de2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/74786973d6de2) -
9
+ ED-26443 LCM: Add scrollIntoView option on extension API 'update' function. This allows you to
10
+ disable scrollIntoView.
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
16
+ ## 3.4.0
17
+
18
+ ### Minor Changes
19
+
20
+ - [#111831](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/111831)
21
+ [`66895944dfac9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/66895944dfac9) -
22
+ [ED-26430] Block drag-and-drop of legacy content macro extension
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies
27
+
3
28
  ## 3.3.0
4
29
 
5
30
  ### Minor Changes
@@ -72,7 +72,7 @@ var extensionPlugin = exports.extensionPlugin = function extensionPlugin(_ref) {
72
72
  var extensionHandlers = options.extensionHandlers || {};
73
73
  return (0, _main.createPlugin)(dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, _api, options.useLongPressSelection, {
74
74
  appearance: options.appearance
75
- }, featureFlags, options.allowDragAndDrop, options === null || options === void 0 ? void 0 : options.__rendererExtensionOptions);
75
+ }, featureFlags, options === null || options === void 0 ? void 0 : options.__rendererExtensionOptions);
76
76
  }
77
77
  }, {
78
78
  name: 'extensionKeymap',
@@ -14,6 +14,7 @@ var _editorJsonTransformer = require("@atlaskit/editor-json-transformer");
14
14
  var _model = require("@atlaskit/editor-prosemirror/model");
15
15
  var _state = require("@atlaskit/editor-prosemirror/state");
16
16
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
17
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
18
  var _commands = require("../editor-commands/commands");
18
19
  var _actions = require("./macro/actions");
19
20
  var _pluginKey = require("./macro/plugin-key");
@@ -259,6 +260,9 @@ var createExtensionAPI = exports.createExtensionAPI = function createExtensionAP
259
260
  if (typeof (opts === null || opts === void 0 ? void 0 : opts.addToHistory) === 'boolean') {
260
261
  tr.setMeta('addToHistory', opts.addToHistory);
261
262
  }
263
+ if (typeof (opts === null || opts === void 0 ? void 0 : opts.scrollIntoView) === 'boolean' && (0, _platformFeatureFlags.fg)('platform_editor_legacy_content_macro')) {
264
+ tr.setMeta('scrollIntoView', opts.scrollIntoView);
265
+ }
262
266
  dispatch(tr);
263
267
  }
264
268
  };
@@ -172,8 +172,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
172
172
  var useLongPressSelection = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
173
173
  var options = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : {};
174
174
  var featureFlags = arguments.length > 8 ? arguments[8] : undefined;
175
- var allowDragAndDrop = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : true;
176
- var __rendererExtensionOptions = arguments.length > 10 ? arguments[10] : undefined;
175
+ var __rendererExtensionOptions = arguments.length > 9 ? arguments[9] : undefined;
177
176
  var state = (0, _pluginFactory.createPluginState)(dispatch, {
178
177
  showEditButton: false,
179
178
  showContextPanel: false
@@ -316,19 +315,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
316
315
  // It's to enable nested extensions selection
317
316
  {
318
317
  useLongPressSelection: useLongPressSelection
319
- }),
320
- handleDrop: function handleDrop(view, event, slice, moved) {
321
- if ((0, _platformFeatureFlags.fg)('platform_editor_legacy_content_macro')) {
322
- if (!allowDragAndDrop) {
323
- var _slice$content$firstC;
324
- // Completely disable DND for extension nodes when allowDragAndDrop is false
325
- var isExtension = slice.content.childCount === 1 && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === view.state.schema.nodes.extension;
326
- return isExtension;
327
- }
328
- return false;
329
- }
330
- return false;
331
- }
318
+ })
332
319
  }
333
320
  });
334
321
  };
@@ -66,7 +66,7 @@ export const extensionPlugin = ({
66
66
  const extensionHandlers = options.extensionHandlers || {};
67
67
  return createPlugin(dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, api, options.useLongPressSelection, {
68
68
  appearance: options.appearance
69
- }, featureFlags, options.allowDragAndDrop, options === null || options === void 0 ? void 0 : options.__rendererExtensionOptions);
69
+ }, featureFlags, options === null || options === void 0 ? void 0 : options.__rendererExtensionOptions);
70
70
  }
71
71
  }, {
72
72
  name: 'extensionKeymap',
@@ -5,6 +5,7 @@ import { JSONTransformer } from '@atlaskit/editor-json-transformer';
5
5
  import { Fragment, Mark } from '@atlaskit/editor-prosemirror/model';
6
6
  import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { setTextSelection } from '@atlaskit/editor-prosemirror/utils';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
8
9
  import { setEditingContextToContextPanel } from '../editor-commands/commands';
9
10
  import { insertMacroFromMacroBrowser } from './macro/actions';
10
11
  import { pluginKey as macroPluginKey } from './macro/plugin-key';
@@ -277,6 +278,9 @@ export const createExtensionAPI = options => {
277
278
  if (typeof (opts === null || opts === void 0 ? void 0 : opts.addToHistory) === 'boolean') {
278
279
  tr.setMeta('addToHistory', opts.addToHistory);
279
280
  }
281
+ if (typeof (opts === null || opts === void 0 ? void 0 : opts.scrollIntoView) === 'boolean' && fg('platform_editor_legacy_content_macro')) {
282
+ tr.setMeta('scrollIntoView', opts.scrollIntoView);
283
+ }
280
284
  dispatch(tr);
281
285
  }
282
286
  };
@@ -115,7 +115,7 @@ export const handleUpdate = ({
115
115
  }
116
116
  return true;
117
117
  };
118
- export const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, pluginInjectionApi, useLongPressSelection = false, options = {}, featureFlags, allowDragAndDrop = true, __rendererExtensionOptions) => {
118
+ export const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, pluginInjectionApi, useLongPressSelection = false, options = {}, featureFlags, __rendererExtensionOptions) => {
119
119
  var _featureFlags$macroIn;
120
120
  const state = createPluginState(dispatch, {
121
121
  showEditButton: false,
@@ -269,19 +269,7 @@ export const createPlugin = (dispatch, providerFactory, extensionHandlers, porta
269
269
  // It's to enable nested extensions selection
270
270
  {
271
271
  useLongPressSelection
272
- }),
273
- handleDrop(view, event, slice, moved) {
274
- if (fg('platform_editor_legacy_content_macro')) {
275
- if (!allowDragAndDrop) {
276
- var _slice$content$firstC;
277
- // Completely disable DND for extension nodes when allowDragAndDrop is false
278
- const isExtension = slice.content.childCount === 1 && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === view.state.schema.nodes.extension;
279
- return isExtension;
280
- }
281
- return false;
282
- }
283
- return false;
284
- }
272
+ })
285
273
  }
286
274
  });
287
275
  };
@@ -65,7 +65,7 @@ export var extensionPlugin = function extensionPlugin(_ref) {
65
65
  var extensionHandlers = options.extensionHandlers || {};
66
66
  return createPlugin(dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, _api, options.useLongPressSelection, {
67
67
  appearance: options.appearance
68
- }, featureFlags, options.allowDragAndDrop, options === null || options === void 0 ? void 0 : options.__rendererExtensionOptions);
68
+ }, featureFlags, options === null || options === void 0 ? void 0 : options.__rendererExtensionOptions);
69
69
  }
70
70
  }, {
71
71
  name: 'extensionKeymap',
@@ -9,6 +9,7 @@ import { JSONTransformer } from '@atlaskit/editor-json-transformer';
9
9
  import { Fragment, Mark } from '@atlaskit/editor-prosemirror/model';
10
10
  import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
11
11
  import { setTextSelection } from '@atlaskit/editor-prosemirror/utils';
12
+ import { fg } from '@atlaskit/platform-feature-flags';
12
13
  import { setEditingContextToContextPanel } from '../editor-commands/commands';
13
14
  import { insertMacroFromMacroBrowser } from './macro/actions';
14
15
  import { pluginKey as macroPluginKey } from './macro/plugin-key';
@@ -252,6 +253,9 @@ export var createExtensionAPI = function createExtensionAPI(options) {
252
253
  if (typeof (opts === null || opts === void 0 ? void 0 : opts.addToHistory) === 'boolean') {
253
254
  tr.setMeta('addToHistory', opts.addToHistory);
254
255
  }
256
+ if (typeof (opts === null || opts === void 0 ? void 0 : opts.scrollIntoView) === 'boolean' && fg('platform_editor_legacy_content_macro')) {
257
+ tr.setMeta('scrollIntoView', opts.scrollIntoView);
258
+ }
255
259
  dispatch(tr);
256
260
  }
257
261
  };
@@ -165,8 +165,7 @@ export var createPlugin = function createPlugin(dispatch, providerFactory, exten
165
165
  var useLongPressSelection = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
166
166
  var options = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : {};
167
167
  var featureFlags = arguments.length > 8 ? arguments[8] : undefined;
168
- var allowDragAndDrop = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : true;
169
- var __rendererExtensionOptions = arguments.length > 10 ? arguments[10] : undefined;
168
+ var __rendererExtensionOptions = arguments.length > 9 ? arguments[9] : undefined;
170
169
  var state = createPluginState(dispatch, {
171
170
  showEditButton: false,
172
171
  showContextPanel: false
@@ -309,19 +308,7 @@ export var createPlugin = function createPlugin(dispatch, providerFactory, exten
309
308
  // It's to enable nested extensions selection
310
309
  {
311
310
  useLongPressSelection: useLongPressSelection
312
- }),
313
- handleDrop: function handleDrop(view, event, slice, moved) {
314
- if (fg('platform_editor_legacy_content_macro')) {
315
- if (!allowDragAndDrop) {
316
- var _slice$content$firstC;
317
- // Completely disable DND for extension nodes when allowDragAndDrop is false
318
- var isExtension = slice.content.childCount === 1 && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === view.state.schema.nodes.extension;
319
- return isExtension;
320
- }
321
- return false;
322
- }
323
- return false;
324
- }
311
+ })
325
312
  }
326
313
  });
327
314
  };
@@ -42,7 +42,6 @@ export interface ExtensionPluginOptions extends LongPressSelectionPluginOptions
42
42
  breakoutEnabled?: boolean;
43
43
  extensionHandlers?: ExtensionHandlers;
44
44
  appearance?: EditorAppearance;
45
- allowDragAndDrop?: boolean;
46
45
  __rendererExtensionOptions?: {
47
46
  rendererExtensionHandlers?: ExtensionHandlers;
48
47
  isAllowedToUseRendererView: (node: ADFEntity) => boolean;
@@ -18,4 +18,4 @@ export declare const handleUpdate: ({ view, prevState, domAtPos, extensionHandle
18
18
  }) => true | undefined;
19
19
  export declare const createPlugin: (dispatch: Dispatch, providerFactory: ProviderFactory, extensionHandlers: ExtensionHandlers, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginInjectionApi: ExtractInjectionAPI<ExtensionPlugin> | undefined, useLongPressSelection?: boolean, options?: {
20
20
  appearance?: EditorAppearance;
21
- }, featureFlags?: FeatureFlags, allowDragAndDrop?: boolean, __rendererExtensionOptions?: ExtensionPluginOptions['__rendererExtensionOptions']) => SafePlugin<import("../extensionPluginType").ExtensionState>;
21
+ }, featureFlags?: FeatureFlags, __rendererExtensionOptions?: ExtensionPluginOptions['__rendererExtensionOptions']) => SafePlugin<import("../extensionPluginType").ExtensionState>;
@@ -42,7 +42,6 @@ export interface ExtensionPluginOptions extends LongPressSelectionPluginOptions
42
42
  breakoutEnabled?: boolean;
43
43
  extensionHandlers?: ExtensionHandlers;
44
44
  appearance?: EditorAppearance;
45
- allowDragAndDrop?: boolean;
46
45
  __rendererExtensionOptions?: {
47
46
  rendererExtensionHandlers?: ExtensionHandlers;
48
47
  isAllowedToUseRendererView: (node: ADFEntity) => boolean;
@@ -18,4 +18,4 @@ export declare const handleUpdate: ({ view, prevState, domAtPos, extensionHandle
18
18
  }) => true | undefined;
19
19
  export declare const createPlugin: (dispatch: Dispatch, providerFactory: ProviderFactory, extensionHandlers: ExtensionHandlers, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginInjectionApi: ExtractInjectionAPI<ExtensionPlugin> | undefined, useLongPressSelection?: boolean, options?: {
20
20
  appearance?: EditorAppearance;
21
- }, featureFlags?: FeatureFlags, allowDragAndDrop?: boolean, __rendererExtensionOptions?: ExtensionPluginOptions['__rendererExtensionOptions']) => SafePlugin<import("../extensionPluginType").ExtensionState>;
21
+ }, featureFlags?: FeatureFlags, __rendererExtensionOptions?: ExtensionPluginOptions['__rendererExtensionOptions']) => SafePlugin<import("../extensionPluginType").ExtensionState>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-extension",
3
- "version": "3.3.0",
3
+ "version": "3.5.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.5.0",
31
31
  "@atlaskit/checkbox": "^15.3.0",
32
32
  "@atlaskit/datetime-picker": "^15.12.0",
33
- "@atlaskit/editor-common": "^99.11.0",
33
+ "@atlaskit/editor-common": "^99.13.0",
34
34
  "@atlaskit/editor-json-transformer": "^8.23.0",
35
35
  "@atlaskit/editor-plugin-analytics": "^1.12.0",
36
36
  "@atlaskit/editor-plugin-context-identifier": "^1.4.0",