@atlaskit/editor-plugin-block-type 14.1.2 → 14.1.4

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,20 @@
1
1
  # @atlaskit/editor-plugin-block-type
2
2
 
3
+ ## 14.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`32dce97f78584`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/32dce97f78584) -
8
+ Fix preserved selection mapping when comment editors append a trailing paragraph after block menu
9
+ transforms.
10
+ - Updated dependencies
11
+
12
+ ## 14.1.3
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 14.1.2
4
19
 
5
20
  ### Patch Changes
@@ -7,12 +7,14 @@ Object.defineProperty(exports, "__esModule", {
7
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
+ var _blockType = require("@atlaskit/editor-common/block-type");
10
11
  var _browser = require("@atlaskit/editor-common/browser");
11
12
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
12
13
  var _state = require("@atlaskit/editor-prosemirror/state");
14
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
15
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
14
16
  var _blockTypes = require("./block-types");
15
- var _blockType = require("./commands/block-type");
17
+ var _blockType2 = require("./commands/block-type");
16
18
  var _consts = require("./consts");
17
19
  var _utils = require("./utils");
18
20
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -82,9 +84,9 @@ var detectBlockType = function detectBlockType(availableBlockTypes, state) {
82
84
  };
83
85
  var autoformatHeading = function autoformatHeading(headingLevel, editorAnalyticsApi) {
84
86
  if (headingLevel === 0) {
85
- return (0, _blockType.setNormalTextWithAnalytics)(_analytics.INPUT_METHOD.FORMATTING, editorAnalyticsApi);
87
+ return (0, _blockType2.setNormalTextWithAnalytics)(_analytics.INPUT_METHOD.FORMATTING, editorAnalyticsApi);
86
88
  }
87
- return (0, _blockType.setHeadingWithAnalytics)(headingLevel, _analytics.INPUT_METHOD.FORMATTING, editorAnalyticsApi);
89
+ return (0, _blockType2.setHeadingWithAnalytics)(headingLevel, _analytics.INPUT_METHOD.FORMATTING, editorAnalyticsApi);
88
90
  };
89
91
  var pluginKey = exports.pluginKey = new _state.PluginKey('blockTypePlugin');
90
92
  var createPlugin = exports.createPlugin = function createPlugin(editorAPI, dispatch, lastNodeMustBeParagraph, includeBlockQuoteAsTextstyleOption, allowFontSize) {
@@ -98,7 +100,8 @@ var createPlugin = exports.createPlugin = function createPlugin(editorAPI, dispa
98
100
  var lastNode = pos.node(1);
99
101
  var paragraph = newState.schema.nodes.paragraph;
100
102
  if (lastNode && lastNode.isBlock && lastNode.type !== paragraph) {
101
- return newState.tr.insert(newState.doc.content.size, newState.schema.nodes.paragraph.create());
103
+ var tr = newState.tr.insert(newState.doc.content.size, newState.schema.nodes.paragraph.create());
104
+ return (0, _platformFeatureFlags.fg)('platform_editor_block_menu_jira_patch_2') ? tr.setMeta(_blockType.INSERTED_TRAILING_PARAGRAPH_TO_LAST_NODE_META, true) : tr;
102
105
  }
103
106
  }
104
107
  },
@@ -162,10 +165,10 @@ var createPlugin = exports.createPlugin = function createPlugin(editorAPI, dispa
162
165
  } else if (event.keyCode === _consts.KEY_7 && event.altKey && (0, _expValEquals.expValEquals)('platform_editor_small_font_size', 'isEnabled', true)) {
163
166
  if (browser.mac && event.metaKey) {
164
167
  var _editorAPI$core$actio3, _editorAPI$core3;
165
- return (_editorAPI$core$actio3 = editorAPI === null || editorAPI === void 0 || (_editorAPI$core3 = editorAPI.core) === null || _editorAPI$core3 === void 0 ? void 0 : _editorAPI$core3.actions.execute((0, _blockType.setSmallTextWithAnalytics)(_analytics.INPUT_METHOD.SHORTCUT, editorAnalyticsApi))) !== null && _editorAPI$core$actio3 !== void 0 ? _editorAPI$core$actio3 : false;
168
+ return (_editorAPI$core$actio3 = editorAPI === null || editorAPI === void 0 || (_editorAPI$core3 = editorAPI.core) === null || _editorAPI$core3 === void 0 ? void 0 : _editorAPI$core3.actions.execute((0, _blockType2.setSmallTextWithAnalytics)(_analytics.INPUT_METHOD.SHORTCUT, editorAnalyticsApi))) !== null && _editorAPI$core$actio3 !== void 0 ? _editorAPI$core$actio3 : false;
166
169
  } else if (!browser.mac && event.ctrlKey && altKeyLocation !== event.DOM_KEY_LOCATION_RIGHT) {
167
170
  var _editorAPI$core$actio4, _editorAPI$core4;
168
- return (_editorAPI$core$actio4 = editorAPI === null || editorAPI === void 0 || (_editorAPI$core4 = editorAPI.core) === null || _editorAPI$core4 === void 0 ? void 0 : _editorAPI$core4.actions.execute((0, _blockType.setSmallTextWithAnalytics)(_analytics.INPUT_METHOD.SHORTCUT, editorAnalyticsApi))) !== null && _editorAPI$core$actio4 !== void 0 ? _editorAPI$core$actio4 : false;
171
+ return (_editorAPI$core$actio4 = editorAPI === null || editorAPI === void 0 || (_editorAPI$core4 = editorAPI.core) === null || _editorAPI$core4 === void 0 ? void 0 : _editorAPI$core4.actions.execute((0, _blockType2.setSmallTextWithAnalytics)(_analytics.INPUT_METHOD.SHORTCUT, editorAnalyticsApi))) !== null && _editorAPI$core$actio4 !== void 0 ? _editorAPI$core$actio4 : false;
169
172
  }
170
173
  } else if (event.key === 'Alt') {
171
174
  // event.location is for the current key only; when a user hits Ctrl-Alt-1 the
@@ -1,7 +1,9 @@
1
1
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
+ import { INSERTED_TRAILING_PARAGRAPH_TO_LAST_NODE_META } from '@atlaskit/editor-common/block-type';
2
3
  import { getBrowserInfo } from '@atlaskit/editor-common/browser';
3
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
5
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
5
7
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
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, SMALL_TEXT } from './block-types';
7
9
  import { setHeadingWithAnalytics, setNormalTextWithAnalytics, setSmallTextWithAnalytics } from './commands/block-type';
@@ -87,7 +89,8 @@ export const createPlugin = (editorAPI, dispatch, lastNodeMustBeParagraph, inclu
87
89
  paragraph
88
90
  } = newState.schema.nodes;
89
91
  if (lastNode && lastNode.isBlock && lastNode.type !== paragraph) {
90
- return newState.tr.insert(newState.doc.content.size, newState.schema.nodes.paragraph.create());
92
+ const tr = newState.tr.insert(newState.doc.content.size, newState.schema.nodes.paragraph.create());
93
+ return fg('platform_editor_block_menu_jira_patch_2') ? tr.setMeta(INSERTED_TRAILING_PARAGRAPH_TO_LAST_NODE_META, true) : tr;
91
94
  }
92
95
  }
93
96
  },
