@atlaskit/editor-plugin-synced-block 10.2.4 → 10.2.6

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,31 @@
1
1
  # @atlaskit/editor-plugin-synced-block
2
2
 
3
+ ## 10.2.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 10.2.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [`12355710b809c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/12355710b809c) -
14
+ Add the `platform_editor_sync_block_activation` boolean experiment API to
15
+ `@atlaskit/tmp-editor-statsig` for Confluence sync block activation checks. Consumers can gate
16
+ sync block activation behavior with
17
+ `expValEquals('platform_editor_sync_block_activation', 'isEnabled', true)`, for example to keep
18
+ source synced block placeholders visible only while the activation experiment is enabled.
19
+
20
+ Decoration-based placeholders now remain visible for empty source synced blocks while activation
21
+ is enabled.
22
+
23
+ The bodied synced block source nodeview now keeps its existing SSR streaming label-container fix
24
+ and only applies the non-SSR separate label container behavior when
25
+ `platform_synced_block_patch_14` is enabled.
26
+
27
+ - Updated dependencies
28
+
3
29
  ## 10.2.4
4
30
 
5
31
  ### Patch Changes
@@ -278,8 +278,7 @@ var editSyncedBlockSource = exports.editSyncedBlockSource = function editSyncedB
278
278
  var syncBlockURL = syncBlockStore.referenceManager.getSyncBlockURL(resourceId);
279
279
  var syncBlockData = (_syncBlockStore$refer = syncBlockStore.referenceManager.getFromCache(resourceId)) === null || _syncBlockStore$refer === void 0 ? void 0 : _syncBlockStore$refer.data;
280
280
  var isOnSameDocument = (syncBlockData === null || syncBlockData === void 0 ? void 0 : syncBlockData.onSameDocument) === true;
