@atlaskit/editor-plugin-synced-block 5.3.20 → 5.3.21

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,13 @@
1
1
  # @atlaskit/editor-plugin-synced-block
2
2
 
3
+ ## 5.3.21
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d7566e0dff5c9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d7566e0dff5c9) -
8
+ [ux] EDITOR-5273 fix sync block layout shift in ssr by adding class name to toDom
9
+ - Updated dependencies
10
+
3
11
  ## 5.3.20
4
12
 
5
13
  ### Patch Changes
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.bodiedSyncBlockNodeWithToDOMFixed = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _adfSchema = require("@atlaskit/adf-schema");
10
+ var _syncBlock = require("@atlaskit/editor-common/sync-block");
11
+ 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; }
12
+ 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; }
13
+ /**
14
+ * Based on packages/editor/editor-plugin-synced-block/src/nodeviews/bodiedSyncedBlock.tsx
15
+ * Adding correct classnames and structure to the toDOM, necessary for SSR rendering
16
+ */
17
+ var bodiedSyncBlockNodeWithToDOMFixed = exports.bodiedSyncBlockNodeWithToDOMFixed = function bodiedSyncBlockNodeWithToDOMFixed() {
18
+ return _objectSpread(_objectSpread({}, _adfSchema.bodiedSyncBlock), {}, {
19
+ toDOM: function toDOM(node) {
20
+ var _node$attrs = node.attrs,
21
+ localId = _node$attrs.localId,
22
+ resourceId = _node$attrs.resourceId;
23
+ var outerAttrs = {
24
+ class: _syncBlock.BodiedSyncBlockSharedCssClassName.prefix,
25
+ 'data-bodied-sync-block': '',
26
+ 'data-local-id': localId,
27
+ 'data-resource-id': resourceId
28
+ };
29
+ var innerAttrs = {
30
+ class: _syncBlock.BodiedSyncBlockSharedCssClassName.content
31
+ };
32
+ return ['div', outerAttrs, ['div', innerAttrs, 0]];
33
+ }
34
+ });
35
+ };
@@ -8,8 +8,10 @@ exports.syncedBlockPlugin = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _adfSchema = require("@atlaskit/adf-schema");
10
10
  var _editorSyncedBlockProvider = require("@atlaskit/editor-synced-block-provider");
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  var _editorActions = require("./editor-actions");
12
13
  var _editorCommands = require("./editor-commands");
14
+ var _bodiedSyncBlockNodeWithToDOMFixed = require("./nodeviews/bodiedSyncBlockNodeWithToDOMFixed");
13
15
  var _main = require("./pm-plugins/main");
14
16
  var _menuAndToolbarExperiences = require("./pm-plugins/menu-and-toolbar-experiences");
15
17
  var _blockMenuComponents = require("./ui/block-menu-components");
@@ -36,7 +38,7 @@ var syncedBlockPlugin = exports.syncedBlockPlugin = function syncedBlockPlugin(_
36
38
  node: _adfSchema.syncBlock
37
39
  }, {
38
40
  name: 'bodiedSyncBlock',
39
- node: _adfSchema.bodiedSyncBlock
41
+ node: (0, _platformFeatureFlags.fg)('platform_synced_block_patch_3') ? (0, _bodiedSyncBlockNodeWithToDOMFixed.bodiedSyncBlockNodeWithToDOMFixed)() : _adfSchema.bodiedSyncBlock
40
42
  }];
41
43
  },
