@atlaskit/editor-plugin-synced-block 10.2.9 → 10.2.10
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,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
+
## 10.2.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`abfc496602dcb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/abfc496602dcb) -
|
|
8
|
+
[ux] Fix the "when the page is published" link in the unpublished synced block reference error
|
|
9
|
+
card. Links rendered inside the reference sync block's contentEditable island did not navigate on
|
|
10
|
+
click (the browser placed the caret instead); anchor navigation is now re-triggered on click, and
|
|
11
|
+
interactive elements show the pointer cursor rather than the text cursor. Both behaviours are
|
|
12
|
+
gated behind the `platform_editor_sync_block_activation` experiment.
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 10.2.9
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -6,9 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.SyncBlockRendererWrapper = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _bindEventListener = require("bind-event-listener");
|
|
9
10
|
var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
10
11
|
var _editorSyncedBlockProvider = require("@atlaskit/editor-synced-block-provider");
|
|
11
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
12
14
|
var _SyncBlockLabel = require("./SyncBlockLabel");
|
|
13
15
|
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); }
|
|
14
16
|
var SyncBlockRendererWrapperDataId = 'sync-block-plugin-renderer-wrapper';
|
|
@@ -27,6 +29,10 @@ var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperCompone
|
|
|
27
29
|
var isUnsyncedBlock = isUnpublishedBlock || (syncBlockFetchResult === null || syncBlockFetchResult === void 0 || (_syncBlockFetchResult3 = syncBlockFetchResult.syncBlockInstance) === null || _syncBlockFetchResult3 === void 0 || (_syncBlockFetchResult3 = _syncBlockFetchResult3.error) === null || _syncBlockFetchResult3 === void 0 ? void 0 : _syncBlockFetchResult3.type) === _editorSyncedBlockProvider.SyncBlockError.NotFound;
|
|
28
30
|
var isTextSelectionEnabled = (0, _platformFeatureFlags.fg)('platform_synced_block_patch_14');
|
|
29
31
|
|
|
32
|
+
// Evaluated unconditionally so the experiment exposure is tracked correctly
|
|
33
|
+
// (recorded on every render, not lazily on first click).
|
|
34
|
+
var isSyncBlockActivationEnabled = (0, _expValEquals.expValEquals)('platform_editor_sync_block_activation', 'isEnabled', true);
|
|
35
|
+
|
|
30
36
|
// Prevent editing in the contentEditable renderer wrapper. We set
|
|
31
37
|
// contentEditable="true" to enable text selection (creating an editable
|
|
32
38
|
// island inside ProseMirror's contentEditable="false" nodeview wrapper),
|
|
@@ -34,7 +40,39 @@ var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperCompone
|
|
|
34
40
|
var preventInput = (0, _react.useCallback)(function (e) {
|
|
35
41
|
e.preventDefault();
|
|
36
42
|
}, []);
|
|
43
|
+
|
|
44
|
+
// Browsers suppress link navigation on a plain click inside a
|
|
45
|
+
// contentEditable region (they place the caret instead), which breaks links
|
|
46
|
+
// rendered in the content — e.g. the "when the page is published" link in
|
|
47
|
+
// the unpublished error card. Re-trigger navigation for _blank anchors
|
|
48
|
+
// ourselves. A native listener (rather than an onClick on the div) is used
|
|
49
|
+
// so we delegate link clicks without making the container itself interactive.
|
|
50
|
+
var rendererRef = (0, _react.useRef)(null);
|
|
51
|
+
(0, _react.useEffect)(function () {
|
|
52
|
+
var containerEl = rendererRef.current;
|
|
53
|
+
if (!containerEl || !isTextSelectionEnabled || !isSyncBlockActivationEnabled) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
var unbind = (0, _bindEventListener.bind)(containerEl, {
|
|
57
|
+
type: 'click',
|
|
58
|
+
listener: function listener(e) {
|
|
59
|
+
// Let the browser handle modified/non-primary clicks (open-in-new-tab,
|
|
60
|
+
// etc.) natively so we don't open a second tab on top of it.
|
|
61
|
+
if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
var target = e.target instanceof Element ? e.target : null;
|
|
65
|
+
var anchor = target === null || target === void 0 ? void 0 : target.closest('a[href]');
|
|
66
|
+
if (!(anchor instanceof HTMLAnchorElement) || e.defaultPrevented || anchor.target !== '_blank') {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
window.open(anchor.href, '_blank', 'noopener,noreferrer');
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return unbind;
|
|
73
|
+
}, [isTextSelectionEnabled, isSyncBlockActivationEnabled]);
|
|
37
74
|
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
75
|
+
ref: rendererRef,
|
|
38
76
|
"data-testid": SyncBlockRendererWrapperDataId
|
|
39
77
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
40
78
|
,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
import { bind } from 'bind-event-listener';
|
|
2
3
|
import { SyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
3
4
|
import { SyncBlockError, useFetchSyncBlockData, useFetchSyncBlockTitle } from '@atlaskit/editor-synced-block-provider';
|
|
4
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
7
|
import { SyncBlockLabel } from './SyncBlockLabel';
|
|
6
8
|
const SyncBlockRendererWrapperDataId = 'sync-block-plugin-renderer-wrapper';
|
|
7
9
|
const SyncBlockRendererWrapperComponent = ({
|
|
@@ -20,6 +22,10 @@ const SyncBlockRendererWrapperComponent = ({
|
|
|
20
22
|
const isUnsyncedBlock = isUnpublishedBlock || (syncBlockFetchResult === null || syncBlockFetchResult === void 0 ? void 0 : (_syncBlockFetchResult5 = syncBlockFetchResult.syncBlockInstance) === null || _syncBlockFetchResult5 === void 0 ? void 0 : (_syncBlockFetchResult6 = _syncBlockFetchResult5.error) === null || _syncBlockFetchResult6 === void 0 ? void 0 : _syncBlockFetchResult6.type) === SyncBlockError.NotFound;
|
|
21
23
|
const isTextSelectionEnabled = fg('platform_synced_block_patch_14');
|
|
22
24
|
|
|
25
|
+
// Evaluated unconditionally so the experiment exposure is tracked correctly
|
|
26
|
+
// (recorded on every render, not lazily on first click).
|
|
27
|
+
const isSyncBlockActivationEnabled = expValEquals('platform_editor_sync_block_activation', 'isEnabled', true);
|
|
28
|
+
|
|
23
29
|
// Prevent editing in the contentEditable renderer wrapper. We set
|
|
24
30
|
// contentEditable="true" to enable text selection (creating an editable
|
|
25
31
|
// island inside ProseMirror's contentEditable="false" nodeview wrapper),
|
|
@@ -27,7 +33,39 @@ const SyncBlockRendererWrapperComponent = ({
|
|
|
27
33
|
const preventInput = useCallback(e => {
|
|
28
34
|
e.preventDefault();
|
|
29
35
|
}, []);
|
|
36
|
+
|
|
37
|
+
// Browsers suppress link navigation on a plain click inside a
|
|
38
|
+
// contentEditable region (they place the caret instead), which breaks links
|
|
39
|
+
// rendered in the content — e.g. the "when the page is published" link in
|
|
40
|
+
// the unpublished error card. Re-trigger navigation for _blank anchors
|
|
41
|
+
// ourselves. A native listener (rather than an onClick on the div) is used
|
|
42
|
+
// so we delegate link clicks without making the container itself interactive.
|
|
43
|
+
const rendererRef = useRef(null);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
const containerEl = rendererRef.current;
|
|
46
|
+
if (!containerEl || !isTextSelectionEnabled || !isSyncBlockActivationEnabled) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const unbind = bind(containerEl, {
|
|
50
|
+
type: 'click',
|
|
51
|
+
listener: e => {
|
|
52
|
+
// Let the browser handle modified/non-primary clicks (open-in-new-tab,
|
|
53
|
+
// etc.) natively so we don't open a second tab on top of it.
|
|
54
|
+
if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const target = e.target instanceof Element ? e.target : null;
|
|
58
|
+
const anchor = target === null || target === void 0 ? void 0 : target.closest('a[href]');
|
|
59
|
+
if (!(anchor instanceof HTMLAnchorElement) || e.defaultPrevented || anchor.target !== '_blank') {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
window.open(anchor.href, '_blank', 'noopener,noreferrer');
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
return unbind;
|
|
66
|
+
}, [isTextSelectionEnabled, isSyncBlockActivationEnabled]);
|
|
30
67
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
ref: rendererRef,
|
|
31
69
|
"data-testid": SyncBlockRendererWrapperDataId
|
|
32
70
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
33
71
|
,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
import { bind } from 'bind-event-listener';
|
|
2
3
|
import { SyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
3
4
|
import { SyncBlockError, useFetchSyncBlockData, useFetchSyncBlockTitle } from '@atlaskit/editor-synced-block-provider';
|
|
4
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
7
|
import { SyncBlockLabel } from './SyncBlockLabel';
|
|
6
8
|
var SyncBlockRendererWrapperDataId = 'sync-block-plugin-renderer-wrapper';
|
|
7
9
|
var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperComponent(_ref) {
|
|
@@ -19,6 +21,10 @@ var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperCompone
|
|
|
19
21
|
var isUnsyncedBlock = isUnpublishedBlock || (syncBlockFetchResult === null || syncBlockFetchResult === void 0 || (_syncBlockFetchResult3 = syncBlockFetchResult.syncBlockInstance) === null || _syncBlockFetchResult3 === void 0 || (_syncBlockFetchResult3 = _syncBlockFetchResult3.error) === null || _syncBlockFetchResult3 === void 0 ? void 0 : _syncBlockFetchResult3.type) === SyncBlockError.NotFound;
|
|
20
22
|
var isTextSelectionEnabled = fg('platform_synced_block_patch_14');
|
|
21
23
|
|
|
24
|
+
// Evaluated unconditionally so the experiment exposure is tracked correctly
|
|
25
|
+
// (recorded on every render, not lazily on first click).
|
|
26
|
+
var isSyncBlockActivationEnabled = expValEquals('platform_editor_sync_block_activation', 'isEnabled', true);
|
|
27
|
+
|
|
22
28
|
// Prevent editing in the contentEditable renderer wrapper. We set
|
|
23
29
|
// contentEditable="true" to enable text selection (creating an editable
|
|
24
30
|
// island inside ProseMirror's contentEditable="false" nodeview wrapper),
|
|
@@ -26,7 +32,39 @@ var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperCompone
|
|
|
26
32
|
var preventInput = useCallback(function (e) {
|
|
27
33
|
e.preventDefault();
|
|
28
34
|
}, []);
|
|
35
|
+
|
|
36
|
+
// Browsers suppress link navigation on a plain click inside a
|
|
37
|
+
// contentEditable region (they place the caret instead), which breaks links
|
|
38
|
+
// rendered in the content — e.g. the "when the page is published" link in
|
|
39
|
+
// the unpublished error card. Re-trigger navigation for _blank anchors
|
|
40
|
+
// ourselves. A native listener (rather than an onClick on the div) is used
|
|
41
|
+
// so we delegate link clicks without making the container itself interactive.
|
|
42
|
+
var rendererRef = useRef(null);
|
|
43
|
+
useEffect(function () {
|
|
44
|
+
var containerEl = rendererRef.current;
|
|
45
|
+
if (!containerEl || !isTextSelectionEnabled || !isSyncBlockActivationEnabled) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
var unbind = bind(containerEl, {
|
|
49
|
+
type: 'click',
|
|
50
|
+
listener: function listener(e) {
|
|
51
|
+
// Let the browser handle modified/non-primary clicks (open-in-new-tab,
|
|
52
|
+
// etc.) natively so we don't open a second tab on top of it.
|
|
53
|
+
if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
var target = e.target instanceof Element ? e.target : null;
|
|
57
|
+
var anchor = target === null || target === void 0 ? void 0 : target.closest('a[href]');
|
|
58
|
+
if (!(anchor instanceof HTMLAnchorElement) || e.defaultPrevented || anchor.target !== '_blank') {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
window.open(anchor.href, '_blank', 'noopener,noreferrer');
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return unbind;
|
|
65
|
+
}, [isTextSelectionEnabled, isSyncBlockActivationEnabled]);
|
|
29
66
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
ref: rendererRef,
|
|
30
68
|
"data-testid": SyncBlockRendererWrapperDataId
|
|
31
69
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
32
70
|
,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "10.2.
|
|
3
|
+
"version": "10.2.10",
|
|
4
4
|
"description": "SyncedBlock plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
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": "^125.
|
|
49
|
+
"@atlaskit/tmp-editor-statsig": "^125.1.0",
|
|
50
50
|
"@atlaskit/tokens": "15.8.0",
|
|
51
51
|
"@atlaskit/tooltip": "^23.1.0",
|
|
52
52
|
"@atlaskit/visually-hidden": "^4.1.0",
|