281
- var shouldReportSameDocument = (0, _platformFeatureFlags.fg)('platform_editor_blocks_patch_2');
282
- var sourceBlock = shouldReportSameDocument && isOnSameDocument && syncBlockData ? (0, _utils3.findBodiedSyncBlockByLocalId)(state, syncBlockData.blockInstanceId) : undefined;
281
+ var sourceBlock = isOnSameDocument && syncBlockData ? (0, _utils3.findBodiedSyncBlockByLocalId)(state, syncBlockData.blockInstanceId) : undefined;
283
282
  if (syncBlockURL) {
284
283
  var _api$analytics5;
285
284
  api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 || _api$analytics5.actions.fireAnalyticsEvent({
@@ -287,11 +286,10 @@ var editSyncedBlockSource = exports.editSyncedBlockSource = function editSyncedB
287
286
  action: _analytics.ACTION.SYNCED_BLOCK_EDIT_SOURCE,
288
287
  actionSubject: _analytics.ACTION_SUBJECT.SYNCED_BLOCK,
289
288
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.SYNCED_BLOCK_SOURCE_URL,
290
- attributes: _objectSpread({
291
- resourceId: resourceId
292
- }, shouldReportSameDocument ? {
289
+ attributes: {
290
+ resourceId: resourceId,
293
291
  sameDocument: isOnSameDocument
294
- } : {})
292
+ }
295
293
  });
296
294
  if (sourceBlock) {
297
295
  var tr = state.tr.setSelection(_state.NodeSelection.create(state.doc, sourceBlock.pos)).scrollIntoView();
@@ -18,6 +18,8 @@ var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/rea
18
18
  var _syncBlock = require("@atlaskit/editor-common/sync-block");
19
19
  var _editorPluginConnectivity = require("@atlaskit/editor-plugin-connectivity");
20
20
  var _model = require("@atlaskit/editor-prosemirror/model");
21
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
22
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
21
23
  var _BodiedSyncBlockWrapper = require("../ui/BodiedSyncBlockWrapper");
22
24
  var _SyncBlockLabel = require("../ui/SyncBlockLabel");
23
25
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
@@ -190,12 +192,17 @@ var BodiedSyncBlock = exports.BodiedSyncBlock = /*#__PURE__*/function () {
190
192
  this.dom = dom;
191
193
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
192
194
  this.contentDOM = contentDOM;
193
-
194
- // During SSR, the portal's renderToStaticMarkup + innerHTML clobbers
195
- // contentDOM. Render the label into a separate container to prevent this.
196
- // On client, render directly into this.dom as before.
197
195
  var labelContainer;
198
196
  if ((0, _coreUtils.isSSR)() && (0, _coreUtils.isSSRStreaming)()) {
197
+ // During SSR, the portal's renderToStaticMarkup + innerHTML clobbers
198
+ // contentDOM. Render the label into a separate container to prevent this.
199
+ // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- NodeView DOM must be created against active runtime document
200
+ labelContainer = document.createElement('div');
201
+ this.dom.appendChild(labelContainer);
202
+ } else if ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_14') || (0, _expValEquals.expValEquals)('platform_editor_sync_block_activation', 'isEnabled', true)) {
203
+ // Render the label into a separate container for the activation experience so
204
+ // portal implementations that write directly into the target do not clobber
205
+ // the ProseMirror contentDOM.
199
206
  // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- NodeView DOM must be created against active runtime document
200
207
  labelContainer = document.createElement('div');
201
208
  this.dom.appendChild(labelContainer);
@@ -274,8 +274,7 @@ export const editSyncedBlockSource = (syncBlockStore, api) => (state, dispatch,
274
274
  const syncBlockURL = syncBlockStore.referenceManager.getSyncBlockURL(resourceId);
275
275
  const syncBlockData = (_syncBlockStore$refer = syncBlockStore.referenceManager.getFromCache(resourceId)) === null || _syncBlockStore$refer === void 0 ? void 0 : _syncBlockStore$refer.data;
276
276
  const isOnSameDocument = (syncBlockData === null || syncBlockData === void 0 ? void 0 : syncBlockData.onSameDocument) === true;
277
- const shouldReportSameDocument = fg('platform_editor_blocks_patch_2');
278
- const sourceBlock = shouldReportSameDocument && isOnSameDocument && syncBlockData ? findBodiedSyncBlockByLocalId(state, syncBlockData.blockInstanceId) : undefined;
277
+ const sourceBlock = isOnSameDocument && syncBlockData ? findBodiedSyncBlockByLocalId(state, syncBlockData.blockInstanceId) : undefined;
279
278
  if (syncBlockURL) {
280
279
  var _api$analytics5;
281
280
  api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions.fireAnalyticsEvent({
@@ -285,9 +284,7 @@ export const editSyncedBlockSource = (syncBlockStore, api) => (state, dispatch,
285
284
  actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_SOURCE_URL,
286
285
  attributes: {
287
286
  resourceId: resourceId,
288
- ...(shouldReportSameDocument ? {
289
- sameDocument: isOnSameDocument
290
- } : {})
287
+ sameDocument: isOnSameDocument
291
288
  }
292
289
  });
293
290
  if (sourceBlock) {
@@ -6,6 +6,8 @@ import ReactNodeView from '@atlaskit/editor-common/react-node-view';
6
6
  import { BodiedSyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
7
7
  import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
8
8
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
9
+ import { fg } from '@atlaskit/platform-feature-flags';
10
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
11
  import { BodiedSyncBlockWrapper } from '../ui/BodiedSyncBlockWrapper';
10
12
  import { SyncBlockLabel } from '../ui/SyncBlockLabel';
11
13
  const toDOMOld = () => ['div', {
@@ -155,12 +157,17 @@ export class BodiedSyncBlock {
155
157
  this.dom = dom;
156
158
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
157
159
  this.contentDOM = contentDOM;
158
-
159
- // During SSR, the portal's renderToStaticMarkup + innerHTML clobbers
160
- // contentDOM. Render the label into a separate container to prevent this.
161
- // On client, render directly into this.dom as before.
162
160
  let labelContainer;
163
161
  if (isSSR() && isSSRStreaming()) {
162
+ // During SSR, the portal's renderToStaticMarkup + innerHTML clobbers
163
+ // contentDOM. Render the label into a separate container to prevent this.
164
+ // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- NodeView DOM must be created against active runtime document
165
+ labelContainer = document.createElement('div');
166
+ this.dom.appendChild(labelContainer);
167
+ } else if (fg('platform_synced_block_patch_14') || expValEquals('platform_editor_sync_block_activation', 'isEnabled', true)) {
168
+ // Render the label into a separate container for the activation experience so
169
+ // portal implementations that write directly into the target do not clobber
170
+ // the ProseMirror contentDOM.
164
171
  // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- NodeView DOM must be created against active runtime document
165
172
  labelContainer = document.createElement('div');
166
173
  this.dom.appendChild(labelContainer);
@@ -271,8 +271,7 @@ export var editSyncedBlockSource = function editSyncedBlockSource(syncBlockStore
271
271
  var syncBlockURL = syncBlockStore.referenceManager.getSyncBlockURL(resourceId);
272
272
  var syncBlockData = (_syncBlockStore$refer = syncBlockStore.referenceManager.getFromCache(resourceId)) === null || _syncBlockStore$refer === void 0 ? void 0 : _syncBlockStore$refer.data;
273
273
  var isOnSameDocument = (syncBlockData === null || syncBlockData === void 0 ? void 0 : syncBlockData.onSameDocument) === true;
274
- var shouldReportSameDocument = fg('platform_editor_blocks_patch_2');
275
- var sourceBlock = shouldReportSameDocument && isOnSameDocument && syncBlockData ? findBodiedSyncBlockByLocalId(state, syncBlockData.blockInstanceId) : undefined;
274
+ var sourceBlock = isOnSameDocument && syncBlockData ? findBodiedSyncBlockByLocalId(state, syncBlockData.blockInstanceId) : undefined;
276
275
  if (syncBlockURL) {
277
276
  var _api$analytics5;
278
277
  api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 || _api$analytics5.actions.fireAnalyticsEvent({
@@ -280,11 +279,10 @@ export var editSyncedBlockSource = function editSyncedBlockSource(syncBlockStore
280
279
  action: ACTION.SYNCED_BLOCK_EDIT_SOURCE,
281
280
  actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
282
281
  actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_SOURCE_URL,
283
- attributes: _objectSpread({
284
- resourceId: resourceId
285
- }, shouldReportSameDocument ? {
282
+ attributes: {
283
+ resourceId: resourceId,
286
284
  sameDocument: isOnSameDocument
287
- } : {})
285
+ }
288
286
  });
289
287
  if (sourceBlock) {
290
288
  var tr = state.tr.setSelection(NodeSelection.create(state.doc, sourceBlock.pos)).scrollIntoView();
@@ -13,6 +13,8 @@ import ReactNodeView from '@atlaskit/editor-common/react-node-view';
13
13
  import { BodiedSyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
14
14
  import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
15
15
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
16
+ import { fg } from '@atlaskit/platform-feature-flags';
17
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
16
18
  import { BodiedSyncBlockWrapper } from '../ui/BodiedSyncBlockWrapper';
17
19
  import { SyncBlockLabel } from '../ui/SyncBlockLabel';
18
20
  var toDOMOld = function toDOMOld() {
@@ -183,12 +185,17 @@ export var BodiedSyncBlock = /*#__PURE__*/function () {
183
185
  this.dom = dom;
184
186
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
185
187
  this.contentDOM = contentDOM;
186
-
187
- // During SSR, the portal's renderToStaticMarkup + innerHTML clobbers
188
- // contentDOM. Render the label into a separate container to prevent this.
189
- // On client, render directly into this.dom as before.
190
188
  var labelContainer;
191
189
  if (isSSR() && isSSRStreaming()) {
190
+ // During SSR, the portal's renderToStaticMarkup + innerHTML clobbers
191
+ // contentDOM. Render the label into a separate container to prevent this.
192
+ // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- NodeView DOM must be created against active runtime document
193
+ labelContainer = document.createElement('div');
194
+ this.dom.appendChild(labelContainer);
195
+ } else if (fg('platform_synced_block_patch_14') || expValEquals('platform_editor_sync_block_activation', 'isEnabled', true)) {
196
+ // Render the label into a separate container for the activation experience so
197
+ // portal implementations that write directly into the target do not clobber
198
+ // the ProseMirror contentDOM.
192
199
  // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- NodeView DOM must be created against active runtime document
193
200
  labelContainer = document.createElement('div');
194
201
  this.dom.appendChild(labelContainer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-synced-block",
3
- "version": "10.2.4",
3
+ "version": "10.2.6",
4
4
  "description": "SyncedBlock plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -21,7 +21,7 @@
21
21
  "atlaskit:src": "src/index.ts",
22
22
  "dependencies": {
23
23
  "@atlaskit/adf-schema": "^56.1.0",
24
- "@atlaskit/button": "24.3.1",
24
+ "@atlaskit/button": "24.3.2",
25
25
  "@atlaskit/dropdown-menu": "17.1.2",
26
26
  "@atlaskit/editor-json-transformer": "^9.0.0",
27
27
  "@atlaskit/editor-plugin-analytics": "^12.0.0",
@@ -46,8 +46,8 @@
46
46
  "@atlaskit/platform-feature-flags": "^2.0.0",
47
47
  "@atlaskit/primitives": "^20.6.0",
48
48
  "@atlaskit/spinner": "20.1.0",
49
- "@atlaskit/tmp-editor-statsig": "^124.1.0",
50
- "@atlaskit/tokens": "15.6.1",
49
+ "@atlaskit/tmp-editor-statsig": "^124.2.0",
50
+ "@atlaskit/tokens": "15.7.0",
51
51
  "@atlaskit/tooltip": "^23.1.0",
52
52
  "@atlaskit/visually-hidden": "^4.1.0",
53
53
  "@babel/runtime": "^7.0.0",
@@ -57,7 +57,7 @@
57
57
  "memoize-one": "^6.0.0"
58
58
  },
59
59
  "peerDependencies": {
60
- "@atlaskit/editor-common": "^116.26.0",
60
+ "@atlaskit/editor-common": "^116.27.0",
61
61
  "react": "^18.2.0",
62
62
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
63
63
  },
@@ -109,9 +109,6 @@
109
109
  "confluence_fronend_labels_categorization_migration": {
110
110
  "type": "boolean"
111
111
  },
112
- "platform_editor_blocks_patch_2": {
113
- "type": "boolean"
114
- },
115
112
  "platform_editor_blocks_patch_4": {
116
113
  "type": "boolean"
117
114
  },