@atlaskit/editor-plugin-text-formatting 1.16.4 → 1.16.6

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 (60) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/editor-commands/clear-formatting.js +5 -0
  3. package/dist/cjs/editor-commands/transform-to-code.js +13 -1
  4. package/dist/cjs/editor-commands/utils/cell-selection.js +4 -1
  5. package/dist/cjs/pm-plugins/clear-formatting-keymap.js +4 -1
  6. package/dist/cjs/pm-plugins/clear-formatting.js +2 -0
  7. package/dist/cjs/pm-plugins/cursor.js +6 -1
  8. package/dist/cjs/pm-plugins/input-rule.js +28 -18
  9. package/dist/cjs/pm-plugins/keymap.js +28 -7
  10. package/dist/cjs/pm-plugins/main.js +7 -6
  11. package/dist/cjs/pm-plugins/smart-input-rule.js +30 -0
  12. package/dist/cjs/textFormattingPlugin.js +2 -1
  13. package/dist/cjs/ui/FloatingToolbarComponent.js +8 -4
  14. package/dist/cjs/ui/Toolbar/constants.js +4 -5
  15. package/dist/cjs/ui/Toolbar/dropdown-menu.js +4 -6
  16. package/dist/cjs/ui/Toolbar/hooks/formatting-icons.js +5 -4
  17. package/dist/cjs/ui/Toolbar/index.js +8 -2
  18. package/dist/cjs/ui/Toolbar/input-method-utils.js +1 -2
  19. package/dist/cjs/ui/Toolbar/more-button.js +2 -3
  20. package/dist/es2019/editor-commands/clear-formatting.js +7 -2
  21. package/dist/es2019/editor-commands/transform-to-code.js +13 -1
  22. package/dist/es2019/editor-commands/utils/cell-selection.js +4 -1
  23. package/dist/es2019/editor-commands/utils.js +1 -1
  24. package/dist/es2019/index.js +3 -0
  25. package/dist/es2019/pm-plugins/clear-formatting-keymap.js +4 -1
  26. package/dist/es2019/pm-plugins/clear-formatting.js +2 -0
  27. package/dist/es2019/pm-plugins/cursor.js +6 -1
  28. package/dist/es2019/pm-plugins/input-rule.js +13 -1
  29. package/dist/es2019/pm-plugins/keymap.js +29 -8
  30. package/dist/es2019/pm-plugins/main.js +6 -1
  31. package/dist/es2019/pm-plugins/smart-input-rule.js +31 -1
  32. package/dist/es2019/textFormattingPlugin.js +2 -1
  33. package/dist/es2019/ui/FloatingToolbarComponent.js +8 -2
  34. package/dist/es2019/ui/Toolbar/dropdown-menu.js +5 -5
  35. package/dist/es2019/ui/Toolbar/index.js +8 -2
  36. package/dist/es2019/ui/Toolbar/more-button.js +2 -3
  37. package/dist/esm/editor-commands/clear-formatting.js +5 -0
  38. package/dist/esm/editor-commands/transform-to-code.js +13 -1
  39. package/dist/esm/editor-commands/utils/cell-selection.js +4 -1
  40. package/dist/esm/index.js +3 -0
  41. package/dist/esm/pm-plugins/clear-formatting-keymap.js +4 -1
  42. package/dist/esm/pm-plugins/clear-formatting.js +2 -0
  43. package/dist/esm/pm-plugins/cursor.js +6 -1
  44. package/dist/esm/pm-plugins/input-rule.js +28 -18
  45. package/dist/esm/pm-plugins/keymap.js +28 -7
  46. package/dist/esm/pm-plugins/main.js +6 -1
  47. package/dist/esm/pm-plugins/smart-input-rule.js +30 -0
  48. package/dist/esm/textFormattingPlugin.js +2 -1
  49. package/dist/esm/ui/FloatingToolbarComponent.js +8 -3
  50. package/dist/esm/ui/Toolbar/constants.js +4 -5
  51. package/dist/esm/ui/Toolbar/dropdown-menu.js +5 -7
  52. package/dist/esm/ui/Toolbar/hooks/formatting-icons.js +1 -2
  53. package/dist/esm/ui/Toolbar/index.js +8 -2
  54. package/dist/esm/ui/Toolbar/input-method-utils.js +1 -2
  55. package/dist/esm/ui/Toolbar/more-button.js +2 -3
  56. package/dist/types/pm-plugins/main.d.ts +0 -2
  57. package/dist/types/ui/Toolbar/dropdown-menu.d.ts +3 -1
  58. package/dist/types-ts4.5/pm-plugins/main.d.ts +0 -2
  59. package/dist/types-ts4.5/ui/Toolbar/dropdown-menu.d.ts +3 -1
  60. package/package.json +5 -5
