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

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,13 @@
1
1
  # @atlaskit/editor-plugin-insert-block
2
2
 
3
+ ## 1.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#127194](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/127194)
8
+ [`8d7f9ef047d37`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8d7f9ef047d37) -
9
+ [ED-24504] Add dropdown options UI
10
+
3
11
  ## 1.8.0
4
12
 
5
13
  ### Minor Changes
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = ExpandIcon;
7
+ var _react = require("@emotion/react");
8
+ /**
9
+ * @jsxRuntime classic
10
+ * @jsx jsx
11
+ */
12
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
13
+
14
+ var iconContainer = (0, _react.css)({
15
+ display: 'inline-flex',
16
+ justifyContent: 'center',
17
+ alignItems: 'center',
18
+ width: '24px',
19
+ height: '24px'
20
+ });
21
+ function ExpandIcon() {
22
+ return (0, _react.jsx)("span", {
23
+ css: iconContainer
24
+ }, (0, _react.jsx)("svg", {
25
+ xmlns: "http://www.w3.org/2000/svg",
26
+ width: "18",
27
+ height: "16",
28
+ viewBox: "0 0 18 16",
29
+ fill: "none"
30
+ }, (0, _react.jsx)("path", {
31
+ d: "M2 2V14H16V2H2ZM2 0H16C16.5304 0 17.0391 0.210714 17.4142 0.585786C17.7893 0.960859 18 1.46957 18 2V14C18 14.5304 17.7893 15.0391 17.4142 15.4142C17.0391 15.7893 16.5304 16 16 16H2C1.46957 16 0.960859 15.7893 0.585786 15.4142C0.210714 15.0391 0 14.5304 0 14V2C0 1.46957 0.210714 0.960859 0.585786 0.585786C0.960859 0.210714 1.46957 0 2 0Z",
32
+ fill: "var(--ds-icon, #44546F)"
33
+ }), (0, _react.jsx)("path", {
34
+ fillRule: "evenodd",
35
+ clipRule: "evenodd",
36
+ d: "M5.29158 6.29294C5.10477 6.48183 5 6.73678 5 7.00244C5 7.2681 5.10477 7.52305 5.29158 7.71194L8.23058 10.6769C8.44858 10.8919 8.73058 10.9989 9.00958 10.9989C9.28858 10.9989 9.56558 10.8919 9.77858 10.6769L12.7086 7.72194C12.8951 7.53292 12.9998 7.27803 12.9998 7.01244C12.9998 6.74686 12.8951 6.49196 12.7086 6.30294C12.6167 6.20976 12.5073 6.13576 12.3866 6.08525C12.2659 6.03474 12.1364 6.00873 12.0056 6.00873C11.8748 6.00873 11.7452 6.03474 11.6245 6.08525C11.5039 6.13576 11.3944 6.20976 11.3026 6.30294L9.00458 8.61994L6.69758 6.29294C6.60554 6.20012 6.49604 6.12644 6.37538 6.07617C6.25472 6.02589 6.1253 6 5.99458 6C5.86386 6 5.73444 6.02589 5.61378 6.07617C5.49312 6.12644 5.38362 6.20012 5.29158 6.29294Z",
37
+ fill: "var(--ds-icon, #44546F)"
38
+ })));
39
+ }
@@ -15,6 +15,7 @@ var _types = require("@atlaskit/editor-common/types");
15
15
  var _consts = require("@atlaskit/editor-plugin-block-type/consts");
16
16
  var _switch = _interopRequireDefault(require("./assets/switch"));
17
17
  var _ToolbarInsertBlock = _interopRequireDefault(require("./ui/ToolbarInsertBlock"));
