@atlaskit/editor-plugin-block-type 1.0.3 → 2.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/i18n/cs.js +2 -3
  3. package/dist/cjs/i18n/da.js +2 -3
  4. package/dist/cjs/i18n/de.js +2 -3
  5. package/dist/cjs/i18n/en.js +2 -3
  6. package/dist/cjs/i18n/en_GB.js +2 -3
  7. package/dist/cjs/i18n/en_ZZ.js +2 -3
  8. package/dist/cjs/i18n/es.js +2 -3
  9. package/dist/cjs/i18n/fi.js +2 -3
  10. package/dist/cjs/i18n/fr.js +2 -3
  11. package/dist/cjs/i18n/hu.js +2 -3
  12. package/dist/cjs/i18n/it.js +2 -3
  13. package/dist/cjs/i18n/ja.js +2 -3
  14. package/dist/cjs/i18n/ko.js +2 -3
  15. package/dist/cjs/i18n/nb.js +2 -3
  16. package/dist/cjs/i18n/nl.js +2 -3
  17. package/dist/cjs/i18n/pl.js +2 -3
  18. package/dist/cjs/i18n/pt_BR.js +2 -3
  19. package/dist/cjs/i18n/ru.js +2 -3
  20. package/dist/cjs/i18n/sv.js +2 -3
  21. package/dist/cjs/i18n/th.js +2 -3
  22. package/dist/cjs/i18n/tr.js +2 -3
  23. package/dist/cjs/i18n/uk.js +2 -3
  24. package/dist/cjs/i18n/vi.js +2 -3
  25. package/dist/cjs/i18n/zh.js +2 -3
  26. package/dist/cjs/i18n/zh_TW.js +2 -3
  27. package/dist/cjs/plugin/block-types.js +29 -45
  28. package/dist/cjs/plugin/commands/block-type.js +4 -7
  29. package/dist/cjs/plugin/commands/delete-and-move-cursor.js +2 -3
  30. package/dist/cjs/plugin/consts.js +1 -2
  31. package/dist/cjs/plugin/index.js +16 -17
  32. package/dist/cjs/plugin/pm-plugins/input-rule.js +1 -2
  33. package/dist/cjs/plugin/pm-plugins/main.js +3 -5
  34. package/dist/cjs/plugin/styles.js +2 -3
  35. package/dist/cjs/plugin/ui/ToolbarBlockType/blocktype-button.js +5 -13
  36. package/dist/cjs/plugin/ui/ToolbarBlockType/index.js +1 -2
  37. package/dist/cjs/plugin/ui/ToolbarBlockType/styled.js +7 -14
  38. package/dist/cjs/plugin/utils.js +3 -6
  39. package/dist/es2019/plugin/block-types.js +1 -1
  40. package/dist/es2019/plugin/index.js +1 -1
  41. package/dist/es2019/plugin/ui/ToolbarBlockType/blocktype-button.js +3 -9
  42. package/dist/esm/plugin/block-types.js +1 -1
  43. package/dist/esm/plugin/index.js +10 -10
  44. package/dist/esm/plugin/ui/ToolbarBlockType/blocktype-button.js +3 -9
  45. package/dist/types/plugin/ui/ToolbarBlockType/blocktype-button.d.ts +0 -7
  46. package/dist/types-ts4.5/plugin/ui/ToolbarBlockType/blocktype-button.d.ts +0 -7
  47. package/package.json +2 -3
  48. package/dist/cjs/messages.js +0 -19
  49. package/dist/cjs/plugin/messages.js +0 -160
  50. package/dist/cjs/plugin/ui/ToolbarBlockType/toolbar-messages.js +0 -15
  51. package/dist/es2019/messages.js +0 -2
  52. package/dist/es2019/plugin/messages.js +0 -153
  53. package/dist/es2019/plugin/ui/ToolbarBlockType/toolbar-messages.js +0 -8
  54. package/dist/esm/messages.js +0 -2
  55. package/dist/esm/plugin/messages.js +0 -153
  56. package/dist/esm/plugin/ui/ToolbarBlockType/toolbar-messages.js +0 -8
  57. package/dist/types/messages.d.ts +0 -2
  58. package/dist/types/plugin/messages.d.ts +0 -152
  59. package/dist/types/plugin/ui/ToolbarBlockType/toolbar-messages.d.ts +0 -7
  60. package/dist/types-ts4.5/messages.d.ts +0 -2
  61. package/dist/types-ts4.5/plugin/messages.d.ts +0 -152
  62. package/dist/types-ts4.5/plugin/ui/ToolbarBlockType/toolbar-messages.d.ts +0 -7
  63. package/messages/package.json +0 -15
