@atlaskit/editor-plugin-extension 1.17.3 → 1.18.1

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,27 @@
1
1
  # @atlaskit/editor-plugin-extension
2
2
 
3
+ ## 1.18.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#165765](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/165765)
8
+ [`3f441f30e6507`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3f441f30e6507) -
9
+ Bump adf-schema to 46.0.0
10
+ - Updated dependencies
11
+
12
+ ## 1.18.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [#161325](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/161325)
17
+ [`69312480d1ccc`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/69312480d1ccc) -
18
+ [ux] [ED-25381] add drag and drop disabling and skipValidation options to editor to enable nested
19
+ legacy content editor
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies
24
+
3
25
  ## 1.17.3
4
26
 
5
27
  ### 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 === null || options === void 0 ? void 0 : options.__livePage);
73
+ }, featureFlags, options.allowDragAndDrop, options === null || options === void 0 ? void 0 : options.__livePage);
74
74
  }
75
75
  }, {
76
76
  name: 'extensionKeymap',
@@ -31,6 +31,7 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
31
31
  var _selection2 = require("@atlaskit/editor-common/selection");
32
32
  var _state = require("@atlaskit/editor-prosemirror/state");
33
33
  var _utils = require("@atlaskit/editor-prosemirror/utils");
34
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
34
35
  var _commands = require("../commands");
35
36
  var _lazyExtension = require("../nodeviews/lazyExtension");
36
37
  var _pluginFactory = require("../plugin-factory");
@@ -190,7 +191,8 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
190
191
  var useLongPressSelection = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
191
192
  var options = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : {};
192
193
  var featureFlags = arguments.length > 8 ? arguments[8] : undefined;
193
- var __livePage = arguments.length > 9 ? arguments[9] : undefined;
194
+ var allowDragAndDrop = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : true;
195
+ var __livePage = arguments.length > 10 ? arguments[10] : undefined;
194
196
  var state = (0, _pluginFactory.createPluginState)(dispatch, {
195
197
  showEditButton: false,
196
198
  showContextPanel: false
@@ -329,10 +331,21 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
329
331
  return null;
330
332
  },
331
333
  handleClickOn: (0, _selection2.createSelectionClickHandler)(['extension', 'bodiedExtension', 'multiBodiedExtension'], function (target) {
332
- return !target.closest('.extension-content');
333
- }, {
334
+ return (0, _platformFeatureFlags.fg)('platform_editor_legacy_content_macro') ? !!target.closest('.extension-container') : !target.closest('.extension-content');
335
+ },
336
+ // It's to enable nested extensions selection
337
+ {
334
338
  useLongPressSelection: useLongPressSelection
335
- })
339
+ }),
340
+ handleDrop: function handleDrop(view, event, slice, moved) {
341
+ if (!allowDragAndDrop) {
342
+ var _slice$content$firstC;
343
+ // Completely disable DND for extension nodes when allowDragAndDrop is false
344
+ 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;
345
+ return isExtension;
346
+ }
347
+ return true;
348
+ }
336
349
  }
337
350
  });
338
351
  };
@@ -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 === null || options === void 0 ? void 0 : options.__livePage);
67
+ }, featureFlags, options.allowDragAndDrop, options === null || options === void 0 ? void 0 : options.__livePage);
68
68
  }
