@atlaskit/editor-plugin-block-type 22.0.5 → 22.0.7
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 +1 -2
- package/dist/cjs/pm-plugins/block-types.js +2 -3
- package/dist/cjs/pm-plugins/commands/block-type.js +4 -5
- package/dist/cjs/pm-plugins/commands/wrapSelectionIn.js +1 -2
- package/dist/cjs/pm-plugins/main.js +3 -4
- package/dist/cjs/pm-plugins/ui/ToolbarBlockType/HeadingButton.js +1 -2
- package/dist/cjs/pm-plugins/ui/ToolbarBlockType/QuoteButton.js +1 -2
- package/dist/cjs/pm-plugins/utils.js +2 -3
- package/dist/es2019/blockTypePlugin.js +1 -2
- package/dist/es2019/pm-plugins/block-types.js +2 -3
- package/dist/es2019/pm-plugins/commands/block-type.js +4 -5
- package/dist/es2019/pm-plugins/commands/wrapSelectionIn.js +1 -2
- package/dist/es2019/pm-plugins/main.js +3 -4
- package/dist/es2019/pm-plugins/ui/ToolbarBlockType/HeadingButton.js +1 -2
- package/dist/es2019/pm-plugins/ui/ToolbarBlockType/QuoteButton.js +1 -2
- package/dist/es2019/pm-plugins/utils.js +2 -3
- package/dist/esm/blockTypePlugin.js +1 -2
- package/dist/esm/pm-plugins/block-types.js +2 -3
- package/dist/esm/pm-plugins/commands/block-type.js +4 -5
- package/dist/esm/pm-plugins/commands/wrapSelectionIn.js +1 -2
- package/dist/esm/pm-plugins/main.js +3 -4
- package/dist/esm/pm-plugins/ui/ToolbarBlockType/HeadingButton.js +1 -2
- package/dist/esm/pm-plugins/ui/ToolbarBlockType/QuoteButton.js +1 -2
- package/dist/esm/pm-plugins/utils.js +2 -3
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-type
|
|
2
2
|
|
|
3
|
+
## 22.0.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 22.0.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`9e6211ceb4ceb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9e6211ceb4ceb) -
|
|
14
|
+
Clean up the fully rolled-out `platform_editor_small_font_size` experiment and make its permanent
|
|
15
|
+
`true` behavior unconditional across editor formatting, task and list handling, paste behavior,
|
|
16
|
+
controls, and rendering.
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 22.0.5
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -19,7 +19,6 @@ var _assets = require("@atlaskit/editor-common/assets");
|
|
|
19
19
|
var _types = require("@atlaskit/editor-common/types");
|
|
20
20
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
21
21
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
22
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
23
22
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
24
23
|
var _blockType = require("./pm-plugins/commands/block-type");
|
|
25
24
|
var _inputRule = _interopRequireDefault(require("./pm-plugins/input-rule"));
|
|
@@ -179,7 +178,7 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
|
|
|
179
178
|
return nodes;
|
|
180
179
|
},
|
|
181
180
|
marks: function marks() {
|
|
182
|
-
if (options !== null && options !== void 0 && options.allowFontSize
|
|
181
|
+
if (options !== null && options !== void 0 && options.allowFontSize) {
|
|
183
182
|
return [{
|
|
184
183
|
name: 'fontSize',
|
|
185
184
|
mark: _fontSize.fontSize
|
|
@@ -18,7 +18,6 @@ var _textHeadingThree = _interopRequireDefault(require("@atlaskit/icon-lab/core/
|
|
|
18
18
|
var _textHeadingTwo = _interopRequireDefault(require("@atlaskit/icon-lab/core/text-heading-two"));
|
|
19
19
|
var _text = _interopRequireDefault(require("@atlaskit/icon/core/text"));
|
|
20
20
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
21
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
22
21
|
var _icons = require("./ui/ToolbarBlockType/icons");
|
|
23
22
|
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; }
|
|
24
23
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -147,7 +146,7 @@ var toolbarBlockTypesWithRank = exports.toolbarBlockTypesWithRank = function too
|
|
|
147
146
|
normal: _objectSpread(_objectSpread({}, NORMAL_TEXT), {}, {
|
|
148
147
|
icon:
|
|
149
148
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
150
|
-
(0,
|
|
149
|
+
(0, _fg.fg)('platform_editor_change_normal_text_icon') ? /*#__PURE__*/_react.default.createElement(_editorToolbar.TextNormalIcon, {
|
|
151
150
|
size: "small",
|
|
152
151
|
label: ""
|
|
153
152
|
}) : /*#__PURE__*/_react.default.createElement(_editorToolbar.TextIcon, {
|
|
@@ -157,7 +156,7 @@ var toolbarBlockTypesWithRank = exports.toolbarBlockTypesWithRank = function too
|
|
|
157
156
|
toolbarRank: _toolbar.TEXT_STYLES_MENU_SECTION_RANK[_toolbar.NORMAL_TEXT_MENU_ITEM.key],
|
|
158
157
|
toolbarKey: _toolbar.NORMAL_TEXT_MENU_ITEM.key
|
|
159
158
|
})
|
|
160
|
-
}, allowFontSize &&
|
|
159
|
+
}, allowFontSize && {
|
|
161
160
|
smallText: _objectSpread(_objectSpread({}, SMALL_TEXT), {}, {
|
|
162
161
|
icon: /*#__PURE__*/_react.default.createElement(_editorToolbar.TextSmallIcon, {
|
|
163
162
|
size: "small",
|
|
@@ -21,7 +21,6 @@ var _editorAnalytics = require("@atlaskit/editor-common/editor-analytics");
|
|
|
21
21
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
22
22
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
23
23
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
24
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
25
24
|
var _blockTypes = require("../block-types");
|
|
26
25
|
var _utils2 = require("../utils");
|
|
27
26
|
var _clearFormatting = require("./clear-formatting");
|
|
@@ -38,7 +37,7 @@ function setBlockType(name) {
|
|
|
38
37
|
tr: tr
|
|
39
38
|
});
|
|
40
39
|
}
|
|
41
|
-
if (name === 'smallText'
|
|
40
|
+
if (name === 'smallText') {
|
|
42
41
|
return setSmallText()({
|
|
43
42
|
tr: tr
|
|
44
43
|
});
|
|
@@ -91,7 +90,7 @@ function setHeading(level, fromBlockQuote) {
|
|
|
91
90
|
// List content stays as paragraphs (headings aren't allowed in list items),
|
|
92
91
|
// but non-list content has been converted to headings by setBlockType above.
|
|
93
92
|
var fontSize = schema.marks.fontSize;
|
|
94
|
-
if (fontSize
|
|
93
|
+
if (fontSize) {
|
|
95
94
|
var allowedBlocks = [schema.nodes.paragraph, schema.nodes.heading];
|
|
96
95
|
if (selection instanceof _editorTables.CellSelection) {
|
|
97
96
|
selection.forEachCell(function (cell, pos) {
|
|
@@ -120,7 +119,7 @@ function setBlockTypeWithAnalytics(name, inputMethod, editorAnalyticsApi, fromBl
|
|
|
120
119
|
tr: tr
|
|
121
120
|
});
|
|
122
121
|
}
|
|
123
|
-
if (name === 'smallText' && marks.fontSize
|
|
122
|
+
if (name === 'smallText' && marks.fontSize) {
|
|
124
123
|
return setSmallTextWithAnalytics(inputMethod, editorAnalyticsApi, fromBlockQuote)({
|
|
125
124
|
tr: tr
|
|
126
125
|
});
|
|
@@ -234,7 +233,7 @@ function setNormalText(fromBlockQuote) {
|
|
|
234
233
|
|
|
235
234
|
// Remove fontSize mark from any lists the selection touches
|
|
236
235
|
var fontSize = schema.marks.fontSize;
|
|
237
|
-
if (fontSize
|
|
236
|
+
if (fontSize) {
|
|
238
237
|
if (selection instanceof _editorTables.CellSelection) {
|
|
239
238
|
selection.forEachCell(function (cell, pos) {
|
|
240
239
|
(0, _commands.createToggleBlockMarkOnRangeNext)(fontSize, function () {
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.wrapSelectionInBlockType = wrapSelectionInBlockType;
|
|
7
7
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
8
8
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
9
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
10
9
|
function wrapSelectionInBlockType(_nodeType) {
|
|
11
10
|
return function (_ref) {
|
|
12
11
|
var tr = _ref.tr;
|
|
@@ -17,7 +16,7 @@ function wrapSelectionInBlockType(_nodeType) {
|
|
|
17
16
|
fontSize = _tr$doc$type$schema$m.fontSize;
|
|
18
17
|
if (nodes.paragraph && nodes.blockquote) {
|
|
19
18
|
/** Remove alignment, indentation, and unsupported blockquote marks from the selection */
|
|
20
|
-
var marksToRemove =
|
|
19
|
+
var marksToRemove = [alignment, indentation, fontSize];
|
|
21
20
|
var hasMark = function hasMark(mark) {
|
|
22
21
|
return marksToRemove.indexOf(mark.type) > -1;
|
|
23
22
|
};
|
|
@@ -11,7 +11,6 @@ var _blockType = require("@atlaskit/editor-common/block-type");
|
|
|
11
11
|
var _browser = require("@atlaskit/editor-common/browser");
|
|
12
12
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
13
13
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
14
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
14
|
var _blockTypes = require("./block-types");
|
|
16
15
|
var _blockType2 = require("./commands/block-type");
|
|
17
16
|
var _consts = require("./consts");
|
|
@@ -26,7 +25,7 @@ var blockTypeForNode = function blockTypeForNode(node, schema) {
|
|
|
26
25
|
}
|
|
27
26
|
} else if (node.marks.some(function (m) {
|
|
28
27
|
return m.type.name === 'fontSize' && m.attrs.fontSize === 'small';
|
|
29
|
-
})
|
|
28
|
+
})) {
|
|
30
29
|
return _blockTypes.SMALL_TEXT;
|
|
31
30
|
} else if (node.type === schema.nodes.paragraph) {
|
|
32
31
|
return _blockTypes.NORMAL_TEXT;
|
|
@@ -47,7 +46,7 @@ var isBlockTypeSchemaSupported = function isBlockTypeSchemaSupported(blockType,
|
|
|
47
46
|
case _blockTypes.HEADING_6:
|
|
48
47
|
return !!state.schema.nodes.heading;
|
|
49
48
|
case _blockTypes.SMALL_TEXT:
|
|
50
|
-
return !!state.schema.marks.fontSize
|
|
49
|
+
return !!state.schema.marks.fontSize;
|
|
51
50
|
case _blockTypes.BLOCK_QUOTE:
|
|
52
51
|
return !!state.schema.nodes.blockquote;
|
|
53
52
|
case _blockTypes.CODE_BLOCK:
|
|
@@ -161,7 +160,7 @@ var createPlugin = exports.createPlugin = function createPlugin(editorAPI, dispa
|
|
|
161
160
|
var _editorAPI$core$actio2, _editorAPI$core2;
|
|
162
161
|
return (_editorAPI$core$actio2 = editorAPI === null || editorAPI === void 0 || (_editorAPI$core2 = editorAPI.core) === null || _editorAPI$core2 === void 0 ? void 0 : _editorAPI$core2.actions.execute(autoformatHeading(headingLevel, editorAnalyticsApi))) !== null && _editorAPI$core$actio2 !== void 0 ? _editorAPI$core$actio2 : false;
|
|
163
162
|
}
|
|
164
|
-
} else if (event.keyCode === _consts.KEY_7 && event.altKey
|
|
163
|
+
} else if (event.keyCode === _consts.KEY_7 && event.altKey) {
|
|
165
164
|
if (browser.mac && event.metaKey) {
|
|
166
165
|
var _editorAPI$core$actio3, _editorAPI$core3;
|
|
167
166
|
return (_editorAPI$core$actio3 = editorAPI === null || editorAPI === void 0 || (_editorAPI$core3 = editorAPI.core) === null || _editorAPI$core3 === void 0 ? void 0 : _editorAPI$core3.actions.execute((0, _blockType2.setSmallTextWithAnalytics)(_analytics.INPUT_METHOD.SHORTCUT, editorAnalyticsApi))) !== null && _editorAPI$core$actio3 !== void 0 ? _editorAPI$core$actio3 : false;
|
|
@@ -19,7 +19,6 @@ var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-
|
|
|
19
19
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
20
20
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
21
21
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
22
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
23
22
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
24
23
|
var _utils = require("../../utils");
|
|
25
24
|
var _editorUGCToken;
|
|
@@ -181,7 +180,7 @@ var HeadingButton = exports.HeadingButton = function HeadingButton(_ref4) {
|
|
|
181
180
|
|
|
182
181
|
// Extract the numeric level from the block type name (e.g. 'heading1' → 1).
|
|
183
182
|
var headingLevel = blockType.name.startsWith('heading') ? parseInt(blockType.name.replace('heading', ''), 10) : null;
|
|
184
|
-
var isDisabled = isMarkdownBridgeActive ? Boolean(sourceFormatState === null || sourceFormatState === void 0 ? void 0 : sourceFormatState.inCodeBlock) :
|
|
183
|
+
var isDisabled = isMarkdownBridgeActive ? Boolean(sourceFormatState === null || sourceFormatState === void 0 ? void 0 : sourceFormatState.inCodeBlock) : shouldDisableHeadingButton(editorView === null || editorView === void 0 ? void 0 : editorView.state, blockType);
|
|
185
184
|
var fromBlockQuote = (currentBlockType === null || currentBlockType === void 0 ? void 0 : currentBlockType.name) === 'blockquote';
|
|
186
185
|
var onClick = function onClick() {
|
|
187
186
|
var _api$core, _api$blockType;
|
|
@@ -14,7 +14,6 @@ var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
|
14
14
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
15
15
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
16
16
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
17
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
18
17
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
19
18
|
var _utils = require("../../utils");
|
|
20
19
|
var shouldDisableQuoteButton = function shouldDisableQuoteButton(state) {
|
|
@@ -52,7 +51,7 @@ var QuoteButton = exports.QuoteButton = function QuoteButton(_ref) {
|
|
|
52
51
|
// on setView. sourceBlockFormatState is null between the view switch and the
|
|
53
52
|
// first CM6 update listener fire, so we can't rely on it as the sentinel.
|
|
54
53
|
var isMarkdownBridgeActive = markdownView === 'syntax';
|
|
55
|
-
var isDisabled = isMarkdownBridgeActive ? Boolean(sourceBlockFormatState === null || sourceBlockFormatState === void 0 ? void 0 : sourceBlockFormatState.inCodeBlock) :
|
|
54
|
+
var isDisabled = isMarkdownBridgeActive ? Boolean(sourceBlockFormatState === null || sourceBlockFormatState === void 0 ? void 0 : sourceBlockFormatState.inCodeBlock) : shouldDisableQuoteButton(editorView === null || editorView === void 0 ? void 0 : editorView.state);
|
|
56
55
|
var onClick = function onClick() {
|
|
57
56
|
var _api$core, _api$blockType;
|
|
58
57
|
if (isDisabled) {
|
|
@@ -15,7 +15,6 @@ var _mark = require("@atlaskit/editor-common/mark");
|
|
|
15
15
|
var _transforms = require("@atlaskit/editor-common/transforms");
|
|
16
16
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
17
17
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
18
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
19
18
|
var _blockTypes = require("./block-types");
|
|
20
19
|
var isNodeAWrappingBlockNode = exports.isNodeAWrappingBlockNode = function isNodeAWrappingBlockNode(node) {
|
|
21
20
|
if (!node) {
|
|
@@ -76,7 +75,7 @@ function getSelectedWrapperNodes(state) {
|
|
|
76
75
|
taskList = _state$schema$nodes.taskList;
|
|
77
76
|
var wrapperNodes = [blockquote, panel, orderedList, bulletList, listItem, codeBlock, decisionItem, decisionList, taskItem, taskList];
|
|
78
77
|
wrapperNodes.push(caption);
|
|
79
|
-
if (empty
|
|
78
|
+
if (empty) {
|
|
80
79
|
for (var depth = 0; depth <= $from.depth; depth++) {
|
|
81
80
|
var node = $from.node(depth);
|
|
82
81
|
if (node.isBlock && wrapperNodes.indexOf(node.type) >= 0) {
|
|
@@ -108,7 +107,7 @@ function areBlockTypesDisabled(state) {
|
|
|
108
107
|
listItem = _state$schema$nodes2.listItem,
|
|
109
108
|
taskList = _state$schema$nodes2.taskList,
|
|
110
109
|
taskItem = _state$schema$nodes2.taskItem;
|
|
111
|
-
var isSmallFontSizeEnabled = allowFontSize
|
|
110
|
+
var isSmallFontSizeEnabled = allowFontSize;
|
|
112
111
|
var excludedTypes = isSmallFontSizeEnabled ? [panel, bulletList, orderedList, listItem, taskList, taskItem] : [panel];
|
|
113
112
|
var disallowedWrapperTypes = nodesTypes.filter(function (type) {
|
|
114
113
|
return !excludedTypes.includes(type);
|
|
@@ -10,7 +10,6 @@ import { IconHeading, IconQuote } from '@atlaskit/editor-common/assets';
|
|
|
10
10
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
11
11
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
13
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
13
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
15
14
|
import { clearFormatting, insertBlockQuoteWithAnalytics, insertBlockQuoteWithAnalyticsCommand, setBlockTypeWithAnalytics } from './pm-plugins/commands/block-type';
|
|
16
15
|
import inputRulePlugin from './pm-plugins/input-rule';
|
|
@@ -166,7 +165,7 @@ const blockTypePlugin = ({
|
|
|
166
165
|
return nodes;
|
|
167
166
|
},
|
|
168
167
|
marks() {
|
|
169
|
-
if (options !== null && options !== void 0 && options.allowFontSize
|
|
168
|
+
if (options !== null && options !== void 0 && options.allowFontSize) {
|
|
170
169
|
return [{
|
|
171
170
|
name: 'fontSize',
|
|
172
171
|
mark: fontSize
|
|
@@ -10,7 +10,6 @@ import TextHeadingThreeIcon from '@atlaskit/icon-lab/core/text-heading-three';
|
|
|
10
10
|
import TextHeadingTwoIcon from '@atlaskit/icon-lab/core/text-heading-two';
|
|
11
11
|
import TextIcon from '@atlaskit/icon/core/text';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
13
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
13
|
import { Text, H1, H2, H3, H4, H5, H6 } from './ui/ToolbarBlockType/icons';
|
|
15
14
|
export const NORMAL_TEXT = {
|
|
16
15
|
name: 'normal',
|
|
@@ -138,7 +137,7 @@ export const toolbarBlockTypesWithRank = ({
|
|
|
138
137
|
...NORMAL_TEXT,
|
|
139
138
|
icon:
|
|
140
139
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
141
|
-
|
|
140
|
+
fg('platform_editor_change_normal_text_icon') ? /*#__PURE__*/React.createElement(TextNormalIcon, {
|
|
142
141
|
size: "small",
|
|
143
142
|
label: ""
|
|
144
143
|
}) : /*#__PURE__*/React.createElement(EditorToolbarTextIcon, {
|
|
@@ -148,7 +147,7 @@ export const toolbarBlockTypesWithRank = ({
|
|
|
148
147
|
toolbarRank: TEXT_STYLES_MENU_SECTION_RANK[NORMAL_TEXT_MENU_ITEM.key],
|
|
149
148
|
toolbarKey: NORMAL_TEXT_MENU_ITEM.key
|
|
150
149
|
},
|
|
151
|
-
...(allowFontSize &&
|
|
150
|
+
...(allowFontSize && {
|
|
152
151
|
smallText: {
|
|
153
152
|
...SMALL_TEXT,
|
|
154
153
|
icon: /*#__PURE__*/React.createElement(TextSmallIcon, {
|
|
@@ -4,7 +4,6 @@ import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
|
4
4
|
import { filterChildrenBetween, wrapSelectionIn } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { liftTarget } from '@atlaskit/editor-prosemirror/transform';
|
|
6
6
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
7
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
7
|
import { HEADINGS_BY_NAME, NORMAL_TEXT } from '../block-types';
|
|
9
8
|
import { convertTaskItemsToBlockTaskItems, getSelectionRangeExpandedToLists } from '../utils';
|
|
10
9
|
import { FORMATTING_NODE_TYPES, FORMATTING_MARK_TYPES, cellSelectionNodesBetween, formatTypes, clearNodeFormattingOnSelection } from './clear-formatting';
|
|
@@ -21,7 +20,7 @@ export function setBlockType(name) {
|
|
|
21
20
|
tr
|
|
22
21
|
});
|
|
23
22
|
}
|
|
24
|
-
if (name === 'smallText'
|
|
23
|
+
if (name === 'smallText') {
|
|
25
24
|
return setSmallText()({
|
|
26
25
|
tr
|
|
27
26
|
});
|
|
@@ -84,7 +83,7 @@ export function setHeading(level, fromBlockQuote) {
|
|
|
84
83
|
const {
|
|
85
84
|
fontSize
|
|
86
85
|
} = schema.marks;
|
|
87
|
-
if (fontSize
|
|
86
|
+
if (fontSize) {
|
|
88
87
|
const allowedBlocks = [schema.nodes.paragraph, schema.nodes.heading];
|
|
89
88
|
if (selection instanceof CellSelection) {
|
|
90
89
|
selection.forEachCell((cell, pos) => {
|
|
@@ -111,7 +110,7 @@ export function setBlockTypeWithAnalytics(name, inputMethod, editorAnalyticsApi,
|
|
|
111
110
|
tr
|
|
112
111
|
});
|
|
113
112
|
}
|
|
114
|
-
if (name === 'smallText' && marks.fontSize
|
|
113
|
+
if (name === 'smallText' && marks.fontSize) {
|
|
115
114
|
return setSmallTextWithAnalytics(inputMethod, editorAnalyticsApi, fromBlockQuote)({
|
|
116
115
|
tr
|
|
117
116
|
});
|
|
@@ -242,7 +241,7 @@ export function setNormalText(fromBlockQuote) {
|
|
|
242
241
|
const {
|
|
243
242
|
fontSize
|
|
244
243
|
} = schema.marks;
|
|
245
|
-
if (fontSize
|
|
244
|
+
if (fontSize) {
|
|
246
245
|
if (selection instanceof CellSelection) {
|
|
247
246
|
selection.forEachCell((cell, pos) => {
|
|
248
247
|
createToggleBlockMarkOnRangeNext(fontSize, () => false, [schema.nodes.paragraph])(pos, pos + cell.nodeSize, tr);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Slice, Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { findWrapping } from '@atlaskit/editor-prosemirror/transform';
|
|
3
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
3
|
export function wrapSelectionInBlockType(_nodeType) {
|
|
5
4
|
return ({
|
|
6
5
|
tr
|
|
@@ -15,7 +14,7 @@ export function wrapSelectionInBlockType(_nodeType) {
|
|
|
15
14
|
} = tr.doc.type.schema.marks;
|
|
16
15
|
if (nodes.paragraph && nodes.blockquote) {
|
|
17
16
|
/** Remove alignment, indentation, and unsupported blockquote marks from the selection */
|
|
18
|
-
const marksToRemove =
|
|
17
|
+
const marksToRemove = [alignment, indentation, fontSize];
|
|
19
18
|
const hasMark = mark => marksToRemove.indexOf(mark.type) > -1;
|
|
20
19
|
const not = fn => arg => !fn(arg);
|
|
21
20
|
|
|
@@ -3,7 +3,6 @@ import { INSERTED_TRAILING_PARAGRAPH_TO_LAST_NODE_META } from '@atlaskit/editor-
|
|
|
3
3
|
import { getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
5
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
6
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
6
|
import { BLOCK_QUOTE, CODE_BLOCK, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6, HEADINGS_BY_LEVEL, NORMAL_TEXT, OTHER, PANEL, TEXT_BLOCK_TYPES, WRAPPER_BLOCK_TYPES, getBlockTypesInDropdown, SMALL_TEXT } from './block-types';
|
|
8
7
|
import { setHeadingWithAnalytics, setNormalTextWithAnalytics, setSmallTextWithAnalytics } from './commands/block-type';
|
|
9
8
|
import { HEADING_KEYS, HEADING_NUMPAD_KEYS, KEY_7 } from './consts';
|
|
@@ -14,7 +13,7 @@ const blockTypeForNode = (node, schema) => {
|
|
|
14
13
|
if (maybeNode) {
|
|
15
14
|
return maybeNode;
|
|
16
15
|
}
|
|
17
|
-
} else if (node.marks.some(m => m.type.name === 'fontSize' && m.attrs.fontSize === 'small')
|
|
16
|
+
} else if (node.marks.some(m => m.type.name === 'fontSize' && m.attrs.fontSize === 'small')) {
|
|
18
17
|
return SMALL_TEXT;
|
|
19
18
|
} else if (node.type === schema.nodes.paragraph) {
|
|
20
19
|
return NORMAL_TEXT;
|
|
@@ -35,7 +34,7 @@ const isBlockTypeSchemaSupported = (blockType, state) => {
|
|
|
35
34
|
case HEADING_6:
|
|
36
35
|
return !!state.schema.nodes.heading;
|
|
37
36
|
case SMALL_TEXT:
|
|
38
|
-
return !!state.schema.marks.fontSize
|
|
37
|
+
return !!state.schema.marks.fontSize;
|
|
39
38
|
case BLOCK_QUOTE:
|
|
40
39
|
return !!state.schema.nodes.blockquote;
|
|
41
40
|
case CODE_BLOCK:
|
|
@@ -145,7 +144,7 @@ export const createPlugin = (editorAPI, dispatch, lastNodeMustBeParagraph, inclu
|
|
|
145
144
|
var _editorAPI$core$actio2, _editorAPI$core2;
|
|
146
145
|
return (_editorAPI$core$actio2 = editorAPI === null || editorAPI === void 0 ? void 0 : (_editorAPI$core2 = editorAPI.core) === null || _editorAPI$core2 === void 0 ? void 0 : _editorAPI$core2.actions.execute(autoformatHeading(headingLevel, editorAnalyticsApi))) !== null && _editorAPI$core$actio2 !== void 0 ? _editorAPI$core$actio2 : false;
|
|
147
146
|
}
|
|
148
|
-
} else if (event.keyCode === KEY_7 && event.altKey
|
|
147
|
+
} else if (event.keyCode === KEY_7 && event.altKey) {
|
|
149
148
|
if (browser.mac && event.metaKey) {
|
|
150
149
|
var _editorAPI$core$actio3, _editorAPI$core3;
|
|
151
150
|
return (_editorAPI$core$actio3 = editorAPI === null || editorAPI === void 0 ? void 0 : (_editorAPI$core3 = editorAPI.core) === null || _editorAPI$core3 === void 0 ? void 0 : _editorAPI$core3.actions.execute(setSmallTextWithAnalytics(INPUT_METHOD.SHORTCUT, editorAnalyticsApi))) !== null && _editorAPI$core$actio3 !== void 0 ? _editorAPI$core$actio3 : false;
|
|
@@ -16,7 +16,6 @@ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared
|
|
|
16
16
|
import { ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
17
17
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
18
18
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
19
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
20
19
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
21
20
|
import { isSelectionInsideListNode } from '../../utils';
|
|
22
21
|
const smallTextStyle = null;
|
|
@@ -180,7 +179,7 @@ export const HeadingButton = ({
|
|
|
180
179
|
|
|
181
180
|
// Extract the numeric level from the block type name (e.g. 'heading1' → 1).
|
|
182
181
|
const headingLevel = blockType.name.startsWith('heading') ? parseInt(blockType.name.replace('heading', ''), 10) : null;
|
|
183
|
-
const isDisabled = isMarkdownBridgeActive ? Boolean(sourceFormatState === null || sourceFormatState === void 0 ? void 0 : sourceFormatState.inCodeBlock) :
|
|
182
|
+
const isDisabled = isMarkdownBridgeActive ? Boolean(sourceFormatState === null || sourceFormatState === void 0 ? void 0 : sourceFormatState.inCodeBlock) : shouldDisableHeadingButton(editorView === null || editorView === void 0 ? void 0 : editorView.state, blockType);
|
|
184
183
|
const fromBlockQuote = (currentBlockType === null || currentBlockType === void 0 ? void 0 : currentBlockType.name) === 'blockquote';
|
|
185
184
|
const onClick = () => {
|
|
186
185
|
var _api$core, _api$blockType, _api$blockType$comman;
|
|
@@ -7,7 +7,6 @@ import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
|
7
7
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
8
8
|
import { ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
10
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
12
11
|
import { isSelectionInsideListNode } from '../../utils';
|
|
13
12
|
const shouldDisableQuoteButton = state => {
|
|
@@ -47,7 +46,7 @@ export const QuoteButton = ({
|
|
|
47
46
|
// on setView. sourceBlockFormatState is null between the view switch and the
|
|
48
47
|
// first CM6 update listener fire, so we can't rely on it as the sentinel.
|
|
49
48
|
const isMarkdownBridgeActive = markdownView === 'syntax';
|
|
50
|
-
const isDisabled = isMarkdownBridgeActive ? Boolean(sourceBlockFormatState === null || sourceBlockFormatState === void 0 ? void 0 : sourceBlockFormatState.inCodeBlock) :
|
|
49
|
+
const isDisabled = isMarkdownBridgeActive ? Boolean(sourceBlockFormatState === null || sourceBlockFormatState === void 0 ? void 0 : sourceBlockFormatState.inCodeBlock) : shouldDisableQuoteButton(editorView === null || editorView === void 0 ? void 0 : editorView.state);
|
|
51
50
|
const onClick = () => {
|
|
52
51
|
var _api$core, _api$blockType, _api$blockType$comman;
|
|
53
52
|
if (isDisabled) {
|
|
@@ -2,7 +2,6 @@ import { anyMarkActive } from '@atlaskit/editor-common/mark';
|
|
|
2
2
|
import { createBlockTaskItem } from '@atlaskit/editor-common/transforms';
|
|
3
3
|
import { createRule, createWrappingJoinRule } from '@atlaskit/editor-common/utils';
|
|
4
4
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
5
|
import { WRAPPER_BLOCK_TYPES, FORMATTING_NODE_TYPES, FORMATTING_MARK_TYPES } from './block-types';
|
|
7
6
|
export const isNodeAWrappingBlockNode = node => {
|
|
8
7
|
if (!node) {
|
|
@@ -62,7 +61,7 @@ function getSelectedWrapperNodes(state) {
|
|
|
62
61
|
} = state.schema.nodes;
|
|
63
62
|
const wrapperNodes = [blockquote, panel, orderedList, bulletList, listItem, codeBlock, decisionItem, decisionList, taskItem, taskList];
|
|
64
63
|
wrapperNodes.push(caption);
|
|
65
|
-
if (empty
|
|
64
|
+
if (empty) {
|
|
66
65
|
for (let depth = 0; depth <= $from.depth; depth++) {
|
|
67
66
|
const node = $from.node(depth);
|
|
68
67
|
if (node.isBlock && wrapperNodes.indexOf(node.type) >= 0) {
|
|
@@ -94,7 +93,7 @@ export function areBlockTypesDisabled(state, allowFontSize = false) {
|
|
|
94
93
|
taskList,
|
|
95
94
|
taskItem
|
|
96
95
|
} = state.schema.nodes;
|
|
97
|
-
const isSmallFontSizeEnabled = allowFontSize
|
|
96
|
+
const isSmallFontSizeEnabled = allowFontSize;
|
|
98
97
|
const excludedTypes = isSmallFontSizeEnabled ? [panel, bulletList, orderedList, listItem, taskList, taskItem] : [panel];
|
|
99
98
|
const disallowedWrapperTypes = nodesTypes.filter(type => !excludedTypes.includes(type));
|
|
100
99
|
if (isSmallFontSizeEnabled) {
|
|
@@ -14,7 +14,6 @@ import { IconHeading, IconQuote } from '@atlaskit/editor-common/assets';
|
|
|
14
14
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
15
15
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
16
16
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
17
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
18
17
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
19
18
|
import { clearFormatting as _clearFormatting, insertBlockQuoteWithAnalytics, insertBlockQuoteWithAnalyticsCommand, setBlockTypeWithAnalytics } from './pm-plugins/commands/block-type';
|
|
20
19
|
import inputRulePlugin from './pm-plugins/input-rule';
|
|
@@ -172,7 +171,7 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
|
|
|
172
171
|
return nodes;
|
|
173
172
|
},
|
|
174
173
|
marks: function marks() {
|
|
175
|
-
if (options !== null && options !== void 0 && options.allowFontSize
|
|
174
|
+
if (options !== null && options !== void 0 && options.allowFontSize) {
|
|
176
175
|
return [{
|
|
177
176
|
name: 'fontSize',
|
|
178
177
|
mark: fontSize
|
|
@@ -13,7 +13,6 @@ import TextHeadingThreeIcon from '@atlaskit/icon-lab/core/text-heading-three';
|
|
|
13
13
|
import TextHeadingTwoIcon from '@atlaskit/icon-lab/core/text-heading-two';
|
|
14
14
|
import TextIcon from '@atlaskit/icon/core/text';
|
|
15
15
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
16
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
17
16
|
import { Text, H1, H2, H3, H4, H5, H6 } from './ui/ToolbarBlockType/icons';
|
|
18
17
|
export var NORMAL_TEXT = {
|
|
19
18
|
name: 'normal',
|
|
@@ -140,7 +139,7 @@ export var toolbarBlockTypesWithRank = function toolbarBlockTypesWithRank(_ref)
|
|
|
140
139
|
normal: _objectSpread(_objectSpread({}, NORMAL_TEXT), {}, {
|
|
141
140
|
icon:
|
|
142
141
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
143
|
-
|
|
142
|
+
fg('platform_editor_change_normal_text_icon') ? /*#__PURE__*/React.createElement(TextNormalIcon, {
|
|
144
143
|
size: "small",
|
|
145
144
|
label: ""
|
|
146
145
|
}) : /*#__PURE__*/React.createElement(EditorToolbarTextIcon, {
|
|
@@ -150,7 +149,7 @@ export var toolbarBlockTypesWithRank = function toolbarBlockTypesWithRank(_ref)
|
|
|
150
149
|
toolbarRank: TEXT_STYLES_MENU_SECTION_RANK[NORMAL_TEXT_MENU_ITEM.key],
|
|
151
150
|
toolbarKey: NORMAL_TEXT_MENU_ITEM.key
|
|
152
151
|
})
|
|
153
|
-
}, allowFontSize &&
|
|
152
|
+
}, allowFontSize && {
|
|
154
153
|
smallText: _objectSpread(_objectSpread({}, SMALL_TEXT), {}, {
|
|
155
154
|
icon: /*#__PURE__*/React.createElement(TextSmallIcon, {
|
|
156
155
|
size: "small",
|
|
@@ -7,7 +7,6 @@ import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
|
7
7
|
import { filterChildrenBetween, wrapSelectionIn } from '@atlaskit/editor-common/utils';
|
|
8
8
|
import { liftTarget } from '@atlaskit/editor-prosemirror/transform';
|
|
9
9
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
10
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
10
|
import { HEADINGS_BY_NAME, NORMAL_TEXT } from '../block-types';
|
|
12
11
|
import { convertTaskItemsToBlockTaskItems, getSelectionRangeExpandedToLists } from '../utils';
|
|
13
12
|
import { FORMATTING_NODE_TYPES, FORMATTING_MARK_TYPES, cellSelectionNodesBetween, formatTypes, clearNodeFormattingOnSelection } from './clear-formatting';
|
|
@@ -21,7 +20,7 @@ export function setBlockType(name) {
|
|
|
21
20
|
tr: tr
|
|
22
21
|
});
|
|
23
22
|
}
|
|
24
|
-
if (name === 'smallText'
|
|
23
|
+
if (name === 'smallText') {
|
|
25
24
|
return setSmallText()({
|
|
26
25
|
tr: tr
|
|
27
26
|
});
|
|
@@ -74,7 +73,7 @@ export function setHeading(level, fromBlockQuote) {
|
|
|
74
73
|
// List content stays as paragraphs (headings aren't allowed in list items),
|
|
75
74
|
// but non-list content has been converted to headings by setBlockType above.
|
|
76
75
|
var fontSize = schema.marks.fontSize;
|
|
77
|
-
if (fontSize
|
|
76
|
+
if (fontSize) {
|
|
78
77
|
var allowedBlocks = [schema.nodes.paragraph, schema.nodes.heading];
|
|
79
78
|
if (selection instanceof CellSelection) {
|
|
80
79
|
selection.forEachCell(function (cell, pos) {
|
|
@@ -103,7 +102,7 @@ export function setBlockTypeWithAnalytics(name, inputMethod, editorAnalyticsApi,
|
|
|
103
102
|
tr: tr
|
|
104
103
|
});
|
|
105
104
|
}
|
|
106
|
-
if (name === 'smallText' && marks.fontSize
|
|
105
|
+
if (name === 'smallText' && marks.fontSize) {
|
|
107
106
|
return setSmallTextWithAnalytics(inputMethod, editorAnalyticsApi, fromBlockQuote)({
|
|
108
107
|
tr: tr
|
|
109
108
|
});
|
|
@@ -217,7 +216,7 @@ export function setNormalText(fromBlockQuote) {
|
|
|
217
216
|
|
|
218
217
|
// Remove fontSize mark from any lists the selection touches
|
|
219
218
|
var fontSize = schema.marks.fontSize;
|
|
220
|
-
if (fontSize
|
|
219
|
+
if (fontSize) {
|
|
221
220
|
if (selection instanceof CellSelection) {
|
|
222
221
|
selection.forEachCell(function (cell, pos) {
|
|
223
222
|
createToggleBlockMarkOnRangeNext(fontSize, function () {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Slice, Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { findWrapping } from '@atlaskit/editor-prosemirror/transform';
|
|
3
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
3
|
export function wrapSelectionInBlockType(_nodeType) {
|
|
5
4
|
return function (_ref) {
|
|
6
5
|
var tr = _ref.tr;
|
|
@@ -11,7 +10,7 @@ export function wrapSelectionInBlockType(_nodeType) {
|
|
|
11
10
|
fontSize = _tr$doc$type$schema$m.fontSize;
|
|
12
11
|
if (nodes.paragraph && nodes.blockquote) {
|
|
13
12
|
/** Remove alignment, indentation, and unsupported blockquote marks from the selection */
|
|
14
|
-
var marksToRemove =
|
|
13
|
+
var marksToRemove = [alignment, indentation, fontSize];
|
|
15
14
|
var hasMark = function hasMark(mark) {
|
|
16
15
|
return marksToRemove.indexOf(mark.type) > -1;
|
|
17
16
|
};
|
|
@@ -6,7 +6,6 @@ import { INSERTED_TRAILING_PARAGRAPH_TO_LAST_NODE_META } from '@atlaskit/editor-
|
|
|
6
6
|
import { getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
7
7
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
8
8
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
9
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
9
|
import { BLOCK_QUOTE, CODE_BLOCK, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6, HEADINGS_BY_LEVEL, NORMAL_TEXT, OTHER, PANEL, TEXT_BLOCK_TYPES, WRAPPER_BLOCK_TYPES, getBlockTypesInDropdown, SMALL_TEXT } from './block-types';
|
|
11
10
|
import { setHeadingWithAnalytics, setNormalTextWithAnalytics, setSmallTextWithAnalytics } from './commands/block-type';
|
|
12
11
|
import { HEADING_KEYS, HEADING_NUMPAD_KEYS, KEY_7 } from './consts';
|
|
@@ -19,7 +18,7 @@ var blockTypeForNode = function blockTypeForNode(node, schema) {
|
|
|
19
18
|
}
|
|
20
19
|
} else if (node.marks.some(function (m) {
|
|
21
20
|
return m.type.name === 'fontSize' && m.attrs.fontSize === 'small';
|
|
22
|
-
})
|
|
21
|
+
})) {
|
|
23
22
|
return SMALL_TEXT;
|
|
24
23
|
} else if (node.type === schema.nodes.paragraph) {
|
|
25
24
|
return NORMAL_TEXT;
|
|
@@ -40,7 +39,7 @@ var isBlockTypeSchemaSupported = function isBlockTypeSchemaSupported(blockType,
|
|
|
40
39
|
case HEADING_6:
|
|
41
40
|
return !!state.schema.nodes.heading;
|
|
42
41
|
case SMALL_TEXT:
|
|
43
|
-
return !!state.schema.marks.fontSize
|
|
42
|
+
return !!state.schema.marks.fontSize;
|
|
44
43
|
case BLOCK_QUOTE:
|
|
45
44
|
return !!state.schema.nodes.blockquote;
|
|
46
45
|
case CODE_BLOCK:
|
|
@@ -154,7 +153,7 @@ export var createPlugin = function createPlugin(editorAPI, dispatch, lastNodeMus
|
|
|
154
153
|
var _editorAPI$core$actio2, _editorAPI$core2;
|
|
155
154
|
return (_editorAPI$core$actio2 = editorAPI === null || editorAPI === void 0 || (_editorAPI$core2 = editorAPI.core) === null || _editorAPI$core2 === void 0 ? void 0 : _editorAPI$core2.actions.execute(autoformatHeading(headingLevel, editorAnalyticsApi))) !== null && _editorAPI$core$actio2 !== void 0 ? _editorAPI$core$actio2 : false;
|
|
156
155
|
}
|
|
157
|
-
} else if (event.keyCode === KEY_7 && event.altKey
|
|
156
|
+
} else if (event.keyCode === KEY_7 && event.altKey) {
|
|
158
157
|
if (browser.mac && event.metaKey) {
|
|
159
158
|
var _editorAPI$core$actio3, _editorAPI$core3;
|
|
160
159
|
return (_editorAPI$core$actio3 = editorAPI === null || editorAPI === void 0 || (_editorAPI$core3 = editorAPI.core) === null || _editorAPI$core3 === void 0 ? void 0 : _editorAPI$core3.actions.execute(setSmallTextWithAnalytics(INPUT_METHOD.SHORTCUT, editorAnalyticsApi))) !== null && _editorAPI$core$actio3 !== void 0 ? _editorAPI$core$actio3 : false;
|
|
@@ -16,7 +16,6 @@ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared
|
|
|
16
16
|
import { ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
17
17
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
18
18
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
19
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
20
19
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
21
20
|
import { isSelectionInsideListNode } from '../../utils';
|
|
22
21
|
var smallTextStyle = null;
|
|
@@ -175,7 +174,7 @@ export var HeadingButton = function HeadingButton(_ref4) {
|
|
|
175
174
|
|
|
176
175
|
// Extract the numeric level from the block type name (e.g. 'heading1' → 1).
|
|
177
176
|
var headingLevel = blockType.name.startsWith('heading') ? parseInt(blockType.name.replace('heading', ''), 10) : null;
|
|
178
|
-
var isDisabled = isMarkdownBridgeActive ? Boolean(sourceFormatState === null || sourceFormatState === void 0 ? void 0 : sourceFormatState.inCodeBlock) :
|
|
177
|
+
var isDisabled = isMarkdownBridgeActive ? Boolean(sourceFormatState === null || sourceFormatState === void 0 ? void 0 : sourceFormatState.inCodeBlock) : shouldDisableHeadingButton(editorView === null || editorView === void 0 ? void 0 : editorView.state, blockType);
|
|
179
178
|
var fromBlockQuote = (currentBlockType === null || currentBlockType === void 0 ? void 0 : currentBlockType.name) === 'blockquote';
|
|
180
179
|
var onClick = function onClick() {
|
|
181
180
|
var _api$core, _api$blockType;
|
|
@@ -7,7 +7,6 @@ import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
|
7
7
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
8
8
|
import { ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
10
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
12
11
|
import { isSelectionInsideListNode } from '../../utils';
|
|
13
12
|
var shouldDisableQuoteButton = function shouldDisableQuoteButton(state) {
|
|
@@ -45,7 +44,7 @@ export var QuoteButton = function QuoteButton(_ref) {
|
|
|
45
44
|
// on setView. sourceBlockFormatState is null between the view switch and the
|
|
46
45
|
// first CM6 update listener fire, so we can't rely on it as the sentinel.
|
|
47
46
|
var isMarkdownBridgeActive = markdownView === 'syntax';
|
|
48
|
-
var isDisabled = isMarkdownBridgeActive ? Boolean(sourceBlockFormatState === null || sourceBlockFormatState === void 0 ? void 0 : sourceBlockFormatState.inCodeBlock) :
|
|
47
|
+
var isDisabled = isMarkdownBridgeActive ? Boolean(sourceBlockFormatState === null || sourceBlockFormatState === void 0 ? void 0 : sourceBlockFormatState.inCodeBlock) : shouldDisableQuoteButton(editorView === null || editorView === void 0 ? void 0 : editorView.state);
|
|
49
48
|
var onClick = function onClick() {
|
|
50
49
|
var _api$core, _api$blockType;
|
|
51
50
|
if (isDisabled) {
|
|
@@ -2,7 +2,6 @@ import { anyMarkActive } from '@atlaskit/editor-common/mark';
|
|
|
2
2
|
import { createBlockTaskItem } from '@atlaskit/editor-common/transforms';
|
|
3
3
|
import { createRule, createWrappingJoinRule } from '@atlaskit/editor-common/utils';
|
|
4
4
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
5
|
import { WRAPPER_BLOCK_TYPES, FORMATTING_NODE_TYPES, FORMATTING_MARK_TYPES } from './block-types';
|
|
7
6
|
export var isNodeAWrappingBlockNode = function isNodeAWrappingBlockNode(node) {
|
|
8
7
|
if (!node) {
|
|
@@ -63,7 +62,7 @@ function getSelectedWrapperNodes(state) {
|
|
|
63
62
|
taskList = _state$schema$nodes.taskList;
|
|
64
63
|
var wrapperNodes = [blockquote, panel, orderedList, bulletList, listItem, codeBlock, decisionItem, decisionList, taskItem, taskList];
|
|
65
64
|
wrapperNodes.push(caption);
|
|
66
|
-
if (empty
|
|
65
|
+
if (empty) {
|
|
67
66
|
for (var depth = 0; depth <= $from.depth; depth++) {
|
|
68
67
|
var node = $from.node(depth);
|
|
69
68
|
if (node.isBlock && wrapperNodes.indexOf(node.type) >= 0) {
|
|
@@ -95,7 +94,7 @@ export function areBlockTypesDisabled(state) {
|
|
|
95
94
|
listItem = _state$schema$nodes2.listItem,
|
|
96
95
|
taskList = _state$schema$nodes2.taskList,
|
|
97
96
|
taskItem = _state$schema$nodes2.taskItem;
|
|
98
|
-
var isSmallFontSizeEnabled = allowFontSize
|
|
97
|
+
var isSmallFontSizeEnabled = allowFontSize;
|
|
99
98
|
var excludedTypes = isSmallFontSizeEnabled ? [panel, bulletList, orderedList, listItem, taskList, taskItem] : [panel];
|
|
100
99
|
var disallowedWrapperTypes = nodesTypes.filter(function (type) {
|
|
101
100
|
return !excludedTypes.includes(type);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-type",
|
|
3
|
-
"version": "22.0.
|
|
3
|
+
"version": "22.0.7",
|
|
4
4
|
"description": "BlockType plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@atlaskit/css": "^1.1.0",
|
|
26
26
|
"@atlaskit/editor-plugin-analytics": "^18.0.0",
|
|
27
27
|
"@atlaskit/editor-plugin-block-menu": "^17.0.0",
|
|
28
|
-
"@atlaskit/editor-plugin-interaction": "^
|
|
28
|
+
"@atlaskit/editor-plugin-interaction": "^30.0.0",
|
|
29
29
|
"@atlaskit/editor-plugin-list": "^20.0.0",
|
|
30
30
|
"@atlaskit/editor-plugin-primary-toolbar": "^19.0.0",
|
|
31
31
|
"@atlaskit/editor-plugin-selection": "^18.0.0",
|
|
@@ -36,21 +36,21 @@
|
|
|
36
36
|
"@atlaskit/editor-tables": "^3.2.0",
|
|
37
37
|
"@atlaskit/editor-toolbar": "^2.6.0",
|
|
38
38
|
"@atlaskit/editor-toolbar-model": "^1.2.0",
|
|
39
|
-
"@atlaskit/icon": "^37.
|
|
40
|
-
"@atlaskit/icon-lab": "^7.
|
|
39
|
+
"@atlaskit/icon": "^37.7.0",
|
|
40
|
+
"@atlaskit/icon-lab": "^7.9.0",
|
|
41
41
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
42
42
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
43
43
|
"@atlaskit/primitives": "^22.5.0",
|
|
44
44
|
"@atlaskit/prosemirror-history": "^1.2.0",
|
|
45
45
|
"@atlaskit/prosemirror-input-rules": "^4.1.0",
|
|
46
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
47
|
-
"@atlaskit/tokens": "^
|
|
46
|
+
"@atlaskit/tmp-editor-statsig": "^195.0.0",
|
|
47
|
+
"@atlaskit/tokens": "^17.0.0",
|
|
48
48
|
"@babel/runtime": "^7.0.0",
|
|
49
49
|
"@compiled/react": "^1.0.2",
|
|
50
50
|
"@emotion/react": "^11.7.1"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@atlaskit/editor-common": "^122.
|
|
53
|
+
"@atlaskit/editor-common": "^122.6.0",
|
|
54
54
|
"react": "^18.2.0 || ^19.2.0",
|
|
55
55
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
56
56
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|