@@ -16,12 +16,12 @@ var _react = _interopRequireDefault(require("react"));
16
16
  var _adfSchema = require("@atlaskit/adf-schema");
17
17
  var _analytics = require("@atlaskit/editor-common/analytics");
18
18
  var _keymaps = require("@atlaskit/editor-common/keymaps");
19
+ var _messages = require("@atlaskit/editor-common/messages");
19
20
  var _quickInsert = require("@atlaskit/editor-common/quick-insert");
20
21
  var _types = require("@atlaskit/editor-common/types");
21
22
  var _withPluginState = require("@atlaskit/editor-common/with-plugin-state");
22
23
  var _commands = require("./commands");
23
24
  var _blockType = require("./commands/block-type");
24
- var _messages = require("./messages");
25
25
  var _inputRule = _interopRequireDefault(require("./pm-plugins/input-rule"));
26
26
  var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
27
27
  var _main = require("./pm-plugins/main");
@@ -36,14 +36,14 @@ var headingPluginOptions = function headingPluginOptions(_ref, isAllowed, editor
36
36
  }, function (_v, idx) {
37
37
  var level = idx + 1;
38
38
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
- var descriptionDescriptor = _messages.messages["heading".concat(level, "Description")];
39
+ var descriptionDescriptor = _messages.blockTypeMessages["heading".concat(level, "Description")];
40
40
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
41
  var keyshortcut = (0, _keymaps.tooltip)(_keymaps.keymap["toggleHeading".concat(level)]);
42
42
  var id = "heading".concat(level);
43
43
  return {
44
44
  id: id,
45
45
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
46
- title: formatMessage(_messages.messages[id]),
46
+ title: formatMessage(_messages.blockTypeMessages[id]),
47
47
  description: formatMessage(descriptionDescriptor),
48
48
  priority: 1300,
49
49
  keywords: ["h".concat(level)],
@@ -57,7 +57,7 @@ var headingPluginOptions = function headingPluginOptions(_ref, isAllowed, editor
57
57
  var tr = insert(state.schema.nodes.heading.createChecked({
58
58
  level: level
59
59
  }));
60
- editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
60
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
61
61
  action: _analytics.ACTION.FORMATTED,
62
62
  actionSubject: _analytics.ACTION_SUBJECT.TEXT,
63
63
  eventType: _analytics.EVENT_TYPE.TRACK,
@@ -79,8 +79,8 @@ var blockquotePluginOptions = function blockquotePluginOptions(_ref2, isAllowed,
79
79
  }
80
80
  return [{
81
81
  id: 'blockquote',
82
- title: formatMessage(_messages.messages.blockquote),
83
- description: formatMessage(_messages.messages.blockquoteDescription),
82
+ title: formatMessage(_messages.blockTypeMessages.blockquote),
83
+ description: formatMessage(_messages.blockTypeMessages.blockquoteDescription),
84
84
  priority: 1300,
85
85
  keyshortcut: (0, _keymaps.tooltip)(_keymaps.toggleBlockQuote),
86
86
  icon: function icon() {
@@ -88,7 +88,7 @@ var blockquotePluginOptions = function blockquotePluginOptions(_ref2, isAllowed,
88
88
  },
89
89
  action: function action(insert, state) {
90
90
  var tr = insert(state.schema.nodes.blockquote.createChecked({}, state.schema.nodes.paragraph.createChecked()));
91
- editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
91
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
92
92
  action: _analytics.ACTION.FORMATTED,
93
93
  actionSubject: _analytics.ACTION_SUBJECT.TEXT,
94
94
  eventType: _analytics.EVENT_TYPE.TRACK,
@@ -101,7 +101,7 @@ var blockquotePluginOptions = function blockquotePluginOptions(_ref2, isAllowed,
101
101
  }
102
102
  }];
103
103
  };
104
- var blockTypePlugin = function blockTypePlugin(_ref3) {
104
+ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3) {
105
105
  var options = _ref3.config,
106
106
  api = _ref3.api;
107
107
  return {
@@ -131,7 +131,7 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
131
131
  plugin: function plugin(_ref4) {
132
132
  var _api$analytics;
133
133
  var dispatch = _ref4.dispatch;
134
- return (0, _main.createPlugin)(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, dispatch, options && options.lastNodeMustBeParagraph);
134
+ return (0, _main.createPlugin)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, dispatch, options && options.lastNodeMustBeParagraph);
135
135
  }
136
136
  }, {
137
137
  name: 'blockTypeInputRule',
@@ -139,7 +139,7 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
139
139
  var _api$analytics2;
140
140
  var schema = _ref5.schema,
141
141
  featureFlags = _ref5.featureFlags;
142
- return (0, _inputRule.default)(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, schema, featureFlags);
142
+ return (0, _inputRule.default)(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, schema, featureFlags);
143
143
  }
144
144
  },
145
145
  // Needs to be lower priority than editor-tables.tableEditing
@@ -150,18 +150,18 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
150
150
  var _api$analytics3;
151
151
  var schema = _ref6.schema,
152
152
  featureFlags = _ref6.featureFlags;
153
- return (0, _keymap.default)(api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, schema, featureFlags);
153
+ return (0, _keymap.default)(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, schema, featureFlags);
154
154
  }
155
155
  }];
