@atlaskit/editor-plugin-block-type 4.0.13 → 4.0.14
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 +8 -0
- package/dist/cjs/pm-plugins/commands/block-type.js +7 -1
- 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 +8 -1
- package/dist/cjs/pm-plugins/ui/FloatingToolbarComponent.js +4 -1
- package/dist/cjs/pm-plugins/ui/PrimaryToolbarComponent.js +4 -1
- package/dist/cjs/pm-plugins/ui/ToolbarBlockType/blocktype-button.js +4 -1
- package/dist/cjs/pm-plugins/ui/ToolbarBlockType/index.js +1 -1
- package/dist/cjs/pm-plugins/utils.js +20 -5
- package/dist/es2019/pm-plugins/commands/block-type.js +8 -2
- 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 +8 -1
- package/dist/es2019/pm-plugins/ui/FloatingToolbarComponent.js +4 -1
- package/dist/es2019/pm-plugins/ui/PrimaryToolbarComponent.js +4 -1
- package/dist/es2019/pm-plugins/ui/ToolbarBlockType/blocktype-button.js +4 -1
- package/dist/es2019/pm-plugins/ui/ToolbarBlockType/index.js +1 -1
- package/dist/es2019/pm-plugins/utils.js +20 -5
- package/dist/esm/pm-plugins/commands/block-type.js +7 -1
- 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 +8 -1
- package/dist/esm/pm-plugins/ui/FloatingToolbarComponent.js +4 -1
- package/dist/esm/pm-plugins/ui/PrimaryToolbarComponent.js +4 -1
- package/dist/esm/pm-plugins/ui/ToolbarBlockType/blocktype-button.js +4 -1
- package/dist/esm/pm-plugins/ui/ToolbarBlockType/index.js +1 -1
- package/dist/esm/pm-plugins/utils.js +20 -5
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# @atlaskit/editor-plugin-block-type
|
2
2
|
|
3
|
+
## 4.0.14
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#99053](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99053)
|
8
|
+
[`a850374dfb10a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a850374dfb10a) -
|
9
|
+
[ux] ED-26049 Disable text styles menu button if lists are nested inside blockquot
|
10
|
+
|
3
11
|
## 4.0.13
|
4
12
|
|
5
13
|
### Patch Changes
|
@@ -68,6 +68,9 @@ function setHeading(level, fromBlockQuote) {
|
|
68
68
|
return tr;
|
69
69
|
};
|
70
70
|
}
|
71
|
+
|
72
|
+
// Ignored via go/ees005
|
73
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
71
74
|
function setBlockTypeWithAnalytics(name, inputMethod, editorAnalyticsApi, fromBlockQuote) {
|
72
75
|
return function (_ref4) {
|
73
76
|
var tr = _ref4.tr;
|
@@ -166,7 +169,10 @@ function setNormalTextWithAnalytics(inputMethod, editorAnalyticsApi, fromBlockQu
|
|
166
169
|
};
|
167
170
|
});
|
168
171
|
}
|
169
|
-
var setHeadingWithAnalytics = exports.setHeadingWithAnalytics = function setHeadingWithAnalytics(newHeadingLevel, inputMethod, editorAnalyticsApi, fromBlockQuote
|
172
|
+
var setHeadingWithAnalytics = exports.setHeadingWithAnalytics = function setHeadingWithAnalytics(newHeadingLevel, inputMethod, editorAnalyticsApi, fromBlockQuote
|
173
|
+
// Ignored via go/ees005
|
174
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
175
|
+
) {
|
170
176
|
return withCurrentHeadingLevel(function (previousHeadingLevel) {
|
171
177
|
return function (_ref9) {
|
172
178
|
var tr = _ref9.tr;
|
@@ -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;
|
@@ -116,6 +119,8 @@ var createPlugin = exports.createPlugin = function createPlugin(editorAPI, dispa
|
|
116
119
|
availableBlockTypesInDropdown: availableBlockTypesInDropdown
|
117
120
|
};
|
118
121
|
},
|
122
|
+
// Ignored via go/ees005
|
123
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
119
124
|
apply: function apply(_tr, oldPluginState, _oldState, newState) {
|
120
125
|
var newPluginState = _objectSpread(_objectSpread({}, oldPluginState), {}, {
|
121
126
|
currentBlockType: detectBlockType(oldPluginState.availableBlockTypesInDropdown, newState),
|
@@ -155,6 +160,8 @@ var createPlugin = exports.createPlugin = function createPlugin(editorAPI, dispa
|
|
155
160
|
}
|
156
161
|
return false;
|
157
162
|
},
|
163
|
+
// Ignored via go/ees005
|
164
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
158
165
|
handleDrop: function handleDrop(view, event, slice, moved) {
|
159
166
|
return handleBlockQuoteDND(view, event, slice);
|
160
167
|
}
|
@@ -34,7 +34,10 @@ function FloatingToolbarComponent(_ref) {
|
|
34
34
|
isSmall: FloatingToolbarSettings.isSmall,
|
35
35
|
isDisabled: FloatingToolbarSettings.disabled,
|
36
36
|
isReducedSpacing: FloatingToolbarSettings.isToolbarReducedSpacing,
|
37
|
-
setTextLevel: boundSetBlockType
|
37
|
+
setTextLevel: boundSetBlockType
|
38
|
+
// Ignored via go/ees005
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
40
|
+
,
|
38
41
|
pluginState: blockTypeState,
|
39
42
|
wrapBlockQuote: wrapBlockQuote,
|
40
43
|
shouldUseDefaultRole: FloatingToolbarSettings.shouldUseDefaultRole,
|
@@ -33,7 +33,10 @@ function PrimaryToolbarComponent(_ref) {
|
|
33
33
|
isDisabled: disabled,
|
34
34
|
isReducedSpacing: isToolbarReducedSpacing,
|
35
35
|
setTextLevel: boundSetBlockType,
|
36
|
-
wrapBlockQuote: wrapBlockQuote
|
36
|
+
wrapBlockQuote: wrapBlockQuote
|
37
|
+
// Ignored via go/ees005
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
39
|
+
,
|
37
40
|
pluginState: blockTypeState,
|
38
41
|
popupsMountPoint: popupsMountPoint,
|
39
42
|
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
|
};
|
@@ -173,7 +173,7 @@ var ToolbarBlockType = /*#__PURE__*/function (_React$PureComponent) {
|
|
173
173
|
}).map(function (blockType) {
|
174
174
|
return blockType.title;
|
175
175
|
});
|
176
|
-
if (!this.props.isDisabled &&
|
176
|
+
if (!this.props.isDisabled && !blockTypesDisabled) {
|
177
177
|
var items = this.createItems();
|
178
178
|
return (
|
179
179
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
@@ -31,7 +31,10 @@ var createWrappingTextBlockRule = exports.createWrappingTextBlockRule = function
|
|
31
31
|
var match = _ref.match,
|
32
32
|
nodeType = _ref.nodeType,
|
33
33
|
getAttrs = _ref.getAttrs;
|
34
|
-
var handler = function handler(state, match, start, end
|
34
|
+
var handler = function handler(state, match, start, end
|
35
|
+
// Ignored via go/ees005
|
36
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
37
|
+
) {
|
35
38
|
var fixedStart = Math.max(start, 1);
|
36
39
|
var $start = state.doc.resolve(fixedStart);
|
37
40
|
var attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;
|
@@ -85,19 +88,31 @@ function areBlockTypesDisabled(state) {
|
|
85
88
|
var nodesTypes = getSelectedWrapperNodes(state);
|
86
89
|
var _state$schema$nodes2 = state.schema.nodes,
|
87
90
|
panel = _state$schema$nodes2.panel,
|
88
|
-
blockquote = _state$schema$nodes2.blockquote
|
91
|
+
blockquote = _state$schema$nodes2.blockquote,
|
92
|
+
bulletList = _state$schema$nodes2.bulletList,
|
93
|
+
orderedList = _state$schema$nodes2.orderedList;
|
89
94
|
if ((0, _experiments.editorExperiment)('platform_editor_blockquote_in_text_formatting_menu', true)) {
|
90
95
|
var hasQuote = false;
|
96
|
+
var hasNestedListInQuote = false;
|
91
97
|
var _state$selection2 = state.selection,
|
92
98
|
$from = _state$selection2.$from,
|
93
99
|
$to = _state$selection2.$to;
|
94
100
|
state.doc.nodesBetween($from.pos, $to.pos, function (node) {
|
95
|
-
|
96
|
-
|
101
|
+
if (node.type === blockquote) {
|
102
|
+
hasQuote = true;
|
103
|
+
node.descendants(function (child) {
|
104
|
+
if (child.type === bulletList || child.type === orderedList) {
|
105
|
+
hasNestedListInQuote = true;
|
106
|
+
return false;
|
107
|
+
}
|
108
|
+
return true;
|
109
|
+
});
|
110
|
+
}
|
111
|
+
return !hasNestedListInQuote;
|
97
112
|
});
|
98
113
|
return nodesTypes.filter(function (type) {
|
99
114
|
return type !== panel;
|
100
|
-
}).length > 0 ||
|
115
|
+
}).length > 0 && (!hasQuote || hasNestedListInQuote);
|
101
116
|
}
|
102
117
|
return nodesTypes.filter(function (type) {
|
103
118
|
return type !== panel;
|
@@ -63,6 +63,9 @@ export function setHeading(level, fromBlockQuote) {
|
|
63
63
|
return tr;
|
64
64
|
};
|
65
65
|
}
|
66
|
+
|
67
|
+
// Ignored via go/ees005
|
68
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
66
69
|
export function setBlockTypeWithAnalytics(name, inputMethod, editorAnalyticsApi, fromBlockQuote) {
|
67
70
|
return ({
|
68
71
|
tr
|
@@ -129,7 +132,7 @@ function withCurrentHeadingLevel(fn) {
|
|
129
132
|
|
130
133
|
// Check each paragraph and/or heading and check for consistent level
|
131
134
|
let level;
|
132
|
-
for (
|
135
|
+
for (const node of nodes) {
|
133
136
|
const nodeLevel = node.node.type === heading ? node.node.attrs.level : 0;
|
134
137
|
if (!level) {
|
135
138
|
level = nodeLevel;
|
@@ -164,7 +167,10 @@ export function setNormalTextWithAnalytics(inputMethod, editorAnalyticsApi, from
|
|
164
167
|
});
|
165
168
|
});
|
166
169
|
}
|
167
|
-
export const setHeadingWithAnalytics = (newHeadingLevel, inputMethod, editorAnalyticsApi, fromBlockQuote
|
170
|
+
export const setHeadingWithAnalytics = (newHeadingLevel, inputMethod, editorAnalyticsApi, fromBlockQuote
|
171
|
+
// Ignored via go/ees005
|
172
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
173
|
+
) => {
|
168
174
|
return withCurrentHeadingLevel(previousHeadingLevel => ({
|
169
175
|
tr
|
170
176
|
}) => {
|
@@ -12,12 +12,16 @@ function getHeadingLevel(match) {
|
|
12
12
|
}
|
13
13
|
function headingRule(nodeType, maxLevel) {
|
14
14
|
return createWrappingTextBlockRule({
|
15
|
+
// Ignored via go/ees005
|
16
|
+
// eslint-disable-next-line require-unicode-regexp
|
15
17
|
match: new RegExp('^(#{1,' + maxLevel + '})\\s$'),
|
16
18
|
nodeType,
|
17
19
|
getAttrs: getHeadingLevel
|
18
20
|
});
|
19
21
|
}
|
20
22
|
function blockQuoteRule(nodeType) {
|
23
|
+
// Ignored via go/ees005
|
24
|
+
// eslint-disable-next-line require-unicode-regexp
|
21
25
|
return createJoinNodesRule(/^\s*>\s$/, nodeType);
|
22
26
|
}
|
23
27
|
|
@@ -30,7 +34,13 @@ function blockQuoteRule(nodeType) {
|
|
30
34
|
function getHeadingRules(editorAnalyticsAPI, schema) {
|
31
35
|
// '# ' for h1, '## ' for h2 and etc
|
32
36
|
const hashRule = headingRule(schema.nodes.heading, MAX_HEADING_LEVEL);
|
33
|
-
const leftNodeReplacementHashRule = createRule(
|
37
|
+
const leftNodeReplacementHashRule = createRule(
|
38
|
+
// Ignored via go/ees005
|
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) => {
|
34
44
|
const level = match[1].length;
|
35
45
|
return insertBlock(state, schema.nodes.heading, start, end, {
|
36
46
|
level
|
@@ -60,7 +70,13 @@ function getHeadingRules(editorAnalyticsAPI, schema) {
|
|
60
70
|
function getBlockQuoteRules(editorAnalyticsAPI, schema) {
|
61
71
|
// '> ' for blockquote
|
62
72
|
const greatherThanRule = blockQuoteRule(schema.nodes.blockquote);
|
63
|
-
const leftNodeReplacementGreatherRule = createRule(
|
73
|
+
const leftNodeReplacementGreatherRule = createRule(
|
74
|
+
// Ignored via go/ees005
|
75
|
+
// 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) => {
|
64
80
|
return insertBlock(state, schema.nodes.blockquote, start, end);
|
65
81
|
});
|
66
82
|
|
@@ -3,6 +3,8 @@ import { backspace, bindKeymapWithCommand, deleteKey, findKeyMapForBrowser, find
|
|
3
3
|
import { createNewParagraphAbove, createNewParagraphBelow, deleteEmptyParagraphAndMoveBlockUp, insertNewLineWithAnalytics } from '@atlaskit/editor-common/utils';
|
4
4
|
import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
5
5
|
import { redo, undo } from '@atlaskit/editor-prosemirror/history';
|
6
|
+
// Ignored via go/ees005
|
7
|
+
// eslint-disable-next-line import/no-namespace
|
6
8
|
import * as blockTypes from './block-types';
|
7
9
|
import { cleanUpAtTheStartOfDocument, insertBlockQuoteWithAnalytics } from './commands/block-type';
|
8
10
|
import { deleteAndMoveCursor } from './commands/delete-and-move-cursor';
|
@@ -12,16 +14,37 @@ const backspaceCommand = chainCommands(cleanUpAtTheStartOfDocument, deleteBlockC
|
|
12
14
|
const del = chainCommands(deleteEmptyParagraphAndMoveBlockUp(isNodeAWrappingBlockNode), deleteBlockContent(isNodeAWrappingBlockNode), deleteAndMoveCursor);
|
13
15
|
export default function keymapPlugin(editorAnalyticsApi, schema, _featureFlags) {
|
14
16
|
const list = {};
|
15
|
-
bindKeymapWithCommand(
|
17
|
+
bindKeymapWithCommand(
|
18
|
+
// Ignored via go/ees005
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
20
|
+
insertNewLine.common, insertNewLineWithAnalytics(editorAnalyticsApi), list);
|
21
|
+
// Ignored via go/ees005
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
16
23
|
bindKeymapWithCommand(moveUp.common, createNewParagraphAbove, list);
|
24
|
+
// Ignored via go/ees005
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
17
26
|
bindKeymapWithCommand(moveDown.common, createNewParagraphBelow, list);
|
27
|
+
// Ignored via go/ees005
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
18
29
|
bindKeymapWithCommand(findKeyMapForBrowser(redoKeymap), redo, list);
|
30
|
+
|
31
|
+
// Ignored via go/ees005
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
19
33
|
bindKeymapWithCommand(undoKeymap.common, undo, list);
|
34
|
+
|
35
|
+
// Ignored via go/ees005
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
20
37
|
bindKeymapWithCommand(backspace.common, backspaceCommand, list);
|
38
|
+
|
39
|
+
// Ignored via go/ees005
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
21
41
|
bindKeymapWithCommand(deleteKey.common, del, list);
|
22
42
|
bindKeymapWithCommand(forwardDelete.mac, del, list);
|
23
43
|
if (schema.nodes[blockTypes.BLOCK_QUOTE.nodeName]) {
|
24
|
-
bindKeymapWithCommand(
|
44
|
+
bindKeymapWithCommand(
|
45
|
+
// Ignored via go/ees005
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
47
|
+
findShortcutByKeymap(toggleBlockQuote), insertBlockQuoteWithAnalytics(INPUT_METHOD.KEYBOARD, editorAnalyticsApi), list);
|
25
48
|
}
|
26
49
|
return keymap(list);
|
27
50
|
}
|
@@ -70,7 +70,10 @@ 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
|
73
|
+
export const createPlugin = (editorAPI, dispatch, lastNodeMustBeParagraph, includeBlockQuoteAsTextstyleOption
|
74
|
+
// Ignored via go/ees005
|
75
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
76
|
+
) => {
|
74
77
|
var _editorAPI$analytics;
|
75
78
|
const editorAnalyticsApi = editorAPI === null || editorAPI === void 0 ? void 0 : (_editorAPI$analytics = editorAPI.analytics) === null || _editorAPI$analytics === void 0 ? void 0 : _editorAPI$analytics.actions;
|
76
79
|
let altKeyLocation = 0;
|
@@ -101,6 +104,8 @@ export const createPlugin = (editorAPI, dispatch, lastNodeMustBeParagraph, inclu
|
|
101
104
|
availableBlockTypesInDropdown
|
102
105
|
};
|
103
106
|
},
|
107
|
+
// Ignored via go/ees005
|
108
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
104
109
|
apply(_tr, oldPluginState, _oldState, newState) {
|
105
110
|
const newPluginState = {
|
106
111
|
...oldPluginState,
|
@@ -141,6 +146,8 @@ export const createPlugin = (editorAPI, dispatch, lastNodeMustBeParagraph, inclu
|
|
141
146
|
}
|
142
147
|
return false;
|
143
148
|
},
|
149
|
+
// Ignored via go/ees005
|
150
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
144
151
|
handleDrop(view, event, slice, moved) {
|
145
152
|
return handleBlockQuoteDND(view, event, slice);
|
146
153
|
}
|
@@ -26,7 +26,10 @@ export function FloatingToolbarComponent({
|
|
26
26
|
isSmall: FloatingToolbarSettings.isSmall,
|
27
27
|
isDisabled: FloatingToolbarSettings.disabled,
|
28
28
|
isReducedSpacing: FloatingToolbarSettings.isToolbarReducedSpacing,
|
29
|
-
setTextLevel: boundSetBlockType
|
29
|
+
setTextLevel: boundSetBlockType
|
30
|
+
// Ignored via go/ees005
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
32
|
+
,
|
30
33
|
pluginState: blockTypeState,
|
31
34
|
wrapBlockQuote: wrapBlockQuote,
|
32
35
|
shouldUseDefaultRole: FloatingToolbarSettings.shouldUseDefaultRole,
|
@@ -28,7 +28,10 @@ export function PrimaryToolbarComponent({
|
|
28
28
|
isDisabled: disabled,
|
29
29
|
isReducedSpacing: isToolbarReducedSpacing,
|
30
30
|
setTextLevel: boundSetBlockType,
|
31
|
-
wrapBlockQuote: wrapBlockQuote
|
31
|
+
wrapBlockQuote: wrapBlockQuote
|
32
|
+
// Ignored via go/ees005
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
34
|
+
,
|
32
35
|
pluginState: blockTypeState,
|
33
36
|
popupsMountPoint: popupsMountPoint,
|
34
37
|
popupsBoundariesElement: popupsBoundariesElement,
|
@@ -63,5 +63,8 @@ export const BlockTypeButton = props => {
|
|
63
63
|
}))))
|
64
64
|
}, !props.isSmall && jsx(Box, {
|
65
65
|
xcss: [buttonContentStyle, props.isReducedSpacing && buttonContentReducedSpacingStyle]
|
66
|
-
}, jsx(FormattedMessage
|
66
|
+
}, jsx(FormattedMessage
|
67
|
+
// Ignored via go/ees005
|
68
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
69
|
+
, props.title || NORMAL_TEXT.title)));
|
67
70
|
};
|
@@ -152,7 +152,7 @@ class ToolbarBlockType extends React.PureComponent {
|
|
152
152
|
return null;
|
153
153
|
}
|
154
154
|
const blockTypeTitles = availableBlockTypesInDropdown.filter(blockType => blockType.name === currentBlockType.name).map(blockType => blockType.title);
|
155
|
-
if (!this.props.isDisabled &&
|
155
|
+
if (!this.props.isDisabled && !blockTypesDisabled) {
|
156
156
|
const items = this.createItems();
|
157
157
|
return (
|
158
158
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
@@ -21,7 +21,10 @@ export const createWrappingTextBlockRule = ({
|
|
21
21
|
nodeType,
|
22
22
|
getAttrs
|
23
23
|
}) => {
|
24
|
-
const handler = (state, match, start, end
|
24
|
+
const handler = (state, match, start, end
|
25
|
+
// Ignored via go/ees005
|
26
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
27
|
+
) => {
|
25
28
|
const fixedStart = Math.max(start, 1);
|
26
29
|
const $start = state.doc.resolve(fixedStart);
|
27
30
|
const attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;
|
@@ -77,19 +80,31 @@ export function areBlockTypesDisabled(state) {
|
|
77
80
|
const nodesTypes = getSelectedWrapperNodes(state);
|
78
81
|
const {
|
79
82
|
panel,
|
80
|
-
blockquote
|
83
|
+
blockquote,
|
84
|
+
bulletList,
|
85
|
+
orderedList
|
81
86
|
} = state.schema.nodes;
|
82
87
|
if (editorExperiment('platform_editor_blockquote_in_text_formatting_menu', true)) {
|
83
88
|
let hasQuote = false;
|
89
|
+
let hasNestedListInQuote = false;
|
84
90
|
const {
|
85
91
|
$from,
|
86
92
|
$to
|
87
93
|
} = state.selection;
|
88
94
|
state.doc.nodesBetween($from.pos, $to.pos, node => {
|
89
|
-
|
90
|
-
|
95
|
+
if (node.type === blockquote) {
|
96
|
+
hasQuote = true;
|
97
|
+
node.descendants(child => {
|
98
|
+
if (child.type === bulletList || child.type === orderedList) {
|
99
|
+
hasNestedListInQuote = true;
|
100
|
+
return false;
|
101
|
+
}
|
102
|
+
return true;
|
103
|
+
});
|
104
|
+
}
|
105
|
+
return !hasNestedListInQuote;
|
91
106
|
});
|
92
|
-
return nodesTypes.filter(type => type !== panel).length > 0 ||
|
107
|
+
return nodesTypes.filter(type => type !== panel).length > 0 && (!hasQuote || hasNestedListInQuote);
|
93
108
|
}
|
94
109
|
return nodesTypes.filter(type => type !== panel).length > 0;
|
95
110
|
}
|
@@ -55,6 +55,9 @@ export function setHeading(level, fromBlockQuote) {
|
|
55
55
|
return tr;
|
56
56
|
};
|
57
57
|
}
|
58
|
+
|
59
|
+
// Ignored via go/ees005
|
60
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
58
61
|
export function setBlockTypeWithAnalytics(name, inputMethod, editorAnalyticsApi, fromBlockQuote) {
|
59
62
|
return function (_ref4) {
|
60
63
|
var tr = _ref4.tr;
|
@@ -153,7 +156,10 @@ export function setNormalTextWithAnalytics(inputMethod, editorAnalyticsApi, from
|
|
153
156
|
};
|
154
157
|
});
|
155
158
|
}
|
156
|
-
export var setHeadingWithAnalytics = function setHeadingWithAnalytics(newHeadingLevel, inputMethod, editorAnalyticsApi, fromBlockQuote
|
159
|
+
export var setHeadingWithAnalytics = function setHeadingWithAnalytics(newHeadingLevel, inputMethod, editorAnalyticsApi, fromBlockQuote
|
160
|
+
// Ignored via go/ees005
|
161
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
162
|
+
) {
|
157
163
|
return withCurrentHeadingLevel(function (previousHeadingLevel) {
|
158
164
|
return function (_ref9) {
|
159
165
|
var tr = _ref9.tr;
|
@@ -13,12 +13,16 @@ function getHeadingLevel(match) {
|
|
13
13
|
}
|
14
14
|
function headingRule(nodeType, maxLevel) {
|
15
15
|
return createWrappingTextBlockRule({
|
16
|
+
// Ignored via go/ees005
|
17
|
+
// eslint-disable-next-line require-unicode-regexp
|
16
18
|
match: new RegExp('^(#{1,' + maxLevel + '})\\s$'),
|
17
19
|
nodeType: nodeType,
|
18
20
|
getAttrs: getHeadingLevel
|
19
21
|
});
|
20
22
|
}
|
21
23
|
function blockQuoteRule(nodeType) {
|
24
|
+
// Ignored via go/ees005
|
25
|
+
// eslint-disable-next-line require-unicode-regexp
|
22
26
|
return createJoinNodesRule(/^\s*>\s$/, nodeType);
|
23
27
|
}
|
24
28
|
|
@@ -31,7 +35,13 @@ function blockQuoteRule(nodeType) {
|
|
31
35
|
function getHeadingRules(editorAnalyticsAPI, schema) {
|
32
36
|
// '# ' for h1, '## ' for h2 and etc
|
33
37
|
var hashRule = headingRule(schema.nodes.heading, MAX_HEADING_LEVEL);
|
34
|
-
var leftNodeReplacementHashRule = createRule(
|
38
|
+
var leftNodeReplacementHashRule = createRule(
|
39
|
+
// Ignored via go/ees005
|
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) {
|
35
45
|
var level = match[1].length;
|
36
46
|
return insertBlock(state, schema.nodes.heading, start, end, {
|
37
47
|
level: level
|
@@ -63,7 +73,13 @@ function getHeadingRules(editorAnalyticsAPI, schema) {
|
|
63
73
|
function getBlockQuoteRules(editorAnalyticsAPI, schema) {
|
64
74
|
// '> ' for blockquote
|
65
75
|
var greatherThanRule = blockQuoteRule(schema.nodes.blockquote);
|
66
|
-
var leftNodeReplacementGreatherRule = createRule(
|
76
|
+
var leftNodeReplacementGreatherRule = createRule(
|
77
|
+
// Ignored via go/ees005
|
78
|
+
// 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) {
|
67
83
|
return insertBlock(state, schema.nodes.blockquote, start, end);
|
68
84
|
});
|
69
85
|
|
@@ -3,6 +3,8 @@ import { backspace, bindKeymapWithCommand, deleteKey, findKeyMapForBrowser, find
|
|
3
3
|
import { createNewParagraphAbove, createNewParagraphBelow, deleteEmptyParagraphAndMoveBlockUp, insertNewLineWithAnalytics } from '@atlaskit/editor-common/utils';
|
4
4
|
import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
5
5
|
import { redo, undo } from '@atlaskit/editor-prosemirror/history';
|
6
|
+
// Ignored via go/ees005
|
7
|
+
// eslint-disable-next-line import/no-namespace
|
6
8
|
import * as blockTypes from './block-types';
|
7
9
|
import { cleanUpAtTheStartOfDocument, insertBlockQuoteWithAnalytics } from './commands/block-type';
|
8
10
|
import { deleteAndMoveCursor } from './commands/delete-and-move-cursor';
|
@@ -12,16 +14,37 @@ var backspaceCommand = chainCommands(cleanUpAtTheStartOfDocument, deleteBlockCon
|
|
12
14
|
var del = chainCommands(deleteEmptyParagraphAndMoveBlockUp(isNodeAWrappingBlockNode), deleteBlockContent(isNodeAWrappingBlockNode), deleteAndMoveCursor);
|
13
15
|
export default function keymapPlugin(editorAnalyticsApi, schema, _featureFlags) {
|
14
16
|
var list = {};
|
15
|
-
bindKeymapWithCommand(
|
17
|
+
bindKeymapWithCommand(
|
18
|
+
// Ignored via go/ees005
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
20
|
+
insertNewLine.common, insertNewLineWithAnalytics(editorAnalyticsApi), list);
|
21
|
+
// Ignored via go/ees005
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
16
23
|
bindKeymapWithCommand(moveUp.common, createNewParagraphAbove, list);
|
24
|
+
// Ignored via go/ees005
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
17
26
|
bindKeymapWithCommand(moveDown.common, createNewParagraphBelow, list);
|
27
|
+
// Ignored via go/ees005
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
18
29
|
bindKeymapWithCommand(findKeyMapForBrowser(redoKeymap), redo, list);
|
30
|
+
|
31
|
+
// Ignored via go/ees005
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
19
33
|
bindKeymapWithCommand(undoKeymap.common, undo, list);
|
34
|
+
|
35
|
+
// Ignored via go/ees005
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
20
37
|
bindKeymapWithCommand(backspace.common, backspaceCommand, list);
|
38
|
+
|
39
|
+
// Ignored via go/ees005
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
21
41
|
bindKeymapWithCommand(deleteKey.common, del, list);
|
22
42
|
bindKeymapWithCommand(forwardDelete.mac, del, list);
|
23
43
|
if (schema.nodes[blockTypes.BLOCK_QUOTE.nodeName]) {
|
24
|
-
bindKeymapWithCommand(
|
44
|
+
bindKeymapWithCommand(
|
45
|
+
// Ignored via go/ees005
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
47
|
+
findShortcutByKeymap(toggleBlockQuote), insertBlockQuoteWithAnalytics(INPUT_METHOD.KEYBOARD, editorAnalyticsApi), list);
|
25
48
|
}
|
26
49
|
return keymap(list);
|
27
50
|
}
|
@@ -74,7 +74,10 @@ 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
|
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
|
+
) {
|
78
81
|
var _editorAPI$analytics;
|
79
82
|
var editorAnalyticsApi = editorAPI === null || editorAPI === void 0 || (_editorAPI$analytics = editorAPI.analytics) === null || _editorAPI$analytics === void 0 ? void 0 : _editorAPI$analytics.actions;
|
80
83
|
var altKeyLocation = 0;
|
@@ -109,6 +112,8 @@ export var createPlugin = function createPlugin(editorAPI, dispatch, lastNodeMus
|
|
109
112
|
availableBlockTypesInDropdown: availableBlockTypesInDropdown
|
110
113
|
};
|
111
114
|
},
|
115
|
+
// Ignored via go/ees005
|
116
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
112
117
|
apply: function apply(_tr, oldPluginState, _oldState, newState) {
|
113
118
|
var newPluginState = _objectSpread(_objectSpread({}, oldPluginState), {}, {
|
114
119
|
currentBlockType: detectBlockType(oldPluginState.availableBlockTypesInDropdown, newState),
|
@@ -148,6 +153,8 @@ export var createPlugin = function createPlugin(editorAPI, dispatch, lastNodeMus
|
|
148
153
|
}
|
149
154
|
return false;
|
150
155
|
},
|
156
|
+
// Ignored via go/ees005
|
157
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
151
158
|
handleDrop: function handleDrop(view, event, slice, moved) {
|
152
159
|
return handleBlockQuoteDND(view, event, slice);
|
153
160
|
}
|
@@ -24,7 +24,10 @@ export function FloatingToolbarComponent(_ref) {
|
|
24
24
|
isSmall: FloatingToolbarSettings.isSmall,
|
25
25
|
isDisabled: FloatingToolbarSettings.disabled,
|
26
26
|
isReducedSpacing: FloatingToolbarSettings.isToolbarReducedSpacing,
|
27
|
-
setTextLevel: boundSetBlockType
|
27
|
+
setTextLevel: boundSetBlockType
|
28
|
+
// Ignored via go/ees005
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
30
|
+
,
|
28
31
|
pluginState: blockTypeState,
|
29
32
|
wrapBlockQuote: wrapBlockQuote,
|
30
33
|
shouldUseDefaultRole: FloatingToolbarSettings.shouldUseDefaultRole,
|
@@ -26,7 +26,10 @@ export function PrimaryToolbarComponent(_ref) {
|
|
26
26
|
isDisabled: disabled,
|
27
27
|
isReducedSpacing: isToolbarReducedSpacing,
|
28
28
|
setTextLevel: boundSetBlockType,
|
29
|
-
wrapBlockQuote: wrapBlockQuote
|
29
|
+
wrapBlockQuote: wrapBlockQuote
|
30
|
+
// Ignored via go/ees005
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
32
|
+
,
|
30
33
|
pluginState: blockTypeState,
|
31
34
|
popupsMountPoint: popupsMountPoint,
|
32
35
|
popupsBoundariesElement: popupsBoundariesElement,
|
@@ -63,5 +63,8 @@ export var BlockTypeButton = function BlockTypeButton(props) {
|
|
63
63
|
}))))
|
64
64
|
}, !props.isSmall && jsx(Box, {
|
65
65
|
xcss: [buttonContentStyle, props.isReducedSpacing && buttonContentReducedSpacingStyle]
|
66
|
-
}, jsx(FormattedMessage
|
66
|
+
}, jsx(FormattedMessage
|
67
|
+
// Ignored via go/ees005
|
68
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
69
|
+
, props.title || NORMAL_TEXT.title)));
|
67
70
|
};
|
@@ -169,7 +169,7 @@ var ToolbarBlockType = /*#__PURE__*/function (_React$PureComponent) {
|
|
169
169
|
}).map(function (blockType) {
|
170
170
|
return blockType.title;
|
171
171
|
});
|
172
|
-
if (!this.props.isDisabled &&
|
172
|
+
if (!this.props.isDisabled && !blockTypesDisabled) {
|
173
173
|
var items = this.createItems();
|
174
174
|
return (
|
175
175
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
@@ -24,7 +24,10 @@ export var createWrappingTextBlockRule = function createWrappingTextBlockRule(_r
|
|
24
24
|
var match = _ref.match,
|
25
25
|
nodeType = _ref.nodeType,
|
26
26
|
getAttrs = _ref.getAttrs;
|
27
|
-
var handler = function handler(state, match, start, end
|
27
|
+
var handler = function handler(state, match, start, end
|
28
|
+
// Ignored via go/ees005
|
29
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
30
|
+
) {
|
28
31
|
var fixedStart = Math.max(start, 1);
|
29
32
|
var $start = state.doc.resolve(fixedStart);
|
30
33
|
var attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;
|
@@ -78,19 +81,31 @@ export function areBlockTypesDisabled(state) {
|
|
78
81
|
var nodesTypes = getSelectedWrapperNodes(state);
|
79
82
|
var _state$schema$nodes2 = state.schema.nodes,
|
80
83
|
panel = _state$schema$nodes2.panel,
|
81
|
-
blockquote = _state$schema$nodes2.blockquote
|
84
|
+
blockquote = _state$schema$nodes2.blockquote,
|
85
|
+
bulletList = _state$schema$nodes2.bulletList,
|
86
|
+
orderedList = _state$schema$nodes2.orderedList;
|
82
87
|
if (editorExperiment('platform_editor_blockquote_in_text_formatting_menu', true)) {
|
83
88
|
var hasQuote = false;
|
89
|
+
var hasNestedListInQuote = false;
|
84
90
|
var _state$selection2 = state.selection,
|
85
91
|
$from = _state$selection2.$from,
|
86
92
|
$to = _state$selection2.$to;
|
87
93
|
state.doc.nodesBetween($from.pos, $to.pos, function (node) {
|
88
|
-
|
89
|
-
|
94
|
+
if (node.type === blockquote) {
|
95
|
+
hasQuote = true;
|
96
|
+
node.descendants(function (child) {
|
97
|
+
if (child.type === bulletList || child.type === orderedList) {
|
98
|
+
hasNestedListInQuote = true;
|
99
|
+
return false;
|
100
|
+
}
|
101
|
+
return true;
|
102
|
+
});
|
103
|
+
}
|
104
|
+
return !hasNestedListInQuote;
|
90
105
|
});
|
91
106
|
return nodesTypes.filter(function (type) {
|
92
107
|
return type !== panel;
|
93
|
-
}).length > 0 ||
|
108
|
+
}).length > 0 && (!hasQuote || hasNestedListInQuote);
|
94
109
|
}
|
95
110
|
return nodesTypes.filter(function (type) {
|
96
111
|
return type !== panel;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atlaskit/editor-plugin-block-type",
|
3
|
-
"version": "4.0.
|
3
|
+
"version": "4.0.14",
|
4
4
|
"description": "BlockType plugin for @atlaskit/editor-core",
|
5
5
|
"author": "Atlassian Pty Ltd",
|
6
6
|
"license": "Apache-2.0",
|
@@ -34,7 +34,7 @@
|
|
34
34
|
},
|
35
35
|
"dependencies": {
|
36
36
|
"@atlaskit/adf-schema": "^46.1.0",
|
37
|
-
"@atlaskit/editor-common": "^97.
|
37
|
+
"@atlaskit/editor-common": "^97.3.0",
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
39
39
|
"@atlaskit/editor-plugin-primary-toolbar": "^2.1.0",
|
40
40
|
"@atlaskit/editor-prosemirror": "6.2.1",
|
@@ -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.30.0",
|
49
49
|
"@atlaskit/tokens": "^2.5.0",
|
50
50
|
"@babel/runtime": "^7.0.0",
|
51
51
|
"@emotion/react": "^11.7.1"
|