@atlaskit/editor-plugin-block-type 1.0.3 → 3.0.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 +40 -0
- package/dist/cjs/i18n/cs.js +2 -3
- package/dist/cjs/i18n/da.js +2 -3
- package/dist/cjs/i18n/de.js +2 -3
- package/dist/cjs/i18n/en.js +2 -3
- package/dist/cjs/i18n/en_GB.js +2 -3
- package/dist/cjs/i18n/en_ZZ.js +2 -3
- package/dist/cjs/i18n/es.js +2 -3
- package/dist/cjs/i18n/fi.js +2 -3
- package/dist/cjs/i18n/fr.js +2 -3
- package/dist/cjs/i18n/hu.js +2 -3
- package/dist/cjs/i18n/it.js +2 -3
- package/dist/cjs/i18n/ja.js +2 -3
- package/dist/cjs/i18n/ko.js +2 -3
- package/dist/cjs/i18n/nb.js +2 -3
- package/dist/cjs/i18n/nl.js +8 -9
- package/dist/cjs/i18n/pl.js +2 -3
- package/dist/cjs/i18n/pt_BR.js +2 -3
- package/dist/cjs/i18n/ru.js +2 -3
- package/dist/cjs/i18n/sv.js +2 -3
- package/dist/cjs/i18n/th.js +2 -3
- package/dist/cjs/i18n/tr.js +2 -3
- package/dist/cjs/i18n/uk.js +2 -3
- package/dist/cjs/i18n/vi.js +2 -3
- package/dist/cjs/i18n/zh.js +2 -3
- package/dist/cjs/i18n/zh_TW.js +2 -3
- package/dist/cjs/plugin/block-types.js +29 -45
- package/dist/cjs/plugin/commands/block-type.js +95 -60
- package/dist/cjs/plugin/commands/delete-and-move-cursor.js +2 -3
- package/dist/cjs/plugin/commands/index.js +1 -8
- package/dist/cjs/plugin/consts.js +1 -2
- package/dist/cjs/plugin/index.js +26 -26
- package/dist/cjs/plugin/pm-plugins/input-rule.js +1 -2
- package/dist/cjs/plugin/pm-plugins/main.js +12 -12
- package/dist/cjs/plugin/styles.js +2 -3
- package/dist/cjs/plugin/ui/ToolbarBlockType/blocktype-button.js +5 -13
- package/dist/cjs/plugin/ui/ToolbarBlockType/index.js +2 -3
- package/dist/cjs/plugin/ui/ToolbarBlockType/styled.js +7 -14
- package/dist/cjs/plugin/utils.js +3 -6
- package/dist/es2019/i18n/nl.js +6 -6
- package/dist/es2019/plugin/block-types.js +1 -1
- package/dist/es2019/plugin/commands/block-type.js +101 -46
- package/dist/es2019/plugin/commands/index.js +1 -6
- package/dist/es2019/plugin/index.js +18 -19
- package/dist/es2019/plugin/pm-plugins/main.js +10 -8
- package/dist/es2019/plugin/ui/ToolbarBlockType/blocktype-button.js +3 -9
- package/dist/es2019/plugin/ui/ToolbarBlockType/index.js +1 -1
- package/dist/esm/i18n/nl.js +6 -6
- package/dist/esm/plugin/block-types.js +1 -1
- package/dist/esm/plugin/commands/block-type.js +90 -53
- package/dist/esm/plugin/commands/index.js +1 -6
- package/dist/esm/plugin/index.js +20 -19
- package/dist/esm/plugin/pm-plugins/main.js +10 -8
- package/dist/esm/plugin/ui/ToolbarBlockType/blocktype-button.js +3 -9
- package/dist/esm/plugin/ui/ToolbarBlockType/index.js +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/plugin/block-types.d.ts +1 -0
- package/dist/types/plugin/commands/block-type.d.ts +8 -6
- package/dist/types/plugin/commands/index.d.ts +0 -5
- package/dist/types/plugin/index.d.ts +5 -2
- package/dist/types/plugin/pm-plugins/main.d.ts +3 -2
- package/dist/types/plugin/ui/ToolbarBlockType/blocktype-button.d.ts +0 -7
- package/dist/types/plugin/ui/ToolbarBlockType/index.d.ts +2 -1
- package/dist/types-ts4.5/index.d.ts +1 -0
- package/dist/types-ts4.5/plugin/block-types.d.ts +1 -0
- package/dist/types-ts4.5/plugin/commands/block-type.d.ts +8 -6
- package/dist/types-ts4.5/plugin/commands/index.d.ts +0 -5
- package/dist/types-ts4.5/plugin/index.d.ts +5 -2
- package/dist/types-ts4.5/plugin/pm-plugins/main.d.ts +3 -2
- package/dist/types-ts4.5/plugin/ui/ToolbarBlockType/blocktype-button.d.ts +0 -7
- package/dist/types-ts4.5/plugin/ui/ToolbarBlockType/index.d.ts +2 -1
- package/package.json +3 -4
- package/report.api.md +17 -1
- package/tmp/api-report-tmp.d.ts +7 -1
- package/dist/cjs/messages.js +0 -19
- package/dist/cjs/plugin/messages.js +0 -160
- package/dist/cjs/plugin/ui/ToolbarBlockType/toolbar-messages.js +0 -15
- package/dist/es2019/messages.js +0 -2
- package/dist/es2019/plugin/messages.js +0 -153
- package/dist/es2019/plugin/ui/ToolbarBlockType/toolbar-messages.js +0 -8
- package/dist/esm/messages.js +0 -2
- package/dist/esm/plugin/messages.js +0 -153
- package/dist/esm/plugin/ui/ToolbarBlockType/toolbar-messages.js +0 -8
- package/dist/types/messages.d.ts +0 -2
- package/dist/types/plugin/messages.d.ts +0 -152
- package/dist/types/plugin/ui/ToolbarBlockType/toolbar-messages.d.ts +0 -7
- package/dist/types-ts4.5/messages.d.ts +0 -2
- package/dist/types-ts4.5/plugin/messages.d.ts +0 -152
- package/dist/types-ts4.5/plugin/ui/ToolbarBlockType/toolbar-messages.d.ts +0 -7
- package/messages/package.json +0 -15
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
export { cleanUpAtTheStartOfDocument, insertBlockQuoteWithAnalytics, setBlockType, setBlockTypeWithAnalytics, setHeadingWithAnalytics, setNormalText, setNormalTextWithAnalytics } from './block-type';
|
|
2
2
|
export { deleteAndMoveCursor } from './delete-and-move-cursor';
|
|
3
|
-
export { deleteBlockContent } from './delete-block-content';
|
|
4
|
-
/**
|
|
5
|
-
* @private
|
|
6
|
-
* @deprecated use import from @atlaskit/editor-common/commands
|
|
7
|
-
*/
|
|
8
|
-
export { setHeading } from '@atlaskit/editor-common/commands';
|
|
3
|
+
export { deleteBlockContent } from './delete-block-content';
|
package/dist/esm/plugin/index.js
CHANGED
|
@@ -3,12 +3,12 @@ import React from 'react';
|
|
|
3
3
|
import { blockquote, hardBreak, heading } from '@atlaskit/adf-schema';
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { keymap, toggleBlockQuote, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
6
|
+
import { blockTypeMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
7
|
import { IconHeading, IconQuote } from '@atlaskit/editor-common/quick-insert';
|
|
7
8
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
8
9
|
import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
|
|
9
10
|
import { setBlockTypeWithAnalytics } from './commands';
|
|
10
11
|
import { insertBlockQuoteWithAnalytics } from './commands/block-type';
|
|
11
|
-
import { messages } from './messages';
|
|
12
12
|
import inputRulePlugin from './pm-plugins/input-rule';
|
|
13
13
|
import keymapPlugin from './pm-plugins/keymap';
|
|
14
14
|
import { createPlugin, pluginKey } from './pm-plugins/main';
|
|
@@ -44,7 +44,7 @@ var headingPluginOptions = function headingPluginOptions(_ref, isAllowed, editor
|
|
|
44
44
|
var tr = insert(state.schema.nodes.heading.createChecked({
|
|
45
45
|
level: level
|
|
46
46
|
}));
|
|
47
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
47
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
48
48
|
action: ACTION.FORMATTED,
|
|
49
49
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
50
50
|
eventType: EVENT_TYPE.TRACK,
|
|
@@ -75,7 +75,7 @@ var blockquotePluginOptions = function blockquotePluginOptions(_ref2, isAllowed,
|
|
|
75
75
|
},
|
|
76
76
|
action: function action(insert, state) {
|
|
77
77
|
var tr = insert(state.schema.nodes.blockquote.createChecked({}, state.schema.nodes.paragraph.createChecked()));
|
|
78
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
78
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
79
79
|
action: ACTION.FORMATTED,
|
|
80
80
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
81
81
|
eventType: EVENT_TYPE.TRACK,
|
|
@@ -116,17 +116,16 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
|
|
|
116
116
|
return [{
|
|
117
117
|
name: 'blockType',
|
|
118
118
|
plugin: function plugin(_ref4) {
|
|
119
|
-
var _api$analytics;
|
|
120
119
|
var dispatch = _ref4.dispatch;
|
|
121
|
-
return createPlugin(api
|
|
120
|
+
return createPlugin(api, dispatch, options && options.lastNodeMustBeParagraph);
|
|
122
121
|
}
|
|
123
122
|
}, {
|
|
124
123
|
name: 'blockTypeInputRule',
|
|
125
124
|
plugin: function plugin(_ref5) {
|
|
126
|
-
var _api$
|
|
125
|
+
var _api$analytics;
|
|
127
126
|
var schema = _ref5.schema,
|
|
128
127
|
featureFlags = _ref5.featureFlags;
|
|
129
|
-
return inputRulePlugin(api === null || api === void 0
|
|
128
|
+
return inputRulePlugin(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, schema, featureFlags);
|
|
130
129
|
}
|
|
131
130
|
},
|
|
132
131
|
// Needs to be lower priority than editor-tables.tableEditing
|
|
@@ -134,21 +133,23 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
|
|
|
134
133
|
{
|
|
135
134
|
name: 'blockTypeKeyMap',
|
|
136
135
|
plugin: function plugin(_ref6) {
|
|
137
|
-
var _api$
|
|
136
|
+
var _api$analytics2;
|
|
138
137
|
var schema = _ref6.schema,
|
|
139
138
|
featureFlags = _ref6.featureFlags;
|
|
140
|
-
return keymapPlugin(api === null || api === void 0
|
|
139
|
+
return keymapPlugin(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, schema, featureFlags);
|
|
141
140
|
}
|
|
142
141
|
}];
|
|
143
142
|
},
|
|
144
143
|
actions: {
|
|
145
144
|
insertBlockQuote: function insertBlockQuote(inputMethod) {
|
|
145
|
+
var _api$analytics3;
|
|
146
|
+
return insertBlockQuoteWithAnalytics(inputMethod, api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
commands: {
|
|
150
|
+
setTextLevel: function setTextLevel(level, inputMethod) {
|
|
146
151
|
var _api$analytics4;
|
|
147
|
-
return
|
|
148
|
-
},
|
|
149
|
-
setBlockType: function setBlockType(name, inputMethod) {
|
|
150
|
-
var _api$analytics5;
|
|
151
|
-
return setBlockTypeWithAnalytics(name, inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions);
|
|
152
|
+
return setBlockTypeWithAnalytics(level, inputMethod, api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
|
|
152
153
|
}
|
|
153
154
|
},
|
|
154
155
|
getSharedState: function getSharedState(editorState) {
|
|
@@ -168,8 +169,8 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
|
|
|
168
169
|
eventDispatcher = _ref7.eventDispatcher;
|
|
169
170
|
var isSmall = options && options.isUndoRedoButtonsEnabled ? toolbarSize < ToolbarSize.XXL : toolbarSize < ToolbarSize.XL;
|
|
170
171
|
var boundSetBlockType = function boundSetBlockType(name) {
|
|
171
|
-
var _api$
|
|
172
|
-
|
|
172
|
+
var _api$analytics5;
|
|
173
|
+
api === null || api === void 0 || api.core.actions.execute(setBlockTypeWithAnalytics(name, INPUT_METHOD.TOOLBAR, api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions));
|
|
173
174
|
};
|
|
174
175
|
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
175
176
|
editorView: editorView,
|
|
@@ -183,7 +184,7 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
|
|
|
183
184
|
isSmall: isSmall,
|
|
184
185
|
isDisabled: disabled,
|
|
185
186
|
isReducedSpacing: isToolbarReducedSpacing,
|
|
186
|
-
|
|
187
|
+
setTextLevel: boundSetBlockType,
|
|
187
188
|
pluginState: pluginState,
|
|
188
189
|
popupsMountPoint: popupsMountPoint,
|
|
189
190
|
popupsBoundariesElement: popupsBoundariesElement,
|
|
@@ -194,9 +195,9 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
|
|
|
194
195
|
},
|
|
195
196
|
pluginsOptions: {
|
|
196
197
|
quickInsert: function quickInsert(intl) {
|
|
197
|
-
var _api$
|
|
198
|
+
var _api$analytics6, _api$analytics7;
|
|
198
199
|
var exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
|
|
199
|
-
return [].concat(_toConsumableArray(blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0
|
|
200
|
+
return [].concat(_toConsumableArray(blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions)), _toConsumableArray(headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 || (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions)));
|
|
200
201
|
}
|
|
201
202
|
}
|
|
202
203
|
};
|
|
@@ -63,16 +63,16 @@ var detectBlockType = function detectBlockType(availableBlockTypes, state) {
|
|
|
63
63
|
});
|
|
64
64
|
return blockType || OTHER;
|
|
65
65
|
};
|
|
66
|
-
var autoformatHeading = function autoformatHeading(headingLevel,
|
|
66
|
+
var autoformatHeading = function autoformatHeading(headingLevel, editorAnalyticsApi) {
|
|
67
67
|
if (headingLevel === 0) {
|
|
68
|
-
setNormalTextWithAnalytics(INPUT_METHOD.FORMATTING, editorAnalyticsApi)
|
|
69
|
-
} else {
|
|
70
|
-
setHeadingWithAnalytics(headingLevel, INPUT_METHOD.FORMATTING, editorAnalyticsApi)(view.state, view.dispatch);
|
|
68
|
+
return setNormalTextWithAnalytics(INPUT_METHOD.FORMATTING, editorAnalyticsApi);
|
|
71
69
|
}
|
|
72
|
-
return
|
|
70
|
+
return setHeadingWithAnalytics(headingLevel, INPUT_METHOD.FORMATTING, editorAnalyticsApi);
|
|
73
71
|
};
|
|
74
72
|
export var pluginKey = new PluginKey('blockTypePlugin');
|
|
75
|
-
export var createPlugin = function createPlugin(
|
|
73
|
+
export var createPlugin = function createPlugin(editorAPI, dispatch, lastNodeMustBeParagraph) {
|
|
74
|
+
var _editorAPI$analytics;
|
|
75
|
+
var editorAnalyticsApi = editorAPI === null || editorAPI === void 0 || (_editorAPI$analytics = editorAPI.analytics) === null || _editorAPI$analytics === void 0 ? void 0 : _editorAPI$analytics.actions;
|
|
76
76
|
var altKeyLocation = 0;
|
|
77
77
|
return new SafePlugin({
|
|
78
78
|
appendTransaction: function appendTransaction(_transactions, _oldState, newState) {
|
|
@@ -123,9 +123,11 @@ export var createPlugin = function createPlugin(editorAnalyticsApi, dispatch, la
|
|
|
123
123
|
var headingLevel = HEADING_KEYS.indexOf(event.keyCode);
|
|
124
124
|
if (headingLevel > -1 && event.altKey) {
|
|
125
125
|
if (browser.mac && event.metaKey) {
|
|
126
|
-
|
|
126
|
+
var _editorAPI$core$actio;
|
|
127
|
+
return (_editorAPI$core$actio = editorAPI === null || editorAPI === void 0 ? void 0 : editorAPI.core.actions.execute(autoformatHeading(headingLevel, editorAnalyticsApi))) !== null && _editorAPI$core$actio !== void 0 ? _editorAPI$core$actio : false;
|
|
127
128
|
} else if (!browser.mac && event.ctrlKey && altKeyLocation !== event.DOM_KEY_LOCATION_RIGHT) {
|
|
128
|
-
|
|
129
|
+
var _editorAPI$core$actio2;
|
|
130
|
+
return (_editorAPI$core$actio2 = editorAPI === null || editorAPI === void 0 ? void 0 : editorAPI.core.actions.execute(autoformatHeading(headingLevel, editorAnalyticsApi))) !== null && _editorAPI$core$actio2 !== void 0 ? _editorAPI$core$actio2 : false;
|
|
129
131
|
}
|
|
130
132
|
} else if (event.key === 'Alt') {
|
|
131
133
|
// event.location is for the current key only; when a user hits Ctrl-Alt-1 the
|
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
-
import {
|
|
4
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
5
|
+
import { toolbarMessages } from '@atlaskit/editor-common/messages';
|
|
5
6
|
import { wrapperStyle } from '@atlaskit/editor-common/styles';
|
|
6
7
|
import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
7
8
|
import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
8
9
|
import TextStyleIcon from '@atlaskit/icon/glyph/editor/text-style';
|
|
9
10
|
import { NORMAL_TEXT } from '../../block-types';
|
|
10
11
|
import { buttonContentReducedSpacingStyle, buttonContentStyle, expandIconWrapperStyle, wrapperSmallStyle } from './styled';
|
|
11
|
-
export var messages = defineMessages({
|
|
12
|
-
textStyles: {
|
|
13
|
-
id: 'fabric.editor.textStyles',
|
|
14
|
-
defaultMessage: 'Text styles',
|
|
15
|
-
description: 'Menu provides access to various heading styles or normal text'
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
12
|
export var BlockTypeButton = function BlockTypeButton(props) {
|
|
19
|
-
var labelTextStyles = props.formatMessage(
|
|
13
|
+
var labelTextStyles = props.formatMessage(toolbarMessages.textStyles);
|
|
20
14
|
return jsx(ToolbarButton, {
|
|
21
15
|
spacing: props.isReducedSpacing ? 'none' : 'default',
|
|
22
16
|
selected: props.selected,
|
|
@@ -94,7 +94,7 @@ var ToolbarBlockType = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
94
94
|
_ref$shouldCloseMenu = _ref.shouldCloseMenu,
|
|
95
95
|
shouldCloseMenu = _ref$shouldCloseMenu === void 0 ? true : _ref$shouldCloseMenu;
|
|
96
96
|
var blockType = item.value;
|
|
97
|
-
_this.props.
|
|
97
|
+
_this.props.setTextLevel(blockType.name);
|
|
98
98
|
if (shouldCloseMenu) {
|
|
99
99
|
_this.setState(_objectSpread(_objectSpread({}, _this.state), {}, {
|
|
100
100
|
active: false
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export type { BlockTypePluginOptions, BlockType } from './plugin/types';
|
|
|
4
4
|
export type { BlockTypeState } from './plugin/pm-plugins/main';
|
|
5
5
|
export type { InputMethod } from './plugin/commands';
|
|
6
6
|
export type { DropdownItem } from './plugin/ui/ToolbarBlockType';
|
|
7
|
+
export type { TextBlockTypes } from './plugin/block-types';
|
|
@@ -11,6 +11,7 @@ export declare const CODE_BLOCK: BlockType;
|
|
|
11
11
|
export declare const PANEL: BlockType;
|
|
12
12
|
export declare const OTHER: BlockType;
|
|
13
13
|
export declare const TEXT_BLOCK_TYPES: BlockType[];
|
|
14
|
+
export type TextBlockTypes = 'normal' | 'heading1' | 'heading2' | 'heading3' | 'heading4' | 'heading5' | 'heading6';
|
|
14
15
|
export declare const WRAPPER_BLOCK_TYPES: BlockType[];
|
|
15
16
|
export declare const ALL_BLOCK_TYPES: BlockType[];
|
|
16
17
|
export declare const HEADINGS_BY_LEVEL: Record<number, BlockType>;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { Command, HeadingLevelsAndNormalText } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { Command, EditorCommand, HeadingLevelsAndNormalText } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { TextBlockTypes } from '../block-types';
|
|
3
4
|
export type InputMethod = INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FORMATTING | INPUT_METHOD.KEYBOARD;
|
|
4
|
-
export declare function setBlockType(name:
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
export declare
|
|
5
|
+
export declare function setBlockType(name: TextBlockTypes): EditorCommand;
|
|
6
|
+
export declare function setHeading(level: HeadingLevelsAndNormalText): EditorCommand;
|
|
7
|
+
export declare function setBlockTypeWithAnalytics(name: TextBlockTypes, inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined): EditorCommand;
|
|
8
|
+
export declare function setNormalText(): EditorCommand;
|
|
9
|
+
export declare function setNormalTextWithAnalytics(inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined): EditorCommand;
|
|
10
|
+
export declare const setHeadingWithAnalytics: (newHeadingLevel: HeadingLevelsAndNormalText, inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => EditorCommand;
|
|
9
11
|
/**
|
|
10
12
|
*
|
|
11
13
|
* @param name - block type name
|
|
@@ -2,8 +2,3 @@ export { cleanUpAtTheStartOfDocument, insertBlockQuoteWithAnalytics, setBlockTyp
|
|
|
2
2
|
export type { InputMethod } from './block-type';
|
|
3
3
|
export { deleteAndMoveCursor } from './delete-and-move-cursor';
|
|
4
4
|
export { deleteBlockContent } from './delete-block-content';
|
|
5
|
-
/**
|
|
6
|
-
* @private
|
|
7
|
-
* @deprecated use import from @atlaskit/editor-common/commands
|
|
8
|
-
*/
|
|
9
|
-
export { setHeading } from '@atlaskit/editor-common/commands';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { Command, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
1
|
+
import type { Command, EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { TextBlockTypes } from './block-types';
|
|
3
4
|
import type { InputMethod } from './commands/block-type';
|
|
4
5
|
import type { BlockTypeState } from './pm-plugins/main';
|
|
5
6
|
import type { BlockTypePluginOptions } from './types';
|
|
@@ -9,7 +10,9 @@ export type BlockTypePlugin = NextEditorPlugin<'blockType', {
|
|
|
9
10
|
sharedState: BlockTypeState | undefined;
|
|
10
11
|
actions: {
|
|
11
12
|
insertBlockQuote: (inputMethod: InputMethod) => Command;
|
|
12
|
-
|
|
13
|
+
};
|
|
14
|
+
commands: {
|
|
15
|
+
setTextLevel: (level: TextBlockTypes, inputMethod: InputMethod) => EditorCommand;
|
|
13
16
|
};
|
|
14
17
|
}>;
|
|
15
18
|
declare const blockTypePlugin: BlockTypePlugin;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
3
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import type { BlockTypePlugin } from '../index';
|
|
4
5
|
import type { BlockType } from '../types';
|
|
5
6
|
export type BlockTypeState = {
|
|
6
7
|
currentBlockType: BlockType;
|
|
@@ -9,7 +10,7 @@ export type BlockTypeState = {
|
|
|
9
10
|
availableWrapperBlockTypes: BlockType[];
|
|
10
11
|
};
|
|
11
12
|
export declare const pluginKey: PluginKey<BlockTypeState>;
|
|
12
|
-
export declare const createPlugin: (
|
|
13
|
+
export declare const createPlugin: (editorAPI: ExtractInjectionAPI<BlockTypePlugin> | undefined, dispatch: (eventName: string | PluginKey, data: any) => void, lastNodeMustBeParagraph?: boolean) => SafePlugin<{
|
|
13
14
|
currentBlockType: BlockType;
|
|
14
15
|
blockTypesDisabled: boolean;
|
|
15
16
|
availableBlockTypes: BlockType[];
|
|
@@ -12,11 +12,4 @@ export interface BlockTypeButtonProps {
|
|
|
12
12
|
onKeyDown(e: React.KeyboardEvent): void;
|
|
13
13
|
formatMessage: WrappedComponentProps['intl']['formatMessage'];
|
|
14
14
|
}
|
|
15
|
-
export declare const messages: {
|
|
16
|
-
textStyles: {
|
|
17
|
-
id: string;
|
|
18
|
-
defaultMessage: string;
|
|
19
|
-
description: string;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
15
|
export declare const BlockTypeButton: React.StatelessComponent<BlockTypeButtonProps>;
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
4
4
|
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import type { TextBlockTypes } from '../../block-types';
|
|
6
7
|
import type { BlockTypeState } from '../../pm-plugins/main';
|
|
7
8
|
import type { BlockType } from '../../types';
|
|
8
9
|
export type DropdownItem = MenuItem & {
|
|
@@ -17,7 +18,7 @@ export interface Props {
|
|
|
17
18
|
popupsBoundariesElement?: HTMLElement;
|
|
18
19
|
popupsScrollableElement?: HTMLElement;
|
|
19
20
|
editorView?: EditorView;
|
|
20
|
-
|
|
21
|
+
setTextLevel: (type: TextBlockTypes) => void;
|
|
21
22
|
}
|
|
22
23
|
export interface State {
|
|
23
24
|
active: boolean;
|
|
@@ -4,3 +4,4 @@ export type { BlockTypePluginOptions, BlockType } from './plugin/types';
|
|
|
4
4
|
export type { BlockTypeState } from './plugin/pm-plugins/main';
|
|
5
5
|
export type { InputMethod } from './plugin/commands';
|
|
6
6
|
export type { DropdownItem } from './plugin/ui/ToolbarBlockType';
|
|
7
|
+
export type { TextBlockTypes } from './plugin/block-types';
|
|
@@ -11,6 +11,7 @@ export declare const CODE_BLOCK: BlockType;
|
|
|
11
11
|
export declare const PANEL: BlockType;
|
|
12
12
|
export declare const OTHER: BlockType;
|
|
13
13
|
export declare const TEXT_BLOCK_TYPES: BlockType[];
|
|
14
|
+
export type TextBlockTypes = 'normal' | 'heading1' | 'heading2' | 'heading3' | 'heading4' | 'heading5' | 'heading6';
|
|
14
15
|
export declare const WRAPPER_BLOCK_TYPES: BlockType[];
|
|
15
16
|
export declare const ALL_BLOCK_TYPES: BlockType[];
|
|
16
17
|
export declare const HEADINGS_BY_LEVEL: Record<number, BlockType>;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { Command, HeadingLevelsAndNormalText } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { Command, EditorCommand, HeadingLevelsAndNormalText } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { TextBlockTypes } from '../block-types';
|
|
3
4
|
export type InputMethod = INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FORMATTING | INPUT_METHOD.KEYBOARD;
|
|
4
|
-
export declare function setBlockType(name:
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
export declare
|
|
5
|
+
export declare function setBlockType(name: TextBlockTypes): EditorCommand;
|
|
6
|
+
export declare function setHeading(level: HeadingLevelsAndNormalText): EditorCommand;
|
|
7
|
+
export declare function setBlockTypeWithAnalytics(name: TextBlockTypes, inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined): EditorCommand;
|
|
8
|
+
export declare function setNormalText(): EditorCommand;
|
|
9
|
+
export declare function setNormalTextWithAnalytics(inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined): EditorCommand;
|
|
10
|
+
export declare const setHeadingWithAnalytics: (newHeadingLevel: HeadingLevelsAndNormalText, inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => EditorCommand;
|
|
9
11
|
/**
|
|
10
12
|
*
|
|
11
13
|
* @param name - block type name
|
|
@@ -2,8 +2,3 @@ export { cleanUpAtTheStartOfDocument, insertBlockQuoteWithAnalytics, setBlockTyp
|
|
|
2
2
|
export type { InputMethod } from './block-type';
|
|
3
3
|
export { deleteAndMoveCursor } from './delete-and-move-cursor';
|
|
4
4
|
export { deleteBlockContent } from './delete-block-content';
|
|
5
|
-
/**
|
|
6
|
-
* @private
|
|
7
|
-
* @deprecated use import from @atlaskit/editor-common/commands
|
|
8
|
-
*/
|
|
9
|
-
export { setHeading } from '@atlaskit/editor-common/commands';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { Command, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
1
|
+
import type { Command, EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { TextBlockTypes } from './block-types';
|
|
3
4
|
import type { InputMethod } from './commands/block-type';
|
|
4
5
|
import type { BlockTypeState } from './pm-plugins/main';
|
|
5
6
|
import type { BlockTypePluginOptions } from './types';
|
|
@@ -11,7 +12,9 @@ export type BlockTypePlugin = NextEditorPlugin<'blockType', {
|
|
|
11
12
|
sharedState: BlockTypeState | undefined;
|
|
12
13
|
actions: {
|
|
13
14
|
insertBlockQuote: (inputMethod: InputMethod) => Command;
|
|
14
|
-
|
|
15
|
+
};
|
|
16
|
+
commands: {
|
|
17
|
+
setTextLevel: (level: TextBlockTypes, inputMethod: InputMethod) => EditorCommand;
|
|
15
18
|
};
|
|
16
19
|
}>;
|
|
17
20
|
declare const blockTypePlugin: BlockTypePlugin;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
3
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import type { BlockTypePlugin } from '../index';
|
|
4
5
|
import type { BlockType } from '../types';
|
|
5
6
|
export type BlockTypeState = {
|
|
6
7
|
currentBlockType: BlockType;
|
|
@@ -9,7 +10,7 @@ export type BlockTypeState = {
|
|
|
9
10
|
availableWrapperBlockTypes: BlockType[];
|
|
10
11
|
};
|
|
11
12
|
export declare const pluginKey: PluginKey<BlockTypeState>;
|
|
12
|
-
export declare const createPlugin: (
|
|
13
|
+
export declare const createPlugin: (editorAPI: ExtractInjectionAPI<BlockTypePlugin> | undefined, dispatch: (eventName: string | PluginKey, data: any) => void, lastNodeMustBeParagraph?: boolean) => SafePlugin<{
|
|
13
14
|
currentBlockType: BlockType;
|
|
14
15
|
blockTypesDisabled: boolean;
|
|
15
16
|
availableBlockTypes: BlockType[];
|
|
@@ -12,11 +12,4 @@ export interface BlockTypeButtonProps {
|
|
|
12
12
|
onKeyDown(e: React.KeyboardEvent): void;
|
|
13
13
|
formatMessage: WrappedComponentProps['intl']['formatMessage'];
|
|
14
14
|
}
|
|
15
|
-
export declare const messages: {
|
|
16
|
-
textStyles: {
|
|
17
|
-
id: string;
|
|
18
|
-
defaultMessage: string;
|
|
19
|
-
description: string;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
15
|
export declare const BlockTypeButton: React.StatelessComponent<BlockTypeButtonProps>;
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
4
4
|
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import type { TextBlockTypes } from '../../block-types';
|
|
6
7
|
import type { BlockTypeState } from '../../pm-plugins/main';
|
|
7
8
|
import type { BlockType } from '../../types';
|
|
8
9
|
export type DropdownItem = MenuItem & {
|
|
@@ -17,7 +18,7 @@ export interface Props {
|
|
|
17
18
|
popupsBoundariesElement?: HTMLElement;
|
|
18
19
|
popupsScrollableElement?: HTMLElement;
|
|
19
20
|
editorView?: EditorView;
|
|
20
|
-
|
|
21
|
+
setTextLevel: (type: TextBlockTypes) => void;
|
|
21
22
|
}
|
|
22
23
|
export interface State {
|
|
23
24
|
active: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-type",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "BlockType plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,12 +34,11 @@
|
|
|
34
34
|
"af:exports": {
|
|
35
35
|
".": "./src/index.ts",
|
|
36
36
|
"./consts": "./src/consts.ts",
|
|
37
|
-
"./messages": "./src/messages.ts",
|
|
38
37
|
"./styles": "./src/styles.ts"
|
|
39
38
|
},
|
|
40
39
|
"dependencies": {
|
|
41
40
|
"@atlaskit/adf-schema": "^32.0.0",
|
|
42
|
-
"@atlaskit/editor-common": "^76.
|
|
41
|
+
"@atlaskit/editor-common": "^76.15.0",
|
|
43
42
|
"@atlaskit/editor-plugin-analytics": "^0.2.0",
|
|
44
43
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
45
44
|
"@atlaskit/editor-shared-styles": "^2.8.0",
|
|
@@ -47,7 +46,7 @@
|
|
|
47
46
|
"@atlaskit/icon": "^21.12.0",
|
|
48
47
|
"@atlaskit/prosemirror-input-rules": "^2.4.0",
|
|
49
48
|
"@atlaskit/theme": "^12.6.0",
|
|
50
|
-
"@atlaskit/tokens": "^1.
|
|
49
|
+
"@atlaskit/tokens": "^1.28.0",
|
|
51
50
|
"@babel/runtime": "^7.0.0",
|
|
52
51
|
"@emotion/react": "^11.7.1"
|
|
53
52
|
},
|
package/report.api.md
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
import type { AllowedBlockTypes } from '@atlaskit/editor-common/types';
|
|
19
19
|
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
20
20
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
21
|
+
import type { EditorCommand } from '@atlaskit/editor-common/types';
|
|
21
22
|
import type { HeadingLevelsAndNormalText } from '@atlaskit/editor-common/types';
|
|
22
23
|
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
23
24
|
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
@@ -48,7 +49,12 @@ export type BlockTypePlugin = NextEditorPlugin<
|
|
|
48
49
|
sharedState: BlockTypeState | undefined;
|
|
49
50
|
actions: {
|
|
50
51
|
insertBlockQuote: (inputMethod: InputMethod) => Command;
|
|
51
|
-
|
|
52
|
+
};
|
|
53
|
+
commands: {
|
|
54
|
+
setTextLevel: (
|
|
55
|
+
level: TextBlockTypes,
|
|
56
|
+
inputMethod: InputMethod,
|
|
57
|
+
) => EditorCommand;
|
|
52
58
|
};
|
|
53
59
|
}
|
|
54
60
|
>;
|
|
@@ -89,6 +95,16 @@ export type InputMethod =
|
|
|
89
95
|
| INPUT_METHOD.SHORTCUT
|
|
90
96
|
| INPUT_METHOD.TOOLBAR;
|
|
91
97
|
|
|
98
|
+
// @public (undocumented)
|
|
99
|
+
export type TextBlockTypes =
|
|
100
|
+
| 'heading1'
|
|
101
|
+
| 'heading2'
|
|
102
|
+
| 'heading3'
|
|
103
|
+
| 'heading4'
|
|
104
|
+
| 'heading5'
|
|
105
|
+
| 'heading6'
|
|
106
|
+
| 'normal';
|
|
107
|
+
|
|
92
108
|
// (No @packageDocumentation comment for this package)
|
|
93
109
|
```
|
|
94
110
|
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import type { AllowedBlockTypes } from '@atlaskit/editor-common/types';
|
|
8
8
|
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
9
9
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
10
|
+
import type { EditorCommand } from '@atlaskit/editor-common/types';
|
|
10
11
|
import type { HeadingLevelsAndNormalText } from '@atlaskit/editor-common/types';
|
|
11
12
|
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
12
13
|
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
@@ -35,7 +36,9 @@ export type BlockTypePlugin = NextEditorPlugin<'blockType', {
|
|
|
35
36
|
sharedState: BlockTypeState | undefined;
|
|
36
37
|
actions: {
|
|
37
38
|
insertBlockQuote: (inputMethod: InputMethod) => Command;
|
|
38
|
-
|
|
39
|
+
};
|
|
40
|
+
commands: {
|
|
41
|
+
setTextLevel: (level: TextBlockTypes, inputMethod: InputMethod) => EditorCommand;
|
|
39
42
|
};
|
|
40
43
|
}>;
|
|
41
44
|
|
|
@@ -70,6 +73,9 @@ export type DropdownItem = MenuItem & {
|
|
|
70
73
|
// @public (undocumented)
|
|
71
74
|
export type InputMethod = INPUT_METHOD.FORMATTING | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.KEYBOARD | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TOOLBAR;
|
|
72
75
|
|
|
76
|
+
// @public (undocumented)
|
|
77
|
+
export type TextBlockTypes = 'heading1' | 'heading2' | 'heading3' | 'heading4' | 'heading5' | 'heading6' | 'normal';
|
|
78
|
+
|
|
73
79
|
// (No @packageDocumentation comment for this package)
|
|
74
80
|
|
|
75
81
|
```
|
package/dist/cjs/messages.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "messages", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _messages.messages;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "toolbarMessages", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _toolbarMessages.toolbarMessages;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _messages = require("./plugin/messages");
|
|
19
|
-
var _toolbarMessages = require("./plugin/ui/ToolbarBlockType/toolbar-messages");
|