@atlaskit/editor-common 94.18.1 → 94.20.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 CHANGED
@@ -1,5 +1,35 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 94.20.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#163776](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/163776)
8
+ [`45d76610f271d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/45d76610f271d) -
9
+ Add support for optional property, isGuest, on CollabProvider
10
+
11
+ ## 94.19.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#161296](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/161296)
16
+ [`9a6292ab637fa`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9a6292ab637fa) -
17
+ [ED-25521] Add experiment based gating to the insertion logic for nested tables, so we only allow
18
+ nesting tables one level deep when the experiment is active
19
+
20
+ ### Patch Changes
21
+
22
+ - [#163730](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/163730)
23
+ [`f3e2275eca566`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f3e2275eca566) -
24
+ Add display: grid to resizer-item to allow drag handle to render correctly
25
+ - [#163832](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/163832)
26
+ [`585fd205a0d0f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/585fd205a0d0f) -
27
+ update heading line heights
28
+ - [#160261](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/160261)
29
+ [`60571420d8c13`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/60571420d8c13) -
30
+ Added UFO escape mechanism to LNV
31
+ - Updated dependencies
32
+
3
33
  ## 94.18.1
4
34
 
5
35
  ### Patch Changes
@@ -3,7 +3,7 @@
3
3
  "compilerOptions": {
4
4
  "declaration": true,
5
5
  "target": "es5",
6
- "outDir": "../../../../../tsDist/@atlaskit__editor-common/app",
6
+ "outDir": "../../../../../post-office/tsDist/@atlaskit__editor-common/app",
7
7
  "rootDir": "../",
8
8
  "composite": true
9
9
  },
@@ -15,6 +15,7 @@ exports.testOnlyIgnoreLazyNodeView = testOnlyIgnoreLazyNodeView;
15
15
  exports.withLazyLoading = void 0;
16
16
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
17
17
  var _state = require("@atlaskit/editor-prosemirror/state");
18
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
19
  var _lazyScheduler = require("./lazy-scheduler");
19
20
  var _nodeView = require("./node-view");
20
21
  var _cssHelper = require("./css-helper");
@@ -144,7 +145,17 @@ var withLazyLoading = exports.withLazyLoading = function withLazyLoading(_ref) {
144
145
  var loaderPromise = loader().then(function (nodeViewFuncModule) {
145
146
  var _resolvedNodesPerEdit;
146
147
  var nodeViewFunc = function nodeViewFunc(node, view, getPos, decorations) {
147
- return nodeViewFuncModule(node, view, getPos, decorations, getNodeViewOptions);
148
+ var nodeView = nodeViewFuncModule(node, view, getPos, decorations, getNodeViewOptions);
149
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
150
+ var dom = nodeView.dom;
151
+ dom.setAttribute('data-vc', "editor-lnv-loaded--".concat(node.type.name));
152
+ if ((0, _platformFeatureFlags.fg)('platform_editor_ed-25557_lnv_add_ssr_placeholder')) {
153
+ var pos = getPos();
154
+ if (pos !== undefined) {
155
+ dom.setAttribute('data-editor-lnv-placeholder-replace', (0, _nodeView.makeNodePlaceholderId)(node.type.name, pos));
156
+ }
157
+ }
158
+ return nodeView;
148
159
  };
149
160
  (_resolvedNodesPerEdit = resolvedNodesPerEditorView.get(view)) === null || _resolvedNodesPerEdit === void 0 || _resolvedNodesPerEdit.set(nodeName, nodeViewFunc);
150
161
 
@@ -5,11 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.LazyNodeView = void 0;
8
+ exports.makeNodePlaceholderId = makeNodePlaceholderId;
8
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
12
  var _memoize = _interopRequireDefault(require("lodash/memoize"));
12
13
  var _model = require("@atlaskit/editor-prosemirror/model");
14
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
15
  var getEditorLineWidth = (0, _memoize.default)(function (view) {
14
16
  var _view$dom;
15
17
  return (_view$dom = view.dom) === null || _view$dom === void 0 ? void 0 : _view$dom.clientWidth;
@@ -34,6 +36,9 @@ function sameOuterDeco(a, b) {
34
36
  }
35
37
  return true;
36
38
  }
39
+ function makeNodePlaceholderId(nodeType, pos) {
40
+ return "".concat(nodeType, ":").concat(pos);
41
+ }
37
42
 
38
43
  /**
39
44
  * 🧱 Internal: Editor FE Platform
@@ -79,6 +84,16 @@ var LazyNodeView = exports.LazyNodeView = /*#__PURE__*/function () {
79
84
  // We are using this to make sure all lazy noded were replaced
80
85
  // before the test started
81
86
  this.dom.setAttribute('data-lazy-node-view-fallback', 'true');
87
+
88
+ // This is used by the UFO to identify the node
89
+ this.dom.setAttribute('data-vc', "editor-lnv-fallback--".concat(_node.type.name));
90
+ if ((0, _platformFeatureFlags.fg)('platform_editor_ed-25557_lnv_add_ssr_placeholder')) {
91
+ var pos = _getPos();
92
+ if (pos !== undefined) {
93
+ // Used for UFO to identify this as a placeholder
94
+ this.dom.setAttribute('data-editor-lnv-placeholder', makeNodePlaceholderId(_node.type.name, pos));
95
+ }
96
+ }
82
97
  }
83
98
  }
84
99
  (0, _createClass2.default)(LazyNodeView, [{
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
17
17
  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 && {}.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
18
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
19
19
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
20
- var packageVersion = "94.18.1";
20
+ var packageVersion = "94.20.0";
21
21
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
22
22
  // Remove URL as it has UGC
23
23
  // TODO: Sanitise the URL instead of just removing it
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getPositionAfterTopParentNodeOfType = exports.getParentOfTypeCount = void 0;
7
+ /*
8
+ * Returns the level of nesting of a given `nodeType` in the current selection.
9
+ * eg. table > table is nested 1 level, table > table > table is nested 2 levels.
10
+ *
11
+ * ```typescript
12
+ * const nestingLevel = getParentOfTypeCount(schema.nodes.table)(selection);
13
+ * ```
14
+ */
15
+ var getParentOfTypeCount = exports.getParentOfTypeCount = function getParentOfTypeCount(nodeType) {
16
+ return function (selection) {
17
+ var count = 0;
18
+ var $from = selection.$from;
19
+ // Loop through parent nodes from bottom to top
20
+ for (var depth = $from.depth; depth > 0; depth--) {
21
+ var node = $from.node(depth);
22
+ // Count the table nodes
23
+ if (node.type === nodeType) {
24
+ count++;
25
+ }
26
+ }
27
+ return count;
28
+ };
29
+ };
30
+
31
+ /*
32
+ * Returns the (absolute) position directly after the top parent node of a given `nodeType` in the current selection.
33
+ *
34
+ * ```typescript
35
+ * const nestingLevel = getEndTopParentNodeOfType(schema.nodes.table)(selection);
36
+ * ```
37
+ */
38
+ var getPositionAfterTopParentNodeOfType = exports.getPositionAfterTopParentNodeOfType = function getPositionAfterTopParentNodeOfType(nodeType) {
39
+ return function (selection) {
40
+ var $from = selection.$from;
41
+ // Loop through parent nodes from top to bottom
42
+ for (var depth = 1; depth <= $from.depth; depth++) {
43
+ var node = $from.node(depth);
44
+ // Count the table nodes
45
+ if (node.type === nodeType) {
46
+ return $from.after(depth);
47
+ }
48
+ }
49
+ };
50
+ };
@@ -48,6 +48,16 @@ var getHandleStyle = function getHandleStyle(node) {
48
48
  var ignoreResizerMutations = exports.ignoreResizerMutations = function ignoreResizerMutations(mutation) {
49
49
  return mutation.target.classList.contains('resizer-item') || mutation.type === 'attributes' && mutation.attributeName === 'style';
50
50
  };
51
+ var resizingStyles = {
52
+ left: '50%',
53
+ transform: 'translateX(-50%)',
54
+ display: 'grid'
55
+ };
56
+
57
+ // Apply grid to stop drag handles rendering inside .resizer-item affecting its height
58
+ var defaultStyles = {
59
+ display: 'grid'
60
+ };
51
61
 
52
62
  /**
53
63
  * BreakoutResizer is a common component used to resize nodes that support the 'Breakout' mark, so it requires
@@ -151,11 +161,7 @@ var BreakoutResizer = exports.BreakoutResizer = function BreakoutResizer(_ref) {
151
161
  maxWidth: maxWidth
152
162
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
153
163
  ,
154
- style: isResizing ? {
155
- // during resize need to center as the resizer-item gets an explicit width value
156
- left: '50%',
157
- transform: 'translateX(-50%)'
158
- } : undefined,
164
+ style: isResizing ? resizingStyles : defaultStyles,
159
165
  handleResizeStart: handleResizeStart,
160
166
  handleResizeStop: handleResizeStop,
161
167
  childrenDOMRef: getRef,
@@ -53,14 +53,15 @@ var headingsSharedStyles = exports.headingsSharedStyles = function headingsShare
53
53
  '& h1': {
54
54
  font: (0, _getEditorUgcToken.default)('editor.font.heading.h1', typographyTheme),
55
55
  marginBottom: 0,
56
- marginTop: '1.667em',
56
+ marginTop: '1.45833em',
57
57
  '& strong': {
58
58
  fontWeight: (0, _getEditorUgcToken.default)('editor.font.weight.heading.h1.bold', typographyTheme)
59
- }
59
+ },
60
+ '&::before': {}
60
61
  },
61
62
  '& h2': {
62
63
  font: (0, _getEditorUgcToken.default)('editor.font.heading.h2', typographyTheme),
63
- marginTop: '1.8em',
64
+ marginTop: '1.4em',
64
65
  marginBottom: 0,
65
66
  '& strong': {
66
67
  fontWeight: (0, _getEditorUgcToken.default)('editor.font.weight.heading.h1.bold', typographyTheme)
@@ -68,7 +69,7 @@ var headingsSharedStyles = exports.headingsSharedStyles = function headingsShare
68
69
  },
69
70
  '& h3': {
70
71
  font: (0, _getEditorUgcToken.default)('editor.font.heading.h3', typographyTheme),
71
- marginTop: '2em',
72
+ marginTop: '1.31249em',
72
73
  marginBottom: 0,
73
74
  '& strong': {
74
75
  fontWeight: (0, _getEditorUgcToken.default)('editor.font.weight.heading.h1.bold', typographyTheme)
@@ -76,14 +77,14 @@ var headingsSharedStyles = exports.headingsSharedStyles = function headingsShare
76
77
  },
77
78
  '& h4': {
78
79
  font: (0, _getEditorUgcToken.default)('editor.font.heading.h4', typographyTheme),
79
- marginTop: '1.357em',
80
+ marginTop: '1.25em',
80
81
  '& strong': {
81
82
  fontWeight: (0, _getEditorUgcToken.default)('editor.font.weight.heading.h1.bold', typographyTheme)
82
83
  }
83
84
  },
84
85
  '& h5': {
85
86
  font: (0, _getEditorUgcToken.default)('editor.font.heading.h5', typographyTheme),
86
- marginTop: '1.667em',
87
+ marginTop: '1.45833em',
87
88
  textTransform: 'none',
88
89
  '& strong': {
89
90
  fontWeight: (0, _getEditorUgcToken.default)('editor.font.weight.heading.h1.bold', typographyTheme)
@@ -91,7 +92,7 @@ var headingsSharedStyles = exports.headingsSharedStyles = function headingsShare
91
92
  },
92
93
  '& h6': {
93
94
  font: (0, _getEditorUgcToken.default)('editor.font.heading.h6', typographyTheme),
94
- marginTop: '1.455em',
95
+ marginTop: '1.59091em',
95
96
  textTransform: 'none',
96
97
  '& strong': {
97
98
  fontWeight: (0, _getEditorUgcToken.default)('editor.font.weight.heading.h1.bold', typographyTheme)
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
24
24
  * @jsx jsx
25
25
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "94.18.1";
27
+ var packageVersion = "94.20.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -1,6 +1,7 @@
1
1
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import { cancelCallback, scheduleCallback } from './lazy-scheduler';
3
- import { LazyNodeView } from './node-view';
4
+ import { LazyNodeView, makeNodePlaceholderId } from './node-view';
4
5
  export { convertToInlineCss } from './css-helper';
5
6
  /**
6
7
  * 📢 Public Plugin Key
@@ -129,7 +130,17 @@ export const withLazyLoading = ({
129
130
  const loaderPromise = loader().then(nodeViewFuncModule => {
130
131
  var _resolvedNodesPerEdit;
131
132
  const nodeViewFunc = (node, view, getPos, decorations) => {
132
- return nodeViewFuncModule(node, view, getPos, decorations, getNodeViewOptions);
133
+ const nodeView = nodeViewFuncModule(node, view, getPos, decorations, getNodeViewOptions);
134
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
135
+ const dom = nodeView.dom;
136
+ dom.setAttribute('data-vc', `editor-lnv-loaded--${node.type.name}`);
137
+ if (fg('platform_editor_ed-25557_lnv_add_ssr_placeholder')) {
138
+ const pos = getPos();
139
+ if (pos !== undefined) {
140
+ dom.setAttribute('data-editor-lnv-placeholder-replace', makeNodePlaceholderId(node.type.name, pos));
141
+ }
142
+ }
143
+ return nodeView;
133
144
  };
134
145
  (_resolvedNodesPerEdit = resolvedNodesPerEditorView.get(view)) === null || _resolvedNodesPerEdit === void 0 ? void 0 : _resolvedNodesPerEdit.set(nodeName, nodeViewFunc);
135
146
 
@@ -1,6 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import memoize from 'lodash/memoize';
3
3
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  const getEditorLineWidth = memoize(view => {
5
6
  var _view$dom;
6
7
  return (_view$dom = view.dom) === null || _view$dom === void 0 ? void 0 : _view$dom.clientWidth;
@@ -25,6 +26,9 @@ function sameOuterDeco(a, b) {
25
26
  }
26
27
  return true;
27
28
  }
29
+ export function makeNodePlaceholderId(nodeType, pos) {
30
+ return `${nodeType}:${pos}`;
31
+ }
28
32
 
29
33
  /**
30
34
  * 🧱 Internal: Editor FE Platform
@@ -68,6 +72,16 @@ export class LazyNodeView {
68
72
  // We are using this to make sure all lazy noded were replaced
69
73
  // before the test started
70
74
  this.dom.setAttribute('data-lazy-node-view-fallback', 'true');
75
+
76
+ // This is used by the UFO to identify the node
77
+ this.dom.setAttribute('data-vc', `editor-lnv-fallback--${_node.type.name}`);
78
+ if (fg('platform_editor_ed-25557_lnv_add_ssr_placeholder')) {
79
+ const pos = _getPos();
80
+ if (pos !== undefined) {
81
+ // Used for UFO to identify this as a placeholder
82
+ this.dom.setAttribute('data-editor-lnv-placeholder', makeNodePlaceholderId(_node.type.name, pos));
83
+ }
84
+ }
71
85
  }
72
86
  }
73
87
  ignoreMutation() {
@@ -1,7 +1,7 @@
1
1
  import { isFedRamp } from './environment';
2
2
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
3
3
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
4
- const packageVersion = "94.18.1";
4
+ const packageVersion = "94.20.0";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // TODO: Sanitise the URL instead of just removing it
@@ -0,0 +1,44 @@
1
+ /*
2
+ * Returns the level of nesting of a given `nodeType` in the current selection.
3
+ * eg. table > table is nested 1 level, table > table > table is nested 2 levels.
4
+ *
5
+ * ```typescript
6
+ * const nestingLevel = getParentOfTypeCount(schema.nodes.table)(selection);
7
+ * ```
8
+ */
9
+ export const getParentOfTypeCount = nodeType => selection => {
10
+ let count = 0;
11
+ const {
12
+ $from
13
+ } = selection;
14
+ // Loop through parent nodes from bottom to top
15
+ for (let depth = $from.depth; depth > 0; depth--) {
16
+ const node = $from.node(depth);
17
+ // Count the table nodes
18
+ if (node.type === nodeType) {
19
+ count++;
20
+ }
21
+ }
22
+ return count;
23
+ };
24
+
25
+ /*
26
+ * Returns the (absolute) position directly after the top parent node of a given `nodeType` in the current selection.
27
+ *
28
+ * ```typescript
29
+ * const nestingLevel = getEndTopParentNodeOfType(schema.nodes.table)(selection);
30
+ * ```
31
+ */
32
+ export const getPositionAfterTopParentNodeOfType = nodeType => selection => {
33
+ const {
34
+ $from
35
+ } = selection;
36
+ // Loop through parent nodes from top to bottom
37
+ for (let depth = 1; depth <= $from.depth; depth++) {
38
+ const node = $from.node(depth);
39
+ // Count the table nodes
40
+ if (node.type === nodeType) {
41
+ return $from.after(depth);
42
+ }
43
+ }
44
+ };
@@ -37,6 +37,16 @@ const getHandleStyle = node => {
37
37
  export const ignoreResizerMutations = mutation => {
38
38
  return mutation.target.classList.contains('resizer-item') || mutation.type === 'attributes' && mutation.attributeName === 'style';
39
39
  };
40
+ const resizingStyles = {
41
+ left: '50%',
42
+ transform: 'translateX(-50%)',
43
+ display: 'grid'
44
+ };
45
+
46
+ // Apply grid to stop drag handles rendering inside .resizer-item affecting its height
47
+ const defaultStyles = {
48
+ display: 'grid'
49
+ };
40
50
 
41
51
  /**
42
52
  * BreakoutResizer is a common component used to resize nodes that support the 'Breakout' mark, so it requires
@@ -144,11 +154,7 @@ const BreakoutResizer = ({
144
154
  maxWidth: maxWidth
145
155
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
146
156
  ,
147
- style: isResizing ? {
148
- // during resize need to center as the resizer-item gets an explicit width value
149
- left: '50%',
150
- transform: 'translateX(-50%)'
151
- } : undefined,
157
+ style: isResizing ? resizingStyles : defaultStyles,
152
158
  handleResizeStart: handleResizeStart,
153
159
  handleResizeStop: handleResizeStop,
154
160
  childrenDOMRef: getRef,
@@ -46,14 +46,15 @@ export const headingsSharedStyles = typographyTheme => {
46
46
  '& h1': {
47
47
  font: editorUGCToken('editor.font.heading.h1', typographyTheme),
48
48
  marginBottom: 0,
49
- marginTop: '1.667em',
49
+ marginTop: '1.45833em',
50
50
  '& strong': {
51
51
  fontWeight: editorUGCToken('editor.font.weight.heading.h1.bold', typographyTheme)
52
- }
52
+ },
53
+ '&::before': {}
53
54
  },
54
55
  '& h2': {
55
56
  font: editorUGCToken('editor.font.heading.h2', typographyTheme),
56
- marginTop: '1.8em',
57
+ marginTop: '1.4em',
57
58
  marginBottom: 0,
58
59
  '& strong': {
59
60
  fontWeight: editorUGCToken('editor.font.weight.heading.h1.bold', typographyTheme)
@@ -61,7 +62,7 @@ export const headingsSharedStyles = typographyTheme => {
61
62
  },
62
63
  '& h3': {
63
64
  font: editorUGCToken('editor.font.heading.h3', typographyTheme),
64
- marginTop: '2em',
65
+ marginTop: '1.31249em',
65
66
  marginBottom: 0,
66
67
  '& strong': {
67
68
  fontWeight: editorUGCToken('editor.font.weight.heading.h1.bold', typographyTheme)
@@ -69,14 +70,14 @@ export const headingsSharedStyles = typographyTheme => {
69
70
  },
70
71
  '& h4': {
71
72
  font: editorUGCToken('editor.font.heading.h4', typographyTheme),
72
- marginTop: '1.357em',
73
+ marginTop: '1.25em',
73
74
  '& strong': {
74
75
  fontWeight: editorUGCToken('editor.font.weight.heading.h1.bold', typographyTheme)
75
76
  }
76
77
  },
77
78
  '& h5': {
78
79
  font: editorUGCToken('editor.font.heading.h5', typographyTheme),
79
- marginTop: '1.667em',
80
+ marginTop: '1.45833em',
80
81
  textTransform: 'none',
81
82
  '& strong': {
82
83
  fontWeight: editorUGCToken('editor.font.weight.heading.h1.bold', typographyTheme)
@@ -84,7 +85,7 @@ export const headingsSharedStyles = typographyTheme => {
84
85
  },
85
86
  '& h6': {
86
87
  font: editorUGCToken('editor.font.heading.h6', typographyTheme),
87
- marginTop: '1.455em',
88
+ marginTop: '1.59091em',
88
89
  textTransform: 'none',
89
90
  '& strong': {
90
91
  fontWeight: editorUGCToken('editor.font.weight.heading.h1.bold', typographyTheme)
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
13
13
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import Layer from '../Layer';
15
15
  const packageName = "@atlaskit/editor-common";
16
- const packageVersion = "94.18.1";
16
+ const packageVersion = "94.20.0";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  class DropList extends Component {
@@ -1,7 +1,8 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  import { cancelCallback, scheduleCallback } from './lazy-scheduler';
4
- import { LazyNodeView } from './node-view';
5
+ import { LazyNodeView, makeNodePlaceholderId } from './node-view';
5
6
  export { convertToInlineCss } from './css-helper';
6
7
  /**
7
8
  * 📢 Public Plugin Key
@@ -129,7 +130,17 @@ export var withLazyLoading = function withLazyLoading(_ref) {
129
130
  var loaderPromise = loader().then(function (nodeViewFuncModule) {
130
131
  var _resolvedNodesPerEdit;
131
132
  var nodeViewFunc = function nodeViewFunc(node, view, getPos, decorations) {
132
- return nodeViewFuncModule(node, view, getPos, decorations, getNodeViewOptions);
133
+ var nodeView = nodeViewFuncModule(node, view, getPos, decorations, getNodeViewOptions);
134
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
135
+ var dom = nodeView.dom;
136
+ dom.setAttribute('data-vc', "editor-lnv-loaded--".concat(node.type.name));
137
+ if (fg('platform_editor_ed-25557_lnv_add_ssr_placeholder')) {
138
+ var pos = getPos();
139
+ if (pos !== undefined) {
140
+ dom.setAttribute('data-editor-lnv-placeholder-replace', makeNodePlaceholderId(node.type.name, pos));
141
+ }
142
+ }
143
+ return nodeView;
133
144
  };
134
145
  (_resolvedNodesPerEdit = resolvedNodesPerEditorView.get(view)) === null || _resolvedNodesPerEdit === void 0 || _resolvedNodesPerEdit.set(nodeName, nodeViewFunc);
135
146
 
@@ -3,6 +3,7 @@ import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  import memoize from 'lodash/memoize';
5
5
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  var getEditorLineWidth = memoize(function (view) {
7
8
  var _view$dom;
8
9
  return (_view$dom = view.dom) === null || _view$dom === void 0 ? void 0 : _view$dom.clientWidth;
@@ -27,6 +28,9 @@ function sameOuterDeco(a, b) {
27
28
  }
28
29
  return true;
29
30
  }
31
+ export function makeNodePlaceholderId(nodeType, pos) {
32
+ return "".concat(nodeType, ":").concat(pos);
33
+ }
30
34
 
31
35
  /**
32
36
  * 🧱 Internal: Editor FE Platform
@@ -72,6 +76,16 @@ export var LazyNodeView = /*#__PURE__*/function () {
72
76
  // We are using this to make sure all lazy noded were replaced
73
77
  // before the test started
74
78
  this.dom.setAttribute('data-lazy-node-view-fallback', 'true');
79
+
80
+ // This is used by the UFO to identify the node
81
+ this.dom.setAttribute('data-vc', "editor-lnv-fallback--".concat(_node.type.name));
82
+ if (fg('platform_editor_ed-25557_lnv_add_ssr_placeholder')) {
83
+ var pos = _getPos();
84
+ if (pos !== undefined) {
85
+ // Used for UFO to identify this as a placeholder
86
+ this.dom.setAttribute('data-editor-lnv-placeholder', makeNodePlaceholderId(_node.type.name, pos));
87
+ }
88
+ }
75
89
  }
76
90
  }
77
91
  _createClass(LazyNodeView, [{
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { isFedRamp } from './environment';
8
8
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
9
9
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
10
- var packageVersion = "94.18.1";
10
+ var packageVersion = "94.20.0";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // TODO: Sanitise the URL instead of just removing it
@@ -0,0 +1,44 @@
1
+ /*
2
+ * Returns the level of nesting of a given `nodeType` in the current selection.
3
+ * eg. table > table is nested 1 level, table > table > table is nested 2 levels.
4
+ *
5
+ * ```typescript
6
+ * const nestingLevel = getParentOfTypeCount(schema.nodes.table)(selection);
7
+ * ```
8
+ */
9
+ export var getParentOfTypeCount = function getParentOfTypeCount(nodeType) {
10
+ return function (selection) {
11
+ var count = 0;
12
+ var $from = selection.$from;
13
+ // Loop through parent nodes from bottom to top
14
+ for (var depth = $from.depth; depth > 0; depth--) {
15
+ var node = $from.node(depth);
16
+ // Count the table nodes
17
+ if (node.type === nodeType) {
18
+ count++;
19
+ }
20
+ }
21
+ return count;
22
+ };
23
+ };
24
+
25
+ /*
26
+ * Returns the (absolute) position directly after the top parent node of a given `nodeType` in the current selection.
27
+ *
28
+ * ```typescript
29
+ * const nestingLevel = getEndTopParentNodeOfType(schema.nodes.table)(selection);
30
+ * ```
31
+ */
32
+ export var getPositionAfterTopParentNodeOfType = function getPositionAfterTopParentNodeOfType(nodeType) {
33
+ return function (selection) {
34
+ var $from = selection.$from;
35
+ // Loop through parent nodes from top to bottom
36
+ for (var depth = 1; depth <= $from.depth; depth++) {
37
+ var node = $from.node(depth);
38
+ // Count the table nodes
39
+ if (node.type === nodeType) {
40
+ return $from.after(depth);
41
+ }
42
+ }
43
+ };
44
+ };
@@ -38,6 +38,16 @@ var getHandleStyle = function getHandleStyle(node) {
38
38
  export var ignoreResizerMutations = function ignoreResizerMutations(mutation) {
39
39
  return mutation.target.classList.contains('resizer-item') || mutation.type === 'attributes' && mutation.attributeName === 'style';
40
40
  };
41
+ var resizingStyles = {
42
+ left: '50%',
43
+ transform: 'translateX(-50%)',
44
+ display: 'grid'
45
+ };
46
+
47
+ // Apply grid to stop drag handles rendering inside .resizer-item affecting its height
48
+ var defaultStyles = {
49
+ display: 'grid'
50
+ };
41
51
 
42
52
  /**
43
53
  * BreakoutResizer is a common component used to resize nodes that support the 'Breakout' mark, so it requires
@@ -141,11 +151,7 @@ var BreakoutResizer = function BreakoutResizer(_ref) {
141
151
  maxWidth: maxWidth
142
152
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
143
153
  ,
144
- style: isResizing ? {
145
- // during resize need to center as the resizer-item gets an explicit width value
146
- left: '50%',
147
- transform: 'translateX(-50%)'
148
- } : undefined,
154
+ style: isResizing ? resizingStyles : defaultStyles,
149
155
  handleResizeStart: handleResizeStart,
150
156
  handleResizeStop: handleResizeStop,
151
157
  childrenDOMRef: getRef,
@@ -52,14 +52,15 @@ export var headingsSharedStyles = function headingsSharedStyles(typographyTheme)
52
52
  '& h1': {
53
53
  font: editorUGCToken('editor.font.heading.h1', typographyTheme),
54
54
  marginBottom: 0,
55
- marginTop: '1.667em',
55
+ marginTop: '1.45833em',
56
56
  '& strong': {
57
57
  fontWeight: editorUGCToken('editor.font.weight.heading.h1.bold', typographyTheme)
58
- }
58
+ },
59
+ '&::before': {}
59
60
  },
60
61
  '& h2': {
61
62
  font: editorUGCToken('editor.font.heading.h2', typographyTheme),
62
- marginTop: '1.8em',
63
+ marginTop: '1.4em',
63
64
  marginBottom: 0,
64
65
  '& strong': {
65
66
  fontWeight: editorUGCToken('editor.font.weight.heading.h1.bold', typographyTheme)
@@ -67,7 +68,7 @@ export var headingsSharedStyles = function headingsSharedStyles(typographyTheme)
67
68
  },
68
69
  '& h3': {
69
70
  font: editorUGCToken('editor.font.heading.h3', typographyTheme),
70
- marginTop: '2em',
71
+ marginTop: '1.31249em',
71
72
  marginBottom: 0,
72
73
  '& strong': {
73
74
  fontWeight: editorUGCToken('editor.font.weight.heading.h1.bold', typographyTheme)
@@ -75,14 +76,14 @@ export var headingsSharedStyles = function headingsSharedStyles(typographyTheme)
75
76
  },
76
77
  '& h4': {
77
78
  font: editorUGCToken('editor.font.heading.h4', typographyTheme),
78
- marginTop: '1.357em',
79
+ marginTop: '1.25em',
79
80
  '& strong': {
80
81
  fontWeight: editorUGCToken('editor.font.weight.heading.h1.bold', typographyTheme)
81
82
  }
82
83
  },
83
84
  '& h5': {
84
85
  font: editorUGCToken('editor.font.heading.h5', typographyTheme),
85
- marginTop: '1.667em',
86
+ marginTop: '1.45833em',
86
87
  textTransform: 'none',
87
88
  '& strong': {
88
89
  fontWeight: editorUGCToken('editor.font.weight.heading.h1.bold', typographyTheme)
@@ -90,7 +91,7 @@ export var headingsSharedStyles = function headingsSharedStyles(typographyTheme)
90
91
  },
91
92
  '& h6': {
92
93
  font: editorUGCToken('editor.font.heading.h6', typographyTheme),
93
- marginTop: '1.455em',
94
+ marginTop: '1.59091em',
94
95
  textTransform: 'none',
95
96
  '& strong': {
96
97
  fontWeight: editorUGCToken('editor.font.weight.heading.h1.bold', typographyTheme)
@@ -21,7 +21,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
21
21
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "94.18.1";
24
+ var packageVersion = "94.20.0";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var DropList = /*#__PURE__*/function (_Component) {
@@ -316,6 +316,7 @@ export interface CollabParticipant {
316
316
  name: string;
317
317
  cursorPos?: number;
318
318
  permit?: ProviderParticipantPermitLevel;
319
+ isGuest?: boolean;
319
320
  }
320
321
  export type ProviderParticipant = CollabParticipant & {
321
322
  userId: string;
@@ -1,5 +1,6 @@
1
1
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { Decoration, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
3
+ export declare function makeNodePlaceholderId(nodeType: string, pos: number): string;
3
4
  /**
4
5
  * 🧱 Internal: Editor FE Platform
5
6
  *
@@ -0,0 +1,4 @@
1
+ import type { NodeType } from '@atlaskit/editor-prosemirror/model';
2
+ import type { Selection } from '@atlaskit/editor-prosemirror/state';
3
+ export declare const getParentOfTypeCount: (nodeType: NodeType) => (selection: Selection) => number;
4
+ export declare const getPositionAfterTopParentNodeOfType: (nodeType: NodeType) => (selection: Selection) => number | undefined;
@@ -316,6 +316,7 @@ export interface CollabParticipant {
316
316
  name: string;
317
317
  cursorPos?: number;
318
318
  permit?: ProviderParticipantPermitLevel;
319
+ isGuest?: boolean;
319
320
  }
320
321
  export type ProviderParticipant = CollabParticipant & {
321
322
  userId: string;
@@ -1,5 +1,6 @@
1
1
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { Decoration, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
3
+ export declare function makeNodePlaceholderId(nodeType: string, pos: number): string;
3
4
  /**
4
5
  * 🧱 Internal: Editor FE Platform
5
6
  *
@@ -0,0 +1,4 @@
1
+ import type { NodeType } from '@atlaskit/editor-prosemirror/model';
2
+ import type { Selection } from '@atlaskit/editor-prosemirror/state';
3
+ export declare const getParentOfTypeCount: (nodeType: NodeType) => (selection: Selection) => number;
4
+ export declare const getPositionAfterTopParentNodeOfType: (nodeType: NodeType) => (selection: Selection) => number | undefined;
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@atlaskit/editor-common/nesting",
3
+ "main": "../dist/cjs/nesting/utilities.js",
4
+ "module": "../dist/esm/nesting/utilities.js",
5
+ "module:es2019": "../dist/es2019/nesting/utilities.js",
6
+ "sideEffects": false,
7
+ "types": "../dist/types/nesting/utilities.d.ts",
8
+ "typesVersions": {
9
+ ">=4.5 <5.4": {
10
+ "*": [
11
+ "../dist/types-ts4.5/nesting/utilities.d.ts"
12
+ ]
13
+ }
14
+ }
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "94.18.1",
3
+ "version": "94.20.0",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -105,6 +105,7 @@
105
105
  "./code-block": "./src/code-block/index.ts",
106
106
  "./table": "./src/table/index.ts",
107
107
  "./lazy-node-view": "./src/lazy-node-view/index.ts",
108
+ "./nesting": "./src/nesting/utilities.ts",
108
109
  "./UNSAFE_do_not_use_editor_context": "./src/ui/EditorContext/index.ts"
109
110
  },
110
111
  "dependencies": {
@@ -136,7 +137,7 @@
136
137
  "@atlaskit/media-common": "^11.7.0",
137
138
  "@atlaskit/media-file-preview": "^0.9.0",
138
139
  "@atlaskit/media-picker": "^67.0.0",
139
- "@atlaskit/media-ui": "^26.1.0",
140
+ "@atlaskit/media-ui": "^26.2.0",
140
141
  "@atlaskit/media-viewer": "49.4.0",
141
142
  "@atlaskit/mention": "^23.3.0",
142
143
  "@atlaskit/menu": "^2.13.0",
@@ -144,14 +145,14 @@
144
145
  "@atlaskit/platform-feature-flags": "^0.3.0",
145
146
  "@atlaskit/popper": "^6.3.0",
146
147
  "@atlaskit/primitives": "^13.1.0",
147
- "@atlaskit/profilecard": "^20.10.0",
148
+ "@atlaskit/profilecard": "^20.11.0",
148
149
  "@atlaskit/section-message": "^6.6.0",
149
150
  "@atlaskit/smart-card": "^30.2.0",
150
151
  "@atlaskit/smart-user-picker": "^6.11.0",
151
152
  "@atlaskit/spinner": "^16.3.0",
152
153
  "@atlaskit/task-decision": "^17.11.0",
153
154
  "@atlaskit/textfield": "^6.5.0",
154
- "@atlaskit/tmp-editor-statsig": "^2.13.0",
155
+ "@atlaskit/tmp-editor-statsig": "^2.14.0",
155
156
  "@atlaskit/tokens": "^2.2.0",
156
157
  "@atlaskit/tooltip": "^18.9.0",
157
158
  "@atlaskit/width-detector": "^4.3.0",
@@ -277,6 +278,9 @@
277
278
  "platform_editor_replace_finddomnode_in_common": {
278
279
  "type": "boolean"
279
280
  },
281
+ "platform_editor_ed-25557_lnv_add_ssr_placeholder": {
282
+ "type": "boolean"
283
+ },
280
284
  "platform-visual-refresh-icons": {
281
285
  "type": "boolean"
282
286
  },