@atlaskit/editor-plugin-text-formatting 2.2.2 → 2.2.3
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,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-text-formatting
|
|
2
2
|
|
|
3
|
+
## 2.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#150144](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/150144)
|
|
8
|
+
[`7cee8fc602804`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7cee8fc602804) -
|
|
9
|
+
Unselect the options when the selection has some part with only one formatting and some part
|
|
10
|
+
without any formatting
|
|
11
|
+
|
|
3
12
|
## 2.2.2
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.hasMultiplePartsWithFormattingInSelection = void 0;
|
|
7
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
7
8
|
var _types = require("./types");
|
|
8
9
|
var isMarkInIconTypes = function isMarkInIconTypes(node) {
|
|
9
10
|
return node.marks.some(function (mark) {
|
|
@@ -15,6 +16,15 @@ var hasMultiplePartsWithFormattingInSelection = exports.hasMultiplePartsWithForm
|
|
|
15
16
|
if (!selectedContent) {
|
|
16
17
|
return false;
|
|
17
18
|
}
|
|
19
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_8')) {
|
|
20
|
+
// Check if there are multiple parts with formatting or if only one part has formatting and the rest have none
|
|
21
|
+
var contentWithMarks = selectedContent.filter(function (child) {
|
|
22
|
+
return isMarkInIconTypes(child);
|
|
23
|
+
});
|
|
24
|
+
var hasFormatting = contentWithMarks.length > 0;
|
|
25
|
+
var allPartsHaveFormatting = contentWithMarks.length === selectedContent.length;
|
|
26
|
+
return hasFormatting && (!allPartsHaveFormatting || contentWithMarks.length > 1);
|
|
27
|
+
}
|
|
18
28
|
var marks = selectedContent.map(function (child) {
|
|
19
29
|
return isMarkInIconTypes(child) ? child.marks : undefined;
|
|
20
30
|
}).filter(Boolean);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
import { IconTypes } from './types';
|
|
2
3
|
const isMarkInIconTypes = node => node.marks.some(mark => Object.values(IconTypes).includes(mark.type.name));
|
|
3
4
|
export const hasMultiplePartsWithFormattingInSelection = ({
|
|
@@ -6,6 +7,13 @@ export const hasMultiplePartsWithFormattingInSelection = ({
|
|
|
6
7
|
if (!selectedContent) {
|
|
7
8
|
return false;
|
|
8
9
|
}
|
|
10
|
+
if (fg('platform_editor_controls_patch_8')) {
|
|
11
|
+
// Check if there are multiple parts with formatting or if only one part has formatting and the rest have none
|
|
12
|
+
const contentWithMarks = selectedContent.filter(child => isMarkInIconTypes(child));
|
|
13
|
+
const hasFormatting = contentWithMarks.length > 0;
|
|
14
|
+
const allPartsHaveFormatting = contentWithMarks.length === selectedContent.length;
|
|
15
|
+
return hasFormatting && (!allPartsHaveFormatting || contentWithMarks.length > 1);
|
|
16
|
+
}
|
|
9
17
|
const marks = selectedContent.map(child => isMarkInIconTypes(child) ? child.marks : undefined).filter(Boolean);
|
|
10
18
|
return marks.length > 1;
|
|
11
19
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
import { IconTypes } from './types';
|
|
2
3
|
var isMarkInIconTypes = function isMarkInIconTypes(node) {
|
|
3
4
|
return node.marks.some(function (mark) {
|
|
@@ -9,6 +10,15 @@ export var hasMultiplePartsWithFormattingInSelection = function hasMultipleParts
|
|
|
9
10
|
if (!selectedContent) {
|
|
10
11
|
return false;
|
|
11
12
|
}
|
|
13
|
+
if (fg('platform_editor_controls_patch_8')) {
|
|
14
|
+
// Check if there are multiple parts with formatting or if only one part has formatting and the rest have none
|
|
15
|
+
var contentWithMarks = selectedContent.filter(function (child) {
|
|
16
|
+
return isMarkInIconTypes(child);
|
|
17
|
+
});
|
|
18
|
+
var hasFormatting = contentWithMarks.length > 0;
|
|
19
|
+
var allPartsHaveFormatting = contentWithMarks.length === selectedContent.length;
|
|
20
|
+
return hasFormatting && (!allPartsHaveFormatting || contentWithMarks.length > 1);
|
|
21
|
+
}
|
|
12
22
|
var marks = selectedContent.map(function (child) {
|
|
13
23
|
return isMarkInIconTypes(child) ? child.marks : undefined;
|
|
14
24
|
}).filter(Boolean);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-text-formatting",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"description": "Text-formatting plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -107,6 +107,9 @@
|
|
|
107
107
|
"platform_editor_resolve_marks": {
|
|
108
108
|
"type": "boolean"
|
|
109
109
|
},
|
|
110
|
+
"platform_editor_controls_patch_8": {
|
|
111
|
+
"type": "boolean"
|
|
112
|
+
},
|
|
110
113
|
"editor_inline_comments_on_inline_nodes": {
|
|
111
114
|
"type": "boolean"
|
|
112
115
|
},
|