156
156
  },
157
157
  actions: {
158
158
  insertBlockQuote: function insertBlockQuote(inputMethod) {
159
159
  var _api$analytics4;
160
- return (0, _blockType.insertBlockQuoteWithAnalytics)(inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
160
+ return (0, _blockType.insertBlockQuoteWithAnalytics)(inputMethod, api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
161
161
  },
162
162
  setBlockType: function setBlockType(name, inputMethod) {
163
163
  var _api$analytics5;
164
- return (0, _commands.setBlockTypeWithAnalytics)(name, inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions);
164
+ return (0, _commands.setBlockTypeWithAnalytics)(name, inputMethod, api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions);
165
165
  }
166
166
  },
167
167
  getSharedState: function getSharedState(editorState) {
@@ -182,7 +182,7 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
182
182
  var isSmall = options && options.isUndoRedoButtonsEnabled ? toolbarSize < _types.ToolbarSize.XXL : toolbarSize < _types.ToolbarSize.XL;
183
183
  var boundSetBlockType = function boundSetBlockType(name) {
184
184
  var _api$analytics6;
185
- return (0, _commands.setBlockTypeWithAnalytics)(name, _analytics.INPUT_METHOD.TOOLBAR, api === null || api === void 0 ? void 0 : (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions)(editorView.state, editorView.dispatch);
185
+ return (0, _commands.setBlockTypeWithAnalytics)(name, _analytics.INPUT_METHOD.TOOLBAR, api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions)(editorView.state, editorView.dispatch);
186
186
  };
187
187
  return /*#__PURE__*/_react.default.createElement(_withPluginState.WithPluginState, {
188
188
  editorView: editorView,
@@ -209,9 +209,8 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
209
209
  quickInsert: function quickInsert(intl) {
210
210
  var _api$analytics7, _api$analytics8;
211
211
  var exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
212
- return [].concat((0, _toConsumableArray2.default)(blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 ? void 0 : (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions)), (0, _toConsumableArray2.default)(headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 ? void 0 : (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions)));
212
+ return [].concat((0, _toConsumableArray2.default)(blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 || (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions)), (0, _toConsumableArray2.default)(headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 || (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions)));
213
213
  }
214
214
  }
215
215
  };
216
- };
217
- exports.blockTypePlugin = blockTypePlugin;
216
+ };
@@ -100,5 +100,4 @@ function inputRulePlugin(editorAnalyticsAPI, schema, featureFlags) {
100
100
  }
101
101
  return;
102
102
  }
103
- var _default = inputRulePlugin;
104
- exports.default = _default;
103
+ var _default = exports.default = inputRulePlugin;
@@ -78,9 +78,8 @@ var autoformatHeading = function autoformatHeading(headingLevel, view, editorAna
78
78
  }
79
79
  return true;
80
80
  };
