@atlaskit/editor-common 111.35.1 → 112.0.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 +23 -0
- package/dist/cjs/analytics/types/enums.js +2 -0
- package/dist/cjs/hooks/index.js +1 -8
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ncs-step-metrics/index.js +1 -0
- package/dist/cjs/preset/core-plugin/index.js +4 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/analytics/types/enums.js +2 -0
- package/dist/es2019/hooks/index.js +1 -2
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ncs-step-metrics/index.js +1 -0
- package/dist/es2019/preset/core-plugin/index.js +4 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/analytics/types/enums.js +2 -0
- package/dist/esm/hooks/index.js +1 -2
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ncs-step-metrics/index.js +1 -0
- package/dist/esm/preset/core-plugin/index.js +4 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/analytics/index.d.ts +1 -1
- package/dist/types/analytics/types/enums.d.ts +1 -0
- package/dist/types/analytics/types/events.d.ts +2 -2
- package/dist/types/analytics/types/paste-events.d.ts +6 -1
- package/dist/types/hooks/index.d.ts +0 -1
- package/dist/types-ts4.5/analytics/index.d.ts +1 -1
- package/dist/types-ts4.5/analytics/types/enums.d.ts +1 -0
- package/dist/types-ts4.5/analytics/types/events.d.ts +2 -2
- package/dist/types-ts4.5/analytics/types/paste-events.d.ts +6 -1
- package/dist/types-ts4.5/hooks/index.d.ts +0 -1
- package/package.json +2 -2
- package/dist/cjs/hooks/useSmartCardReloadAfterCache.js +0 -54
- package/dist/es2019/hooks/useSmartCardReloadAfterCache.js +0 -49
- package/dist/esm/hooks/useSmartCardReloadAfterCache.js +0 -49
- package/dist/types/hooks/useSmartCardReloadAfterCache.d.ts +0 -16
- package/dist/types-ts4.5/hooks/useSmartCardReloadAfterCache.d.ts +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 112.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`0fda7892b26bc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0fda7892b26bc) -
|
|
8
|
+
[ux] Remove useSmartCardReloadAfterCache hook
|
|
9
|
+
|
|
10
|
+
### Minor Changes
|
|
11
|
+
|
|
12
|
+
- [`71de71e52182e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/71de71e52182e) -
|
|
13
|
+
Remove @atlaskit/editor-plugin-ncs-metrics
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`7091cae4a7f26`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7091cae4a7f26) -
|
|
18
|
+
EDITOR-5607 Add analytics for new editor paste menu
|
|
19
|
+
- [`71de71e52182e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/71de71e52182e) -
|
|
20
|
+
Add experiment platform_editor_remove_collab_step_metrics which removes step metrics writes to
|
|
21
|
+
local storage from collab edit plugin
|
|
22
|
+
- [`8240c1a7e1875`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8240c1a7e1875) -
|
|
23
|
+
In view mode allow replace document to override behaviour
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
|
|
3
26
|
## 111.35.1
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -182,6 +182,7 @@ var ACTION = exports.ACTION = /*#__PURE__*/function (ACTION) {
|
|
|
182
182
|
ACTION["SELECT_ALL_ESCAPED"] = "selectAllEscaped";
|
|
183
183
|
ACTION["SORT_COLUMN"] = "sortedColumn";
|
|
184
184
|
ACTION["SORT_COLUMN_NOT_ALLOWED"] = "sortColumnNotAllowed";
|
|
185
|
+
// remove this enum when cleaning up platform_editor_remove_collab_step_metrics
|
|
185
186
|
ACTION["NCS_SESSION_STEP_METRICS"] = "ncsSessionStepMetrics";
|
|
186
187
|
ACTION["STEPS_TRACKED"] = "stepsTracked";
|
|
187
188
|
ACTION["ORGANIC_CHANGES_TRACKED"] = "organicChangesTracked";
|
|
@@ -366,6 +367,7 @@ var ACTION_SUBJECT = exports.ACTION_SUBJECT = /*#__PURE__*/function (ACTION_SUBJ
|
|
|
366
367
|
ACTION_SUBJECT["TOOLBAR_DROPDOWN_MENU_ITEM"] = "toolbarDropdownMenuItem";
|
|
367
368
|
ACTION_SUBJECT["BLOCK_MENU"] = "blockMenu";
|
|
368
369
|
ACTION_SUBJECT["BLOCK_MENU_ITEM"] = "blockMenuItem";
|
|
370
|
+
ACTION_SUBJECT["PASTE_ACTIONS_MENU"] = "pasteActionsMenu";
|
|
369
371
|
ACTION_SUBJECT["SYNCED_BLOCK"] = "syncedBlock";
|
|
370
372
|
return ACTION_SUBJECT;
|
|
371
373
|
}({});
|
package/dist/cjs/hooks/index.js
CHANGED
|
@@ -28,14 +28,7 @@ Object.defineProperty(exports, "useSharedPluginStateWithSelector", {
|
|
|
28
28
|
return _useSharedPluginStateWithSelector.useSharedPluginStateWithSelector;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
Object.defineProperty(exports, "useSmartCardReloadAfterCache", {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
get: function get() {
|
|
34
|
-
return _useSmartCardReloadAfterCache.default;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
31
|
var _usePreviousState = _interopRequireDefault(require("./usePreviousState"));
|
|
38
32
|
var _useConstructor = _interopRequireDefault(require("./useConstructor"));
|
|
39
33
|
var _useSharedPluginState = require("./useSharedPluginState");
|
|
40
|
-
var _useSharedPluginStateWithSelector = require("./useSharedPluginStateWithSelector");
|
|
41
|
-
var _useSmartCardReloadAfterCache = _interopRequireDefault(require("./useSmartCardReloadAfterCache"));
|
|
34
|
+
var _useSharedPluginStateWithSelector = require("./useSharedPluginStateWithSelector");
|
|
@@ -19,7 +19,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
19
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
20
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
21
21
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
22
|
-
var packageVersion = "
|
|
22
|
+
var packageVersion = "111.35.1";
|
|
23
23
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
24
24
|
// Remove URL as it has UGC
|
|
25
25
|
// Ignored via go/ees007
|
|
@@ -7,6 +7,7 @@ exports.NCS_STORAGE = void 0;
|
|
|
7
7
|
// Disable no-re-export rule for entry point files
|
|
8
8
|
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
9
9
|
var NCS_STORAGE = exports.NCS_STORAGE = /*#__PURE__*/function (NCS_STORAGE) {
|
|
10
|
+
// remove step metrics keys when cleaning up platform_editor_remove_collab_step_metrics
|
|
10
11
|
NCS_STORAGE["NCS_STORAGE_CLIENT_KEY"] = "ncs-session-step-metrics-storage";
|
|
11
12
|
NCS_STORAGE["NCS_SESSION_STEP_METRICS"] = "ncsSessionStepMetrics";
|
|
12
13
|
NCS_STORAGE["NCS_ACTIVE_SESSIONS"] = "ncsActiveSessions";
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.corePlugin = void 0;
|
|
7
7
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
8
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
8
9
|
var _nodeAnchorProvider = require("../../node-anchor/node-anchor-provider");
|
|
9
10
|
var _processRawValue = require("../../utils/processRawValue");
|
|
10
11
|
var _editorCommands = require("../editor-commands");
|
|
@@ -101,6 +102,9 @@ var corePlugin = exports.corePlugin = function corePlugin(_ref) {
|
|
|
101
102
|
if (content) {
|
|
102
103
|
var _options$scrollIntoVi2;
|
|
103
104
|
var tr = state.tr.replaceWith(0, state.doc.nodeSize - 2, content);
|
|
105
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_are_nodes_equal_ignore_mark_order', 'isEnabled', true)) {
|
|
106
|
+
tr.setMeta('replaceDocument', true);
|
|
107
|
+
}
|
|
104
108
|
if ((options === null || options === void 0 ? void 0 : options.addToHistory) === false) {
|
|
105
109
|
tr.setMeta('addToHistory', false);
|
|
106
110
|
}
|
|
@@ -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 = "
|
|
27
|
+
var packageVersion = "111.35.1";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var fadeIn = (0, _react2.keyframes)({
|
|
@@ -176,6 +176,7 @@ export let ACTION = /*#__PURE__*/function (ACTION) {
|
|
|
176
176
|
ACTION["SELECT_ALL_ESCAPED"] = "selectAllEscaped";
|
|
177
177
|
ACTION["SORT_COLUMN"] = "sortedColumn";
|
|
178
178
|
ACTION["SORT_COLUMN_NOT_ALLOWED"] = "sortColumnNotAllowed";
|
|
179
|
+
// remove this enum when cleaning up platform_editor_remove_collab_step_metrics
|
|
179
180
|
ACTION["NCS_SESSION_STEP_METRICS"] = "ncsSessionStepMetrics";
|
|
180
181
|
ACTION["STEPS_TRACKED"] = "stepsTracked";
|
|
181
182
|
ACTION["ORGANIC_CHANGES_TRACKED"] = "organicChangesTracked";
|
|
@@ -360,6 +361,7 @@ export let ACTION_SUBJECT = /*#__PURE__*/function (ACTION_SUBJECT) {
|
|
|
360
361
|
ACTION_SUBJECT["TOOLBAR_DROPDOWN_MENU_ITEM"] = "toolbarDropdownMenuItem";
|
|
361
362
|
ACTION_SUBJECT["BLOCK_MENU"] = "blockMenu";
|
|
362
363
|
ACTION_SUBJECT["BLOCK_MENU_ITEM"] = "blockMenuItem";
|
|
364
|
+
ACTION_SUBJECT["PASTE_ACTIONS_MENU"] = "pasteActionsMenu";
|
|
363
365
|
ACTION_SUBJECT["SYNCED_BLOCK"] = "syncedBlock";
|
|
364
366
|
return ACTION_SUBJECT;
|
|
365
367
|
}({});
|
|
@@ -4,5 +4,4 @@
|
|
|
4
4
|
export { default as usePreviousState } from './usePreviousState';
|
|
5
5
|
export { default as useConstructor } from './useConstructor';
|
|
6
6
|
export { useSharedPluginState } from './useSharedPluginState';
|
|
7
|
-
export { useSharedPluginStateWithSelector } from './useSharedPluginStateWithSelector';
|
|
8
|
-
export { default as useSmartCardReloadAfterCache } from './useSmartCardReloadAfterCache';
|
|
7
|
+
export { useSharedPluginStateWithSelector } from './useSharedPluginStateWithSelector';
|
|
@@ -4,7 +4,7 @@ import { isFedRamp } from './environment';
|
|
|
4
4
|
import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
|
|
5
5
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
6
6
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
7
|
-
const packageVersion = "
|
|
7
|
+
const packageVersion = "111.35.1";
|
|
8
8
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
9
9
|
// Remove URL as it has UGC
|
|
10
10
|
// Ignored via go/ees007
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
3
3
|
|
|
4
4
|
export let NCS_STORAGE = /*#__PURE__*/function (NCS_STORAGE) {
|
|
5
|
+
// remove step metrics keys when cleaning up platform_editor_remove_collab_step_metrics
|
|
5
6
|
NCS_STORAGE["NCS_STORAGE_CLIENT_KEY"] = "ncs-session-step-metrics-storage";
|
|
6
7
|
NCS_STORAGE["NCS_SESSION_STEP_METRICS"] = "ncsSessionStepMetrics";
|
|
7
8
|
NCS_STORAGE["NCS_ACTIVE_SESSIONS"] = "ncsActiveSessions";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Node } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
3
|
import { getNodeIdProvider } from '../../node-anchor/node-anchor-provider';
|
|
3
4
|
import { processRawFragmentValue, processRawValue, processRawValueWithoutValidation } from '../../utils/processRawValue';
|
|
4
5
|
import { editorCommandToPMCommand } from '../editor-commands';
|
|
@@ -103,6 +104,9 @@ export const corePlugin = ({
|
|
|
103
104
|
if (content) {
|
|
104
105
|
var _options$scrollIntoVi2;
|
|
105
106
|
const tr = state.tr.replaceWith(0, state.doc.nodeSize - 2, content);
|
|
107
|
+
if (expValEquals('platform_editor_are_nodes_equal_ignore_mark_order', 'isEnabled', true)) {
|
|
108
|
+
tr.setMeta('replaceDocument', true);
|
|
109
|
+
}
|
|
106
110
|
if ((options === null || options === void 0 ? void 0 : options.addToHistory) === false) {
|
|
107
111
|
tr.setMeta('addToHistory', false);
|
|
108
112
|
}
|
|
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import Layer from '../Layer';
|
|
16
16
|
const packageName = "@atlaskit/editor-common";
|
|
17
|
-
const packageVersion = "
|
|
17
|
+
const packageVersion = "111.35.1";
|
|
18
18
|
const halfFocusRing = 1;
|
|
19
19
|
const dropOffset = '0, 8';
|
|
20
20
|
const fadeIn = keyframes({
|
|
@@ -176,6 +176,7 @@ export var ACTION = /*#__PURE__*/function (ACTION) {
|
|
|
176
176
|
ACTION["SELECT_ALL_ESCAPED"] = "selectAllEscaped";
|
|
177
177
|
ACTION["SORT_COLUMN"] = "sortedColumn";
|
|
178
178
|
ACTION["SORT_COLUMN_NOT_ALLOWED"] = "sortColumnNotAllowed";
|
|
179
|
+
// remove this enum when cleaning up platform_editor_remove_collab_step_metrics
|
|
179
180
|
ACTION["NCS_SESSION_STEP_METRICS"] = "ncsSessionStepMetrics";
|
|
180
181
|
ACTION["STEPS_TRACKED"] = "stepsTracked";
|
|
181
182
|
ACTION["ORGANIC_CHANGES_TRACKED"] = "organicChangesTracked";
|
|
@@ -360,6 +361,7 @@ export var ACTION_SUBJECT = /*#__PURE__*/function (ACTION_SUBJECT) {
|
|
|
360
361
|
ACTION_SUBJECT["TOOLBAR_DROPDOWN_MENU_ITEM"] = "toolbarDropdownMenuItem";
|
|
361
362
|
ACTION_SUBJECT["BLOCK_MENU"] = "blockMenu";
|
|
362
363
|
ACTION_SUBJECT["BLOCK_MENU_ITEM"] = "blockMenuItem";
|
|
364
|
+
ACTION_SUBJECT["PASTE_ACTIONS_MENU"] = "pasteActionsMenu";
|
|
363
365
|
ACTION_SUBJECT["SYNCED_BLOCK"] = "syncedBlock";
|
|
364
366
|
return ACTION_SUBJECT;
|
|
365
367
|
}({});
|
package/dist/esm/hooks/index.js
CHANGED
|
@@ -4,5 +4,4 @@
|
|
|
4
4
|
export { default as usePreviousState } from './usePreviousState';
|
|
5
5
|
export { default as useConstructor } from './useConstructor';
|
|
6
6
|
export { useSharedPluginState } from './useSharedPluginState';
|
|
7
|
-
export { useSharedPluginStateWithSelector } from './useSharedPluginStateWithSelector';
|
|
8
|
-
export { default as useSmartCardReloadAfterCache } from './useSmartCardReloadAfterCache';
|
|
7
|
+
export { useSharedPluginStateWithSelector } from './useSharedPluginStateWithSelector';
|
|
@@ -10,7 +10,7 @@ import { isFedRamp } from './environment';
|
|
|
10
10
|
import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
|
|
11
11
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
12
12
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
13
|
-
var packageVersion = "
|
|
13
|
+
var packageVersion = "111.35.1";
|
|
14
14
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
15
15
|
// Remove URL as it has UGC
|
|
16
16
|
// Ignored via go/ees007
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
3
3
|
|
|
4
4
|
export var NCS_STORAGE = /*#__PURE__*/function (NCS_STORAGE) {
|
|
5
|
+
// remove step metrics keys when cleaning up platform_editor_remove_collab_step_metrics
|
|
5
6
|
NCS_STORAGE["NCS_STORAGE_CLIENT_KEY"] = "ncs-session-step-metrics-storage";
|
|
6
7
|
NCS_STORAGE["NCS_SESSION_STEP_METRICS"] = "ncsSessionStepMetrics";
|
|
7
8
|
NCS_STORAGE["NCS_ACTIVE_SESSIONS"] = "ncsActiveSessions";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Node } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
3
|
import { getNodeIdProvider } from '../../node-anchor/node-anchor-provider';
|
|
3
4
|
import { processRawFragmentValue, processRawValue, processRawValueWithoutValidation } from '../../utils/processRawValue';
|
|
4
5
|
import { editorCommandToPMCommand } from '../editor-commands';
|
|
@@ -96,6 +97,9 @@ export var corePlugin = function corePlugin(_ref) {
|
|
|
96
97
|
if (content) {
|
|
97
98
|
var _options$scrollIntoVi2;
|
|
98
99
|
var tr = state.tr.replaceWith(0, state.doc.nodeSize - 2, content);
|
|
100
|
+
if (expValEquals('platform_editor_are_nodes_equal_ignore_mark_order', 'isEnabled', true)) {
|
|
101
|
+
tr.setMeta('replaceDocument', true);
|
|
102
|
+
}
|
|
99
103
|
if ((options === null || options === void 0 ? void 0 : options.addToHistory) === false) {
|
|
100
104
|
tr.setMeta('addToHistory', false);
|
|
101
105
|
}
|
|
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
22
|
import Layer from '../Layer';
|
|
23
23
|
var packageName = "@atlaskit/editor-common";
|
|
24
|
-
var packageVersion = "
|
|
24
|
+
var packageVersion = "111.35.1";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var fadeIn = keyframes({
|
|
@@ -11,7 +11,7 @@ export type { InputMethodInsertLink, InputMethodInsertMedia, InsertMediaVia, Ins
|
|
|
11
11
|
export { CHANGE_ALIGNMENT_REASON, TABLE_ACTION, TABLE_BREAKOUT, TABLE_OVERFLOW_CHANGE_TRIGGER, TABLE_STATUS, TABLE_DISPLAY_MODE, } from './types/table-events';
|
|
12
12
|
export type { TableEventPayload, OverflowStateInfo } from './types/table-events';
|
|
13
13
|
export { PasteContents, PasteSources, PasteTypes } from './types/paste-events';
|
|
14
|
-
export type { PASTE_ACTION_SUBJECT_ID, PasteContent, PasteEventPayload, PasteSource, PasteType, } from './types/paste-events';
|
|
14
|
+
export type { PASTE_ACTION_SUBJECT_ID, PasteActionsMenuEventPayload, PasteActionsMenuOpenedAEP, PasteContent, PasteEventPayload, PasteSource, PasteType, } from './types/paste-events';
|
|
15
15
|
export type { MediaSwitchType, MediaAltTextActionType, MediaEventPayload, MediaLinkAEP, CaptionTrackAction, MediaResizeTrackAction, MediaInputResizeTrackAction, } from './types/media-events';
|
|
16
16
|
export type { MoveContentEventPayload } from './types/move-content-events';
|
|
17
17
|
export type { DispatchAnalyticsEvent } from './types/dispatch-analytics-event';
|
|
@@ -353,6 +353,7 @@ export declare enum ACTION_SUBJECT {
|
|
|
353
353
|
TOOLBAR_DROPDOWN_MENU_ITEM = "toolbarDropdownMenuItem",
|
|
354
354
|
BLOCK_MENU = "blockMenu",
|
|
355
355
|
BLOCK_MENU_ITEM = "blockMenuItem",
|
|
356
|
+
PASTE_ACTIONS_MENU = "pasteActionsMenu",
|
|
356
357
|
SYNCED_BLOCK = "syncedBlock"
|
|
357
358
|
}
|
|
358
359
|
export declare enum ACTION_SUBJECT_ID {
|
|
@@ -45,7 +45,7 @@ import type { NcsSessionStepEventAEP } from './ncs-session-step-events';
|
|
|
45
45
|
import type { NestedTableActionsEventPayload } from './nested-table-events';
|
|
46
46
|
import type { NodeEventPayload } from './node-events';
|
|
47
47
|
import type { OfflineEditingEventPayload } from './offline-editing-event';
|
|
48
|
-
import type { PasteEventPayload } from './paste-events';
|
|
48
|
+
import type { PasteActionsMenuEventPayload, PasteEventPayload } from './paste-events';
|
|
49
49
|
import type { ReferentialityEventPayload } from './referentiality-events';
|
|
50
50
|
import type { SelectionEventPayload } from './selection-events';
|
|
51
51
|
import type { SelectionExtensionEventPayload } from './selection-extension-events';
|
|
@@ -66,7 +66,7 @@ export type SimplifiedNode = {
|
|
|
66
66
|
pos: number;
|
|
67
67
|
type: string;
|
|
68
68
|
};
|
|
69
|
-
export type AnalyticsEventPayload<T = void> = AvatarEventPayload | GeneralEventPayload<T> | FormatEventPayload | SubstituteEventPayload | InsertEventPayload | NodeEventPayload | MoveContentEventPayload | MediaEventPayload | TableEventPayload | PasteEventPayload | CutCopyEventPayload | ErrorEventPayload | TextColorEventPayload | FindReplaceEventPayload | DateEventPayload | SelectionEventPayload | ListEventPayload | ConfigPanelEventPayload | ElementBrowserEventPayload | CreateLinkInlineDialogEventPayload | HighlightActionsEventPayload | UnsupportedContentPayload | ExtensionEventPayload | TransactionEventPayload | TypeAheadPayload | UnlinkToolbarAEP | EditLinkToolbarAEP | PreviewItemClickedAEP | OpenSettingsToolbarAEP | CustomPanelEventPayload | FeatureExposureAEP | NewCollabSyncUpErrorAEP | UnsupportedContentTooltipPayload | ReferentialityEventPayload | LoomEventPayload | MBEEventPayload | HighlightEventPayload | DatasourceClickedPayload | ElementEventPayload | VisitedLinkAEP | ViewEventPayload | MediaUploadEventPayload | MentionEventPayload | EngagementPlatformEventPayload | NestedTableActionsEventPayload | AICommandPaletteEventPayload | AIDefinitionsEventPayload | AIEventPayload | AIStreamingEventPayload | AIProactiveEventPayload | AIUnifiedEventPayload | BreakoutEventPayload | BlockMenuEventPayload | ActiveSessionEventPayload | AIInlineSuggestionPayload | SelectionExtensionEventPayload | TelepointerClickPayload | SelectionToolbarEventPayload | ExperienceEventPayload | AlignmentEventPayload | UndoRedoAEP | OfflineEditingEventPayload | NcsSessionStepEventAEP | FloatingToolbarOverflowEventPayload | SyncBlockEventPayload | FloatingToolbarEventPayload;
|
|
69
|
+
export type AnalyticsEventPayload<T = void> = AvatarEventPayload | GeneralEventPayload<T> | FormatEventPayload | SubstituteEventPayload | InsertEventPayload | NodeEventPayload | MoveContentEventPayload | MediaEventPayload | TableEventPayload | PasteEventPayload | PasteActionsMenuEventPayload | CutCopyEventPayload | ErrorEventPayload | TextColorEventPayload | FindReplaceEventPayload | DateEventPayload | SelectionEventPayload | ListEventPayload | ConfigPanelEventPayload | ElementBrowserEventPayload | CreateLinkInlineDialogEventPayload | HighlightActionsEventPayload | UnsupportedContentPayload | ExtensionEventPayload | TransactionEventPayload | TypeAheadPayload | UnlinkToolbarAEP | EditLinkToolbarAEP | PreviewItemClickedAEP | OpenSettingsToolbarAEP | CustomPanelEventPayload | FeatureExposureAEP | NewCollabSyncUpErrorAEP | UnsupportedContentTooltipPayload | ReferentialityEventPayload | LoomEventPayload | MBEEventPayload | HighlightEventPayload | DatasourceClickedPayload | ElementEventPayload | VisitedLinkAEP | ViewEventPayload | MediaUploadEventPayload | MentionEventPayload | EngagementPlatformEventPayload | NestedTableActionsEventPayload | AICommandPaletteEventPayload | AIDefinitionsEventPayload | AIEventPayload | AIStreamingEventPayload | AIProactiveEventPayload | AIUnifiedEventPayload | BreakoutEventPayload | BlockMenuEventPayload | ActiveSessionEventPayload | AIInlineSuggestionPayload | SelectionExtensionEventPayload | TelepointerClickPayload | SelectionToolbarEventPayload | ExperienceEventPayload | AlignmentEventPayload | UndoRedoAEP | OfflineEditingEventPayload | NcsSessionStepEventAEP | FloatingToolbarOverflowEventPayload | SyncBlockEventPayload | FloatingToolbarEventPayload;
|
|
70
70
|
type CustomPanelEventPayload = TrackAEP<ACTION.CHANGED_BACKGROUND_COLOR | ACTION.CHANGED_ICON | ACTION.REMOVE_ICON, ACTION_SUBJECT.PANEL, ACTION_SUBJECT_ID.PANEL, {
|
|
71
71
|
newColor: string;
|
|
72
72
|
previousColor: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, INPUT_METHOD } from './enums';
|
|
2
|
-
import type { OperationalAEP, TrackAEP } from './utils';
|
|
2
|
+
import type { OperationalAEP, TrackAEP, UIAEP } from './utils';
|
|
3
3
|
export declare const PasteTypes: {
|
|
4
4
|
[type: string]: PasteType;
|
|
5
5
|
};
|
|
@@ -18,6 +18,7 @@ type PasteBaseOperationalAEP<Action, Attributes> = OperationalAEP<Action, ACTION
|
|
|
18
18
|
type PasteAEP = PasteBaseAEP<ACTION.PASTED, {
|
|
19
19
|
content: PasteContent;
|
|
20
20
|
inputMethod: INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
|
|
21
|
+
invokedFrom?: string;
|
|
21
22
|
pasteSize: number;
|
|
22
23
|
source?: PasteSource;
|
|
23
24
|
type: PasteType;
|
|
@@ -36,4 +37,8 @@ type PastedTimedAEP = PasteBaseOperationalAEP<ACTION.PASTED_TIMED, {
|
|
|
36
37
|
time: number;
|
|
37
38
|
}>;
|
|
38
39
|
export type PasteEventPayload = PasteAEP | PasteAsPlainAEP | PastedTimedAEP;
|
|
40
|
+
export type PasteActionsMenuOpenedAEP = UIAEP<ACTION.OPENED, ACTION_SUBJECT.PASTE_ACTIONS_MENU, undefined, {
|
|
41
|
+
visibleAiActions: string[];
|
|
42
|
+
}, undefined>;
|
|
43
|
+
export type PasteActionsMenuEventPayload = PasteActionsMenuOpenedAEP;
|
|
39
44
|
export {};
|
|
@@ -2,4 +2,3 @@ export { default as usePreviousState } from './usePreviousState';
|
|
|
2
2
|
export { default as useConstructor } from './useConstructor';
|
|
3
3
|
export { useSharedPluginState } from './useSharedPluginState';
|
|
4
4
|
export { useSharedPluginStateWithSelector, type NamedPluginStatesFromInjectionAPI, } from './useSharedPluginStateWithSelector';
|
|
5
|
-
export { default as useSmartCardReloadAfterCache } from './useSmartCardReloadAfterCache';
|
|
@@ -11,7 +11,7 @@ export type { InputMethodInsertLink, InputMethodInsertMedia, InsertMediaVia, Ins
|
|
|
11
11
|
export { CHANGE_ALIGNMENT_REASON, TABLE_ACTION, TABLE_BREAKOUT, TABLE_OVERFLOW_CHANGE_TRIGGER, TABLE_STATUS, TABLE_DISPLAY_MODE, } from './types/table-events';
|
|
12
12
|
export type { TableEventPayload, OverflowStateInfo } from './types/table-events';
|
|
13
13
|
export { PasteContents, PasteSources, PasteTypes } from './types/paste-events';
|
|
14
|
-
export type { PASTE_ACTION_SUBJECT_ID, PasteContent, PasteEventPayload, PasteSource, PasteType, } from './types/paste-events';
|
|
14
|
+
export type { PASTE_ACTION_SUBJECT_ID, PasteActionsMenuEventPayload, PasteActionsMenuOpenedAEP, PasteContent, PasteEventPayload, PasteSource, PasteType, } from './types/paste-events';
|
|
15
15
|
export type { MediaSwitchType, MediaAltTextActionType, MediaEventPayload, MediaLinkAEP, CaptionTrackAction, MediaResizeTrackAction, MediaInputResizeTrackAction, } from './types/media-events';
|
|
16
16
|
export type { MoveContentEventPayload } from './types/move-content-events';
|
|
17
17
|
export type { DispatchAnalyticsEvent } from './types/dispatch-analytics-event';
|
|
@@ -353,6 +353,7 @@ export declare enum ACTION_SUBJECT {
|
|
|
353
353
|
TOOLBAR_DROPDOWN_MENU_ITEM = "toolbarDropdownMenuItem",
|
|
354
354
|
BLOCK_MENU = "blockMenu",
|
|
355
355
|
BLOCK_MENU_ITEM = "blockMenuItem",
|
|
356
|
+
PASTE_ACTIONS_MENU = "pasteActionsMenu",
|
|
356
357
|
SYNCED_BLOCK = "syncedBlock"
|
|
357
358
|
}
|
|
358
359
|
export declare enum ACTION_SUBJECT_ID {
|
|
@@ -45,7 +45,7 @@ import type { NcsSessionStepEventAEP } from './ncs-session-step-events';
|
|
|
45
45
|
import type { NestedTableActionsEventPayload } from './nested-table-events';
|
|
46
46
|
import type { NodeEventPayload } from './node-events';
|
|
47
47
|
import type { OfflineEditingEventPayload } from './offline-editing-event';
|
|
48
|
-
import type { PasteEventPayload } from './paste-events';
|
|
48
|
+
import type { PasteActionsMenuEventPayload, PasteEventPayload } from './paste-events';
|
|
49
49
|
import type { ReferentialityEventPayload } from './referentiality-events';
|
|
50
50
|
import type { SelectionEventPayload } from './selection-events';
|
|
51
51
|
import type { SelectionExtensionEventPayload } from './selection-extension-events';
|
|
@@ -66,7 +66,7 @@ export type SimplifiedNode = {
|
|
|
66
66
|
pos: number;
|
|
67
67
|
type: string;
|
|
68
68
|
};
|
|
69
|
-
export type AnalyticsEventPayload<T = void> = AvatarEventPayload | GeneralEventPayload<T> | FormatEventPayload | SubstituteEventPayload | InsertEventPayload | NodeEventPayload | MoveContentEventPayload | MediaEventPayload | TableEventPayload | PasteEventPayload | CutCopyEventPayload | ErrorEventPayload | TextColorEventPayload | FindReplaceEventPayload | DateEventPayload | SelectionEventPayload | ListEventPayload | ConfigPanelEventPayload | ElementBrowserEventPayload | CreateLinkInlineDialogEventPayload | HighlightActionsEventPayload | UnsupportedContentPayload | ExtensionEventPayload | TransactionEventPayload | TypeAheadPayload | UnlinkToolbarAEP | EditLinkToolbarAEP | PreviewItemClickedAEP | OpenSettingsToolbarAEP | CustomPanelEventPayload | FeatureExposureAEP | NewCollabSyncUpErrorAEP | UnsupportedContentTooltipPayload | ReferentialityEventPayload | LoomEventPayload | MBEEventPayload | HighlightEventPayload | DatasourceClickedPayload | ElementEventPayload | VisitedLinkAEP | ViewEventPayload | MediaUploadEventPayload | MentionEventPayload | EngagementPlatformEventPayload | NestedTableActionsEventPayload | AICommandPaletteEventPayload | AIDefinitionsEventPayload | AIEventPayload | AIStreamingEventPayload | AIProactiveEventPayload | AIUnifiedEventPayload | BreakoutEventPayload | BlockMenuEventPayload | ActiveSessionEventPayload | AIInlineSuggestionPayload | SelectionExtensionEventPayload | TelepointerClickPayload | SelectionToolbarEventPayload | ExperienceEventPayload | AlignmentEventPayload | UndoRedoAEP | OfflineEditingEventPayload | NcsSessionStepEventAEP | FloatingToolbarOverflowEventPayload | SyncBlockEventPayload | FloatingToolbarEventPayload;
|
|
69
|
+
export type AnalyticsEventPayload<T = void> = AvatarEventPayload | GeneralEventPayload<T> | FormatEventPayload | SubstituteEventPayload | InsertEventPayload | NodeEventPayload | MoveContentEventPayload | MediaEventPayload | TableEventPayload | PasteEventPayload | PasteActionsMenuEventPayload | CutCopyEventPayload | ErrorEventPayload | TextColorEventPayload | FindReplaceEventPayload | DateEventPayload | SelectionEventPayload | ListEventPayload | ConfigPanelEventPayload | ElementBrowserEventPayload | CreateLinkInlineDialogEventPayload | HighlightActionsEventPayload | UnsupportedContentPayload | ExtensionEventPayload | TransactionEventPayload | TypeAheadPayload | UnlinkToolbarAEP | EditLinkToolbarAEP | PreviewItemClickedAEP | OpenSettingsToolbarAEP | CustomPanelEventPayload | FeatureExposureAEP | NewCollabSyncUpErrorAEP | UnsupportedContentTooltipPayload | ReferentialityEventPayload | LoomEventPayload | MBEEventPayload | HighlightEventPayload | DatasourceClickedPayload | ElementEventPayload | VisitedLinkAEP | ViewEventPayload | MediaUploadEventPayload | MentionEventPayload | EngagementPlatformEventPayload | NestedTableActionsEventPayload | AICommandPaletteEventPayload | AIDefinitionsEventPayload | AIEventPayload | AIStreamingEventPayload | AIProactiveEventPayload | AIUnifiedEventPayload | BreakoutEventPayload | BlockMenuEventPayload | ActiveSessionEventPayload | AIInlineSuggestionPayload | SelectionExtensionEventPayload | TelepointerClickPayload | SelectionToolbarEventPayload | ExperienceEventPayload | AlignmentEventPayload | UndoRedoAEP | OfflineEditingEventPayload | NcsSessionStepEventAEP | FloatingToolbarOverflowEventPayload | SyncBlockEventPayload | FloatingToolbarEventPayload;
|
|
70
70
|
type CustomPanelEventPayload = TrackAEP<ACTION.CHANGED_BACKGROUND_COLOR | ACTION.CHANGED_ICON | ACTION.REMOVE_ICON, ACTION_SUBJECT.PANEL, ACTION_SUBJECT_ID.PANEL, {
|
|
71
71
|
newColor: string;
|
|
72
72
|
previousColor: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, INPUT_METHOD } from './enums';
|
|
2
|
-
import type { OperationalAEP, TrackAEP } from './utils';
|
|
2
|
+
import type { OperationalAEP, TrackAEP, UIAEP } from './utils';
|
|
3
3
|
export declare const PasteTypes: {
|
|
4
4
|
[type: string]: PasteType;
|
|
5
5
|
};
|
|
@@ -18,6 +18,7 @@ type PasteBaseOperationalAEP<Action, Attributes> = OperationalAEP<Action, ACTION
|
|
|
18
18
|
type PasteAEP = PasteBaseAEP<ACTION.PASTED, {
|
|
19
19
|
content: PasteContent;
|
|
20
20
|
inputMethod: INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
|
|
21
|
+
invokedFrom?: string;
|
|
21
22
|
pasteSize: number;
|
|
22
23
|
source?: PasteSource;
|
|
23
24
|
type: PasteType;
|
|
@@ -36,4 +37,8 @@ type PastedTimedAEP = PasteBaseOperationalAEP<ACTION.PASTED_TIMED, {
|
|
|
36
37
|
time: number;
|
|
37
38
|
}>;
|
|
38
39
|
export type PasteEventPayload = PasteAEP | PasteAsPlainAEP | PastedTimedAEP;
|
|
40
|
+
export type PasteActionsMenuOpenedAEP = UIAEP<ACTION.OPENED, ACTION_SUBJECT.PASTE_ACTIONS_MENU, undefined, {
|
|
41
|
+
visibleAiActions: string[];
|
|
42
|
+
}, undefined>;
|
|
43
|
+
export type PasteActionsMenuEventPayload = PasteActionsMenuOpenedAEP;
|
|
39
44
|
export {};
|
|
@@ -2,4 +2,3 @@ export { default as usePreviousState } from './usePreviousState';
|
|
|
2
2
|
export { default as useConstructor } from './useConstructor';
|
|
3
3
|
export { useSharedPluginState } from './useSharedPluginState';
|
|
4
4
|
export { useSharedPluginStateWithSelector, type NamedPluginStatesFromInjectionAPI, } from './useSharedPluginStateWithSelector';
|
|
5
|
-
export { default as useSmartCardReloadAfterCache } from './useSmartCardReloadAfterCache';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "112.0.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/"
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"@atlaskit/task-decision": "^19.3.0",
|
|
83
83
|
"@atlaskit/textfield": "^8.2.0",
|
|
84
84
|
"@atlaskit/theme": "^22.0.0",
|
|
85
|
-
"@atlaskit/tmp-editor-statsig": "^35.
|
|
85
|
+
"@atlaskit/tmp-editor-statsig": "^35.10.0",
|
|
86
86
|
"@atlaskit/tokens": "^11.1.0",
|
|
87
87
|
"@atlaskit/tooltip": "^20.14.0",
|
|
88
88
|
"@atlaskit/width-detector": "^5.0.0",
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _hooks = require("@atlaskit/smart-card/hooks");
|
|
9
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
10
|
-
/**
|
|
11
|
-
* Hook to manage smart card reload behavior when content is loaded from local cache.
|
|
12
|
-
*
|
|
13
|
-
* Handles:
|
|
14
|
-
* - Capturing initial card status on mount (synchronously to avoid race conditions)
|
|
15
|
-
* - Tracking URL changes and resetting state
|
|
16
|
-
* - Only reloading data that was initially loaded from cache
|
|
17
|
-
* - Ensuring reload is called at most once per URL
|
|
18
|
-
* - Respecting page SSR state to avoid reloading on server-rendered pages
|
|
19
|
-
*
|
|
20
|
-
* @param url - The smart card URL
|
|
21
|
-
* @param cardStatus - The current card resolution status ('pending', 'resolved', etc)
|
|
22
|
-
* @param isPageSSRed - Whether the page was server-side rendered
|
|
23
|
-
*/
|
|
24
|
-
var useSmartCardReloadAfterCache = function useSmartCardReloadAfterCache(url, cardStatus, isPageSSRed) {
|
|
25
|
-
var initialCardStatus = (0, _react.useRef)(undefined);
|
|
26
|
-
var hasReloaded = (0, _react.useRef)(false);
|
|
27
|
-
var previousUrl = (0, _react.useRef)(url);
|
|
28
|
-
var reload = (0, _hooks.useSmartLinkReload)({
|
|
29
|
-
url: url || ''
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
// Reset refs when URL changes (do this before capturing initial status)
|
|
33
|
-
if (previousUrl.current !== url) {
|
|
34
|
-
initialCardStatus.current = undefined;
|
|
35
|
-
hasReloaded.current = false;
|
|
36
|
-
previousUrl.current = url;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Capture initial card status on first render (synchronously)
|
|
40
|
-
// This determines if the card was loaded from cache (resolved on mount)
|
|
41
|
-
// or if it's being fetched fresh (pending on mount)
|
|
42
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_smartlink_local_cache', 'isEnabled', true) && cardStatus && initialCardStatus.current === undefined) {
|
|
43
|
-
initialCardStatus.current = cardStatus;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Reload from cache in the background if needed
|
|
47
|
-
(0, _react.useEffect)(function () {
|
|
48
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_smartlink_local_cache', 'isEnabled', true) && !isPageSSRed && url && initialCardStatus.current === 'resolved' && cardStatus === 'resolved' && !hasReloaded.current) {
|
|
49
|
-
hasReloaded.current = true;
|
|
50
|
-
reload();
|
|
51
|
-
}
|
|
52
|
-
}, [isPageSSRed, url, cardStatus, reload]);
|
|
53
|
-
};
|
|
54
|
-
var _default = exports.default = useSmartCardReloadAfterCache;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef } from 'react';
|
|
2
|
-
import { useSmartLinkReload } from '@atlaskit/smart-card/hooks';
|
|
3
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Hook to manage smart card reload behavior when content is loaded from local cache.
|
|
7
|
-
*
|
|
8
|
-
* Handles:
|
|
9
|
-
* - Capturing initial card status on mount (synchronously to avoid race conditions)
|
|
10
|
-
* - Tracking URL changes and resetting state
|
|
11
|
-
* - Only reloading data that was initially loaded from cache
|
|
12
|
-
* - Ensuring reload is called at most once per URL
|
|
13
|
-
* - Respecting page SSR state to avoid reloading on server-rendered pages
|
|
14
|
-
*
|
|
15
|
-
* @param url - The smart card URL
|
|
16
|
-
* @param cardStatus - The current card resolution status ('pending', 'resolved', etc)
|
|
17
|
-
* @param isPageSSRed - Whether the page was server-side rendered
|
|
18
|
-
*/
|
|
19
|
-
const useSmartCardReloadAfterCache = (url, cardStatus, isPageSSRed) => {
|
|
20
|
-
const initialCardStatus = useRef(undefined);
|
|
21
|
-
const hasReloaded = useRef(false);
|
|
22
|
-
const previousUrl = useRef(url);
|
|
23
|
-
const reload = useSmartLinkReload({
|
|
24
|
-
url: url || ''
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
// Reset refs when URL changes (do this before capturing initial status)
|
|
28
|
-
if (previousUrl.current !== url) {
|
|
29
|
-
initialCardStatus.current = undefined;
|
|
30
|
-
hasReloaded.current = false;
|
|
31
|
-
previousUrl.current = url;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Capture initial card status on first render (synchronously)
|
|
35
|
-
// This determines if the card was loaded from cache (resolved on mount)
|
|
36
|
-
// or if it's being fetched fresh (pending on mount)
|
|
37
|
-
if (expValEquals('platform_editor_smartlink_local_cache', 'isEnabled', true) && cardStatus && initialCardStatus.current === undefined) {
|
|
38
|
-
initialCardStatus.current = cardStatus;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Reload from cache in the background if needed
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
if (expValEquals('platform_editor_smartlink_local_cache', 'isEnabled', true) && !isPageSSRed && url && initialCardStatus.current === 'resolved' && cardStatus === 'resolved' && !hasReloaded.current) {
|
|
44
|
-
hasReloaded.current = true;
|
|
45
|
-
reload();
|
|
46
|
-
}
|
|
47
|
-
}, [isPageSSRed, url, cardStatus, reload]);
|
|
48
|
-
};
|
|
49
|
-
export default useSmartCardReloadAfterCache;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef } from 'react';
|
|
2
|
-
import { useSmartLinkReload } from '@atlaskit/smart-card/hooks';
|
|
3
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Hook to manage smart card reload behavior when content is loaded from local cache.
|
|
7
|
-
*
|
|
8
|
-
* Handles:
|
|
9
|
-
* - Capturing initial card status on mount (synchronously to avoid race conditions)
|
|
10
|
-
* - Tracking URL changes and resetting state
|
|
11
|
-
* - Only reloading data that was initially loaded from cache
|
|
12
|
-
* - Ensuring reload is called at most once per URL
|
|
13
|
-
* - Respecting page SSR state to avoid reloading on server-rendered pages
|
|
14
|
-
*
|
|
15
|
-
* @param url - The smart card URL
|
|
16
|
-
* @param cardStatus - The current card resolution status ('pending', 'resolved', etc)
|
|
17
|
-
* @param isPageSSRed - Whether the page was server-side rendered
|
|
18
|
-
*/
|
|
19
|
-
var useSmartCardReloadAfterCache = function useSmartCardReloadAfterCache(url, cardStatus, isPageSSRed) {
|
|
20
|
-
var initialCardStatus = useRef(undefined);
|
|
21
|
-
var hasReloaded = useRef(false);
|
|
22
|
-
var previousUrl = useRef(url);
|
|
23
|
-
var reload = useSmartLinkReload({
|
|
24
|
-
url: url || ''
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
// Reset refs when URL changes (do this before capturing initial status)
|
|
28
|
-
if (previousUrl.current !== url) {
|
|
29
|
-
initialCardStatus.current = undefined;
|
|
30
|
-
hasReloaded.current = false;
|
|
31
|
-
previousUrl.current = url;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Capture initial card status on first render (synchronously)
|
|
35
|
-
// This determines if the card was loaded from cache (resolved on mount)
|
|
36
|
-
// or if it's being fetched fresh (pending on mount)
|
|
37
|
-
if (expValEquals('platform_editor_smartlink_local_cache', 'isEnabled', true) && cardStatus && initialCardStatus.current === undefined) {
|
|
38
|
-
initialCardStatus.current = cardStatus;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Reload from cache in the background if needed
|
|
42
|
-
useEffect(function () {
|
|
43
|
-
if (expValEquals('platform_editor_smartlink_local_cache', 'isEnabled', true) && !isPageSSRed && url && initialCardStatus.current === 'resolved' && cardStatus === 'resolved' && !hasReloaded.current) {
|
|
44
|
-
hasReloaded.current = true;
|
|
45
|
-
reload();
|
|
46
|
-
}
|
|
47
|
-
}, [isPageSSRed, url, cardStatus, reload]);
|
|
48
|
-
};
|
|
49
|
-
export default useSmartCardReloadAfterCache;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook to manage smart card reload behavior when content is loaded from local cache.
|
|
3
|
-
*
|
|
4
|
-
* Handles:
|
|
5
|
-
* - Capturing initial card status on mount (synchronously to avoid race conditions)
|
|
6
|
-
* - Tracking URL changes and resetting state
|
|
7
|
-
* - Only reloading data that was initially loaded from cache
|
|
8
|
-
* - Ensuring reload is called at most once per URL
|
|
9
|
-
* - Respecting page SSR state to avoid reloading on server-rendered pages
|
|
10
|
-
*
|
|
11
|
-
* @param url - The smart card URL
|
|
12
|
-
* @param cardStatus - The current card resolution status ('pending', 'resolved', etc)
|
|
13
|
-
* @param isPageSSRed - Whether the page was server-side rendered
|
|
14
|
-
*/
|
|
15
|
-
declare const useSmartCardReloadAfterCache: (url: string | undefined, cardStatus: string | undefined, isPageSSRed: boolean) => void;
|
|
16
|
-
export default useSmartCardReloadAfterCache;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook to manage smart card reload behavior when content is loaded from local cache.
|
|
3
|
-
*
|
|
4
|
-
* Handles:
|
|
5
|
-
* - Capturing initial card status on mount (synchronously to avoid race conditions)
|
|
6
|
-
* - Tracking URL changes and resetting state
|
|
7
|
-
* - Only reloading data that was initially loaded from cache
|
|
8
|
-
* - Ensuring reload is called at most once per URL
|
|
9
|
-
* - Respecting page SSR state to avoid reloading on server-rendered pages
|
|
10
|
-
*
|
|
11
|
-
* @param url - The smart card URL
|
|
12
|
-
* @param cardStatus - The current card resolution status ('pending', 'resolved', etc)
|
|
13
|
-
* @param isPageSSRed - Whether the page was server-side rendered
|
|
14
|
-
*/
|
|
15
|
-
declare const useSmartCardReloadAfterCache: (url: string | undefined, cardStatus: string | undefined, isPageSSRed: boolean) => void;
|
|
16
|
-
export default useSmartCardReloadAfterCache;
|