@atlaskit/editor-plugin-block-type 4.2.1 → 4.2.2

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,18 @@
1
1
  # @atlaskit/editor-plugin-block-type
2
2
 
3
+ ## 4.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#107782](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/107782)
8
+ [`bc422d0adbbb5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/bc422d0adbbb5) -
9
+ [ux] ED-26378 remove editor_nest_media_and_codeblock_in_quotes_jira
10
+ - [#107782](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/107782)
11
+ [`cccc7a8347929`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/cccc7a8347929) -
12
+ [ux] ED-26378 Remove editor_nest_media_and_codeblock_in_quotes_jira and
13
+ nestMediaAndCodeblockInQuote
14
+ - Updated dependencies
15
+
3
16
  ## 4.2.1
4
17
 
5
18
  ### Patch Changes
@@ -4,13 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.pluginKey = exports.handleBlockQuoteDND = exports.createPlugin = void 0;
7
+ exports.pluginKey = exports.createPlugin = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _analytics = require("@atlaskit/editor-common/analytics");
10
10
  var _browser = require("@atlaskit/editor-common/browser");
11
11
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
12
12
  var _state = require("@atlaskit/editor-prosemirror/state");
13
- var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
14
13
  var _blockTypes = require("./block-types");
15
14
  var _blockType = require("./commands/block-type");
16
15
  var _consts = require("./consts");
@@ -157,44 +156,7 @@ var createPlugin = exports.createPlugin = function createPlugin(editorAPI, dispa
157
156
  altKeyLocation = 0;
158
157
  }
159
158
  return false;
160
- },
161
- handleDrop: function handleDrop(view, event, slice, moved) {
162
- return handleBlockQuoteDND(view, event, slice);
163
159
  }
164
160
  }
165
161
  });
166
- };
167
- var handleBlockQuoteDND = exports.handleBlockQuoteDND = function handleBlockQuoteDND(view, event, slice) {
168
- // Throwaway code for the sake of the expiriment. handleDrop can be removed after experiment complete.
169
- if ((0, _experiments.editorExperiment)('nest-media-and-codeblock-in-quote', false)) {
170
- var sliceContainsCodeBlockOrMedia = false;
171
- slice.content.forEach(function (node) {
172
- if (node.type === view.state.schema.nodes.codeBlock) {
173
- sliceContainsCodeBlockOrMedia = true;
174
- } else if (node.type === view.state.schema.nodes.mediaSingle) {
175
- sliceContainsCodeBlockOrMedia = true;
176
- } else if (node.type === view.state.schema.nodes.mediaGroup) {
177
- sliceContainsCodeBlockOrMedia = true;
178
- }
179
- });
180
- if (sliceContainsCodeBlockOrMedia) {
181
- var state = view.state;
182
- var schema = state.schema;
183
- var dropPos = view.posAtCoords({
184
- left: event.clientX,
185
- top: event.clientY
186
- });
187
- if (!dropPos) {
188
- return false;
189
- }
190
- var resolvedPos = state.doc.resolve(dropPos.pos);
191
- var dropLocationNodeType = resolvedPos.node().type;
192
- var dropLocationParentNodeType = resolvedPos.depth > 0 ? resolvedPos.node(resolvedPos.depth - 1).type : dropLocationNodeType;
193
- if (dropLocationNodeType === schema.nodes.blockquote || dropLocationParentNodeType === schema.nodes.blockquote) {
194
- event.preventDefault();
195
- return true;
196
- }
197
- }
198
- }
199
- return false;
200
162
  };
@@ -2,7 +2,6 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
2
  import { browser } from '@atlaskit/editor-common/browser';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
6
5
  import { BLOCK_QUOTE, CODE_BLOCK, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6, HEADINGS_BY_LEVEL, NORMAL_TEXT, OTHER, PANEL, TEXT_BLOCK_TYPES, WRAPPER_BLOCK_TYPES, getBlockTypesInDropdown } from './block-types';
7
6
  import { setHeadingWithAnalytics, setNormalTextWithAnalytics } from './commands/block-type';
8
7
  import { HEADING_KEYS } from './consts';
@@ -143,48 +142,7 @@ export const createPlugin = (editorAPI, dispatch, lastNodeMustBeParagraph, inclu
143
142
  altKeyLocation = 0;
144
143
  }
145
144
  return false;
146
- },
147
- handleDrop(view, event, slice, moved) {
148
- return handleBlockQuoteDND(view, event, slice);
149
145
  }
150
146
  }
151
147
  });
152
- };
153
- export const handleBlockQuoteDND = (view, event, slice) => {
154
- // Throwaway code for the sake of the expiriment. handleDrop can be removed after experiment complete.
155
- if (editorExperiment('nest-media-and-codeblock-in-quote', false)) {
156
- let sliceContainsCodeBlockOrMedia = false;
157
- slice.content.forEach(node => {
158
- if (node.type === view.state.schema.nodes.codeBlock) {
159
- sliceContainsCodeBlockOrMedia = true;
160
- } else if (node.type === view.state.schema.nodes.mediaSingle) {
161
- sliceContainsCodeBlockOrMedia = true;
162
- } else if (node.type === view.state.schema.nodes.mediaGroup) {
163
- sliceContainsCodeBlockOrMedia = true;
164
- }
165
- });
166
- if (sliceContainsCodeBlockOrMedia) {
167
- const {
168
- state
169
- } = view;
170
- const {
171
- schema
172
- } = state;
173
- const dropPos = view.posAtCoords({
174
- left: event.clientX,
175
- top: event.clientY
176
- });
177
- if (!dropPos) {
178
- return false;
179
- }
180
- const resolvedPos = state.doc.resolve(dropPos.pos);
181
- const dropLocationNodeType = resolvedPos.node().type;
182
- const dropLocationParentNodeType = resolvedPos.depth > 0 ? resolvedPos.node(resolvedPos.depth - 1).type : dropLocationNodeType;
183
- if (dropLocationNodeType === schema.nodes.blockquote || dropLocationParentNodeType === schema.nodes.blockquote) {
184
- event.preventDefault();
185
- return true;
186
- }
187
- }
188
- }
189
- return false;
190
148
  };
@@ -5,7 +5,6 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
5
  import { browser } from '@atlaskit/editor-common/browser';
6
6
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
7
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
8
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
9
8
  import { BLOCK_QUOTE, CODE_BLOCK, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6, HEADINGS_BY_LEVEL, NORMAL_TEXT, OTHER, PANEL, TEXT_BLOCK_TYPES, WRAPPER_BLOCK_TYPES, getBlockTypesInDropdown } from './block-types';
10
9
  import { setHeadingWithAnalytics, setNormalTextWithAnalytics } from './commands/block-type';
11
10
  import { HEADING_KEYS } from './consts';
@@ -150,44 +149,7 @@ export var createPlugin = function createPlugin(editorAPI, dispatch, lastNodeMus
150
149
  altKeyLocation = 0;
151
150
  }
152
151
  return false;
153
- },
154
- handleDrop: function handleDrop(view, event, slice, moved) {
155
- return handleBlockQuoteDND(view, event, slice);
156
152
  }
157
153
  }
158
154
  });
159
- };
160
- export var handleBlockQuoteDND = function handleBlockQuoteDND(view, event, slice) {
161
- // Throwaway code for the sake of the expiriment. handleDrop can be removed after experiment complete.
162
- if (editorExperiment('nest-media-and-codeblock-in-quote', false)) {
163
- var sliceContainsCodeBlockOrMedia = false;
164
- slice.content.forEach(function (node) {
165
- if (node.type === view.state.schema.nodes.codeBlock) {
166
- sliceContainsCodeBlockOrMedia = true;
167
- } else if (node.type === view.state.schema.nodes.mediaSingle) {
168
- sliceContainsCodeBlockOrMedia = true;
169
- } else if (node.type === view.state.schema.nodes.mediaGroup) {
170
- sliceContainsCodeBlockOrMedia = true;
171
- }
172
- });
173
- if (sliceContainsCodeBlockOrMedia) {
174
- var state = view.state;
175
- var schema = state.schema;
176
- var dropPos = view.posAtCoords({
177
- left: event.clientX,
178
- top: event.clientY
179
- });
180
- if (!dropPos) {
181
- return false;
182
- }
183
- var resolvedPos = state.doc.resolve(dropPos.pos);
184
- var dropLocationNodeType = resolvedPos.node().type;
185
- var dropLocationParentNodeType = resolvedPos.depth > 0 ? resolvedPos.node(resolvedPos.depth - 1).type : dropLocationNodeType;
186
- if (dropLocationNodeType === schema.nodes.blockquote || dropLocationParentNodeType === schema.nodes.blockquote) {
187
- event.preventDefault();
188
- return true;
189
- }
190
- }
191
- }
192
- return false;
193
155
  };
@@ -1,8 +1,6 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { Slice } from '@atlaskit/editor-prosemirror/model';
4
3
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
4
  import type { BlockTypePlugin } from '../blockTypePluginType';
7
5
  import type { BlockType } from './types';
8
6
  export type BlockTypeState = {
@@ -15,4 +13,3 @@ export type BlockTypeState = {
15
13
  };
16
14
  export declare const pluginKey: PluginKey<BlockTypeState>;
17
15
  export declare const createPlugin: (editorAPI: ExtractInjectionAPI<BlockTypePlugin> | undefined, dispatch: (eventName: string | PluginKey, data: any) => void, lastNodeMustBeParagraph?: boolean, includeBlockQuoteAsTextstyleOption?: boolean) => SafePlugin<BlockTypeState>;
18
- export declare const handleBlockQuoteDND: (view: EditorView, event: DragEvent, slice: Slice) => boolean;
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { BlockTypePlugin } from '../../blockTypePluginType';
4
4
  interface FloatingToolbarComponentProps {
5
5
  api: ExtractInjectionAPI<BlockTypePlugin> | undefined;
6
6
  }
7
- export declare function FloatingToolbarComponent({ api }: FloatingToolbarComponentProps): JSX.Element;
7
+ export declare function FloatingToolbarComponent({ api }: FloatingToolbarComponentProps): React.JSX.Element;
8
8
  export {};
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { BlockTypePlugin } from '../../blockTypePluginType';
4
4
  interface PrimaryToolbarComponentProps {
@@ -11,5 +11,5 @@ interface PrimaryToolbarComponentProps {
11
11
  popupsScrollableElement?: HTMLElement;
12
12
  shouldUseDefaultRole: boolean;
13
13
  }
14
- export declare function PrimaryToolbarComponent({ api, isSmall, disabled, isToolbarReducedSpacing, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, shouldUseDefaultRole, }: PrimaryToolbarComponentProps): JSX.Element;
14
+ export declare function PrimaryToolbarComponent({ api, isSmall, disabled, isToolbarReducedSpacing, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, shouldUseDefaultRole, }: PrimaryToolbarComponentProps): React.JSX.Element;
15
15
  export {};
@@ -1,8 +1,6 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { Slice } from '@atlaskit/editor-prosemirror/model';
4
3
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
4
  import type { BlockTypePlugin } from '../blockTypePluginType';
7
5
  import type { BlockType } from './types';
8
6
  export type BlockTypeState = {
@@ -15,4 +13,3 @@ export type BlockTypeState = {
15
13
  };
16
14
  export declare const pluginKey: PluginKey<BlockTypeState>;
17
15
  export declare const createPlugin: (editorAPI: ExtractInjectionAPI<BlockTypePlugin> | undefined, dispatch: (eventName: string | PluginKey, data: any) => void, lastNodeMustBeParagraph?: boolean, includeBlockQuoteAsTextstyleOption?: boolean) => SafePlugin<BlockTypeState>;
18
- export declare const handleBlockQuoteDND: (view: EditorView, event: DragEvent, slice: Slice) => boolean;
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { BlockTypePlugin } from '../../blockTypePluginType';
4
4
  interface FloatingToolbarComponentProps {
5
5
  api: ExtractInjectionAPI<BlockTypePlugin> | undefined;
6
6
  }
7
- export declare function FloatingToolbarComponent({ api }: FloatingToolbarComponentProps): JSX.Element;
7
+ export declare function FloatingToolbarComponent({ api }: FloatingToolbarComponentProps): React.JSX.Element;
8
8
  export {};
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { BlockTypePlugin } from '../../blockTypePluginType';
4
4
  interface PrimaryToolbarComponentProps {
@@ -11,5 +11,5 @@ interface PrimaryToolbarComponentProps {
11
11
  popupsScrollableElement?: HTMLElement;
12
12
  shouldUseDefaultRole: boolean;
13
13
  }
14
- export declare function PrimaryToolbarComponent({ api, isSmall, disabled, isToolbarReducedSpacing, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, shouldUseDefaultRole, }: PrimaryToolbarComponentProps): JSX.Element;
14
+ export declare function PrimaryToolbarComponent({ api, isSmall, disabled, isToolbarReducedSpacing, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, shouldUseDefaultRole, }: PrimaryToolbarComponentProps): React.JSX.Element;
15
15
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-type",
3
- "version": "4.2.1",
3
+ "version": "4.2.2",
4
4
  "description": "BlockType plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@atlaskit/adf-schema": "^46.1.0",
37
- "@atlaskit/editor-common": "^99.7.0",
37
+ "@atlaskit/editor-common": "^99.8.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^1.11.0",
39
39
  "@atlaskit/editor-plugin-primary-toolbar": "^2.1.0",
40
40
  "@atlaskit/editor-prosemirror": "6.2.1",
@@ -45,7 +45,7 @@
45
45
  "@atlaskit/primitives": "^13.4.0",
46
46
  "@atlaskit/prosemirror-input-rules": "^3.2.0",
47
47
  "@atlaskit/theme": "^14.1.0",
48
- "@atlaskit/tmp-editor-statsig": "^2.41.0",
48
+ "@atlaskit/tmp-editor-statsig": "^2.42.0",
49
49
  "@atlaskit/tokens": "^3.3.0",
50
50
  "@babel/runtime": "^7.0.0",
51
51
  "@emotion/react": "^11.7.1"
@@ -104,9 +104,6 @@
104
104
  }
105
105
  },
106
106
  "platform-feature-flags": {
107
- "editor_nest_media_and_codeblock_in_quotes_jira": {
108
- "type": "boolean"
109
- },
110
107
  "platform_editor_toolbar_responsive_fixes": {
111
108
  "type": "boolean"
112
109
  },