@atlaskit/editor-synced-block-provider 0.8.0 → 1.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 +14 -0
- package/dist/cjs/common/syncBlockProvider.js +12 -6
- package/dist/cjs/common/syncBlockStoreManager.js +1 -11
- package/dist/cjs/utils/ari.js +1 -16
- package/dist/es2019/common/syncBlockProvider.js +12 -6
- package/dist/es2019/common/syncBlockStoreManager.js +1 -7
- package/dist/es2019/utils/ari.js +0 -15
- package/dist/esm/common/syncBlockProvider.js +13 -7
- package/dist/esm/common/syncBlockStoreManager.js +1 -11
- package/dist/esm/utils/ari.js +0 -15
- package/dist/types/common/syncBlockProvider.d.ts +2 -1
- package/dist/types/common/syncBlockStoreManager.d.ts +0 -3
- package/dist/types/utils/ari.d.ts +0 -8
- package/dist/types-ts4.5/common/syncBlockProvider.d.ts +2 -1
- package/dist/types-ts4.5/common/syncBlockStoreManager.d.ts +0 -3
- package/dist/types-ts4.5/utils/ari.d.ts +0 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-synced-block-provider
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`10882b2fab738`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/10882b2fab738) -
|
|
8
|
+
[ux] Introduced bodiedSyncBlock nodeview
|
|
9
|
+
|
|
10
|
+
## 0.9.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [`d69b1dec4af70`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d69b1dec4af70) -
|
|
15
|
+
Generate link to source block with localid parameter
|
|
16
|
+
|
|
3
17
|
## 0.8.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -65,7 +65,7 @@ var SyncBlockProvider = exports.SyncBlockProvider = /*#__PURE__*/function (_Sync
|
|
|
65
65
|
value: function writeNodesData(nodes, data) {
|
|
66
66
|
var _this3 = this;
|
|
67
67
|
var resourceIds = [];
|
|
68
|
-
nodes.forEach(function (
|
|
68
|
+
nodes.forEach(function (_node, index) {
|
|
69
69
|
if (!data[index].content) {
|
|
70
70
|
resourceIds.push(Promise.reject('No Synced Blockcontent to write'));
|
|
71
71
|
return;
|
|
@@ -85,14 +85,20 @@ var SyncBlockProvider = exports.SyncBlockProvider = /*#__PURE__*/function (_Sync
|
|
|
85
85
|
value: function retrieveSyncBlockSourceUrl(node) {
|
|
86
86
|
var resourceId = node.attrs.resourceId;
|
|
87
87
|
var pageARI;
|
|
88
|
+
var sourceLocalId;
|
|
88
89
|
if (resourceId && typeof resourceId === 'string') {
|
|
89
90
|
try {
|
|
90
91
|
pageARI = (0, _ari.getPageARIFromResourceId)(resourceId);
|
|
91
92
|
} catch (error) {
|
|
92
93
|
return Promise.reject(error);
|
|
93
94
|
}
|
|
95
|
+
try {
|
|
96
|
+
sourceLocalId = (0, _ari.getLocalIdFromAri)(resourceId);
|
|
97
|
+
} catch (error) {
|
|
98
|
+
// EDITOR-1921: log analytic here, safe to continue
|
|
99
|
+
}
|
|
94
100
|
}
|
|
95
|
-
return pageARI ? fetchURLfromARI(pageARI) : Promise.resolve(undefined);
|
|
101
|
+
return pageARI ? fetchURLfromARI(pageARI, sourceLocalId) : Promise.resolve(undefined);
|
|
96
102
|
}
|
|
97
103
|
}]);
|
|
98
104
|
}(_types.SyncBlockDataProvider);
|
|
@@ -142,7 +148,7 @@ var useHandleContentChanges = exports.useHandleContentChanges = function useHand
|
|
|
142
148
|
}
|
|
143
149
|
var syncBlockNode = (0, _utils.convertSyncBlockPMNodeToSyncBlockData)(node, false);
|
|
144
150
|
var data = {
|
|
145
|
-
content: updatedDoc
|
|
151
|
+
content: updatedDoc,
|
|
146
152
|
resourceId: node.attrs.resourceId,
|
|
147
153
|
localId: node.attrs.localId
|
|
148
154
|
};
|
|
@@ -150,7 +156,7 @@ var useHandleContentChanges = exports.useHandleContentChanges = function useHand
|
|
|
150
156
|
}, [isSource, node, provider, updatedDoc]);
|
|
151
157
|
};
|
|
152
158
|
var fetchURLfromARI = /*#__PURE__*/function () {
|
|
153
|
-
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(ari) {
|
|
159
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(ari, sourceLocalId) {
|
|
154
160
|
var response, _payload$data, payload, url;
|
|
155
161
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
156
162
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -181,7 +187,7 @@ var fetchURLfromARI = /*#__PURE__*/function () {
|
|
|
181
187
|
_context.next = 10;
|
|
182
188
|
break;
|
|
183
189
|
}
|
|
184
|
-
return _context.abrupt("return", url);
|
|
190
|
+
return _context.abrupt("return", sourceLocalId ? url + "?block=".concat(sourceLocalId) : url);
|
|
185
191
|
case 10:
|
|
186
192
|
_context.next = 13;
|
|
187
193
|
break;
|
|
@@ -196,7 +202,7 @@ var fetchURLfromARI = /*#__PURE__*/function () {
|
|
|
196
202
|
}
|
|
197
203
|
}, _callee);
|
|
198
204
|
}));
|
|
199
|
-
return function fetchURLfromARI(_x) {
|
|
205
|
+
return function fetchURLfromARI(_x, _x2) {
|
|
200
206
|
return _ref.apply(this, arguments);
|
|
201
207
|
};
|
|
202
208
|
}();
|
|
@@ -87,21 +87,11 @@ var SyncBlockStoreManager = exports.SyncBlockStoreManager = /*#__PURE__*/functio
|
|
|
87
87
|
value: function setEditorView(editorView) {
|
|
88
88
|
this.editorView = editorView;
|
|
89
89
|
}
|
|
90
|
-
}, {
|
|
91
|
-
key: "setSyncBlockNestedEditorView",
|
|
92
|
-
value: function setSyncBlockNestedEditorView(editorView) {
|
|
93
|
-
this.syncBlockNestedEditorView = editorView;
|
|
94
|
-
}
|
|
95
|
-
}, {
|
|
96
|
-
key: "getSyncBlockNestedEditorView",
|
|
97
|
-
value: function getSyncBlockNestedEditorView() {
|
|
98
|
-
return this.syncBlockNestedEditorView;
|
|
99
|
-
}
|
|
100
90
|
}, {
|
|
101
91
|
key: "isSourceBlock",
|
|
102
92
|
value: function isSourceBlock(node) {
|
|
103
93
|
var _this$dataProvider;
|
|
104
|
-
if (node.type.name !== '
|
|
94
|
+
if (node.type.name !== 'bodiedSyncBlock') {
|
|
105
95
|
return false;
|
|
106
96
|
}
|
|
107
97
|
var _node$attrs2 = node.attrs,
|
package/dist/cjs/utils/ari.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.resourceIdFromSourceAndLocalId = exports.getPageIdAndTypeFromAri = exports.getPageARIFromResourceId = exports.getLocalIdFromAri = exports.
|
|
6
|
+
exports.resourceIdFromSourceAndLocalId = exports.getPageIdAndTypeFromAri = exports.getPageARIFromResourceId = exports.getLocalIdFromAri = exports.getContentPropertyAri = exports.getConfluencePageAri = void 0;
|
|
7
7
|
/* eslint-disable require-unicode-regexp */
|
|
8
8
|
|
|
9
9
|
var getConfluencePageAri = exports.getConfluencePageAri = function getConfluencePageAri(pageId, cloudId) {
|
|
@@ -37,21 +37,6 @@ var getPageARIFromResourceId = exports.getPageARIFromResourceId = function getPa
|
|
|
37
37
|
var getContentPropertyAri = exports.getContentPropertyAri = function getContentPropertyAri(contentPropertyId, cloudId) {
|
|
38
38
|
return "ari:cloud:confluence:".concat(cloudId, ":content/").concat(contentPropertyId);
|
|
39
39
|
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* DEPRECATED - Will be removed in the future
|
|
43
|
-
* @private
|
|
44
|
-
* @deprecated
|
|
45
|
-
* @param ari
|
|
46
|
-
* @returns
|
|
47
|
-
*/
|
|
48
|
-
var getContentPropertyIdFromAri = exports.getContentPropertyIdFromAri = function getContentPropertyIdFromAri(ari) {
|
|
49
|
-
var match = ari.match(/ari:cloud:confluence:[^:]+:content\/([^/]+)/);
|
|
50
|
-
if (match) {
|
|
51
|
-
return match[1];
|
|
52
|
-
}
|
|
53
|
-
throw new Error("Invalid content property ARI: ".concat(ari));
|
|
54
|
-
};
|
|
55
40
|
var resourceIdFromSourceAndLocalId = exports.resourceIdFromSourceAndLocalId = function resourceIdFromSourceAndLocalId(sourceId, localId) {
|
|
56
41
|
return sourceId + '/' + localId;
|
|
57
42
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { useEffect, useState, useMemo } from 'react';
|
|
3
|
-
import { getPageARIFromResourceId } from '../utils/ari';
|
|
3
|
+
import { getLocalIdFromAri, getPageARIFromResourceId } from '../utils/ari';
|
|
4
4
|
import { convertSyncBlockPMNodeToSyncBlockData } from '../utils/utils';
|
|
5
5
|
import { SyncBlockDataProvider } from './types';
|
|
6
6
|
export class SyncBlockProvider extends SyncBlockDataProvider {
|
|
@@ -32,7 +32,7 @@ export class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
32
32
|
*/
|
|
33
33
|
writeNodesData(nodes, data) {
|
|
34
34
|
const resourceIds = [];
|
|
35
|
-
nodes.forEach((
|
|
35
|
+
nodes.forEach((_node, index) => {
|
|
36
36
|
if (!data[index].content) {
|
|
37
37
|
resourceIds.push(Promise.reject('No Synced Blockcontent to write'));
|
|
38
38
|
return;
|
|
@@ -50,14 +50,20 @@ export class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
50
50
|
resourceId
|
|
51
51
|
} = node.attrs;
|
|
52
52
|
let pageARI;
|
|
53
|
+
let sourceLocalId;
|
|
53
54
|
if (resourceId && typeof resourceId === 'string') {
|
|
54
55
|
try {
|
|
55
56
|
pageARI = getPageARIFromResourceId(resourceId);
|
|
56
57
|
} catch (error) {
|
|
57
58
|
return Promise.reject(error);
|
|
58
59
|
}
|
|
60
|
+
try {
|
|
61
|
+
sourceLocalId = getLocalIdFromAri(resourceId);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
// EDITOR-1921: log analytic here, safe to continue
|
|
64
|
+
}
|
|
59
65
|
}
|
|
60
|
-
return pageARI ? fetchURLfromARI(pageARI) : Promise.resolve(undefined);
|
|
66
|
+
return pageARI ? fetchURLfromARI(pageARI, sourceLocalId) : Promise.resolve(undefined);
|
|
61
67
|
}
|
|
62
68
|
}
|
|
63
69
|
export const useFetchDocNode = (editorView, node, defaultDocNode, provider) => {
|
|
@@ -104,14 +110,14 @@ export const useHandleContentChanges = (updatedDoc, isSource, node, provider) =>
|
|
|
104
110
|
}
|
|
105
111
|
const syncBlockNode = convertSyncBlockPMNodeToSyncBlockData(node, false);
|
|
106
112
|
const data = {
|
|
107
|
-
content: updatedDoc
|
|
113
|
+
content: updatedDoc,
|
|
108
114
|
resourceId: node.attrs.resourceId,
|
|
109
115
|
localId: node.attrs.localId
|
|
110
116
|
};
|
|
111
117
|
provider === null || provider === void 0 ? void 0 : provider.writeNodesData([syncBlockNode], [data]);
|
|
112
118
|
}, [isSource, node, provider, updatedDoc]);
|
|
113
119
|
};
|
|
114
|
-
const fetchURLfromARI = async ari => {
|
|
120
|
+
const fetchURLfromARI = async (ari, sourceLocalId) => {
|
|
115
121
|
const response = await fetch('/gateway/api/object-resolver/resolve/ari', {
|
|
116
122
|
method: 'POST',
|
|
117
123
|
headers: {
|
|
@@ -127,7 +133,7 @@ const fetchURLfromARI = async ari => {
|
|
|
127
133
|
const payload = await response.json();
|
|
128
134
|
const url = payload === null || payload === void 0 ? void 0 : (_payload$data = payload.data) === null || _payload$data === void 0 ? void 0 : _payload$data.url;
|
|
129
135
|
if (typeof url === 'string') {
|
|
130
|
-
return url;
|
|
136
|
+
return sourceLocalId ? url + `?block=${sourceLocalId}` : url;
|
|
131
137
|
}
|
|
132
138
|
} else {
|
|
133
139
|
//eslint-disable-next-line no-console
|
|
@@ -71,15 +71,9 @@ export class SyncBlockStoreManager {
|
|
|
71
71
|
setEditorView(editorView) {
|
|
72
72
|
this.editorView = editorView;
|
|
73
73
|
}
|
|
74
|
-
setSyncBlockNestedEditorView(editorView) {
|
|
75
|
-
this.syncBlockNestedEditorView = editorView;
|
|
76
|
-
}
|
|
77
|
-
getSyncBlockNestedEditorView() {
|
|
78
|
-
return this.syncBlockNestedEditorView;
|
|
79
|
-
}
|
|
80
74
|
isSourceBlock(node) {
|
|
81
75
|
var _this$dataProvider;
|
|
82
|
-
if (node.type.name !== '
|
|
76
|
+
if (node.type.name !== 'bodiedSyncBlock') {
|
|
83
77
|
return false;
|
|
84
78
|
}
|
|
85
79
|
const {
|
package/dist/es2019/utils/ari.js
CHANGED
|
@@ -26,21 +26,6 @@ export const getPageARIFromResourceId = resourceId => {
|
|
|
26
26
|
throw new Error(`Invalid resourceId: ${resourceId}`);
|
|
27
27
|
};
|
|
28
28
|
export const getContentPropertyAri = (contentPropertyId, cloudId) => `ari:cloud:confluence:${cloudId}:content/${contentPropertyId}`;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* DEPRECATED - Will be removed in the future
|
|
32
|
-
* @private
|
|
33
|
-
* @deprecated
|
|
34
|
-
* @param ari
|
|
35
|
-
* @returns
|
|
36
|
-
*/
|
|
37
|
-
export const getContentPropertyIdFromAri = ari => {
|
|
38
|
-
const match = ari.match(/ari:cloud:confluence:[^:]+:content\/([^/]+)/);
|
|
39
|
-
if (match) {
|
|
40
|
-
return match[1];
|
|
41
|
-
}
|
|
42
|
-
throw new Error(`Invalid content property ARI: ${ari}`);
|
|
43
|
-
};
|
|
44
29
|
export const resourceIdFromSourceAndLocalId = (sourceId, localId) => {
|
|
45
30
|
return sourceId + '/' + localId;
|
|
46
31
|
};
|
|
@@ -12,7 +12,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
12
12
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
13
13
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
14
14
|
import { useEffect, useState, useMemo } from 'react';
|
|
15
|
-
import { getPageARIFromResourceId } from '../utils/ari';
|
|
15
|
+
import { getLocalIdFromAri, getPageARIFromResourceId } from '../utils/ari';
|
|
16
16
|
import { convertSyncBlockPMNodeToSyncBlockData } from '../utils/utils';
|
|
17
17
|
import { SyncBlockDataProvider } from './types';
|
|
18
18
|
export var SyncBlockProvider = /*#__PURE__*/function (_SyncBlockDataProvide) {
|
|
@@ -58,7 +58,7 @@ export var SyncBlockProvider = /*#__PURE__*/function (_SyncBlockDataProvide) {
|
|
|
58
58
|
value: function writeNodesData(nodes, data) {
|
|
59
59
|
var _this3 = this;
|
|
60
60
|
var resourceIds = [];
|
|
61
|
-
nodes.forEach(function (
|
|
61
|
+
nodes.forEach(function (_node, index) {
|
|
62
62
|
if (!data[index].content) {
|
|
63
63
|
resourceIds.push(Promise.reject('No Synced Blockcontent to write'));
|
|
64
64
|
return;
|
|
@@ -78,14 +78,20 @@ export var SyncBlockProvider = /*#__PURE__*/function (_SyncBlockDataProvide) {
|
|
|
78
78
|
value: function retrieveSyncBlockSourceUrl(node) {
|
|
79
79
|
var resourceId = node.attrs.resourceId;
|
|
80
80
|
var pageARI;
|
|
81
|
+
var sourceLocalId;
|
|
81
82
|
if (resourceId && typeof resourceId === 'string') {
|
|
82
83
|
try {
|
|
83
84
|
pageARI = getPageARIFromResourceId(resourceId);
|
|
84
85
|
} catch (error) {
|
|
85
86
|
return Promise.reject(error);
|
|
86
87
|
}
|
|
88
|
+
try {
|
|
89
|
+
sourceLocalId = getLocalIdFromAri(resourceId);
|
|
90
|
+
} catch (error) {
|
|
91
|
+
// EDITOR-1921: log analytic here, safe to continue
|
|
92
|
+
}
|
|
87
93
|
}
|
|
88
|
-
return pageARI ? fetchURLfromARI(pageARI) : Promise.resolve(undefined);
|
|
94
|
+
return pageARI ? fetchURLfromARI(pageARI, sourceLocalId) : Promise.resolve(undefined);
|
|
89
95
|
}
|
|
90
96
|
}]);
|
|
91
97
|
}(SyncBlockDataProvider);
|
|
@@ -135,7 +141,7 @@ export var useHandleContentChanges = function useHandleContentChanges(updatedDoc
|
|
|
135
141
|
}
|
|
136
142
|
var syncBlockNode = convertSyncBlockPMNodeToSyncBlockData(node, false);
|
|
137
143
|
var data = {
|
|
138
|
-
content: updatedDoc
|
|
144
|
+
content: updatedDoc,
|
|
139
145
|
resourceId: node.attrs.resourceId,
|
|
140
146
|
localId: node.attrs.localId
|
|
141
147
|
};
|
|
@@ -143,7 +149,7 @@ export var useHandleContentChanges = function useHandleContentChanges(updatedDoc
|
|
|
143
149
|
}, [isSource, node, provider, updatedDoc]);
|
|
144
150
|
};
|
|
145
151
|
var fetchURLfromARI = /*#__PURE__*/function () {
|
|
146
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(ari) {
|
|
152
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(ari, sourceLocalId) {
|
|
147
153
|
var response, _payload$data, payload, url;
|
|
148
154
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
149
155
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -174,7 +180,7 @@ var fetchURLfromARI = /*#__PURE__*/function () {
|
|
|
174
180
|
_context.next = 10;
|
|
175
181
|
break;
|
|
176
182
|
}
|
|
177
|
-
return _context.abrupt("return", url);
|
|
183
|
+
return _context.abrupt("return", sourceLocalId ? url + "?block=".concat(sourceLocalId) : url);
|
|
178
184
|
case 10:
|
|
179
185
|
_context.next = 13;
|
|
180
186
|
break;
|
|
@@ -189,7 +195,7 @@ var fetchURLfromARI = /*#__PURE__*/function () {
|
|
|
189
195
|
}
|
|
190
196
|
}, _callee);
|
|
191
197
|
}));
|
|
192
|
-
return function fetchURLfromARI(_x) {
|
|
198
|
+
return function fetchURLfromARI(_x, _x2) {
|
|
193
199
|
return _ref.apply(this, arguments);
|
|
194
200
|
};
|
|
195
201
|
}();
|
|
@@ -82,21 +82,11 @@ export var SyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
82
82
|
value: function setEditorView(editorView) {
|
|
83
83
|
this.editorView = editorView;
|
|
84
84
|
}
|
|
85
|
-
}, {
|
|
86
|
-
key: "setSyncBlockNestedEditorView",
|
|
87
|
-
value: function setSyncBlockNestedEditorView(editorView) {
|
|
88
|
-
this.syncBlockNestedEditorView = editorView;
|
|
89
|
-
}
|
|
90
|
-
}, {
|
|
91
|
-
key: "getSyncBlockNestedEditorView",
|
|
92
|
-
value: function getSyncBlockNestedEditorView() {
|
|
93
|
-
return this.syncBlockNestedEditorView;
|
|
94
|
-
}
|
|
95
85
|
}, {
|
|
96
86
|
key: "isSourceBlock",
|
|
97
87
|
value: function isSourceBlock(node) {
|
|
98
88
|
var _this$dataProvider;
|
|
99
|
-
if (node.type.name !== '
|
|
89
|
+
if (node.type.name !== 'bodiedSyncBlock') {
|
|
100
90
|
return false;
|
|
101
91
|
}
|
|
102
92
|
var _node$attrs2 = node.attrs,
|
package/dist/esm/utils/ari.js
CHANGED
|
@@ -31,21 +31,6 @@ export var getPageARIFromResourceId = function getPageARIFromResourceId(resource
|
|
|
31
31
|
export var getContentPropertyAri = function getContentPropertyAri(contentPropertyId, cloudId) {
|
|
32
32
|
return "ari:cloud:confluence:".concat(cloudId, ":content/").concat(contentPropertyId);
|
|
33
33
|
};
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* DEPRECATED - Will be removed in the future
|
|
37
|
-
* @private
|
|
38
|
-
* @deprecated
|
|
39
|
-
* @param ari
|
|
40
|
-
* @returns
|
|
41
|
-
*/
|
|
42
|
-
export var getContentPropertyIdFromAri = function getContentPropertyIdFromAri(ari) {
|
|
43
|
-
var match = ari.match(/ari:cloud:confluence:[^:]+:content\/([^/]+)/);
|
|
44
|
-
if (match) {
|
|
45
|
-
return match[1];
|
|
46
|
-
}
|
|
47
|
-
throw new Error("Invalid content property ARI: ".concat(ari));
|
|
48
|
-
};
|
|
49
34
|
export var resourceIdFromSourceAndLocalId = function resourceIdFromSourceAndLocalId(sourceId, localId) {
|
|
50
35
|
return sourceId + '/' + localId;
|
|
51
36
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DocNode } from '@atlaskit/adf-schema';
|
|
2
|
+
import type { ADFEntity } from '@atlaskit/adf-utils/types';
|
|
2
3
|
import type { JSONNode } from '@atlaskit/editor-json-transformer/types';
|
|
3
4
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -25,4 +26,4 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
25
26
|
}
|
|
26
27
|
export declare const useFetchDocNode: (editorView: EditorView, node: PMNode, defaultDocNode: DocNode, provider?: SyncBlockDataProvider) => DocNode;
|
|
27
28
|
export declare const useMemoizedSyncedBlockProvider: (fetchProvider: ADFFetchProvider, writeProvider: ADFWriteProvider, sourceId: string) => SyncBlockProvider;
|
|
28
|
-
export declare const useHandleContentChanges: (updatedDoc:
|
|
29
|
+
export declare const useHandleContentChanges: (updatedDoc: ADFEntity | undefined, isSource: boolean, node: PMNode, provider?: SyncBlockDataProvider) => void;
|
|
@@ -21,7 +21,6 @@ export declare class SyncBlockStoreManager {
|
|
|
21
21
|
private editorView?;
|
|
22
22
|
private dataProvider?;
|
|
23
23
|
private confirmationTransaction?;
|
|
24
|
-
private syncBlockNestedEditorView?;
|
|
25
24
|
constructor(dataProvider?: SyncBlockDataProvider);
|
|
26
25
|
/**
|
|
27
26
|
* Add/update a sync block node to the store.
|
|
@@ -36,8 +35,6 @@ export declare class SyncBlockStoreManager {
|
|
|
36
35
|
*/
|
|
37
36
|
getSyncBlockURL(resourceId: ResourceId): string | undefined;
|
|
38
37
|
setEditorView(editorView: EditorView | undefined): void;
|
|
39
|
-
setSyncBlockNestedEditorView(editorView: EditorView | undefined): void;
|
|
40
|
-
getSyncBlockNestedEditorView(): EditorView | undefined;
|
|
41
38
|
isSourceBlock(node: PMNode): boolean;
|
|
42
39
|
registerConfirmationCallback(callback: ConfirmationCallback): () => void;
|
|
43
40
|
requireConfirmationBeforeDelete(): boolean;
|
|
@@ -7,12 +7,4 @@ export declare const getPageIdAndTypeFromAri: (ari: string) => {
|
|
|
7
7
|
export declare const getLocalIdFromAri: (ari: string) => string;
|
|
8
8
|
export declare const getPageARIFromResourceId: (resourceId: string) => string;
|
|
9
9
|
export declare const getContentPropertyAri: (contentPropertyId: string, cloudId: string) => string;
|
|
10
|
-
/**
|
|
11
|
-
* DEPRECATED - Will be removed in the future
|
|
12
|
-
* @private
|
|
13
|
-
* @deprecated
|
|
14
|
-
* @param ari
|
|
15
|
-
* @returns
|
|
16
|
-
*/
|
|
17
|
-
export declare const getContentPropertyIdFromAri: (ari: string) => string;
|
|
18
10
|
export declare const resourceIdFromSourceAndLocalId: (sourceId: string, localId: string) => string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DocNode } from '@atlaskit/adf-schema';
|
|
2
|
+
import type { ADFEntity } from '@atlaskit/adf-utils/types';
|
|
2
3
|
import type { JSONNode } from '@atlaskit/editor-json-transformer/types';
|
|
3
4
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -25,4 +26,4 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
25
26
|
}
|
|
26
27
|
export declare const useFetchDocNode: (editorView: EditorView, node: PMNode, defaultDocNode: DocNode, provider?: SyncBlockDataProvider) => DocNode;
|
|
27
28
|
export declare const useMemoizedSyncedBlockProvider: (fetchProvider: ADFFetchProvider, writeProvider: ADFWriteProvider, sourceId: string) => SyncBlockProvider;
|
|
28
|
-
export declare const useHandleContentChanges: (updatedDoc:
|
|
29
|
+
export declare const useHandleContentChanges: (updatedDoc: ADFEntity | undefined, isSource: boolean, node: PMNode, provider?: SyncBlockDataProvider) => void;
|
|
@@ -21,7 +21,6 @@ export declare class SyncBlockStoreManager {
|
|
|
21
21
|
private editorView?;
|
|
22
22
|
private dataProvider?;
|
|
23
23
|
private confirmationTransaction?;
|
|
24
|
-
private syncBlockNestedEditorView?;
|
|
25
24
|
constructor(dataProvider?: SyncBlockDataProvider);
|
|
26
25
|
/**
|
|
27
26
|
* Add/update a sync block node to the store.
|
|
@@ -36,8 +35,6 @@ export declare class SyncBlockStoreManager {
|
|
|
36
35
|
*/
|
|
37
36
|
getSyncBlockURL(resourceId: ResourceId): string | undefined;
|
|
38
37
|
setEditorView(editorView: EditorView | undefined): void;
|
|
39
|
-
setSyncBlockNestedEditorView(editorView: EditorView | undefined): void;
|
|
40
|
-
getSyncBlockNestedEditorView(): EditorView | undefined;
|
|
41
38
|
isSourceBlock(node: PMNode): boolean;
|
|
42
39
|
registerConfirmationCallback(callback: ConfirmationCallback): () => void;
|
|
43
40
|
requireConfirmationBeforeDelete(): boolean;
|
|
@@ -7,12 +7,4 @@ export declare const getPageIdAndTypeFromAri: (ari: string) => {
|
|
|
7
7
|
export declare const getLocalIdFromAri: (ari: string) => string;
|
|
8
8
|
export declare const getPageARIFromResourceId: (resourceId: string) => string;
|
|
9
9
|
export declare const getContentPropertyAri: (contentPropertyId: string, cloudId: string) => string;
|
|
10
|
-
/**
|
|
11
|
-
* DEPRECATED - Will be removed in the future
|
|
12
|
-
* @private
|
|
13
|
-
* @deprecated
|
|
14
|
-
* @param ari
|
|
15
|
-
* @returns
|
|
16
|
-
*/
|
|
17
|
-
export declare const getContentPropertyIdFromAri: (ari: string) => string;
|
|
18
10
|
export declare const resourceIdFromSourceAndLocalId: (sourceId: string, localId: string) => string;
|
package/package.json
CHANGED