@atlaskit/editor-plugin-synced-block 10.0.1 → 10.0.4

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,25 @@
1
1
  # @atlaskit/editor-plugin-synced-block
2
2
 
3
+ ## 10.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d034aa0575c89`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d034aa0575c89) -
8
+ Add same-document analytics for synced block edit source and always evaluate the scroll gate.
9
+ - Updated dependencies
10
+
11
+ ## 10.0.3
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
17
+ ## 10.0.2
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies
22
+
3
23
  ## 10.0.1
4
24
 
5
25
  ### Patch Changes
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.unsync = exports.removeSyncedBlockAtPos = exports.removeSyncedBlock = exports.editSyncedBlockSource = exports.createSyncedBlock = exports.copySyncedBlockReferenceToClipboardEditorCommand = exports.copySyncedBlockReferenceToClipboard = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
7
9
  var _schemaDefault = require("@atlaskit/adf-schema/schema-default");
8
10
  var _analytics = require("@atlaskit/editor-common/analytics");
9
11
  var _copyButton = require("@atlaskit/editor-common/copy-button");
@@ -15,6 +17,8 @@ var _main = require("../pm-plugins/main");
15
17
  var _utils2 = require("../pm-plugins/utils/utils");
16
18
  var _types = require("../types");
17
19
  var _utils3 = require("./utils");
20
+ 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; }
21
+ 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; }
18
22
  var createSyncedBlock = exports.createSyncedBlock = function createSyncedBlock(_ref) {
19
23
  var tr = _ref.tr,
20
24
  syncBlockStore = _ref.syncBlockStore,
@@ -187,6 +191,9 @@ var editSyncedBlockSource = exports.editSyncedBlockSource = function editSyncedB
187
191
  }
188
192
  var syncBlockURL = syncBlockStore.referenceManager.getSyncBlockURL(resourceId);
189
193
  var syncBlockData = (_syncBlockStore$refer = syncBlockStore.referenceManager.getFromCache(resourceId)) === null || _syncBlockStore$refer === void 0 ? void 0 : _syncBlockStore$refer.data;