81
- var pluginKey = new _state.PluginKey('blockTypePlugin');
82
- exports.pluginKey = pluginKey;
83
- var createPlugin = function createPlugin(editorAnalyticsApi, dispatch, lastNodeMustBeParagraph) {
81
+ var pluginKey = exports.pluginKey = new _state.PluginKey('blockTypePlugin');
82
+ var createPlugin = exports.createPlugin = function createPlugin(editorAnalyticsApi, dispatch, lastNodeMustBeParagraph) {
84
83
  var altKeyLocation = 0;
85
84
  return new _safePlugin.SafePlugin({
86
85
  appendTransaction: function appendTransaction(_transactions, _oldState, newState) {
@@ -147,5 +146,4 @@ var createPlugin = function createPlugin(editorAnalyticsApi, dispatch, lastNodeM
147
146
  }
148
147
  }
149
148
  });
150
- };
151
- exports.createPlugin = createPlugin;
149
+ };
@@ -9,7 +9,6 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
9
9
  var _react = require("@emotion/react");
10
10
  var _styles = require("@atlaskit/editor-common/styles");
11
11
  var _templateObject;
12
- var blocktypeStyles = function blocktypeStyles(props) {
12
+ var blocktypeStyles = exports.blocktypeStyles = function blocktypeStyles(props) {
13
13
  return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", ";\n ", ";\n }\n"])), _styles.blockquoteSharedStyles, (0, _styles.headingsSharedStyles)(props));
14
- };
15
- exports.blocktypeStyles = blocktypeStyles;
14
+ };
@@ -4,10 +4,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.messages = exports.BlockTypeButton = void 0;
7
+ exports.BlockTypeButton = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _react2 = require("@emotion/react");
10
10
  var _reactIntlNext = require("react-intl-next");
11
+ var _messages = require("@atlaskit/editor-common/messages");
11
12
  var _styles = require("@atlaskit/editor-common/styles");
12
13
  var _uiMenu = require("@atlaskit/editor-common/ui-menu");
13
14
  var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-down"));
@@ -16,16 +17,8 @@ var _blockTypes = require("../../block-types");
16
17
  var _styled = require("./styled");
17
18
  /** @jsx jsx */
18
19
 
19
- var messages = (0, _reactIntlNext.defineMessages)({
20
- textStyles: {
21
- id: 'fabric.editor.textStyles',
22
- defaultMessage: 'Text styles',
23
- description: 'Menu provides access to various heading styles or normal text'
24
- }
25
- });
26
- exports.messages = messages;
27
- var BlockTypeButton = function BlockTypeButton(props) {
28
- var labelTextStyles = props.formatMessage(messages.textStyles);
20
+ var BlockTypeButton = exports.BlockTypeButton = function BlockTypeButton(props) {
21
+ var labelTextStyles = props.formatMessage(_messages.toolbarMessages.textStyles);
29
22
  return (0, _react2.jsx)(_uiMenu.ToolbarButton, {
30
23
  spacing: props.isReducedSpacing ? 'none' : 'default',
31
24
  selected: props.selected,
@@ -56,5 +49,4 @@ var BlockTypeButton = function BlockTypeButton(props) {
56
49
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
57
50
  props.isReducedSpacing && _styled.buttonContentReducedSpacingStyle]
58
51
  }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, props.title || _blockTypes.NORMAL_TEXT.title)));
