@atlaskit/editor-core 187.8.10 → 187.8.13

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 (31) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/plugins/text-formatting/index.js +23 -21
  3. package/dist/cjs/plugins/text-formatting/pm-plugins/input-rule.js +48 -54
  4. package/dist/cjs/plugins/text-formatting/pm-plugins/smart-input-rule.js +28 -33
  5. package/dist/cjs/ui/ElementBrowser/components/ElementSearch.js +5 -3
  6. package/dist/cjs/ui/ElementBrowser/components/StatelessElementBrowser.js +8 -6
  7. package/dist/cjs/version-wrapper.js +1 -1
  8. package/dist/cjs/version.json +1 -1
  9. package/dist/es2019/plugins/text-formatting/index.js +15 -10
  10. package/dist/es2019/plugins/text-formatting/pm-plugins/input-rule.js +20 -18
  11. package/dist/es2019/plugins/text-formatting/pm-plugins/smart-input-rule.js +11 -12
  12. package/dist/es2019/ui/ElementBrowser/components/ElementSearch.js +5 -3
  13. package/dist/es2019/ui/ElementBrowser/components/StatelessElementBrowser.js +9 -6
  14. package/dist/es2019/version-wrapper.js +1 -1
  15. package/dist/es2019/version.json +1 -1
  16. package/dist/esm/plugins/text-formatting/index.js +23 -21
  17. package/dist/esm/plugins/text-formatting/pm-plugins/input-rule.js +48 -54
  18. package/dist/esm/plugins/text-formatting/pm-plugins/smart-input-rule.js +26 -31
  19. package/dist/esm/ui/ElementBrowser/components/ElementSearch.js +5 -3
  20. package/dist/esm/ui/ElementBrowser/components/StatelessElementBrowser.js +8 -6
  21. package/dist/esm/version-wrapper.js +1 -1
  22. package/dist/esm/version.json +1 -1
  23. package/dist/types/plugins/text-formatting/pm-plugins/input-rule.d.ts +2 -1
  24. package/dist/types/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +2 -2
  25. package/dist/types/ui/ElementBrowser/components/ElementSearch.d.ts +2 -1
  26. package/dist/types/ui/ElementBrowser/components/StatelessElementBrowser.d.ts +4 -4
  27. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/input-rule.d.ts +2 -1
  28. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +2 -2
  29. package/dist/types-ts4.5/ui/ElementBrowser/components/ElementSearch.d.ts +2 -1
  30. package/dist/types-ts4.5/ui/ElementBrowser/components/StatelessElementBrowser.d.ts +4 -4
  31. package/package.json +2 -2