18
+ var _transformOptions = require("./ui/transformOptions");
18
19
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
19
20
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
20
21
  var toolbarSizeToButtons = function toolbarSizeToButtons(toolbarSize) {
@@ -127,12 +128,25 @@ var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_
127
128
  if (!(api !== null && api !== void 0 && (_api$featureFlags = api.featureFlags) !== null && _api$featureFlags !== void 0 && (_api$featureFlags = _api$featureFlags.sharedState.currentState()) !== null && _api$featureFlags !== void 0 && _api$featureFlags.basicTextTransformations)) {
128
129
  return;
129
130
  }
131
+ var formatMessage = intl.formatMessage;
132
+ var options = _transformOptions.transformationOptions.map(function (option) {
133
+ var IconBefore = option.icon;
134
+ return {
135
+ title: formatMessage(option.title),
136
+ icon: /*#__PURE__*/_react.default.createElement(IconBefore, {
137
+ label: ""
138
+ }),
139
+ onClick: function onClick() {
140
+ return true;
141
+ }
142
+ };
143
+ });
130
144
  return {
131
145
  items: [{
132
146
  type: 'dropdown',
133
- title: intl.formatMessage(_messages.toolbarInsertBlockMessages.turnInto),
147
+ title: formatMessage(_messages.toolbarInsertBlockMessages.turnInto),
134
148
  iconBefore: _switch.default,
135
- options: []
149
+ options: options
136
150
  }],
137
151
  rank: -9
138
152
  };
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.transformationOptions = void 0;
8
+ var _messages = require("@atlaskit/editor-common/messages");
9
+ var _code = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/code"));
10
+ var _info = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/info"));
11
+ var _quote = _interopRequireDefault(require("@atlaskit/icon/glyph/quote"));
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
+ }];
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
6
+ import { css, jsx } from '@emotion/react';
7
+ const iconContainer = css({
8
+ display: 'inline-flex',
9
+ justifyContent: 'center',
10
+ alignItems: 'center',
11
+ width: '24px',
12
+ height: '24px'
13
+ });
14
+ export default function ExpandIcon() {
15
+ return jsx("span", {
16
+ css: iconContainer
17
+ }, jsx("svg", {
18
+ xmlns: "http://www.w3.org/2000/svg",
19
+ width: "18",
20
+ height: "16",
21
+ viewBox: "0 0 18 16",
22
+ fill: "none"
23
+ }, jsx("path", {
24
+ d: "M2 2V14H16V2H2ZM2 0H16C16.5304 0 17.0391 0.210714 17.4142 0.585786C17.7893 0.960859 18 1.46957 18 2V14C18 14.5304 17.7893 15.0391 17.4142 15.4142C17.0391 15.7893 16.5304 16 16 16H2C1.46957 16 0.960859 15.7893 0.585786 15.4142C0.210714 15.0391 0 14.5304 0 14V2C0 1.46957 0.210714 0.960859 0.585786 0.585786C0.960859 0.210714 1.46957 0 2 0Z",
25
+ fill: "var(--ds-icon, #44546F)"
26
+ }), jsx("path", {
27
+ fillRule: "evenodd",
28
+ clipRule: "evenodd",
29
+ d: "M5.29158 6.29294C5.10477 6.48183 5 6.73678 5 7.00244C5 7.2681 5.10477 7.52305 5.29158 7.71194L8.23058 10.6769C8.44858 10.8919 8.73058 10.9989 9.00958 10.9989C9.28858 10.9989 9.56558 10.8919 9.77858 10.6769L12.7086 7.72194C12.8951 7.53292 12.9998 7.27803 12.9998 7.01244C12.9998 6.74686 12.8951 6.49196 12.7086 6.30294C12.6167 6.20976 12.5073 6.13576 12.3866 6.08525C12.2659 6.03474 12.1364 6.00873 12.0056 6.00873C11.8748 6.00873 11.7452 6.03474 11.6245 6.08525C11.5039 6.13576 11.3944 6.20976 11.3026 6.30294L9.00458 8.61994L6.69758 6.29294C6.60554 6.20012 6.49604 6.12644 6.37538 6.07617C6.25472 6.02589 6.1253 6 5.99458 6C5.86386 6 5.73444 6.02589 5.61378 6.07617C5.49312 6.12644 5.38362 6.20012 5.29158 6.29294Z",
30
+ fill: "var(--ds-icon, #44546F)"
31
+ })));
32
+ }
@@ -7,6 +7,7 @@ import { ToolbarSize } from '@atlaskit/editor-common/types';
7
7
  import { BLOCK_QUOTE, CODE_BLOCK, PANEL } from '@atlaskit/editor-plugin-block-type/consts';
8
8
  import SwitchIcon from './assets/switch';
9
9
  import ToolbarInsertBlock from './ui/ToolbarInsertBlock';