69
69
  }, {
70
70
  name: 'extensionKeymap',
@@ -2,6 +2,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { createSelectionClickHandler, GapCursorSelection, isSelectionAtEndOfNode, isSelectionAtStartOfNode } from '@atlaskit/editor-common/selection';
3
3
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { findParentNodeOfTypeClosestToPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
5
6
  import { clearEditingContext, updateState } from '../commands';
6
7
  import { lazyExtensionNodeView } from '../nodeviews/lazyExtension';
7
8
  import { createCommand, createPluginState, getPluginState } from '../plugin-factory';
@@ -114,7 +115,7 @@ export const handleUpdate = ({
114
115
  }
115
116
  return true;
116
117
  };
117
- const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, pluginInjectionApi, useLongPressSelection = false, options = {}, featureFlags, __livePage) => {
118
+ const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, pluginInjectionApi, useLongPressSelection = false, options = {}, featureFlags, allowDragAndDrop = true, __livePage) => {
118
119
  var _featureFlags$macroIn, _featureFlags$macroIn2;
119
120
  const state = createPluginState(dispatch, {
120
121
  showEditButton: false,
@@ -265,9 +266,20 @@ const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProvid
265
266
  }
266
267
  return null;
267
268
  },
268
- handleClickOn: createSelectionClickHandler(['extension', 'bodiedExtension', 'multiBodiedExtension'], target => !target.closest('.extension-content'), {
269
+ handleClickOn: createSelectionClickHandler(['extension', 'bodiedExtension', 'multiBodiedExtension'], target => fg('platform_editor_legacy_content_macro') ? !!target.closest('.extension-container') : !target.closest('.extension-content'),
270
+ // It's to enable nested extensions selection
271
+ {
269
272
  useLongPressSelection
270
- })
273
+ }),
274
+ handleDrop(view, event, slice, moved) {
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 true;
282
+ }
271
283
  }
272
284
  });
273
285
  };
@@ -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 === null || options === void 0 ? void 0 : options.__livePage);
66
+ }, featureFlags, options.allowDragAndDrop, options === null || options === void 0 ? void 0 : options.__livePage);
67
67
  }
68
68
  }, {
69
69
  name: 'extensionKeymap',
@@ -5,6 +5,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
5
  import { createSelectionClickHandler, GapCursorSelection, isSelectionAtEndOfNode, isSelectionAtStartOfNode } from '@atlaskit/editor-common/selection';
6
6
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { findParentNodeOfTypeClosestToPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
8
9
  import { clearEditingContext, updateState } from '../commands';
9
10
  import { lazyExtensionNodeView } from '../nodeviews/lazyExtension';
10
11
  import { createCommand, createPluginState, getPluginState } from '../plugin-factory';
@@ -164,7 +165,8 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
164
165
  var useLongPressSelection = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
165
166
  var options = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : {};
166
167
  var featureFlags = arguments.length > 8 ? arguments[8] : undefined;
167
- var __livePage = arguments.length > 9 ? arguments[9] : undefined;
168
+ var allowDragAndDrop = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : true;
169
+ var __livePage = arguments.length > 10 ? arguments[10] : undefined;
168
170
  var state = createPluginState(dispatch, {
169
171
  showEditButton: false,
170
172
  showContextPanel: false
@@ -303,10 +305,21 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
303
305
  return null;
304
306
  },
305
307
  handleClickOn: createSelectionClickHandler(['extension', 'bodiedExtension', 'multiBodiedExtension'], function (target) {
306
- return !target.closest('.extension-content');
307
- }, {
308
+ return fg('platform_editor_legacy_content_macro') ? !!target.closest('.extension-container') : !target.closest('.extension-content');
309
+ },
310
+ // It's to enable nested extensions selection
311
+ {
308
312
  useLongPressSelection: useLongPressSelection
309
- })
313
+ }),
314
+ handleDrop: function handleDrop(view, event, slice, moved) {
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 true;
322
+ }
310
323
  }
311
324
  });
312
325
  };
@@ -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, __livePage?: boolean) => SafePlugin<import("../types").ExtensionState>;
23
+ }, featureFlags?: FeatureFlags, allowDragAndDrop?: boolean, __livePage?: boolean) => SafePlugin<import("../types").ExtensionState>;
24
24
  export { pluginKey, createPlugin, createCommand, getPluginState };
@@ -41,6 +41,7 @@ export interface ExtensionPluginOptions extends LongPressSelectionPluginOptions
41
41
  breakoutEnabled?: boolean;
42
42
  extensionHandlers?: ExtensionHandlers;
43
43
  appearance?: EditorAppearance;
44
+ allowDragAndDrop?: boolean;
44
45
  __livePage?: boolean;
45
46
  }
46
47
  type InsertMacroFromMacroBrowser = (macroProvider: MacroProvider, macroNode?: PmNode, isEditing?: boolean) => (view: EditorView) => Promise<boolean>;