@@ -19,6 +19,7 @@ function ElementSearch(_ref) {
19
19
  formatMessage = _ref.intl.formatMessage,
20
20
  focus = _ref.focus,
21
21
  onClick = _ref.onClick,
22
+ onKeyDown = _ref.onKeyDown,
22
23
  searchTerm = _ref.searchTerm;
23
24
  var ref = useFocus(focus);
24
25
  var onChange = function onChange(_ref2) {
@@ -34,6 +35,7 @@ function ElementSearch(_ref) {
34
35
  onChange: onChange,
35
36
  onClick: onClick,
36
37
  onFocus: onFocus,
38
+ onKeyDown: onKeyDown,
37
39
  onBlur: onBlur,
38
40
  elemBeforeInput: jsx("div", {
39
41
  css: elementBeforeInput,
@@ -65,10 +67,10 @@ var placeHolderMessage = {
65
67
  description: 'Search field placeholder'
66
68
  };
67
69
  var styledShortcut = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n padding: ", "px ", "px;\n width: ", "px;\n"])), shortcutStyle, GRID_SIZE / 2, GRID_SIZE, GRID_SIZE * 6);
68
- var wrapper = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n & > [data-ds--text-field--container] {\n height: ", "px;\n border-radius: ", "px;\n flex: 1 1 100%;\n overflow: visible;\n & > [data-ds--text-field--input] {\n margin-bottom: 3px;\n font-size: ", ";\n padding: ", "px 6px ", "px 0;\n }\n }\n"])), GRID_SIZE * 6, GRID_SIZE, relativeFontSizeToBase16(14), GRID_SIZE, GRID_SIZE);
70
+ var wrapper = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n & > [data-ds--text-field--container] {\n height: ", "px;\n border-radius: ", "px;\n flex: 1 1 100%;\n overflow: visible;\n & > [data-ds--text-field--input] {\n margin-bottom: 3px;\n font-size: ", ";\n padding: ", "px ", " ", "px 0;\n }\n }\n"])), GRID_SIZE * 6, GRID_SIZE, relativeFontSizeToBase16(14), GRID_SIZE, "var(--ds-space-075, 6px)", GRID_SIZE);
69
71
  var wrapperInline = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n & > [data-ds--text-field--container] {\n height: ", "px;\n flex: none;\n overflow: revert;\n }\n"])), GRID_SIZE * 5);
70
- var elementBeforeInput = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin: 1px 6px 0 8px;\n color: ", ";\n\n // Custom SearchIcon style\n span,\n svg {\n height: 20px;\n width: 20px;\n }\n"])), "var(--ds-icon, ".concat(N200, ")"));
71
- var elementAfterInput = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: 0 8px;\n height: ", ";\n text-align: center;\n"])), SEARCH_ITEM_HEIGHT_WIDTH);
72
+ var elementBeforeInput = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin: 1px ", " 0 ", ";\n color: ", ";\n\n // Custom SearchIcon style\n span,\n svg {\n height: 20px;\n width: 20px;\n }\n"])), "var(--ds-space-075, 6px)", "var(--ds-space-100, 8px)", "var(--ds-icon, ".concat(N200, ")"));
73
+ var elementAfterInput = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: 0 ", ";\n height: ", ";\n text-align: center;\n"])), "var(--ds-space-100, 8px)", SEARCH_ITEM_HEIGHT_WIDTH);
72
74
  var MemoizedElementSearchWithAnalytics = /*#__PURE__*/memo(withAnalyticsContext({
73
75
  component: 'Searchbar'
74
76
  })(injectIntl(ElementSearch)));
@@ -20,7 +20,7 @@ var baseBrowserContainerStyles = css(_templateObject2 || (_templateObject2 = _ta
20
20
  var mobileElementBrowserContainer = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", ";\n flex-direction: column;\n"])), baseBrowserContainerStyles);
21
21
  var elementBrowserContainer = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", ";\n flex-direction: row;\n"])), baseBrowserContainerStyles);
22
22
  var baseSidebarStyles = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n\n overflow-x: auto;\n overflow-y: hidden;\n"])));
23
- var mobileSideBar = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", ";\n flex: 0 0 ", ";\n padding: 12px 12px 0 12px;\n"])), baseSidebarStyles, INLINE_SIDEBAR_HEIGHT);
23
+ var mobileSideBar = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", ";\n flex: 0 0 ", ";\n padding: ", " ", " 0\n ", ";\n"])), baseSidebarStyles, INLINE_SIDEBAR_HEIGHT, "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)");
24
24
  var mobileSideBarShowCategories = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n flex: 0 0 auto;\n"])));
25
25
  var sideBar = css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n ", ";\n flex: 0 0 'auto';\n"])), baseSidebarStyles);
26
26
  var sideBarShowCategories = css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n ", ";\n flex: 0 0 ", ";\n"])), baseSidebarStyles, SIDEBAR_WIDTH);
@@ -33,6 +33,7 @@ var categoryListWrapper = css(_templateObject15 || (_templateObject15 = _taggedT
33
33
  function StatelessElementBrowser(props) {
34
34
  var items = props.items,
35
35
  onSelectItem = props.onSelectItem,
36
+ onInsertItem = props.onInsertItem,
36
37
  viewMoreItem = props.viewMoreItem;
37
38
  var _useContainerWidth = useContainerWidth(),
38
39
  containerWidth = _useContainerWidth.containerWidth,
@@ -82,10 +83,11 @@ function StatelessElementBrowser(props) {
82
83
  if (e.key !== 'Enter') {
83
84
  return;
84
85
  }
85
- if (onSelectItem && selectedItem != null) {
86
- onSelectItem(selectedItem);
86
+ if (onInsertItem && selectedItem != null) {
87
+ onInsertItem(selectedItem);
87
88
  }
88
- }, [onSelectItem, selectedItem]);
89
+ e.preventDefault();
90
+ }, [onInsertItem, selectedItem]);
89
91
 
90
92
  /**
91
93
  * On arrow key selection and clicks the selectedItemIndex will change.
@@ -146,13 +148,13 @@ function MobileBrowser(_ref) {
146
148
  viewMoreItem = _ref.viewMoreItem;
147
149
  return jsx("div", {
148
150
  css: mobileElementBrowserContainer,
149
- onKeyPress: onKeyPress,
150
151
  onKeyDown: onKeyDown,
151
152
  "data-testid": "mobile__element-browser"
152
153
  }, jsx("div", {
153
154
  css: showCategories ? [mobileSideBar, mobileSideBarShowCategories] : mobileSideBar
154
155
  }, showSearch && jsx(ElementSearch, {
155
156
  onSearch: onSearch,
157
+ onKeyDown: onKeyPress,
156
158
  mode: mode,
157
159
  focus: focusOnSearch,
158
160
  onClick: setFocusOnSearch,
@@ -225,13 +227,13 @@ function DesktopBrowser(_ref2) {
225
227
  createAnalyticsEvent: createAnalyticsEvent
226
228
  }))), jsx("div", {
227
229
  css: mainContent,
228
- onKeyPress: onKeyPress,
229
230
  onKeyDown: onKeyDown,
230
231
  "data-testid": "main-content"
231
232
  }, showSearch && jsx("div", {
232
233
  css: searchContainer
233
234
  }, jsx(ElementSearch, {
234
235
  onSearch: onSearch,
236
+ onKeyDown: onKeyPress,
235
237
  mode: mode,
236
238
  focus: focusOnSearch,
237
239
  onClick: setFocusOnSearch,
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.8.10";
2
+ export var version = "187.8.13";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.8.10",
3
+ "version": "187.8.13",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,6 @@
1
1
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
4
  import type { FeatureFlags } from '@atlaskit/editor-common/types';
4
5
  declare enum ValidAutoformatChars {
5
6
  STRONG = "__",
@@ -19,5 +20,5 @@ export declare const italicRegex1: ReverseRegexExp;
19
20
  export declare const italicRegex2: ReverseRegexExp;
20
21
  export declare const strikeRegex: ReverseRegexExp;
21
22
  export declare const codeRegex: ReverseRegexExp;
22
- export declare function inputRulePlugin(schema: Schema, featureFlags: FeatureFlags): SafePlugin | undefined;
23
+ export declare function inputRulePlugin(schema: Schema, _featureFlags: FeatureFlags, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
23
24
  export default inputRulePlugin;
@@ -1,3 +1,3 @@
1
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
2
- declare const _default: (featureFlags: FeatureFlags) => import("@atlaskit/editor-common/safe-plugin").SafePlugin<any>;
1
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
+ declare const _default: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => import("@atlaskit/editor-common/safe-plugin").SafePlugin<any>;
3
3
  export default _default;
@@ -1,12 +1,13 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { WrappedComponentProps } from 'react-intl-next';
3
+ import type { WrappedComponentProps } from 'react-intl-next';
4
4
  import { Modes } from '../types';
5
5
  interface Props {
6
6
  onSearch: (value: string) => void;
7
7
  mode: keyof typeof Modes;
8
8
  focus: boolean;
9
9
  onClick: (e: React.MouseEvent) => void;
10
+ onKeyDown: (e: React.KeyboardEvent) => void;
10
11
  searchTerm?: string;
11
12
  }
12
13
  declare const MemoizedElementSearchWithAnalytics: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<Props & WrappedComponentProps<"intl">, "intl"> & {
@@ -1,9 +1,9 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
4
- import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
5
- import { Category, Modes } from '../types';
6
- import { EmptyStateHandler } from '../../../types/empty-state-handler';
3
+ import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
4
+ import type { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
5
+ import type { Category, Modes } from '../types';
6
+ import type { EmptyStateHandler } from '../../../types/empty-state-handler';
7
7
  export type StatelessElementBrowserProps = {
8
8
  categories?: Category[];
9
9
  items: QuickInsertItem[];
@@ -1,5 +1,6 @@
1
1
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
4
  import type { FeatureFlags } from '@atlaskit/editor-common/types';
4
5
  declare enum ValidAutoformatChars {
5
6
  STRONG = "__",
@@ -19,5 +20,5 @@ export declare const italicRegex1: ReverseRegexExp;
19
20
  export declare const italicRegex2: ReverseRegexExp;
20
21
  export declare const strikeRegex: ReverseRegexExp;
21
22
  export declare const codeRegex: ReverseRegexExp;
22
- export declare function inputRulePlugin(schema: Schema, featureFlags: FeatureFlags): SafePlugin | undefined;
23
+ export declare function inputRulePlugin(schema: Schema, _featureFlags: FeatureFlags, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
23
24
  export default inputRulePlugin;
@@ -1,3 +1,3 @@
1
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
2
- declare const _default: (featureFlags: FeatureFlags) => import("@atlaskit/editor-common/safe-plugin").SafePlugin<any>;
1
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
+ declare const _default: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => import("@atlaskit/editor-common/safe-plugin").SafePlugin<any>;
3
3
  export default _default;
@@ -1,12 +1,13 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { WrappedComponentProps } from 'react-intl-next';
3
+ import type { WrappedComponentProps } from 'react-intl-next';
4
4
  import { Modes } from '../types';
5
5
  interface Props {
6
6
  onSearch: (value: string) => void;
7
7
  mode: keyof typeof Modes;
8
8
  focus: boolean;
9
9
  onClick: (e: React.MouseEvent) => void;
10
+ onKeyDown: (e: React.KeyboardEvent) => void;
10
11
  searchTerm?: string;
11
12
  }
12
13
  declare const MemoizedElementSearchWithAnalytics: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<Props & WrappedComponentProps<"intl">, "intl"> & {
@@ -1,9 +1,9 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
4
- import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
5
- import { Category, Modes } from '../types';
6
- import { EmptyStateHandler } from '../../../types/empty-state-handler';
3
+ import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
4
+ import type { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
5
+ import type { Category, Modes } from '../types';
6
+ import type { EmptyStateHandler } from '../../../types/empty-state-handler';
7
7
  export type StatelessElementBrowserProps = {
8
8
  categories?: Category[];
9
9
  items: QuickInsertItem[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.8.10",
3
+ "version": "187.8.13",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -55,7 +55,7 @@
55
55
  "@atlaskit/code": "^14.6.0",
56
56
  "@atlaskit/date": "^0.10.0",
57
57
  "@atlaskit/datetime-picker": "^12.7.0",
58
- "@atlaskit/editor-common": "^74.31.0",
58
+ "@atlaskit/editor-common": "^74.32.0",
59
59
  "@atlaskit/editor-json-transformer": "^8.10.0",
60
60
  "@atlaskit/editor-markdown-transformer": "^5.2.5",
61
61
  "@atlaskit/editor-palette": "1.5.1",