@atlaskit/editor-plugin-block-type 4.1.4 → 4.1.6
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 +16 -0
- package/dist/cjs/blockTypePlugin.js +3 -2
- package/dist/cjs/pm-plugins/commands/block-type.js +1 -7
- package/dist/cjs/pm-plugins/commands/clear-formatting.js +1 -5
- package/dist/cjs/pm-plugins/input-rule.js +2 -8
- package/dist/cjs/pm-plugins/main.js +1 -8
- package/dist/cjs/pm-plugins/utils.js +1 -4
- package/dist/es2019/blockTypePlugin.js +4 -3
- package/dist/es2019/pm-plugins/commands/block-type.js +1 -7
- package/dist/es2019/pm-plugins/commands/clear-formatting.js +1 -5
- package/dist/es2019/pm-plugins/input-rule.js +2 -8
- package/dist/es2019/pm-plugins/main.js +1 -8
- package/dist/es2019/pm-plugins/utils.js +1 -4
- package/dist/esm/blockTypePlugin.js +4 -3
- package/dist/esm/pm-plugins/commands/block-type.js +1 -7
- package/dist/esm/pm-plugins/commands/clear-formatting.js +1 -5
- package/dist/esm/pm-plugins/input-rule.js +2 -8
- package/dist/esm/pm-plugins/main.js +1 -8
- package/dist/esm/pm-plugins/utils.js +1 -4
- package/package.json +2 -5
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# @atlaskit/editor-plugin-block-type
|
2
2
|
|
3
|
+
## 4.1.6
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#107473](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/107473)
|
8
|
+
[`962b3297548df`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/962b3297548df) -
|
9
|
+
[ux] Implement variation 2 for editor contextual toolbar formatting experiment
|
10
|
+
|
11
|
+
## 4.1.5
|
12
|
+
|
13
|
+
### Patch Changes
|
14
|
+
|
15
|
+
- [#107139](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/107139)
|
16
|
+
[`3721ee9d53429`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3721ee9d53429) -
|
17
|
+
[ux] ED-26378 Editor Implementation - Clean up previous project FF in blockQuote
|
18
|
+
|
3
19
|
## 4.1.4
|
4
20
|
|
5
21
|
### Patch Changes
|
@@ -100,7 +100,6 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
|
|
100
100
|
var _api$primaryToolbar;
|
101
101
|
var options = _ref3.config,
|
102
102
|
api = _ref3.api;
|
103
|
-
var isNestingInQuoteSchemaChanged = (0, _platformFeatureFlags.fg)('platform_editor_nest_in_quotes_adf_change') || (0, _platformFeatureFlags.fg)('editor_nest_media_and_codeblock_in_quotes_jira');
|
104
103
|
var primaryToolbarComponent = function primaryToolbarComponent(_ref4) {
|
105
104
|
var popupsMountPoint = _ref4.popupsMountPoint,
|
106
105
|
popupsBoundariesElement = _ref4.popupsBoundariesElement,
|
@@ -135,7 +134,7 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
|
|
135
134
|
node: _adfSchema.heading
|
136
135
|
}, {
|
137
136
|
name: 'blockquote',
|
138
|
-
node:
|
137
|
+
node: _adfSchema.blockquoteWithNestedCodeblockOrMedia
|
139
138
|
}, {
|
140
139
|
name: 'hardBreak',
|
141
140
|
node: _adfSchema.hardBreak
|
@@ -208,6 +207,8 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
|
|
208
207
|
selectionToolbar: function selectionToolbar() {
|
209
208
|
if ((0, _experiments.editorExperiment)('contextual_formatting_toolbar', true, {
|
210
209
|
exposure: true
|
210
|
+
}) || (0, _experiments.editorExperiment)('platform_editor_contextual_formatting_toolbar_v2', 'variant1', {
|
211
|
+
exposure: true
|
211
212
|
}) || (0, _experiments.editorExperiment)('platform_editor_contextual_formatting_toolbar_v2', 'variant2', {
|
212
213
|
exposure: true
|
213
214
|
})) {
|
@@ -71,9 +71,6 @@ function setHeading(level, fromBlockQuote) {
|
|
71
71
|
return tr;
|
72
72
|
};
|
73
73
|
}
|
74
|
-
|
75
|
-
// Ignored via go/ees005
|
76
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
77
74
|
function setBlockTypeWithAnalytics(name, inputMethod, editorAnalyticsApi, fromBlockQuote) {
|
78
75
|
return function (_ref4) {
|
79
76
|
var tr = _ref4.tr;
|
@@ -230,10 +227,7 @@ function setNormalTextWithAnalytics(inputMethod, editorAnalyticsApi, fromBlockQu
|
|
230
227
|
};
|
231
228
|
});
|
232
229
|
}
|
233
|
-
var setHeadingWithAnalytics = exports.setHeadingWithAnalytics = function setHeadingWithAnalytics(newHeadingLevel, inputMethod, editorAnalyticsApi, fromBlockQuote
|
234
|
-
// Ignored via go/ees005
|
235
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
236
|
-
) {
|
230
|
+
var setHeadingWithAnalytics = exports.setHeadingWithAnalytics = function setHeadingWithAnalytics(newHeadingLevel, inputMethod, editorAnalyticsApi, fromBlockQuote) {
|
237
231
|
return withCurrentHeadingLevel(function (previousHeadingLevel) {
|
238
232
|
return function (_ref10) {
|
239
233
|
var tr = _ref10.tr;
|
@@ -22,15 +22,11 @@ var formatTypes = exports.formatTypes = {
|
|
22
22
|
subsup: 'subsup',
|
23
23
|
backgroundColor: _analytics.ACTION_SUBJECT_ID.FORMAT_BACKGROUND_COLOR
|
24
24
|
};
|
25
|
-
var cellSelectionNodesBetween = exports.cellSelectionNodesBetween = function cellSelectionNodesBetween(selection, doc, f, startPos
|
26
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
27
|
-
) {
|
25
|
+
var cellSelectionNodesBetween = exports.cellSelectionNodesBetween = function cellSelectionNodesBetween(selection, doc, f, startPos) {
|
28
26
|
selection.forEachCell(function (cell, cellPos) {
|
29
27
|
doc.nodesBetween(cellPos, cellPos + cell.nodeSize, f, startPos);
|
30
28
|
});
|
31
29
|
};
|
32
|
-
|
33
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
34
30
|
function clearNodeFormattingOnSelection(schema, tr, formattedNodeType, nodeName, formattingCleared) {
|
35
31
|
return function (node, pos) {
|
36
32
|
if (node.type === formattedNodeType) {
|
@@ -45,10 +45,7 @@ function getHeadingRules(editorAnalyticsAPI, schema) {
|
|
45
45
|
var leftNodeReplacementHashRule = (0, _utils.createRule)(
|
46
46
|
// Ignored via go/ees005
|
47
47
|
// eslint-disable-next-line require-unicode-regexp
|
48
|
-
new RegExp("".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "(#{1,6})\\s$")),
|
49
|
-
// Ignored via go/ees005
|
50
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
51
|
-
function (state, match, start, end) {
|
48
|
+
new RegExp("".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "(#{1,6})\\s$")), function (state, match, start, end) {
|
52
49
|
var level = match[1].length;
|
53
50
|
return (0, _commands.insertBlock)(state, schema.nodes.heading, start, end, {
|
54
51
|
level: level
|
@@ -83,10 +80,7 @@ function getBlockQuoteRules(editorAnalyticsAPI, schema) {
|
|
83
80
|
var leftNodeReplacementGreatherRule = (0, _utils.createRule)(
|
84
81
|
// Ignored via go/ees005
|
85
82
|
// eslint-disable-next-line require-unicode-regexp
|
86
|
-
new RegExp("".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "\\s*>\\s$")),
|
87
|
-
// Ignored via go/ees005
|
88
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
89
|
-
function (state, _match, start, end) {
|
83
|
+
new RegExp("".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "\\s*>\\s$")), function (state, _match, start, end) {
|
90
84
|
return (0, _commands.insertBlock)(state, schema.nodes.blockquote, start, end);
|
91
85
|
});
|
92
86
|
|
@@ -81,10 +81,7 @@ var autoformatHeading = function autoformatHeading(headingLevel, editorAnalytics
|
|
81
81
|
return (0, _blockType.setHeadingWithAnalytics)(headingLevel, _analytics.INPUT_METHOD.FORMATTING, editorAnalyticsApi);
|
82
82
|
};
|
83
83
|
var pluginKey = exports.pluginKey = new _state.PluginKey('blockTypePlugin');
|
84
|
-
var createPlugin = exports.createPlugin = function createPlugin(editorAPI, dispatch, lastNodeMustBeParagraph, includeBlockQuoteAsTextstyleOption
|
85
|
-
// Ignored via go/ees005
|
86
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
87
|
-
) {
|
84
|
+
var createPlugin = exports.createPlugin = function createPlugin(editorAPI, dispatch, lastNodeMustBeParagraph, includeBlockQuoteAsTextstyleOption) {
|
88
85
|
var _editorAPI$analytics;
|
89
86
|
var editorAnalyticsApi = editorAPI === null || editorAPI === void 0 || (_editorAPI$analytics = editorAPI.analytics) === null || _editorAPI$analytics === void 0 ? void 0 : _editorAPI$analytics.actions;
|
90
87
|
var altKeyLocation = 0;
|
@@ -121,8 +118,6 @@ var createPlugin = exports.createPlugin = function createPlugin(editorAPI, dispa
|
|
121
118
|
formattingIsPresent: formattingIsPresent
|
122
119
|
};
|
123
120
|
},
|
124
|
-
// Ignored via go/ees005
|
125
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
126
121
|
apply: function apply(_tr, oldPluginState, _oldState, newState) {
|
127
122
|
var newPluginState = _objectSpread(_objectSpread({}, oldPluginState), {}, {
|
128
123
|
currentBlockType: detectBlockType(oldPluginState.availableBlockTypesInDropdown, newState),
|
@@ -163,8 +158,6 @@ var createPlugin = exports.createPlugin = function createPlugin(editorAPI, dispa
|
|
163
158
|
}
|
164
159
|
return false;
|
165
160
|
},
|
166
|
-
// Ignored via go/ees005
|
167
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
168
161
|
handleDrop: function handleDrop(view, event, slice, moved) {
|
169
162
|
return handleBlockQuoteDND(view, event, slice);
|
170
163
|
}
|
@@ -32,10 +32,7 @@ var createWrappingTextBlockRule = exports.createWrappingTextBlockRule = function
|
|
32
32
|
var match = _ref.match,
|
33
33
|
nodeType = _ref.nodeType,
|
34
34
|
getAttrs = _ref.getAttrs;
|
35
|
-
var handler = function handler(state, match, start, end
|
36
|
-
// Ignored via go/ees005
|
37
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
38
|
-
) {
|
35
|
+
var handler = function handler(state, match, start, end) {
|
39
36
|
var fixedStart = Math.max(start, 1);
|
40
37
|
var $start = state.doc.resolve(fixedStart);
|
41
38
|
var attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
2
|
+
import { blockquoteWithNestedCodeblockOrMedia, 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';
|
@@ -91,7 +91,6 @@ const blockTypePlugin = ({
|
|
91
91
|
api
|
92
92
|
}) => {
|
93
93
|
var _api$primaryToolbar;
|
94
|
-
const isNestingInQuoteSchemaChanged = fg('platform_editor_nest_in_quotes_adf_change') || fg('editor_nest_media_and_codeblock_in_quotes_jira');
|
95
94
|
const primaryToolbarComponent = ({
|
96
95
|
popupsMountPoint,
|
97
96
|
popupsBoundariesElement,
|
@@ -127,7 +126,7 @@ const blockTypePlugin = ({
|
|
127
126
|
node: heading
|
128
127
|
}, {
|
129
128
|
name: 'blockquote',
|
130
|
-
node:
|
129
|
+
node: blockquoteWithNestedCodeblockOrMedia
|
131
130
|
}, {
|
132
131
|
name: 'hardBreak',
|
133
132
|
node: hardBreak
|
@@ -198,6 +197,8 @@ const blockTypePlugin = ({
|
|
198
197
|
selectionToolbar: () => {
|
199
198
|
if (editorExperiment('contextual_formatting_toolbar', true, {
|
200
199
|
exposure: true
|
200
|
+
}) || editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'variant1', {
|
201
|
+
exposure: true
|
201
202
|
}) || editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'variant2', {
|
202
203
|
exposure: true
|
203
204
|
})) {
|
@@ -64,9 +64,6 @@ export function setHeading(level, fromBlockQuote) {
|
|
64
64
|
return tr;
|
65
65
|
};
|
66
66
|
}
|
67
|
-
|
68
|
-
// Ignored via go/ees005
|
69
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
70
67
|
export function setBlockTypeWithAnalytics(name, inputMethod, editorAnalyticsApi, fromBlockQuote) {
|
71
68
|
return ({
|
72
69
|
tr
|
@@ -229,10 +226,7 @@ export function setNormalTextWithAnalytics(inputMethod, editorAnalyticsApi, from
|
|
229
226
|
});
|
230
227
|
});
|
231
228
|
}
|
232
|
-
export const setHeadingWithAnalytics = (newHeadingLevel, inputMethod, editorAnalyticsApi, fromBlockQuote
|
233
|
-
// Ignored via go/ees005
|
234
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
235
|
-
) => {
|
229
|
+
export const setHeadingWithAnalytics = (newHeadingLevel, inputMethod, editorAnalyticsApi, fromBlockQuote) => {
|
236
230
|
return withCurrentHeadingLevel(previousHeadingLevel => ({
|
237
231
|
tr
|
238
232
|
}) => {
|
@@ -14,15 +14,11 @@ export const formatTypes = {
|
|
14
14
|
subsup: 'subsup',
|
15
15
|
backgroundColor: ACTION_SUBJECT_ID.FORMAT_BACKGROUND_COLOR
|
16
16
|
};
|
17
|
-
export const cellSelectionNodesBetween = (selection, doc, f, startPos
|
18
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
19
|
-
) => {
|
17
|
+
export const cellSelectionNodesBetween = (selection, doc, f, startPos) => {
|
20
18
|
selection.forEachCell((cell, cellPos) => {
|
21
19
|
doc.nodesBetween(cellPos, cellPos + cell.nodeSize, f, startPos);
|
22
20
|
});
|
23
21
|
};
|
24
|
-
|
25
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
26
22
|
export function clearNodeFormattingOnSelection(schema, tr, formattedNodeType, nodeName, formattingCleared) {
|
27
23
|
return function (node, pos) {
|
28
24
|
if (node.type === formattedNodeType) {
|
@@ -37,10 +37,7 @@ function getHeadingRules(editorAnalyticsAPI, schema) {
|
|
37
37
|
const leftNodeReplacementHashRule = createRule(
|
38
38
|
// Ignored via go/ees005
|
39
39
|
// eslint-disable-next-line require-unicode-regexp
|
40
|
-
new RegExp(`${leafNodeReplacementCharacter}(#{1,6})\\s$`),
|
41
|
-
// Ignored via go/ees005
|
42
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
43
|
-
(state, match, start, end) => {
|
40
|
+
new RegExp(`${leafNodeReplacementCharacter}(#{1,6})\\s$`), (state, match, start, end) => {
|
44
41
|
const level = match[1].length;
|
45
42
|
return insertBlock(state, schema.nodes.heading, start, end, {
|
46
43
|
level
|
@@ -73,10 +70,7 @@ function getBlockQuoteRules(editorAnalyticsAPI, schema) {
|
|
73
70
|
const leftNodeReplacementGreatherRule = createRule(
|
74
71
|
// Ignored via go/ees005
|
75
72
|
// eslint-disable-next-line require-unicode-regexp
|
76
|
-
new RegExp(`${leafNodeReplacementCharacter}\\s*>\\s$`),
|
77
|
-
// Ignored via go/ees005
|
78
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
79
|
-
(state, _match, start, end) => {
|
73
|
+
new RegExp(`${leafNodeReplacementCharacter}\\s*>\\s$`), (state, _match, start, end) => {
|
80
74
|
return insertBlock(state, schema.nodes.blockquote, start, end);
|
81
75
|
});
|
82
76
|
|
@@ -70,10 +70,7 @@ const autoformatHeading = (headingLevel, editorAnalyticsApi) => {
|
|
70
70
|
return setHeadingWithAnalytics(headingLevel, INPUT_METHOD.FORMATTING, editorAnalyticsApi);
|
71
71
|
};
|
72
72
|
export const pluginKey = new PluginKey('blockTypePlugin');
|
73
|
-
export const createPlugin = (editorAPI, dispatch, lastNodeMustBeParagraph, includeBlockQuoteAsTextstyleOption
|
74
|
-
// Ignored via go/ees005
|
75
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
76
|
-
) => {
|
73
|
+
export const createPlugin = (editorAPI, dispatch, lastNodeMustBeParagraph, includeBlockQuoteAsTextstyleOption) => {
|
77
74
|
var _editorAPI$analytics;
|
78
75
|
const editorAnalyticsApi = editorAPI === null || editorAPI === void 0 ? void 0 : (_editorAPI$analytics = editorAPI.analytics) === null || _editorAPI$analytics === void 0 ? void 0 : _editorAPI$analytics.actions;
|
79
76
|
let altKeyLocation = 0;
|
@@ -106,8 +103,6 @@ export const createPlugin = (editorAPI, dispatch, lastNodeMustBeParagraph, inclu
|
|
106
103
|
formattingIsPresent
|
107
104
|
};
|
108
105
|
},
|
109
|
-
// Ignored via go/ees005
|
110
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
111
106
|
apply(_tr, oldPluginState, _oldState, newState) {
|
112
107
|
const newPluginState = {
|
113
108
|
...oldPluginState,
|
@@ -149,8 +144,6 @@ export const createPlugin = (editorAPI, dispatch, lastNodeMustBeParagraph, inclu
|
|
149
144
|
}
|
150
145
|
return false;
|
151
146
|
},
|
152
|
-
// Ignored via go/ees005
|
153
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
154
147
|
handleDrop(view, event, slice, moved) {
|
155
148
|
return handleBlockQuoteDND(view, event, slice);
|
156
149
|
}
|
@@ -22,10 +22,7 @@ export const createWrappingTextBlockRule = ({
|
|
22
22
|
nodeType,
|
23
23
|
getAttrs
|
24
24
|
}) => {
|
25
|
-
const handler = (state, match, start, end
|
26
|
-
// Ignored via go/ees005
|
27
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
28
|
-
) => {
|
25
|
+
const handler = (state, match, start, end) => {
|
29
26
|
const fixedStart = Math.max(start, 1);
|
30
27
|
const $start = state.doc.resolve(fixedStart);
|
31
28
|
const attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
2
2
|
import React from 'react';
|
3
|
-
import {
|
3
|
+
import { blockquoteWithNestedCodeblockOrMedia, hardBreak, heading } from '@atlaskit/adf-schema';
|
4
4
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
5
5
|
import { keymap, tooltip } from '@atlaskit/editor-common/keymaps';
|
6
6
|
import { blockTypeMessages as messages } from '@atlaskit/editor-common/messages';
|
@@ -93,7 +93,6 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
|
|
93
93
|
var _api$primaryToolbar;
|
94
94
|
var options = _ref3.config,
|
95
95
|
api = _ref3.api;
|
96
|
-
var isNestingInQuoteSchemaChanged = fg('platform_editor_nest_in_quotes_adf_change') || fg('editor_nest_media_and_codeblock_in_quotes_jira');
|
97
96
|
var primaryToolbarComponent = function primaryToolbarComponent(_ref4) {
|
98
97
|
var popupsMountPoint = _ref4.popupsMountPoint,
|
99
98
|
popupsBoundariesElement = _ref4.popupsBoundariesElement,
|
@@ -128,7 +127,7 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
|
|
128
127
|
node: heading
|
129
128
|
}, {
|
130
129
|
name: 'blockquote',
|
131
|
-
node:
|
130
|
+
node: blockquoteWithNestedCodeblockOrMedia
|
132
131
|
}, {
|
133
132
|
name: 'hardBreak',
|
134
133
|
node: hardBreak
|
@@ -201,6 +200,8 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
|
|
201
200
|
selectionToolbar: function selectionToolbar() {
|
202
201
|
if (editorExperiment('contextual_formatting_toolbar', true, {
|
203
202
|
exposure: true
|
203
|
+
}) || editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'variant1', {
|
204
|
+
exposure: true
|
204
205
|
}) || editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'variant2', {
|
205
206
|
exposure: true
|
206
207
|
})) {
|
@@ -56,9 +56,6 @@ export function setHeading(level, fromBlockQuote) {
|
|
56
56
|
return tr;
|
57
57
|
};
|
58
58
|
}
|
59
|
-
|
60
|
-
// Ignored via go/ees005
|
61
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
62
59
|
export function setBlockTypeWithAnalytics(name, inputMethod, editorAnalyticsApi, fromBlockQuote) {
|
63
60
|
return function (_ref4) {
|
64
61
|
var tr = _ref4.tr;
|
@@ -215,10 +212,7 @@ export function setNormalTextWithAnalytics(inputMethod, editorAnalyticsApi, from
|
|
215
212
|
};
|
216
213
|
});
|
217
214
|
}
|
218
|
-
export var setHeadingWithAnalytics = function setHeadingWithAnalytics(newHeadingLevel, inputMethod, editorAnalyticsApi, fromBlockQuote
|
219
|
-
// Ignored via go/ees005
|
220
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
221
|
-
) {
|
215
|
+
export var setHeadingWithAnalytics = function setHeadingWithAnalytics(newHeadingLevel, inputMethod, editorAnalyticsApi, fromBlockQuote) {
|
222
216
|
return withCurrentHeadingLevel(function (previousHeadingLevel) {
|
223
217
|
return function (_ref10) {
|
224
218
|
var tr = _ref10.tr;
|
@@ -14,15 +14,11 @@ export var formatTypes = {
|
|
14
14
|
subsup: 'subsup',
|
15
15
|
backgroundColor: ACTION_SUBJECT_ID.FORMAT_BACKGROUND_COLOR
|
16
16
|
};
|
17
|
-
export var cellSelectionNodesBetween = function cellSelectionNodesBetween(selection, doc, f, startPos
|
18
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
19
|
-
) {
|
17
|
+
export var cellSelectionNodesBetween = function cellSelectionNodesBetween(selection, doc, f, startPos) {
|
20
18
|
selection.forEachCell(function (cell, cellPos) {
|
21
19
|
doc.nodesBetween(cellPos, cellPos + cell.nodeSize, f, startPos);
|
22
20
|
});
|
23
21
|
};
|
24
|
-
|
25
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
26
22
|
export function clearNodeFormattingOnSelection(schema, tr, formattedNodeType, nodeName, formattingCleared) {
|
27
23
|
return function (node, pos) {
|
28
24
|
if (node.type === formattedNodeType) {
|
@@ -38,10 +38,7 @@ function getHeadingRules(editorAnalyticsAPI, schema) {
|
|
38
38
|
var leftNodeReplacementHashRule = createRule(
|
39
39
|
// Ignored via go/ees005
|
40
40
|
// eslint-disable-next-line require-unicode-regexp
|
41
|
-
new RegExp("".concat(leafNodeReplacementCharacter, "(#{1,6})\\s$")),
|
42
|
-
// Ignored via go/ees005
|
43
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
44
|
-
function (state, match, start, end) {
|
41
|
+
new RegExp("".concat(leafNodeReplacementCharacter, "(#{1,6})\\s$")), function (state, match, start, end) {
|
45
42
|
var level = match[1].length;
|
46
43
|
return insertBlock(state, schema.nodes.heading, start, end, {
|
47
44
|
level: level
|
@@ -76,10 +73,7 @@ function getBlockQuoteRules(editorAnalyticsAPI, schema) {
|
|
76
73
|
var leftNodeReplacementGreatherRule = createRule(
|
77
74
|
// Ignored via go/ees005
|
78
75
|
// eslint-disable-next-line require-unicode-regexp
|
79
|
-
new RegExp("".concat(leafNodeReplacementCharacter, "\\s*>\\s$")),
|
80
|
-
// Ignored via go/ees005
|
81
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
82
|
-
function (state, _match, start, end) {
|
76
|
+
new RegExp("".concat(leafNodeReplacementCharacter, "\\s*>\\s$")), function (state, _match, start, end) {
|
83
77
|
return insertBlock(state, schema.nodes.blockquote, start, end);
|
84
78
|
});
|
85
79
|
|
@@ -74,10 +74,7 @@ var autoformatHeading = function autoformatHeading(headingLevel, editorAnalytics
|
|
74
74
|
return setHeadingWithAnalytics(headingLevel, INPUT_METHOD.FORMATTING, editorAnalyticsApi);
|
75
75
|
};
|
76
76
|
export var pluginKey = new PluginKey('blockTypePlugin');
|
77
|
-
export var createPlugin = function createPlugin(editorAPI, dispatch, lastNodeMustBeParagraph, includeBlockQuoteAsTextstyleOption
|
78
|
-
// Ignored via go/ees005
|
79
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
80
|
-
) {
|
77
|
+
export var createPlugin = function createPlugin(editorAPI, dispatch, lastNodeMustBeParagraph, includeBlockQuoteAsTextstyleOption) {
|
81
78
|
var _editorAPI$analytics;
|
82
79
|
var editorAnalyticsApi = editorAPI === null || editorAPI === void 0 || (_editorAPI$analytics = editorAPI.analytics) === null || _editorAPI$analytics === void 0 ? void 0 : _editorAPI$analytics.actions;
|
83
80
|
var altKeyLocation = 0;
|
@@ -114,8 +111,6 @@ export var createPlugin = function createPlugin(editorAPI, dispatch, lastNodeMus
|
|
114
111
|
formattingIsPresent: formattingIsPresent
|
115
112
|
};
|
116
113
|
},
|
117
|
-
// Ignored via go/ees005
|
118
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
119
114
|
apply: function apply(_tr, oldPluginState, _oldState, newState) {
|
120
115
|
var newPluginState = _objectSpread(_objectSpread({}, oldPluginState), {}, {
|
121
116
|
currentBlockType: detectBlockType(oldPluginState.availableBlockTypesInDropdown, newState),
|
@@ -156,8 +151,6 @@ export var createPlugin = function createPlugin(editorAPI, dispatch, lastNodeMus
|
|
156
151
|
}
|
157
152
|
return false;
|
158
153
|
},
|
159
|
-
// Ignored via go/ees005
|
160
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
161
154
|
handleDrop: function handleDrop(view, event, slice, moved) {
|
162
155
|
return handleBlockQuoteDND(view, event, slice);
|
163
156
|
}
|
@@ -25,10 +25,7 @@ export var createWrappingTextBlockRule = function createWrappingTextBlockRule(_r
|
|
25
25
|
var match = _ref.match,
|
26
26
|
nodeType = _ref.nodeType,
|
27
27
|
getAttrs = _ref.getAttrs;
|
28
|
-
var handler = function handler(state, match, start, end
|
29
|
-
// Ignored via go/ees005
|
30
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
31
|
-
) {
|
28
|
+
var handler = function handler(state, match, start, end) {
|
32
29
|
var fixedStart = Math.max(start, 1);
|
33
30
|
var $start = state.doc.resolve(fixedStart);
|
34
31
|
var attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atlaskit/editor-plugin-block-type",
|
3
|
-
"version": "4.1.
|
3
|
+
"version": "4.1.6",
|
4
4
|
"description": "BlockType plugin for @atlaskit/editor-core",
|
5
5
|
"author": "Atlassian Pty Ltd",
|
6
6
|
"license": "Apache-2.0",
|
@@ -45,7 +45,7 @@
|
|
45
45
|
"@atlaskit/primitives": "^13.3.0",
|
46
46
|
"@atlaskit/prosemirror-input-rules": "^3.2.0",
|
47
47
|
"@atlaskit/theme": "^14.0.0",
|
48
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
48
|
+
"@atlaskit/tmp-editor-statsig": "^2.41.0",
|
49
49
|
"@atlaskit/tokens": "^3.2.0",
|
50
50
|
"@babel/runtime": "^7.0.0",
|
51
51
|
"@emotion/react": "^11.7.1"
|
@@ -110,9 +110,6 @@
|
|
110
110
|
"platform_editor_toolbar_responsive_fixes": {
|
111
111
|
"type": "boolean"
|
112
112
|
},
|
113
|
-
"platform_editor_nest_in_quotes_adf_change": {
|
114
|
-
"type": "boolean"
|
115
|
-
},
|
116
113
|
"platform_editor_toolbar_fix_for_disabled_options": {
|
117
114
|
"type": "boolean"
|
118
115
|
}
|