@atlaskit/editor-plugin-insert-block 1.8.1 → 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @atlaskit/editor-plugin-insert-block
2
2
 
3
+ ## 1.8.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#128333](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/128333)
8
+ [`4ad86751ab1d7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4ad86751ab1d7) -
9
+ [ED-24505] Implement onClick handler for Turn into dropdown options and update relevant insertion
10
+ analytics with inputMethod: floatingToolbar when an element is inserted via the dropdown
11
+ - Updated dependencies
12
+
3
13
  ## 1.8.1
4
14
 
5
15
  ### Patch Changes
@@ -129,14 +129,16 @@ var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_
129
129
  return;
130
130
  }
131
131
  var formatMessage = intl.formatMessage;
132
- var options = _transformOptions.transformationOptions.map(function (option) {
132
+ var options = (0, _transformOptions.transformationOptions)(api).map(function (option) {
133
133
  var IconBefore = option.icon;
134
134
  return {
135
135
  title: formatMessage(option.title),
136
136
  icon: /*#__PURE__*/_react.default.createElement(IconBefore, {
137
137
  label: ""
138
138
  }),
139
- onClick: function onClick() {
139
+ onClick: function onClick(state, dispatch) {
140
+ var _option$command;
141
+ (_option$command = option.command) === null || _option$command === void 0 || _option$command.call(option, _analytics.INPUT_METHOD.FLOATING_TB)(state, dispatch);
140
142
  return true;
141
143
  }
142
144
  };
@@ -10,16 +10,23 @@ var _code = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/code"));
10
10
  var _info = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/info"));
11
11
  var _quote = _interopRequireDefault(require("@atlaskit/icon/glyph/quote"));
12
12
  var _expand = _interopRequireDefault(require("../assets/expand"));
13
- var transformationOptions = exports.transformationOptions = [{
14
- title: _messages.blockTypeMessages.panel,
15
- icon: _info.default
16
- }, {
17
- title: _messages.toolbarInsertBlockMessages.expand,
18
- icon: _expand.default
19
- }, {
20
- title: _messages.blockTypeMessages.codeblock,
21
- icon: _code.default
22
- }, {
23
- title: _messages.blockTypeMessages.blockquote,
24
- icon: _quote.default
25
- }];
13
+ var transformationOptions = exports.transformationOptions = function transformationOptions(api) {
14
+ var _api$panel, _api$expand, _api$codeBlock, _api$blockType;
15
+ return [{
16
+ title: _messages.blockTypeMessages.panel,
17
+ icon: _info.default,
18
+ command: api === null || api === void 0 || (_api$panel = api.panel) === null || _api$panel === void 0 ? void 0 : _api$panel.actions.insertPanel
19
+ }, {
20
+ title: _messages.toolbarInsertBlockMessages.expand,
21
+ icon: _expand.default,
22
+ command: api === null || api === void 0 || (_api$expand = api.expand) === null || _api$expand === void 0 ? void 0 : _api$expand.actions.insertExpandWithInputMethod
23
+ }, {
24
+ title: _messages.blockTypeMessages.codeblock,
25
+ icon: _code.default,
26
+ command: api === null || api === void 0 || (_api$codeBlock = api.codeBlock) === null || _api$codeBlock === void 0 ? void 0 : _api$codeBlock.actions.insertCodeBlock
27
+ }, {
28
+ title: _messages.blockTypeMessages.blockquote,
29
+ icon: _quote.default,
30
+ command: api === null || api === void 0 || (_api$blockType = api.blockType) === null || _api$blockType === void 0 ? void 0 : _api$blockType.actions.insertBlockQuote
31
+ }];
32
+ };
@@ -120,14 +120,16 @@ export const insertBlockPlugin = ({
120
120
  const {
121
121
  formatMessage
122
122
  } = intl;
123
- const options = transformationOptions.map(option => {
123
+ const options = transformationOptions(api).map(option => {
124
124
  const IconBefore = option.icon;
125
125
  return {
126
126
  title: formatMessage(option.title),
127
127
  icon: /*#__PURE__*/React.createElement(IconBefore, {
128
128
  label: ""
129
129
  }),
130
- onClick: () => {
130
+ onClick: (state, dispatch) => {
131
+ var _option$command;
132
+ (_option$command = option.command) === null || _option$command === void 0 ? void 0 : _option$command.call(option, INPUT_METHOD.FLOATING_TB)(state, dispatch);
131
133
  return true;
132
134
  }
133
135
  };
@@ -3,16 +3,23 @@ import EditorCodeIcon from '@atlaskit/icon/glyph/editor/code';
3
3
  import EditorInfoIcon from '@atlaskit/icon/glyph/editor/info';
4
4
  import QuoteIcon from '@atlaskit/icon/glyph/quote';
5
5
  import ExpandIcon from '../assets/expand';
6
- export const transformationOptions = [{
7
- title: messages.panel,
8
- icon: EditorInfoIcon
9
- }, {
10
- title: toolbarMessages.expand,
11
- icon: ExpandIcon
12
- }, {
13
- title: messages.codeblock,
14
- icon: EditorCodeIcon
15
- }, {
16
- title: messages.blockquote,
17
- icon: QuoteIcon
18
- }];
6
+ export const transformationOptions = api => {
7
+ var _api$panel, _api$expand, _api$codeBlock, _api$blockType;
8
+ return [{
9
+ title: messages.panel,
10
+ icon: EditorInfoIcon,
11
+ command: api === null || api === void 0 ? void 0 : (_api$panel = api.panel) === null || _api$panel === void 0 ? void 0 : _api$panel.actions.insertPanel
12
+ }, {
13
+ title: toolbarMessages.expand,
14
+ icon: ExpandIcon,
15
+ command: api === null || api === void 0 ? void 0 : (_api$expand = api.expand) === null || _api$expand === void 0 ? void 0 : _api$expand.actions.insertExpandWithInputMethod
16
+ }, {
17
+ title: messages.codeblock,
18
+ icon: EditorCodeIcon,
19
+ command: api === null || api === void 0 ? void 0 : (_api$codeBlock = api.codeBlock) === null || _api$codeBlock === void 0 ? void 0 : _api$codeBlock.actions.insertCodeBlock
20
+ }, {
21
+ title: messages.blockquote,
22
+ icon: QuoteIcon,
23
+ command: api === null || api === void 0 ? void 0 : (_api$blockType = api.blockType) === null || _api$blockType === void 0 ? void 0 : _api$blockType.actions.insertBlockQuote
24
+ }];
25
+ };
@@ -119,14 +119,16 @@ export var insertBlockPlugin = function insertBlockPlugin(_ref) {
119
119
  return;
120
120
  }
121
121
  var formatMessage = intl.formatMessage;
122
- var options = transformationOptions.map(function (option) {
122
+ var options = transformationOptions(api).map(function (option) {
123
123
  var IconBefore = option.icon;
124
124
  return {
125
125
  title: formatMessage(option.title),
126
126
  icon: /*#__PURE__*/React.createElement(IconBefore, {
127
127
  label: ""
128
128
  }),
129
- onClick: function onClick() {
129
+ onClick: function onClick(state, dispatch) {
130
+ var _option$command;
131
+ (_option$command = option.command) === null || _option$command === void 0 || _option$command.call(option, INPUT_METHOD.FLOATING_TB)(state, dispatch);
130
132
  return true;
131
133
  }
132
134
  };
@@ -3,16 +3,23 @@ import EditorCodeIcon from '@atlaskit/icon/glyph/editor/code';
3
3
  import EditorInfoIcon from '@atlaskit/icon/glyph/editor/info';
4
4
  import QuoteIcon from '@atlaskit/icon/glyph/quote';
5
5
  import ExpandIcon from '../assets/expand';
6
- export var transformationOptions = [{
7
- title: messages.panel,
8
- icon: EditorInfoIcon
9
- }, {
10
- title: toolbarMessages.expand,
11
- icon: ExpandIcon
12
- }, {
13
- title: messages.codeblock,
14
- icon: EditorCodeIcon
15
- }, {
16
- title: messages.blockquote,
17
- icon: QuoteIcon
18
- }];
6
+ export var transformationOptions = function transformationOptions(api) {
7
+ var _api$panel, _api$expand, _api$codeBlock, _api$blockType;
8
+ return [{
9
+ title: messages.panel,
10
+ icon: EditorInfoIcon,
11
+ command: api === null || api === void 0 || (_api$panel = api.panel) === null || _api$panel === void 0 ? void 0 : _api$panel.actions.insertPanel
12
+ }, {
13
+ title: toolbarMessages.expand,
14
+ icon: ExpandIcon,
15
+ command: api === null || api === void 0 || (_api$expand = api.expand) === null || _api$expand === void 0 ? void 0 : _api$expand.actions.insertExpandWithInputMethod
16
+ }, {
17
+ title: messages.codeblock,
18
+ icon: EditorCodeIcon,
19
+ command: api === null || api === void 0 || (_api$codeBlock = api.codeBlock) === null || _api$codeBlock === void 0 ? void 0 : _api$codeBlock.actions.insertCodeBlock
20
+ }, {
21
+ title: messages.blockquote,
22
+ icon: QuoteIcon,
23
+ command: api === null || api === void 0 || (_api$blockType = api.blockType) === null || _api$blockType === void 0 ? void 0 : _api$blockType.actions.insertBlockQuote
24
+ }];
25
+ };
@@ -1,17 +1,21 @@
1
- import EditorInfoIcon from '@atlaskit/icon/glyph/editor/info';
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import QuoteIcon from '@atlaskit/icon/glyph/quote';
2
3
  import ExpandIcon from '../assets/expand';
3
- export declare const transformationOptions: ({
4
+ import type { InsertBlockPlugin } from '../plugin';
5
+ export declare const transformationOptions: (api: ExtractInjectionAPI<InsertBlockPlugin> | undefined) => ({
4
6
  title: {
5
7
  id: string;
6
8
  defaultMessage: string;
7
9
  description: string;
8
10
  };
9
- icon: typeof EditorInfoIcon;
11
+ icon: typeof ExpandIcon;
12
+ command: ((inputMethod: import("@atlaskit/editor-plugin-expand").InsertMethod) => import("@atlaskit/editor-common/types").Command) | undefined;
10
13
  } | {
11
14
  title: {
12
15
  id: string;
13
16
  defaultMessage: string;
14
17
  description: string;
15
18
  };
16
- icon: typeof ExpandIcon;
19
+ icon: typeof QuoteIcon;
20
+ command: ((inputMethod: import("@atlaskit/editor-plugin-block-type").InputMethod) => import("@atlaskit/editor-common/types").Command) | undefined;
17
21
  })[];
@@ -1,17 +1,21 @@
1
- import EditorInfoIcon from '@atlaskit/icon/glyph/editor/info';
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import QuoteIcon from '@atlaskit/icon/glyph/quote';
2
3
  import ExpandIcon from '../assets/expand';
3
- export declare const transformationOptions: ({
4
+ import type { InsertBlockPlugin } from '../plugin';
5
+ export declare const transformationOptions: (api: ExtractInjectionAPI<InsertBlockPlugin> | undefined) => ({
4
6
  title: {
5
7
  id: string;
6
8
  defaultMessage: string;
7
9
  description: string;
8
10
  };
9
- icon: typeof EditorInfoIcon;
11
+ icon: typeof ExpandIcon;
12
+ command: ((inputMethod: import("@atlaskit/editor-plugin-expand").InsertMethod) => import("@atlaskit/editor-common/types").Command) | undefined;
10
13
  } | {
11
14
  title: {
12
15
  id: string;
13
16
  defaultMessage: string;
14
17
  description: string;
15
18
  };
16
- icon: typeof ExpandIcon;
19
+ icon: typeof QuoteIcon;
20
+ command: ((inputMethod: import("@atlaskit/editor-plugin-block-type").InputMethod) => import("@atlaskit/editor-common/types").Command) | undefined;
17
21
  })[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-insert-block",
3
- "version": "1.8.1",
3
+ "version": "1.8.2",
4
4
  "description": "Insert block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,33 +33,33 @@
33
33
  ".": "./src/index.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@atlaskit/editor-common": "^87.5.0",
37
- "@atlaskit/editor-plugin-analytics": "^1.6.0",
38
- "@atlaskit/editor-plugin-block-type": "^3.11.0",
39
- "@atlaskit/editor-plugin-code-block": "^3.2.0",
40
- "@atlaskit/editor-plugin-date": "^2.2.0",
41
- "@atlaskit/editor-plugin-emoji": "^2.2.0",
42
- "@atlaskit/editor-plugin-expand": "^2.2.0",
43
- "@atlaskit/editor-plugin-extension": "^1.12.0",
36
+ "@atlaskit/editor-common": "^87.6.0",
37
+ "@atlaskit/editor-plugin-analytics": "^1.7.0",
38
+ "@atlaskit/editor-plugin-block-type": "^3.12.0",
39
+ "@atlaskit/editor-plugin-code-block": "^3.3.0",
40
+ "@atlaskit/editor-plugin-date": "^2.3.0",
41
+ "@atlaskit/editor-plugin-emoji": "^2.3.0",
42
+ "@atlaskit/editor-plugin-expand": "^2.3.0",
43
+ "@atlaskit/editor-plugin-extension": "^1.13.0",
44
44
  "@atlaskit/editor-plugin-feature-flags": "^1.2.0",
45
- "@atlaskit/editor-plugin-hyperlink": "^2.7.0",
45
+ "@atlaskit/editor-plugin-hyperlink": "^2.8.0",
46
46
  "@atlaskit/editor-plugin-image-upload": "^1.2.0",
47
- "@atlaskit/editor-plugin-layout": "^1.6.0",
48
- "@atlaskit/editor-plugin-media": "^1.27.0",
49
- "@atlaskit/editor-plugin-mentions": "^2.2.0",
50
- "@atlaskit/editor-plugin-panel": "^2.2.0",
51
- "@atlaskit/editor-plugin-placeholder-text": "^1.6.0",
47
+ "@atlaskit/editor-plugin-layout": "^1.7.0",
48
+ "@atlaskit/editor-plugin-media": "^1.28.0",
49
+ "@atlaskit/editor-plugin-mentions": "^2.3.0",
50
+ "@atlaskit/editor-plugin-panel": "^2.3.0",
51
+ "@atlaskit/editor-plugin-placeholder-text": "^1.7.0",
52
52
  "@atlaskit/editor-plugin-primary-toolbar": "^2.0.0",
53
53
  "@atlaskit/editor-plugin-quick-insert": "^1.2.0",
54
- "@atlaskit/editor-plugin-rule": "^1.7.0",
55
- "@atlaskit/editor-plugin-status": "^2.3.0",
56
- "@atlaskit/editor-plugin-table": "^7.24.0",
57
- "@atlaskit/editor-plugin-tasks-and-decisions": "^2.3.0",
58
- "@atlaskit/editor-plugin-type-ahead": "^1.6.0",
54
+ "@atlaskit/editor-plugin-rule": "^1.8.0",
55
+ "@atlaskit/editor-plugin-status": "^2.4.0",
56
+ "@atlaskit/editor-plugin-table": "^7.25.0",
57
+ "@atlaskit/editor-plugin-tasks-and-decisions": "^2.4.0",
58
+ "@atlaskit/editor-plugin-type-ahead": "^1.7.0",
59
59
  "@atlaskit/editor-prosemirror": "5.0.1",
60
60
  "@atlaskit/editor-shared-styles": "^2.13.0",
61
61
  "@atlaskit/emoji": "^67.7.0",
62
- "@atlaskit/icon": "^22.10.0",
62
+ "@atlaskit/icon": "^22.11.0",
63
63
  "@atlaskit/platform-feature-flags": "^0.3.0",
64
64
  "@atlaskit/primitives": "^11.1.0",
65
65
  "@atlaskit/theme": "^12.11.0",