@@ -1,15 +1,15 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/createClass";
4
- import _get from "@babel/runtime/helpers/get";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
+ import _get from "@babel/runtime/helpers/get";
7
+ import _inherits from "@babel/runtime/helpers/inherits";
8
8
  import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
9
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
- var _ValidCombinations;
11
- function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
10
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
12
11
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
12
+ function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
13
13
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
14
14
  import { transformNonTextNodesToText } from '@atlaskit/editor-common/mark';
15
15
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
@@ -24,7 +24,7 @@ var ValidAutoformatChars = /*#__PURE__*/function (ValidAutoformatChars) {
24
24
  ValidAutoformatChars["CODE"] = "`";
25
25
  return ValidAutoformatChars;
26
26
  }(ValidAutoformatChars || {});
27
- export var ValidCombinations = (_ValidCombinations = {}, _defineProperty(_ValidCombinations, ValidAutoformatChars.STRIKE, [
27
+ export var ValidCombinations = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ValidAutoformatChars.STRIKE, [
28
28
  // e.g: _~~lol~~_
29
29
  ValidAutoformatChars.ITALIC,
30
30
  // e.g: __~~lol~~__
@@ -32,26 +32,28 @@ ValidAutoformatChars.STRONG,
32
32
  // e.g: **~~lol~~**
33
33
  ValidAutoformatChars.STRONG_MARKDOWN,
34
34
  // e.g: *~~lol~~*
35
- ValidAutoformatChars.ITALIC_MARKDOWN]), _defineProperty(_ValidCombinations, ValidAutoformatChars.STRONG, [
35
+ ValidAutoformatChars.ITALIC_MARKDOWN]), ValidAutoformatChars.STRONG, [
36
36
  // e.g: ~~__lol__~~
37
37
  ValidAutoformatChars.STRIKE,
38
38
  // e.g: *__lol__*
39
- ValidAutoformatChars.ITALIC_MARKDOWN]), _defineProperty(_ValidCombinations, ValidAutoformatChars.STRONG_MARKDOWN, [
39
+ ValidAutoformatChars.ITALIC_MARKDOWN]), ValidAutoformatChars.STRONG_MARKDOWN, [
40
40
  // e.g: _**lol**_
41
41
  ValidAutoformatChars.ITALIC,
42
42
  // e.g: ~~**lol**~~
43
- ValidAutoformatChars.STRIKE]), _defineProperty(_ValidCombinations, ValidAutoformatChars.ITALIC_MARKDOWN, [
43
+ ValidAutoformatChars.STRIKE]), ValidAutoformatChars.ITALIC_MARKDOWN, [
44
44
  // e.g: ~~*lol*~~
45
45
  ValidAutoformatChars.STRIKE,
46
46
  // e.g: __*lol*__
47
- ValidAutoformatChars.STRONG]), _defineProperty(_ValidCombinations, ValidAutoformatChars.ITALIC, [
47
+ ValidAutoformatChars.STRONG]), ValidAutoformatChars.ITALIC, [
48
48
  // e.g: ~~_lol_~~
49
49
  ValidAutoformatChars.STRIKE,
50
50
  // e.g: **_lol_**
51
- ValidAutoformatChars.STRONG_MARKDOWN]), _defineProperty(_ValidCombinations, ValidAutoformatChars.CODE, [
51
+ ValidAutoformatChars.STRONG_MARKDOWN]), ValidAutoformatChars.CODE, [
52
52
  // e.g: loko (`some code`
53
- '( ']), _ValidCombinations);
53
+ '( ']);
54
54
  function addMark(markType, schema, char) {
55
+ // Ignored via go/ees005
56
+ // eslint-disable-next-line @typescript-eslint/max-params
55
57
  return function (state, match, start, end) {
56
58
  var _schema$marks;
57
59
  var doc = state.doc,
@@ -102,20 +104,19 @@ function addMark(markType, schema, char) {
102
104
  };
103
105
  }
104
106
  var ReverseRegexExp = /*#__PURE__*/function (_RegExp) {
105
- _inherits(ReverseRegexExp, _RegExp);
106
- var _super = _createSuper(ReverseRegexExp);
107
107
  function ReverseRegexExp() {
108
108
  _classCallCheck(this, ReverseRegexExp);
109
- return _super.apply(this, arguments);
109
+ return _callSuper(this, ReverseRegexExp, arguments);
110
110
  }
111
- _createClass(ReverseRegexExp, [{
111
+ _inherits(ReverseRegexExp, _RegExp);
112
+ return _createClass(ReverseRegexExp, [{
112
113
  key: "exec",
113
114
  value: function exec(str) {
114
115
  if (!str) {
115
116
  return null;
116
117
  }
117
118
  var reverseStr = _toConsumableArray(str).reverse().join('');
118
- var result = _get(_getPrototypeOf(ReverseRegexExp.prototype), "exec", this).call(this, reverseStr);
119
+ var result = _superPropGet(ReverseRegexExp, "exec", this, 3)([reverseStr]);
119
120
  if (!result) {
120
121
  return null;
121
122
  }
@@ -133,10 +134,13 @@ var ReverseRegexExp = /*#__PURE__*/function (_RegExp) {
133
134
  return result;
134
135
  }
135
136
  }]);
136
- return ReverseRegexExp;
137
137
  }( /*#__PURE__*/_wrapNativeSuper(RegExp));
138
138
  var buildRegex = function buildRegex(char) {
139
+ // Ignored via go/ees005
140
+ // eslint-disable-next-line require-unicode-regexp
139
141
  var escapedChar = char.replace(/(\W)/g, '\\$1');
142
+ // Ignored via go/ees005
143
+ // eslint-disable-next-line require-unicode-regexp
140
144
  var combinations = ValidCombinations[char].map(function (c) {
141
145
  return c.replace(/(\W)/g, '\\$1');
142
146
  }).join('|');
@@ -144,7 +148,13 @@ var buildRegex = function buildRegex(char) {
144
148
  // Single X - https://regex101.com/r/McT3yq/14/
145
149
  // Double X - https://regex101.com/r/pQUgjx/1/
146
150
  var baseRegex = '^X(?=[^X\\s]).*?[^\\sX]X(?=[\\sOBJECT_REPLACEMENT_CHARACTER]COMBINATIONS|$)'.replace('OBJECT_REPLACEMENT_CHARACTER', leafNodeReplacementCharacter).replace('COMBINATIONS', combinations ? "|".concat(combinations) : '');
147
- var replacedRegex = String.prototype.hasOwnProperty('replaceAll') ? baseRegex.replaceAll('X', escapedChar) : baseRegex.replace(/X/g, escapedChar);
151
+ var replacedRegex = String.prototype.hasOwnProperty('replaceAll') ?
152
+ // Ignored via go/ees005
153
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
154
+ baseRegex.replaceAll('X', escapedChar) :
155
+ // Ignored via go/ees005
156
+ // eslint-disable-next-line require-unicode-regexp
157
+ baseRegex.replace(/X/g, escapedChar);
148
158
  return new ReverseRegexExp(replacedRegex);
149
159
  };
150
160
  export var strongRegex1 = buildRegex(ValidAutoformatChars.STRONG);
@@ -6,25 +6,46 @@ import { toggleCodeWithAnalytics, toggleEmWithAnalytics, toggleStrikeWithAnalyti
6
6
  export default function keymapPlugin(schema, editorAnalyticsAPI) {
7
7
  var list = {};
8
8
  if (schema.marks.strong) {
9
- bindKeymapWithEditorCommand(toggleBold.common, toggleStrongWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
9
+ bindKeymapWithEditorCommand(
10
+ // Ignored via go/ees005
11
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
12
+ toggleBold.common, toggleStrongWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
10
13
  }
11
14
  if (schema.marks.em) {
12
- bindKeymapWithEditorCommand(toggleItalic.common, toggleEmWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
15
+ bindKeymapWithEditorCommand(
16
+ // Ignored via go/ees005
17
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
18
+ toggleItalic.common, toggleEmWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
13
19
  }
14
20
  if (schema.marks.code) {
15
- bindKeymapWithEditorCommand(toggleCode.common, toggleCodeWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
21
+ bindKeymapWithEditorCommand(
22
+ // Ignored via go/ees005
23
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
24
+ toggleCode.common, toggleCodeWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
16
25
  }
17
26
  if (schema.marks.strike) {
18
- bindKeymapWithEditorCommand(toggleStrikethrough.common, toggleStrikeWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
27
+ bindKeymapWithEditorCommand(
28
+ // Ignored via go/ees005
29
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
30
+ toggleStrikethrough.common, toggleStrikeWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
19
31
  }
20
32
  if (schema.marks.subsup) {
21
- bindKeymapWithEditorCommand(toggleSubscript.common, toggleSubscriptWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
33
+ bindKeymapWithEditorCommand(
34
+ // Ignored via go/ees005
35
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
36
+ toggleSubscript.common, toggleSubscriptWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
22
37
  }
23
38
  if (schema.marks.subsup) {
24
- bindKeymapWithEditorCommand(toggleSuperscript.common, toggleSuperscriptWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
39
+ bindKeymapWithEditorCommand(
40
+ // Ignored via go/ees005
41
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
42
+ toggleSuperscript.common, toggleSuperscriptWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
25
43
  }
26
44
  if (schema.marks.underline) {
27
- bindKeymapWithEditorCommand(toggleUnderline.common, toggleUnderlineWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
45
+ bindKeymapWithEditorCommand(
46
+ // Ignored via go/ees005
47
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
48
+ toggleUnderline.common, toggleUnderlineWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
28
49
  }
29
50
  return new SafePlugin({
30
51
  props: {
@@ -8,9 +8,10 @@ import { shallowEqual } from '@atlaskit/editor-common/utils';
8
8
  import { toggleMark } from '@atlaskit/editor-prosemirror/commands';
9
9
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
10
10
  import { createInlineCodeFromTextInputWithAnalytics } from '../editor-commands/text-formatting';
11
+ // Ignored via go/ees005
12
+ // eslint-disable-next-line import/no-namespace
11
13
  import * as commands from '../editor-commands/text-formatting';
12
14
  import { pluginKey } from './plugin-key';
13
- export { pluginKey };
14
15
  var isSelectionInlineCursor = function isSelectionInlineCursor(selection) {
15
16
  if (selection instanceof NodeSelection) {
16
17
  return true;
@@ -78,6 +79,8 @@ export var plugin = function plugin(dispatch, editorAnalyticsAPI) {
78
79
  init: function init(_config, state) {
79
80
  return getTextFormattingState(state, editorAnalyticsAPI);
80
81
  },
82
+ // Ignored via go/ees005
83
+ // eslint-disable-next-line @typescript-eslint/max-params
81
84
  apply: function apply(_tr, pluginState, _oldState, newState) {
82
85
  var state = getTextFormattingState(newState, editorAnalyticsAPI);
83
86
  if (!shallowEqual(pluginState, state)) {
@@ -99,6 +102,8 @@ export var plugin = function plugin(dispatch, editorAnalyticsAPI) {
99
102
  }
100
103
  return false;
101
104
  },
105
+ // Ignored via go/ees005
106
+ // eslint-disable-next-line @typescript-eslint/max-params
102
107
  handleTextInput: function handleTextInput(view, from, to, text) {
103
108
  var state = view.state,
104
109
  dispatch = view.dispatch;
@@ -15,6 +15,8 @@ import { createPlugin } from '@atlaskit/prosemirror-input-rules';
15
15
  * @param text text to replace with
16
16
  */
17
17
  function replaceTextUsingCaptureGroup(text) {
18
+ // Ignored via go/ees005
19
+ // eslint-disable-next-line @typescript-eslint/max-params
18
20
  return function (state, match, start, end) {
19
21
  var _match = _slicedToArray(match, 4),
20
22
  prefix = _match[1],
@@ -59,6 +61,8 @@ function createReplacementRules(replMap, replacementRuleWithAnalytics) {
59
61
  function createSingleQuotesRules() {
60
62
  return [
61
63
  // wrapped text
64
+ // Ignored via go/ees005
65
+ // eslint-disable-next-line require-unicode-regexp, @typescript-eslint/max-params
62
66
  createRule(/(\s|^)'(\S+.*\S+)'$/, function (state, match, start, end) {
63
67
  var OPEN_SMART_QUOTE_CHAR = '‘';
64
68
  var CLOSED_SMART_QUOTE_CHAR = '’';
@@ -75,6 +79,8 @@ function createSingleQuotesRules() {
75
79
  return state.tr.insertText(CLOSED_SMART_QUOTE_CHAR, positionOfClosedQuote, end).insertText(openQuoteReplacement, start, start + openQuoteReplacement.length);
76
80
  }),
77
81
  // apostrophe
82
+ // Ignored via go/ees005
83
+ // eslint-disable-next-line require-unicode-regexp
78
84
  createReplacementRule('’', /(\w+)(')(\w+)$/)];
79
85
  }
80
86
 
@@ -97,10 +103,20 @@ function getProductRules(editorAnalyticsAPI) {
97
103
  }, editorAnalyticsAPI);
98
104
  };
99
105
  return createReplacementRules({
106
+ // Ignored via go/ees005
107
+ // eslint-disable-next-line require-unicode-regexp
100
108
  Atlassian: /(\s+|^)(atlassian)(\s)$/,
109
+ // Ignored via go/ees005
110
+ // eslint-disable-next-line require-unicode-regexp
101
111
  Jira: /(\s+|^)(jira|JIRA)(\s)$/,
112
+ // Ignored via go/ees005
113
+ // eslint-disable-next-line require-unicode-regexp
102
114
  Bitbucket: /(\s+|^)(bitbucket|BitBucket)(\s)$/,
115
+ // Ignored via go/ees005
116
+ // eslint-disable-next-line require-unicode-regexp
103
117
  Hipchat: /(\s+|^)(hipchat|HipChat)(\s)$/,
118
+ // Ignored via go/ees005
119
+ // eslint-disable-next-line require-unicode-regexp
104
120
  Trello: /(\s+|^)(trello)(\s)$/
105
121
  }, productRuleWithAnalytics);
106
122
  }
@@ -126,8 +142,14 @@ function getSymbolRules(editorAnalyticsAPI) {
126
142
  }, editorAnalyticsAPI);
127
143
  };
128
144
  return createReplacementRules({
145
+ // Ignored via go/ees005
146
+ // eslint-disable-next-line require-unicode-regexp
129
147
  '→': /(\s+|^)(--?>)(\s)$/,
148
+ // Ignored via go/ees005
149
+ // eslint-disable-next-line require-unicode-regexp
130
150
  '←': /(\s+|^)(<--?)(\s)$/,
151
+ // Ignored via go/ees005
152
+ // eslint-disable-next-line require-unicode-regexp
131
153
  '↔︎': /(\s+|^)(<->?)(\s)$/
132
154
  }, symbolRuleWithAnalytics);
133
155
  }
@@ -153,11 +175,19 @@ function getPunctuationRules(editorAnalyticsAPI) {
153
175
  }, editorAnalyticsAPI);
154
176
  };
155
177
  var dashEllipsisRules = createReplacementRules({
178
+ // Ignored via go/ees005
179
+ // eslint-disable-next-line require-unicode-regexp
156
180
  '–': /(\s+|^)(--)(\s)$/,
181
+ // Ignored via go/ees005
182
+ // eslint-disable-next-line require-unicode-regexp
157
183
  '…': /()(\.\.\.)$/
158
184
  }, punctuationRuleWithAnalytics);
159
185
  var doubleQuoteRules = createReplacementRules({
186
+ // Ignored via go/ees005
187
+ // eslint-disable-next-line require-unicode-regexp
160
188
  '“': /((?:^|[\s\{\[\(\<'"\u2018\u201C]))(")$/,
189
+ // Ignored via go/ees005
190
+ // eslint-disable-next-line require-unicode-regexp
161
191
  '”': /"$/
162
192
  }, punctuationRuleWithAnalytics);
163
193
  var singleQuoteRules = createSingleQuotesRules();
@@ -10,7 +10,8 @@ import { toggleCodeWithAnalytics, toggleEmWithAnalytics, toggleStrikeWithAnalyti
10
10
  import textFormattingCursorPlugin from './pm-plugins/cursor';
11
11
  import textFormattingInputRulePlugin from './pm-plugins/input-rule';
12
12
  import keymapPlugin from './pm-plugins/keymap';
13
- import { plugin as pmPlugin, pluginKey as textFormattingPluginKey } from './pm-plugins/main';
13
+ import { plugin as pmPlugin } from './pm-plugins/main';
14
+ import { pluginKey as textFormattingPluginKey } from './pm-plugins/plugin-key';
14
15
  import textFormattingSmartInputRulePlugin from './pm-plugins/smart-input-rule';
15
16
  import { FloatingToolbarTextFormalWithIntl as FloatingToolbarComponent } from './ui/FloatingToolbarComponent';
16
17
  import { PrimaryToolbarComponent } from './ui/PrimaryToolbarComponent';
@@ -1,4 +1,3 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
1
  /**
3
2
  * @jsxRuntime classic
4
3
  * @jsx jsx
@@ -46,9 +45,15 @@ var FloatingToolbarTextFormat = function FloatingToolbarTextFormat(_ref) {
46
45
  });
47
46
  var items = useMemo(function () {
48
47
  if (!clearIcon) {
49
- return defaultIcons;
48
+ return [{
49
+ items: defaultIcons
50
+ }];
50
51
  }
51
- return [].concat(_toConsumableArray(defaultIcons), [clearIcon]);
52
+ return [{
53
+ items: defaultIcons
54
+ }, {
55
+ items: [clearIcon]
56
+ }];
52
57
  }, [clearIcon, defaultIcons]);
53
58
  return jsx(FormattingTextDropdownMenu, {
54
59
  editorView: editorView,
@@ -1,5 +1,4 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- var _ResponsiveCustomButt, _ResponsiveCustomMenu, _ResponsiveCustomButt2, _ResponsiveCustomMenu2;
3
2
  import { ToolbarSize } from '@atlaskit/editor-common/types';
4
3
  import { IconTypes } from './types';
5
4
  export var DefaultButtonsToolbar = [IconTypes.strong, IconTypes.em];
@@ -10,13 +9,13 @@ export var DefaultButtonsMenu = [IconTypes.underline, IconTypes.strike, IconType
10
9
  * To be removed as part of ED-25129 in favour of ResponsiveCustomButtonToolbarNext along with references
11
10
  * to platform_editor_toolbar_responsive_fixes feature gate
12
11
  */
13
- export var ResponsiveCustomButtonToolbar = (_ResponsiveCustomButt = {}, _defineProperty(_ResponsiveCustomButt, ToolbarSize.XXL, DefaultButtonsToolbar), _defineProperty(_ResponsiveCustomButt, ToolbarSize.XL, DefaultButtonsToolbar), _defineProperty(_ResponsiveCustomButt, ToolbarSize.L, DefaultButtonsToolbar), _defineProperty(_ResponsiveCustomButt, ToolbarSize.M, []), _defineProperty(_ResponsiveCustomButt, ToolbarSize.S, []), _defineProperty(_ResponsiveCustomButt, ToolbarSize.XXXS, []), _ResponsiveCustomButt);
12
+ export var ResponsiveCustomButtonToolbar = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ToolbarSize.XXL, DefaultButtonsToolbar), ToolbarSize.XL, DefaultButtonsToolbar), ToolbarSize.L, DefaultButtonsToolbar), ToolbarSize.M, []), ToolbarSize.S, []), ToolbarSize.XXXS, []);
14
13
 
15
14
  // eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
16
15
  /** @deprecated
17
16
  * To be removed as part of ED-25129 in favour of ResponsiveCustomButtonToolbarNext along with references
18
17
  * to platform_editor_toolbar_responsive_fixes feature gate
19
18
  */
20
- export var ResponsiveCustomMenu = (_ResponsiveCustomMenu = {}, _defineProperty(_ResponsiveCustomMenu, ToolbarSize.XXL, DefaultButtonsMenu), _defineProperty(_ResponsiveCustomMenu, ToolbarSize.XL, DefaultButtonsMenu), _defineProperty(_ResponsiveCustomMenu, ToolbarSize.L, DefaultButtonsMenu), _defineProperty(_ResponsiveCustomMenu, ToolbarSize.M, [IconTypes.strong, IconTypes.em].concat(DefaultButtonsMenu)), _defineProperty(_ResponsiveCustomMenu, ToolbarSize.S, [IconTypes.strong, IconTypes.em].concat(DefaultButtonsMenu)), _defineProperty(_ResponsiveCustomMenu, ToolbarSize.XXXS, [IconTypes.strong, IconTypes.em].concat(DefaultButtonsMenu)), _ResponsiveCustomMenu);
21
- export var ResponsiveCustomButtonToolbarNext = (_ResponsiveCustomButt2 = {}, _defineProperty(_ResponsiveCustomButt2, ToolbarSize.XXL, DefaultButtonsToolbar), _defineProperty(_ResponsiveCustomButt2, ToolbarSize.XL, DefaultButtonsToolbar), _defineProperty(_ResponsiveCustomButt2, ToolbarSize.L, DefaultButtonsToolbar), _defineProperty(_ResponsiveCustomButt2, ToolbarSize.M, DefaultButtonsToolbar), _defineProperty(_ResponsiveCustomButt2, ToolbarSize.S, DefaultButtonsToolbar), _defineProperty(_ResponsiveCustomButt2, ToolbarSize.XXXS, []), _ResponsiveCustomButt2);
22
- export var ResponsiveCustomMenuNext = (_ResponsiveCustomMenu2 = {}, _defineProperty(_ResponsiveCustomMenu2, ToolbarSize.XXL, DefaultButtonsMenu), _defineProperty(_ResponsiveCustomMenu2, ToolbarSize.XL, DefaultButtonsMenu), _defineProperty(_ResponsiveCustomMenu2, ToolbarSize.L, DefaultButtonsMenu), _defineProperty(_ResponsiveCustomMenu2, ToolbarSize.M, DefaultButtonsMenu), _defineProperty(_ResponsiveCustomMenu2, ToolbarSize.S, DefaultButtonsMenu), _defineProperty(_ResponsiveCustomMenu2, ToolbarSize.XXXS, [IconTypes.strong, IconTypes.em].concat(DefaultButtonsMenu)), _ResponsiveCustomMenu2);
19
+ export var ResponsiveCustomMenu = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ToolbarSize.XXL, DefaultButtonsMenu), ToolbarSize.XL, DefaultButtonsMenu), ToolbarSize.L, DefaultButtonsMenu), ToolbarSize.M, [IconTypes.strong, IconTypes.em].concat(DefaultButtonsMenu)), ToolbarSize.S, [IconTypes.strong, IconTypes.em].concat(DefaultButtonsMenu)), ToolbarSize.XXXS, [IconTypes.strong, IconTypes.em].concat(DefaultButtonsMenu));
20
+ export var ResponsiveCustomButtonToolbarNext = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ToolbarSize.XXL, DefaultButtonsToolbar), ToolbarSize.XL, DefaultButtonsToolbar), ToolbarSize.L, DefaultButtonsToolbar), ToolbarSize.M, DefaultButtonsToolbar), ToolbarSize.S, DefaultButtonsToolbar), ToolbarSize.XXXS, []);
21
+ export var ResponsiveCustomMenuNext = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ToolbarSize.XXL, DefaultButtonsMenu), ToolbarSize.XL, DefaultButtonsMenu), ToolbarSize.L, DefaultButtonsMenu), ToolbarSize.M, DefaultButtonsMenu), ToolbarSize.S, DefaultButtonsMenu), ToolbarSize.XXXS, [IconTypes.strong, IconTypes.em].concat(DefaultButtonsMenu));
@@ -1,5 +1,5 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import React, { useCallback, useMemo, useState } from 'react';
2
+ import React, { useCallback, useState } from 'react';
3
3
  import { toolbarMessages } from '@atlaskit/editor-common/messages';
4
4
  import { DropdownMenuWithKeyboardNavigation as DropdownMenu } from '@atlaskit/editor-common/ui-menu';
5
5
  import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
@@ -27,11 +27,6 @@ export var FormattingTextDropdownMenu = /*#__PURE__*/React.memo(function (_ref)
27
27
  _useState2 = _slicedToArray(_useState, 2),
28
28
  isOpenedByKeyboard = _useState2[0],
29
29
  setIsOpenedByKeyboard = _useState2[1];
30
- var group = useMemo(function () {
31
- return [{
32
- items: items
33
- }];
34
- }, [items]);
35
30
  var onItemActivated = useCallback(function (_ref2) {
36
31
  var item = _ref2.item,
37
32
  _ref2$shouldCloseMenu = _ref2.shouldCloseMenu,
@@ -50,11 +45,14 @@ export var FormattingTextDropdownMenu = /*#__PURE__*/React.memo(function (_ref)
50
45
  scrollableElement: popupsScrollableElement,
51
46
  onItemActivated: onItemActivated,
52
47
  isOpen: isMenuOpen,
53
- items: group,
48
+ items: items,
54
49
  zIndex: akEditorMenuZIndex,
55
50
  fitHeight: 188,
56
51
  fitWidth: 136,
57
52
  shouldUseDefaultRole: true,
53
+ section: {
54
+ hasSeparator: true
55
+ },
58
56
  shouldFocusFirstItem: function shouldFocusFirstItem() {
59
57
  if (isOpenedByKeyboard) {
60
58
  setIsOpenedByKeyboard(false);
@@ -1,5 +1,4 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- var _IconsMarkSchema;
3
2
  /**
4
3
  * @jsxRuntime classic
5
4
  * @jsx jsx
@@ -111,7 +110,7 @@ var getIcon = function getIcon(_ref) {
111
110
  'aria-keyshortcuts': getAriaKeyshortcuts(tooltipKeymap)
112
111
  };
113
112
  };
114
- var IconsMarkSchema = (_IconsMarkSchema = {}, _defineProperty(_IconsMarkSchema, IconTypes.strong, 'strong'), _defineProperty(_IconsMarkSchema, IconTypes.em, 'em'), _defineProperty(_IconsMarkSchema, IconTypes.strike, 'strike'), _defineProperty(_IconsMarkSchema, IconTypes.code, 'code'), _defineProperty(_IconsMarkSchema, IconTypes.underline, 'underline'), _defineProperty(_IconsMarkSchema, IconTypes.superscript, 'subsup'), _defineProperty(_IconsMarkSchema, IconTypes.subscript, 'subsup'), _IconsMarkSchema);
113
+ var IconsMarkSchema = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, IconTypes.strong, 'strong'), IconTypes.em, 'em'), IconTypes.strike, 'strike'), IconTypes.code, 'code'), IconTypes.underline, 'underline'), IconTypes.superscript, 'subsup'), IconTypes.subscript, 'subsup');
115
114
  var buildMenuIconState = function buildMenuIconState(iconMark) {
116
115
  return function (_ref2) {
117
116
  var schema = _ref2.schema,
@@ -111,9 +111,15 @@ var ToolbarFormatting = function ToolbarFormatting(_ref) {
111
111
  }
112
112
  var items = useMemo(function () {
113
113
  if (!clearIcon) {
114
- return dropdownItems;
114
+ return [{
115
+ items: dropdownItems
116
+ }];
115
117
  }
116
- return [].concat(_toConsumableArray(dropdownItems), [clearIcon]);
118
+ return [{
119
+ items: dropdownItems
120
+ }, {
121
+ items: [clearIcon]
122
+ }];
117
123
  }, [clearIcon, dropdownItems]);
118
124
  var moreFormattingButtonLabel = intl.formatMessage(toolbarMessages.moreFormatting);
119
125
  var labelTextFormat = intl.formatMessage(toolbarMessages.textFormatting);
@@ -1,8 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- var _toolbarTypeToInputMe;
3
2
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
3
  import { ToolbarType } from './types';
5
- export var toolbarTypeToInputMethod = (_toolbarTypeToInputMe = {}, _defineProperty(_toolbarTypeToInputMe, ToolbarType.PRIMARY, INPUT_METHOD.TOOLBAR), _defineProperty(_toolbarTypeToInputMe, ToolbarType.FLOATING, INPUT_METHOD.FLOATING_TB), _toolbarTypeToInputMe);
4
+ export var toolbarTypeToInputMethod = _defineProperty(_defineProperty({}, ToolbarType.PRIMARY, INPUT_METHOD.TOOLBAR), ToolbarType.FLOATING, INPUT_METHOD.FLOATING_TB);
6
5
  export var getInputMethod = function getInputMethod(toolbarType) {
7
6
  return toolbarTypeToInputMethod[toolbarType];
8
7
  };
@@ -13,8 +13,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
13
13
  var MoreIconStyle = css({
14
14
  display: 'flex',
15
15
  alignItems: 'center',
16
- height: "var(--ds-space-300, 24px)",
17
- padding: "0 ".concat("var(--ds-space-025, 2px)")
16
+ height: "var(--ds-space-300, 24px)"
18
17
  });
19
18
  export var MoreButton = /*#__PURE__*/React.memo(function (_ref) {
20
19
  var label = _ref.label,
@@ -38,7 +37,7 @@ export var MoreButton = /*#__PURE__*/React.memo(function (_ref) {
38
37
  }, jsx(ShowMoreHorizontalIcon, {
39
38
  label: "",
40
39
  color: "currentColor",
41
- spacing: "compact"
40
+ spacing: "spacious"
42
41
  })),
43
42
  "aria-expanded": ariaExpanded,
44
43
  "aria-label": label,
@@ -2,6 +2,4 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  import type { TextFormattingState } from '@atlaskit/editor-common/types';
5
- import { pluginKey } from './plugin-key';
6
- export { pluginKey };
7
5
  export declare const plugin: (dispatch: Dispatch, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => SafePlugin<TextFormattingState>;
@@ -5,7 +5,9 @@ import { type MenuIconItem, ToolbarType } from './types';
5
5
  type DropdownMenuProps = {
6
6
  editorView: EditorView;
7
7
  isReducedSpacing: boolean;
8
- items: Array<MenuIconItem>;
8
+ items: {
9
+ items: MenuIconItem[];
10
+ }[];
9
11
  moreButtonLabel: string;
10
12
  hasFormattingActive: boolean;
11
13
  popupsBoundariesElement?: HTMLElement;
@@ -2,6 +2,4 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  import type { TextFormattingState } from '@atlaskit/editor-common/types';
5
- import { pluginKey } from './plugin-key';
6
- export { pluginKey };
7
5
  export declare const plugin: (dispatch: Dispatch, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => SafePlugin<TextFormattingState>;
@@ -5,7 +5,9 @@ import { type MenuIconItem, ToolbarType } from './types';
5
5
  type DropdownMenuProps = {
6
6
  editorView: EditorView;
7
7
  isReducedSpacing: boolean;
8
- items: Array<MenuIconItem>;
8
+ items: {
9
+ items: MenuIconItem[];
10
+ }[];
9
11
  moreButtonLabel: string;
10
12
  hasFormattingActive: boolean;
11
13
  popupsBoundariesElement?: HTMLElement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-text-formatting",
3
- "version": "1.16.4",
3
+ "version": "1.16.6",
4
4
  "description": "Text-formatting plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,17 +32,17 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^46.1.0",
35
- "@atlaskit/editor-common": "^96.3.0",
35
+ "@atlaskit/editor-common": "^98.0.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
37
- "@atlaskit/editor-plugin-primary-toolbar": "^2.0.0",
37
+ "@atlaskit/editor-plugin-primary-toolbar": "^2.1.0",
38
38
  "@atlaskit/editor-prosemirror": "6.2.1",
39
39
  "@atlaskit/editor-shared-styles": "^3.2.0",
40
40
  "@atlaskit/editor-tables": "^2.8.0",
41
41
  "@atlaskit/icon": "^23.1.0",
42
42
  "@atlaskit/platform-feature-flags": "^0.3.0",
43
43
  "@atlaskit/prosemirror-input-rules": "^3.2.0",
44
- "@atlaskit/tmp-editor-statsig": "^2.23.0",
45
- "@atlaskit/tokens": "^2.4.0",
44
+ "@atlaskit/tmp-editor-statsig": "^2.31.0",
45
+ "@atlaskit/tokens": "^2.5.0",
46
46
  "@babel/runtime": "^7.0.0",
47
47
  "@emotion/react": "^11.7.1",
48
48
  "react-intl-next": "npm:react-intl@^5.18.1"