@atlaskit/editor-plugin-insert-block 1.8.0 → 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 +18 -0
- package/dist/cjs/assets/expand.js +39 -0
- package/dist/cjs/plugin.js +18 -2
- package/dist/cjs/ui/transformOptions.js +32 -0
- package/dist/es2019/assets/expand.js +32 -0
- package/dist/es2019/plugin.js +20 -2
- package/dist/es2019/ui/transformOptions.js +25 -0
- package/dist/esm/assets/expand.js +32 -0
- package/dist/esm/plugin.js +18 -2
- package/dist/esm/ui/transformOptions.js +25 -0
- package/dist/types/assets/expand.d.ts +6 -0
- package/dist/types/ui/transformOptions.d.ts +21 -0
- package/dist/types-ts4.5/assets/expand.d.ts +6 -0
- package/dist/types-ts4.5/ui/transformOptions.d.ts +21 -0
- package/package.json +21 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
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
|
+
|
|
13
|
+
## 1.8.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#127194](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/127194)
|
|
18
|
+
[`8d7f9ef047d37`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8d7f9ef047d37) -
|
|
19
|
+
[ED-24504] Add dropdown options UI
|
|
20
|
+
|
|
3
21
|
## 1.8.0
|
|
4
22
|
|
|
5
23
|
### 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
|
+
}
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -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,27 @@ 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 = (0, _transformOptions.transformationOptions)(api).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(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);
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
});
|
|
130
146
|
return {
|
|
131
147
|
items: [{
|
|
132
148
|
type: 'dropdown',
|
|
133
|
-
title:
|
|
149
|
+
title: formatMessage(_messages.toolbarInsertBlockMessages.turnInto),
|
|
134
150
|
iconBefore: _switch.default,
|
|
135
|
-
options:
|
|
151
|
+
options: options
|
|
136
152
|
}],
|
|
137
153
|
rank: -9
|
|
138
154
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
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 = 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
|
+
};
|
|
@@ -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
|
+
}
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -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,29 @@ 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(api).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: (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);
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
});
|
|
119
137
|
return {
|
|
120
138
|
items: [{
|
|
121
139
|
type: 'dropdown',
|
|
122
|
-
title:
|
|
140
|
+
title: formatMessage(messages.turnInto),
|
|
123
141
|
iconBefore: SwitchIcon,
|
|
124
|
-
options
|
|
142
|
+
options
|
|
125
143
|
}],
|
|
126
144
|
rank: -9
|
|
127
145
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
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 = 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
|
+
};
|
|
@@ -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
|
+
}
|
package/dist/esm/plugin.js
CHANGED
|
@@ -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,27 @@ 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(api).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(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);
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
});
|
|
120
136
|
return {
|
|
121
137
|
items: [{
|
|
122
138
|
type: 'dropdown',
|
|
123
|
-
title:
|
|
139
|
+
title: formatMessage(messages.turnInto),
|
|
124
140
|
iconBefore: SwitchIcon,
|
|
125
|
-
options:
|
|
141
|
+
options: options
|
|
126
142
|
}],
|
|
127
143
|
rank: -9
|
|
128
144
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
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 = 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
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import QuoteIcon from '@atlaskit/icon/glyph/quote';
|
|
3
|
+
import ExpandIcon from '../assets/expand';
|
|
4
|
+
import type { InsertBlockPlugin } from '../plugin';
|
|
5
|
+
export declare const transformationOptions: (api: ExtractInjectionAPI<InsertBlockPlugin> | undefined) => ({
|
|
6
|
+
title: {
|
|
7
|
+
id: string;
|
|
8
|
+
defaultMessage: string;
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
icon: typeof ExpandIcon;
|
|
12
|
+
command: ((inputMethod: import("@atlaskit/editor-plugin-expand").InsertMethod) => import("@atlaskit/editor-common/types").Command) | undefined;
|
|
13
|
+
} | {
|
|
14
|
+
title: {
|
|
15
|
+
id: string;
|
|
16
|
+
defaultMessage: string;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
icon: typeof QuoteIcon;
|
|
20
|
+
command: ((inputMethod: import("@atlaskit/editor-plugin-block-type").InputMethod) => import("@atlaskit/editor-common/types").Command) | undefined;
|
|
21
|
+
})[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import QuoteIcon from '@atlaskit/icon/glyph/quote';
|
|
3
|
+
import ExpandIcon from '../assets/expand';
|
|
4
|
+
import type { InsertBlockPlugin } from '../plugin';
|
|
5
|
+
export declare const transformationOptions: (api: ExtractInjectionAPI<InsertBlockPlugin> | undefined) => ({
|
|
6
|
+
title: {
|
|
7
|
+
id: string;
|
|
8
|
+
defaultMessage: string;
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
icon: typeof ExpandIcon;
|
|
12
|
+
command: ((inputMethod: import("@atlaskit/editor-plugin-expand").InsertMethod) => import("@atlaskit/editor-common/types").Command) | undefined;
|
|
13
|
+
} | {
|
|
14
|
+
title: {
|
|
15
|
+
id: string;
|
|
16
|
+
defaultMessage: string;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
icon: typeof QuoteIcon;
|
|
20
|
+
command: ((inputMethod: import("@atlaskit/editor-plugin-block-type").InputMethod) => import("@atlaskit/editor-common/types").Command) | undefined;
|
|
21
|
+
})[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-insert-block",
|
|
3
|
-
"version": "1.8.
|
|
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.
|
|
37
|
-
"@atlaskit/editor-plugin-analytics": "^1.
|
|
38
|
-
"@atlaskit/editor-plugin-block-type": "^3.
|
|
39
|
-
"@atlaskit/editor-plugin-code-block": "^3.
|
|
40
|
-
"@atlaskit/editor-plugin-date": "^2.
|
|
41
|
-
"@atlaskit/editor-plugin-emoji": "^2.
|
|
42
|
-
"@atlaskit/editor-plugin-expand": "^2.
|
|
43
|
-
"@atlaskit/editor-plugin-extension": "^1.
|
|
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.
|
|
45
|
+
"@atlaskit/editor-plugin-hyperlink": "^2.8.0",
|
|
46
46
|
"@atlaskit/editor-plugin-image-upload": "^1.2.0",
|
|
47
|
-
"@atlaskit/editor-plugin-layout": "^1.
|
|
48
|
-
"@atlaskit/editor-plugin-media": "^1.
|
|
49
|
-
"@atlaskit/editor-plugin-mentions": "^2.
|
|
50
|
-
"@atlaskit/editor-plugin-panel": "^2.
|
|
51
|
-
"@atlaskit/editor-plugin-placeholder-text": "^1.
|
|
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.
|
|
55
|
-
"@atlaskit/editor-plugin-status": "^2.
|
|
56
|
-
"@atlaskit/editor-plugin-table": "^7.
|
|
57
|
-
"@atlaskit/editor-plugin-tasks-and-decisions": "^2.
|
|
58
|
-
"@atlaskit/editor-plugin-type-ahead": "^1.
|
|
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.
|
|
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",
|