@atlaskit/editor-plugin-block-type 6.2.1 → 6.2.2
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,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-type
|
|
2
2
|
|
|
3
|
+
## 6.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#200079](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/200079)
|
|
8
|
+
[`ce48926ed3661`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ce48926ed3661) -
|
|
9
|
+
Clean up bugfix feature flag
|
|
10
|
+
|
|
3
11
|
## 6.2.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -16,10 +16,8 @@ exports.setNormalTextWithAnalytics = setNormalTextWithAnalytics;
|
|
|
16
16
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
17
17
|
var _editorAnalytics = require("@atlaskit/editor-common/editor-analytics");
|
|
18
18
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
19
|
-
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
20
19
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
21
20
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
22
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
23
21
|
var _blockTypes = require("../block-types");
|
|
24
22
|
var _clearFormatting = require("./clear-formatting");
|
|
25
23
|
var _wrapSelectionIn = require("./wrapSelectionIn");
|
|
@@ -58,28 +56,20 @@ function setHeading(level, fromBlockQuote) {
|
|
|
58
56
|
if (!range) {
|
|
59
57
|
return;
|
|
60
58
|
}
|
|
61
|
-
if ((0, _platformFeatureFlags.fg)('platform_editor_bugfix_remove_block_quote')) {
|
|
62
|
-
// First, lift the content out of the blockquote
|
|
63
|
-
var targetLiftDepth = (0, _transform.liftTarget)(range);
|
|
64
|
-
if (targetLiftDepth || targetLiftDepth === 0) {
|
|
65
|
-
tr.lift(range, targetLiftDepth);
|
|
66
|
-
}
|
|
67
59
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
tr.setBlockType(newFrom, newTo, schema.nodes.heading, {
|
|
73
|
-
level: level
|
|
74
|
-
});
|
|
75
|
-
} else {
|
|
76
|
-
var content = $from.node().content;
|
|
77
|
-
var headingNode = schema.nodes.heading.createChecked({
|
|
78
|
-
level: level
|
|
79
|
-
}, content);
|
|
80
|
-
var slice = new _model.Slice(_model.Fragment.from(headingNode), 0, 0);
|
|
81
|
-
tr.replaceRange(range.start, range.end, slice);
|
|
60
|
+
// First, lift the content out of the blockquote
|
|
61
|
+
var targetLiftDepth = (0, _transform.liftTarget)(range);
|
|
62
|
+
if (targetLiftDepth || targetLiftDepth === 0) {
|
|
63
|
+
tr.lift(range, targetLiftDepth);
|
|
82
64
|
}
|
|
65
|
+
|
|
66
|
+
// Then apply the heading block type to the lifted content
|
|
67
|
+
// We need to recalculate positions after the lift operation
|
|
68
|
+
var newFrom = tr.mapping.map($from.pos);
|
|
69
|
+
var newTo = tr.mapping.map($to.pos);
|
|
70
|
+
tr.setBlockType(newFrom, newTo, schema.nodes.heading, {
|
|
71
|
+
level: level
|
|
72
|
+
});
|
|
83
73
|
} else {
|
|
84
74
|
tr.setBlockType($from.pos, $to.pos, schema.nodes.heading, {
|
|
85
75
|
level: level
|
|
@@ -121,14 +111,11 @@ function setNormalText(fromBlockQuote) {
|
|
|
121
111
|
if (!range) {
|
|
122
112
|
return;
|
|
123
113
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
} else {
|
|
131
|
-
tr.lift(range, 0);
|
|
114
|
+
|
|
115
|
+
// First, lift the content out of the blockquote
|
|
116
|
+
var targetLiftDepth = (0, _transform.liftTarget)(range);
|
|
117
|
+
if (targetLiftDepth || targetLiftDepth === 0) {
|
|
118
|
+
tr.lift(range, targetLiftDepth);
|
|
132
119
|
}
|
|
133
120
|
var newFrom = tr.mapping.map($from.pos);
|
|
134
121
|
var newTo = tr.mapping.map($to.pos);
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
3
3
|
import { filterChildrenBetween, wrapSelectionIn } from '@atlaskit/editor-common/utils';
|
|
4
|
-
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
5
4
|
import { liftTarget } from '@atlaskit/editor-prosemirror/transform';
|
|
6
5
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
6
|
import { HEADINGS_BY_NAME, NORMAL_TEXT } from '../block-types';
|
|
9
7
|
import { FORMATTING_NODE_TYPES, FORMATTING_MARK_TYPES, cellSelectionNodesBetween, formatTypes, clearNodeFormattingOnSelection } from './clear-formatting';
|
|
10
8
|
import { wrapSelectionInBlockType } from './wrapSelectionIn';
|
|
@@ -51,28 +49,20 @@ export function setHeading(level, fromBlockQuote) {
|
|
|
51
49
|
if (!range) {
|
|
52
50
|
return;
|
|
53
51
|
}
|
|
54
|
-
if (fg('platform_editor_bugfix_remove_block_quote')) {
|
|
55
|
-
// First, lift the content out of the blockquote
|
|
56
|
-
const targetLiftDepth = liftTarget(range);
|
|
57
|
-
if (targetLiftDepth || targetLiftDepth === 0) {
|
|
58
|
-
tr.lift(range, targetLiftDepth);
|
|
59
|
-
}
|
|
60
52
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
tr.setBlockType(newFrom, newTo, schema.nodes.heading, {
|
|
66
|
-
level
|
|
67
|
-
});
|
|
68
|
-
} else {
|
|
69
|
-
const content = $from.node().content;
|
|
70
|
-
const headingNode = schema.nodes.heading.createChecked({
|
|
71
|
-
level
|
|
72
|
-
}, content);
|
|
73
|
-
const slice = new Slice(Fragment.from(headingNode), 0, 0);
|
|
74
|
-
tr.replaceRange(range.start, range.end, slice);
|
|
53
|
+
// First, lift the content out of the blockquote
|
|
54
|
+
const targetLiftDepth = liftTarget(range);
|
|
55
|
+
if (targetLiftDepth || targetLiftDepth === 0) {
|
|
56
|
+
tr.lift(range, targetLiftDepth);
|
|
75
57
|
}
|
|
58
|
+
|
|
59
|
+
// Then apply the heading block type to the lifted content
|
|
60
|
+
// We need to recalculate positions after the lift operation
|
|
61
|
+
const newFrom = tr.mapping.map($from.pos);
|
|
62
|
+
const newTo = tr.mapping.map($to.pos);
|
|
63
|
+
tr.setBlockType(newFrom, newTo, schema.nodes.heading, {
|
|
64
|
+
level
|
|
65
|
+
});
|
|
76
66
|
} else {
|
|
77
67
|
tr.setBlockType($from.pos, $to.pos, schema.nodes.heading, {
|
|
78
68
|
level
|
|
@@ -125,14 +115,11 @@ export function setNormalText(fromBlockQuote) {
|
|
|
125
115
|
if (!range) {
|
|
126
116
|
return;
|
|
127
117
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
} else {
|
|
135
|
-
tr.lift(range, 0);
|
|
118
|
+
|
|
119
|
+
// First, lift the content out of the blockquote
|
|
120
|
+
const targetLiftDepth = liftTarget(range);
|
|
121
|
+
if (targetLiftDepth || targetLiftDepth === 0) {
|
|
122
|
+
tr.lift(range, targetLiftDepth);
|
|
136
123
|
}
|
|
137
124
|
const newFrom = tr.mapping.map($from.pos);
|
|
138
125
|
const newTo = tr.mapping.map($to.pos);
|
|
@@ -4,10 +4,8 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
6
6
|
import { filterChildrenBetween, wrapSelectionIn } from '@atlaskit/editor-common/utils';
|
|
7
|
-
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
8
7
|
import { liftTarget } from '@atlaskit/editor-prosemirror/transform';
|
|
9
8
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
10
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
9
|
import { HEADINGS_BY_NAME, NORMAL_TEXT } from '../block-types';
|
|
12
10
|
import { FORMATTING_NODE_TYPES, FORMATTING_MARK_TYPES, cellSelectionNodesBetween, formatTypes, clearNodeFormattingOnSelection } from './clear-formatting';
|
|
13
11
|
import { wrapSelectionInBlockType } from './wrapSelectionIn';
|
|
@@ -43,28 +41,20 @@ export function setHeading(level, fromBlockQuote) {
|
|
|
43
41
|
if (!range) {
|
|
44
42
|
return;
|
|
45
43
|
}
|
|
46
|
-
if (fg('platform_editor_bugfix_remove_block_quote')) {
|
|
47
|
-
// First, lift the content out of the blockquote
|
|
48
|
-
var targetLiftDepth = liftTarget(range);
|
|
49
|
-
if (targetLiftDepth || targetLiftDepth === 0) {
|
|
50
|
-
tr.lift(range, targetLiftDepth);
|
|
51
|
-
}
|
|
52
44
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
tr.setBlockType(newFrom, newTo, schema.nodes.heading, {
|
|
58
|
-
level: level
|
|
59
|
-
});
|
|
60
|
-
} else {
|
|
61
|
-
var content = $from.node().content;
|
|
62
|
-
var headingNode = schema.nodes.heading.createChecked({
|
|
63
|
-
level: level
|
|
64
|
-
}, content);
|
|
65
|
-
var slice = new Slice(Fragment.from(headingNode), 0, 0);
|
|
66
|
-
tr.replaceRange(range.start, range.end, slice);
|
|
45
|
+
// First, lift the content out of the blockquote
|
|
46
|
+
var targetLiftDepth = liftTarget(range);
|
|
47
|
+
if (targetLiftDepth || targetLiftDepth === 0) {
|
|
48
|
+
tr.lift(range, targetLiftDepth);
|
|
67
49
|
}
|
|
50
|
+
|
|
51
|
+
// Then apply the heading block type to the lifted content
|
|
52
|
+
// We need to recalculate positions after the lift operation
|
|
53
|
+
var newFrom = tr.mapping.map($from.pos);
|
|
54
|
+
var newTo = tr.mapping.map($to.pos);
|
|
55
|
+
tr.setBlockType(newFrom, newTo, schema.nodes.heading, {
|
|
56
|
+
level: level
|
|
57
|
+
});
|
|
68
58
|
} else {
|
|
69
59
|
tr.setBlockType($from.pos, $to.pos, schema.nodes.heading, {
|
|
70
60
|
level: level
|
|
@@ -106,14 +96,11 @@ export function setNormalText(fromBlockQuote) {
|
|
|
106
96
|
if (!range) {
|
|
107
97
|
return;
|
|
108
98
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
} else {
|
|
116
|
-
tr.lift(range, 0);
|
|
99
|
+
|
|
100
|
+
// First, lift the content out of the blockquote
|
|
101
|
+
var targetLiftDepth = liftTarget(range);
|
|
102
|
+
if (targetLiftDepth || targetLiftDepth === 0) {
|
|
103
|
+
tr.lift(range, targetLiftDepth);
|
|
117
104
|
}
|
|
118
105
|
var newFrom = tr.mapping.map($from.pos);
|
|
119
106
|
var newTo = tr.mapping.map($to.pos);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-type",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.2",
|
|
4
4
|
"description": "BlockType plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@emotion/react": "^11.7.1"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@atlaskit/editor-common": "^107.
|
|
60
|
+
"@atlaskit/editor-common": "^107.22.0",
|
|
61
61
|
"react": "^18.2.0",
|
|
62
62
|
"react-dom": "^18.2.0",
|
|
63
63
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
@@ -118,9 +118,6 @@
|
|
|
118
118
|
},
|
|
119
119
|
"platform_editor_use_preferences_plugin": {
|
|
120
120
|
"type": "boolean"
|
|
121
|
-
},
|
|
122
|
-
"platform_editor_bugfix_remove_block_quote": {
|
|
123
|
-
"type": "boolean"
|
|
124
121
|
}
|
|
125
122
|
}
|
|
126
123
|
}
|