@atlaskit/editor-plugin-synced-block 11.0.0 → 11.0.2
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/AGENTS.md +3 -3
- package/CHANGELOG.md +19 -0
- package/dist/cjs/nodeviews/bodiedSyncedBlock.js +25 -193
- package/dist/cjs/nodeviews/syncedBlock.js +4 -25
- package/dist/cjs/pm-plugins/main.js +64 -130
- package/dist/cjs/pm-plugins/menu-and-toolbar-experiences.js +2 -7
- package/dist/cjs/pm-plugins/utils/has-synced-blocks.js +2 -2
- package/dist/cjs/syncedBlockPlugin.js +3 -12
- package/dist/es2019/nodeviews/bodiedSyncedBlock.js +9 -150
- package/dist/es2019/nodeviews/syncedBlock.js +3 -17
- package/dist/es2019/pm-plugins/main.js +65 -133
- package/dist/es2019/pm-plugins/menu-and-toolbar-experiences.js +2 -7
- package/dist/es2019/pm-plugins/utils/has-synced-blocks.js +2 -2
- package/dist/es2019/syncedBlockPlugin.js +3 -12
- package/dist/esm/nodeviews/bodiedSyncedBlock.js +24 -192
- package/dist/esm/nodeviews/syncedBlock.js +4 -25
- package/dist/esm/pm-plugins/main.js +65 -131
- package/dist/esm/pm-plugins/menu-and-toolbar-experiences.js +2 -7
- package/dist/esm/pm-plugins/utils/has-synced-blocks.js +2 -2
- package/dist/esm/syncedBlockPlugin.js +3 -12
- package/dist/types/nodeviews/bodiedSyncedBlock.d.ts +1 -13
- package/dist/types/pm-plugins/main.d.ts +6 -10
- package/dist/types/pm-plugins/utils/has-synced-blocks.d.ts +2 -2
- package/dist/types/types/index.d.ts +1 -2
- package/package.json +6 -6
- package/dist/cjs/ui/BodiedSyncBlockWrapper.js +0 -25
- package/dist/es2019/ui/BodiedSyncBlockWrapper.js +0 -19
- package/dist/esm/ui/BodiedSyncBlockWrapper.js +0 -18
- package/dist/types/ui/BodiedSyncBlockWrapper.d.ts +0 -9
package/AGENTS.md
CHANGED
|
@@ -39,7 +39,7 @@ src/
|
|
|
39
39
|
│ └── bodiedSyncedBlock.tsx # NodeView for source (bodiedSyncBlock) — nested editor with content
|
|
40
40
|
├── pm-plugins/
|
|
41
41
|
│ ├── main.ts # Core state machine: lifecycle, creation, deletion, cache,
|
|
42
|
-
│ │ status decoration apply path
|
|
42
|
+
│ │ status decoration apply path
|
|
43
43
|
│ ├── menu-and-toolbar-experiences.ts # Experience tracking for menu/toolbar interactions
|
|
44
44
|
│ └── utils/
|
|
45
45
|
│ ├── track-sync-blocks.ts # Tracks mutations, updates shared state
|
|
@@ -61,7 +61,7 @@ src/
|
|
|
61
61
|
│ ├── DeleteConfirmationModal.tsx # Deletion confirmation dialog
|
|
62
62
|
│ ├── SyncBlockRefresher.tsx # Periodic data refresh from backend
|
|
63
63
|
│ ├── SyncBlockLabel.tsx # Source/reference label chrome
|
|
64
|
-
│ ├──
|
|
64
|
+
│ ├── SyncBlockRendererWrapper.tsx # Node-view wrapper
|
|
65
65
|
│ ├── SyncBlockSSRReactContextsProvider.tsx # Supplies React contexts during SSR
|
|
66
66
|
│ └── Flag.tsx # Error/info flags (offline, copy notifications)
|
|
67
67
|
└── types/
|
|
@@ -80,7 +80,7 @@ from outside the plugin lifecycle:
|
|
|
80
80
|
|
|
81
81
|
### Lazy Init & Perf (EDITOR-6928 / EDITOR-6930)
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
`main.ts`:
|
|
84
84
|
|
|
85
85
|
- Skips creating synced-block plugin state and node-views for documents with no synced blocks
|
|
86
86
|
(`hasSyncedBlocks(doc)`).
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
+
## 11.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 11.0.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`72f7cec91a1d4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/72f7cec91a1d4) -
|
|
14
|
+
Remove the `editor_synced_block_perf` experiment. The lazy node-view init and cached
|
|
15
|
+
status-decoration apply path are now always on, and the legacy full-document `descendants()`
|
|
16
|
+
decoration walk has been removed.
|
|
17
|
+
- [`72f7cec91a1d4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/72f7cec91a1d4) -
|
|
18
|
+
Remove the `platform_synced_block_use_new_source_nodeview` experiment. The new source node view is
|
|
19
|
+
now always used and the superseded implementation has been deleted.
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 11.0.0
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -4,187 +4,19 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.bodiedSyncBlockNodeView = exports.BodiedSyncBlock = void 0;
|
|
8
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
11
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
12
|
-
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
13
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
10
|
var _react = _interopRequireDefault(require("react"));
|
|
15
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
16
12
|
var _coreUtils = require("@atlaskit/editor-common/core-utils");
|
|
17
13
|
var _errorBoundary = require("@atlaskit/editor-common/error-boundary");
|
|
18
|
-
var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
|
|
19
14
|
var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
20
15
|
var _editorPluginConnectivity = require("@atlaskit/editor-plugin-connectivity");
|
|
21
16
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
22
17
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
23
|
-
var _BodiedSyncBlockWrapper = require("../ui/BodiedSyncBlockWrapper");
|
|
24
18
|
var _SyncBlockLabel = require("../ui/SyncBlockLabel");
|
|
25
19
|
var _isEmptySourceSyncBlock = require("./isEmptySourceSyncBlock");
|
|
26
|
-
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)); }
|
|
27
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
28
|
-
function _superPropGet(t, o, e, r) { var p = (0, _get2.default)((0, _getPrototypeOf2.default)(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
29
|
-
var toDOMOld = function toDOMOld() {
|
|
30
|
-
return ['div', {
|
|
31
|
-
class: _syncBlock.BodiedSyncBlockSharedCssClassName.content,
|
|
32
|
-
contenteditable: true
|
|
33
|
-
}, 0];
|
|
34
|
-
};
|
|
35
|
-
var BodiedSyncBlockOld = /*#__PURE__*/function (_ReactNodeView) {
|
|
36
|
-
function BodiedSyncBlockOld(props) {
|
|
37
|
-
var _this;
|
|
38
|
-
(0, _classCallCheck2.default)(this, BodiedSyncBlockOld);
|
|
39
|
-
_this = _callSuper(this, BodiedSyncBlockOld, [props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props]);
|
|
40
|
-
_this.api = props.api;
|
|
41
|
-
_this.syncBlockStore = props.syncBlockStore;
|
|
42
|
-
_this.handleConnectivityModeChange();
|
|
43
|
-
_this.handleViewModeChange();
|
|
44
|
-
return _this;
|
|
45
|
-
}
|
|
46
|
-
(0, _inherits2.default)(BodiedSyncBlockOld, _ReactNodeView);
|
|
47
|
-
return (0, _createClass2.default)(BodiedSyncBlockOld, [{
|
|
48
|
-
key: "updateContentEditable",
|
|
49
|
-
value: function updateContentEditable(_ref) {
|
|
50
|
-
var _this$api, _this$api2;
|
|
51
|
-
var contentDOM = _ref.contentDOM,
|
|
52
|
-
nextConnectivityMode = _ref.nextConnectivityMode,
|
|
53
|
-
nextViewMode = _ref.nextViewMode;
|
|
54
|
-
var connectivityMode = nextConnectivityMode !== null && nextConnectivityMode !== void 0 ? nextConnectivityMode : (_this$api = this.api) === null || _this$api === void 0 || (_this$api = _this$api.connectivity) === null || _this$api === void 0 || (_this$api = _this$api.sharedState) === null || _this$api === void 0 || (_this$api = _this$api.currentState()) === null || _this$api === void 0 ? void 0 : _this$api.mode;
|
|
55
|
-
var viewMode = nextViewMode !== null && nextViewMode !== void 0 ? nextViewMode : (_this$api2 = this.api) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.editorViewMode) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.sharedState) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.currentState()) === null || _this$api2 === void 0 ? void 0 : _this$api2.mode;
|
|
56
|
-
var isOnline = !(0, _editorPluginConnectivity.isOfflineMode)(connectivityMode);
|
|
57
|
-
var isEditMode = viewMode !== 'view';
|
|
58
|
-
var shouldBeEditable = isOnline && isEditMode;
|
|
59
|
-
contentDOM === null || contentDOM === void 0 || contentDOM.setAttribute('contenteditable', shouldBeEditable ? 'true' : 'false');
|
|
60
|
-
}
|
|
61
|
-
}, {
|
|
62
|
-
key: "handleConnectivityModeChange",
|
|
63
|
-
value: function handleConnectivityModeChange() {
|
|
64
|
-
var _this$api3,
|
|
65
|
-
_this2 = this;
|
|
66
|
-
if ((_this$api3 = this.api) !== null && _this$api3 !== void 0 && _this$api3.connectivity) {
|
|
67
|
-
this.cleanupConnectivityModeListener = this.api.connectivity.sharedState.onChange(function (_ref2) {
|
|
68
|
-
var nextSharedState = _ref2.nextSharedState;
|
|
69
|
-
_this2.updateContentEditable({
|
|
70
|
-
contentDOM: _this2.contentDOM,
|
|
71
|
-
nextConnectivityMode: nextSharedState.mode
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}, {
|
|
77
|
-
key: "handleViewModeChange",
|
|
78
|
-
value: function handleViewModeChange() {
|
|
79
|
-
var _this$api4,
|
|
80
|
-
_this3 = this;
|
|
81
|
-
if ((_this$api4 = this.api) !== null && _this$api4 !== void 0 && _this$api4.editorViewMode) {
|
|
82
|
-
this.cleanupViewModeListener = this.api.editorViewMode.sharedState.onChange(function (_ref3) {
|
|
83
|
-
var nextSharedState = _ref3.nextSharedState;
|
|
84
|
-
_this3.updateContentEditable({
|
|
85
|
-
contentDOM: _this3.contentDOM,
|
|
86
|
-
nextViewMode: nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.mode
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}, {
|
|
92
|
-
key: "createDomRef",
|
|
93
|
-
value: function createDomRef() {
|
|
94
|
-
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- NodeView DOM must be created against active runtime document
|
|
95
|
-
var domRef = document.createElement('div');
|
|
96
|
-
domRef.classList.add(_syncBlock.BodiedSyncBlockSharedCssClassName.prefix);
|
|
97
|
-
domRef.classList.toggle(_syncBlock.BodiedSyncBlockSharedCssClassName.empty, (0, _isEmptySourceSyncBlock.isEmptySourceSyncBlock)(this.node));
|
|
98
|
-
return domRef;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Keeps the empty marker class in sync so the source placeholder can be shown purely from
|
|
103
|
-
* document state. See `isEmptySourceSyncBlock` for why the DOM is not used to decide this.
|
|
104
|
-
*/
|
|
105
|
-
}, {
|
|
106
|
-
key: "update",
|
|
107
|
-
value: function update(node, decorations) {
|
|
108
|
-
var updated = _superPropGet(BodiedSyncBlockOld, "update", this, 3)([node, decorations]);
|
|
109
|
-
if (updated) {
|
|
110
|
-
// `ReactNodeView`'s `dom` getter throws rather than returning nullish once the view is
|
|
111
|
-
// destroyed, so optional chaining here would be misleading. `super.update()` only
|
|
112
|
-
// returns true while the view is still mounted, so the ref is guaranteed.
|
|
113
|
-
this.dom.classList.toggle(_syncBlock.BodiedSyncBlockSharedCssClassName.empty, (0, _isEmptySourceSyncBlock.isEmptySourceSyncBlock)(this.node));
|
|
114
|
-
}
|
|
115
|
-
return updated;
|
|
116
|
-
}
|
|
117
|
-
}, {
|
|
118
|
-
key: "render",
|
|
119
|
-
value: function render(_props, forwardRef) {
|
|
120
|
-
var _this$api$syncedBlock, _this$api5, _this$api6;
|
|
121
|
-
// Use passed syncBlockStore for SSR where sharedState.currentState() is delayed
|
|
122
|
-
var syncBlockStore = (_this$api$syncedBlock = (_this$api5 = this.api) === null || _this$api5 === void 0 || (_this$api5 = _this$api5.syncedBlock.sharedState) === null || _this$api5 === void 0 || (_this$api5 = _this$api5.currentState()) === null || _this$api5 === void 0 ? void 0 : _this$api5.syncBlockStore) !== null && _this$api$syncedBlock !== void 0 ? _this$api$syncedBlock : this.syncBlockStore;
|
|
123
|
-
if (!syncBlockStore) {
|
|
124
|
-
return null;
|
|
125
|
-
}
|
|
126
|
-
return /*#__PURE__*/_react.default.createElement(_errorBoundary.ErrorBoundary, {
|
|
127
|
-
component: _analytics.ACTION_SUBJECT.SYNCED_BLOCK,
|
|
128
|
-
dispatchAnalyticsEvent: (_this$api6 = this.api) === null || _this$api6 === void 0 || (_this$api6 = _this$api6.analytics) === null || _this$api6 === void 0 ? void 0 : _this$api6.actions.fireAnalyticsEvent,
|
|
129
|
-
fallbackComponent: null
|
|
130
|
-
}, /*#__PURE__*/_react.default.createElement(_BodiedSyncBlockWrapper.BodiedSyncBlockWrapper, {
|
|
131
|
-
ref: forwardRef,
|
|
132
|
-
syncBlockStore: syncBlockStore,
|
|
133
|
-
node: this.node
|
|
134
|
-
}));
|
|
135
|
-
}
|
|
136
|
-
}, {
|
|
137
|
-
key: "getContentDOM",
|
|
138
|
-
value: function getContentDOM() {
|
|
139
|
-
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- NodeView serialization must target active runtime document
|
|
140
|
-
var _DOMSerializer$render = _model.DOMSerializer.renderSpec(document, toDOMOld()),
|
|
141
|
-
dom = _DOMSerializer$render.dom,
|
|
142
|
-
contentDOM = _DOMSerializer$render.contentDOM;
|
|
143
|
-
// In SSR, the first check won't work, so fallback to nodeType check
|
|
144
|
-
if (dom instanceof HTMLElement || dom.nodeType === 1) {
|
|
145
|
-
this.updateContentEditable({
|
|
146
|
-
contentDOM: contentDOM
|
|
147
|
-
});
|
|
148
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
149
|
-
return {
|
|
150
|
-
dom: dom,
|
|
151
|
-
contentDOM: contentDOM
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
return undefined;
|
|
155
|
-
}
|
|
156
|
-
}, {
|
|
157
|
-
key: "destroy",
|
|
158
|
-
value: function destroy() {
|
|
159
|
-
if (this.cleanupConnectivityModeListener) {
|
|
160
|
-
this.cleanupConnectivityModeListener();
|
|
161
|
-
}
|
|
162
|
-
if (this.cleanupViewModeListener) {
|
|
163
|
-
this.cleanupViewModeListener();
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}]);
|
|
167
|
-
}(_reactNodeView.default);
|
|
168
|
-
var bodiedSyncBlockNodeViewOld = exports.bodiedSyncBlockNodeViewOld = function bodiedSyncBlockNodeViewOld(_ref4) {
|
|
169
|
-
var pluginOptions = _ref4.pluginOptions,
|
|
170
|
-
pmPluginFactoryParams = _ref4.pmPluginFactoryParams,
|
|
171
|
-
api = _ref4.api,
|
|
172
|
-
syncBlockStore = _ref4.syncBlockStore;
|
|
173
|
-
return function (node, view, getPos) {
|
|
174
|
-
var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
|
|
175
|
-
eventDispatcher = pmPluginFactoryParams.eventDispatcher;
|
|
176
|
-
return new BodiedSyncBlockOld({
|
|
177
|
-
api: api,
|
|
178
|
-
pluginOptions: pluginOptions,
|
|
179
|
-
node: node,
|
|
180
|
-
view: view,
|
|
181
|
-
getPos: getPos,
|
|
182
|
-
portalProviderAPI: portalProviderAPI,
|
|
183
|
-
eventDispatcher: eventDispatcher,
|
|
184
|
-
syncBlockStore: syncBlockStore
|
|
185
|
-
}).init();
|
|
186
|
-
};
|
|
187
|
-
};
|
|
188
20
|
var toDOM = function toDOM(node) {
|
|
189
21
|
return ['div', {
|
|
190
22
|
class: "".concat(_syncBlock.BodiedSyncBlockSharedCssClassName.prefix, " bodiedSyncBlockView-content-wrap"),
|
|
@@ -197,7 +29,7 @@ var toDOM = function toDOM(node) {
|
|
|
197
29
|
};
|
|
198
30
|
var BodiedSyncBlock = exports.BodiedSyncBlock = /*#__PURE__*/function () {
|
|
199
31
|
function BodiedSyncBlock(node, view, getPos, api, nodeViewPortalProviderAPI) {
|
|
200
|
-
var
|
|
32
|
+
var _this = this;
|
|
201
33
|
(0, _classCallCheck2.default)(this, BodiedSyncBlock);
|
|
202
34
|
this.node = node;
|
|
203
35
|
this.view = view;
|
|
@@ -205,9 +37,9 @@ var BodiedSyncBlock = exports.BodiedSyncBlock = /*#__PURE__*/function () {
|
|
|
205
37
|
this.api = api;
|
|
206
38
|
this.nodeViewPortalProviderAPI = nodeViewPortalProviderAPI;
|
|
207
39
|
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- NodeView serialization must target active runtime document
|
|
208
|
-
var _DOMSerializer$
|
|
209
|
-
dom = _DOMSerializer$
|
|
210
|
-
contentDOM = _DOMSerializer$
|
|
40
|
+
var _DOMSerializer$render = _model.DOMSerializer.renderSpec(document, toDOM(this.node)),
|
|
41
|
+
dom = _DOMSerializer$render.dom,
|
|
42
|
+
contentDOM = _DOMSerializer$render.contentDOM;
|
|
211
43
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
212
44
|
this.dom = dom;
|
|
213
45
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
@@ -231,11 +63,11 @@ var BodiedSyncBlock = exports.BodiedSyncBlock = /*#__PURE__*/function () {
|
|
|
231
63
|
}
|
|
232
64
|
this.labelKey = crypto.randomUUID();
|
|
233
65
|
this.nodeViewPortalProviderAPI.render(function () {
|
|
234
|
-
var
|
|
66
|
+
var _this$api;
|
|
235
67
|
return /*#__PURE__*/_react.default.createElement(_errorBoundary.ErrorBoundary, {
|
|
236
68
|
component: _analytics.ACTION_SUBJECT.SYNCED_BLOCK,
|
|
237
69
|
componentId: _analytics.ACTION_SUBJECT_ID.SYNCED_BLOCK_LABEL,
|
|
238
|
-
dispatchAnalyticsEvent: (
|
|
70
|
+
dispatchAnalyticsEvent: (_this$api = _this.api) === null || _this$api === void 0 || (_this$api = _this$api.analytics) === null || _this$api === void 0 ? void 0 : _this$api.actions.fireAnalyticsEvent,
|
|
239
71
|
fallbackComponent: null
|
|
240
72
|
}, /*#__PURE__*/_react.default.createElement(_SyncBlockLabel.SyncBlockLabel, {
|
|
241
73
|
isSource: true,
|
|
@@ -252,12 +84,12 @@ var BodiedSyncBlock = exports.BodiedSyncBlock = /*#__PURE__*/function () {
|
|
|
252
84
|
}
|
|
253
85
|
return (0, _createClass2.default)(BodiedSyncBlock, [{
|
|
254
86
|
key: "updateContentEditable",
|
|
255
|
-
value: function updateContentEditable(
|
|
256
|
-
var _this$
|
|
257
|
-
var nextConnectivityMode =
|
|
258
|
-
nextViewMode =
|
|
259
|
-
var connectivityMode = nextConnectivityMode !== null && nextConnectivityMode !== void 0 ? nextConnectivityMode : (_this$
|
|
260
|
-
var viewMode = nextViewMode !== null && nextViewMode !== void 0 ? nextViewMode : (_this$
|
|
87
|
+
value: function updateContentEditable(_ref) {
|
|
88
|
+
var _this$api2, _this$api3;
|
|
89
|
+
var nextConnectivityMode = _ref.nextConnectivityMode,
|
|
90
|
+
nextViewMode = _ref.nextViewMode;
|
|
91
|
+
var connectivityMode = nextConnectivityMode !== null && nextConnectivityMode !== void 0 ? nextConnectivityMode : (_this$api2 = this.api) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.connectivity) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.sharedState) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.currentState()) === null || _this$api2 === void 0 ? void 0 : _this$api2.mode;
|
|
92
|
+
var viewMode = nextViewMode !== null && nextViewMode !== void 0 ? nextViewMode : (_this$api3 = this.api) === null || _this$api3 === void 0 || (_this$api3 = _this$api3.editorViewMode) === null || _this$api3 === void 0 || (_this$api3 = _this$api3.sharedState) === null || _this$api3 === void 0 || (_this$api3 = _this$api3.currentState()) === null || _this$api3 === void 0 ? void 0 : _this$api3.mode;
|
|
261
93
|
var isOnline = !(0, _editorPluginConnectivity.isOfflineMode)(connectivityMode);
|
|
262
94
|
var isEditMode = viewMode !== 'view';
|
|
263
95
|
var shouldBeEditable = isOnline && isEditMode;
|
|
@@ -266,12 +98,12 @@ var BodiedSyncBlock = exports.BodiedSyncBlock = /*#__PURE__*/function () {
|
|
|
266
98
|
}, {
|
|
267
99
|
key: "handleConnectivityModeChange",
|
|
268
100
|
value: function handleConnectivityModeChange() {
|
|
269
|
-
var _this$
|
|
270
|
-
|
|
271
|
-
if ((_this$
|
|
272
|
-
this.cleanupConnectivityModeListener = this.api.connectivity.sharedState.onChange(function (
|
|
273
|
-
var nextSharedState =
|
|
274
|
-
|
|
101
|
+
var _this$api4,
|
|
102
|
+
_this2 = this;
|
|
103
|
+
if ((_this$api4 = this.api) !== null && _this$api4 !== void 0 && _this$api4.connectivity) {
|
|
104
|
+
this.cleanupConnectivityModeListener = this.api.connectivity.sharedState.onChange(function (_ref2) {
|
|
105
|
+
var nextSharedState = _ref2.nextSharedState;
|
|
106
|
+
_this2.updateContentEditable({
|
|
275
107
|
nextConnectivityMode: nextSharedState.mode
|
|
276
108
|
});
|
|
277
109
|
});
|
|
@@ -280,12 +112,12 @@ var BodiedSyncBlock = exports.BodiedSyncBlock = /*#__PURE__*/function () {
|
|
|
280
112
|
}, {
|
|
281
113
|
key: "handleViewModeChange",
|
|
282
114
|
value: function handleViewModeChange() {
|
|
283
|
-
var _this$
|
|
284
|
-
|
|
285
|
-
if ((_this$
|
|
286
|
-
this.cleanupViewModeListener = this.api.editorViewMode.sharedState.onChange(function (
|
|
287
|
-
var nextSharedState =
|
|
288
|
-
|
|
115
|
+
var _this$api5,
|
|
116
|
+
_this3 = this;
|
|
117
|
+
if ((_this$api5 = this.api) !== null && _this$api5 !== void 0 && _this$api5.editorViewMode) {
|
|
118
|
+
this.cleanupViewModeListener = this.api.editorViewMode.sharedState.onChange(function (_ref3) {
|
|
119
|
+
var nextSharedState = _ref3.nextSharedState;
|
|
120
|
+
_this3.updateContentEditable({
|
|
289
121
|
nextViewMode: nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.mode
|
|
290
122
|
});
|
|
291
123
|
});
|
|
@@ -19,7 +19,6 @@ var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/rea
|
|
|
19
19
|
var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
20
20
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
21
21
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
22
|
-
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
23
22
|
var _editorCommands = require("../editor-commands");
|
|
24
23
|
var _SyncBlockRendererWrapper = require("../ui/SyncBlockRendererWrapper");
|
|
25
24
|
var _SyncBlockSSRReactContextsProvider = require("../ui/SyncBlockSSRReactContextsProvider");
|
|
@@ -194,12 +193,7 @@ var SyncBlock = exports.SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
194
193
|
}, {
|
|
195
194
|
key: "render",
|
|
196
195
|
value: function render(_ref) {
|
|
197
|
-
var _this$options,
|
|
198
|
-
_this$api$syncedBlock2,
|
|
199
|
-
_this$api2,
|
|
200
|
-
_this$api3,
|
|
201
|
-
_this2 = this,
|
|
202
|
-
_this$options2;
|
|
196
|
+
var _this$options, _this$api$syncedBlock2, _this$api2, _this$api3, _this$options2;
|
|
203
197
|
var getPos = _ref.getPos;
|
|
204
198
|
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.syncedBlockRenderer)) {
|
|
205
199
|
return null;
|
|
@@ -215,10 +209,6 @@ var SyncBlock = exports.SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
215
209
|
return null;
|
|
216
210
|
}
|
|
217
211
|
|
|
218
|
-
// Use expValEqualsNoExposure — the exposure is already fired once at plugin
|
|
219
|
-
// creation time in syncedBlockPlugin.tsx and main.ts createPlugin().
|
|
220
|
-
var isPerfEnabled = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('editor_synced_block_perf', 'isEnabled', true);
|
|
221
|
-
|
|
222
212
|
// get document node from data provider
|
|
223
213
|
return /*#__PURE__*/_react.default.createElement(_SyncBlockSSRReactContextsProvider.SyncBlockSSRReactContextsProvider, {
|
|
224
214
|
intl: this.intl
|
|
@@ -226,20 +216,9 @@ var SyncBlock = exports.SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
226
216
|
component: _analytics.ACTION_SUBJECT.SYNCED_BLOCK,
|
|
227
217
|
dispatchAnalyticsEvent: (_this$api3 = this.api) === null || _this$api3 === void 0 || (_this$api3 = _this$api3.analytics) === null || _this$api3 === void 0 ? void 0 : _this$api3.actions.fireAnalyticsEvent,
|
|
228
218
|
fallbackComponent: null
|
|
229
|
-
}, /*#__PURE__*/_react.default.createElement(_syncBlock.SyncBlockActionsProvider
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
removeSyncBlock: isPerfEnabled ? this.removeSyncBlockStable : function () {
|
|
233
|
-
var pos = getPos();
|
|
234
|
-
if (pos !== undefined) {
|
|
235
|
-
(0, _editorCommands.removeSyncedBlockAtPos)(_this2.api, pos);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
239
|
-
,
|
|
240
|
-
fetchSyncBlockSourceInfo: isPerfEnabled ? this.fetchSyncBlockSourceInfoStable : function (sourceAri) {
|
|
241
|
-
return syncBlockStore.referenceManager.fetchSyncBlockSourceInfoBySourceAri(sourceAri);
|
|
242
|
-
}
|
|
219
|
+
}, /*#__PURE__*/_react.default.createElement(_syncBlock.SyncBlockActionsProvider, {
|
|
220
|
+
removeSyncBlock: this.removeSyncBlockStable,
|
|
221
|
+
fetchSyncBlockSourceInfo: this.fetchSyncBlockSourceInfoStable
|
|
243
222
|
}, /*#__PURE__*/_react.default.createElement(_SyncBlockRendererWrapper.SyncBlockRendererWrapper, {
|
|
244
223
|
localId: localId,
|
|
245
224
|
resourceId: resourceId,
|