@atlaskit/editor-plugin-insert-block 1.7.1 → 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 +21 -0
- package/dist/cjs/assets/expand.js +39 -0
- package/dist/cjs/assets/switch.js +30 -0
- package/dist/cjs/plugin.js +38 -0
- package/dist/cjs/ui/transformOptions.js +25 -0
- package/dist/es2019/assets/expand.js +32 -0
- package/dist/es2019/assets/switch.js +23 -0
- package/dist/es2019/plugin.js +40 -0
- package/dist/es2019/ui/transformOptions.js +18 -0
- package/dist/esm/assets/expand.js +32 -0
- package/dist/esm/assets/switch.js +23 -0
- package/dist/esm/plugin.js +38 -0
- package/dist/esm/ui/transformOptions.js +18 -0
- package/dist/types/assets/expand.d.ts +6 -0
- package/dist/types/assets/switch.d.ts +2 -0
- package/dist/types/types.d.ts +3 -1
- package/dist/types/ui/transformOptions.d.ts +17 -0
- package/dist/types-ts4.5/assets/expand.d.ts +6 -0
- package/dist/types-ts4.5/assets/switch.d.ts +2 -0
- package/dist/types-ts4.5/types.d.ts +3 -1
- package/dist/types-ts4.5/ui/transformOptions.d.ts +17 -0
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
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
|
+
|
|
11
|
+
## 1.8.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [`3ac0ae73c0d52`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3ac0ae73c0d52) -
|
|
16
|
+
[ED-24499] Add Turn into dropdown button to text selection toolbar for
|
|
17
|
+
platform_editor_basic_text_transformations experiment. This button will be used to provide options
|
|
18
|
+
to transform selected texts/inline nodes into other elements (e.g. expand) containing the content.
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
3
24
|
## 1.7.1
|
|
4
25
|
|
|
5
26
|
### Patch 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
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = SwitchIcon;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _svg = _interopRequireDefault(require("@atlaskit/icon/svg"));
|
|
10
|
+
function SwitchIcon() {
|
|
11
|
+
return /*#__PURE__*/_react.default.createElement(_svg.default, {
|
|
12
|
+
label: ""
|
|
13
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
14
|
+
d: "M6.003 16H8.998C9.26322 16 9.51757 15.8947 9.70511 15.7071C9.89264 15.5196 9.998 15.2652 9.998 15C9.998 14.7348 9.89264 14.4805 9.70511 14.2929C9.51757 14.1054 9.26322 14 8.998 14H5.102C4.494 14 4 14.493 4 15.1V19C4 19.2656 4.10551 19.5204 4.29333 19.7082C4.48115 19.896 4.73589 20.0015 5.0015 20.0015C5.26711 20.0015 5.52185 19.896 5.70967 19.7082C5.89748 19.5204 6.003 19.2656 6.003 19V16Z",
|
|
15
|
+
fill: "var(--ds-icon, #44546F)"
|
|
16
|
+
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
17
|
+
d: "M18.018 14.572C16.989 16.649 14.807 18 12.37 18C10.104 18 8.051 16.833 6.945 14.98C6.659 14.5 6.023 14.334 5.524 14.609C5.40677 14.6709 5.30331 14.7559 5.21991 14.8589C5.13651 14.9619 5.0749 15.0808 5.0388 15.2083C5.00271 15.3359 4.99289 15.4694 5.00994 15.6009C5.027 15.7323 5.07056 15.8589 5.138 15.973C6.611 18.443 9.35 20 12.37 20C15.618 20 18.528 18.198 19.899 15.43C20.146 14.932 19.925 14.335 19.406 14.098C18.886 13.861 18.265 14.073 18.018 14.572Z",
|
|
18
|
+
fill: "var(--ds-icon, #44546F)"
|
|
19
|
+
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
20
|
+
fillRule: "evenodd",
|
|
21
|
+
clipRule: "evenodd",
|
|
22
|
+
d: "M15.002 10L18.898 10C19.506 10 20 9.50703 20 8.90003V5.00003C20 4.73441 19.8945 4.47968 19.7067 4.29186C19.5188 4.10404 19.2641 3.99853 18.9985 3.99853C18.7329 3.99853 18.4782 4.10404 18.2903 4.29186C18.1025 4.47968 17.997 4.73441 17.997 5.00003V8.00003H15.002C14.7368 8.00003 14.4824 8.10538 14.2949 8.29292C14.1074 8.48046 14.002 8.73481 14.002 9.00003C14.002 9.26524 14.1074 9.5196 14.2949 9.70713C14.4824 9.89467 14.7368 10 15.002 10Z",
|
|
23
|
+
fill: "var(--ds-icon, #44546F)"
|
|
24
|
+
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
25
|
+
fillRule: "evenodd",
|
|
26
|
+
clipRule: "evenodd",
|
|
27
|
+
d: "M4.596 9.90303C5.116 10.14 5.736 9.92803 5.983 9.42903C7.012 7.35203 9.193 6.00103 11.63 6.00103C13.896 6.00103 15.95 7.16803 17.055 9.02203C17.1988 9.25438 17.4265 9.42245 17.6909 9.49135C17.9553 9.56024 18.2361 9.52468 18.475 9.39203C18.975 9.11803 19.148 8.50703 18.862 8.02803C17.389 5.55803 14.65 4.00103 11.63 4.00103C8.382 4.00103 5.472 5.80303 4.102 8.57103C4.03537 8.70353 4.00045 8.84971 4 8.99803C4.00188 9.1902 4.05909 9.37775 4.16479 9.53825C4.27049 9.69875 4.4202 9.8254 4.596 9.90303Z",
|
|
28
|
+
fill: "var(--ds-icon, #44546F)"
|
|
29
|
+
}));
|
|
30
|
+
}
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -9,10 +9,13 @@ exports.insertBlockPlugin = void 0;
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
11
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
12
13
|
var _providerFactory = require("@atlaskit/editor-common/provider-factory");
|
|
13
14
|
var _types = require("@atlaskit/editor-common/types");
|
|
14
15
|
var _consts = require("@atlaskit/editor-plugin-block-type/consts");
|
|
16
|
+
var _switch = _interopRequireDefault(require("./assets/switch"));
|
|
15
17
|
var _ToolbarInsertBlock = _interopRequireDefault(require("./ui/ToolbarInsertBlock"));
|
|
18
|
+
var _transformOptions = require("./ui/transformOptions");
|
|
16
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); }
|
|
17
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; }
|
|
18
21
|
var toolbarSizeToButtons = function toolbarSizeToButtons(toolbarSize) {
|
|
@@ -114,6 +117,41 @@ var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_
|
|
|
114
117
|
toggle();
|
|
115
118
|
}
|
|
116
119
|
},
|
|
120
|
+
pluginsOptions: {
|
|
121
|
+
// This is added for basic text transformations experiment.
|
|
122
|
+
// This may not be the most ideal plugin to add this to, but it is suitable for experiment purpose
|
|
123
|
+
// as relevant plugin dependencies are already set up.
|
|
124
|
+
// If we decide to ship the feature, we will consider a separate plugin if needed.
|
|
125
|
+
// Experiment one-pager: https://hello.atlassian.net/wiki/spaces/ETM/pages/3931754727/Experiment+Elements+Basic+Text+Transformations
|
|
126
|
+
selectionToolbar: function selectionToolbar(_, intl) {
|
|
127
|
+
var _api$featureFlags;
|
|
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)) {
|
|
129
|
+
return;
|
|
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
|
+
});
|
|
144
|
+
return {
|
|
145
|
+
items: [{
|
|
146
|
+
type: 'dropdown',
|
|
147
|
+
title: formatMessage(_messages.toolbarInsertBlockMessages.turnInto),
|
|
148
|
+
iconBefore: _switch.default,
|
|
149
|
+
options: options
|
|
150
|
+
}],
|
|
151
|
+
rank: -9
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
},
|
|
117
155
|
usePluginHook: function usePluginHook() {
|
|
118
156
|
(0, _react.useLayoutEffect)(function () {
|
|
119
157
|
return function () {
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import SVG from '@atlaskit/icon/svg';
|
|
3
|
+
export default function SwitchIcon() {
|
|
4
|
+
return /*#__PURE__*/React.createElement(SVG, {
|
|
5
|
+
label: ""
|
|
6
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
7
|
+
d: "M6.003 16H8.998C9.26322 16 9.51757 15.8947 9.70511 15.7071C9.89264 15.5196 9.998 15.2652 9.998 15C9.998 14.7348 9.89264 14.4805 9.70511 14.2929C9.51757 14.1054 9.26322 14 8.998 14H5.102C4.494 14 4 14.493 4 15.1V19C4 19.2656 4.10551 19.5204 4.29333 19.7082C4.48115 19.896 4.73589 20.0015 5.0015 20.0015C5.26711 20.0015 5.52185 19.896 5.70967 19.7082C5.89748 19.5204 6.003 19.2656 6.003 19V16Z",
|
|
8
|
+
fill: "var(--ds-icon, #44546F)"
|
|
9
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
10
|
+
d: "M18.018 14.572C16.989 16.649 14.807 18 12.37 18C10.104 18 8.051 16.833 6.945 14.98C6.659 14.5 6.023 14.334 5.524 14.609C5.40677 14.6709 5.30331 14.7559 5.21991 14.8589C5.13651 14.9619 5.0749 15.0808 5.0388 15.2083C5.00271 15.3359 4.99289 15.4694 5.00994 15.6009C5.027 15.7323 5.07056 15.8589 5.138 15.973C6.611 18.443 9.35 20 12.37 20C15.618 20 18.528 18.198 19.899 15.43C20.146 14.932 19.925 14.335 19.406 14.098C18.886 13.861 18.265 14.073 18.018 14.572Z",
|
|
11
|
+
fill: "var(--ds-icon, #44546F)"
|
|
12
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
13
|
+
fillRule: "evenodd",
|
|
14
|
+
clipRule: "evenodd",
|
|
15
|
+
d: "M15.002 10L18.898 10C19.506 10 20 9.50703 20 8.90003V5.00003C20 4.73441 19.8945 4.47968 19.7067 4.29186C19.5188 4.10404 19.2641 3.99853 18.9985 3.99853C18.7329 3.99853 18.4782 4.10404 18.2903 4.29186C18.1025 4.47968 17.997 4.73441 17.997 5.00003V8.00003H15.002C14.7368 8.00003 14.4824 8.10538 14.2949 8.29292C14.1074 8.48046 14.002 8.73481 14.002 9.00003C14.002 9.26524 14.1074 9.5196 14.2949 9.70713C14.4824 9.89467 14.7368 10 15.002 10Z",
|
|
16
|
+
fill: "var(--ds-icon, #44546F)"
|
|
17
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
18
|
+
fillRule: "evenodd",
|
|
19
|
+
clipRule: "evenodd",
|
|
20
|
+
d: "M4.596 9.90303C5.116 10.14 5.736 9.92803 5.983 9.42903C7.012 7.35203 9.193 6.00103 11.63 6.00103C13.896 6.00103 15.95 7.16803 17.055 9.02203C17.1988 9.25438 17.4265 9.42245 17.6909 9.49135C17.9553 9.56024 18.2361 9.52468 18.475 9.39203C18.975 9.11803 19.148 8.50703 18.862 8.02803C17.389 5.55803 14.65 4.00103 11.63 4.00103C8.382 4.00103 5.472 5.80303 4.102 8.57103C4.03537 8.70353 4.00045 8.84971 4 8.99803C4.00188 9.1902 4.05909 9.37775 4.16479 9.53825C4.27049 9.69875 4.4202 9.8254 4.596 9.90303Z",
|
|
21
|
+
fill: "var(--ds-icon, #44546F)"
|
|
22
|
+
}));
|
|
23
|
+
}
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import React, { useLayoutEffect } from 'react';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
5
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
5
6
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
6
7
|
import { BLOCK_QUOTE, CODE_BLOCK, PANEL } from '@atlaskit/editor-plugin-block-type/consts';
|
|
8
|
+
import SwitchIcon from './assets/switch';
|
|
7
9
|
import ToolbarInsertBlock from './ui/ToolbarInsertBlock';
|
|
10
|
+
import { transformationOptions } from './ui/transformOptions';
|
|
8
11
|
const toolbarSizeToButtons = toolbarSize => {
|
|
9
12
|
switch (toolbarSize) {
|
|
10
13
|
case ToolbarSize.XXL:
|
|
@@ -103,6 +106,43 @@ export const insertBlockPlugin = ({
|
|
|
103
106
|
toggle();
|
|
104
107
|
}
|
|
105
108
|
},
|
|
109
|
+
pluginsOptions: {
|
|
110
|
+
// This is added for basic text transformations experiment.
|
|
111
|
+
// This may not be the most ideal plugin to add this to, but it is suitable for experiment purpose
|
|
112
|
+
// as relevant plugin dependencies are already set up.
|
|
113
|
+
// If we decide to ship the feature, we will consider a separate plugin if needed.
|
|
114
|
+
// Experiment one-pager: https://hello.atlassian.net/wiki/spaces/ETM/pages/3931754727/Experiment+Elements+Basic+Text+Transformations
|
|
115
|
+
selectionToolbar: (_, intl) => {
|
|
116
|
+
var _api$featureFlags, _api$featureFlags$sha;
|
|
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)) {
|
|
118
|
+
return;
|
|
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
|
+
});
|
|
135
|
+
return {
|
|
136
|
+
items: [{
|
|
137
|
+
type: 'dropdown',
|
|
138
|
+
title: formatMessage(messages.turnInto),
|
|
139
|
+
iconBefore: SwitchIcon,
|
|
140
|
+
options
|
|
141
|
+
}],
|
|
142
|
+
rank: -9
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
},
|
|
106
146
|
usePluginHook: () => {
|
|
107
147
|
useLayoutEffect(() => {
|
|
108
148
|
return () => {
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import SVG from '@atlaskit/icon/svg';
|
|
3
|
+
export default function SwitchIcon() {
|
|
4
|
+
return /*#__PURE__*/React.createElement(SVG, {
|
|
5
|
+
label: ""
|
|
6
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
7
|
+
d: "M6.003 16H8.998C9.26322 16 9.51757 15.8947 9.70511 15.7071C9.89264 15.5196 9.998 15.2652 9.998 15C9.998 14.7348 9.89264 14.4805 9.70511 14.2929C9.51757 14.1054 9.26322 14 8.998 14H5.102C4.494 14 4 14.493 4 15.1V19C4 19.2656 4.10551 19.5204 4.29333 19.7082C4.48115 19.896 4.73589 20.0015 5.0015 20.0015C5.26711 20.0015 5.52185 19.896 5.70967 19.7082C5.89748 19.5204 6.003 19.2656 6.003 19V16Z",
|
|
8
|
+
fill: "var(--ds-icon, #44546F)"
|
|
9
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
10
|
+
d: "M18.018 14.572C16.989 16.649 14.807 18 12.37 18C10.104 18 8.051 16.833 6.945 14.98C6.659 14.5 6.023 14.334 5.524 14.609C5.40677 14.6709 5.30331 14.7559 5.21991 14.8589C5.13651 14.9619 5.0749 15.0808 5.0388 15.2083C5.00271 15.3359 4.99289 15.4694 5.00994 15.6009C5.027 15.7323 5.07056 15.8589 5.138 15.973C6.611 18.443 9.35 20 12.37 20C15.618 20 18.528 18.198 19.899 15.43C20.146 14.932 19.925 14.335 19.406 14.098C18.886 13.861 18.265 14.073 18.018 14.572Z",
|
|
11
|
+
fill: "var(--ds-icon, #44546F)"
|
|
12
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
13
|
+
fillRule: "evenodd",
|
|
14
|
+
clipRule: "evenodd",
|
|
15
|
+
d: "M15.002 10L18.898 10C19.506 10 20 9.50703 20 8.90003V5.00003C20 4.73441 19.8945 4.47968 19.7067 4.29186C19.5188 4.10404 19.2641 3.99853 18.9985 3.99853C18.7329 3.99853 18.4782 4.10404 18.2903 4.29186C18.1025 4.47968 17.997 4.73441 17.997 5.00003V8.00003H15.002C14.7368 8.00003 14.4824 8.10538 14.2949 8.29292C14.1074 8.48046 14.002 8.73481 14.002 9.00003C14.002 9.26524 14.1074 9.5196 14.2949 9.70713C14.4824 9.89467 14.7368 10 15.002 10Z",
|
|
16
|
+
fill: "var(--ds-icon, #44546F)"
|
|
17
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
18
|
+
fillRule: "evenodd",
|
|
19
|
+
clipRule: "evenodd",
|
|
20
|
+
d: "M4.596 9.90303C5.116 10.14 5.736 9.92803 5.983 9.42903C7.012 7.35203 9.193 6.00103 11.63 6.00103C13.896 6.00103 15.95 7.16803 17.055 9.02203C17.1988 9.25438 17.4265 9.42245 17.6909 9.49135C17.9553 9.56024 18.2361 9.52468 18.475 9.39203C18.975 9.11803 19.148 8.50703 18.862 8.02803C17.389 5.55803 14.65 4.00103 11.63 4.00103C8.382 4.00103 5.472 5.80303 4.102 8.57103C4.03537 8.70353 4.00045 8.84971 4 8.99803C4.00188 9.1902 4.05909 9.37775 4.16479 9.53825C4.27049 9.69875 4.4202 9.8254 4.596 9.90303Z",
|
|
21
|
+
fill: "var(--ds-icon, #44546F)"
|
|
22
|
+
}));
|
|
23
|
+
}
|
package/dist/esm/plugin.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import React, { useLayoutEffect } from 'react';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
5
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
5
6
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
6
7
|
import { BLOCK_QUOTE, CODE_BLOCK, PANEL } from '@atlaskit/editor-plugin-block-type/consts';
|
|
8
|
+
import SwitchIcon from './assets/switch';
|
|
7
9
|
import ToolbarInsertBlock from './ui/ToolbarInsertBlock';
|
|
10
|
+
import { transformationOptions } from './ui/transformOptions';
|
|
8
11
|
var toolbarSizeToButtons = function toolbarSizeToButtons(toolbarSize) {
|
|
9
12
|
switch (toolbarSize) {
|
|
10
13
|
case ToolbarSize.XXL:
|
|
@@ -104,6 +107,41 @@ export var insertBlockPlugin = function insertBlockPlugin(_ref) {
|
|
|
104
107
|
toggle();
|
|
105
108
|
}
|
|
106
109
|
},
|
|
110
|
+
pluginsOptions: {
|
|
111
|
+
// This is added for basic text transformations experiment.
|
|
112
|
+
// This may not be the most ideal plugin to add this to, but it is suitable for experiment purpose
|
|
113
|
+
// as relevant plugin dependencies are already set up.
|
|
114
|
+
// If we decide to ship the feature, we will consider a separate plugin if needed.
|
|
115
|
+
// Experiment one-pager: https://hello.atlassian.net/wiki/spaces/ETM/pages/3931754727/Experiment+Elements+Basic+Text+Transformations
|
|
116
|
+
selectionToolbar: function selectionToolbar(_, intl) {
|
|
117
|
+
var _api$featureFlags;
|
|
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)) {
|
|
119
|
+
return;
|
|
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
|
+
});
|
|
134
|
+
return {
|
|
135
|
+
items: [{
|
|
136
|
+
type: 'dropdown',
|
|
137
|
+
title: formatMessage(messages.turnInto),
|
|
138
|
+
iconBefore: SwitchIcon,
|
|
139
|
+
options: options
|
|
140
|
+
}],
|
|
141
|
+
rank: -9
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
},
|
|
107
145
|
usePluginHook: function usePluginHook() {
|
|
108
146
|
useLayoutEffect(function () {
|
|
109
147
|
return function () {
|
|
@@ -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
|
+
}];
|
package/dist/types/types.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { DatePlugin } from '@atlaskit/editor-plugin-date';
|
|
|
6
6
|
import type { EmojiPlugin } from '@atlaskit/editor-plugin-emoji';
|
|
7
7
|
import type { ExpandPlugin } from '@atlaskit/editor-plugin-expand';
|
|
8
8
|
import type { ExtensionPlugin } from '@atlaskit/editor-plugin-extension';
|
|
9
|
+
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
9
10
|
import type { HyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
|
|
10
11
|
import type { ImageUploadPlugin } from '@atlaskit/editor-plugin-image-upload';
|
|
11
12
|
import type { LayoutPlugin } from '@atlaskit/editor-plugin-layout';
|
|
@@ -41,5 +42,6 @@ export type InsertBlockPluginDependencies = [
|
|
|
41
42
|
OptionalPlugin<PlaceholderTextPlugin>,
|
|
42
43
|
OptionalPlugin<ExtensionPlugin>,
|
|
43
44
|
OptionalPlugin<TasksAndDecisionsPlugin>,
|
|
44
|
-
OptionalPlugin<PrimaryToolbarPlugin
|
|
45
|
+
OptionalPlugin<PrimaryToolbarPlugin>,
|
|
46
|
+
OptionalPlugin<FeatureFlagsPlugin>
|
|
45
47
|
];
|
|
@@ -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
|
+
})[];
|
|
@@ -6,6 +6,7 @@ import type { DatePlugin } from '@atlaskit/editor-plugin-date';
|
|
|
6
6
|
import type { EmojiPlugin } from '@atlaskit/editor-plugin-emoji';
|
|
7
7
|
import type { ExpandPlugin } from '@atlaskit/editor-plugin-expand';
|
|
8
8
|
import type { ExtensionPlugin } from '@atlaskit/editor-plugin-extension';
|
|
9
|
+
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
9
10
|
import type { HyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
|
|
10
11
|
import type { ImageUploadPlugin } from '@atlaskit/editor-plugin-image-upload';
|
|
11
12
|
import type { LayoutPlugin } from '@atlaskit/editor-plugin-layout';
|
|
@@ -41,5 +42,6 @@ export type InsertBlockPluginDependencies = [
|
|
|
41
42
|
OptionalPlugin<PlaceholderTextPlugin>,
|
|
42
43
|
OptionalPlugin<ExtensionPlugin>,
|
|
43
44
|
OptionalPlugin<TasksAndDecisionsPlugin>,
|
|
44
|
-
OptionalPlugin<PrimaryToolbarPlugin
|
|
45
|
+
OptionalPlugin<PrimaryToolbarPlugin>,
|
|
46
|
+
OptionalPlugin<FeatureFlagsPlugin>
|
|
45
47
|
];
|
|
@@ -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.
|
|
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.
|
|
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",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"@atlaskit/editor-plugin-emoji": "^2.2.0",
|
|
42
42
|
"@atlaskit/editor-plugin-expand": "^2.2.0",
|
|
43
43
|
"@atlaskit/editor-plugin-extension": "^1.12.0",
|
|
44
|
+
"@atlaskit/editor-plugin-feature-flags": "^1.2.0",
|
|
44
45
|
"@atlaskit/editor-plugin-hyperlink": "^2.7.0",
|
|
45
46
|
"@atlaskit/editor-plugin-image-upload": "^1.2.0",
|
|
46
47
|
"@atlaskit/editor-plugin-layout": "^1.6.0",
|