@atlaskit/editor-plugin-synced-block 5.3.33 → 5.3.35
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 +15 -0
- package/dist/cjs/editor-commands/index.js +2 -4
- package/dist/cjs/nodeviews/bodiedSyncedBlock.js +14 -7
- package/dist/cjs/pm-plugins/main.js +273 -110
- package/dist/cjs/pm-plugins/utils/handle-bodied-sync-block-creation.js +2 -1
- package/dist/cjs/pm-plugins/utils/utils.js +13 -1
- package/dist/es2019/editor-commands/index.js +10 -10
- package/dist/es2019/nodeviews/bodiedSyncedBlock.js +14 -7
- package/dist/es2019/pm-plugins/main.js +263 -116
- package/dist/es2019/pm-plugins/utils/handle-bodied-sync-block-creation.js +2 -1
- package/dist/es2019/pm-plugins/utils/utils.js +13 -0
- package/dist/esm/editor-commands/index.js +3 -5
- package/dist/esm/nodeviews/bodiedSyncedBlock.js +13 -6
- package/dist/esm/pm-plugins/main.js +273 -110
- package/dist/esm/pm-plugins/utils/handle-bodied-sync-block-creation.js +2 -1
- package/dist/esm/pm-plugins/utils/utils.js +13 -0
- package/dist/types/nodeviews/bodiedSyncedBlock.d.ts +22 -1
- package/dist/types/pm-plugins/utils/utils.d.ts +5 -0
- package/dist/types-ts4.5/nodeviews/bodiedSyncedBlock.d.ts +22 -1
- package/dist/types-ts4.5/pm-plugins/utils/utils.d.ts +5 -0
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
+
## 5.3.35
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`d144f08676a16`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d144f08676a16) -
|
|
8
|
+
[EDITOR-5528] Remove lazy loading for bodiedSyncBlock node
|
|
9
|
+
|
|
10
|
+
## 5.3.34
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`6424f86f6390a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6424f86f6390a) -
|
|
15
|
+
Improve Synced Blocks robustness
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 5.3.33
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -153,9 +153,7 @@ var copySyncedBlockReferenceToClipboardInternal = function copySyncedBlockRefere
|
|
|
153
153
|
}
|
|
154
154
|
var domNode = (0, _copyButton.toDOM)(referenceSyncBlockNode, schema);
|
|
155
155
|
(0, _copyButton.copyDomNode)(domNode, referenceSyncBlockNode.type, selection);
|
|
156
|
-
|
|
157
|
-
// Use setTimeout to dispatch transaction in next tick and avoid re-entrant dispatch
|
|
158
|
-
setTimeout(function () {
|
|
156
|
+
(0, _utils2.deferDispatch)(function () {
|
|
159
157
|
api === null || api === void 0 || api.core.actions.execute(function (_ref3) {
|
|
160
158
|
var _api$analytics4;
|
|
161
159
|
var tr = _ref3.tr;
|
|
@@ -175,7 +173,7 @@ var copySyncedBlockReferenceToClipboardInternal = function copySyncedBlockRefere
|
|
|
175
173
|
}
|
|
176
174
|
});
|
|
177
175
|
});
|
|
178
|
-
}
|
|
176
|
+
});
|
|
179
177
|
return true;
|
|
180
178
|
};
|
|
181
179
|
var editSyncedBlockSource = exports.editSyncedBlockSource = function editSyncedBlockSource(syncBlockStore, api) {
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.bodiedSyncBlockNodeView = void 0;
|
|
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
10
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
@@ -17,6 +17,7 @@ var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/rea
|
|
|
17
17
|
var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
18
18
|
var _editorPluginConnectivity = require("@atlaskit/editor-plugin-connectivity");
|
|
19
19
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
20
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
21
|
var _BodiedSyncBlockWrapper = require("../ui/BodiedSyncBlockWrapper");
|
|
21
22
|
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)); }
|
|
22
23
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
@@ -26,12 +27,13 @@ var toDOM = function toDOM() {
|
|
|
26
27
|
contenteditable: true
|
|
27
28
|
}, 0];
|
|
28
29
|
};
|
|
29
|
-
var BodiedSyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
30
|
+
var BodiedSyncBlock = exports.BodiedSyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
30
31
|
function BodiedSyncBlock(props) {
|
|
31
32
|
var _this;
|
|
32
33
|
(0, _classCallCheck2.default)(this, BodiedSyncBlock);
|
|
33
34
|
_this = _callSuper(this, BodiedSyncBlock, [props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props]);
|
|
34
35
|
_this.api = props.api;
|
|
36
|
+
_this.syncBlockStore = props.syncBlockStore;
|
|
35
37
|
_this.handleConnectivityModeChange();
|
|
36
38
|
_this.handleViewModeChange();
|
|
37
39
|
return _this;
|
|
@@ -91,8 +93,9 @@ var BodiedSyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
91
93
|
}, {
|
|
92
94
|
key: "render",
|
|
93
95
|
value: function render(_props, forwardRef) {
|
|
94
|
-
var _this$api5, _this$api6;
|
|
95
|
-
|
|
96
|
+
var _this$api$syncedBlock, _this$api5, _this$api6;
|
|
97
|
+
// Use passed syncBlockStore for SSR where sharedState.currentState() is delayed
|
|
98
|
+
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;
|
|
96
99
|
if (!syncBlockStore) {
|
|
97
100
|
return null;
|
|
98
101
|
}
|
|
@@ -112,10 +115,12 @@ var BodiedSyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
112
115
|
var _DOMSerializer$render = _model.DOMSerializer.renderSpec(document, toDOM()),
|
|
113
116
|
dom = _DOMSerializer$render.dom,
|
|
114
117
|
contentDOM = _DOMSerializer$render.contentDOM;
|
|
115
|
-
|
|
118
|
+
// In SSR, the first check won't work, so fallback to nodeType check
|
|
119
|
+
if (dom instanceof HTMLElement || dom.nodeType === 1 && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_5')) {
|
|
116
120
|
this.updateContentEditable({
|
|
117
121
|
contentDOM: contentDOM
|
|
118
122
|
});
|
|
123
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
119
124
|
return {
|
|
120
125
|
dom: dom,
|
|
121
126
|
contentDOM: contentDOM
|
|
@@ -138,7 +143,8 @@ var BodiedSyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
138
143
|
var bodiedSyncBlockNodeView = exports.bodiedSyncBlockNodeView = function bodiedSyncBlockNodeView(_ref4) {
|
|
139
144
|
var pluginOptions = _ref4.pluginOptions,
|
|
140
145
|
pmPluginFactoryParams = _ref4.pmPluginFactoryParams,
|
|
141
|
-
api = _ref4.api
|
|
146
|
+
api = _ref4.api,
|
|
147
|
+
syncBlockStore = _ref4.syncBlockStore;
|
|
142
148
|
return function (node, view, getPos) {
|
|
143
149
|
var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
|
|
144
150
|
eventDispatcher = pmPluginFactoryParams.eventDispatcher;
|
|
@@ -149,7 +155,8 @@ var bodiedSyncBlockNodeView = exports.bodiedSyncBlockNodeView = function bodiedS
|
|
|
149
155
|
view: view,
|
|
150
156
|
getPos: getPos,
|
|
151
157
|
portalProviderAPI: portalProviderAPI,
|
|
152
|
-
eventDispatcher: eventDispatcher
|
|
158
|
+
eventDispatcher: eventDispatcher,
|
|
159
|
+
syncBlockStore: syncBlockStore
|
|
153
160
|
}).init();
|
|
154
161
|
};
|
|
155
162
|
};
|