42
44
  pmPlugins: function pmPlugins() {
@@ -0,0 +1,27 @@
1
+ import { bodiedSyncBlock } from '@atlaskit/adf-schema';
2
+ import { BodiedSyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
3
+ /**
4
+ * Based on packages/editor/editor-plugin-synced-block/src/nodeviews/bodiedSyncedBlock.tsx
5
+ * Adding correct classnames and structure to the toDOM, necessary for SSR rendering
6
+ */
7
+ export const bodiedSyncBlockNodeWithToDOMFixed = () => {
8
+ return {
9
+ ...bodiedSyncBlock,
10
+ toDOM: node => {
11
+ const {
12
+ localId,
13
+ resourceId
14
+ } = node.attrs;
15
+ const outerAttrs = {
16
+ class: BodiedSyncBlockSharedCssClassName.prefix,
17
+ 'data-bodied-sync-block': '',
18
+ 'data-local-id': localId,
19
+ 'data-resource-id': resourceId
20
+ };
21
+ const innerAttrs = {
22
+ class: BodiedSyncBlockSharedCssClassName.content
23
+ };
24
+ return ['div', outerAttrs, ['div', innerAttrs, 0]];
25
+ }
26
+ };
27
+ };
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  import { bodiedSyncBlock, syncBlock } from '@atlaskit/adf-schema';
3
3
  import { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { flushBodiedSyncBlocks, flushSyncBlocks } from './editor-actions';
5
6
  import { copySyncedBlockReferenceToClipboardEditorCommand, createSyncedBlock } from './editor-commands';
7
+ import { bodiedSyncBlockNodeWithToDOMFixed } from './nodeviews/bodiedSyncBlockNodeWithToDOMFixed';
6
8
  import { createPlugin, syncedBlockPluginKey } from './pm-plugins/main';
7
9
  import { getMenuAndToolbarExperiencesPlugin } from './pm-plugins/menu-and-toolbar-experiences';
8
10
  import { getBlockMenuComponents } from './ui/block-menu-components';
@@ -30,7 +32,7 @@ export const syncedBlockPlugin = ({
30
32
  node: syncBlock
31
33
  }, {
32
34
  name: 'bodiedSyncBlock',
33
- node: bodiedSyncBlock
35
+ node: fg('platform_synced_block_patch_3') ? bodiedSyncBlockNodeWithToDOMFixed() : bodiedSyncBlock
34
36
  }];
35
37
  },
36
38
  pmPlugins() {
@@ -0,0 +1,28 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ 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; }
3
+ 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; }
4
+ import { bodiedSyncBlock } from '@atlaskit/adf-schema';
5
+ import { BodiedSyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
6
+ /**
7
+ * Based on packages/editor/editor-plugin-synced-block/src/nodeviews/bodiedSyncedBlock.tsx
8
+ * Adding correct classnames and structure to the toDOM, necessary for SSR rendering
9
+ */
10
+ export var bodiedSyncBlockNodeWithToDOMFixed = function bodiedSyncBlockNodeWithToDOMFixed() {
11
+ return _objectSpread(_objectSpread({}, bodiedSyncBlock), {}, {
12
+ toDOM: function toDOM(node) {
13
+ var _node$attrs = node.attrs,
14
+ localId = _node$attrs.localId,
15
+ resourceId = _node$attrs.resourceId;
16
+ var outerAttrs = {
17
+ class: BodiedSyncBlockSharedCssClassName.prefix,
18
+ 'data-bodied-sync-block': '',
19
+ 'data-local-id': localId,
20
+ 'data-resource-id': resourceId
21
+ };
22
+ var innerAttrs = {
23
+ class: BodiedSyncBlockSharedCssClassName.content
24
+ };
25
+ return ['div', outerAttrs, ['div', innerAttrs, 0]];
26
+ }
27
+ });
28
+ };
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  import { bodiedSyncBlock, syncBlock } from '@atlaskit/adf-schema';
3
3
  import { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { flushBodiedSyncBlocks as _flushBodiedSyncBlocks, flushSyncBlocks } from './editor-actions';
5
6
  import { copySyncedBlockReferenceToClipboardEditorCommand, createSyncedBlock } from './editor-commands';
7
+ import { bodiedSyncBlockNodeWithToDOMFixed } from './nodeviews/bodiedSyncBlockNodeWithToDOMFixed';
6
8
  import { createPlugin, syncedBlockPluginKey } from './pm-plugins/main';
7
9
  import { getMenuAndToolbarExperiencesPlugin } from './pm-plugins/menu-and-toolbar-experiences';
8
10
  import { getBlockMenuComponents } from './ui/block-menu-components';
@@ -29,7 +31,7 @@ export var syncedBlockPlugin = function syncedBlockPlugin(_ref) {
29
31
  node: syncBlock
30
32
  }, {
31
33
  name: 'bodiedSyncBlock',
32
- node: bodiedSyncBlock
34
+ node: fg('platform_synced_block_patch_3') ? bodiedSyncBlockNodeWithToDOMFixed() : bodiedSyncBlock
33
35
  }];
34
36
  },
35
37
  pmPlugins: function pmPlugins() {
@@ -0,0 +1,6 @@
1
+ import type { NodeSpec } from '@atlaskit/editor-prosemirror/model';
2
+ /**
3
+ * Based on packages/editor/editor-plugin-synced-block/src/nodeviews/bodiedSyncedBlock.tsx
4
+ * Adding correct classnames and structure to the toDOM, necessary for SSR rendering
5
+ */
6
+ export declare const bodiedSyncBlockNodeWithToDOMFixed: () => NodeSpec;
@@ -0,0 +1,6 @@
1
+ import type { NodeSpec } from '@atlaskit/editor-prosemirror/model';
2
+ /**
3
+ * Based on packages/editor/editor-plugin-synced-block/src/nodeviews/bodiedSyncedBlock.tsx
4
+ * Adding correct classnames and structure to the toDOM, necessary for SSR rendering
5
+ */
6
+ export declare const bodiedSyncBlockNodeWithToDOMFixed: () => NodeSpec;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-synced-block",
3
- "version": "5.3.20",
3
+ "version": "5.3.21",
4
4
  "description": "SyncedBlock plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -40,7 +40,7 @@
40
40
  "@atlaskit/editor-plugin-selection": "^7.0.0",
41
41
  "@atlaskit/editor-prosemirror": "^7.3.0",
42
42
  "@atlaskit/editor-shared-styles": "^3.10.0",
43
- "@atlaskit/editor-synced-block-provider": "^3.28.0",
43
+ "@atlaskit/editor-synced-block-provider": "^3.29.0",
44
44
  "@atlaskit/editor-toolbar": "^0.19.0",
45
45
  "@atlaskit/flag": "^17.8.0",
46
46
  "@atlaskit/icon": "31.0.0",
@@ -61,7 +61,7 @@
61
61
  "react-intl-next": "npm:react-intl@^5.18.1"
62
62
  },
63
63
  "peerDependencies": {
64
- "@atlaskit/editor-common": "^111.12.0",
64
+ "@atlaskit/editor-common": "^111.13.0",
65
65
  "react": "^18.2.0"
66
66
  },
67
67
  "devDependencies": {
@@ -106,6 +106,9 @@
106
106
  "platform-feature-flags": {
107
107
  "platform_synced_block_patch_2": {
108
108
  "type": "boolean"
109
+ },
110
+ "platform_synced_block_patch_3": {
111
+ "type": "boolean"
109
112
  }
110
113
  }
111
114
  }