@atlaskit/editor-core 187.41.8 → 187.42.3

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 (138) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/labs/next/presets/default.js +2 -2
  3. package/dist/cjs/plugins/code-block/index.js +1 -1
  4. package/dist/cjs/plugins/help-dialog/ui/index.js +1 -1
  5. package/dist/cjs/plugins/index.js +0 -7
  6. package/dist/cjs/plugins/insert-block/index.js +11 -11
  7. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +1 -1
  8. package/dist/cjs/plugins/panel/index.js +1 -1
  9. package/dist/cjs/ui/ContentStyles/index.js +1 -1
  10. package/dist/cjs/version-wrapper.js +1 -1
  11. package/dist/es2019/index.js +0 -6
  12. package/dist/es2019/labs/next/presets/default.js +1 -1
  13. package/dist/es2019/plugins/code-block/index.js +1 -1
  14. package/dist/es2019/plugins/help-dialog/ui/index.js +1 -1
  15. package/dist/es2019/plugins/index.js +0 -1
  16. package/dist/es2019/plugins/insert-block/index.js +1 -1
  17. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +1 -1
  18. package/dist/es2019/plugins/panel/index.js +1 -1
  19. package/dist/es2019/ui/ContentStyles/index.js +1 -1
  20. package/dist/es2019/version-wrapper.js +1 -1
  21. package/dist/esm/index.js +0 -6
  22. package/dist/esm/labs/next/presets/default.js +1 -1
  23. package/dist/esm/plugins/code-block/index.js +1 -1
  24. package/dist/esm/plugins/help-dialog/ui/index.js +1 -1
  25. package/dist/esm/plugins/index.js +0 -1
  26. package/dist/esm/plugins/insert-block/index.js +1 -1
  27. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +1 -1
  28. package/dist/esm/plugins/panel/index.js +1 -1
  29. package/dist/esm/ui/ContentStyles/index.js +1 -1
  30. package/dist/esm/version-wrapper.js +1 -1
  31. package/dist/types/index.d.ts +0 -7
  32. package/dist/types/labs/next/presets/default.d.ts +1 -1
  33. package/dist/types/plugins/index.d.ts +0 -1
  34. package/dist/types/plugins/insert-block/types.d.ts +2 -2
  35. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +1 -1
  36. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +1 -1
  37. package/dist/types/types/editor-props.d.ts +1 -1
  38. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  39. package/dist/types/ui/ColorPickerButton/index.d.ts +1 -1
  40. package/dist/types/ui/ContentStyles/index.d.ts +2 -2
  41. package/dist/types-ts4.5/index.d.ts +0 -7
  42. package/dist/types-ts4.5/labs/next/presets/default.d.ts +1 -1
  43. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  44. package/dist/types-ts4.5/plugins/insert-block/types.d.ts +2 -2
  45. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +1 -1
  46. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +1 -1
  47. package/dist/types-ts4.5/types/editor-props.d.ts +1 -1
  48. package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  49. package/dist/types-ts4.5/ui/ColorPickerButton/index.d.ts +1 -1
  50. package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
  51. package/package.json +9 -7
  52. package/report.api.md +1 -62
  53. package/tmp/api-report-tmp.d.ts +1 -51
  54. package/dist/cjs/plugins/block-type/commands/block-type.js +0 -202
  55. package/dist/cjs/plugins/block-type/commands/delete-and-move-cursor.js +0 -56
  56. package/dist/cjs/plugins/block-type/commands/delete-block-content.js +0 -45
  57. package/dist/cjs/plugins/block-type/commands/index.js +0 -68
  58. package/dist/cjs/plugins/block-type/consts.js +0 -15
  59. package/dist/cjs/plugins/block-type/index.js +0 -215
  60. package/dist/cjs/plugins/block-type/messages.js +0 -160
  61. package/dist/cjs/plugins/block-type/pm-plugins/input-rule.js +0 -104
  62. package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +0 -34
  63. package/dist/cjs/plugins/block-type/pm-plugins/main.js +0 -151
  64. package/dist/cjs/plugins/block-type/styles.js +0 -15
  65. package/dist/cjs/plugins/block-type/types.js +0 -115
  66. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +0 -54
  67. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +0 -193
  68. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +0 -34
  69. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/toolbar-messages.js +0 -15
  70. package/dist/cjs/plugins/block-type/utils.js +0 -87
  71. package/dist/es2019/plugins/block-type/commands/block-type.js +0 -191
  72. package/dist/es2019/plugins/block-type/commands/delete-and-move-cursor.js +0 -54
  73. package/dist/es2019/plugins/block-type/commands/delete-block-content.js +0 -42
  74. package/dist/es2019/plugins/block-type/commands/index.js +0 -3
  75. package/dist/es2019/plugins/block-type/consts.js +0 -8
  76. package/dist/es2019/plugins/block-type/index.js +0 -201
  77. package/dist/es2019/plugins/block-type/messages.js +0 -153
  78. package/dist/es2019/plugins/block-type/pm-plugins/input-rule.js +0 -93
  79. package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +0 -25
  80. package/dist/es2019/plugins/block-type/pm-plugins/main.js +0 -137
  81. package/dist/es2019/plugins/block-type/styles.js +0 -8
  82. package/dist/es2019/plugins/block-type/types.js +0 -93
  83. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +0 -44
  84. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +0 -170
  85. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +0 -49
  86. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/toolbar-messages.js +0 -8
  87. package/dist/es2019/plugins/block-type/utils.js +0 -76
  88. package/dist/esm/plugins/block-type/commands/block-type.js +0 -187
  89. package/dist/esm/plugins/block-type/commands/delete-and-move-cursor.js +0 -49
  90. package/dist/esm/plugins/block-type/commands/delete-block-content.js +0 -39
  91. package/dist/esm/plugins/block-type/commands/index.js +0 -3
  92. package/dist/esm/plugins/block-type/consts.js +0 -8
  93. package/dist/esm/plugins/block-type/index.js +0 -202
  94. package/dist/esm/plugins/block-type/messages.js +0 -153
  95. package/dist/esm/plugins/block-type/pm-plugins/input-rule.js +0 -96
  96. package/dist/esm/plugins/block-type/pm-plugins/keymap.js +0 -25
  97. package/dist/esm/plugins/block-type/pm-plugins/main.js +0 -142
  98. package/dist/esm/plugins/block-type/styles.js +0 -7
  99. package/dist/esm/plugins/block-type/types.js +0 -93
  100. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +0 -44
  101. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +0 -186
  102. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +0 -20
  103. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/toolbar-messages.js +0 -8
  104. package/dist/esm/plugins/block-type/utils.js +0 -77
  105. package/dist/types/plugins/block-type/commands/block-type.d.ts +0 -19
  106. package/dist/types/plugins/block-type/commands/delete-and-move-cursor.d.ts +0 -12
  107. package/dist/types/plugins/block-type/commands/delete-block-content.d.ts +0 -10
  108. package/dist/types/plugins/block-type/commands/index.d.ts +0 -4
  109. package/dist/types/plugins/block-type/consts.d.ts +0 -1
  110. package/dist/types/plugins/block-type/index.d.ts +0 -18
  111. package/dist/types/plugins/block-type/messages.d.ts +0 -152
  112. package/dist/types/plugins/block-type/pm-plugins/input-rule.d.ts +0 -6
  113. package/dist/types/plugins/block-type/pm-plugins/keymap.d.ts +0 -5
  114. package/dist/types/plugins/block-type/pm-plugins/main.d.ts +0 -17
  115. package/dist/types/plugins/block-type/styles.d.ts +0 -2
  116. package/dist/types/plugins/block-type/types.d.ts +0 -40
  117. package/dist/types/plugins/block-type/ui/ToolbarBlockType/blocktype-button.d.ts +0 -22
  118. package/dist/types/plugins/block-type/ui/ToolbarBlockType/index.d.ts +0 -29
  119. package/dist/types/plugins/block-type/ui/ToolbarBlockType/styled.d.ts +0 -8
  120. package/dist/types/plugins/block-type/ui/ToolbarBlockType/toolbar-messages.d.ts +0 -7
  121. package/dist/types/plugins/block-type/utils.d.ts +0 -16
  122. package/dist/types-ts4.5/plugins/block-type/commands/block-type.d.ts +0 -19
  123. package/dist/types-ts4.5/plugins/block-type/commands/delete-and-move-cursor.d.ts +0 -12
  124. package/dist/types-ts4.5/plugins/block-type/commands/delete-block-content.d.ts +0 -10
  125. package/dist/types-ts4.5/plugins/block-type/commands/index.d.ts +0 -4
  126. package/dist/types-ts4.5/plugins/block-type/consts.d.ts +0 -1
  127. package/dist/types-ts4.5/plugins/block-type/index.d.ts +0 -20
  128. package/dist/types-ts4.5/plugins/block-type/messages.d.ts +0 -152
  129. package/dist/types-ts4.5/plugins/block-type/pm-plugins/input-rule.d.ts +0 -6
  130. package/dist/types-ts4.5/plugins/block-type/pm-plugins/keymap.d.ts +0 -5
  131. package/dist/types-ts4.5/plugins/block-type/pm-plugins/main.d.ts +0 -17
  132. package/dist/types-ts4.5/plugins/block-type/styles.d.ts +0 -2
  133. package/dist/types-ts4.5/plugins/block-type/types.d.ts +0 -40
  134. package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/blocktype-button.d.ts +0 -22
  135. package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/index.d.ts +0 -29
  136. package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/styled.d.ts +0 -8
  137. package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/toolbar-messages.d.ts +0 -7
  138. package/dist/types-ts4.5/plugins/block-type/utils.d.ts +0 -16