10
+ import { transformationOptions } from './ui/transformOptions';
10
11
  const toolbarSizeToButtons = toolbarSize => {
11
12
  switch (toolbarSize) {
12
13
  case ToolbarSize.XXL:
@@ -116,12 +117,27 @@ export const insertBlockPlugin = ({
116
117
  if (!(api !== null && api !== void 0 && (_api$featureFlags = api.featureFlags) !== null && _api$featureFlags !== void 0 && (_api$featureFlags$sha = _api$featureFlags.sharedState.currentState()) !== null && _api$featureFlags$sha !== void 0 && _api$featureFlags$sha.basicTextTransformations)) {
117
118
  return;
118
119
  }
120
+ const {
121
+ formatMessage
122
+ } = intl;
123
+ const options = transformationOptions.map(option => {
124
+ const IconBefore = option.icon;
125
+ return {
126
+ title: formatMessage(option.title),
127
+ icon: /*#__PURE__*/React.createElement(IconBefore, {
128
+ label: ""
129
+ }),
130
+ onClick: () => {
131
+ return true;
132
+ }
133
+ };
134
+ });
119
135
  return {
120
136
  items: [{
121
137
  type: 'dropdown',
122
- title: intl.formatMessage(messages.turnInto),
138
+ title: formatMessage(messages.turnInto),
123
139
  iconBefore: SwitchIcon,
124
- options: []
140
+ options
125
141
  }],
126
142
  rank: -9
127
143
  };
@@ -0,0 +1,18 @@
1
+ import { blockTypeMessages as messages, toolbarInsertBlockMessages as toolbarMessages } from '@atlaskit/editor-common/messages';
2
+ import EditorCodeIcon from '@atlaskit/icon/glyph/editor/code';
3
+ import EditorInfoIcon from '@atlaskit/icon/glyph/editor/info';
4
+ import QuoteIcon from '@atlaskit/icon/glyph/quote';
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
+ }];
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
6
+ import { css, jsx } from '@emotion/react';
7
+ var iconContainer = css({
8
+ display: 'inline-flex',
9
+ justifyContent: 'center',
10
+ alignItems: 'center',
11
+ width: '24px',
12
+ height: '24px'
13
+ });
14
+ export default function ExpandIcon() {
15
+ return jsx("span", {
16
+ css: iconContainer
17
+ }, jsx("svg", {
18
+ xmlns: "http://www.w3.org/2000/svg",
19
+ width: "18",
20
+ height: "16",
21
+ viewBox: "0 0 18 16",
22
+ fill: "none"
23
+ }, jsx("path", {
24
+ d: "M2 2V14H16V2H2ZM2 0H16C16.5304 0 17.0391 0.210714 17.4142 0.585786C17.7893 0.960859 18 1.46957 18 2V14C18 14.5304 17.7893 15.0391 17.4142 15.4142C17.0391 15.7893 16.5304 16 16 16H2C1.46957 16 0.960859 15.7893 0.585786 15.4142C0.210714 15.0391 0 14.5304 0 14V2C0 1.46957 0.210714 0.960859 0.585786 0.585786C0.960859 0.210714 1.46957 0 2 0Z",
25
+ fill: "var(--ds-icon, #44546F)"
26
+ }), jsx("path", {
27
+ fillRule: "evenodd",
28
+ clipRule: "evenodd",
29
+ d: "M5.29158 6.29294C5.10477 6.48183 5 6.73678 5 7.00244C5 7.2681 5.10477 7.52305 5.29158 7.71194L8.23058 10.6769C8.44858 10.8919 8.73058 10.9989 9.00958 10.9989C9.28858 10.9989 9.56558 10.8919 9.77858 10.6769L12.7086 7.72194C12.8951 7.53292 12.9998 7.27803 12.9998 7.01244C12.9998 6.74686 12.8951 6.49196 12.7086 6.30294C12.6167 6.20976 12.5073 6.13576 12.3866 6.08525C12.2659 6.03474 12.1364 6.00873 12.0056 6.00873C11.8748 6.00873 11.7452 6.03474 11.6245 6.08525C11.5039 6.13576 11.3944 6.20976 11.3026 6.30294L9.00458 8.61994L6.69758 6.29294C6.60554 6.20012 6.49604 6.12644 6.37538 6.07617C6.25472 6.02589 6.1253 6 5.99458 6C5.86386 6 5.73444 6.02589 5.61378 6.07617C5.49312 6.12644 5.38362 6.20012 5.29158 6.29294Z",
30
+ fill: "var(--ds-icon, #44546F)"
31
+ })));
32
+ }
@@ -7,6 +7,7 @@ import { ToolbarSize } from '@atlaskit/editor-common/types';
7
7
  import { BLOCK_QUOTE, CODE_BLOCK, PANEL } from '@atlaskit/editor-plugin-block-type/consts';
8
8
  import SwitchIcon from './assets/switch';
9
9
  import ToolbarInsertBlock from './ui/ToolbarInsertBlock';
10
+ import { transformationOptions } from './ui/transformOptions';
10
11
  var toolbarSizeToButtons = function toolbarSizeToButtons(toolbarSize) {
11
12
  switch (toolbarSize) {
12
13
  case ToolbarSize.XXL:
@@ -117,12 +118,25 @@ export var insertBlockPlugin = function insertBlockPlugin(_ref) {
117
118
  if (!(api !== null && api !== void 0 && (_api$featureFlags = api.featureFlags) !== null && _api$featureFlags !== void 0 && (_api$featureFlags = _api$featureFlags.sharedState.currentState()) !== null && _api$featureFlags !== void 0 && _api$featureFlags.basicTextTransformations)) {
118
119
  return;
119
120
  }
121
+ var formatMessage = intl.formatMessage;
122
+ var options = transformationOptions.map(function (option) {
123
+ var IconBefore = option.icon;
124
+ return {
125
+ title: formatMessage(option.title),
126
+ icon: /*#__PURE__*/React.createElement(IconBefore, {
127
+ label: ""
128
+ }),
129
+ onClick: function onClick() {
130
+ return true;
131
+ }
132
+ };
133
+ });
120
134
  return {
121
135
  items: [{
122
136
  type: 'dropdown',
123
- title: intl.formatMessage(messages.turnInto),
137
+ title: formatMessage(messages.turnInto),
124
138
  iconBefore: SwitchIcon,
125
- options: []
139
+ options: options
126
140
  }],
127
141
  rank: -9
128
142
  };
@@ -0,0 +1,18 @@
1
+ import { blockTypeMessages as messages, toolbarInsertBlockMessages as toolbarMessages } from '@atlaskit/editor-common/messages';
2
+ import EditorCodeIcon from '@atlaskit/icon/glyph/editor/code';
3
+ import EditorInfoIcon from '@atlaskit/icon/glyph/editor/info';
4
+ import QuoteIcon from '@atlaskit/icon/glyph/quote';
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
+ }];
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import { jsx } from '@emotion/react';
6
+ export default function ExpandIcon(): jsx.JSX.Element;
@@ -0,0 +1,17 @@
1
+ import EditorInfoIcon from '@atlaskit/icon/glyph/editor/info';
2
+ import ExpandIcon from '../assets/expand';
3
+ export declare const transformationOptions: ({
4
+ title: {
5
+ id: string;
6
+ defaultMessage: string;
7
+ description: string;
8
+ };
9
+ icon: typeof EditorInfoIcon;
10
+ } | {
11
+ title: {
12
+ id: string;
13
+ defaultMessage: string;
14
+ description: string;
15
+ };
16
+ icon: typeof ExpandIcon;
17
+ })[];
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import { jsx } from '@emotion/react';
6
+ export default function ExpandIcon(): jsx.JSX.Element;
@@ -0,0 +1,17 @@
1
+ import EditorInfoIcon from '@atlaskit/icon/glyph/editor/info';
2
+ import ExpandIcon from '../assets/expand';
3
+ export declare const transformationOptions: ({
4
+ title: {
5
+ id: string;
6
+ defaultMessage: string;
7
+ description: string;
8
+ };
9
+ icon: typeof EditorInfoIcon;
10
+ } | {
11
+ title: {
12
+ id: string;
13
+ defaultMessage: string;
14
+ description: string;
15
+ };
16
+ icon: typeof ExpandIcon;
17
+ })[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-insert-block",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "Insert block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,7 +33,7 @@
33
33
  ".": "./src/index.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@atlaskit/editor-common": "^87.4.0",
36
+ "@atlaskit/editor-common": "^87.5.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^1.6.0",
38
38
  "@atlaskit/editor-plugin-block-type": "^3.11.0",
39
39
  "@atlaskit/editor-plugin-code-block": "^3.2.0",