@atlaskit/renderer 108.20.8 → 108.20.9
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 +6 -0
- package/dist/cjs/react/nodes/extensionFrame.js +25 -0
- package/dist/cjs/react/nodes/index.js +16 -0
- package/dist/cjs/react/nodes/multiBodiedExtension.js +108 -0
- package/dist/cjs/ui/ExtensionRenderer.js +3 -2
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/es2019/react/nodes/extensionFrame.js +20 -0
- package/dist/es2019/react/nodes/index.js +5 -1
- package/dist/es2019/react/nodes/multiBodiedExtension.js +121 -0
- package/dist/es2019/ui/ExtensionRenderer.js +3 -2
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/esm/react/nodes/extensionFrame.js +19 -0
- package/dist/esm/react/nodes/index.js +5 -1
- package/dist/esm/react/nodes/multiBodiedExtension.js +99 -0
- package/dist/esm/ui/ExtensionRenderer.js +3 -2
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/types/react/nodes/extensionFrame.d.ts +24 -0
- package/dist/types/react/nodes/index.d.ts +14 -8
- package/dist/types/react/nodes/multiBodiedExtension.d.ts +25 -0
- package/dist/types/ui/ExtensionRenderer.d.ts +2 -1
- package/dist/types-ts4.5/react/nodes/extensionFrame.d.ts +24 -0
- package/dist/types-ts4.5/react/nodes/index.d.ts +14 -8
- package/dist/types-ts4.5/react/nodes/multiBodiedExtension.d.ts +25 -0
- package/dist/types-ts4.5/ui/ExtensionRenderer.d.ts +2 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 108.20.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#60504](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/60504) [`fdd20fa0201f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fdd20fa0201f) - ED-21506: multiBodiedExtension- Fix issues with Renderer
|
|
8
|
+
|
|
3
9
|
## 108.20.8
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -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.default = void 0;
|
|
8
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
+
var _react = require("@emotion/react");
|
|
10
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
11
|
+
var _react2 = _interopRequireDefault(require("react"));
|
|
12
|
+
var _templateObject;
|
|
13
|
+
/** @jsx jsx */
|
|
14
|
+
var ExtensionFrame = function ExtensionFrame(props) {
|
|
15
|
+
var containerCSS = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n border: 1px solid ", ";\n min-height: 100px;\n "])), "var(--ds-border, ".concat(_colors.N30, ")"));
|
|
16
|
+
return (0, _react.jsx)("div", {
|
|
17
|
+
css: containerCSS,
|
|
18
|
+
className: "extension-frame",
|
|
19
|
+
"data-extension-frame": "true",
|
|
20
|
+
style: {
|
|
21
|
+
flexBasis: "100%"
|
|
22
|
+
}
|
|
23
|
+
}, props.children);
|
|
24
|
+
};
|
|
25
|
+
var _default = exports.default = ExtensionFrame;
|
|
@@ -49,6 +49,12 @@ Object.defineProperty(exports, "Extension", {
|
|
|
49
49
|
return _extension.default;
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
|
+
Object.defineProperty(exports, "ExtensionFrame", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function get() {
|
|
55
|
+
return _extensionFrame.default;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
52
58
|
Object.defineProperty(exports, "HardBreak", {
|
|
53
59
|
enumerable: true,
|
|
54
60
|
get: function get() {
|
|
@@ -87,6 +93,12 @@ Object.defineProperty(exports, "ListItem", {
|
|
|
87
93
|
}
|
|
88
94
|
});
|
|
89
95
|
exports.Mention = exports.MediaSingle = exports.MediaInline = exports.MediaGroup = exports.Media = void 0;
|
|
96
|
+
Object.defineProperty(exports, "MultiBodiedExtension", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function get() {
|
|
99
|
+
return _multiBodiedExtension.default;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
90
102
|
Object.defineProperty(exports, "OrderedList", {
|
|
91
103
|
enumerable: true,
|
|
92
104
|
get: function get() {
|
|
@@ -146,6 +158,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
146
158
|
var _reactLoadable = _interopRequireDefault(require("react-loadable"));
|
|
147
159
|
var _blockquote = _interopRequireDefault(require("./blockquote"));
|
|
148
160
|
var _bodiedExtension = _interopRequireDefault(require("./bodiedExtension"));
|
|
161
|
+
var _multiBodiedExtension = _interopRequireDefault(require("./multiBodiedExtension"));
|
|
162
|
+
var _extensionFrame = _interopRequireDefault(require("./extensionFrame"));
|
|
149
163
|
var _bulletList = _interopRequireDefault(require("./bulletList"));
|
|
150
164
|
var _doc = _interopRequireWildcard(require("./doc"));
|
|
151
165
|
var _extension = _interopRequireDefault(require("./extension"));
|
|
@@ -428,6 +442,8 @@ var nodeToReact = exports.nodeToReact = {
|
|
|
428
442
|
emoji: Emoji,
|
|
429
443
|
extension: _extension.default,
|
|
430
444
|
bodiedExtension: _bodiedExtension.default,
|
|
445
|
+
multiBodiedExtension: _multiBodiedExtension.default,
|
|
446
|
+
extensionFrame: _extensionFrame.default,
|
|
431
447
|
hardBreak: _hardBreak.default,
|
|
432
448
|
heading: _heading.default,
|
|
433
449
|
inlineCard: InlineCard,
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
12
|
+
var _react = require("@emotion/react");
|
|
13
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
14
|
+
var _react2 = _interopRequireWildcard(require("react"));
|
|
15
|
+
var _extension = require("./extension");
|
|
16
|
+
var _ExtensionRenderer = _interopRequireDefault(require("../../ui/ExtensionRenderer"));
|
|
17
|
+
var _templateObject, _templateObject2;
|
|
18
|
+
/** @jsx jsx */
|
|
19
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
var useMultiBodiedExtensionActions = function useMultiBodiedExtensionActions(_ref) {
|
|
22
|
+
var updateActiveChild = _ref.updateActiveChild,
|
|
23
|
+
children = _ref.children;
|
|
24
|
+
var actions = _react2.default.useMemo(function () {
|
|
25
|
+
return {
|
|
26
|
+
changeActive: function changeActive(index) {
|
|
27
|
+
return updateActiveChild(index);
|
|
28
|
+
},
|
|
29
|
+
addChild: function addChild() {
|
|
30
|
+
return false;
|
|
31
|
+
},
|
|
32
|
+
getChildrenCount: function getChildrenCount() {
|
|
33
|
+
return children ? children === null || children === void 0 ? void 0 : children.length : 0;
|
|
34
|
+
},
|
|
35
|
+
removeChild: function removeChild(index) {
|
|
36
|
+
return false;
|
|
37
|
+
},
|
|
38
|
+
updateParameters: function updateParameters(parameters) {
|
|
39
|
+
return false;
|
|
40
|
+
},
|
|
41
|
+
getChildren: function getChildren() {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}, [updateActiveChild, children]);
|
|
46
|
+
return actions;
|
|
47
|
+
};
|
|
48
|
+
var navigationCSS = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n // make sure the user can't see a range selection inside the navigation\n // This is really important to keep the navigation working properly\n user-select: none;\n -webkit-user-modify: read-only;\n border: 1px solid ", ";\n background-color: ", ";\n\n .mbe-add-tab-button,\n .mbe-remove-tab {\n display: none;\n }\n"])), "var(--ds-border, ".concat(_colors.N40, ")"), "var(--ds-background-inverse-subtle, ".concat(_colors.N50, ")"));
|
|
49
|
+
var MultiBodiedExtension = function MultiBodiedExtension(props) {
|
|
50
|
+
var children = props.children,
|
|
51
|
+
_props$layout = props.layout,
|
|
52
|
+
layout = _props$layout === void 0 ? 'default' : _props$layout,
|
|
53
|
+
_props$path = props.path,
|
|
54
|
+
path = _props$path === void 0 ? [] : _props$path;
|
|
55
|
+
var _useState = (0, _react2.useState)(0),
|
|
56
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
57
|
+
activeChildIndex = _useState2[0],
|
|
58
|
+
setActiveChildIndex = _useState2[1];
|
|
59
|
+
var updateActiveChild = _react2.default.useCallback(function (index) {
|
|
60
|
+
if (typeof index !== 'number') {
|
|
61
|
+
// TODO: Make sure we log this somewhere if this happens
|
|
62
|
+
setActiveChildIndex(0);
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
setActiveChildIndex(index);
|
|
66
|
+
return true;
|
|
67
|
+
}, [setActiveChildIndex]);
|
|
68
|
+
var actions = useMultiBodiedExtensionActions({
|
|
69
|
+
updateActiveChild: updateActiveChild,
|
|
70
|
+
children: children
|
|
71
|
+
});
|
|
72
|
+
var containerCSS = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n border: 1px solid ", ";\n min-height: 100px;\n\n .multiBodiedExtension--frames > [data-extension-frame='true'] {\n display: none;\n }\n\n .multiBodiedExtension--frames\n > [data-extension-frame='true']:nth-of-type(", ") {\n border: 1px solid ", ";\n display: block;\n min-height: 100px;\n }\n "])), "var(--ds-border, ".concat(_colors.N30, ")"), activeChildIndex + 1, "var(--ds-border, ".concat(_colors.N50, ")"));
|
|
73
|
+
return (0, _react.jsx)("section", {
|
|
74
|
+
className: "multiBodiedExtension--container",
|
|
75
|
+
css: containerCSS,
|
|
76
|
+
"data-testid": "multiBodiedExtension--container",
|
|
77
|
+
"data-active-child-index": activeChildIndex
|
|
78
|
+
}, (0, _react.jsx)("nav", {
|
|
79
|
+
className: "multiBodiedExtension-navigation",
|
|
80
|
+
css: navigationCSS,
|
|
81
|
+
"data-testid": "multiBodiedExtension-navigation"
|
|
82
|
+
}, (0, _react.jsx)(_ExtensionRenderer.default, (0, _extends2.default)({}, props, {
|
|
83
|
+
actions: actions,
|
|
84
|
+
type: "multiBodiedExtension"
|
|
85
|
+
}), function (_ref2) {
|
|
86
|
+
var result = _ref2.result;
|
|
87
|
+
try {
|
|
88
|
+
if (result && /*#__PURE__*/_react2.default.isValidElement(result)) {
|
|
89
|
+
// Return the content directly if it's a valid JSX.Element
|
|
90
|
+
return (0, _extension.renderExtension)(result, layout, {
|
|
91
|
+
isTopLevel: path.length < 1
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
} catch (e) {
|
|
95
|
+
/** We don't want this error to block renderer */
|
|
96
|
+
/** We keep rendering the default content */
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Always return default content if anything goes wrong
|
|
100
|
+
return (0, _extension.renderExtension)(children, layout, {
|
|
101
|
+
isTopLevel: path.length < 1
|
|
102
|
+
});
|
|
103
|
+
})), (0, _react.jsx)("article", {
|
|
104
|
+
className: "multiBodiedExtension--frames",
|
|
105
|
+
"data-testid": "multiBodiedExtension--frames"
|
|
106
|
+
}, children));
|
|
107
|
+
};
|
|
108
|
+
var _default = exports.default = MultiBodiedExtension;
|
|
@@ -41,7 +41,7 @@ var ExtensionRenderer = exports.default = /*#__PURE__*/function (_React$Componen
|
|
|
41
41
|
});
|
|
42
42
|
});
|
|
43
43
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getNodeRenderer", (0, _memoizeOne.default)(_extensions.getNodeRenderer));
|
|
44
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderExtensionNode", function (extensionProvider
|
|
44
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderExtensionNode", function (extensionProvider) {
|
|
45
45
|
var _marks$find;
|
|
46
46
|
var _this$props = _this.props,
|
|
47
47
|
extensionHandlers = _this$props.extensionHandlers,
|
|
@@ -53,7 +53,8 @@ var ExtensionRenderer = exports.default = /*#__PURE__*/function (_React$Componen
|
|
|
53
53
|
text = _this$props.text,
|
|
54
54
|
type = _this$props.type,
|
|
55
55
|
localId = _this$props.localId,
|
|
56
|
-
marks = _this$props.marks
|
|
56
|
+
marks = _this$props.marks,
|
|
57
|
+
actions = _this$props.actions;
|
|
57
58
|
var fragmentLocalId = marks === null || marks === void 0 || (_marks$find = marks.find(function (m) {
|
|
58
59
|
return m.type.name === 'fragment';
|
|
59
60
|
})) === null || _marks$find === void 0 || (_marks$find = _marks$find.attrs) === null || _marks$find === void 0 ? void 0 : _marks$find.localId;
|
|
@@ -53,7 +53,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
53
53
|
var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
54
54
|
var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
55
55
|
var packageName = "@atlaskit/renderer";
|
|
56
|
-
var packageVersion = "108.20.
|
|
56
|
+
var packageVersion = "108.20.9";
|
|
57
57
|
var Renderer = exports.Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
58
58
|
(0, _inherits2.default)(Renderer, _PureComponent);
|
|
59
59
|
var _super = _createSuper(Renderer);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
|
|
3
|
+
import { jsx, css } from '@emotion/react';
|
|
4
|
+
import { N30 } from '@atlaskit/theme/colors';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
const ExtensionFrame = props => {
|
|
7
|
+
const containerCSS = css`
|
|
8
|
+
border: 1px solid ${`var(--ds-border, ${N30})`};
|
|
9
|
+
min-height: 100px;
|
|
10
|
+
`;
|
|
11
|
+
return jsx("div", {
|
|
12
|
+
css: containerCSS,
|
|
13
|
+
className: "extension-frame",
|
|
14
|
+
"data-extension-frame": "true",
|
|
15
|
+
style: {
|
|
16
|
+
flexBasis: `100%`
|
|
17
|
+
}
|
|
18
|
+
}, props.children);
|
|
19
|
+
};
|
|
20
|
+
export default ExtensionFrame;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import Loadable from 'react-loadable';
|
|
2
2
|
import Blockquote from './blockquote';
|
|
3
3
|
import BodiedExtension from './bodiedExtension';
|
|
4
|
+
import MultiBodiedExtension from './multiBodiedExtension';
|
|
5
|
+
import ExtensionFrame from './extensionFrame';
|
|
4
6
|
import BulletList from './bulletList';
|
|
5
7
|
import Doc, { DocWithSelectAllTrap } from './doc';
|
|
6
8
|
import Extension from './extension';
|
|
@@ -127,6 +129,8 @@ export const nodeToReact = {
|
|
|
127
129
|
emoji: Emoji,
|
|
128
130
|
extension: Extension,
|
|
129
131
|
bodiedExtension: BodiedExtension,
|
|
132
|
+
multiBodiedExtension: MultiBodiedExtension,
|
|
133
|
+
extensionFrame: ExtensionFrame,
|
|
130
134
|
hardBreak: HardBreak,
|
|
131
135
|
heading: Heading,
|
|
132
136
|
inlineCard: InlineCard,
|
|
@@ -294,4 +298,4 @@ const isEmojiBlock = pnode => {
|
|
|
294
298
|
}
|
|
295
299
|
return emojiCount > 0;
|
|
296
300
|
};
|
|
297
|
-
export { Blockquote, BodiedExtension, BulletList, BlockCard, Caption, CodeBlock, WindowedCodeBlock, Date, DecisionItem, DecisionList, Doc, DocWithSelectAllTrap, Emoji, Extension, Expand, HardBreak, Heading, ListItem, InlineCard, InlineExtension, LayoutSection, LayoutColumn, Media, MediaGroup, MediaInline, MediaSingle, Mention, OrderedList, Panel, Paragraph, Placeholder, Rule, Status, TaskItem, TaskList, Table, TableCell, TableRow, UnknownBlock, EmbedCard };
|
|
301
|
+
export { Blockquote, BodiedExtension, BulletList, BlockCard, Caption, CodeBlock, WindowedCodeBlock, Date, DecisionItem, DecisionList, Doc, DocWithSelectAllTrap, Emoji, Extension, ExtensionFrame, Expand, HardBreak, Heading, ListItem, InlineCard, InlineExtension, LayoutSection, LayoutColumn, Media, MediaGroup, MediaInline, MediaSingle, Mention, MultiBodiedExtension, OrderedList, Panel, Paragraph, Placeholder, Rule, Status, TaskItem, TaskList, Table, TableCell, TableRow, UnknownBlock, EmbedCard };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
|
|
4
|
+
import { jsx, css } from '@emotion/react';
|
|
5
|
+
import { N30, N40, N50 } from '@atlaskit/theme/colors';
|
|
6
|
+
import React, { useState } from 'react';
|
|
7
|
+
import { renderExtension } from './extension';
|
|
8
|
+
import ExtensionRenderer from '../../ui/ExtensionRenderer';
|
|
9
|
+
const useMultiBodiedExtensionActions = ({
|
|
10
|
+
updateActiveChild,
|
|
11
|
+
children
|
|
12
|
+
}) => {
|
|
13
|
+
const actions = React.useMemo(() => {
|
|
14
|
+
return {
|
|
15
|
+
changeActive(index) {
|
|
16
|
+
return updateActiveChild(index);
|
|
17
|
+
},
|
|
18
|
+
addChild() {
|
|
19
|
+
return false;
|
|
20
|
+
},
|
|
21
|
+
getChildrenCount() {
|
|
22
|
+
return children ? children === null || children === void 0 ? void 0 : children.length : 0;
|
|
23
|
+
},
|
|
24
|
+
removeChild(index) {
|
|
25
|
+
return false;
|
|
26
|
+
},
|
|
27
|
+
updateParameters(parameters) {
|
|
28
|
+
return false;
|
|
29
|
+
},
|
|
30
|
+
getChildren() {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}, [updateActiveChild, children]);
|
|
35
|
+
return actions;
|
|
36
|
+
};
|
|
37
|
+
const navigationCSS = css`
|
|
38
|
+
// make sure the user can't see a range selection inside the navigation
|
|
39
|
+
// This is really important to keep the navigation working properly
|
|
40
|
+
user-select: none;
|
|
41
|
+
-webkit-user-modify: read-only;
|
|
42
|
+
border: 1px solid ${`var(--ds-border, ${N40})`};
|
|
43
|
+
background-color: ${`var(--ds-background-inverse-subtle, ${N50})`};
|
|
44
|
+
|
|
45
|
+
.mbe-add-tab-button,
|
|
46
|
+
.mbe-remove-tab {
|
|
47
|
+
display: none;
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
const MultiBodiedExtension = props => {
|
|
51
|
+
const {
|
|
52
|
+
children,
|
|
53
|
+
layout = 'default',
|
|
54
|
+
path = []
|
|
55
|
+
} = props;
|
|
56
|
+
const [activeChildIndex, setActiveChildIndex] = useState(0);
|
|
57
|
+
const updateActiveChild = React.useCallback(index => {
|
|
58
|
+
if (typeof index !== 'number') {
|
|
59
|
+
// TODO: Make sure we log this somewhere if this happens
|
|
60
|
+
setActiveChildIndex(0);
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
setActiveChildIndex(index);
|
|
64
|
+
return true;
|
|
65
|
+
}, [setActiveChildIndex]);
|
|
66
|
+
const actions = useMultiBodiedExtensionActions({
|
|
67
|
+
updateActiveChild,
|
|
68
|
+
children
|
|
69
|
+
});
|
|
70
|
+
const containerCSS = css`
|
|
71
|
+
border: 1px solid ${`var(--ds-border, ${N30})`};
|
|
72
|
+
min-height: 100px;
|
|
73
|
+
|
|
74
|
+
.multiBodiedExtension--frames > [data-extension-frame='true'] {
|
|
75
|
+
display: none;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.multiBodiedExtension--frames
|
|
79
|
+
> [data-extension-frame='true']:nth-of-type(${activeChildIndex + 1}) {
|
|
80
|
+
border: 1px solid ${`var(--ds-border, ${N50})`};
|
|
81
|
+
display: block;
|
|
82
|
+
min-height: 100px;
|
|
83
|
+
}
|
|
84
|
+
`;
|
|
85
|
+
return jsx("section", {
|
|
86
|
+
className: "multiBodiedExtension--container",
|
|
87
|
+
css: containerCSS,
|
|
88
|
+
"data-testid": "multiBodiedExtension--container",
|
|
89
|
+
"data-active-child-index": activeChildIndex
|
|
90
|
+
}, jsx("nav", {
|
|
91
|
+
className: "multiBodiedExtension-navigation",
|
|
92
|
+
css: navigationCSS,
|
|
93
|
+
"data-testid": "multiBodiedExtension-navigation"
|
|
94
|
+
}, jsx(ExtensionRenderer, _extends({}, props, {
|
|
95
|
+
actions: actions,
|
|
96
|
+
type: "multiBodiedExtension"
|
|
97
|
+
}), ({
|
|
98
|
+
result
|
|
99
|
+
}) => {
|
|
100
|
+
try {
|
|
101
|
+
if (result && /*#__PURE__*/React.isValidElement(result)) {
|
|
102
|
+
// Return the content directly if it's a valid JSX.Element
|
|
103
|
+
return renderExtension(result, layout, {
|
|
104
|
+
isTopLevel: path.length < 1
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
} catch (e) {
|
|
108
|
+
/** We don't want this error to block renderer */
|
|
109
|
+
/** We keep rendering the default content */
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Always return default content if anything goes wrong
|
|
113
|
+
return renderExtension(children, layout, {
|
|
114
|
+
isTopLevel: path.length < 1
|
|
115
|
+
});
|
|
116
|
+
})), jsx("article", {
|
|
117
|
+
className: "multiBodiedExtension--frames",
|
|
118
|
+
"data-testid": "multiBodiedExtension--frames"
|
|
119
|
+
}, children));
|
|
120
|
+
};
|
|
121
|
+
export default MultiBodiedExtension;
|
|
@@ -21,7 +21,7 @@ export default class ExtensionRenderer extends React.Component {
|
|
|
21
21
|
});
|
|
22
22
|
});
|
|
23
23
|
_defineProperty(this, "getNodeRenderer", memoizeOne(getNodeRenderer));
|
|
24
|
-
_defineProperty(this, "renderExtensionNode",
|
|
24
|
+
_defineProperty(this, "renderExtensionNode", extensionProvider => {
|
|
25
25
|
var _marks$find, _marks$find$attrs;
|
|
26
26
|
const {
|
|
27
27
|
extensionHandlers,
|
|
@@ -33,7 +33,8 @@ export default class ExtensionRenderer extends React.Component {
|
|
|
33
33
|
text,
|
|
34
34
|
type,
|
|
35
35
|
localId,
|
|
36
|
-
marks
|
|
36
|
+
marks,
|
|
37
|
+
actions
|
|
37
38
|
} = this.props;
|
|
38
39
|
const fragmentLocalId = marks === null || marks === void 0 ? void 0 : (_marks$find = marks.find(m => m.type.name === 'fragment')) === null || _marks$find === void 0 ? void 0 : (_marks$find$attrs = _marks$find.attrs) === null || _marks$find$attrs === void 0 ? void 0 : _marks$find$attrs.localId;
|
|
39
40
|
const node = {
|
|
@@ -35,7 +35,7 @@ import { RenderTracking } from '../../react/utils/performance/RenderTracking';
|
|
|
35
35
|
export const NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
36
36
|
export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
37
37
|
const packageName = "@atlaskit/renderer";
|
|
38
|
-
const packageVersion = "108.20.
|
|
38
|
+
const packageVersion = "108.20.9";
|
|
39
39
|
export class Renderer extends PureComponent {
|
|
40
40
|
constructor(props) {
|
|
41
41
|
super(props);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject;
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
|
|
5
|
+
import { jsx, css } from '@emotion/react';
|
|
6
|
+
import { N30 } from '@atlaskit/theme/colors';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
var ExtensionFrame = function ExtensionFrame(props) {
|
|
9
|
+
var containerCSS = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n min-height: 100px;\n "])), "var(--ds-border, ".concat(N30, ")"));
|
|
10
|
+
return jsx("div", {
|
|
11
|
+
css: containerCSS,
|
|
12
|
+
className: "extension-frame",
|
|
13
|
+
"data-extension-frame": "true",
|
|
14
|
+
style: {
|
|
15
|
+
flexBasis: "100%"
|
|
16
|
+
}
|
|
17
|
+
}, props.children);
|
|
18
|
+
};
|
|
19
|
+
export default ExtensionFrame;
|
|
@@ -4,6 +4,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import Loadable from 'react-loadable';
|
|
5
5
|
import Blockquote from './blockquote';
|
|
6
6
|
import BodiedExtension from './bodiedExtension';
|
|
7
|
+
import MultiBodiedExtension from './multiBodiedExtension';
|
|
8
|
+
import ExtensionFrame from './extensionFrame';
|
|
7
9
|
import BulletList from './bulletList';
|
|
8
10
|
import Doc, { DocWithSelectAllTrap } from './doc';
|
|
9
11
|
import Extension from './extension';
|
|
@@ -244,6 +246,8 @@ export var nodeToReact = {
|
|
|
244
246
|
emoji: Emoji,
|
|
245
247
|
extension: Extension,
|
|
246
248
|
bodiedExtension: BodiedExtension,
|
|
249
|
+
multiBodiedExtension: MultiBodiedExtension,
|
|
250
|
+
extensionFrame: ExtensionFrame,
|
|
247
251
|
hardBreak: HardBreak,
|
|
248
252
|
heading: Heading,
|
|
249
253
|
inlineCard: InlineCard,
|
|
@@ -412,4 +416,4 @@ var isEmojiBlock = function isEmojiBlock(pnode) {
|
|
|
412
416
|
}
|
|
413
417
|
return emojiCount > 0;
|
|
414
418
|
};
|
|
415
|
-
export { Blockquote, BodiedExtension, BulletList, BlockCard, Caption, CodeBlock, WindowedCodeBlock, Date, DecisionItem, DecisionList, Doc, DocWithSelectAllTrap, Emoji, Extension, Expand, HardBreak, Heading, ListItem, InlineCard, InlineExtension, LayoutSection, LayoutColumn, Media, MediaGroup, MediaInline, MediaSingle, Mention, OrderedList, Panel, Paragraph, Placeholder, Rule, Status, TaskItem, TaskList, Table, TableCell, TableRow, UnknownBlock, EmbedCard };
|
|
419
|
+
export { Blockquote, BodiedExtension, BulletList, BlockCard, Caption, CodeBlock, WindowedCodeBlock, Date, DecisionItem, DecisionList, Doc, DocWithSelectAllTrap, Emoji, Extension, ExtensionFrame, Expand, HardBreak, Heading, ListItem, InlineCard, InlineExtension, LayoutSection, LayoutColumn, Media, MediaGroup, MediaInline, MediaSingle, Mention, MultiBodiedExtension, OrderedList, Panel, Paragraph, Placeholder, Rule, Status, TaskItem, TaskList, Table, TableCell, TableRow, UnknownBlock, EmbedCard };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
4
|
+
var _templateObject, _templateObject2;
|
|
5
|
+
/** @jsx jsx */
|
|
6
|
+
|
|
7
|
+
import { jsx, css } from '@emotion/react';
|
|
8
|
+
import { N30, N40, N50 } from '@atlaskit/theme/colors';
|
|
9
|
+
import React, { useState } from 'react';
|
|
10
|
+
import { renderExtension } from './extension';
|
|
11
|
+
import ExtensionRenderer from '../../ui/ExtensionRenderer';
|
|
12
|
+
var useMultiBodiedExtensionActions = function useMultiBodiedExtensionActions(_ref) {
|
|
13
|
+
var updateActiveChild = _ref.updateActiveChild,
|
|
14
|
+
children = _ref.children;
|
|
15
|
+
var actions = React.useMemo(function () {
|
|
16
|
+
return {
|
|
17
|
+
changeActive: function changeActive(index) {
|
|
18
|
+
return updateActiveChild(index);
|
|
19
|
+
},
|
|
20
|
+
addChild: function addChild() {
|
|
21
|
+
return false;
|
|
22
|
+
},
|
|
23
|
+
getChildrenCount: function getChildrenCount() {
|
|
24
|
+
return children ? children === null || children === void 0 ? void 0 : children.length : 0;
|
|
25
|
+
},
|
|
26
|
+
removeChild: function removeChild(index) {
|
|
27
|
+
return false;
|
|
28
|
+
},
|
|
29
|
+
updateParameters: function updateParameters(parameters) {
|
|
30
|
+
return false;
|
|
31
|
+
},
|
|
32
|
+
getChildren: function getChildren() {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}, [updateActiveChild, children]);
|
|
37
|
+
return actions;
|
|
38
|
+
};
|
|
39
|
+
var navigationCSS = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n // make sure the user can't see a range selection inside the navigation\n // This is really important to keep the navigation working properly\n user-select: none;\n -webkit-user-modify: read-only;\n border: 1px solid ", ";\n background-color: ", ";\n\n .mbe-add-tab-button,\n .mbe-remove-tab {\n display: none;\n }\n"])), "var(--ds-border, ".concat(N40, ")"), "var(--ds-background-inverse-subtle, ".concat(N50, ")"));
|
|
40
|
+
var MultiBodiedExtension = function MultiBodiedExtension(props) {
|
|
41
|
+
var children = props.children,
|
|
42
|
+
_props$layout = props.layout,
|
|
43
|
+
layout = _props$layout === void 0 ? 'default' : _props$layout,
|
|
44
|
+
_props$path = props.path,
|
|
45
|
+
path = _props$path === void 0 ? [] : _props$path;
|
|
46
|
+
var _useState = useState(0),
|
|
47
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
48
|
+
activeChildIndex = _useState2[0],
|
|
49
|
+
setActiveChildIndex = _useState2[1];
|
|
50
|
+
var updateActiveChild = React.useCallback(function (index) {
|
|
51
|
+
if (typeof index !== 'number') {
|
|
52
|
+
// TODO: Make sure we log this somewhere if this happens
|
|
53
|
+
setActiveChildIndex(0);
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
setActiveChildIndex(index);
|
|
57
|
+
return true;
|
|
58
|
+
}, [setActiveChildIndex]);
|
|
59
|
+
var actions = useMultiBodiedExtensionActions({
|
|
60
|
+
updateActiveChild: updateActiveChild,
|
|
61
|
+
children: children
|
|
62
|
+
});
|
|
63
|
+
var containerCSS = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n min-height: 100px;\n\n .multiBodiedExtension--frames > [data-extension-frame='true'] {\n display: none;\n }\n\n .multiBodiedExtension--frames\n > [data-extension-frame='true']:nth-of-type(", ") {\n border: 1px solid ", ";\n display: block;\n min-height: 100px;\n }\n "])), "var(--ds-border, ".concat(N30, ")"), activeChildIndex + 1, "var(--ds-border, ".concat(N50, ")"));
|
|
64
|
+
return jsx("section", {
|
|
65
|
+
className: "multiBodiedExtension--container",
|
|
66
|
+
css: containerCSS,
|
|
67
|
+
"data-testid": "multiBodiedExtension--container",
|
|
68
|
+
"data-active-child-index": activeChildIndex
|
|
69
|
+
}, jsx("nav", {
|
|
70
|
+
className: "multiBodiedExtension-navigation",
|
|
71
|
+
css: navigationCSS,
|
|
72
|
+
"data-testid": "multiBodiedExtension-navigation"
|
|
73
|
+
}, jsx(ExtensionRenderer, _extends({}, props, {
|
|
74
|
+
actions: actions,
|
|
75
|
+
type: "multiBodiedExtension"
|
|
76
|
+
}), function (_ref2) {
|
|
77
|
+
var result = _ref2.result;
|
|
78
|
+
try {
|
|
79
|
+
if (result && /*#__PURE__*/React.isValidElement(result)) {
|
|
80
|
+
// Return the content directly if it's a valid JSX.Element
|
|
81
|
+
return renderExtension(result, layout, {
|
|
82
|
+
isTopLevel: path.length < 1
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
} catch (e) {
|
|
86
|
+
/** We don't want this error to block renderer */
|
|
87
|
+
/** We keep rendering the default content */
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Always return default content if anything goes wrong
|
|
91
|
+
return renderExtension(children, layout, {
|
|
92
|
+
isTopLevel: path.length < 1
|
|
93
|
+
});
|
|
94
|
+
})), jsx("article", {
|
|
95
|
+
className: "multiBodiedExtension--frames",
|
|
96
|
+
"data-testid": "multiBodiedExtension--frames"
|
|
97
|
+
}, children));
|
|
98
|
+
};
|
|
99
|
+
export default MultiBodiedExtension;
|
|
@@ -34,7 +34,7 @@ var ExtensionRenderer = /*#__PURE__*/function (_React$Component) {
|
|
|
34
34
|
});
|
|
35
35
|
});
|
|
36
36
|
_defineProperty(_assertThisInitialized(_this), "getNodeRenderer", memoizeOne(getNodeRenderer));
|
|
37
|
-
_defineProperty(_assertThisInitialized(_this), "renderExtensionNode", function (extensionProvider
|
|
37
|
+
_defineProperty(_assertThisInitialized(_this), "renderExtensionNode", function (extensionProvider) {
|
|
38
38
|
var _marks$find;
|
|
39
39
|
var _this$props = _this.props,
|
|
40
40
|
extensionHandlers = _this$props.extensionHandlers,
|
|
@@ -46,7 +46,8 @@ var ExtensionRenderer = /*#__PURE__*/function (_React$Component) {
|
|
|
46
46
|
text = _this$props.text,
|
|
47
47
|
type = _this$props.type,
|
|
48
48
|
localId = _this$props.localId,
|
|
49
|
-
marks = _this$props.marks
|
|
49
|
+
marks = _this$props.marks,
|
|
50
|
+
actions = _this$props.actions;
|
|
50
51
|
var fragmentLocalId = marks === null || marks === void 0 || (_marks$find = marks.find(function (m) {
|
|
51
52
|
return m.type.name === 'fragment';
|
|
52
53
|
})) === null || _marks$find === void 0 || (_marks$find = _marks$find.attrs) === null || _marks$find === void 0 ? void 0 : _marks$find.localId;
|
|
@@ -45,7 +45,7 @@ import { RenderTracking } from '../../react/utils/performance/RenderTracking';
|
|
|
45
45
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
46
46
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
47
47
|
var packageName = "@atlaskit/renderer";
|
|
48
|
-
var packageVersion = "108.20.
|
|
48
|
+
var packageVersion = "108.20.9";
|
|
49
49
|
export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
50
50
|
_inherits(Renderer, _PureComponent);
|
|
51
51
|
var _super = _createSuper(Renderer);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
+
import type { RendererContext } from '../types';
|
|
5
|
+
import type { Serializer } from '../..';
|
|
6
|
+
import type { ExtensionLayout } from '@atlaskit/adf-schema';
|
|
7
|
+
import type { ExtensionHandlers } from '@atlaskit/editor-common/extensions';
|
|
8
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
9
|
+
export interface Props {
|
|
10
|
+
serializer: Serializer<any>;
|
|
11
|
+
extensionHandlers?: ExtensionHandlers;
|
|
12
|
+
rendererContext: RendererContext;
|
|
13
|
+
providers: ProviderFactory;
|
|
14
|
+
extensionType: string;
|
|
15
|
+
extensionKey: string;
|
|
16
|
+
path?: PMNode[];
|
|
17
|
+
originalContent?: any;
|
|
18
|
+
parameters?: any;
|
|
19
|
+
content?: any;
|
|
20
|
+
layout?: ExtensionLayout;
|
|
21
|
+
localId?: string;
|
|
22
|
+
}
|
|
23
|
+
declare const ExtensionFrame: React.FunctionComponent<Props>;
|
|
24
|
+
export default ExtensionFrame;
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import type React from 'react';
|
|
2
2
|
import Loadable from 'react-loadable';
|
|
3
|
-
import { Fragment, Node, Mark } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
import type { Fragment, Node, Mark } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import Blockquote from './blockquote';
|
|
5
|
-
import
|
|
5
|
+
import type { Props as BodiedExtensionProps } from './bodiedExtension';
|
|
6
|
+
import BodiedExtension from './bodiedExtension';
|
|
7
|
+
import type { Props as MultiBodiedExtensionProps } from './multiBodiedExtension';
|
|
8
|
+
import MultiBodiedExtension from './multiBodiedExtension';
|
|
9
|
+
import ExtensionFrame from './extensionFrame';
|
|
6
10
|
import BulletList from './bulletList';
|
|
7
11
|
import Doc, { DocWithSelectAllTrap } from './doc';
|
|
8
|
-
import
|
|
12
|
+
import type { Props as ExtensionProps } from './extension';
|
|
13
|
+
import Extension from './extension';
|
|
9
14
|
import HardBreak from './hardBreak';
|
|
10
15
|
import Heading from './heading';
|
|
11
|
-
import
|
|
16
|
+
import type { Props as InlineExtensionProps } from './inlineExtension';
|
|
17
|
+
import InlineExtension from './inlineExtension';
|
|
12
18
|
import LayoutSection from './layoutSection';
|
|
13
19
|
import LayoutColumn from './layoutColumn';
|
|
14
20
|
import ListItem from './listItem';
|
|
@@ -21,7 +27,7 @@ import Table from './table';
|
|
|
21
27
|
import { TableCell } from './tableCell';
|
|
22
28
|
import TableRow from './tableRow';
|
|
23
29
|
import UnknownBlock from './unknownBlock';
|
|
24
|
-
import { NodeComponentsProps } from '../../ui/Renderer/types';
|
|
30
|
+
import type { NodeComponentsProps } from '../../ui/Renderer/types';
|
|
25
31
|
declare const WindowedCodeBlock: React.ComponentType<import("./codeBlock/codeBlock").Props> & Loadable.LoadableComponent;
|
|
26
32
|
declare const CodeBlock: React.ComponentType<import("react-intl-next").WithIntlProps<import("./codeBlock/codeBlock").Props & import("react-intl-next").WrappedComponentProps<"intl">>> & Loadable.LoadableComponent;
|
|
27
33
|
declare const TaskList: React.ComponentType<import("./taskList").Props> & Loadable.LoadableComponent;
|
|
@@ -94,5 +100,5 @@ export declare function isTextNode(node: Node | Mark): node is Node;
|
|
|
94
100
|
* whose content satisfies the condition for an emoji block
|
|
95
101
|
*/
|
|
96
102
|
export declare const isEmojiDoc: (doc: Fragment) => boolean;
|
|
97
|
-
export { Blockquote, BodiedExtension, BulletList, BlockCard, Caption, CodeBlock, WindowedCodeBlock, Date, DecisionItem, DecisionList, Doc, DocWithSelectAllTrap, Emoji, Extension, Expand, HardBreak, Heading, ListItem, InlineCard, InlineExtension, LayoutSection, LayoutColumn, Media, MediaGroup, MediaInline, MediaSingle, Mention, OrderedList, Panel, Paragraph, Placeholder, Rule, Status, TaskItem, TaskList, Table, TableCell, TableRow, UnknownBlock, EmbedCard, };
|
|
98
|
-
export type { BodiedExtensionProps, ExtensionProps, InlineExtensionProps };
|
|
103
|
+
export { Blockquote, BodiedExtension, BulletList, BlockCard, Caption, CodeBlock, WindowedCodeBlock, Date, DecisionItem, DecisionList, Doc, DocWithSelectAllTrap, Emoji, Extension, ExtensionFrame, Expand, HardBreak, Heading, ListItem, InlineCard, InlineExtension, LayoutSection, LayoutColumn, Media, MediaGroup, MediaInline, MediaSingle, Mention, MultiBodiedExtension, OrderedList, Panel, Paragraph, Placeholder, Rule, Status, TaskItem, TaskList, Table, TableCell, TableRow, UnknownBlock, EmbedCard, };
|
|
104
|
+
export type { BodiedExtensionProps, ExtensionProps, InlineExtensionProps, MultiBodiedExtensionProps, };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { Mark as PMMark, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
+
import type { RendererContext } from '../types';
|
|
5
|
+
import type { Serializer } from '../..';
|
|
6
|
+
import type { ExtensionLayout } from '@atlaskit/adf-schema';
|
|
7
|
+
import type { ExtensionHandlers } from '@atlaskit/editor-common/extensions';
|
|
8
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
9
|
+
export interface Props {
|
|
10
|
+
serializer: Serializer<any>;
|
|
11
|
+
extensionHandlers?: ExtensionHandlers;
|
|
12
|
+
rendererContext: RendererContext;
|
|
13
|
+
providers: ProviderFactory;
|
|
14
|
+
extensionType: string;
|
|
15
|
+
extensionKey: string;
|
|
16
|
+
path?: PMNode[];
|
|
17
|
+
originalContent?: any;
|
|
18
|
+
parameters?: any;
|
|
19
|
+
content?: any;
|
|
20
|
+
layout?: ExtensionLayout;
|
|
21
|
+
localId?: string;
|
|
22
|
+
marks?: PMMark[];
|
|
23
|
+
}
|
|
24
|
+
declare const MultiBodiedExtension: React.FunctionComponent<Props>;
|
|
25
|
+
export default MultiBodiedExtension;
|
|
@@ -12,6 +12,7 @@ export interface Props {
|
|
|
12
12
|
rendererContext: RendererContext;
|
|
13
13
|
extensionType: string;
|
|
14
14
|
extensionKey: string;
|
|
15
|
+
actions?: MultiBodiedExtensionActions;
|
|
15
16
|
text?: string;
|
|
16
17
|
parameters?: any;
|
|
17
18
|
content?: any;
|
|
@@ -34,7 +35,7 @@ export default class ExtensionRenderer extends React.Component<Props, State> {
|
|
|
34
35
|
componentWillUnmount(): void;
|
|
35
36
|
handleProvider: (name: keyof State, providerPromise?: Promise<any>) => void;
|
|
36
37
|
getNodeRenderer: import("memoize-one").MemoizedFn<typeof getNodeRenderer>;
|
|
37
|
-
renderExtensionNode: (extensionProvider?: ExtensionProvider | null
|
|
38
|
+
renderExtensionNode: (extensionProvider?: ExtensionProvider | null) => JSX.Element;
|
|
38
39
|
setupAndRenderExtensionNode: (providers: {
|
|
39
40
|
extensionProvider?: Promise<ExtensionProvider<any>> | undefined;
|
|
40
41
|
}) => JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
+
import type { RendererContext } from '../types';
|
|
5
|
+
import type { Serializer } from '../..';
|
|
6
|
+
import type { ExtensionLayout } from '@atlaskit/adf-schema';
|
|
7
|
+
import type { ExtensionHandlers } from '@atlaskit/editor-common/extensions';
|
|
8
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
9
|
+
export interface Props {
|
|
10
|
+
serializer: Serializer<any>;
|
|
11
|
+
extensionHandlers?: ExtensionHandlers;
|
|
12
|
+
rendererContext: RendererContext;
|
|
13
|
+
providers: ProviderFactory;
|
|
14
|
+
extensionType: string;
|
|
15
|
+
extensionKey: string;
|
|
16
|
+
path?: PMNode[];
|
|
17
|
+
originalContent?: any;
|
|
18
|
+
parameters?: any;
|
|
19
|
+
content?: any;
|
|
20
|
+
layout?: ExtensionLayout;
|
|
21
|
+
localId?: string;
|
|
22
|
+
}
|
|
23
|
+
declare const ExtensionFrame: React.FunctionComponent<Props>;
|
|
24
|
+
export default ExtensionFrame;
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import type React from 'react';
|
|
2
2
|
import Loadable from 'react-loadable';
|
|
3
|
-
import { Fragment, Node, Mark } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
import type { Fragment, Node, Mark } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import Blockquote from './blockquote';
|
|
5
|
-
import
|
|
5
|
+
import type { Props as BodiedExtensionProps } from './bodiedExtension';
|
|
6
|
+
import BodiedExtension from './bodiedExtension';
|
|
7
|
+
import type { Props as MultiBodiedExtensionProps } from './multiBodiedExtension';
|
|
8
|
+
import MultiBodiedExtension from './multiBodiedExtension';
|
|
9
|
+
import ExtensionFrame from './extensionFrame';
|
|
6
10
|
import BulletList from './bulletList';
|
|
7
11
|
import Doc, { DocWithSelectAllTrap } from './doc';
|
|
8
|
-
import
|
|
12
|
+
import type { Props as ExtensionProps } from './extension';
|
|
13
|
+
import Extension from './extension';
|
|
9
14
|
import HardBreak from './hardBreak';
|
|
10
15
|
import Heading from './heading';
|
|
11
|
-
import
|
|
16
|
+
import type { Props as InlineExtensionProps } from './inlineExtension';
|
|
17
|
+
import InlineExtension from './inlineExtension';
|
|
12
18
|
import LayoutSection from './layoutSection';
|
|
13
19
|
import LayoutColumn from './layoutColumn';
|
|
14
20
|
import ListItem from './listItem';
|
|
@@ -21,7 +27,7 @@ import Table from './table';
|
|
|
21
27
|
import { TableCell } from './tableCell';
|
|
22
28
|
import TableRow from './tableRow';
|
|
23
29
|
import UnknownBlock from './unknownBlock';
|
|
24
|
-
import { NodeComponentsProps } from '../../ui/Renderer/types';
|
|
30
|
+
import type { NodeComponentsProps } from '../../ui/Renderer/types';
|
|
25
31
|
declare const WindowedCodeBlock: React.ComponentType<import("./codeBlock/codeBlock").Props> & Loadable.LoadableComponent;
|
|
26
32
|
declare const CodeBlock: React.ComponentType<import("react-intl-next").WithIntlProps<import("./codeBlock/codeBlock").Props & import("react-intl-next").WrappedComponentProps<"intl">>> & Loadable.LoadableComponent;
|
|
27
33
|
declare const TaskList: React.ComponentType<import("./taskList").Props> & Loadable.LoadableComponent;
|
|
@@ -94,5 +100,5 @@ export declare function isTextNode(node: Node | Mark): node is Node;
|
|
|
94
100
|
* whose content satisfies the condition for an emoji block
|
|
95
101
|
*/
|
|
96
102
|
export declare const isEmojiDoc: (doc: Fragment) => boolean;
|
|
97
|
-
export { Blockquote, BodiedExtension, BulletList, BlockCard, Caption, CodeBlock, WindowedCodeBlock, Date, DecisionItem, DecisionList, Doc, DocWithSelectAllTrap, Emoji, Extension, Expand, HardBreak, Heading, ListItem, InlineCard, InlineExtension, LayoutSection, LayoutColumn, Media, MediaGroup, MediaInline, MediaSingle, Mention, OrderedList, Panel, Paragraph, Placeholder, Rule, Status, TaskItem, TaskList, Table, TableCell, TableRow, UnknownBlock, EmbedCard, };
|
|
98
|
-
export type { BodiedExtensionProps, ExtensionProps, InlineExtensionProps };
|
|
103
|
+
export { Blockquote, BodiedExtension, BulletList, BlockCard, Caption, CodeBlock, WindowedCodeBlock, Date, DecisionItem, DecisionList, Doc, DocWithSelectAllTrap, Emoji, Extension, ExtensionFrame, Expand, HardBreak, Heading, ListItem, InlineCard, InlineExtension, LayoutSection, LayoutColumn, Media, MediaGroup, MediaInline, MediaSingle, Mention, MultiBodiedExtension, OrderedList, Panel, Paragraph, Placeholder, Rule, Status, TaskItem, TaskList, Table, TableCell, TableRow, UnknownBlock, EmbedCard, };
|
|
104
|
+
export type { BodiedExtensionProps, ExtensionProps, InlineExtensionProps, MultiBodiedExtensionProps, };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { Mark as PMMark, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
+
import type { RendererContext } from '../types';
|
|
5
|
+
import type { Serializer } from '../..';
|
|
6
|
+
import type { ExtensionLayout } from '@atlaskit/adf-schema';
|
|
7
|
+
import type { ExtensionHandlers } from '@atlaskit/editor-common/extensions';
|
|
8
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
9
|
+
export interface Props {
|
|
10
|
+
serializer: Serializer<any>;
|
|
11
|
+
extensionHandlers?: ExtensionHandlers;
|
|
12
|
+
rendererContext: RendererContext;
|
|
13
|
+
providers: ProviderFactory;
|
|
14
|
+
extensionType: string;
|
|
15
|
+
extensionKey: string;
|
|
16
|
+
path?: PMNode[];
|
|
17
|
+
originalContent?: any;
|
|
18
|
+
parameters?: any;
|
|
19
|
+
content?: any;
|
|
20
|
+
layout?: ExtensionLayout;
|
|
21
|
+
localId?: string;
|
|
22
|
+
marks?: PMMark[];
|
|
23
|
+
}
|
|
24
|
+
declare const MultiBodiedExtension: React.FunctionComponent<Props>;
|
|
25
|
+
export default MultiBodiedExtension;
|
|
@@ -12,6 +12,7 @@ export interface Props {
|
|
|
12
12
|
rendererContext: RendererContext;
|
|
13
13
|
extensionType: string;
|
|
14
14
|
extensionKey: string;
|
|
15
|
+
actions?: MultiBodiedExtensionActions;
|
|
15
16
|
text?: string;
|
|
16
17
|
parameters?: any;
|
|
17
18
|
content?: any;
|
|
@@ -34,7 +35,7 @@ export default class ExtensionRenderer extends React.Component<Props, State> {
|
|
|
34
35
|
componentWillUnmount(): void;
|
|
35
36
|
handleProvider: (name: keyof State, providerPromise?: Promise<any>) => void;
|
|
36
37
|
getNodeRenderer: import("memoize-one").MemoizedFn<typeof getNodeRenderer>;
|
|
37
|
-
renderExtensionNode: (extensionProvider?: ExtensionProvider | null
|
|
38
|
+
renderExtensionNode: (extensionProvider?: ExtensionProvider | null) => JSX.Element;
|
|
38
39
|
setupAndRenderExtensionNode: (providers: {
|
|
39
40
|
extensionProvider?: Promise<ExtensionProvider<any>> | undefined;
|
|
40
41
|
}) => JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "108.20.
|
|
3
|
+
"version": "108.20.9",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@atlaskit/icon": "^22.0.0",
|
|
42
42
|
"@atlaskit/link-datasource": "^1.19.0",
|
|
43
43
|
"@atlaskit/media-card": "^77.6.0",
|
|
44
|
-
"@atlaskit/media-client": "^26.
|
|
44
|
+
"@atlaskit/media-client": "^26.1.0",
|
|
45
45
|
"@atlaskit/media-client-react": "^2.0.0",
|
|
46
46
|
"@atlaskit/media-common": "^11.0.0",
|
|
47
47
|
"@atlaskit/media-filmstrip": "^47.0.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@atlaskit/status": "^1.4.0",
|
|
53
53
|
"@atlaskit/task-decision": "^17.9.0",
|
|
54
54
|
"@atlaskit/theme": "^12.6.0",
|
|
55
|
-
"@atlaskit/tokens": "^1.
|
|
55
|
+
"@atlaskit/tokens": "^1.30.0",
|
|
56
56
|
"@atlaskit/tooltip": "^18.0.0",
|
|
57
57
|
"@babel/runtime": "^7.0.0",
|
|
58
58
|
"@emotion/react": "^11.7.1",
|