@@ -2,9 +2,11 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
+ import { INSERTED_TRAILING_PARAGRAPH_TO_LAST_NODE_META } from '@atlaskit/editor-common/block-type';
5
6
  import { getBrowserInfo } from '@atlaskit/editor-common/browser';
6
7
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
8
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
9
+ import { fg } from '@atlaskit/platform-feature-flags';
8
10
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
11
  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, SMALL_TEXT } from './block-types';
10
12
  import { setHeadingWithAnalytics, setNormalTextWithAnalytics, setSmallTextWithAnalytics } from './commands/block-type';
@@ -91,7 +93,8 @@ export var createPlugin = function createPlugin(editorAPI, dispatch, lastNodeMus
91
93
  var lastNode = pos.node(1);
92
94
  var paragraph = newState.schema.nodes.paragraph;
93
95
  if (lastNode && lastNode.isBlock && lastNode.type !== paragraph) {
94
- return newState.tr.insert(newState.doc.content.size, newState.schema.nodes.paragraph.create());
96
+ var tr = newState.tr.insert(newState.doc.content.size, newState.schema.nodes.paragraph.create());
97
+ return fg('platform_editor_block_menu_jira_patch_2') ? tr.setMeta(INSERTED_TRAILING_PARAGRAPH_TO_LAST_NODE_META, true) : tr;
95
98
  }
96
99
  }
97
100
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-type",
3
- "version": "14.1.2",
3
+ "version": "14.1.4",
4
4
  "description": "BlockType plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -29,7 +29,7 @@
29
29
  ],
30
30
  "atlaskit:src": "src/index.ts",
31
31
  "dependencies": {
32
- "@atlaskit/adf-schema": "^52.11.0",
32
+ "@atlaskit/adf-schema": "^52.13.0",
33
33
  "@atlaskit/css": "^0.19.0",
34
34
  "@atlaskit/editor-plugin-analytics": "^10.1.0",
35
35
  "@atlaskit/editor-plugin-block-menu": "^9.2.0",
@@ -41,7 +41,7 @@
41
41
  "@atlaskit/editor-prosemirror": "^7.3.0",
42
42
  "@atlaskit/editor-shared-styles": "^3.11.0",
43
43
  "@atlaskit/editor-tables": "^2.10.0",
44
- "@atlaskit/editor-toolbar": "^1.5.0",
44
+ "@atlaskit/editor-toolbar": "^1.6.0",
45
45
  "@atlaskit/editor-toolbar-model": "^0.5.0",
46
46
  "@atlaskit/icon": "^35.0.0",
47
47
  "@atlaskit/icon-lab": "^6.9.0",
@@ -49,14 +49,14 @@
49
49
  "@atlaskit/primitives": "^19.0.0",
50
50
  "@atlaskit/prosemirror-history": "^0.2.0",
51
51
  "@atlaskit/prosemirror-input-rules": "^3.7.0",
52
- "@atlaskit/tmp-editor-statsig": "^81.1.0",
52
+ "@atlaskit/tmp-editor-statsig": "^82.0.0",
53
53
  "@atlaskit/tokens": "^13.0.0",
54
54
  "@babel/runtime": "^7.0.0",
55
55
  "@compiled/react": "^0.20.0",
56
56
  "@emotion/react": "^11.7.1"
57
57
  },
58
58
  "peerDependencies": {
59
- "@atlaskit/editor-common": "^114.35.0",
59
+ "@atlaskit/editor-common": "^114.37.0",
60
60
  "react": "^18.2.0",
61
61
  "react-dom": "^18.2.0",
62
62
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
@@ -104,6 +104,9 @@
104
104
  }
105
105
  },
106
106
  "platform-feature-flags": {
107
+ "platform_editor_block_menu_jira_patch_2": {
108
+ "type": "boolean"
109
+ },
107
110
  "platform_editor_change_normal_text_icon": {
108
111
  "type": "boolean"
109
112
  },