194
+ var isOnSameDocument = (syncBlockData === null || syncBlockData === void 0 ? void 0 : syncBlockData.onSameDocument) === true;
195
+ var shouldReportSameDocument = (0, _platformFeatureFlags.fg)('platform_editor_blocks_patch_2');
196
+ var sourceBlock = shouldReportSameDocument && isOnSameDocument && syncBlockData ? (0, _utils3.findBodiedSyncBlockByLocalId)(state, syncBlockData.blockInstanceId) : undefined;
190
197
  if (syncBlockURL) {
191
198
  var _api$analytics5;
192
199
  api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 || _api$analytics5.actions.fireAnalyticsEvent({
@@ -194,17 +201,16 @@ var editSyncedBlockSource = exports.editSyncedBlockSource = function editSyncedB
194
201
  action: _analytics.ACTION.SYNCED_BLOCK_EDIT_SOURCE,
195
202
  actionSubject: _analytics.ACTION_SUBJECT.SYNCED_BLOCK,
196
203
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.SYNCED_BLOCK_SOURCE_URL,
197
- attributes: {
204
+ attributes: _objectSpread({
198
205
  resourceId: resourceId
199
- }
206
+ }, shouldReportSameDocument ? {
207
+ sameDocument: isOnSameDocument
208
+ } : {})
200
209
  });
201
- if (syncBlockData !== null && syncBlockData !== void 0 && syncBlockData.onSameDocument && (0, _platformFeatureFlags.fg)('platform_editor_blocks_patch_2')) {
202
- var sourceBlock = (0, _utils3.findBodiedSyncBlockByLocalId)(state, syncBlockData.blockInstanceId);
203
- if (sourceBlock) {
204
- var tr = state.tr.setSelection(_state.NodeSelection.create(state.doc, sourceBlock.pos)).scrollIntoView();
205
- dispatch === null || dispatch === void 0 || dispatch(tr);
206
- return true;
207
- }
210
+ if (sourceBlock) {
211
+ var tr = state.tr.setSelection(_state.NodeSelection.create(state.doc, sourceBlock.pos)).scrollIntoView();
212
+ dispatch === null || dispatch === void 0 || dispatch(tr);
213
+ return true;
208
214
  }
209
215
  window.open(syncBlockURL, '_blank');
210
216
  } else {
@@ -186,6 +186,9 @@ export const editSyncedBlockSource = (syncBlockStore, api) => (state, dispatch,
186
186
  }
187
187
  const syncBlockURL = syncBlockStore.referenceManager.getSyncBlockURL(resourceId);
188
188
  const syncBlockData = (_syncBlockStore$refer = syncBlockStore.referenceManager.getFromCache(resourceId)) === null || _syncBlockStore$refer === void 0 ? void 0 : _syncBlockStore$refer.data;
189
+ const isOnSameDocument = (syncBlockData === null || syncBlockData === void 0 ? void 0 : syncBlockData.onSameDocument) === true;
190
+ const shouldReportSameDocument = fg('platform_editor_blocks_patch_2');
191
+ const sourceBlock = shouldReportSameDocument && isOnSameDocument && syncBlockData ? findBodiedSyncBlockByLocalId(state, syncBlockData.blockInstanceId) : undefined;
189
192
  if (syncBlockURL) {
190
193
  var _api$analytics5;
191
194
  api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions.fireAnalyticsEvent({
@@ -194,16 +197,16 @@ export const editSyncedBlockSource = (syncBlockStore, api) => (state, dispatch,
194
197
  actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
195
198
  actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_SOURCE_URL,
196
199
  attributes: {
197
- resourceId: resourceId
200
+ resourceId: resourceId,
201
+ ...(shouldReportSameDocument ? {
202
+ sameDocument: isOnSameDocument
203
+ } : {})
198
204
  }
199
205
  });
200
- if (syncBlockData !== null && syncBlockData !== void 0 && syncBlockData.onSameDocument && fg('platform_editor_blocks_patch_2')) {
201
- const sourceBlock = findBodiedSyncBlockByLocalId(state, syncBlockData.blockInstanceId);
202
- if (sourceBlock) {
203
- const tr = state.tr.setSelection(NodeSelection.create(state.doc, sourceBlock.pos)).scrollIntoView();
204
- dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr);
205
- return true;
206
- }
206
+ if (sourceBlock) {
207
+ const tr = state.tr.setSelection(NodeSelection.create(state.doc, sourceBlock.pos)).scrollIntoView();
208
+ dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr);
209
+ return true;
207
210
  }
208
211
  window.open(syncBlockURL, '_blank');
209
212
  } else {
@@ -1,3 +1,6 @@
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; }
1
4
  import { defaultSchema } from '@atlaskit/adf-schema/schema-default';
2
5
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
3
6
  import { copyDomNode, toDOM } from '@atlaskit/editor-common/copy-button';
@@ -181,6 +184,9 @@ export var editSyncedBlockSource = function editSyncedBlockSource(syncBlockStore
181
184
  }
182
185
  var syncBlockURL = syncBlockStore.referenceManager.getSyncBlockURL(resourceId);
183
186
  var syncBlockData = (_syncBlockStore$refer = syncBlockStore.referenceManager.getFromCache(resourceId)) === null || _syncBlockStore$refer === void 0 ? void 0 : _syncBlockStore$refer.data;
187
+ var isOnSameDocument = (syncBlockData === null || syncBlockData === void 0 ? void 0 : syncBlockData.onSameDocument) === true;
188
+ var shouldReportSameDocument = fg('platform_editor_blocks_patch_2');
189
+ var sourceBlock = shouldReportSameDocument && isOnSameDocument && syncBlockData ? findBodiedSyncBlockByLocalId(state, syncBlockData.blockInstanceId) : undefined;
184
190
  if (syncBlockURL) {
185
191
  var _api$analytics5;
186
192
  api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 || _api$analytics5.actions.fireAnalyticsEvent({
@@ -188,17 +194,16 @@ export var editSyncedBlockSource = function editSyncedBlockSource(syncBlockStore
188
194
  action: ACTION.SYNCED_BLOCK_EDIT_SOURCE,
189
195
  actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
190
196
  actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_SOURCE_URL,
191
- attributes: {
197
+ attributes: _objectSpread({
192
198
  resourceId: resourceId
193
- }
199
+ }, shouldReportSameDocument ? {
200
+ sameDocument: isOnSameDocument
201
+ } : {})
194
202
  });
195
- if (syncBlockData !== null && syncBlockData !== void 0 && syncBlockData.onSameDocument && fg('platform_editor_blocks_patch_2')) {
196
- var sourceBlock = findBodiedSyncBlockByLocalId(state, syncBlockData.blockInstanceId);
197
- if (sourceBlock) {
198
- var tr = state.tr.setSelection(NodeSelection.create(state.doc, sourceBlock.pos)).scrollIntoView();
199
- dispatch === null || dispatch === void 0 || dispatch(tr);
200
- return true;
201
- }
203
+ if (sourceBlock) {
204
+ var tr = state.tr.setSelection(NodeSelection.create(state.doc, sourceBlock.pos)).scrollIntoView();
205
+ dispatch === null || dispatch === void 0 || dispatch(tr);
206
+ return true;
202
207
  }
203
208
  window.open(syncBlockURL, '_blank');
204
209
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-synced-block",
3
- "version": "10.0.1",
3
+ "version": "10.0.4",
4
4
  "description": "SyncedBlock plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -20,7 +20,7 @@
20
20
  "sideEffects": false,
21
21
  "atlaskit:src": "src/index.ts",
22
22
  "dependencies": {
23
- "@atlaskit/adf-schema": "^55.0.0",
23
+ "@atlaskit/adf-schema": "^55.2.0",
24
24
  "@atlaskit/button": "24.0.0",
25
25
  "@atlaskit/dropdown-menu": "17.0.0",
26
26
  "@atlaskit/editor-json-transformer": "^9.0.0",
@@ -35,7 +35,7 @@
35
35
  "@atlaskit/editor-plugin-user-intent": "^10.0.0",
36
36
  "@atlaskit/editor-prosemirror": "^8.0.0",
37
37
  "@atlaskit/editor-shared-styles": "^4.0.0",
38
- "@atlaskit/editor-synced-block-provider": "^8.0.0",
38
+ "@atlaskit/editor-synced-block-provider": "^8.1.0",
39
39
  "@atlaskit/editor-toolbar": "^2.0.0",
40
40
  "@atlaskit/flag": "^18.0.0",
41
41
  "@atlaskit/icon": "36.0.0",
@@ -46,7 +46,7 @@
46
46
  "@atlaskit/platform-feature-flags": "^2.0.0",
47
47
  "@atlaskit/primitives": "^20.0.0",
48
48
  "@atlaskit/spinner": "20.0.0",
49
- "@atlaskit/tmp-editor-statsig": "^105.0.0",
49
+ "@atlaskit/tmp-editor-statsig": "^107.1.0",
50
50
  "@atlaskit/tokens": "14.0.0",
51
51
  "@atlaskit/tooltip": "^23.0.0",
52
52
  "@atlaskit/visually-hidden": "^4.0.0",
@@ -56,7 +56,7 @@
56
56
  "date-fns": "^2.17.0"
57
57
  },
58
58
  "peerDependencies": {
59
- "@atlaskit/editor-common": "^116.1.0",
59
+ "@atlaskit/editor-common": "^116.3.0",
60
60
  "react": "^18.2.0",
61
61
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
62
62
  },