@atlaskit/editor-plugin-block-type 3.14.8 → 3.15.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,28 @@
1
1
  # @atlaskit/editor-plugin-block-type
2
2
 
3
+ ## 3.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#142806](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/142806)
8
+ [`f73667130fb7d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f73667130fb7d) -
9
+ [ux] Update styles for nested dnd to only apply to full page editor. Removed
10
+ blockquoteSharedStylesNew export.
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
16
+ ## 3.14.9
17
+
18
+ ### Patch Changes
19
+
20
+ - [#141778](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/141778)
21
+ [`1c6f578277694`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1c6f578277694) -
22
+ ED-24870 & ED-24864 - Add the logic to gate the nested media in quotes functionality behind the
23
+ nest-media-and-codeblock-in-quote experiment. Also adjust the logic so the nested expands are now
24
+ behind the nested-expand-in-expand experiment.
25
+
3
26
  ## 3.14.8
4
27
 
5
28
  ### Patch Changes
@@ -4,12 +4,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.pluginKey = exports.createPlugin = void 0;
7
+ exports.pluginKey = exports.handleBlockQuoteDND = 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");
13
14
  var _blockTypes = require("../block-types");
14
15
  var _commands = require("../commands");
15
16
  var _consts = require("../consts");
@@ -145,7 +146,44 @@ var createPlugin = exports.createPlugin = function createPlugin(editorAPI, dispa
145
146
  altKeyLocation = 0;
146
147
  }
147
148
  return false;
149
+ },
150
+ handleDrop: function handleDrop(view, event, slice, moved) {
151
+ return handleBlockQuoteDND(view, event, slice);
148
152
  }
149
153
  }
150
154
  });
155
+ };
156
+ var handleBlockQuoteDND = exports.handleBlockQuoteDND = function handleBlockQuoteDND(view, event, slice) {
157
+ // Throwaway code for the sake of the expiriment. handleDrop can be removed after experiment complete.
158
+ if ((0, _experiments.editorExperiment)('nest-media-and-codeblock-in-quote', false)) {
159
+ var sliceContainsCodeBlockOrMedia = false;
160
+ slice.content.forEach(function (node) {
161
+ if (node.type === view.state.schema.nodes.codeBlock) {
162
+ sliceContainsCodeBlockOrMedia = true;
163
+ } else if (node.type === view.state.schema.nodes.mediaSingle) {
164
+ sliceContainsCodeBlockOrMedia = true;
165
+ } else if (node.type === view.state.schema.nodes.mediaGroup) {
166
+ sliceContainsCodeBlockOrMedia = true;
167
+ }
168
+ });
169
+ if (sliceContainsCodeBlockOrMedia) {
170
+ var state = view.state;
171
+ var schema = state.schema;
172
+ var dropPos = view.posAtCoords({
173
+ left: event.clientX,
174
+ top: event.clientY
175
+ });
176
+ if (!dropPos) {
177
+ return false;
178
+ }
179
+ var resolvedPos = state.doc.resolve(dropPos.pos);
180
+ var dropLocationNodeType = resolvedPos.node().type;
181
+ var dropLocationParentNodeType = resolvedPos.depth > 0 ? resolvedPos.node(resolvedPos.depth - 1).type : dropLocationNodeType;
182
+ if (dropLocationNodeType === schema.nodes.blockquote || dropLocationParentNodeType === schema.nodes.blockquote) {
183
+ event.preventDefault();
184
+ return true;
185
+ }
186
+ }
187
+ }
188
+ return false;
151
189
  };
@@ -12,5 +12,5 @@ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
12
12
  var _templateObject; // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
13
13
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Imports are not safe in an object syntax
14
14
  var blocktypeStyles = exports.blocktypeStyles = function blocktypeStyles() {
15
- return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t.ProseMirror {\n\t\t", ";\n\t\t", ";\n\t}\n"])), (0, _experiments.editorExperiment)('nested-dnd', true) ? _styles.blockquoteSharedStylesNew : _styles.blockquoteSharedStyles, (0, _styles.headingsSharedStyles)());
15
+ return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t.ProseMirror {\n\t\t", ";\n\t\t", ";\n\t}\n\n\t", "\n"])), _styles.blockquoteSharedStyles, (0, _styles.headingsSharedStyles)(), (0, _experiments.editorExperiment)('nested-dnd', true) && ".ak-editor-content-area.appearance-full-page .ProseMirror blockquote {\n\t\tpadding-left: ".concat("var(--ds-space-250, 20px)", ";\n\t}\n\n\t/* Don't want extra padding for inline editor (nested) */\n\t.ak-editor-content-area .ak-editor-content-area .ProseMirror blockquote {\n\t\tpadding-left: ", "var(--ds-space-200, 16px)", ";\n\t}"));
16
16
  };
@@ -2,6 +2,7 @@ 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';
5
6
  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 } from '../block-types';
6
7
  import { setHeadingWithAnalytics, setNormalTextWithAnalytics } from '../commands';
7
8
  import { HEADING_KEYS } from '../consts';
@@ -133,7 +134,48 @@ export const createPlugin = (editorAPI, dispatch, lastNodeMustBeParagraph) => {
133
134
  altKeyLocation = 0;
134
135
  }
135
136
  return false;
137
+ },
138
+ handleDrop(view, event, slice, moved) {
139
+ return handleBlockQuoteDND(view, event, slice);
136
140
  }
137
141
  }
138
142
  });
143
+ };
144
+ export const handleBlockQuoteDND = (view, event, slice) => {
145
+ // Throwaway code for the sake of the expiriment. handleDrop can be removed after experiment complete.
146
+ if (editorExperiment('nest-media-and-codeblock-in-quote', false)) {
147
+ let sliceContainsCodeBlockOrMedia = false;
148
+ slice.content.forEach(node => {
149
+ if (node.type === view.state.schema.nodes.codeBlock) {
150
+ sliceContainsCodeBlockOrMedia = true;
151
+ } else if (node.type === view.state.schema.nodes.mediaSingle) {
152
+ sliceContainsCodeBlockOrMedia = true;
153
+ } else if (node.type === view.state.schema.nodes.mediaGroup) {
154
+ sliceContainsCodeBlockOrMedia = true;
155
+ }
156
+ });
157
+ if (sliceContainsCodeBlockOrMedia) {
158
+ const {
159
+ state
160
+ } = view;
161
+ const {
162
+ schema
163
+ } = state;
164
+ const dropPos = view.posAtCoords({
165
+ left: event.clientX,
166
+ top: event.clientY
167
+ });
168
+ if (!dropPos) {
169
+ return false;
170
+ }
171
+ const resolvedPos = state.doc.resolve(dropPos.pos);
172
+ const dropLocationNodeType = resolvedPos.node().type;
173
+ const dropLocationParentNodeType = resolvedPos.depth > 0 ? resolvedPos.node(resolvedPos.depth - 1).type : dropLocationNodeType;
174
+ if (dropLocationNodeType === schema.nodes.blockquote || dropLocationParentNodeType === schema.nodes.blockquote) {
175
+ event.preventDefault();
176
+ return true;
177
+ }
178
+ }
179
+ }
180
+ return false;
139
181
  };
@@ -1,12 +1,20 @@
1
1
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
2
2
  import { css } from '@emotion/react';
3
- import { blockquoteSharedStyles, blockquoteSharedStylesNew, headingsSharedStyles } from '@atlaskit/editor-common/styles';
3
+ import { blockquoteSharedStyles, headingsSharedStyles } from '@atlaskit/editor-common/styles';
4
4
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
5
-
6
5
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Imports are not safe in an object syntax
7
6
  export const blocktypeStyles = () => css`
8
7
  .ProseMirror {
9
- ${editorExperiment('nested-dnd', true) ? blockquoteSharedStylesNew : blockquoteSharedStyles};
8
+ ${blockquoteSharedStyles};
10
9
  ${headingsSharedStyles()};
11
10
  }
11
+
12
+ ${editorExperiment('nested-dnd', true) && `.ak-editor-content-area.appearance-full-page .ProseMirror blockquote {
13
+ padding-left: ${"var(--ds-space-250, 20px)"};
14
+ }
15
+
16
+ /* Don't want extra padding for inline editor (nested) */
17
+ .ak-editor-content-area .ak-editor-content-area .ProseMirror blockquote {
18
+ padding-left: ${"var(--ds-space-200, 16px)"};
19
+ }`}
12
20
  `;
@@ -5,6 +5,7 @@ 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';
8
9
  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 } from '../block-types';
9
10
  import { setHeadingWithAnalytics, setNormalTextWithAnalytics } from '../commands';
10
11
  import { HEADING_KEYS } from '../consts';
@@ -138,7 +139,44 @@ export var createPlugin = function createPlugin(editorAPI, dispatch, lastNodeMus
138
139
  altKeyLocation = 0;
139
140
  }
140
141
  return false;
142
+ },
143
+ handleDrop: function handleDrop(view, event, slice, moved) {
144
+ return handleBlockQuoteDND(view, event, slice);
141
145
  }
142
146
  }
143
147
  });
148
+ };
149
+ export var handleBlockQuoteDND = function handleBlockQuoteDND(view, event, slice) {
150
+ // Throwaway code for the sake of the expiriment. handleDrop can be removed after experiment complete.
151
+ if (editorExperiment('nest-media-and-codeblock-in-quote', false)) {
152
+ var sliceContainsCodeBlockOrMedia = false;
153
+ slice.content.forEach(function (node) {
154
+ if (node.type === view.state.schema.nodes.codeBlock) {
155
+ sliceContainsCodeBlockOrMedia = true;
156
+ } else if (node.type === view.state.schema.nodes.mediaSingle) {
157
+ sliceContainsCodeBlockOrMedia = true;
158
+ } else if (node.type === view.state.schema.nodes.mediaGroup) {
159
+ sliceContainsCodeBlockOrMedia = true;
160
+ }
161
+ });
162
+ if (sliceContainsCodeBlockOrMedia) {
163
+ var state = view.state;
164
+ var schema = state.schema;
165
+ var dropPos = view.posAtCoords({
166
+ left: event.clientX,
167
+ top: event.clientY
168
+ });
169
+ if (!dropPos) {
170
+ return false;
171
+ }
172
+ var resolvedPos = state.doc.resolve(dropPos.pos);
173
+ var dropLocationNodeType = resolvedPos.node().type;
174
+ var dropLocationParentNodeType = resolvedPos.depth > 0 ? resolvedPos.node(resolvedPos.depth - 1).type : dropLocationNodeType;
175
+ if (dropLocationNodeType === schema.nodes.blockquote || dropLocationParentNodeType === schema.nodes.blockquote) {
176
+ event.preventDefault();
177
+ return true;
178
+ }
179
+ }
180
+ }
181
+ return false;
144
182
  };
@@ -2,10 +2,9 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
2
2
  var _templateObject;
3
3
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
4
4
  import { css } from '@emotion/react';
5
- import { blockquoteSharedStyles, blockquoteSharedStylesNew, headingsSharedStyles } from '@atlaskit/editor-common/styles';
5
+ import { blockquoteSharedStyles, headingsSharedStyles } from '@atlaskit/editor-common/styles';
6
6
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
7
-
8
7
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Imports are not safe in an object syntax
9
8
  export var blocktypeStyles = function blocktypeStyles() {
10
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t.ProseMirror {\n\t\t", ";\n\t\t", ";\n\t}\n"])), editorExperiment('nested-dnd', true) ? blockquoteSharedStylesNew : blockquoteSharedStyles, headingsSharedStyles());
9
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t.ProseMirror {\n\t\t", ";\n\t\t", ";\n\t}\n\n\t", "\n"])), blockquoteSharedStyles, headingsSharedStyles(), editorExperiment('nested-dnd', true) && ".ak-editor-content-area.appearance-full-page .ProseMirror blockquote {\n\t\tpadding-left: ".concat("var(--ds-space-250, 20px)", ";\n\t}\n\n\t/* Don't want extra padding for inline editor (nested) */\n\t.ak-editor-content-area .ak-editor-content-area .ProseMirror blockquote {\n\t\tpadding-left: ", "var(--ds-space-200, 16px)", ";\n\t}"));
11
10
  };
@@ -1,6 +1,8 @@
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';
3
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
6
  import type { BlockTypePlugin } from '../index';
5
7
  import type { BlockType } from '../types';
6
8
  export type BlockTypeState = {
@@ -16,3 +18,4 @@ export declare const createPlugin: (editorAPI: ExtractInjectionAPI<BlockTypePlug
16
18
  availableBlockTypes: BlockType[];
17
19
  availableWrapperBlockTypes: BlockType[];
18
20
  }>;
21
+ export declare const handleBlockQuoteDND: (view: EditorView, event: DragEvent, slice: Slice) => boolean;
@@ -1,6 +1,8 @@
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';
3
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
6
  import type { BlockTypePlugin } from '../index';
5
7
  import type { BlockType } from '../types';
6
8
  export type BlockTypeState = {
@@ -16,3 +18,4 @@ export declare const createPlugin: (editorAPI: ExtractInjectionAPI<BlockTypePlug
16
18
  availableBlockTypes: BlockType[];
17
19
  availableWrapperBlockTypes: BlockType[];
18
20
  }>;
21
+ export declare const handleBlockQuoteDND: (view: EditorView, event: DragEvent, slice: Slice) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-type",
3
- "version": "3.14.8",
3
+ "version": "3.15.0",
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": "^40.9.0",
37
- "@atlaskit/editor-common": "^89.2.0",
37
+ "@atlaskit/editor-common": "^90.0.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^1.8.0",
39
39
  "@atlaskit/editor-plugin-primary-toolbar": "^2.0.0",
40
40
  "@atlaskit/editor-prosemirror": "6.0.0",
@@ -56,7 +56,7 @@
56
56
  "devDependencies": {
57
57
  "@af/visual-regression": "*",
58
58
  "@atlaskit/analytics-next": "^10.1.0",
59
- "@atlaskit/editor-plugin-quick-insert": "^1.3.0",
59
+ "@atlaskit/editor-plugin-quick-insert": "^1.4.0",
60
60
  "@atlaskit/editor-plugin-type-ahead": "^1.8.0",
61
61
  "@atlaskit/ssr": "*",
62
62
  "@atlaskit/visual-regression": "*",