@atlaskit/editor-plugin-block-type 5.0.2 → 5.1.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 +20 -0
- package/dist/cjs/blockTypePlugin.js +11 -4
- package/dist/es2019/blockTypePlugin.js +12 -7
- package/dist/esm/blockTypePlugin.js +12 -5
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
# @atlaskit/editor-plugin-block-type
|
2
2
|
|
3
|
+
## 5.1.0
|
4
|
+
|
5
|
+
### Minor Changes
|
6
|
+
|
7
|
+
- [#120472](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120472)
|
8
|
+
[`4758d7dd443dd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4758d7dd443dd) -
|
9
|
+
[ux] ED-26766 update adf-schema from 47.2.1 to 47.6.0 and adf-schema-json from 1.27.0 to 1.31.0
|
10
|
+
and feature gated the usage of new prosemirror nodes in blockTypePlugin, expandPlugin, listPlugin
|
11
|
+
and panelPlugin as the new defaults of these nodes support nesting of extensions
|
12
|
+
- [#120472](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120472)
|
13
|
+
[`73c800ab5f2fc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/73c800ab5f2fc) -
|
14
|
+
ED-26766 update adf-schema from 47.2.1 to 47.6.0 and adf-schema-json from 1.27.0 to 1.31.0
|
15
|
+
|
16
|
+
### Patch Changes
|
17
|
+
|
18
|
+
- [#120007](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120007)
|
19
|
+
[`e87df0a8c73c6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e87df0a8c73c6) -
|
20
|
+
[ux] Do not add headings, lists, layouts, panels in the new QuickInsert menu
|
21
|
+
- Updated dependencies
|
22
|
+
|
3
23
|
## 5.0.2
|
4
24
|
|
5
25
|
### Patch Changes
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.blockTypePlugin = void 0;
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
9
10
|
var _react = _interopRequireDefault(require("react"));
|
10
11
|
var _adfSchema = require("@atlaskit/adf-schema");
|
11
12
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
@@ -21,6 +22,8 @@ var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
|
|
21
22
|
var _main = require("./pm-plugins/main");
|
22
23
|
var _FloatingToolbarComponent = require("./pm-plugins/ui/FloatingToolbarComponent");
|
23
24
|
var _PrimaryToolbarComponent = require("./pm-plugins/ui/PrimaryToolbarComponent");
|
25
|
+
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; }
|
26
|
+
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) { (0, _defineProperty2.default)(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; }
|
24
27
|
var headingPluginOptions = function headingPluginOptions(_ref, isAllowed, editorAnalyticsApi) {
|
25
28
|
var formatMessage = _ref.formatMessage;
|
26
29
|
if (!isAllowed) {
|
@@ -129,12 +132,15 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
|
|
129
132
|
return {
|
130
133
|
name: 'blockType',
|
131
134
|
nodes: function nodes() {
|
135
|
+
var blockquote = (0, _experiments.editorExperiment)('platform_editor_nested_non_bodied_macros', 'test', {
|
136
|
+
exposure: false
|
137
|
+
}) ? _adfSchema.extendedBlockquote : _adfSchema.blockquoteWithoutNonBodiedMacros;
|
132
138
|
var nodes = [{
|
133
139
|
name: 'heading',
|
134
140
|
node: _adfSchema.heading
|
135
141
|
}, {
|
136
142
|
name: 'blockquote',
|
137
|
-
node:
|
143
|
+
node: blockquote
|
138
144
|
}, {
|
139
145
|
name: 'hardBreak',
|
140
146
|
node: _adfSchema.hardBreak
|
@@ -203,7 +209,7 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
|
|
203
209
|
return _main.pluginKey.getState(editorState);
|
204
210
|
},
|
205
211
|
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
|
206
|
-
pluginsOptions: {
|
212
|
+
pluginsOptions: _objectSpread({
|
207
213
|
selectionToolbar: function selectionToolbar() {
|
208
214
|
var _api$selectionToolbar;
|
209
215
|
if ((api === null || api === void 0 || (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.sharedState) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.currentState()) === null || _api$selectionToolbar === void 0 ? void 0 : _api$selectionToolbar.toolbarDocking) === 'top' && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
|
@@ -238,12 +244,13 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
|
|
238
244
|
} else {
|
239
245
|
return undefined;
|
240
246
|
}
|
241
|
-
}
|
247
|
+
}
|
248
|
+
}, (0, _experiments.editorExperiment)('platform_editor_insertion', 'control') && {
|
242
249
|
quickInsert: function quickInsert(intl) {
|
243
250
|
var _api$analytics7, _api$analytics8;
|
244
251
|
var exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
|
245
252
|
return [].concat((0, _toConsumableArray2.default)(blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 || (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions)), (0, _toConsumableArray2.default)(headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 || (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions)));
|
246
253
|
}
|
247
|
-
}
|
254
|
+
})
|
248
255
|
};
|
249
256
|
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
2
|
+
import { extendedBlockquote, blockquoteWithoutNonBodiedMacros, hardBreak, heading } from '@atlaskit/adf-schema';
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
4
4
|
import { keymap, tooltip } from '@atlaskit/editor-common/keymaps';
|
5
5
|
import { blockTypeMessages as messages } from '@atlaskit/editor-common/messages';
|
@@ -121,12 +121,15 @@ const blockTypePlugin = ({
|
|
121
121
|
return {
|
122
122
|
name: 'blockType',
|
123
123
|
nodes() {
|
124
|
+
const blockquote = editorExperiment('platform_editor_nested_non_bodied_macros', 'test', {
|
125
|
+
exposure: false
|
126
|
+
}) ? extendedBlockquote : blockquoteWithoutNonBodiedMacros;
|
124
127
|
const nodes = [{
|
125
128
|
name: 'heading',
|
126
129
|
node: heading
|
127
130
|
}, {
|
128
131
|
name: 'blockquote',
|
129
|
-
node:
|
132
|
+
node: blockquote
|
130
133
|
}, {
|
131
134
|
name: 'hardBreak',
|
132
135
|
node: hardBreak
|
@@ -229,11 +232,13 @@ const blockTypePlugin = ({
|
|
229
232
|
return undefined;
|
230
233
|
}
|
231
234
|
},
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
235
|
+
...(editorExperiment('platform_editor_insertion', 'control') && {
|
236
|
+
quickInsert: intl => {
|
237
|
+
var _api$analytics7, _api$analytics8;
|
238
|
+
const exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
|
239
|
+
return [...blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 ? void 0 : (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions), ...headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 ? void 0 : (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions)];
|
240
|
+
}
|
241
|
+
})
|
237
242
|
}
|
238
243
|
};
|
239
244
|
};
|
@@ -1,6 +1,9 @@
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
|
+
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; }
|
4
|
+
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; }
|
2
5
|
import React from 'react';
|
3
|
-
import {
|
6
|
+
import { extendedBlockquote, blockquoteWithoutNonBodiedMacros, hardBreak, heading } from '@atlaskit/adf-schema';
|
4
7
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
5
8
|
import { keymap, tooltip } from '@atlaskit/editor-common/keymaps';
|
6
9
|
import { blockTypeMessages as messages } from '@atlaskit/editor-common/messages';
|
@@ -122,12 +125,15 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
|
|
122
125
|
return {
|
123
126
|
name: 'blockType',
|
124
127
|
nodes: function nodes() {
|
128
|
+
var blockquote = editorExperiment('platform_editor_nested_non_bodied_macros', 'test', {
|
129
|
+
exposure: false
|
130
|
+
}) ? extendedBlockquote : blockquoteWithoutNonBodiedMacros;
|
125
131
|
var nodes = [{
|
126
132
|
name: 'heading',
|
127
133
|
node: heading
|
128
134
|
}, {
|
129
135
|
name: 'blockquote',
|
130
|
-
node:
|
136
|
+
node: blockquote
|
131
137
|
}, {
|
132
138
|
name: 'hardBreak',
|
133
139
|
node: hardBreak
|
@@ -196,7 +202,7 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
|
|
196
202
|
return pluginKey.getState(editorState);
|
197
203
|
},
|
198
204
|
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
|
199
|
-
pluginsOptions: {
|
205
|
+
pluginsOptions: _objectSpread({
|
200
206
|
selectionToolbar: function selectionToolbar() {
|
201
207
|
var _api$selectionToolbar;
|
202
208
|
if ((api === null || api === void 0 || (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.sharedState) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.currentState()) === null || _api$selectionToolbar === void 0 ? void 0 : _api$selectionToolbar.toolbarDocking) === 'top' && editorExperiment('platform_editor_controls', 'variant1', {
|
@@ -231,13 +237,14 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
|
|
231
237
|
} else {
|
232
238
|
return undefined;
|
233
239
|
}
|
234
|
-
}
|
240
|
+
}
|
241
|
+
}, editorExperiment('platform_editor_insertion', 'control') && {
|
235
242
|
quickInsert: function quickInsert(intl) {
|
236
243
|
var _api$analytics7, _api$analytics8;
|
237
244
|
var exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
|
238
245
|
return [].concat(_toConsumableArray(blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 || (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions)), _toConsumableArray(headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 || (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions)));
|
239
246
|
}
|
240
|
-
}
|
247
|
+
})
|
241
248
|
};
|
242
249
|
};
|
243
250
|
export { blockTypePlugin };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atlaskit/editor-plugin-block-type",
|
3
|
-
"version": "5.0
|
3
|
+
"version": "5.1.0",
|
4
4
|
"description": "BlockType plugin for @atlaskit/editor-core",
|
5
5
|
"author": "Atlassian Pty Ltd",
|
6
6
|
"license": "Apache-2.0",
|
@@ -35,9 +35,9 @@
|
|
35
35
|
"./styles": "./src/ui/styles.ts"
|
36
36
|
},
|
37
37
|
"dependencies": {
|
38
|
-
"@atlaskit/adf-schema": "^47.
|
39
|
-
"@atlaskit/editor-common": "^100.
|
40
|
-
"@atlaskit/editor-plugin-analytics": "^2.
|
38
|
+
"@atlaskit/adf-schema": "^47.6.0",
|
39
|
+
"@atlaskit/editor-common": "^100.5.0",
|
40
|
+
"@atlaskit/editor-plugin-analytics": "^2.1.0",
|
41
41
|
"@atlaskit/editor-plugin-primary-toolbar": "^3.0.0",
|
42
42
|
"@atlaskit/editor-plugin-selection-toolbar": "^2.0.0",
|
43
43
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
@@ -48,7 +48,7 @@
|
|
48
48
|
"@atlaskit/primitives": "^14.1.0",
|
49
49
|
"@atlaskit/prosemirror-input-rules": "^3.3.0",
|
50
50
|
"@atlaskit/theme": "^17.0.0",
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^3.
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^3.4.0",
|
52
52
|
"@atlaskit/tokens": "^4.3.0",
|
53
53
|
"@babel/runtime": "^7.0.0",
|
54
54
|
"@emotion/react": "^11.7.1"
|
@@ -62,7 +62,7 @@
|
|
62
62
|
"@af/visual-regression": "*",
|
63
63
|
"@atlaskit/analytics-next": "^11.0.0",
|
64
64
|
"@atlaskit/editor-plugin-quick-insert": "^2.0.0",
|
65
|
-
"@atlaskit/editor-plugin-type-ahead": "^2.
|
65
|
+
"@atlaskit/editor-plugin-type-ahead": "^2.1.0",
|
66
66
|
"@atlaskit/ssr": "*",
|
67
67
|
"@atlaskit/visual-regression": "*",
|
68
68
|
"@testing-library/react": "^13.4.0",
|