@atlaskit/editor-plugin-block-type 19.0.5 → 19.0.7
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 +14 -0
- package/dist/cjs/pm-plugins/commands/clear-formatting.js +1 -1
- package/dist/cjs/pm-plugins/ui/ToolbarBlockType/index.js +2 -4
- package/dist/cjs/pm-plugins/utils.js +19 -23
- package/dist/es2019/pm-plugins/commands/clear-formatting.js +1 -1
- package/dist/es2019/pm-plugins/ui/ToolbarBlockType/index.js +2 -4
- package/dist/es2019/pm-plugins/utils.js +20 -24
- package/dist/esm/pm-plugins/commands/clear-formatting.js +1 -1
- package/dist/esm/pm-plugins/ui/ToolbarBlockType/index.js +2 -4
- package/dist/esm/pm-plugins/utils.js +19 -23
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-type
|
|
2
2
|
|
|
3
|
+
## 19.0.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`70c05b380d08c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/70c05b380d08c) -
|
|
8
|
+
Clean up experiment `platform_editor_blockquote_in_text_formatting_menu` as globally enabled.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 19.0.6
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 19.0.5
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -9,7 +9,7 @@ exports.formatTypes = void 0;
|
|
|
9
9
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
10
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
11
11
|
// Functions duplicated from platform/packages/editor/editor-plugin-text-formatting/src/editor-commands/clear-formatting.ts
|
|
12
|
-
// TODO: ED-26959 - Refactor to avoid duplication
|
|
12
|
+
// TODO: ED-26959 - Refactor to avoid duplication.
|
|
13
13
|
var FORMATTING_NODE_TYPES = exports.FORMATTING_NODE_TYPES = ['heading', 'blockquote'];
|
|
14
14
|
var FORMATTING_MARK_TYPES = exports.FORMATTING_MARK_TYPES = ['em', 'code', 'strike', 'strong', 'underline', 'textColor', 'subsup', 'backgroundColor'];
|
|
15
15
|
var formatTypes = exports.formatTypes = {
|
|
@@ -238,11 +238,9 @@ var ToolbarBlockType = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
238
238
|
blockTypeIcon: currentIcon || defaultIcon
|
|
239
239
|
});
|
|
240
240
|
return (0, _react2.jsx)("span", {
|
|
241
|
-
css:
|
|
241
|
+
css:
|
|
242
242
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
243
|
-
[_styles.wrapperStyle, _styled.floatingToolbarWrapperStyle]
|
|
244
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
245
|
-
_styles.wrapperStyle
|
|
243
|
+
[_styles.wrapperStyle, _styled.floatingToolbarWrapperStyle]
|
|
246
244
|
}, (0, _react2.jsx)(_uiMenu.DropdownMenuWithKeyboardNavigation, {
|
|
247
245
|
items: items,
|
|
248
246
|
onOpenChange: this.onOpenChange,
|
|
@@ -16,7 +16,6 @@ var _transforms = require("@atlaskit/editor-common/transforms");
|
|
|
16
16
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
17
17
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
18
18
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
19
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
20
19
|
var _blockTypes = require("./block-types");
|
|
21
20
|
var isNodeAWrappingBlockNode = exports.isNodeAWrappingBlockNode = function isNodeAWrappingBlockNode(node) {
|
|
22
21
|
if (!node) {
|
|
@@ -127,28 +126,25 @@ function areBlockTypesDisabled(state) {
|
|
|
127
126
|
}
|
|
128
127
|
return disallowedWrapperTypes.length > 0;
|
|
129
128
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
return disallowedWrapperTypes.length > 0 && (!hasQuote || hasNestedListInQuote);
|
|
150
|
-
}
|
|
151
|
-
return disallowedWrapperTypes.length > 0;
|
|
129
|
+
var hasQuote = false;
|
|
130
|
+
var hasNestedListInQuote = false;
|
|
131
|
+
var _state$selection2 = state.selection,
|
|
132
|
+
$from = _state$selection2.$from,
|
|
133
|
+
$to = _state$selection2.$to;
|
|
134
|
+
state.doc.nodesBetween($from.pos, $to.pos, function (node) {
|
|
135
|
+
if (node.type === blockquote) {
|
|
136
|
+
hasQuote = true;
|
|
137
|
+
node.descendants(function (child) {
|
|
138
|
+
if (child.type === bulletList || child.type === orderedList) {
|
|
139
|
+
hasNestedListInQuote = true;
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
return true;
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
return !hasNestedListInQuote;
|
|
146
|
+
});
|
|
147
|
+
return disallowedWrapperTypes.length > 0 && (!hasQuote || hasNestedListInQuote);
|
|
152
148
|
}
|
|
153
149
|
|
|
154
150
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { liftTarget } from '@atlaskit/editor-prosemirror/transform';
|
|
3
3
|
// Functions duplicated from platform/packages/editor/editor-plugin-text-formatting/src/editor-commands/clear-formatting.ts
|
|
4
|
-
// TODO: ED-26959 - Refactor to avoid duplication
|
|
4
|
+
// TODO: ED-26959 - Refactor to avoid duplication.
|
|
5
5
|
export const FORMATTING_NODE_TYPES = ['heading', 'blockquote'];
|
|
6
6
|
export const FORMATTING_MARK_TYPES = ['em', 'code', 'strike', 'strong', 'underline', 'textColor', 'subsup', 'backgroundColor'];
|
|
7
7
|
export const formatTypes = {
|
|
@@ -208,11 +208,9 @@ class ToolbarBlockType extends React.PureComponent {
|
|
|
208
208
|
blockTypeIcon: currentIcon || defaultIcon
|
|
209
209
|
});
|
|
210
210
|
return jsx("span", {
|
|
211
|
-
css:
|
|
211
|
+
css:
|
|
212
212
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
213
|
-
[wrapperStyle, floatingToolbarWrapperStyle]
|
|
214
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
215
|
-
wrapperStyle
|
|
213
|
+
[wrapperStyle, floatingToolbarWrapperStyle]
|
|
216
214
|
}, jsx(DropdownMenu, {
|
|
217
215
|
items: items,
|
|
218
216
|
onOpenChange: this.onOpenChange,
|
|
@@ -3,7 +3,6 @@ import { createBlockTaskItem } from '@atlaskit/editor-common/transforms';
|
|
|
3
3
|
import { createRule, createWrappingJoinRule } from '@atlaskit/editor-common/utils';
|
|
4
4
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
6
|
import { WRAPPER_BLOCK_TYPES, FORMATTING_NODE_TYPES, FORMATTING_MARK_TYPES } from './block-types';
|
|
8
7
|
export const isNodeAWrappingBlockNode = node => {
|
|
9
8
|
if (!node) {
|
|
@@ -109,29 +108,26 @@ export function areBlockTypesDisabled(state, allowFontSize = false) {
|
|
|
109
108
|
}
|
|
110
109
|
return disallowedWrapperTypes.length > 0;
|
|
111
110
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return disallowedWrapperTypes.length > 0 && (!hasQuote || hasNestedListInQuote);
|
|
133
|
-
}
|
|
134
|
-
return disallowedWrapperTypes.length > 0;
|
|
111
|
+
let hasQuote = false;
|
|
112
|
+
let hasNestedListInQuote = false;
|
|
113
|
+
const {
|
|
114
|
+
$from,
|
|
115
|
+
$to
|
|
116
|
+
} = state.selection;
|
|
117
|
+
state.doc.nodesBetween($from.pos, $to.pos, node => {
|
|
118
|
+
if (node.type === blockquote) {
|
|
119
|
+
hasQuote = true;
|
|
120
|
+
node.descendants(child => {
|
|
121
|
+
if (child.type === bulletList || child.type === orderedList) {
|
|
122
|
+
hasNestedListInQuote = true;
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
return true;
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return !hasNestedListInQuote;
|
|
129
|
+
});
|
|
130
|
+
return disallowedWrapperTypes.length > 0 && (!hasQuote || hasNestedListInQuote);
|
|
135
131
|
}
|
|
136
132
|
|
|
137
133
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { liftTarget } from '@atlaskit/editor-prosemirror/transform';
|
|
3
3
|
// Functions duplicated from platform/packages/editor/editor-plugin-text-formatting/src/editor-commands/clear-formatting.ts
|
|
4
|
-
// TODO: ED-26959 - Refactor to avoid duplication
|
|
4
|
+
// TODO: ED-26959 - Refactor to avoid duplication.
|
|
5
5
|
export var FORMATTING_NODE_TYPES = ['heading', 'blockquote'];
|
|
6
6
|
export var FORMATTING_MARK_TYPES = ['em', 'code', 'strike', 'strong', 'underline', 'textColor', 'subsup', 'backgroundColor'];
|
|
7
7
|
export var formatTypes = {
|
|
@@ -234,11 +234,9 @@ var ToolbarBlockType = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
234
234
|
blockTypeIcon: currentIcon || defaultIcon
|
|
235
235
|
});
|
|
236
236
|
return jsx("span", {
|
|
237
|
-
css:
|
|
237
|
+
css:
|
|
238
238
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
239
|
-
[wrapperStyle, floatingToolbarWrapperStyle]
|
|
240
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
241
|
-
wrapperStyle
|
|
239
|
+
[wrapperStyle, floatingToolbarWrapperStyle]
|
|
242
240
|
}, jsx(DropdownMenu, {
|
|
243
241
|
items: items,
|
|
244
242
|
onOpenChange: this.onOpenChange,
|
|
@@ -3,7 +3,6 @@ import { createBlockTaskItem } from '@atlaskit/editor-common/transforms';
|
|
|
3
3
|
import { createRule, createWrappingJoinRule } from '@atlaskit/editor-common/utils';
|
|
4
4
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
6
|
import { WRAPPER_BLOCK_TYPES, FORMATTING_NODE_TYPES, FORMATTING_MARK_TYPES } from './block-types';
|
|
8
7
|
export var isNodeAWrappingBlockNode = function isNodeAWrappingBlockNode(node) {
|
|
9
8
|
if (!node) {
|
|
@@ -114,28 +113,25 @@ export function areBlockTypesDisabled(state) {
|
|
|
114
113
|
}
|
|
115
114
|
return disallowedWrapperTypes.length > 0;
|
|
116
115
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return disallowedWrapperTypes.length > 0 && (!hasQuote || hasNestedListInQuote);
|
|
137
|
-
}
|
|
138
|
-
return disallowedWrapperTypes.length > 0;
|
|
116
|
+
var hasQuote = false;
|
|
117
|
+
var hasNestedListInQuote = false;
|
|
118
|
+
var _state$selection2 = state.selection,
|
|
119
|
+
$from = _state$selection2.$from,
|
|
120
|
+
$to = _state$selection2.$to;
|
|
121
|
+
state.doc.nodesBetween($from.pos, $to.pos, function (node) {
|
|
122
|
+
if (node.type === blockquote) {
|
|
123
|
+
hasQuote = true;
|
|
124
|
+
node.descendants(function (child) {
|
|
125
|
+
if (child.type === bulletList || child.type === orderedList) {
|
|
126
|
+
hasNestedListInQuote = true;
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
return true;
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return !hasNestedListInQuote;
|
|
133
|
+
});
|
|
134
|
+
return disallowedWrapperTypes.length > 0 && (!hasQuote || hasNestedListInQuote);
|
|
139
135
|
}
|
|
140
136
|
|
|
141
137
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-type",
|
|
3
|
-
"version": "19.0.
|
|
3
|
+
"version": "19.0.7",
|
|
4
4
|
"description": "BlockType plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"@atlaskit/editor-tables": "^3.0.0",
|
|
37
37
|
"@atlaskit/editor-toolbar": "^2.4.0",
|
|
38
38
|
"@atlaskit/editor-toolbar-model": "^1.2.0",
|
|
39
|
-
"@atlaskit/icon": "^37.
|
|
40
|
-
"@atlaskit/icon-lab": "^7.
|
|
39
|
+
"@atlaskit/icon": "^37.4.0",
|
|
40
|
+
"@atlaskit/icon-lab": "^7.6.0",
|
|
41
41
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
42
42
|
"@atlaskit/platform-feature-flags": "^2.1.0",
|
|
43
43
|
"@atlaskit/primitives": "^22.2.0",
|
|
44
44
|
"@atlaskit/prosemirror-history": "^1.2.0",
|
|
45
45
|
"@atlaskit/prosemirror-input-rules": "^4.0.0",
|
|
46
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
46
|
+
"@atlaskit/tmp-editor-statsig": "^152.0.0",
|
|
47
47
|
"@atlaskit/tokens": "^16.7.0",
|
|
48
48
|
"@babel/runtime": "^7.0.0",
|
|
49
49
|
"@compiled/react": "^1.0.2",
|