@atlaskit/editor-common 110.30.2 → 110.31.1
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 +22 -0
- package/dist/cjs/ai-messages/ai-experience-application.js +5 -0
- package/dist/cjs/messages/syncBlock.js +20 -0
- package/dist/cjs/transforms/index.js +4 -4
- package/dist/cjs/transforms/sync-block.js +41 -19
- package/dist/es2019/ai-messages/ai-experience-application.js +5 -0
- package/dist/es2019/messages/syncBlock.js +20 -0
- package/dist/es2019/transforms/index.js +1 -1
- package/dist/es2019/transforms/sync-block.js +41 -19
- package/dist/esm/ai-messages/ai-experience-application.js +5 -0
- package/dist/esm/messages/syncBlock.js +20 -0
- package/dist/esm/transforms/index.js +1 -1
- package/dist/esm/transforms/sync-block.js +40 -18
- package/dist/types/ai-messages/ai-experience-application.d.ts +5 -0
- package/dist/types/messages/syncBlock.d.ts +20 -0
- package/dist/types/transforms/index.d.ts +1 -1
- package/dist/types/transforms/sync-block.d.ts +6 -1
- package/dist/types-ts4.5/ai-messages/ai-experience-application.d.ts +5 -0
- package/dist/types-ts4.5/messages/syncBlock.d.ts +20 -0
- package/dist/types-ts4.5/transforms/index.d.ts +1 -1
- package/dist/types-ts4.5/transforms/sync-block.d.ts +6 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 110.31.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`b14a5fc14cf22`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b14a5fc14cf22) -
|
|
8
|
+
[ux] EDITOR-2606 copy sync block from renderer should flatten out content instead of creating new
|
|
9
|
+
reference
|
|
10
|
+
|
|
11
|
+
## 110.31.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [`721d3790d48fe`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/721d3790d48fe) -
|
|
16
|
+
EDITOR-2533 implement error-ui with retry
|
|
17
|
+
- [`65371c14c13c5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/65371c14c13c5) -
|
|
18
|
+
[ENGHEALTH-23797] A11y violation detected for rule "aria-dialog-name" for
|
|
19
|
+
"@atlassian/editor-plugin-ai" from "Editor: AI"
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
3
25
|
## 110.30.2
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -8,6 +8,11 @@ var _reactIntlNext = require("react-intl-next");
|
|
|
8
8
|
// eslint-disable-next-line no-restricted-imports
|
|
9
9
|
|
|
10
10
|
var aiExperienceApplicationMessages = exports.aiExperienceApplicationMessages = (0, _reactIntlNext.defineMessages)({
|
|
11
|
+
dialogAriaLabel: {
|
|
12
|
+
id: 'fabric.editor.ai.experience.dialogAriaLabel',
|
|
13
|
+
defaultMessage: 'Atlassian Intelligence Dialog',
|
|
14
|
+
description: 'Aria label for the Atlassian Intelligence dialog'
|
|
15
|
+
},
|
|
11
16
|
responseTooSimilarMessage: {
|
|
12
17
|
id: 'fabric.editor.ai.experience.responseTooSimilarMessage',
|
|
13
18
|
defaultMessage: 'Atlassian Intelligence has no suggestions at this time. Feel free to try a different prompt or content.',
|
|
@@ -145,5 +145,25 @@ var syncBlockMessages = exports.syncBlockMessages = (0, _reactIntlNext.defineMes
|
|
|
145
145
|
id: 'fabric.editor.error.description.failToCreateWhenOffline',
|
|
146
146
|
defaultMessage: 'You appear to be offline. Please connect to the internet to create synced content.',
|
|
147
147
|
description: 'Description in flag which appears when a sync block cannot be created in offline mode'
|
|
148
|
+
},
|
|
149
|
+
generalErrorDescription: {
|
|
150
|
+
id: 'fabric.editor.syncedBlockGeneralErrorDescription',
|
|
151
|
+
defaultMessage: 'Something went wrong while loading this synced block.',
|
|
152
|
+
description: 'Description for general error state of the synced block'
|
|
153
|
+
},
|
|
154
|
+
notFoundDescription: {
|
|
155
|
+
id: 'fabric.editor.syncedBlockNotFoundDescription',
|
|
156
|
+
defaultMessage: 'We’re unable to load this synced block.',
|
|
157
|
+
description: 'Description for error state where the synced block cannot be found or no longer exists'
|
|
158
|
+
},
|
|
159
|
+
notFoundAltText: {
|
|
160
|
+
id: 'fabric.editor.syncedBlockNotFoundIconAltText',
|
|
161
|
+
defaultMessage: 'Synced block not found.',
|
|
162
|
+
description: 'Alt text for icon on error state where the synced block cannot be found or no longer exists'
|
|
163
|
+
},
|
|
164
|
+
retryButton: {
|
|
165
|
+
id: 'fabric.editor.retrySyncedBlock',
|
|
166
|
+
defaultMessage: 'Retry',
|
|
167
|
+
description: 'Label for button which retries loading the synced block'
|
|
148
168
|
}
|
|
149
169
|
});
|
|
@@ -153,16 +153,16 @@ Object.defineProperty(exports, "transformSliceToRemoveOpenNestedExpand", {
|
|
|
153
153
|
return _expand.transformSliceToRemoveOpenNestedExpand;
|
|
154
154
|
}
|
|
155
155
|
});
|
|
156
|
-
Object.defineProperty(exports, "
|
|
156
|
+
Object.defineProperty(exports, "transformSyncBlock", {
|
|
157
157
|
enumerable: true,
|
|
158
158
|
get: function get() {
|
|
159
|
-
return
|
|
159
|
+
return _syncBlock.transformSyncBlock;
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
|
-
Object.defineProperty(exports, "
|
|
162
|
+
Object.defineProperty(exports, "transformTaskListToBlockNodes", {
|
|
163
163
|
enumerable: true,
|
|
164
164
|
get: function get() {
|
|
165
|
-
return
|
|
165
|
+
return _listTransforms.transformTaskListToBlockNodes;
|
|
166
166
|
}
|
|
167
167
|
});
|
|
168
168
|
Object.defineProperty(exports, "transformToTaskList", {
|
|
@@ -4,34 +4,56 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.transformSyncBlock = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
11
11
|
var _slice = require("../utils/slice");
|
|
12
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
13
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
-
var
|
|
14
|
+
var transformSyncBlockNode = function transformSyncBlockNode(node, schema, isFromEditor) {
|
|
15
|
+
// if copying from renderer, flatten out the content and remove the sync block
|
|
16
|
+
if (!isFromEditor) {
|
|
17
|
+
return node.content;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// sync blocks need a unique localId to function correctly
|
|
21
|
+
var newAttrs = _objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
22
|
+
localId: _adfSchema.uuid.generate()
|
|
23
|
+
});
|
|
24
|
+
return schema.nodes.syncBlock.create(newAttrs, null, (0, _toConsumableArray2.default)(node.marks));
|
|
25
|
+
};
|
|
26
|
+
var transformBodiedSyncBlockNode = function transformBodiedSyncBlockNode(node, schema, isFromEditor) {
|
|
27
|
+
// if copying from renderer, flatten out the content and remove the bodied sync block
|
|
28
|
+
if (!isFromEditor) {
|
|
29
|
+
return node.content;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// bodied sync blocks need a unique localId and convert to a reference sync block
|
|
33
|
+
// when converting we want to be specific about attributes and marks we carry over
|
|
34
|
+
var newAttrs = {
|
|
35
|
+
resourceId: node.attrs.resourceId,
|
|
36
|
+
localId: _adfSchema.uuid.generate()
|
|
37
|
+
};
|
|
38
|
+
var newMarks = schema.nodes.syncBlock.markSet ? node.marks.filter(function (mark) {
|
|
39
|
+
var _schema$nodes$syncBlo;
|
|
40
|
+
return (_schema$nodes$syncBlo = schema.nodes.syncBlock.markSet) === null || _schema$nodes$syncBlo === void 0 ? void 0 : _schema$nodes$syncBlo.includes(mark.type);
|
|
41
|
+
}) : node.marks; // schema.nodes.syncBlock.markSet is null meaning all marks are allowed
|
|
42
|
+
|
|
43
|
+
return schema.nodes.syncBlock.create(newAttrs, null, newMarks);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* If we are copying from editor, transform the copied source or reference sync block to a new reference sync block
|
|
48
|
+
* Otherwise, (e.g. if copying from renderer), flatten out the content and remove the sync block
|
|
49
|
+
*/
|
|
50
|
+
var transformSyncBlock = exports.transformSyncBlock = function transformSyncBlock(slice, schema, pasteSource) {
|
|
51
|
+
var isFromEditor = pasteSource === 'fabric-editor';
|
|
15
52
|
slice = (0, _slice.mapSlice)(slice, function (node) {
|
|
16
|
-
// sync blocks need a unique localId to function correctly
|
|
17
53
|
if (node.type === schema.nodes.syncBlock) {
|
|
18
|
-
|
|
19
|
-
localId: _adfSchema.uuid.generate()
|
|
20
|
-
});
|
|
21
|
-
return schema.nodes.syncBlock.create(newAttrs, null, (0, _toConsumableArray2.default)(node.marks));
|
|
54
|
+
return transformSyncBlockNode(node, schema, isFromEditor);
|
|
22
55
|
} else if (node.type === schema.nodes.bodiedSyncBlock) {
|
|
23
|
-
|
|
24
|
-
// when converting we want to be specific about attributes and marks we carry over
|
|
25
|
-
var _newAttrs = {
|
|
26
|
-
resourceId: node.attrs.resourceId,
|
|
27
|
-
localId: _adfSchema.uuid.generate()
|
|
28
|
-
};
|
|
29
|
-
var newMarks = schema.nodes.syncBlock.markSet ? node.marks.filter(function (mark) {
|
|
30
|
-
var _schema$nodes$syncBlo;
|
|
31
|
-
return (_schema$nodes$syncBlo = schema.nodes.syncBlock.markSet) === null || _schema$nodes$syncBlo === void 0 ? void 0 : _schema$nodes$syncBlo.includes(mark.type);
|
|
32
|
-
}) : node.marks; // schema.nodes.syncBlock.markSet is null meaning all marks are allowed
|
|
33
|
-
|
|
34
|
-
return schema.nodes.syncBlock.create(_newAttrs, null, newMarks);
|
|
56
|
+
return transformBodiedSyncBlockNode(node, schema, isFromEditor);
|
|
35
57
|
}
|
|
36
58
|
return node;
|
|
37
59
|
});
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
// eslint-disable-next-line no-restricted-imports
|
|
2
2
|
import { defineMessages } from 'react-intl-next';
|
|
3
3
|
export const aiExperienceApplicationMessages = defineMessages({
|
|
4
|
+
dialogAriaLabel: {
|
|
5
|
+
id: 'fabric.editor.ai.experience.dialogAriaLabel',
|
|
6
|
+
defaultMessage: 'Atlassian Intelligence Dialog',
|
|
7
|
+
description: 'Aria label for the Atlassian Intelligence dialog'
|
|
8
|
+
},
|
|
4
9
|
responseTooSimilarMessage: {
|
|
5
10
|
id: 'fabric.editor.ai.experience.responseTooSimilarMessage',
|
|
6
11
|
defaultMessage: 'Atlassian Intelligence has no suggestions at this time. Feel free to try a different prompt or content.',
|
|
@@ -139,5 +139,25 @@ export const syncBlockMessages = defineMessages({
|
|
|
139
139
|
id: 'fabric.editor.error.description.failToCreateWhenOffline',
|
|
140
140
|
defaultMessage: 'You appear to be offline. Please connect to the internet to create synced content.',
|
|
141
141
|
description: 'Description in flag which appears when a sync block cannot be created in offline mode'
|
|
142
|
+
},
|
|
143
|
+
generalErrorDescription: {
|
|
144
|
+
id: 'fabric.editor.syncedBlockGeneralErrorDescription',
|
|
145
|
+
defaultMessage: 'Something went wrong while loading this synced block.',
|
|
146
|
+
description: 'Description for general error state of the synced block'
|
|
147
|
+
},
|
|
148
|
+
notFoundDescription: {
|
|
149
|
+
id: 'fabric.editor.syncedBlockNotFoundDescription',
|
|
150
|
+
defaultMessage: 'We’re unable to load this synced block.',
|
|
151
|
+
description: 'Description for error state where the synced block cannot be found or no longer exists'
|
|
152
|
+
},
|
|
153
|
+
notFoundAltText: {
|
|
154
|
+
id: 'fabric.editor.syncedBlockNotFoundIconAltText',
|
|
155
|
+
defaultMessage: 'Synced block not found.',
|
|
156
|
+
description: 'Alt text for icon on error state where the synced block cannot be found or no longer exists'
|
|
157
|
+
},
|
|
158
|
+
retryButton: {
|
|
159
|
+
id: 'fabric.editor.retrySyncedBlock',
|
|
160
|
+
defaultMessage: 'Retry',
|
|
161
|
+
description: 'Label for button which retries loading the synced block'
|
|
142
162
|
}
|
|
143
163
|
});
|
|
@@ -8,4 +8,4 @@ export { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToC
|
|
|
8
8
|
export { transformSliceToDecisionList } from './decision-list';
|
|
9
9
|
export { transformListStructure, transformBetweenListTypes, transformListRecursively, transformToTaskList, transformTaskListToBlockNodes, getFormattedNode } from './list-transforms';
|
|
10
10
|
export { isBulletOrOrderedList, isTaskList, getSupportedListTypesSet, convertBlockToInlineContent } from './list-utils';
|
|
11
|
-
export {
|
|
11
|
+
export { transformSyncBlock } from './sync-block';
|
|
@@ -1,27 +1,49 @@
|
|
|
1
1
|
import { uuid } from '@atlaskit/adf-schema';
|
|
2
2
|
import { mapSlice } from '../utils/slice';
|
|
3
|
-
|
|
3
|
+
const transformSyncBlockNode = (node, schema, isFromEditor) => {
|
|
4
|
+
// if copying from renderer, flatten out the content and remove the sync block
|
|
5
|
+
if (!isFromEditor) {
|
|
6
|
+
return node.content;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// sync blocks need a unique localId to function correctly
|
|
10
|
+
const newAttrs = {
|
|
11
|
+
...node.attrs,
|
|
12
|
+
localId: uuid.generate()
|
|
13
|
+
};
|
|
14
|
+
return schema.nodes.syncBlock.create(newAttrs, null, [...node.marks]);
|
|
15
|
+
};
|
|
16
|
+
const transformBodiedSyncBlockNode = (node, schema, isFromEditor) => {
|
|
17
|
+
// if copying from renderer, flatten out the content and remove the bodied sync block
|
|
18
|
+
if (!isFromEditor) {
|
|
19
|
+
return node.content;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// bodied sync blocks need a unique localId and convert to a reference sync block
|
|
23
|
+
// when converting we want to be specific about attributes and marks we carry over
|
|
24
|
+
const newAttrs = {
|
|
25
|
+
resourceId: node.attrs.resourceId,
|
|
26
|
+
localId: uuid.generate()
|
|
27
|
+
};
|
|
28
|
+
const newMarks = schema.nodes.syncBlock.markSet ? node.marks.filter(mark => {
|
|
29
|
+
var _schema$nodes$syncBlo;
|
|
30
|
+
return (_schema$nodes$syncBlo = schema.nodes.syncBlock.markSet) === null || _schema$nodes$syncBlo === void 0 ? void 0 : _schema$nodes$syncBlo.includes(mark.type);
|
|
31
|
+
}) : node.marks; // schema.nodes.syncBlock.markSet is null meaning all marks are allowed
|
|
32
|
+
|
|
33
|
+
return schema.nodes.syncBlock.create(newAttrs, null, newMarks);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* If we are copying from editor, transform the copied source or reference sync block to a new reference sync block
|
|
38
|
+
* Otherwise, (e.g. if copying from renderer), flatten out the content and remove the sync block
|
|
39
|
+
*/
|
|
40
|
+
export const transformSyncBlock = (slice, schema, pasteSource) => {
|
|
41
|
+
const isFromEditor = pasteSource === 'fabric-editor';
|
|
4
42
|
slice = mapSlice(slice, node => {
|
|
5
|
-
// sync blocks need a unique localId to function correctly
|
|
6
43
|
if (node.type === schema.nodes.syncBlock) {
|
|
7
|
-
|
|
8
|
-
...node.attrs,
|
|
9
|
-
localId: uuid.generate()
|
|
10
|
-
};
|
|
11
|
-
return schema.nodes.syncBlock.create(newAttrs, null, [...node.marks]);
|
|
44
|
+
return transformSyncBlockNode(node, schema, isFromEditor);
|
|
12
45
|
} else if (node.type === schema.nodes.bodiedSyncBlock) {
|
|
13
|
-
|
|
14
|
-
// when converting we want to be specific about attributes and marks we carry over
|
|
15
|
-
const newAttrs = {
|
|
16
|
-
resourceId: node.attrs.resourceId,
|
|
17
|
-
localId: uuid.generate()
|
|
18
|
-
};
|
|
19
|
-
const newMarks = schema.nodes.syncBlock.markSet ? node.marks.filter(mark => {
|
|
20
|
-
var _schema$nodes$syncBlo;
|
|
21
|
-
return (_schema$nodes$syncBlo = schema.nodes.syncBlock.markSet) === null || _schema$nodes$syncBlo === void 0 ? void 0 : _schema$nodes$syncBlo.includes(mark.type);
|
|
22
|
-
}) : node.marks; // schema.nodes.syncBlock.markSet is null meaning all marks are allowed
|
|
23
|
-
|
|
24
|
-
return schema.nodes.syncBlock.create(newAttrs, null, newMarks);
|
|
46
|
+
return transformBodiedSyncBlockNode(node, schema, isFromEditor);
|
|
25
47
|
}
|
|
26
48
|
return node;
|
|
27
49
|
});
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
// eslint-disable-next-line no-restricted-imports
|
|
2
2
|
import { defineMessages } from 'react-intl-next';
|
|
3
3
|
export var aiExperienceApplicationMessages = defineMessages({
|
|
4
|
+
dialogAriaLabel: {
|
|
5
|
+
id: 'fabric.editor.ai.experience.dialogAriaLabel',
|
|
6
|
+
defaultMessage: 'Atlassian Intelligence Dialog',
|
|
7
|
+
description: 'Aria label for the Atlassian Intelligence dialog'
|
|
8
|
+
},
|
|
4
9
|
responseTooSimilarMessage: {
|
|
5
10
|
id: 'fabric.editor.ai.experience.responseTooSimilarMessage',
|
|
6
11
|
defaultMessage: 'Atlassian Intelligence has no suggestions at this time. Feel free to try a different prompt or content.',
|
|
@@ -139,5 +139,25 @@ export var syncBlockMessages = defineMessages({
|
|
|
139
139
|
id: 'fabric.editor.error.description.failToCreateWhenOffline',
|
|
140
140
|
defaultMessage: 'You appear to be offline. Please connect to the internet to create synced content.',
|
|
141
141
|
description: 'Description in flag which appears when a sync block cannot be created in offline mode'
|
|
142
|
+
},
|
|
143
|
+
generalErrorDescription: {
|
|
144
|
+
id: 'fabric.editor.syncedBlockGeneralErrorDescription',
|
|
145
|
+
defaultMessage: 'Something went wrong while loading this synced block.',
|
|
146
|
+
description: 'Description for general error state of the synced block'
|
|
147
|
+
},
|
|
148
|
+
notFoundDescription: {
|
|
149
|
+
id: 'fabric.editor.syncedBlockNotFoundDescription',
|
|
150
|
+
defaultMessage: 'We’re unable to load this synced block.',
|
|
151
|
+
description: 'Description for error state where the synced block cannot be found or no longer exists'
|
|
152
|
+
},
|
|
153
|
+
notFoundAltText: {
|
|
154
|
+
id: 'fabric.editor.syncedBlockNotFoundIconAltText',
|
|
155
|
+
defaultMessage: 'Synced block not found.',
|
|
156
|
+
description: 'Alt text for icon on error state where the synced block cannot be found or no longer exists'
|
|
157
|
+
},
|
|
158
|
+
retryButton: {
|
|
159
|
+
id: 'fabric.editor.retrySyncedBlock',
|
|
160
|
+
defaultMessage: 'Retry',
|
|
161
|
+
description: 'Label for button which retries loading the synced block'
|
|
142
162
|
}
|
|
143
163
|
});
|
|
@@ -8,4 +8,4 @@ export { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToC
|
|
|
8
8
|
export { transformSliceToDecisionList } from './decision-list';
|
|
9
9
|
export { transformListStructure, transformBetweenListTypes, transformListRecursively, transformToTaskList, transformTaskListToBlockNodes, getFormattedNode } from './list-transforms';
|
|
10
10
|
export { isBulletOrOrderedList, isTaskList, getSupportedListTypesSet, convertBlockToInlineContent } from './list-utils';
|
|
11
|
-
export {
|
|
11
|
+
export { transformSyncBlock } from './sync-block';
|
|
@@ -4,27 +4,49 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
import { uuid } from '@atlaskit/adf-schema';
|
|
6
6
|
import { mapSlice } from '../utils/slice';
|
|
7
|
-
|
|
7
|
+
var transformSyncBlockNode = function transformSyncBlockNode(node, schema, isFromEditor) {
|
|
8
|
+
// if copying from renderer, flatten out the content and remove the sync block
|
|
9
|
+
if (!isFromEditor) {
|
|
10
|
+
return node.content;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// sync blocks need a unique localId to function correctly
|
|
14
|
+
var newAttrs = _objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
15
|
+
localId: uuid.generate()
|
|
16
|
+
});
|
|
17
|
+
return schema.nodes.syncBlock.create(newAttrs, null, _toConsumableArray(node.marks));
|
|
18
|
+
};
|
|
19
|
+
var transformBodiedSyncBlockNode = function transformBodiedSyncBlockNode(node, schema, isFromEditor) {
|
|
20
|
+
// if copying from renderer, flatten out the content and remove the bodied sync block
|
|
21
|
+
if (!isFromEditor) {
|
|
22
|
+
return node.content;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// bodied sync blocks need a unique localId and convert to a reference sync block
|
|
26
|
+
// when converting we want to be specific about attributes and marks we carry over
|
|
27
|
+
var newAttrs = {
|
|
28
|
+
resourceId: node.attrs.resourceId,
|
|
29
|
+
localId: uuid.generate()
|
|
30
|
+
};
|
|
31
|
+
var newMarks = schema.nodes.syncBlock.markSet ? node.marks.filter(function (mark) {
|
|
32
|
+
var _schema$nodes$syncBlo;
|
|
33
|
+
return (_schema$nodes$syncBlo = schema.nodes.syncBlock.markSet) === null || _schema$nodes$syncBlo === void 0 ? void 0 : _schema$nodes$syncBlo.includes(mark.type);
|
|
34
|
+
}) : node.marks; // schema.nodes.syncBlock.markSet is null meaning all marks are allowed
|
|
35
|
+
|
|
36
|
+
return schema.nodes.syncBlock.create(newAttrs, null, newMarks);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* If we are copying from editor, transform the copied source or reference sync block to a new reference sync block
|
|
41
|
+
* Otherwise, (e.g. if copying from renderer), flatten out the content and remove the sync block
|
|
42
|
+
*/
|
|
43
|
+
export var transformSyncBlock = function transformSyncBlock(slice, schema, pasteSource) {
|
|
44
|
+
var isFromEditor = pasteSource === 'fabric-editor';
|
|
8
45
|
slice = mapSlice(slice, function (node) {
|
|
9
|
-
// sync blocks need a unique localId to function correctly
|
|
10
46
|
if (node.type === schema.nodes.syncBlock) {
|
|
11
|
-
|
|
12
|
-
localId: uuid.generate()
|
|
13
|
-
});
|
|
14
|
-
return schema.nodes.syncBlock.create(newAttrs, null, _toConsumableArray(node.marks));
|
|
47
|
+
return transformSyncBlockNode(node, schema, isFromEditor);
|
|
15
48
|
} else if (node.type === schema.nodes.bodiedSyncBlock) {
|
|
16
|
-
|
|
17
|
-
// when converting we want to be specific about attributes and marks we carry over
|
|
18
|
-
var _newAttrs = {
|
|
19
|
-
resourceId: node.attrs.resourceId,
|
|
20
|
-
localId: uuid.generate()
|
|
21
|
-
};
|
|
22
|
-
var newMarks = schema.nodes.syncBlock.markSet ? node.marks.filter(function (mark) {
|
|
23
|
-
var _schema$nodes$syncBlo;
|
|
24
|
-
return (_schema$nodes$syncBlo = schema.nodes.syncBlock.markSet) === null || _schema$nodes$syncBlo === void 0 ? void 0 : _schema$nodes$syncBlo.includes(mark.type);
|
|
25
|
-
}) : node.marks; // schema.nodes.syncBlock.markSet is null meaning all marks are allowed
|
|
26
|
-
|
|
27
|
-
return schema.nodes.syncBlock.create(_newAttrs, null, newMarks);
|
|
49
|
+
return transformBodiedSyncBlockNode(node, schema, isFromEditor);
|
|
28
50
|
}
|
|
29
51
|
return node;
|
|
30
52
|
});
|
|
@@ -139,4 +139,24 @@ export declare const syncBlockMessages: {
|
|
|
139
139
|
defaultMessage: string;
|
|
140
140
|
description: string;
|
|
141
141
|
};
|
|
142
|
+
generalErrorDescription: {
|
|
143
|
+
id: string;
|
|
144
|
+
defaultMessage: string;
|
|
145
|
+
description: string;
|
|
146
|
+
};
|
|
147
|
+
notFoundDescription: {
|
|
148
|
+
id: string;
|
|
149
|
+
defaultMessage: string;
|
|
150
|
+
description: string;
|
|
151
|
+
};
|
|
152
|
+
notFoundAltText: {
|
|
153
|
+
id: string;
|
|
154
|
+
defaultMessage: string;
|
|
155
|
+
description: string;
|
|
156
|
+
};
|
|
157
|
+
retryButton: {
|
|
158
|
+
id: string;
|
|
159
|
+
defaultMessage: string;
|
|
160
|
+
description: string;
|
|
161
|
+
};
|
|
142
162
|
};
|
|
@@ -5,5 +5,5 @@ export { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToC
|
|
|
5
5
|
export { transformSliceToDecisionList } from './decision-list';
|
|
6
6
|
export { transformListStructure, transformBetweenListTypes, transformListRecursively, transformToTaskList, transformTaskListToBlockNodes, getFormattedNode, } from './list-transforms';
|
|
7
7
|
export { isBulletOrOrderedList, isTaskList, getSupportedListTypesSet, convertBlockToInlineContent, } from './list-utils';
|
|
8
|
-
export {
|
|
8
|
+
export { transformSyncBlock } from './sync-block';
|
|
9
9
|
export type { TransformContext, TransformFunction } from './list-types';
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import type { Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
|
|
2
|
+
import type { PasteSource } from '../analytics';
|
|
3
|
+
/**
|
|
4
|
+
* If we are copying from editor, transform the copied source or reference sync block to a new reference sync block
|
|
5
|
+
* Otherwise, (e.g. if copying from renderer), flatten out the content and remove the sync block
|
|
6
|
+
*/
|
|
7
|
+
export declare const transformSyncBlock: (slice: Slice, schema: Schema, pasteSource: PasteSource) => Slice;
|
|
@@ -139,4 +139,24 @@ export declare const syncBlockMessages: {
|
|
|
139
139
|
defaultMessage: string;
|
|
140
140
|
description: string;
|
|
141
141
|
};
|
|
142
|
+
generalErrorDescription: {
|
|
143
|
+
id: string;
|
|
144
|
+
defaultMessage: string;
|
|
145
|
+
description: string;
|
|
146
|
+
};
|
|
147
|
+
notFoundDescription: {
|
|
148
|
+
id: string;
|
|
149
|
+
defaultMessage: string;
|
|
150
|
+
description: string;
|
|
151
|
+
};
|
|
152
|
+
notFoundAltText: {
|
|
153
|
+
id: string;
|
|
154
|
+
defaultMessage: string;
|
|
155
|
+
description: string;
|
|
156
|
+
};
|
|
157
|
+
retryButton: {
|
|
158
|
+
id: string;
|
|
159
|
+
defaultMessage: string;
|
|
160
|
+
description: string;
|
|
161
|
+
};
|
|
142
162
|
};
|
|
@@ -5,5 +5,5 @@ export { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToC
|
|
|
5
5
|
export { transformSliceToDecisionList } from './decision-list';
|
|
6
6
|
export { transformListStructure, transformBetweenListTypes, transformListRecursively, transformToTaskList, transformTaskListToBlockNodes, getFormattedNode, } from './list-transforms';
|
|
7
7
|
export { isBulletOrOrderedList, isTaskList, getSupportedListTypesSet, convertBlockToInlineContent, } from './list-utils';
|
|
8
|
-
export {
|
|
8
|
+
export { transformSyncBlock } from './sync-block';
|
|
9
9
|
export type { TransformContext, TransformFunction } from './list-types';
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import type { Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
|
|
2
|
+
import type { PasteSource } from '../analytics';
|
|
3
|
+
/**
|
|
4
|
+
* If we are copying from editor, transform the copied source or reference sync block to a new reference sync block
|
|
5
|
+
* Otherwise, (e.g. if copying from renderer), flatten out the content and remove the sync block
|
|
6
|
+
*/
|
|
7
|
+
export declare const transformSyncBlock: (slice: Slice, schema: Schema, pasteSource: PasteSource) => Slice;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "110.
|
|
3
|
+
"version": "110.31.1",
|
|
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/"
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"@atlaskit/theme": "^21.0.0",
|
|
85
85
|
"@atlaskit/tmp-editor-statsig": "^13.38.0",
|
|
86
86
|
"@atlaskit/tokens": "^8.0.0",
|
|
87
|
-
"@atlaskit/tooltip": "^20.
|
|
87
|
+
"@atlaskit/tooltip": "^20.9.0",
|
|
88
88
|
"@atlaskit/ufo": "^0.4.0",
|
|
89
89
|
"@atlaskit/width-detector": "^5.0.0",
|
|
90
90
|
"@babel/runtime": "^7.0.0",
|