59
- };
60
- exports.BlockTypeButton = BlockTypeButton;
52
+ };
@@ -204,5 +204,4 @@ var ToolbarBlockType = /*#__PURE__*/function (_React$PureComponent) {
204
204
  }]);
205
205
  return ToolbarBlockType;
206
206
  }(_react.default.PureComponent);
207
- var _default = (0, _reactIntlNext.injectIntl)(ToolbarBlockType);
208
- exports.default = _default;
207
+ var _default = exports.default = (0, _reactIntlNext.injectIntl)(ToolbarBlockType);
@@ -12,23 +12,16 @@ var _shortcut = require("@atlaskit/editor-shared-styles/shortcut");
12
12
  var _colors = require("@atlaskit/theme/colors");
13
13
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
14
14
  /** @jsx jsx */
15
- var blockTypeMenuItemStyle = function blockTypeMenuItemStyle(tagName, selected) {
15
+ var blockTypeMenuItemStyle = exports.blockTypeMenuItemStyle = function blockTypeMenuItemStyle(tagName, selected) {
16
16
  // TEMP FIX: See https://product-fabric.atlassian.net/browse/ED-13878
17
17
  var selectedStyle = selected ? "".concat(tagName, " { color: ", "var(--ds-text, white)", " !important; }") : '';
18
18
  return function (themeProps) {
19
19
  return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n > {\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-top: 0;\n }\n }\n ", ";\n "])), (0, _styles.headingsSharedStyles)(themeProps), selectedStyle);
20
20
  };
21
21
  };
