@atlaskit/editor-plugin-block-type 4.0.13 → 4.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 +16 -0
- package/dist/cjs/blockTypePlugin.js +3 -0
- package/dist/cjs/pm-plugins/block-types.js +3 -1
- package/dist/cjs/pm-plugins/commands/block-type.js +65 -11
- package/dist/cjs/pm-plugins/commands/clear-formatting.js +58 -0
- package/dist/cjs/pm-plugins/input-rule.js +18 -2
- package/dist/cjs/pm-plugins/keymap.js +26 -2
- package/dist/cjs/pm-plugins/main.js +14 -4
- package/dist/cjs/pm-plugins/ui/FloatingToolbarComponent.js +9 -1
- package/dist/cjs/pm-plugins/ui/PrimaryToolbarComponent.js +8 -0
- package/dist/cjs/pm-plugins/ui/ToolbarBlockType/blocktype-button.js +4 -1
- package/dist/cjs/pm-plugins/ui/ToolbarBlockType/index.js +83 -46
- package/dist/cjs/pm-plugins/ui/ToolbarBlockType/styled.js +15 -1
- package/dist/cjs/pm-plugins/utils.js +61 -7
- package/dist/es2019/blockTypePlugin.js +4 -1
- package/dist/es2019/pm-plugins/block-types.js +2 -0
- package/dist/es2019/pm-plugins/commands/block-type.js +57 -2
- package/dist/es2019/pm-plugins/commands/clear-formatting.js +50 -0
- package/dist/es2019/pm-plugins/input-rule.js +18 -2
- package/dist/es2019/pm-plugins/keymap.js +25 -2
- package/dist/es2019/pm-plugins/main.js +15 -5
- package/dist/es2019/pm-plugins/ui/FloatingToolbarComponent.js +9 -1
- package/dist/es2019/pm-plugins/ui/PrimaryToolbarComponent.js +8 -0
- package/dist/es2019/pm-plugins/ui/ToolbarBlockType/blocktype-button.js +4 -1
- package/dist/es2019/pm-plugins/ui/ToolbarBlockType/index.js +84 -49
- package/dist/es2019/pm-plugins/ui/ToolbarBlockType/styled.js +14 -0
- package/dist/es2019/pm-plugins/utils.js +63 -7
- package/dist/esm/blockTypePlugin.js +4 -1
- package/dist/esm/pm-plugins/block-types.js +2 -0
- package/dist/esm/pm-plugins/commands/block-type.js +62 -10
- package/dist/esm/pm-plugins/commands/clear-formatting.js +50 -0
- package/dist/esm/pm-plugins/input-rule.js +18 -2
- package/dist/esm/pm-plugins/keymap.js +25 -2
- package/dist/esm/pm-plugins/main.js +15 -5
- package/dist/esm/pm-plugins/ui/FloatingToolbarComponent.js +9 -1
- package/dist/esm/pm-plugins/ui/PrimaryToolbarComponent.js +8 -0
- package/dist/esm/pm-plugins/ui/ToolbarBlockType/blocktype-button.js +4 -1
- package/dist/esm/pm-plugins/ui/ToolbarBlockType/index.js +85 -48
- package/dist/esm/pm-plugins/ui/ToolbarBlockType/styled.js +14 -0
- package/dist/esm/pm-plugins/utils.js +61 -7
- package/dist/types/blockTypePluginType.d.ts +1 -0
- package/dist/types/pm-plugins/block-types.d.ts +2 -0
- package/dist/types/pm-plugins/commands/block-type.d.ts +1 -0
- package/dist/types/pm-plugins/commands/clear-formatting.d.ts +8 -0
- package/dist/types/pm-plugins/main.d.ts +2 -7
- package/dist/types/pm-plugins/ui/ToolbarBlockType/index.d.ts +1 -0
- package/dist/types/pm-plugins/ui/ToolbarBlockType/styled.d.ts +1 -0
- package/dist/types/pm-plugins/utils.d.ts +3 -0
- package/dist/types-ts4.5/blockTypePluginType.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/block-types.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/commands/block-type.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/commands/clear-formatting.d.ts +8 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +2 -7
- package/dist/types-ts4.5/pm-plugins/ui/ToolbarBlockType/index.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/ui/ToolbarBlockType/styled.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/utils.d.ts +3 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# @atlaskit/editor-plugin-block-type
|
2
2
|
|
3
|
+
## 4.1.0
|
4
|
+
|
5
|
+
### Minor Changes
|
6
|
+
|
7
|
+
- [#96424](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/96424)
|
8
|
+
[`e14834ad65277`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e14834ad65277) -
|
9
|
+
[ux] Add clear formatting option to text styling menu
|
10
|
+
|
11
|
+
## 4.0.14
|
12
|
+
|
13
|
+
### Patch Changes
|
14
|
+
|
15
|
+
- [#99053](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99053)
|
16
|
+
[`a850374dfb10a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a850374dfb10a) -
|
17
|
+
[ux] ED-26049 Disable text styles menu button if lists are nested inside blockquot
|
18
|
+
|
3
19
|
## 4.0.13
|
4
20
|
|
5
21
|
### Patch Changes
|
@@ -191,6 +191,9 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
|
|
191
191
|
insertBlockQuote: function insertBlockQuote(inputMethod) {
|
192
192
|
var _api$analytics5;
|
193
193
|
return (0, _blockType.insertBlockQuoteWithAnalyticsCommand)(inputMethod, api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions);
|
194
|
+
},
|
195
|
+
clearFormatting: function clearFormatting() {
|
196
|
+
return (0, _blockType.clearFormatting)();
|
194
197
|
}
|
195
198
|
},
|
196
199
|
getSharedState: function getSharedState(editorState) {
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.getBlockTypesInDropdown = exports.WRAPPER_BLOCK_TYPES = exports.TEXT_BLOCK_TYPES = exports.PANEL = exports.OTHER = exports.NORMAL_TEXT = exports.HEADING_6 = exports.HEADING_5 = exports.HEADING_4 = exports.HEADING_3 = exports.HEADING_2 = exports.HEADING_1 = exports.HEADINGS_BY_NAME = exports.HEADINGS_BY_LEVEL = exports.CODE_BLOCK = exports.BLOCK_QUOTE = exports.ALL_BLOCK_TYPES = void 0;
|
6
|
+
exports.getBlockTypesInDropdown = exports.WRAPPER_BLOCK_TYPES = exports.TEXT_BLOCK_TYPES = exports.PANEL = exports.OTHER = exports.NORMAL_TEXT = exports.HEADING_6 = exports.HEADING_5 = exports.HEADING_4 = exports.HEADING_3 = exports.HEADING_2 = exports.HEADING_1 = exports.HEADINGS_BY_NAME = exports.HEADINGS_BY_LEVEL = exports.FORMATTING_NODE_TYPES = exports.FORMATTING_MARK_TYPES = exports.CODE_BLOCK = exports.BLOCK_QUOTE = exports.ALL_BLOCK_TYPES = void 0;
|
7
7
|
var _messages = require("@atlaskit/editor-common/messages");
|
8
8
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
9
9
|
var NORMAL_TEXT = exports.NORMAL_TEXT = {
|
@@ -76,6 +76,8 @@ var OTHER = exports.OTHER = {
|
|
76
76
|
nodeName: ''
|
77
77
|
};
|
78
78
|
var TEXT_BLOCK_TYPES = exports.TEXT_BLOCK_TYPES = [NORMAL_TEXT, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6];
|
79
|
+
var FORMATTING_NODE_TYPES = exports.FORMATTING_NODE_TYPES = ['heading', 'blockquote'];
|
80
|
+
var FORMATTING_MARK_TYPES = exports.FORMATTING_MARK_TYPES = ['em', 'code', 'strike', 'strong', 'underline', 'textColor', 'subsup', 'backgroundColor'];
|
79
81
|
var WRAPPER_BLOCK_TYPES = exports.WRAPPER_BLOCK_TYPES = [BLOCK_QUOTE, CODE_BLOCK, PANEL];
|
80
82
|
var ALL_BLOCK_TYPES = exports.ALL_BLOCK_TYPES = TEXT_BLOCK_TYPES.concat(WRAPPER_BLOCK_TYPES);
|
81
83
|
var getBlockTypesInDropdown = exports.getBlockTypesInDropdown = function getBlockTypesInDropdown(includeBlockQuoteAsTextstyleOption) {
|
@@ -3,7 +3,9 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.cleanUpAtTheStartOfDocument = void 0;
|
7
|
+
exports.clearFormatting = clearFormatting;
|
8
|
+
exports.insertBlockQuoteWithAnalytics = void 0;
|
7
9
|
exports.insertBlockQuoteWithAnalyticsCommand = insertBlockQuoteWithAnalyticsCommand;
|
8
10
|
exports.setBlockType = setBlockType;
|
9
11
|
exports.setBlockTypeWithAnalytics = setBlockTypeWithAnalytics;
|
@@ -17,6 +19,7 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
17
19
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
18
20
|
var _editorTables = require("@atlaskit/editor-tables");
|
19
21
|
var _blockTypes = require("../block-types");
|
22
|
+
var _clearFormatting = require("./clear-formatting");
|
20
23
|
var _wrapSelectionIn = require("./wrapSelectionIn");
|
21
24
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
22
25
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
@@ -68,6 +71,9 @@ function setHeading(level, fromBlockQuote) {
|
|
68
71
|
return tr;
|
69
72
|
};
|
70
73
|
}
|
74
|
+
|
75
|
+
// Ignored via go/ees005
|
76
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
71
77
|
function setBlockTypeWithAnalytics(name, inputMethod, editorAnalyticsApi, fromBlockQuote) {
|
72
78
|
return function (_ref4) {
|
73
79
|
var tr = _ref4.tr;
|
@@ -108,9 +114,54 @@ function setNormalText(fromBlockQuote) {
|
|
108
114
|
return tr;
|
109
115
|
};
|
110
116
|
}
|
111
|
-
function
|
117
|
+
function clearFormatting() {
|
112
118
|
return function (_ref7) {
|
113
119
|
var tr = _ref7.tr;
|
120
|
+
var formattingCleared = [];
|
121
|
+
var schema = tr.doc.type.schema;
|
122
|
+
_clearFormatting.FORMATTING_MARK_TYPES.forEach(function (mark) {
|
123
|
+
var _tr$selection = tr.selection,
|
124
|
+
from = _tr$selection.from,
|
125
|
+
to = _tr$selection.to;
|
126
|
+
var markType = schema.marks[mark];
|
127
|
+
if (!markType) {
|
128
|
+
return;
|
129
|
+
}
|
130
|
+
if (tr.selection instanceof _editorTables.CellSelection) {
|
131
|
+
(0, _clearFormatting.cellSelectionNodesBetween)(tr.selection, tr.doc, function (node, pos) {
|
132
|
+
var isTableCell = node.type === schema.nodes.tableCell || node.type === schema.nodes.tableHeader;
|
133
|
+
if (!isTableCell) {
|
134
|
+
return true;
|
135
|
+
}
|
136
|
+
if (tr.doc.rangeHasMark(pos, pos + node.nodeSize, markType)) {
|
137
|
+
formattingCleared.push(_clearFormatting.formatTypes[mark]);
|
138
|
+
tr.removeMark(pos, pos + node.nodeSize, markType);
|
139
|
+
}
|
140
|
+
return false;
|
141
|
+
});
|
142
|
+
} else if (tr.doc.rangeHasMark(from, to, markType)) {
|
143
|
+
formattingCleared.push(_clearFormatting.formatTypes[mark]);
|
144
|
+
tr.removeMark(from, to, markType);
|
145
|
+
}
|
146
|
+
});
|
147
|
+
_clearFormatting.FORMATTING_NODE_TYPES.forEach(function (nodeName) {
|
148
|
+
var formattedNodeType = schema.nodes[nodeName];
|
149
|
+
var _tr$selection2 = tr.selection,
|
150
|
+
$from = _tr$selection2.$from,
|
151
|
+
$to = _tr$selection2.$to;
|
152
|
+
if (tr.selection instanceof _editorTables.CellSelection) {
|
153
|
+
(0, _clearFormatting.cellSelectionNodesBetween)(tr.selection, tr.doc, (0, _clearFormatting.clearNodeFormattingOnSelection)(schema, tr, formattedNodeType, nodeName, formattingCleared));
|
154
|
+
} else {
|
155
|
+
tr.doc.nodesBetween($from.pos, $to.pos, (0, _clearFormatting.clearNodeFormattingOnSelection)(schema, tr, formattedNodeType, nodeName, formattingCleared));
|
156
|
+
}
|
157
|
+
});
|
158
|
+
tr.setStoredMarks([]);
|
159
|
+
return tr;
|
160
|
+
};
|
161
|
+
}
|
162
|
+
function withCurrentHeadingLevel(fn) {
|
163
|
+
return function (_ref8) {
|
164
|
+
var tr = _ref8.tr;
|
114
165
|
// Find all headings and paragraphs of text
|
115
166
|
var _tr$doc$type$schema$n = tr.doc.type.schema.nodes,
|
116
167
|
heading = _tr$doc$type$schema$n.heading,
|
@@ -147,8 +198,8 @@ function withCurrentHeadingLevel(fn) {
|
|
147
198
|
}
|
148
199
|
function setNormalTextWithAnalytics(inputMethod, editorAnalyticsApi, fromBlockQuote) {
|
149
200
|
return withCurrentHeadingLevel(function (previousHeadingLevel) {
|
150
|
-
return function (
|
151
|
-
var tr =
|
201
|
+
return function (_ref9) {
|
202
|
+
var tr = _ref9.tr;
|
152
203
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
153
204
|
action: _analytics.ACTION.FORMATTED,
|
154
205
|
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
@@ -166,10 +217,13 @@ function setNormalTextWithAnalytics(inputMethod, editorAnalyticsApi, fromBlockQu
|
|
166
217
|
};
|
167
218
|
});
|
168
219
|
}
|
169
|
-
var setHeadingWithAnalytics = exports.setHeadingWithAnalytics = function setHeadingWithAnalytics(newHeadingLevel, inputMethod, editorAnalyticsApi, fromBlockQuote
|
220
|
+
var setHeadingWithAnalytics = exports.setHeadingWithAnalytics = function setHeadingWithAnalytics(newHeadingLevel, inputMethod, editorAnalyticsApi, fromBlockQuote
|
221
|
+
// Ignored via go/ees005
|
222
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
223
|
+
) {
|
170
224
|
return withCurrentHeadingLevel(function (previousHeadingLevel) {
|
171
|
-
return function (
|
172
|
-
var tr =
|
225
|
+
return function (_ref10) {
|
226
|
+
var tr = _ref10.tr;
|
173
227
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
174
228
|
action: _analytics.ACTION.FORMATTED,
|
175
229
|
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
@@ -218,8 +272,8 @@ var insertBlockQuoteWithAnalytics = exports.insertBlockQuoteWithAnalytics = func
|
|
218
272
|
};
|
219
273
|
function insertBlockQuoteWithAnalyticsCommand(inputMethod, editorAnalyticsApi) {
|
220
274
|
return withCurrentHeadingLevel(function (previousHeadingLevel) {
|
221
|
-
return function (
|
222
|
-
var tr =
|
275
|
+
return function (_ref11) {
|
276
|
+
var tr = _ref11.tr;
|
223
277
|
var nodes = tr.doc.type.schema.nodes;
|
224
278
|
|
225
279
|
// TODO: analytics event
|
@@ -241,8 +295,8 @@ function insertBlockQuoteWithAnalyticsCommand(inputMethod, editorAnalyticsApi) {
|
|
241
295
|
});
|
242
296
|
}
|
243
297
|
var cleanUpAtTheStartOfDocument = exports.cleanUpAtTheStartOfDocument = function cleanUpAtTheStartOfDocument(state, dispatch) {
|
244
|
-
var
|
245
|
-
$cursor =
|
298
|
+
var _ref12 = state.selection,
|
299
|
+
$cursor = _ref12.$cursor;
|
246
300
|
if ($cursor && !$cursor.nodeBefore && !$cursor.nodeAfter && $cursor.pos === 1) {
|
247
301
|
var tr = state.tr,
|
248
302
|
schema = state.schema;
|
@@ -0,0 +1,58 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.cellSelectionNodesBetween = exports.FORMATTING_NODE_TYPES = exports.FORMATTING_MARK_TYPES = void 0;
|
7
|
+
exports.clearNodeFormattingOnSelection = clearNodeFormattingOnSelection;
|
8
|
+
exports.formatTypes = void 0;
|
9
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
10
|
+
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
11
|
+
// Functions duplicated from platform/packages/editor/editor-plugin-text-formatting/src/editor-commands/clear-formatting.ts
|
12
|
+
// TODO: Refactor to avoid duplication if platform_editor_blockquote_in_text_formatting_menu experiment is productionalised
|
13
|
+
var FORMATTING_NODE_TYPES = exports.FORMATTING_NODE_TYPES = ['heading', 'blockquote'];
|
14
|
+
var FORMATTING_MARK_TYPES = exports.FORMATTING_MARK_TYPES = ['em', 'code', 'strike', 'strong', 'underline', 'textColor', 'subsup', 'backgroundColor'];
|
15
|
+
var formatTypes = exports.formatTypes = {
|
16
|
+
em: _analytics.ACTION_SUBJECT_ID.FORMAT_ITALIC,
|
17
|
+
code: _analytics.ACTION_SUBJECT_ID.FORMAT_CODE,
|
18
|
+
strike: _analytics.ACTION_SUBJECT_ID.FORMAT_STRIKE,
|
19
|
+
strong: _analytics.ACTION_SUBJECT_ID.FORMAT_STRONG,
|
20
|
+
underline: _analytics.ACTION_SUBJECT_ID.FORMAT_UNDERLINE,
|
21
|
+
textColor: _analytics.ACTION_SUBJECT_ID.FORMAT_COLOR,
|
22
|
+
subsup: 'subsup',
|
23
|
+
backgroundColor: _analytics.ACTION_SUBJECT_ID.FORMAT_BACKGROUND_COLOR
|
24
|
+
};
|
25
|
+
var cellSelectionNodesBetween = exports.cellSelectionNodesBetween = function cellSelectionNodesBetween(selection, doc, f, startPos
|
26
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
27
|
+
) {
|
28
|
+
selection.forEachCell(function (cell, cellPos) {
|
29
|
+
doc.nodesBetween(cellPos, cellPos + cell.nodeSize, f, startPos);
|
30
|
+
});
|
31
|
+
};
|
32
|
+
|
33
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
34
|
+
function clearNodeFormattingOnSelection(schema, tr, formattedNodeType, nodeName, formattingCleared) {
|
35
|
+
return function (node, pos) {
|
36
|
+
if (node.type === formattedNodeType) {
|
37
|
+
if (formattedNodeType.isTextblock) {
|
38
|
+
tr.setNodeMarkup(pos, schema.nodes.paragraph);
|
39
|
+
formattingCleared.push(nodeName);
|
40
|
+
return false;
|
41
|
+
} else {
|
42
|
+
// In case of panel or blockquote
|
43
|
+
var fromPos = tr.doc.resolve(pos + 1);
|
44
|
+
var toPos = tr.doc.resolve(pos + node.nodeSize - 1);
|
45
|
+
var nodeRange = fromPos.blockRange(toPos);
|
46
|
+
if (nodeRange) {
|
47
|
+
var targetLiftDepth = (0, _transform.liftTarget)(nodeRange);
|
48
|
+
if (targetLiftDepth || targetLiftDepth === 0) {
|
49
|
+
formattingCleared.push(nodeName);
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
51
|
+
tr.lift(nodeRange, targetLiftDepth);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
return true;
|
57
|
+
};
|
58
|
+
}
|
@@ -20,12 +20,16 @@ function getHeadingLevel(match) {
|
|
20
20
|
}
|
21
21
|
function headingRule(nodeType, maxLevel) {
|
22
22
|
return (0, _utils2.createWrappingTextBlockRule)({
|
23
|
+
// Ignored via go/ees005
|
24
|
+
// eslint-disable-next-line require-unicode-regexp
|
23
25
|
match: new RegExp('^(#{1,' + maxLevel + '})\\s$'),
|
24
26
|
nodeType: nodeType,
|
25
27
|
getAttrs: getHeadingLevel
|
26
28
|
});
|
27
29
|
}
|
28
30
|
function blockQuoteRule(nodeType) {
|
31
|
+
// Ignored via go/ees005
|
32
|
+
// eslint-disable-next-line require-unicode-regexp
|
29
33
|
return (0, _utils2.createJoinNodesRule)(/^\s*>\s$/, nodeType);
|
30
34
|
}
|
31
35
|
|
@@ -38,7 +42,13 @@ function blockQuoteRule(nodeType) {
|
|
38
42
|
function getHeadingRules(editorAnalyticsAPI, schema) {
|
39
43
|
// '# ' for h1, '## ' for h2 and etc
|
40
44
|
var hashRule = headingRule(schema.nodes.heading, MAX_HEADING_LEVEL);
|
41
|
-
var leftNodeReplacementHashRule = (0, _utils.createRule)(
|
45
|
+
var leftNodeReplacementHashRule = (0, _utils.createRule)(
|
46
|
+
// Ignored via go/ees005
|
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) {
|
42
52
|
var level = match[1].length;
|
43
53
|
return (0, _commands.insertBlock)(state, schema.nodes.heading, start, end, {
|
44
54
|
level: level
|
@@ -70,7 +80,13 @@ function getHeadingRules(editorAnalyticsAPI, schema) {
|
|
70
80
|
function getBlockQuoteRules(editorAnalyticsAPI, schema) {
|
71
81
|
// '> ' for blockquote
|
72
82
|
var greatherThanRule = blockQuoteRule(schema.nodes.blockquote);
|
73
|
-
var leftNodeReplacementGreatherRule = (0, _utils.createRule)(
|
83
|
+
var leftNodeReplacementGreatherRule = (0, _utils.createRule)(
|
84
|
+
// Ignored via go/ees005
|
85
|
+
// 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) {
|
74
90
|
return (0, _commands.insertBlock)(state, schema.nodes.blockquote, start, end);
|
75
91
|
});
|
76
92
|
|
@@ -17,20 +17,44 @@ var _deleteBlockContent = require("./commands/delete-block-content");
|
|
17
17
|
var _utils2 = require("./utils");
|
18
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
19
19
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
20
|
+
// Ignored via go/ees005
|
21
|
+
// eslint-disable-next-line import/no-namespace
|
22
|
+
|
20
23
|
var backspaceCommand = (0, _commands.chainCommands)(_blockType.cleanUpAtTheStartOfDocument, (0, _deleteBlockContent.deleteBlockContent)(_utils2.isNodeAWrappingBlockNode), _deleteAndMoveCursor.deleteAndMoveCursor);
|
21
24
|
var del = (0, _commands.chainCommands)((0, _utils.deleteEmptyParagraphAndMoveBlockUp)(_utils2.isNodeAWrappingBlockNode), (0, _deleteBlockContent.deleteBlockContent)(_utils2.isNodeAWrappingBlockNode), _deleteAndMoveCursor.deleteAndMoveCursor);
|
22
25
|
function keymapPlugin(editorAnalyticsApi, schema, _featureFlags) {
|
23
26
|
var list = {};
|
24
|
-
(0, _keymaps.bindKeymapWithCommand)(
|
27
|
+
(0, _keymaps.bindKeymapWithCommand)(
|
28
|
+
// Ignored via go/ees005
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
30
|
+
_keymaps.insertNewLine.common, (0, _utils.insertNewLineWithAnalytics)(editorAnalyticsApi), list);
|
31
|
+
// Ignored via go/ees005
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
25
33
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveUp.common, _utils.createNewParagraphAbove, list);
|
34
|
+
// Ignored via go/ees005
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
26
36
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveDown.common, _utils.createNewParagraphBelow, list);
|
37
|
+
// Ignored via go/ees005
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
27
39
|
(0, _keymaps.bindKeymapWithCommand)((0, _keymaps.findKeyMapForBrowser)(_keymaps.redo), _history.redo, list);
|
40
|
+
|
41
|
+
// Ignored via go/ees005
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
28
43
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.undo.common, _history.undo, list);
|
44
|
+
|
45
|
+
// Ignored via go/ees005
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
29
47
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.backspace.common, backspaceCommand, list);
|
48
|
+
|
49
|
+
// Ignored via go/ees005
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
30
51
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.deleteKey.common, del, list);
|
31
52
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.forwardDelete.mac, del, list);
|
32
53
|
if (schema.nodes[blockTypes.BLOCK_QUOTE.nodeName]) {
|
33
|
-
(0, _keymaps.bindKeymapWithCommand)(
|
54
|
+
(0, _keymaps.bindKeymapWithCommand)(
|
55
|
+
// Ignored via go/ees005
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
57
|
+
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleBlockQuote), (0, _blockType.insertBlockQuoteWithAnalytics)(_analytics.INPUT_METHOD.KEYBOARD, editorAnalyticsApi), list);
|
34
58
|
}
|
35
59
|
return (0, _keymaps.keymap)(list);
|
36
60
|
}
|
@@ -81,7 +81,10 @@ 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
|
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
|
+
) {
|
85
88
|
var _editorAPI$analytics;
|
86
89
|
var editorAnalyticsApi = editorAPI === null || editorAPI === void 0 || (_editorAPI$analytics = editorAPI.analytics) === null || _editorAPI$analytics === void 0 ? void 0 : _editorAPI$analytics.actions;
|
87
90
|
var altKeyLocation = 0;
|
@@ -108,20 +111,25 @@ var createPlugin = exports.createPlugin = function createPlugin(editorAPI, dispa
|
|
108
111
|
var availableBlockTypesInDropdown = BLOCK_TYPES_IN_DROPDOWN.filter(function (blockType) {
|
109
112
|
return isBlockTypeSchemaSupported(blockType, state);
|
110
113
|
});
|
114
|
+
var formattingIsPresent = (0, _utils.hasBlockQuoteInOptions)(availableBlockTypesInDropdown) ? (0, _utils.checkFormattingIsPresent)(state) : undefined;
|
111
115
|
return {
|
112
116
|
currentBlockType: detectBlockType(availableBlockTypesInDropdown, state),
|
113
117
|
blockTypesDisabled: (0, _utils.areBlockTypesDisabled)(state),
|
114
118
|
availableBlockTypes: availableBlockTypes,
|
115
119
|
availableWrapperBlockTypes: availableWrapperBlockTypes,
|
116
|
-
availableBlockTypesInDropdown: availableBlockTypesInDropdown
|
120
|
+
availableBlockTypesInDropdown: availableBlockTypesInDropdown,
|
121
|
+
formattingIsPresent: formattingIsPresent
|
117
122
|
};
|
118
123
|
},
|
124
|
+
// Ignored via go/ees005
|
125
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
119
126
|
apply: function apply(_tr, oldPluginState, _oldState, newState) {
|
120
127
|
var newPluginState = _objectSpread(_objectSpread({}, oldPluginState), {}, {
|
121
128
|
currentBlockType: detectBlockType(oldPluginState.availableBlockTypesInDropdown, newState),
|
122
|
-
blockTypesDisabled: (0, _utils.areBlockTypesDisabled)(newState)
|
129
|
+
blockTypesDisabled: (0, _utils.areBlockTypesDisabled)(newState),
|
130
|
+
formattingIsPresent: (0, _utils.hasBlockQuoteInOptions)(oldPluginState.availableBlockTypesInDropdown) ? (0, _utils.checkFormattingIsPresent)(newState) : undefined
|
123
131
|
});
|
124
|
-
if (newPluginState.currentBlockType !== oldPluginState.currentBlockType || newPluginState.blockTypesDisabled !== oldPluginState.blockTypesDisabled) {
|
132
|
+
if (newPluginState.currentBlockType !== oldPluginState.currentBlockType || newPluginState.blockTypesDisabled !== oldPluginState.blockTypesDisabled || newPluginState.formattingIsPresent !== oldPluginState.formattingIsPresent) {
|
125
133
|
dispatch(pluginKey, newPluginState);
|
126
134
|
}
|
127
135
|
return newPluginState;
|
@@ -155,6 +163,8 @@ var createPlugin = exports.createPlugin = function createPlugin(editorAPI, dispa
|
|
155
163
|
}
|
156
164
|
return false;
|
157
165
|
},
|
166
|
+
// Ignored via go/ees005
|
167
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
158
168
|
handleDrop: function handleDrop(view, event, slice, moved) {
|
159
169
|
return handleBlockQuoteDND(view, event, slice);
|
160
170
|
}
|
@@ -30,13 +30,21 @@ function FloatingToolbarComponent(_ref) {
|
|
30
30
|
var _api$core2, _api$blockType2;
|
31
31
|
return api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(api === null || api === void 0 || (_api$blockType2 = api.blockType) === null || _api$blockType2 === void 0 || (_api$blockType2 = _api$blockType2.commands) === null || _api$blockType2 === void 0 ? void 0 : _api$blockType2.insertBlockQuote(_analytics.INPUT_METHOD.TOOLBAR));
|
32
32
|
}, [api]);
|
33
|
+
var clearFormatting = (0, _react.useCallback)(function () {
|
34
|
+
var _api$core3, _api$blockType3;
|
35
|
+
return api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(api === null || api === void 0 || (_api$blockType3 = api.blockType) === null || _api$blockType3 === void 0 || (_api$blockType3 = _api$blockType3.commands) === null || _api$blockType3 === void 0 ? void 0 : _api$blockType3.clearFormatting());
|
36
|
+
}, [api]);
|
33
37
|
return /*#__PURE__*/_react.default.createElement(_ToolbarBlockType.default, {
|
34
38
|
isSmall: FloatingToolbarSettings.isSmall,
|
35
39
|
isDisabled: FloatingToolbarSettings.disabled,
|
36
40
|
isReducedSpacing: FloatingToolbarSettings.isToolbarReducedSpacing,
|
37
|
-
setTextLevel: boundSetBlockType
|
41
|
+
setTextLevel: boundSetBlockType
|
42
|
+
// Ignored via go/ees005
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
44
|
+
,
|
38
45
|
pluginState: blockTypeState,
|
39
46
|
wrapBlockQuote: wrapBlockQuote,
|
47
|
+
clearFormatting: clearFormatting,
|
40
48
|
shouldUseDefaultRole: FloatingToolbarSettings.shouldUseDefaultRole,
|
41
49
|
api: api
|
42
50
|
});
|
@@ -28,12 +28,20 @@ function PrimaryToolbarComponent(_ref) {
|
|
28
28
|
var _api$core2, _api$blockType2;
|
29
29
|
return api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(api === null || api === void 0 || (_api$blockType2 = api.blockType) === null || _api$blockType2 === void 0 || (_api$blockType2 = _api$blockType2.commands) === null || _api$blockType2 === void 0 ? void 0 : _api$blockType2.insertBlockQuote(_analytics.INPUT_METHOD.TOOLBAR));
|
30
30
|
};
|
31
|
+
var clearFormatting = function clearFormatting() {
|
32
|
+
var _api$core3, _api$blockType3;
|
33
|
+
return api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(api === null || api === void 0 || (_api$blockType3 = api.blockType) === null || _api$blockType3 === void 0 || (_api$blockType3 = _api$blockType3.commands) === null || _api$blockType3 === void 0 ? void 0 : _api$blockType3.clearFormatting());
|
34
|
+
};
|
31
35
|
return /*#__PURE__*/_react.default.createElement(_ToolbarBlockType.default, {
|
32
36
|
isSmall: isSmall,
|
33
37
|
isDisabled: disabled,
|
34
38
|
isReducedSpacing: isToolbarReducedSpacing,
|
35
39
|
setTextLevel: boundSetBlockType,
|
36
40
|
wrapBlockQuote: wrapBlockQuote,
|
41
|
+
clearFormatting: clearFormatting
|
42
|
+
// Ignored via go/ees005
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
44
|
+
,
|
37
45
|
pluginState: blockTypeState,
|
38
46
|
popupsMountPoint: popupsMountPoint,
|
39
47
|
popupsBoundariesElement: popupsBoundariesElement,
|
@@ -71,5 +71,8 @@ var BlockTypeButton = exports.BlockTypeButton = function BlockTypeButton(props)
|
|
71
71
|
}))))
|
72
72
|
}, !props.isSmall && (0, _react2.jsx)(_primitives.Box, {
|
73
73
|
xcss: [buttonContentStyle, props.isReducedSpacing && buttonContentReducedSpacingStyle]
|
74
|
-
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage
|
74
|
+
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage
|
75
|
+
// Ignored via go/ees005
|
76
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
77
|
+
, props.title || _blockTypes.NORMAL_TEXT.title)));
|
75
78
|
};
|
@@ -15,10 +15,13 @@ var _react = _interopRequireDefault(require("react"));
|
|
15
15
|
var _react2 = require("@emotion/react");
|
16
16
|
var _reactIntlNext = require("react-intl-next");
|
17
17
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
18
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
18
19
|
var _styles = require("@atlaskit/editor-common/styles");
|
19
20
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
20
21
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
22
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
21
23
|
var _tokens = require("@atlaskit/tokens");
|
24
|
+
var _blockTypes = require("../../block-types");
|
22
25
|
var _blocktypeButton = require("./blocktype-button");
|
23
26
|
var _styled = require("./styled");
|
24
27
|
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; }
|
@@ -69,22 +72,21 @@ var ToolbarBlockType = /*#__PURE__*/function (_React$PureComponent) {
|
|
69
72
|
var formatMessage = _this.props.intl.formatMessage;
|
70
73
|
var _this$props$pluginSta = _this.props.pluginState,
|
71
74
|
currentBlockType = _this$props$pluginSta.currentBlockType,
|
72
|
-
availableBlockTypesInDropdown = _this$props$pluginSta.availableBlockTypesInDropdown
|
75
|
+
availableBlockTypesInDropdown = _this$props$pluginSta.availableBlockTypesInDropdown,
|
76
|
+
formattingIsPresent = _this$props$pluginSta.formattingIsPresent;
|
73
77
|
var items = availableBlockTypesInDropdown.map(function (blockType, index) {
|
74
78
|
var isActive = currentBlockType === blockType;
|
75
79
|
var tagName = blockType.tagName || 'p';
|
76
80
|
var Tag = tagName;
|
77
81
|
var keyMap = (0, _keymaps.findKeymapByDescription)(blockType.title.defaultMessage);
|
78
|
-
|
82
|
+
var item = {
|
79
83
|
content:
|
80
84
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
81
85
|
(0, _react2.jsx)("div", {
|
82
86
|
css: (0, _styled.blockTypeMenuItemStyle)(tagName, isActive, _this.state.typographyTheme)
|
83
87
|
}, (0, _react2.jsx)(Tag, null, formatMessage(blockType.title))),
|
84
88
|
value: blockType,
|
85
|
-
label: formatMessage(blockType.title),
|
86
89
|
'aria-label': (0, _keymaps.tooltip)(keyMap, formatMessage(blockType.title)),
|
87
|
-
keyShortcuts: (0, _keymaps.getAriaKeyshortcuts)(keyMap),
|
88
90
|
key: "".concat(blockType.name, "-").concat(index),
|
89
91
|
elemAfter:
|
90
92
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
@@ -93,7 +95,32 @@ var ToolbarBlockType = /*#__PURE__*/function (_React$PureComponent) {
|
|
93
95
|
}, (0, _keymaps.tooltip)(keyMap)),
|
94
96
|
isActive: isActive
|
95
97
|
};
|
98
|
+
return item;
|
96
99
|
});
|
100
|
+
if (availableBlockTypesInDropdown.map(function (blockType) {
|
101
|
+
return blockType.name;
|
102
|
+
}).includes('blockquote')) {
|
103
|
+
var clearFormattingItem = {
|
104
|
+
content: (0, _react2.jsx)("div", null, (0, _react2.jsx)("p", null, _messages.toolbarMessages.clearFormatting.defaultMessage)),
|
105
|
+
value: {
|
106
|
+
name: 'clearFormatting'
|
107
|
+
},
|
108
|
+
'aria-label': (0, _keymaps.tooltip)(_keymaps.clearFormatting, _messages.toolbarMessages.clearFormatting.defaultMessage),
|
109
|
+
key: 'clear-formatting',
|
110
|
+
elemAfter:
|
111
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
112
|
+
(0, _react2.jsx)("div", {
|
113
|
+
css: [_styled.keyboardShortcut]
|
114
|
+
}, (0, _keymaps.tooltip)(_keymaps.clearFormatting)),
|
115
|
+
isActive: false,
|
116
|
+
isDisabled: currentBlockType === _blockTypes.NORMAL_TEXT && !formattingIsPresent
|
117
|
+
};
|
118
|
+
return [{
|
119
|
+
items: items
|
120
|
+
}, {
|
121
|
+
items: [clearFormattingItem]
|
122
|
+
}];
|
123
|
+
}
|
97
124
|
return [{
|
98
125
|
items: items
|
99
126
|
}];
|
@@ -106,8 +133,12 @@ var ToolbarBlockType = /*#__PURE__*/function (_React$PureComponent) {
|
|
106
133
|
if (blockType.name === 'blockquote') {
|
107
134
|
_this.props.wrapBlockQuote(blockType.name);
|
108
135
|
} else {
|
109
|
-
|
110
|
-
|
136
|
+
if (blockType.name === 'clearFormatting') {
|
137
|
+
_this.props.clearFormatting();
|
138
|
+
} else {
|
139
|
+
var fromBlockQuote = _this.props.pluginState.currentBlockType.name === 'blockquote';
|
140
|
+
_this.props.setTextLevel(blockType.name, fromBlockQuote);
|
141
|
+
}
|
111
142
|
}
|
112
143
|
if (shouldCloseMenu) {
|
113
144
|
_this.setState(_objectSpread(_objectSpread({}, _this.state), {}, {
|
@@ -173,49 +204,55 @@ var ToolbarBlockType = /*#__PURE__*/function (_React$PureComponent) {
|
|
173
204
|
}).map(function (blockType) {
|
174
205
|
return blockType.title;
|
175
206
|
});
|
176
|
-
if (!this.props.isDisabled &&
|
207
|
+
if (!this.props.isDisabled && !blockTypesDisabled) {
|
177
208
|
var items = this.createItems();
|
178
|
-
return (
|
209
|
+
return (0, _react2.jsx)("span", {
|
210
|
+
css: (0, _experiments.editorExperiment)('platform_editor_blockquote_in_text_formatting_menu', true) ?
|
211
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
212
|
+
[_styles.wrapperStyle, _styled.floatingToolbarWrapperStyle] :
|
179
213
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
214
|
+
_styles.wrapperStyle
|
215
|
+
}, (0, _react2.jsx)(_uiMenu.DropdownMenuWithKeyboardNavigation, {
|
216
|
+
items: items,
|
217
|
+
onOpenChange: this.onOpenChange,
|
218
|
+
onItemActivated: this.handleSelectBlockType,
|
219
|
+
isOpen: active,
|
220
|
+
mountTo: popupsMountPoint,
|
221
|
+
boundariesElement: popupsBoundariesElement,
|
222
|
+
scrollableElement: popupsScrollableElement,
|
223
|
+
zIndex: _editorSharedStyles.akEditorMenuZIndex,
|
224
|
+
fitHeight: 360,
|
225
|
+
fitWidth: 106,
|
226
|
+
section: {
|
227
|
+
hasSeparator: true
|
228
|
+
},
|
229
|
+
shouldUseDefaultRole: shouldUseDefaultRole
|
230
|
+
// hasSeparator={true}
|
231
|
+
,
|
232
|
+
shouldFocusFirstItem: function shouldFocusFirstItem() {
|
233
|
+
if (isOpenedByKeyboard) {
|
234
|
+
// eslint-disable-next-line @repo/internal/react/no-set-state-inside-render
|
235
|
+
_this3.setState(_objectSpread(_objectSpread({}, _this3.state), {}, {
|
236
|
+
isOpenedByKeyboard: false
|
237
|
+
}));
|
202
238
|
}
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
239
|
+
return isOpenedByKeyboard;
|
240
|
+
}
|
241
|
+
}, (0, _react2.jsx)(_blocktypeButton.BlockTypeButton, {
|
242
|
+
isSmall: isSmall,
|
243
|
+
isReducedSpacing: isReducedSpacing,
|
244
|
+
selected: active,
|
245
|
+
disabled: false,
|
246
|
+
title: blockTypeTitles[0],
|
247
|
+
onClick: this.handleTriggerClick,
|
248
|
+
onKeyDown: this.handleTriggerByKeyboard,
|
249
|
+
formatMessage: formatMessage,
|
250
|
+
"aria-expanded": active,
|
251
|
+
blockTypeName: currentBlockType.name
|
252
|
+
})), !(api !== null && api !== void 0 && api.primaryToolbar) && (0, _react2.jsx)("span", {
|
253
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
254
|
+
css: _styles.separatorStyles
|
255
|
+
}));
|
219
256
|
}
|
220
257
|
return (
|
221
258
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|