@atlaskit/renderer 124.0.4 → 124.1.0
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 +11 -0
- package/dist/cjs/react/index.js +10 -10
- package/dist/cjs/react/nodes/index.js +14 -0
- package/dist/cjs/react/nodes/syncBlock.js +16 -0
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/es2019/react/index.js +8 -8
- package/dist/es2019/react/nodes/index.js +6 -0
- package/dist/es2019/react/nodes/syncBlock.js +9 -0
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/esm/react/index.js +8 -8
- package/dist/esm/react/nodes/index.js +12 -0
- package/dist/esm/react/nodes/syncBlock.js +9 -0
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/types/react/index.d.ts +5 -5
- package/dist/types/react/nodes/syncBlock.d.ts +6 -0
- package/dist/types-ts4.5/react/index.d.ts +5 -5
- package/dist/types-ts4.5/react/nodes/syncBlock.d.ts +6 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 124.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`6fabf6d555515`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6fabf6d555515) -
|
|
8
|
+
EDITOR-1566 add renderer sync-block node support
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 124.0.4
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/dist/cjs/react/index.js
CHANGED
|
@@ -13,21 +13,21 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
13
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
15
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
16
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
17
16
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
18
|
-
var
|
|
17
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
19
18
|
var _nodes = require("./nodes");
|
|
20
19
|
var _textWrapper = _interopRequireDefault(require("./nodes/text-wrapper"));
|
|
21
|
-
var
|
|
22
|
-
var _validator = require("@atlaskit/editor-common/validator");
|
|
20
|
+
var _links = require("./utils/links");
|
|
23
21
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
24
|
-
var
|
|
25
|
-
var
|
|
22
|
+
var _validator = require("@atlaskit/editor-common/validator");
|
|
23
|
+
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
26
24
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
27
|
-
var
|
|
25
|
+
var _utils3 = require("../utils");
|
|
26
|
+
var _marks = require("./marks");
|
|
28
27
|
var _code = require("./marks/code");
|
|
29
|
-
var
|
|
28
|
+
var _rendererNode = require("./renderer-node");
|
|
30
29
|
var _renderTextSegments = require("./utils/render-text-segments");
|
|
30
|
+
var _segmentText = require("./utils/segment-text");
|
|
31
31
|
var _excluded = ["key"];
|
|
32
32
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
33
33
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -656,7 +656,7 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
|
|
|
656
656
|
if (!(0, _links.isNestedHeaderLinksEnabled)(this.allowHeadingAnchorLinks)) {
|
|
657
657
|
return this.getProps(node);
|
|
658
658
|
}
|
|
659
|
-
var nestedHeaderIds = (0,
|
|
659
|
+
var nestedHeaderIds = (0, _utils2.findChildrenByType)(node, node.type.schema.nodes.heading).map(function (_ref4) {
|
|
660
660
|
var node = _ref4.node;
|
|
661
661
|
return _this7.getHeadingId(node, _this7.expandHeadingIds);
|
|
662
662
|
});
|
|
@@ -684,7 +684,7 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
|
|
|
684
684
|
// Ignored via go/ees005
|
|
685
685
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
686
686
|
.reduce(function (acc, node) {
|
|
687
|
-
return acc.concat((0,
|
|
687
|
+
return acc.concat((0, _utils3.getText)(node) || '');
|
|
688
688
|
}, '').trim()
|
|
689
689
|
// Ignored via go/ees005
|
|
690
690
|
// eslint-disable-next-line require-unicode-regexp
|
|
@@ -434,6 +434,19 @@ var Expand = exports.Expand = (0, _reactLoadable.default)({
|
|
|
434
434
|
return null;
|
|
435
435
|
}
|
|
436
436
|
});
|
|
437
|
+
var SyncBlockLoader = (0, _reactLoadable.default)({
|
|
438
|
+
loader: function loader() {
|
|
439
|
+
return Promise.resolve().then(function () {
|
|
440
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_renderer-node_SyncBlock" */
|
|
441
|
+
'./syncBlock'));
|
|
442
|
+
}).then(function (mod) {
|
|
443
|
+
return mod.default;
|
|
444
|
+
});
|
|
445
|
+
},
|
|
446
|
+
loading: function loading() {
|
|
447
|
+
return null;
|
|
448
|
+
}
|
|
449
|
+
});
|
|
437
450
|
var nodeToReact = exports.nodeToReact = {
|
|
438
451
|
blockquote: _blockquote.default,
|
|
439
452
|
bulletList: _bulletList.default,
|
|
@@ -476,6 +489,7 @@ var nodeToReact = exports.nodeToReact = {
|
|
|
476
489
|
unsupportedBlock: _ui.UnsupportedBlock,
|
|
477
490
|
unsupportedInline: _ui.UnsupportedInline,
|
|
478
491
|
expand: Expand,
|
|
492
|
+
syncBlock: SyncBlockLoader,
|
|
479
493
|
nestedExpand: Expand,
|
|
480
494
|
embedCard: EmbedCard,
|
|
481
495
|
blockTaskItem: TaskItem
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = SyncBlock;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
// For sync block to work, we need to pass in a custom syncBlock renderer
|
|
10
|
+
// However, we need define a basic component to render the sync block
|
|
11
|
+
function SyncBlock(props) {
|
|
12
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
13
|
+
"data-sync-block": true,
|
|
14
|
+
"data-local-id": props.localId
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -68,7 +68,7 @@ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
68
68
|
// we want to calculate all the table widths (which causes reflows) after the renderer has finished loading to mitigate performance impact
|
|
69
69
|
var TABLE_WIDTH_INFO_TIMEOUT = 10000;
|
|
70
70
|
var packageName = "@atlaskit/renderer";
|
|
71
|
-
var packageVersion = "
|
|
71
|
+
var packageVersion = "0.0.0-development";
|
|
72
72
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
73
73
|
containerName: 'ak-renderer-wrapper',
|
|
74
74
|
containerType: 'inline-size'
|
|
@@ -2,21 +2,21 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { MarkType } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
5
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
|
-
import {
|
|
8
|
-
import { Doc, DocWithSelectAllTrap,
|
|
6
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
|
+
import { Doc, DocWithSelectAllTrap, isTextNode, isTextWrapper, mergeTextNodes, toReact } from './nodes';
|
|
9
8
|
import TextWrapperComponent from './nodes/text-wrapper';
|
|
10
|
-
import {
|
|
11
|
-
import { getMarksByOrder, isSameMark } from '@atlaskit/editor-common/validator';
|
|
9
|
+
import { isNestedHeaderLinksEnabled } from './utils/links';
|
|
12
10
|
import { getColumnWidths } from '@atlaskit/editor-common/utils';
|
|
13
|
-
import {
|
|
11
|
+
import { getMarksByOrder, isSameMark } from '@atlaskit/editor-common/validator';
|
|
14
12
|
import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
|
|
15
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
|
-
import {
|
|
14
|
+
import { getText } from '../utils';
|
|
15
|
+
import { isAnnotationMark, toReact as markToReact } from './marks';
|
|
17
16
|
import { isCodeMark } from './marks/code';
|
|
18
|
-
import {
|
|
17
|
+
import { insideBlockNode, insideBreakoutLayout, insideMultiBodiedExtension, insideTable } from './renderer-node';
|
|
19
18
|
import { renderTextSegments } from './utils/render-text-segments';
|
|
19
|
+
import { segmentText } from './utils/segment-text';
|
|
20
20
|
function mergeMarks(marksAndNodes) {
|
|
21
21
|
return marksAndNodes.reduce((acc, markOrNode) => {
|
|
22
22
|
const prev = acc.length && acc[acc.length - 1] || null;
|
|
@@ -126,6 +126,11 @@ const Expand = Loadable({
|
|
|
126
126
|
'../../ui/Expand').then(mod => mod.default),
|
|
127
127
|
loading: () => null
|
|
128
128
|
});
|
|
129
|
+
const SyncBlockLoader = Loadable({
|
|
130
|
+
loader: () => import( /* webpackChunkName: "@atlaskit-internal_renderer-node_SyncBlock" */
|
|
131
|
+
'./syncBlock').then(mod => mod.default),
|
|
132
|
+
loading: () => null
|
|
133
|
+
});
|
|
129
134
|
export const nodeToReact = {
|
|
130
135
|
blockquote: Blockquote,
|
|
131
136
|
bulletList: BulletList,
|
|
@@ -168,6 +173,7 @@ export const nodeToReact = {
|
|
|
168
173
|
unsupportedBlock: UnsupportedBlock,
|
|
169
174
|
unsupportedInline: UnsupportedInline,
|
|
170
175
|
expand: Expand,
|
|
176
|
+
syncBlock: SyncBlockLoader,
|
|
171
177
|
nestedExpand: Expand,
|
|
172
178
|
embedCard: EmbedCard,
|
|
173
179
|
blockTaskItem: TaskItem
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
// For sync block to work, we need to pass in a custom syncBlock renderer
|
|
3
|
+
// However, we need define a basic component to render the sync block
|
|
4
|
+
export default function SyncBlock(props) {
|
|
5
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
6
|
+
"data-sync-block": true,
|
|
7
|
+
"data-local-id": props.localId
|
|
8
|
+
});
|
|
9
|
+
}
|
|
@@ -54,7 +54,7 @@ export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
54
54
|
// we want to calculate all the table widths (which causes reflows) after the renderer has finished loading to mitigate performance impact
|
|
55
55
|
const TABLE_WIDTH_INFO_TIMEOUT = 10000;
|
|
56
56
|
const packageName = "@atlaskit/renderer";
|
|
57
|
-
const packageVersion = "
|
|
57
|
+
const packageVersion = "0.0.0-development";
|
|
58
58
|
const setAsQueryContainerStyles = css({
|
|
59
59
|
containerName: 'ak-renderer-wrapper',
|
|
60
60
|
containerType: 'inline-size'
|
package/dist/esm/react/index.js
CHANGED
|
@@ -9,21 +9,21 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
9
9
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import { MarkType } from '@atlaskit/editor-prosemirror/model';
|
|
12
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
13
12
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
|
-
import {
|
|
15
|
-
import { Doc, DocWithSelectAllTrap,
|
|
13
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
14
|
+
import { Doc, DocWithSelectAllTrap, isTextNode, isTextWrapper, mergeTextNodes, toReact } from './nodes';
|
|
16
15
|
import TextWrapperComponent from './nodes/text-wrapper';
|
|
17
|
-
import {
|
|
18
|
-
import { getMarksByOrder, isSameMark } from '@atlaskit/editor-common/validator';
|
|
16
|
+
import { isNestedHeaderLinksEnabled } from './utils/links';
|
|
19
17
|
import { getColumnWidths } from '@atlaskit/editor-common/utils';
|
|
20
|
-
import {
|
|
18
|
+
import { getMarksByOrder, isSameMark } from '@atlaskit/editor-common/validator';
|
|
21
19
|
import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
|
|
22
20
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
23
|
-
import {
|
|
21
|
+
import { getText } from '../utils';
|
|
22
|
+
import { isAnnotationMark, toReact as markToReact } from './marks';
|
|
24
23
|
import { isCodeMark } from './marks/code';
|
|
25
|
-
import {
|
|
24
|
+
import { insideBlockNode, insideBreakoutLayout, insideMultiBodiedExtension, insideTable } from './renderer-node';
|
|
26
25
|
import { renderTextSegments } from './utils/render-text-segments';
|
|
26
|
+
import { segmentText } from './utils/segment-text';
|
|
27
27
|
function mergeMarks(marksAndNodes) {
|
|
28
28
|
return marksAndNodes.reduce(function (acc, markOrNode) {
|
|
29
29
|
var prev = acc.length && acc[acc.length - 1] || null;
|
|
@@ -243,6 +243,17 @@ var Expand = Loadable({
|
|
|
243
243
|
return null;
|
|
244
244
|
}
|
|
245
245
|
});
|
|
246
|
+
var SyncBlockLoader = Loadable({
|
|
247
|
+
loader: function loader() {
|
|
248
|
+
return import( /* webpackChunkName: "@atlaskit-internal_renderer-node_SyncBlock" */
|
|
249
|
+
'./syncBlock').then(function (mod) {
|
|
250
|
+
return mod.default;
|
|
251
|
+
});
|
|
252
|
+
},
|
|
253
|
+
loading: function loading() {
|
|
254
|
+
return null;
|
|
255
|
+
}
|
|
256
|
+
});
|
|
246
257
|
export var nodeToReact = {
|
|
247
258
|
blockquote: Blockquote,
|
|
248
259
|
bulletList: BulletList,
|
|
@@ -285,6 +296,7 @@ export var nodeToReact = {
|
|
|
285
296
|
unsupportedBlock: UnsupportedBlock,
|
|
286
297
|
unsupportedInline: UnsupportedInline,
|
|
287
298
|
expand: Expand,
|
|
299
|
+
syncBlock: SyncBlockLoader,
|
|
288
300
|
nestedExpand: Expand,
|
|
289
301
|
embedCard: EmbedCard,
|
|
290
302
|
blockTaskItem: TaskItem
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
// For sync block to work, we need to pass in a custom syncBlock renderer
|
|
3
|
+
// However, we need define a basic component to render the sync block
|
|
4
|
+
export default function SyncBlock(props) {
|
|
5
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
6
|
+
"data-sync-block": true,
|
|
7
|
+
"data-local-id": props.localId
|
|
8
|
+
});
|
|
9
|
+
}
|
|
@@ -59,7 +59,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
59
59
|
// we want to calculate all the table widths (which causes reflows) after the renderer has finished loading to mitigate performance impact
|
|
60
60
|
var TABLE_WIDTH_INFO_TIMEOUT = 10000;
|
|
61
61
|
var packageName = "@atlaskit/renderer";
|
|
62
|
-
var packageVersion = "
|
|
62
|
+
var packageVersion = "0.0.0-development";
|
|
63
63
|
var setAsQueryContainerStyles = css({
|
|
64
64
|
containerName: 'ak-renderer-wrapper',
|
|
65
65
|
containerType: 'inline-size'
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { Fragment, Mark, Node } from '@atlaskit/editor-prosemirror/model';
|
|
2
1
|
import { type GetPMNodeHeight } from '@atlaskit/editor-common/extensibility';
|
|
3
|
-
import type {
|
|
4
|
-
import type { RendererAppearance, StickyHeaderConfig, HeadingAnchorLinksProps, NodeComponentsProps } from '../ui/Renderer/types';
|
|
2
|
+
import type { Fragment, Mark, Node } from '@atlaskit/editor-prosemirror/model';
|
|
5
3
|
import type { AnalyticsEventPayload } from '../analytics/events';
|
|
4
|
+
import type { Serializer } from '../serializer';
|
|
5
|
+
import type { HeadingAnchorLinksProps, NodeComponentsProps, RendererAppearance, StickyHeaderConfig } from '../ui/Renderer/types';
|
|
6
6
|
import type { TextWrapper } from './nodes';
|
|
7
7
|
import type { ExtensionHandlers } from '@atlaskit/editor-common/extensions';
|
|
8
8
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
9
9
|
import type { EventHandlers } from '@atlaskit/editor-common/ui';
|
|
10
|
-
import type {
|
|
10
|
+
import type { EmojiResourceConfig } from '@atlaskit/emoji/resource';
|
|
11
11
|
import type { MediaOptions } from '../types/mediaOptions';
|
|
12
12
|
import type { SmartLinksOptions } from '../types/smartLinksOptions';
|
|
13
|
-
import type {
|
|
13
|
+
import type { ExtensionViewportSize, RendererContext, TextHighlighter } from './types';
|
|
14
14
|
export interface ReactSerializerInit {
|
|
15
15
|
allowAltTextOnImages?: boolean;
|
|
16
16
|
allowAnnotations?: boolean;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { Fragment, Mark, Node } from '@atlaskit/editor-prosemirror/model';
|
|
2
1
|
import { type GetPMNodeHeight } from '@atlaskit/editor-common/extensibility';
|
|
3
|
-
import type {
|
|
4
|
-
import type { RendererAppearance, StickyHeaderConfig, HeadingAnchorLinksProps, NodeComponentsProps } from '../ui/Renderer/types';
|
|
2
|
+
import type { Fragment, Mark, Node } from '@atlaskit/editor-prosemirror/model';
|
|
5
3
|
import type { AnalyticsEventPayload } from '../analytics/events';
|
|
4
|
+
import type { Serializer } from '../serializer';
|
|
5
|
+
import type { HeadingAnchorLinksProps, NodeComponentsProps, RendererAppearance, StickyHeaderConfig } from '../ui/Renderer/types';
|
|
6
6
|
import type { TextWrapper } from './nodes';
|
|
7
7
|
import type { ExtensionHandlers } from '@atlaskit/editor-common/extensions';
|
|
8
8
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
9
9
|
import type { EventHandlers } from '@atlaskit/editor-common/ui';
|
|
10
|
-
import type {
|
|
10
|
+
import type { EmojiResourceConfig } from '@atlaskit/emoji/resource';
|
|
11
11
|
import type { MediaOptions } from '../types/mediaOptions';
|
|
12
12
|
import type { SmartLinksOptions } from '../types/smartLinksOptions';
|
|
13
|
-
import type {
|
|
13
|
+
import type { ExtensionViewportSize, RendererContext, TextHighlighter } from './types';
|
|
14
14
|
export interface ReactSerializerInit {
|
|
15
15
|
allowAltTextOnImages?: boolean;
|
|
16
16
|
allowAnnotations?: boolean;
|