22
- exports.blockTypeMenuItemStyle = blockTypeMenuItemStyle;
23
- var keyboardShortcut = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n margin-left: ", ";\n"])), _shortcut.shortcutStyle, "var(--ds-space-200, 16px)");
24
- exports.keyboardShortcut = keyboardShortcut;
25
- var keyboardShortcutSelect = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n"])), "var(--ds-icon, ".concat(_colors.N400, ")"));
26
- exports.keyboardShortcutSelect = keyboardShortcutSelect;
27
- var buttonContentStyle = (0, _react.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n min-width: 80px;\n align-items: center;\n overflow: hidden;\n justify-content: center;\n flex-direction: column;\n padding: ", ";\n"])), "var(--ds-space-075, 6px)");
28
- exports.buttonContentStyle = buttonContentStyle;
29
- var buttonContentReducedSpacingStyle = (0, _react.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n padding: ", ";\n"])), "var(--ds-space-100, 8px)");
30
- exports.buttonContentReducedSpacingStyle = buttonContentReducedSpacingStyle;
31
- var wrapperSmallStyle = (0, _react.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n margin-left: ", ";\n min-width: 40px;\n"])), "var(--ds-space-050, 4px)");
32
- exports.wrapperSmallStyle = wrapperSmallStyle;
33
- var expandIconWrapperStyle = (0, _react.css)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n margin-left: -8px;\n"])));
34
- exports.expandIconWrapperStyle = expandIconWrapperStyle;
22
+ var keyboardShortcut = exports.keyboardShortcut = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n margin-left: ", ";\n"])), _shortcut.shortcutStyle, "var(--ds-space-200, 16px)");
23
+ var keyboardShortcutSelect = exports.keyboardShortcutSelect = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n"])), "var(--ds-icon, ".concat(_colors.N400, ")"));
24
+ var buttonContentStyle = exports.buttonContentStyle = (0, _react.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n min-width: 80px;\n align-items: center;\n overflow: hidden;\n justify-content: center;\n flex-direction: column;\n padding: ", ";\n"])), "var(--ds-space-075, 6px)");
25
+ var buttonContentReducedSpacingStyle = exports.buttonContentReducedSpacingStyle = (0, _react.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n padding: ", ";\n"])), "var(--ds-space-100, 8px)");
26
+ var wrapperSmallStyle = exports.wrapperSmallStyle = (0, _react.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n margin-left: ", ";\n min-width: 40px;\n"])), "var(--ds-space-050, 4px)");
27
+ var expandIconWrapperStyle = exports.expandIconWrapperStyle = (0, _react.css)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n margin-left: -8px;\n"])));
@@ -8,7 +8,7 @@ exports.isNodeAWrappingBlockNode = exports.createWrappingTextBlockRule = exports
8
8
  var _utils = require("@atlaskit/editor-common/utils");
9
9
  var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
10
10
  var _blockTypes = require("./block-types");
11
- var isNodeAWrappingBlockNode = function isNodeAWrappingBlockNode(node) {
11
+ var isNodeAWrappingBlockNode = exports.isNodeAWrappingBlockNode = function isNodeAWrappingBlockNode(node) {
12
12
  if (!node) {
13
13
  return false;
14
14
  }
@@ -16,8 +16,7 @@ var isNodeAWrappingBlockNode = function isNodeAWrappingBlockNode(node) {
16
16
  return blockNode.name === node.type.name;
17
17
  });
18
18
  };
19
- exports.isNodeAWrappingBlockNode = isNodeAWrappingBlockNode;
20
- var createJoinNodesRule = function createJoinNodesRule(match, nodeType) {
19
+ var createJoinNodesRule = exports.createJoinNodesRule = function createJoinNodesRule(match, nodeType) {
21
20
  return (0, _utils.createWrappingJoinRule)({
22
21
  nodeType: nodeType,
23
22
  match: match,
@@ -27,8 +26,7 @@ var createJoinNodesRule = function createJoinNodesRule(match, nodeType) {
27
26
  }
28
27
  });
29
28
  };
30
- exports.createJoinNodesRule = createJoinNodesRule;
31
- var createWrappingTextBlockRule = function createWrappingTextBlockRule(_ref) {
29
+ var createWrappingTextBlockRule = exports.createWrappingTextBlockRule = function createWrappingTextBlockRule(_ref) {
32
30
  var match = _ref.match,
33
31
  nodeType = _ref.nodeType,
34
32
  getAttrs = _ref.getAttrs;
@@ -48,7 +46,6 @@ var createWrappingTextBlockRule = function createWrappingTextBlockRule(_ref) {
48
46
  /**
49
47
  * Function will create a list of wrapper blocks present in a selection.
50
48
  */
51
- exports.createWrappingTextBlockRule = createWrappingTextBlockRule;
52
49
  function getSelectedWrapperNodes(state) {
53
50
  var nodes = [];
54
51
  if (state.selection) {
@@ -1,4 +1,4 @@
1
- import { messages } from './messages';
1
+ import { blockTypeMessages as messages } from '@atlaskit/editor-common/messages';
2
2
  export const NORMAL_TEXT = {
3
3
  name: 'normal',
4
4
  title: messages.normal,
@@ -2,12 +2,12 @@ import React from 'react';
2
2
  import { blockquote, hardBreak, heading } from '@atlaskit/adf-schema';
3
3
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { keymap, toggleBlockQuote, tooltip } from '@atlaskit/editor-common/keymaps';
5
+ import { blockTypeMessages as messages } from '@atlaskit/editor-common/messages';
5
6
  import { IconHeading, IconQuote } from '@atlaskit/editor-common/quick-insert';
6
7
  import { ToolbarSize } from '@atlaskit/editor-common/types';
7
8
  import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
8
9
  import { setBlockTypeWithAnalytics } from './commands';
9
10
  import { insertBlockQuoteWithAnalytics } from './commands/block-type';
10
- import { messages } from './messages';
11
11
  import inputRulePlugin from './pm-plugins/input-rule';
12
12
  import keymapPlugin from './pm-plugins/keymap';
13
13
  import { createPlugin, pluginKey } from './pm-plugins/main';
@@ -1,22 +1,16 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
- import { defineMessages, FormattedMessage } from 'react-intl-next';
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 const 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 const BlockTypeButton = props => {
19
- const labelTextStyles = props.formatMessage(messages.textStyles);
13
+ const labelTextStyles = props.formatMessage(toolbarMessages.textStyles);
20
14
  return jsx(ToolbarButton, {
21
15
  spacing: props.isReducedSpacing ? 'none' : 'default',
22
16
  selected: props.selected,
@@ -1,4 +1,4 @@
1
- import { messages } from './messages';
1
+ import { blockTypeMessages as messages } from '@atlaskit/editor-common/messages';
2
2
  export var NORMAL_TEXT = {
3
3
  name: 'normal',
4
4
  title: messages.normal,
@@ -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 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
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 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
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,
@@ -118,7 +118,7 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
118
118
  plugin: function plugin(_ref4) {
119
119
  var _api$analytics;
120
120
  var dispatch = _ref4.dispatch;
121
- return createPlugin(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, dispatch, options && options.lastNodeMustBeParagraph);
121
+ return createPlugin(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, dispatch, options && options.lastNodeMustBeParagraph);
122
122
  }
123
123
  }, {
124
124
  name: 'blockTypeInputRule',
@@ -126,7 +126,7 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
126
126
  var _api$analytics2;
127
127
  var schema = _ref5.schema,
128
128
  featureFlags = _ref5.featureFlags;
129
- return inputRulePlugin(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, schema, featureFlags);
129
+ return inputRulePlugin(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, schema, featureFlags);
130
130
  }
131
131
  },
132
132
  // Needs to be lower priority than editor-tables.tableEditing
@@ -137,18 +137,18 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
137
137
  var _api$analytics3;
138
138
  var schema = _ref6.schema,
139
139
  featureFlags = _ref6.featureFlags;
140
- return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, schema, featureFlags);
140
+ return keymapPlugin(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, schema, featureFlags);
141
141
  }
142
142
  }];
143
143
  },
144
144
  actions: {
145
145
  insertBlockQuote: function insertBlockQuote(inputMethod) {
146
146
  var _api$analytics4;
147
- return insertBlockQuoteWithAnalytics(inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
147
+ return insertBlockQuoteWithAnalytics(inputMethod, api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
148
148
  },
149
149
  setBlockType: function setBlockType(name, inputMethod) {
150
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);
151
+ return setBlockTypeWithAnalytics(name, inputMethod, api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions);
152
152
  }
153
153
  },
154
154
  getSharedState: function getSharedState(editorState) {
@@ -169,7 +169,7 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
169
169
  var isSmall = options && options.isUndoRedoButtonsEnabled ? toolbarSize < ToolbarSize.XXL : toolbarSize < ToolbarSize.XL;
170
170
  var boundSetBlockType = function boundSetBlockType(name) {
171
171
  var _api$analytics6;
172
- return setBlockTypeWithAnalytics(name, INPUT_METHOD.TOOLBAR, api === null || api === void 0 ? void 0 : (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions)(editorView.state, editorView.dispatch);
172
+ return setBlockTypeWithAnalytics(name, INPUT_METHOD.TOOLBAR, api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions)(editorView.state, editorView.dispatch);
173
173
  };
174
174
  return /*#__PURE__*/React.createElement(WithPluginState, {
175
175
  editorView: editorView,
@@ -196,7 +196,7 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
196
196
  quickInsert: function quickInsert(intl) {
197
197
  var _api$analytics7, _api$analytics8;
198
198
  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 ? void 0 : (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions)), _toConsumableArray(headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 ? void 0 : (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions)));
199
+ return [].concat(_toConsumableArray(blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 || (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions)), _toConsumableArray(headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 || (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions)));
200
200
  }
201
201
  }
202
202
  };
@@ -1,22 +1,16 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
- import { defineMessages, FormattedMessage } from 'react-intl-next';
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(messages.textStyles);
13
+ var labelTextStyles = props.formatMessage(toolbarMessages.textStyles);
20
14
  return jsx(ToolbarButton, {
21
15
  spacing: props.isReducedSpacing ? 'none' : 'default',
22
16
  selected: props.selected,
@@ -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>;
@@ -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>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-type",
3
- "version": "1.0.3",
3
+ "version": "2.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.1.0",
41
+ "@atlaskit/editor-common": "^76.2.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",
@@ -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");