@@ -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, __livePage?: boolean) => SafePlugin<import("../types").ExtensionState>;
23
+ }, featureFlags?: FeatureFlags, allowDragAndDrop?: boolean, __livePage?: boolean) => SafePlugin<import("../types").ExtensionState>;
24
24
  export { pluginKey, createPlugin, createCommand, getPluginState };
@@ -41,6 +41,7 @@ export interface ExtensionPluginOptions extends LongPressSelectionPluginOptions
41
41
  breakoutEnabled?: boolean;
42
42
  extensionHandlers?: ExtensionHandlers;
43
43
  appearance?: EditorAppearance;
44
+ allowDragAndDrop?: boolean;
44
45
  __livePage?: boolean;
45
46
  }
46
47
  type InsertMacroFromMacroBrowser = (macroProvider: MacroProvider, macroNode?: PmNode, isEditing?: boolean) => (view: EditorView) => Promise<boolean>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-extension",
3
- "version": "1.17.3",
3
+ "version": "1.18.1",
4
4
  "description": "editor-plugin-extension plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -23,14 +23,14 @@
23
23
  ".": "./src/index.ts"
24
24
  },
25
25
  "dependencies": {
26
- "@atlaskit/adf-schema": "^44.2.0",
26
+ "@atlaskit/adf-schema": "^46.1.0",
27
27
  "@atlaskit/adf-utils": "^19.13.0",
28
28
  "@atlaskit/analytics-next": "^10.1.0",
29
29
  "@atlaskit/avatar": "^21.17.0",
30
30
  "@atlaskit/button": "^20.3.0",
31
- "@atlaskit/checkbox": "^15.1.0",
31
+ "@atlaskit/checkbox": "^15.2.0",
32
32
  "@atlaskit/datetime-picker": "^15.9.0",
33
- "@atlaskit/editor-common": "^95.0.0",
33
+ "@atlaskit/editor-common": "^95.7.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",
@@ -44,19 +44,19 @@
44
44
  "@atlaskit/empty-state": "^7.12.0",
45
45
  "@atlaskit/form": "^10.5.0",
46
46
  "@atlaskit/heading": "3.1.0",
47
- "@atlaskit/icon": "^22.24.0",
47
+ "@atlaskit/icon": "^22.26.0",
48
48
  "@atlaskit/platform-feature-flags": "^0.3.0",
49
49
  "@atlaskit/primitives": "^13.2.0",
50
- "@atlaskit/radio": "^6.5.0",
51
- "@atlaskit/section-message": "^6.6.0",
52
- "@atlaskit/select": "^18.5.0",
50
+ "@atlaskit/radio": "^6.6.0",
51
+ "@atlaskit/section-message": "^6.7.0",
52
+ "@atlaskit/select": "^18.6.0",
53
53
  "@atlaskit/smart-user-picker": "^6.11.0",
54
54
  "@atlaskit/spinner": "^16.3.0",
55
55
  "@atlaskit/tabs": "^16.5.0",
56
56
  "@atlaskit/textarea": "^5.6.0",
57
- "@atlaskit/textfield": "^6.5.0",
57
+ "@atlaskit/textfield": "^6.6.0",
58
58
  "@atlaskit/theme": "^14.0.0",
59
- "@atlaskit/tmp-editor-statsig": "^2.19.0",
59
+ "@atlaskit/tmp-editor-statsig": "^2.21.0",
60
60
  "@atlaskit/toggle": "^13.4.0",
61
61
  "@atlaskit/tokens": "^2.3.0",
62
62
  "@atlaskit/tooltip": "^18.9.0",
@@ -110,6 +110,9 @@
110
110
  "platform_editor_remove_copy_button_from_view_mode": {
111
111
  "type": "boolean"
112
112
  },
113
+ "platform_editor_legacy_content_macro": {
114
+ "type": "boolean"
115
+ },
113
116
  "platform_editor_react18_phase2_loadable": {
114
117
  "type": "boolean"
115
118
  }