@@ -1,7 +0,0 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject;
3
- import { css } from '@emotion/react';
4
- import { blockquoteSharedStyles, headingsSharedStyles } from '@atlaskit/editor-common/styles';
5
- export var blocktypeStyles = function blocktypeStyles(props) {
6
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror {\n ", ";\n ", ";\n }\n"])), blockquoteSharedStyles, headingsSharedStyles(props));
7
- };
@@ -1,93 +0,0 @@
1
- // The names of the blocks don't map precisely to schema nodes, because
2
- // of concepts like "paragraph" <-> "Normal text" and "Unknown".
3
- //
4
- // (there are also different blocks for different types of panel, when
5
- // they're really all just a panel node)
6
- //
7
- // Rather than half-match half-not, this plugin introduces its own
8
- // nomenclature for what 'block type' is active.
9
-
10
- import { messages } from './messages';
11
- export var NORMAL_TEXT = {
12
- name: 'normal',
13
- title: messages.normal,
14
- nodeName: 'paragraph',
15
- tagName: 'p'
16
- };
17
- export var HEADING_1 = {
18
- name: 'heading1',
19
- title: messages.heading1,
20
- nodeName: 'heading',
21
- tagName: 'h1',
22
- level: 1
23
- };
24
- export var HEADING_2 = {
25
- name: 'heading2',
26
- title: messages.heading2,
27
- nodeName: 'heading',
28
- tagName: 'h2',
29
- level: 2
30
- };
31
- export var HEADING_3 = {
32
- name: 'heading3',
33
- title: messages.heading3,
34
- nodeName: 'heading',
35
- tagName: 'h3',
36
- level: 3
37
- };
38
- export var HEADING_4 = {
39
- name: 'heading4',
40
- title: messages.heading4,
41
- nodeName: 'heading',
42
- tagName: 'h4',
43
- level: 4
44
- };
45
- export var HEADING_5 = {
46
- name: 'heading5',
47
- title: messages.heading5,
48
- nodeName: 'heading',
49
- tagName: 'h5',
50
- level: 5
51
- };
52
- export var HEADING_6 = {
53
- name: 'heading6',
54
- title: messages.heading6,
55
- nodeName: 'heading',
56
- tagName: 'h6',
57
- level: 6
58
- };
59
- export var BLOCK_QUOTE = {
60
- name: 'blockquote',
61
- title: messages.blockquote,
62
- nodeName: 'blockquote'
63
- };
64
- export var CODE_BLOCK = {
65
- name: 'codeblock',
66
- title: messages.codeblock,
67
- nodeName: 'codeBlock'
68
- };
69
- export var PANEL = {
70
- name: 'panel',
71
- title: messages.infoPanel,
72
- nodeName: 'panel'
73
- };
74
- export var OTHER = {
75
- name: 'other',
76
- title: messages.other,
77
- nodeName: ''
78
- };
79
- export var TEXT_BLOCK_TYPES = [NORMAL_TEXT, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6];
80
- export var WRAPPER_BLOCK_TYPES = [BLOCK_QUOTE, CODE_BLOCK, PANEL];
81
- export var ALL_BLOCK_TYPES = TEXT_BLOCK_TYPES.concat(WRAPPER_BLOCK_TYPES);
82
- export var HEADINGS_BY_LEVEL = TEXT_BLOCK_TYPES.reduce(function (acc, blockType) {
83
- if (blockType.level && blockType.nodeName === 'heading') {
84
- acc[blockType.level] = blockType;
85
- }
86
- return acc;
87
- }, {});
88
- export var HEADINGS_BY_NAME = TEXT_BLOCK_TYPES.reduce(function (acc, blockType) {
89
- if (blockType.level && blockType.nodeName === 'heading') {
90
- acc[blockType.name] = blockType;
91
- }
92
- return acc;
93
- }, {});
@@ -1,44 +0,0 @@
1
- /** @jsx jsx */
2
- import React from 'react';
3
- import { jsx } from '@emotion/react';
4
- import { FormattedMessage, defineMessages } from 'react-intl-next';
5
- import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
6
- import TextStyleIcon from '@atlaskit/icon/glyph/editor/text-style';
7
- import { wrapperStyle } from '@atlaskit/editor-common/styles';
8
- import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
9
- import { NORMAL_TEXT } from '../../types';
10
- import { buttonContentStyle, buttonContentReducedSpacingStyle, wrapperSmallStyle, expandIconWrapperStyle } 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
- export var BlockTypeButton = function BlockTypeButton(props) {
19
- var labelTextStyles = props.formatMessage(messages.textStyles);
20
- return jsx(ToolbarButton, {
21
- spacing: props.isReducedSpacing ? 'none' : 'default',
22
- selected: props.selected,
23
- className: "block-type-btn",
24
- disabled: props.disabled,
25
- onClick: props.onClick,
26
- onKeyDown: props.onKeyDown,
27
- title: labelTextStyles,
28
- "aria-label": labelTextStyles,
29
- "aria-haspopup": true,
30
- "aria-expanded": props['aria-expanded'],
31
- iconAfter: jsx("span", {
32
- css: [wrapperStyle, props.isSmall && wrapperSmallStyle],
33
- "data-testid": "toolbar-block-type-text-styles-icon"
34
- }, props.isSmall && jsx(TextStyleIcon, {
35
- label: labelTextStyles
36
- }), jsx("span", {
37
- css: expandIconWrapperStyle
38
- }, jsx(ExpandIcon, {
39
- label: ""
40
- })))
41
- }, !props.isSmall && jsx("span", {
42
- css: [buttonContentStyle, props.isReducedSpacing && buttonContentReducedSpacingStyle]
43
- }, jsx(FormattedMessage, props.title || NORMAL_TEXT.title)));
44
- };
@@ -1,186 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
- 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; }
9
- 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) { _defineProperty(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; }
10
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
- /** @jsx jsx */
13
- import React from 'react';
14
- import { jsx } from '@emotion/react';
15
- import { injectIntl } from 'react-intl-next';
16
- import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
17
- import { getAriaKeyshortcuts, tooltip, findKeymapByDescription } from '@atlaskit/editor-common/keymaps';
18
- import { separatorStyles, wrapperStyle } from '@atlaskit/editor-common/styles';
19
- import { DropdownMenuWithKeyboardNavigation as DropdownMenu } from '@atlaskit/editor-common/ui-menu';
20
- import { blockTypeMenuItemStyle, keyboardShortcut, keyboardShortcutSelect } from './styled';
21
- import { BlockTypeButton } from './blocktype-button';
22
- var ToolbarBlockType = /*#__PURE__*/function (_React$PureComponent) {
23
- _inherits(ToolbarBlockType, _React$PureComponent);
24
- var _super = _createSuper(ToolbarBlockType);
25
- function ToolbarBlockType() {
26
- var _this;
27
- _classCallCheck(this, ToolbarBlockType);
28
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
29
- args[_key] = arguments[_key];
30
- }
31
- _this = _super.call.apply(_super, [this].concat(args));
32
- _defineProperty(_assertThisInitialized(_this), "state", {
33
- active: false,
34
- isOpenedByKeyboard: false
35
- });
36
- _defineProperty(_assertThisInitialized(_this), "onOpenChange", function (attrs) {
37
- _this.setState(_objectSpread(_objectSpread({}, _this.state), {}, {
38
- active: attrs.isOpen,
39
- isOpenedByKeyboard: attrs.isOpenedByKeyboard
40
- }));
41
- });
42
- _defineProperty(_assertThisInitialized(_this), "handleTriggerClick", function () {
43
- _this.onOpenChange({
44
- isOpen: !_this.state.active,
45
- isOpenedByKeyboard: false
46
- });
47
- });
48
- _defineProperty(_assertThisInitialized(_this), "handleTriggerByKeyboard", function (event) {
49
- if (event.key === 'Enter' || event.key === ' ') {
50
- event.preventDefault();
51
- _this.onOpenChange({
52
- isOpen: !_this.state.active,
53
- isOpenedByKeyboard: true
54
- });
55
- }
56
- });
57
- _defineProperty(_assertThisInitialized(_this), "createItems", function () {
58
- var formatMessage = _this.props.intl.formatMessage;
59
- var _this$props$pluginSta = _this.props.pluginState,
60
- currentBlockType = _this$props$pluginSta.currentBlockType,
61
- availableBlockTypes = _this$props$pluginSta.availableBlockTypes;
62
- var items = availableBlockTypes.map(function (blockType, index) {
63
- var isActive = currentBlockType === blockType;
64
- var tagName = blockType.tagName || 'p';
65
- var Tag = tagName;
66
- var keyMap = findKeymapByDescription(blockType.title.defaultMessage);
67
- return {
68
- content: jsx("div", {
69
- css: blockTypeMenuItemStyle(tagName, isActive)
70
- }, jsx(Tag, null, formatMessage(blockType.title))),
71
- value: blockType,
72
- label: formatMessage(blockType.title),
73
- 'aria-label': tooltip(keyMap, formatMessage(blockType.title)),
74
- keyShortcuts: getAriaKeyshortcuts(keyMap),
75
- key: "".concat(blockType.name, "-").concat(index),
76
- elemAfter: jsx("div", {
77
- css: [keyboardShortcut, isActive && keyboardShortcutSelect]
78
- }, tooltip(keyMap)),
79
- isActive: isActive
80
- };
81
- });
82
- return [{
83
- items: items
84
- }];
85
- });
86
- _defineProperty(_assertThisInitialized(_this), "handleSelectBlockType", function (_ref) {
87
- var item = _ref.item,
88
- _ref$shouldCloseMenu = _ref.shouldCloseMenu,
89
- shouldCloseMenu = _ref$shouldCloseMenu === void 0 ? true : _ref$shouldCloseMenu;
90
- var blockType = item.value;
91
- _this.props.setBlockType(blockType.name);
92
- if (shouldCloseMenu) {
93
- _this.setState(_objectSpread(_objectSpread({}, _this.state), {}, {
94
- active: false
95
- }));
96
- }
97
- });
98
- return _this;
99
- }
100
- _createClass(ToolbarBlockType, [{
101
- key: "render",
102
- value: function render() {
103
- var _this2 = this;
104
- var _this$state = this.state,
105
- active = _this$state.active,
106
- isOpenedByKeyboard = _this$state.isOpenedByKeyboard;
107
- var _this$props = this.props,
108
- popupsMountPoint = _this$props.popupsMountPoint,
109
- popupsBoundariesElement = _this$props.popupsBoundariesElement,
110
- popupsScrollableElement = _this$props.popupsScrollableElement,
111
- isSmall = _this$props.isSmall,
112
- isReducedSpacing = _this$props.isReducedSpacing,
113
- _this$props$pluginSta2 = _this$props.pluginState,
114
- currentBlockType = _this$props$pluginSta2.currentBlockType,
115
- blockTypesDisabled = _this$props$pluginSta2.blockTypesDisabled,
116
- availableBlockTypes = _this$props$pluginSta2.availableBlockTypes,
117
- formatMessage = _this$props.intl.formatMessage;
118
- var isHeadingDisabled = !availableBlockTypes.some(function (blockType) {
119
- return blockType.nodeName === 'heading';
120
- });
121
- if (isHeadingDisabled) {
122
- return null;
123
- }
124
- var blockTypeTitles = availableBlockTypes.filter(function (blockType) {
125
- return blockType.name === currentBlockType.name;
126
- }).map(function (blockType) {
127
- return blockType.title;
128
- });
129
- if (!this.props.isDisabled && !blockTypesDisabled) {
130
- var items = this.createItems();
131
- return jsx("span", {
132
- css: wrapperStyle
133
- }, jsx(DropdownMenu, {
134
- items: items,
135
- onOpenChange: this.onOpenChange,
136
- onItemActivated: this.handleSelectBlockType,
137
- isOpen: active,
138
- mountTo: popupsMountPoint,
139
- boundariesElement: popupsBoundariesElement,
140
- scrollableElement: popupsScrollableElement,
141
- zIndex: akEditorMenuZIndex,
142
- fitHeight: 360,
143
- fitWidth: 106,
144
- shouldUseDefaultRole: true,
145
- shouldFocusFirstItem: function shouldFocusFirstItem() {
146
- if (isOpenedByKeyboard) {
147
- _this2.setState(_objectSpread(_objectSpread({}, _this2.state), {}, {
148
- isOpenedByKeyboard: false
149
- }));
150
- }
151
- return isOpenedByKeyboard;
152
- }
153
- }, jsx(BlockTypeButton, {
154
- isSmall: isSmall,
155
- isReducedSpacing: isReducedSpacing,
156
- selected: active,
157
- disabled: false,
158
- title: blockTypeTitles[0],
159
- onClick: this.handleTriggerClick,
160
- onKeyDown: this.handleTriggerByKeyboard,
161
- formatMessage: formatMessage,
162
- "aria-expanded": active
163
- })), jsx("span", {
164
- css: separatorStyles
165
- }));
166
- }
167
- return jsx("span", {
168
- css: wrapperStyle
169
- }, jsx(BlockTypeButton, {
170
- isSmall: isSmall,
171
- isReducedSpacing: isReducedSpacing,
172
- selected: active,
173
- disabled: true,
174
- title: blockTypeTitles[0],
175
- onClick: this.handleTriggerClick,
176
- onKeyDown: this.handleTriggerByKeyboard,
177
- formatMessage: formatMessage,
178
- "aria-expanded": active
179
- }), jsx("span", {
180
- css: separatorStyles
181
- }));
182
- }
183
- }]);
184
- return ToolbarBlockType;
185
- }(React.PureComponent);
186
- export default injectIntl(ToolbarBlockType);
@@ -1,20 +0,0 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
3
- /** @jsx jsx */
4
- import { css } from '@emotion/react';
5
- import { N400 } from '@atlaskit/theme/colors';
6
- import { headingsSharedStyles } from '@atlaskit/editor-common/styles';
7
- import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
8
- export var blockTypeMenuItemStyle = function blockTypeMenuItemStyle(tagName, selected) {
9
- // TEMP FIX: See https://product-fabric.atlassian.net/browse/ED-13878
10
- var selectedStyle = selected ? "".concat(tagName, " { color: ", "var(--ds-text, white)", " !important; }") : '';
11
- return function (themeProps) {
12
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", ";\n > {\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-top: 0;\n }\n }\n ", ";\n "])), headingsSharedStyles(themeProps), selectedStyle);
13
- };
14
- };
15
- export var keyboardShortcut = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n margin-left: ", ";\n"])), shortcutStyle, "var(--ds-space-200, 16px)");
16
- export var keyboardShortcutSelect = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n color: ", ";\n"])), "var(--ds-icon, ".concat(N400, ")"));
17
- export var buttonContentStyle = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\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)");
18
- export var buttonContentReducedSpacingStyle = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding: ", ";\n"])), "var(--ds-space-100, 8px)");
19
- export var wrapperSmallStyle = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n margin-left: ", ";\n min-width: 40px;\n"])), "var(--ds-space-050, 4px)");
20
- export var expandIconWrapperStyle = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n margin-left: -8px;\n"])));
@@ -1,8 +0,0 @@
1
- import { defineMessages } from 'react-intl-next';
2
- export var toolbarMessages = defineMessages({
3
- textStyles: {
4
- id: 'fabric.editor.textStyles',
5
- defaultMessage: 'Text styles',
6
- description: 'Menu provides access to various heading styles or normal text'
7
- }
8
- });
@@ -1,77 +0,0 @@
1
- import { createRule } from '@atlaskit/prosemirror-input-rules';
2
- import { createWrappingJoinRule } from '@atlaskit/editor-common/utils';
3
- import { WRAPPER_BLOCK_TYPES } from './types';
4
- export var isNodeAWrappingBlockNode = function isNodeAWrappingBlockNode(node) {
5
- if (!node) {
6
- return false;
7
- }
8
- return WRAPPER_BLOCK_TYPES.some(function (blockNode) {
9
- return blockNode.name === node.type.name;
10
- });
11
- };
12
- export var createJoinNodesRule = function createJoinNodesRule(match, nodeType) {
13
- return createWrappingJoinRule({
14
- nodeType: nodeType,
15
- match: match,
16
- getAttrs: {},
17
- joinPredicate: function joinPredicate(_, node) {
18
- return node.type === nodeType;
19
- }
20
- });
21
- };
22
- export var createWrappingTextBlockRule = function createWrappingTextBlockRule(_ref) {
23
- var match = _ref.match,
24
- nodeType = _ref.nodeType,
25
- getAttrs = _ref.getAttrs;
26
- var handler = function handler(state, match, start, end) {
27
- var fixedStart = Math.max(start, 1);
28
- var $start = state.doc.resolve(fixedStart);
29
- var attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;
30
- var nodeBefore = $start.node(-1);
31
- if (nodeBefore && !nodeBefore.canReplaceWith($start.index(-1), $start.indexAfter(-1), nodeType)) {
32
- return null;
33
- }
34
- return state.tr.delete(fixedStart, end).setBlockType(fixedStart, fixedStart, nodeType, attrs);
35
- };
36
- return createRule(match, handler);
37
- };
38
-
39
- /**
40
- * Function will create a list of wrapper blocks present in a selection.
41
- */
42
- function getSelectedWrapperNodes(state) {
43
- var nodes = [];
44
- if (state.selection) {
45
- var _state$selection = state.selection,
46
- $from = _state$selection.$from,
47
- $to = _state$selection.$to;
48
- var _state$schema$nodes = state.schema.nodes,
49
- blockquote = _state$schema$nodes.blockquote,
50
- panel = _state$schema$nodes.panel,
51
- orderedList = _state$schema$nodes.orderedList,
52
- bulletList = _state$schema$nodes.bulletList,
53
- listItem = _state$schema$nodes.listItem,
54
- codeBlock = _state$schema$nodes.codeBlock,
55
- decisionItem = _state$schema$nodes.decisionItem,
56
- decisionList = _state$schema$nodes.decisionList,
57
- taskItem = _state$schema$nodes.taskItem,
58
- taskList = _state$schema$nodes.taskList;
59
- state.doc.nodesBetween($from.pos, $to.pos, function (node) {
60
- if (node.isBlock && [blockquote, panel, orderedList, bulletList, listItem, codeBlock, decisionItem, decisionList, taskItem, taskList].indexOf(node.type) >= 0) {
61
- nodes.push(node.type);
62
- }
63
- });
64
- }
65
- return nodes;
66
- }
67
-
68
- /**
69
- * Function will check if changing block types: Paragraph, Heading is enabled.
70
- */
71
- export function areBlockTypesDisabled(state) {
72
- var nodesTypes = getSelectedWrapperNodes(state);
73
- var panel = state.schema.nodes.panel;
74
- return nodesTypes.filter(function (type) {
75
- return type !== panel;
76
- }).length > 0;
77
- }
@@ -1,19 +0,0 @@
1
- import type { HeadingLevelsAndNormalText, Command } from '@atlaskit/editor-common/types';
2
- import type { INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
- 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: string): Command;
5
- export declare function setBlockTypeWithAnalytics(name: string, inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined): Command;
6
- export declare function setNormalText(): Command;
7
- export declare function setNormalTextWithAnalytics(inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined): Command;
8
- export declare function setHeading(level: HeadingLevelsAndNormalText): Command;
9
- export declare const setHeadingWithAnalytics: (newHeadingLevel: HeadingLevelsAndNormalText, inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
10
- /**
11
- *
12
- * @param name - block type name
13
- * @param inputMethod - input method
14
- * @param editorAnalyticsApi - analytics api, undefined if not available either because it failed to load or wasn't added
15
- * otherwise Editor becomes very sad and crashes
16
- * @returns - command that inserts block type
17
- */
18
- export declare const insertBlockQuoteWithAnalytics: (inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
19
- export declare const cleanUpAtTheStartOfDocument: Command;
@@ -1,12 +0,0 @@
1
- import type { Command } from '@atlaskit/editor-core/src/types';
2
- /**
3
- * Fixes cursor position after delete for list/task in panel and table
4
- *
5
- * ED-13873 fixes a bug where after deleting a list the cursor would move
6
- * to the cell to the right. Uses setSelection to position the cursor as expected after deleting.
7
- *
8
- * @param state EditorState
9
- * @param dispatch CommandDispatch
10
- * @returns boolean
11
- */
12
- export declare const deleteAndMoveCursor: Command;
@@ -1,10 +0,0 @@
1
- import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
- import type { Command } from '@atlaskit/editor-common/types';
3
- /**
4
- * Prevent removing the block when deleting block content
5
- *
6
- * @param state EditorState
7
- * @param dispatch CommandDispatch
8
- * @returns boolean
9
- */
10
- export declare function deleteBlockContent(isNodeAWrappingBlockNode: (node?: PMNode | null) => boolean): Command;
@@ -1,4 +0,0 @@
1
- export { cleanUpAtTheStartOfDocument, insertBlockQuoteWithAnalytics, setBlockType, setBlockTypeWithAnalytics, setHeading, setHeadingWithAnalytics, setNormalText, setNormalTextWithAnalytics, } from './block-type';
2
- export type { InputMethod } from './block-type';
3
- export { deleteAndMoveCursor } from './delete-and-move-cursor';
4
- export { deleteBlockContent } from './delete-block-content';
@@ -1 +0,0 @@
1
- export declare const HEADING_KEYS: number[];
@@ -1,18 +0,0 @@
1
- import type { NextEditorPlugin, OptionalPlugin, Command } from '@atlaskit/editor-common/types';
2
- import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
- import type { BlockTypeState } from './pm-plugins/main';
4
- import type { BlockTypePluginOptions } from './types';
5
- import type { InputMethod } from './commands/block-type';
6
- export type BlockTypePlugin = NextEditorPlugin<'blockType', {
7
- pluginConfiguration: BlockTypePluginOptions | undefined;
8
- dependencies: [OptionalPlugin<typeof analyticsPlugin>];
9
- sharedState: BlockTypeState | undefined;
10
- actions: {
11
- insertBlockQuote: (inputMethod: InputMethod) => Command;
12
- setBlockType: (name: string, inputMethod: InputMethod) => Command;
13
- };
14
- }>;
15
- declare const blockTypePlugin: BlockTypePlugin;
16
- export default blockTypePlugin;
17
- export { pluginKey } from './pm-plugins/main';
18
- export type { BlockTypeState } from './pm-plugins/main';
@@ -1,152 +0,0 @@
1
- export declare const messages: {
2
- normal: {
3
- id: string;
4
- defaultMessage: string;
5
- description: string;
6
- };
7
- heading1: {
8
- id: string;
9
- defaultMessage: string;
10
- description: string;
11
- };
12
- heading1Description: {
13
- id: string;
14
- defaultMessage: string;
15
- description: string;
16
- };
17
- heading2: {
18
- id: string;
19
- defaultMessage: string;
20
- description: string;
21
- };
22
- heading2Description: {
23
- id: string;
24
- defaultMessage: string;
25
- description: string;
26
- };
27
- heading3: {
28
- id: string;
29
- defaultMessage: string;
30
- description: string;
31
- };
32
- heading3Description: {
33
- id: string;
34
- defaultMessage: string;
35
- description: string;
36
- };
37
- heading4: {
38
- id: string;
39
- defaultMessage: string;
40
- description: string;
41
- };
42
- heading4Description: {
43
- id: string;
44
- defaultMessage: string;
45
- description: string;
46
- };
47
- heading5: {
48
- id: string;
49
- defaultMessage: string;
50
- description: string;
51
- };
52
- heading5Description: {
53
- id: string;
54
- defaultMessage: string;
55
- description: string;
56
- };
57
- heading6: {
58
- id: string;
59
- defaultMessage: string;
60
- description: string;
61
- };
62
- heading6Description: {
63
- id: string;
64
- defaultMessage: string;
65
- description: string;
66
- };
67
- blockquote: {
68
- id: string;
69
- defaultMessage: string;
70
- description: string;
71
- };
72
- blockquoteDescription: {
73
- id: string;
74
- defaultMessage: string;
75
- description: string;
76
- };
77
- codeblock: {
78
- id: string;
79
- defaultMessage: string;
80
- description: string;
81
- };
82
- codeblockDescription: {
83
- id: string;
84
- defaultMessage: string;
85
- description: string;
86
- };
87
- infoPanel: {
88
- id: string;
89
- defaultMessage: string;
90
- description: string;
91
- };
92
- infoPanelDescription: {
93
- id: string;
94
- defaultMessage: string;
95
- description: string;
96
- };
97
- notePanel: {
98
- id: string;
99
- defaultMessage: string;
100
- description: string;
101
- };
102
- notePanelDescription: {
103
- id: string;
104
- defaultMessage: string;
105
- description: string;
106
- };
107
- successPanel: {
108
- id: string;
109
- defaultMessage: string;
110
- description: string;
111
- };
112
- successPanelDescription: {
113
- id: string;
114
- defaultMessage: string;
115
- description: string;
116
- };
117
- warningPanel: {
118
- id: string;
119
- defaultMessage: string;
120
- description: string;
121
- };
122
- warningPanelDescription: {
123
- id: string;
124
- defaultMessage: string;
125
- description: string;
126
- };
127
- errorPanel: {
128
- id: string;
129
- defaultMessage: string;
130
- description: string;
131
- };
132
- errorPanelDescription: {
133
- id: string;
134
- defaultMessage: string;
135
- description: string;
136
- };
137
- customPanel: {
138
- id: string;
139
- defaultMessage: string;
140
- description: string;
141
- };
142
- customPanelDescription: {
143
- id: string;
144
- defaultMessage: string;
145
- description: string;
146
- };
147
- other: {
148
- id: string;
149
- defaultMessage: string;
150
- description: string;
151
- };
152
- };
@@ -1,6 +0,0 @@
1
- import type { Schema } from '@atlaskit/editor-prosemirror/model';
2
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
4
- import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
- declare function inputRulePlugin(editorAnalyticsAPI: EditorAnalyticsAPI | undefined, schema: Schema, featureFlags: FeatureFlags): SafePlugin | undefined;
6
- export default inputRulePlugin;