@atlaskit/editor-common 114.54.2 → 114.55.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 +11 -0
- package/dist/cjs/analytics/types/enums.js +1 -0
- package/dist/cjs/code-block/index.js +76 -8
- package/dist/cjs/messages/codeBlockButton.js +10 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/analytics/types/enums.js +1 -0
- package/dist/es2019/code-block/index.js +69 -8
- package/dist/es2019/messages/codeBlockButton.js +10 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/analytics/types/enums.js +1 -0
- package/dist/esm/code-block/index.js +75 -7
- package/dist/esm/messages/codeBlockButton.js +10 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/analytics/types/enums.d.ts +1 -0
- package/dist/types/analytics/types/general-events.d.ts +7 -1
- package/dist/types/code-block/index.d.ts +13 -4
- package/dist/types/messages/codeBlockButton.d.ts +10 -0
- package/dist/types-ts4.5/analytics/types/enums.d.ts +1 -0
- package/dist/types-ts4.5/analytics/types/general-events.d.ts +7 -1
- package/dist/types-ts4.5/code-block/index.d.ts +13 -4
- package/dist/types-ts4.5/messages/codeBlockButton.d.ts +10 -0
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 114.55.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`52a08b0d14e39`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/52a08b0d14e39) -
|
|
8
|
+
Add code block language auto-detection experiment
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 114.54.2
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -93,6 +93,7 @@ var ACTION = exports.ACTION = /*#__PURE__*/function (ACTION) {
|
|
|
93
93
|
/** used in @atlassian/editor-referentiality */
|
|
94
94
|
ACTION["GOT_CONNECTIONS"] = "gotConnections";
|
|
95
95
|
ACTION["LANGUAGE_SELECTED"] = "languageSelected";
|
|
96
|
+
ACTION["LANGUAGE_AUTO_DETECTED"] = "languageAutoDetected";
|
|
96
97
|
ACTION["LIST_ITEM_JOINED"] = "listItemJoined";
|
|
97
98
|
ACTION["MATCHED"] = "matched";
|
|
98
99
|
ACTION["MEDIA_LINK_TRANSFORMED"] = "mediaLinkTransformed";
|
|
@@ -4,8 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.updateCodeBlockWrappedStateNodeKeys = exports.transferCodeBlockWrappedValue = exports.setCodeBlockFoldState = exports.isCodeBlockWordWrapEnabled = exports.
|
|
7
|
+
exports.updateCodeBlockWrappedStateNodeKeys = exports.transferCodeBlockWrappedValue = exports.setCodeBlockFoldState = exports.normalizeMarkdownCodeBlockAttrsInSlice = exports.isCodeBlockWordWrapEnabled = exports.getInsertedCodeBlocksInTransaction = exports.getDefaultCodeBlockAttrs = exports.getCodeBlockFoldState = exports.defaultWordWrapState = exports.codeBlockWrappedStates = exports.areCodeBlockLineNumbersVisible = exports.areCodeBlockLineNumbersHidden = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
8
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _adfSchema = require("@atlaskit/adf-schema");
|
|
11
|
+
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
12
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
13
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
10
14
|
var _slice = require("../utils/slice");
|
|
11
15
|
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; }
|
|
@@ -15,19 +19,24 @@ var defaultWordWrapState = exports.defaultWordWrapState = false;
|
|
|
15
19
|
// Remove the wrap WeakMap fallback when cleaning up platform_editor_code_block_q4_lovability
|
|
16
20
|
var codeBlockWrappedStates = exports.codeBlockWrappedStates = new WeakMap();
|
|
17
21
|
var getDefaultCodeBlockAttrs = exports.getDefaultCodeBlockAttrs = function getDefaultCodeBlockAttrs(attrs) {
|
|
22
|
+
var _attrs$localId;
|
|
23
|
+
var localId = (_attrs$localId = attrs === null || attrs === void 0 ? void 0 : attrs.localId) !== null && _attrs$localId !== void 0 ? _attrs$localId : (0, _expValEquals.expValEquals)('platform_editor_code_block_auto_detection', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_add_code_block_localid') ? _adfSchema.uuid.generate() : undefined;
|
|
24
|
+
var attrsWithLocalId = localId ? _objectSpread(_objectSpread({}, attrs), {}, {
|
|
25
|
+
localId: localId
|
|
26
|
+
}) : attrs;
|
|
18
27
|
if (!(0, _expValEquals.expValEquals)('platform_editor_code_block_q4_lovability', 'isEnabled', true)) {
|
|
19
|
-
return
|
|
28
|
+
return attrsWithLocalId;
|
|
20
29
|
}
|
|
21
30
|
|
|
22
31
|
// Only boolean wrap values represent caller intent. null/undefined means unset.
|
|
23
32
|
if ((attrs === null || attrs === void 0 ? void 0 : attrs.wrap) === true || (attrs === null || attrs === void 0 ? void 0 : attrs.wrap) === false) {
|
|
24
|
-
return
|
|
33
|
+
return attrsWithLocalId;
|
|
25
34
|
}
|
|
26
|
-
return _objectSpread(_objectSpread({},
|
|
35
|
+
return _objectSpread(_objectSpread({}, attrsWithLocalId), {}, {
|
|
27
36
|
wrap: true
|
|
28
37
|
});
|
|
29
38
|
};
|
|
30
|
-
var
|
|
39
|
+
var normalizeMarkdownCodeBlockAttrsInSlice = exports.normalizeMarkdownCodeBlockAttrsInSlice = function normalizeMarkdownCodeBlockAttrsInSlice(slice, schema) {
|
|
31
40
|
if (!(0, _expValEquals.expValEquals)('platform_editor_code_block_q4_lovability', 'isEnabled', true)) {
|
|
32
41
|
return slice;
|
|
33
42
|
}
|
|
@@ -39,11 +48,70 @@ var defaultWrapForMarkdownCodeBlocksInSlice = exports.defaultWrapForMarkdownCode
|
|
|
39
48
|
// Markdown conversion uses MarkdownParser token mappings and creates code block nodes
|
|
40
49
|
// with the schema-default wrap:false. Since Markdown has no wrap syntax, treat that
|
|
41
50
|
// default as missing user intent and change it to wrap:true.
|
|
42
|
-
return node.type.create(
|
|
43
|
-
wrap: true
|
|
44
|
-
}), node.content, node.marks);
|
|
51
|
+
return node.type.create(getDefaultCodeBlockAttrs(node.attrs), node.content, node.marks);
|
|
45
52
|
});
|
|
46
53
|
};
|
|
54
|
+
var isReplaceStep = function isReplaceStep(step) {
|
|
55
|
+
return step instanceof _transform.ReplaceStep || step instanceof _transform.ReplaceAroundStep;
|
|
56
|
+
};
|
|
57
|
+
var hasInsertedCodeBlockInStep = function hasInsertedCodeBlockInStep(step, codeBlockType, filter) {
|
|
58
|
+
var hasInsertedCodeBlock = false;
|
|
59
|
+
step.slice.content.descendants(function (node) {
|
|
60
|
+
if (node.type === codeBlockType && (!filter || filter(node))) {
|
|
61
|
+
hasInsertedCodeBlock = true;
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
return !hasInsertedCodeBlock;
|
|
65
|
+
});
|
|
66
|
+
return hasInsertedCodeBlock;
|
|
67
|
+
};
|
|
68
|
+
var collectMappedInsertedRanges = function collectMappedInsertedRanges(tr, stepIndex) {
|
|
69
|
+
var ranges = [];
|
|
70
|
+
var stepMap = tr.mapping.maps[stepIndex];
|
|
71
|
+
var remainingMaps = tr.mapping.slice(stepIndex + 1);
|
|
72
|
+
stepMap.forEach(function (_oldStart, _oldEnd, newStart, newEnd) {
|
|
73
|
+
if (newStart === newEnd) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
var finalFrom = remainingMaps.map(newStart, 1);
|
|
77
|
+
var finalTo = remainingMaps.map(newEnd, -1);
|
|
78
|
+
if (finalFrom < finalTo) {
|
|
79
|
+
ranges.push([finalFrom, finalTo]);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
return ranges;
|
|
83
|
+
};
|
|
84
|
+
var getInsertedCodeBlocksInTransaction = exports.getInsertedCodeBlocksInTransaction = function getInsertedCodeBlocksInTransaction(tr, codeBlockType) {
|
|
85
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
86
|
+
var insertedCodeBlocks = [];
|
|
87
|
+
var seenPositions = new Set();
|
|
88
|
+
tr.steps.forEach(function (step, stepIndex) {
|
|
89
|
+
if (!isReplaceStep(step)) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
var insertedCodeBlockByStep = hasInsertedCodeBlockInStep(step, codeBlockType, options.filter);
|
|
93
|
+
if (!insertedCodeBlockByStep) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
collectMappedInsertedRanges(tr, stepIndex).forEach(function (_ref) {
|
|
97
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
98
|
+
from = _ref2[0],
|
|
99
|
+
to = _ref2[1];
|
|
100
|
+
tr.doc.nodesBetween(from, to, function (node, pos) {
|
|
101
|
+
if (pos >= from && node.type === codeBlockType && (!options.filter || options.filter(node)) && !seenPositions.has(pos)) {
|
|
102
|
+
seenPositions.add(pos);
|
|
103
|
+
insertedCodeBlocks.push({
|
|
104
|
+
node: node,
|
|
105
|
+
pos: pos
|
|
106
|
+
});
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
return true;
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
return insertedCodeBlocks;
|
|
114
|
+
};
|
|
47
115
|
|
|
48
116
|
// Code folding state management - similar to word wrapping
|
|
49
117
|
|
|
@@ -58,6 +58,16 @@ var codeBlockButtonMessages = exports.codeBlockButtonMessages = (0, _reactIntl.d
|
|
|
58
58
|
defaultMessage: 'Detect language',
|
|
59
59
|
description: 'Option in the code block language picker that clears the selected language so the editor can detect it automatically.'
|
|
60
60
|
},
|
|
61
|
+
detectedLanguage: {
|
|
62
|
+
id: 'fabric.editor.codeBlock.detectedLanguage',
|
|
63
|
+
defaultMessage: '{language} (detected)',
|
|
64
|
+
description: 'Label in the code block language picker trigger when the editor detected the code language. The language placeholder is the detected language name, such as JavaScript.'
|
|
65
|
+
},
|
|
66
|
+
noneDetected: {
|
|
67
|
+
id: 'fabric.editor.codeBlock.noneDetected',
|
|
68
|
+
defaultMessage: '(None detected)',
|
|
69
|
+
description: 'Label in the code block language picker trigger when the editor could not detect a code language.'
|
|
70
|
+
},
|
|
61
71
|
recentlyUsed: {
|
|
62
72
|
id: 'fabric.editor.codeBlock.recentlyUsed',
|
|
63
73
|
defaultMessage: 'Recently used',
|
|
@@ -19,7 +19,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
19
19
|
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 _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
20
20
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
21
21
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
22
|
-
var packageVersion = "114.54.
|
|
22
|
+
var packageVersion = "114.54.2";
|
|
23
23
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
24
24
|
// Remove URL as it has UGC
|
|
25
25
|
// Ignored via go/ees007
|
|
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
24
24
|
* @jsx jsx
|
|
25
25
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
26
26
|
var packageName = "@atlaskit/editor-common";
|
|
27
|
-
var packageVersion = "114.54.
|
|
27
|
+
var packageVersion = "114.54.2";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var fadeIn = (0, _react2.keyframes)({
|
|
@@ -87,6 +87,7 @@ export let ACTION = /*#__PURE__*/function (ACTION) {
|
|
|
87
87
|
/** used in @atlassian/editor-referentiality */
|
|
88
88
|
ACTION["GOT_CONNECTIONS"] = "gotConnections";
|
|
89
89
|
ACTION["LANGUAGE_SELECTED"] = "languageSelected";
|
|
90
|
+
ACTION["LANGUAGE_AUTO_DETECTED"] = "languageAutoDetected";
|
|
90
91
|
ACTION["LIST_ITEM_JOINED"] = "listItemJoined";
|
|
91
92
|
ACTION["MATCHED"] = "matched";
|
|
92
93
|
ACTION["MEDIA_LINK_TRANSFORMED"] = "mediaLinkTransformed";
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { uuid } from '@atlaskit/adf-schema';
|
|
2
|
+
import { ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
4
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
5
|
import { mapSlice } from '../utils/slice';
|
|
3
6
|
export const defaultWordWrapState = false;
|
|
@@ -5,20 +8,26 @@ export const defaultWordWrapState = false;
|
|
|
5
8
|
// Remove the wrap WeakMap fallback when cleaning up platform_editor_code_block_q4_lovability
|
|
6
9
|
export const codeBlockWrappedStates = new WeakMap();
|
|
7
10
|
export const getDefaultCodeBlockAttrs = attrs => {
|
|
11
|
+
var _attrs$localId;
|
|
12
|
+
const localId = (_attrs$localId = attrs === null || attrs === void 0 ? void 0 : attrs.localId) !== null && _attrs$localId !== void 0 ? _attrs$localId : expValEquals('platform_editor_code_block_auto_detection', 'isEnabled', true) && fg('platform_editor_add_code_block_localid') ? uuid.generate() : undefined;
|
|
13
|
+
const attrsWithLocalId = localId ? {
|
|
14
|
+
...attrs,
|
|
15
|
+
localId
|
|
16
|
+
} : attrs;
|
|
8
17
|
if (!expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true)) {
|
|
9
|
-
return
|
|
18
|
+
return attrsWithLocalId;
|
|
10
19
|
}
|
|
11
20
|
|
|
12
21
|
// Only boolean wrap values represent caller intent. null/undefined means unset.
|
|
13
22
|
if ((attrs === null || attrs === void 0 ? void 0 : attrs.wrap) === true || (attrs === null || attrs === void 0 ? void 0 : attrs.wrap) === false) {
|
|
14
|
-
return
|
|
23
|
+
return attrsWithLocalId;
|
|
15
24
|
}
|
|
16
25
|
return {
|
|
17
|
-
...
|
|
26
|
+
...attrsWithLocalId,
|
|
18
27
|
wrap: true
|
|
19
28
|
};
|
|
20
29
|
};
|
|
21
|
-
export const
|
|
30
|
+
export const normalizeMarkdownCodeBlockAttrsInSlice = (slice, schema) => {
|
|
22
31
|
if (!expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true)) {
|
|
23
32
|
return slice;
|
|
24
33
|
}
|
|
@@ -30,11 +39,63 @@ export const defaultWrapForMarkdownCodeBlocksInSlice = (slice, schema) => {
|
|
|
30
39
|
// Markdown conversion uses MarkdownParser token mappings and creates code block nodes
|
|
31
40
|
// with the schema-default wrap:false. Since Markdown has no wrap syntax, treat that
|
|
32
41
|
// default as missing user intent and change it to wrap:true.
|
|
33
|
-
return node.type.create(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
return node.type.create(getDefaultCodeBlockAttrs(node.attrs), node.content, node.marks);
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
const isReplaceStep = step => step instanceof ReplaceStep || step instanceof ReplaceAroundStep;
|
|
46
|
+
const hasInsertedCodeBlockInStep = (step, codeBlockType, filter) => {
|
|
47
|
+
let hasInsertedCodeBlock = false;
|
|
48
|
+
step.slice.content.descendants(node => {
|
|
49
|
+
if (node.type === codeBlockType && (!filter || filter(node))) {
|
|
50
|
+
hasInsertedCodeBlock = true;
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
return !hasInsertedCodeBlock;
|
|
54
|
+
});
|
|
55
|
+
return hasInsertedCodeBlock;
|
|
56
|
+
};
|
|
57
|
+
const collectMappedInsertedRanges = (tr, stepIndex) => {
|
|
58
|
+
const ranges = [];
|
|
59
|
+
const stepMap = tr.mapping.maps[stepIndex];
|
|
60
|
+
const remainingMaps = tr.mapping.slice(stepIndex + 1);
|
|
61
|
+
stepMap.forEach((_oldStart, _oldEnd, newStart, newEnd) => {
|
|
62
|
+
if (newStart === newEnd) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const finalFrom = remainingMaps.map(newStart, 1);
|
|
66
|
+
const finalTo = remainingMaps.map(newEnd, -1);
|
|
67
|
+
if (finalFrom < finalTo) {
|
|
68
|
+
ranges.push([finalFrom, finalTo]);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return ranges;
|
|
72
|
+
};
|
|
73
|
+
export const getInsertedCodeBlocksInTransaction = (tr, codeBlockType, options = {}) => {
|
|
74
|
+
const insertedCodeBlocks = [];
|
|
75
|
+
const seenPositions = new Set();
|
|
76
|
+
tr.steps.forEach((step, stepIndex) => {
|
|
77
|
+
if (!isReplaceStep(step)) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const insertedCodeBlockByStep = hasInsertedCodeBlockInStep(step, codeBlockType, options.filter);
|
|
81
|
+
if (!insertedCodeBlockByStep) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
collectMappedInsertedRanges(tr, stepIndex).forEach(([from, to]) => {
|
|
85
|
+
tr.doc.nodesBetween(from, to, (node, pos) => {
|
|
86
|
+
if (pos >= from && node.type === codeBlockType && (!options.filter || options.filter(node)) && !seenPositions.has(pos)) {
|
|
87
|
+
seenPositions.add(pos);
|
|
88
|
+
insertedCodeBlocks.push({
|
|
89
|
+
node,
|
|
90
|
+
pos
|
|
91
|
+
});
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
return true;
|
|
95
|
+
});
|
|
96
|
+
});
|
|
37
97
|
});
|
|
98
|
+
return insertedCodeBlocks;
|
|
38
99
|
};
|
|
39
100
|
|
|
40
101
|
// Code folding state management - similar to word wrapping
|
|
@@ -52,6 +52,16 @@ export const codeBlockButtonMessages = defineMessages({
|
|
|
52
52
|
defaultMessage: 'Detect language',
|
|
53
53
|
description: 'Option in the code block language picker that clears the selected language so the editor can detect it automatically.'
|
|
54
54
|
},
|
|
55
|
+
detectedLanguage: {
|
|
56
|
+
id: 'fabric.editor.codeBlock.detectedLanguage',
|
|
57
|
+
defaultMessage: '{language} (detected)',
|
|
58
|
+
description: 'Label in the code block language picker trigger when the editor detected the code language. The language placeholder is the detected language name, such as JavaScript.'
|
|
59
|
+
},
|
|
60
|
+
noneDetected: {
|
|
61
|
+
id: 'fabric.editor.codeBlock.noneDetected',
|
|
62
|
+
defaultMessage: '(None detected)',
|
|
63
|
+
description: 'Label in the code block language picker trigger when the editor could not detect a code language.'
|
|
64
|
+
},
|
|
55
65
|
recentlyUsed: {
|
|
56
66
|
id: 'fabric.editor.codeBlock.recentlyUsed',
|
|
57
67
|
defaultMessage: 'Recently used',
|
|
@@ -4,7 +4,7 @@ import { isFedRamp } from './environment';
|
|
|
4
4
|
import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
|
|
5
5
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
6
6
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
7
|
-
const packageVersion = "114.54.
|
|
7
|
+
const packageVersion = "114.54.2";
|
|
8
8
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
9
9
|
// Remove URL as it has UGC
|
|
10
10
|
// Ignored via go/ees007
|
|
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import Layer from '../Layer';
|
|
16
16
|
const packageName = "@atlaskit/editor-common";
|
|
17
|
-
const packageVersion = "114.54.
|
|
17
|
+
const packageVersion = "114.54.2";
|
|
18
18
|
const halfFocusRing = 1;
|
|
19
19
|
const dropOffset = '0, 8';
|
|
20
20
|
const fadeIn = keyframes({
|
|
@@ -87,6 +87,7 @@ export var ACTION = /*#__PURE__*/function (ACTION) {
|
|
|
87
87
|
/** used in @atlassian/editor-referentiality */
|
|
88
88
|
ACTION["GOT_CONNECTIONS"] = "gotConnections";
|
|
89
89
|
ACTION["LANGUAGE_SELECTED"] = "languageSelected";
|
|
90
|
+
ACTION["LANGUAGE_AUTO_DETECTED"] = "languageAutoDetected";
|
|
90
91
|
ACTION["LIST_ITEM_JOINED"] = "listItemJoined";
|
|
91
92
|
ACTION["MATCHED"] = "matched";
|
|
92
93
|
ACTION["MEDIA_LINK_TRANSFORMED"] = "mediaLinkTransformed";
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
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; }
|
|
3
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
|
+
import { uuid } from '@atlaskit/adf-schema';
|
|
6
|
+
import { ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
8
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
9
|
import { mapSlice } from '../utils/slice';
|
|
6
10
|
export var defaultWordWrapState = false;
|
|
@@ -8,19 +12,24 @@ export var defaultWordWrapState = false;
|
|
|
8
12
|
// Remove the wrap WeakMap fallback when cleaning up platform_editor_code_block_q4_lovability
|
|
9
13
|
export var codeBlockWrappedStates = new WeakMap();
|
|
10
14
|
export var getDefaultCodeBlockAttrs = function getDefaultCodeBlockAttrs(attrs) {
|
|
15
|
+
var _attrs$localId;
|
|
16
|
+
var localId = (_attrs$localId = attrs === null || attrs === void 0 ? void 0 : attrs.localId) !== null && _attrs$localId !== void 0 ? _attrs$localId : expValEquals('platform_editor_code_block_auto_detection', 'isEnabled', true) && fg('platform_editor_add_code_block_localid') ? uuid.generate() : undefined;
|
|
17
|
+
var attrsWithLocalId = localId ? _objectSpread(_objectSpread({}, attrs), {}, {
|
|
18
|
+
localId: localId
|
|
19
|
+
}) : attrs;
|
|
11
20
|
if (!expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true)) {
|
|
12
|
-
return
|
|
21
|
+
return attrsWithLocalId;
|
|
13
22
|
}
|
|
14
23
|
|
|
15
24
|
// Only boolean wrap values represent caller intent. null/undefined means unset.
|
|
16
25
|
if ((attrs === null || attrs === void 0 ? void 0 : attrs.wrap) === true || (attrs === null || attrs === void 0 ? void 0 : attrs.wrap) === false) {
|
|
17
|
-
return
|
|
26
|
+
return attrsWithLocalId;
|
|
18
27
|
}
|
|
19
|
-
return _objectSpread(_objectSpread({},
|
|
28
|
+
return _objectSpread(_objectSpread({}, attrsWithLocalId), {}, {
|
|
20
29
|
wrap: true
|
|
21
30
|
});
|
|
22
31
|
};
|
|
23
|
-
export var
|
|
32
|
+
export var normalizeMarkdownCodeBlockAttrsInSlice = function normalizeMarkdownCodeBlockAttrsInSlice(slice, schema) {
|
|
24
33
|
if (!expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true)) {
|
|
25
34
|
return slice;
|
|
26
35
|
}
|
|
@@ -32,11 +41,70 @@ export var defaultWrapForMarkdownCodeBlocksInSlice = function defaultWrapForMark
|
|
|
32
41
|
// Markdown conversion uses MarkdownParser token mappings and creates code block nodes
|
|
33
42
|
// with the schema-default wrap:false. Since Markdown has no wrap syntax, treat that
|
|
34
43
|
// default as missing user intent and change it to wrap:true.
|
|
35
|
-
return node.type.create(
|
|
36
|
-
wrap: true
|
|
37
|
-
}), node.content, node.marks);
|
|
44
|
+
return node.type.create(getDefaultCodeBlockAttrs(node.attrs), node.content, node.marks);
|
|
38
45
|
});
|
|
39
46
|
};
|
|
47
|
+
var isReplaceStep = function isReplaceStep(step) {
|
|
48
|
+
return step instanceof ReplaceStep || step instanceof ReplaceAroundStep;
|
|
49
|
+
};
|
|
50
|
+
var hasInsertedCodeBlockInStep = function hasInsertedCodeBlockInStep(step, codeBlockType, filter) {
|
|
51
|
+
var hasInsertedCodeBlock = false;
|
|
52
|
+
step.slice.content.descendants(function (node) {
|
|
53
|
+
if (node.type === codeBlockType && (!filter || filter(node))) {
|
|
54
|
+
hasInsertedCodeBlock = true;
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
return !hasInsertedCodeBlock;
|
|
58
|
+
});
|
|
59
|
+
return hasInsertedCodeBlock;
|
|
60
|
+
};
|
|
61
|
+
var collectMappedInsertedRanges = function collectMappedInsertedRanges(tr, stepIndex) {
|
|
62
|
+
var ranges = [];
|
|
63
|
+
var stepMap = tr.mapping.maps[stepIndex];
|
|
64
|
+
var remainingMaps = tr.mapping.slice(stepIndex + 1);
|
|
65
|
+
stepMap.forEach(function (_oldStart, _oldEnd, newStart, newEnd) {
|
|
66
|
+
if (newStart === newEnd) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
var finalFrom = remainingMaps.map(newStart, 1);
|
|
70
|
+
var finalTo = remainingMaps.map(newEnd, -1);
|
|
71
|
+
if (finalFrom < finalTo) {
|
|
72
|
+
ranges.push([finalFrom, finalTo]);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
return ranges;
|
|
76
|
+
};
|
|
77
|
+
export var getInsertedCodeBlocksInTransaction = function getInsertedCodeBlocksInTransaction(tr, codeBlockType) {
|
|
78
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
79
|
+
var insertedCodeBlocks = [];
|
|
80
|
+
var seenPositions = new Set();
|
|
81
|
+
tr.steps.forEach(function (step, stepIndex) {
|
|
82
|
+
if (!isReplaceStep(step)) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
var insertedCodeBlockByStep = hasInsertedCodeBlockInStep(step, codeBlockType, options.filter);
|
|
86
|
+
if (!insertedCodeBlockByStep) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
collectMappedInsertedRanges(tr, stepIndex).forEach(function (_ref) {
|
|
90
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
91
|
+
from = _ref2[0],
|
|
92
|
+
to = _ref2[1];
|
|
93
|
+
tr.doc.nodesBetween(from, to, function (node, pos) {
|
|
94
|
+
if (pos >= from && node.type === codeBlockType && (!options.filter || options.filter(node)) && !seenPositions.has(pos)) {
|
|
95
|
+
seenPositions.add(pos);
|
|
96
|
+
insertedCodeBlocks.push({
|
|
97
|
+
node: node,
|
|
98
|
+
pos: pos
|
|
99
|
+
});
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
return true;
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
return insertedCodeBlocks;
|
|
107
|
+
};
|
|
40
108
|
|
|
41
109
|
// Code folding state management - similar to word wrapping
|
|
42
110
|
|
|
@@ -52,6 +52,16 @@ export var codeBlockButtonMessages = defineMessages({
|
|
|
52
52
|
defaultMessage: 'Detect language',
|
|
53
53
|
description: 'Option in the code block language picker that clears the selected language so the editor can detect it automatically.'
|
|
54
54
|
},
|
|
55
|
+
detectedLanguage: {
|
|
56
|
+
id: 'fabric.editor.codeBlock.detectedLanguage',
|
|
57
|
+
defaultMessage: '{language} (detected)',
|
|
58
|
+
description: 'Label in the code block language picker trigger when the editor detected the code language. The language placeholder is the detected language name, such as JavaScript.'
|
|
59
|
+
},
|
|
60
|
+
noneDetected: {
|
|
61
|
+
id: 'fabric.editor.codeBlock.noneDetected',
|
|
62
|
+
defaultMessage: '(None detected)',
|
|
63
|
+
description: 'Label in the code block language picker trigger when the editor could not detect a code language.'
|
|
64
|
+
},
|
|
55
65
|
recentlyUsed: {
|
|
56
66
|
id: 'fabric.editor.codeBlock.recentlyUsed',
|
|
57
67
|
defaultMessage: 'Recently used',
|
|
@@ -10,7 +10,7 @@ import { isFedRamp } from './environment';
|
|
|
10
10
|
import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
|
|
11
11
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
12
12
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
13
|
-
var packageVersion = "114.54.
|
|
13
|
+
var packageVersion = "114.54.2";
|
|
14
14
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
15
15
|
// Remove URL as it has UGC
|
|
16
16
|
// Ignored via go/ees007
|
|
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
22
|
import Layer from '../Layer';
|
|
23
23
|
var packageName = "@atlaskit/editor-common";
|
|
24
|
-
var packageVersion = "114.54.
|
|
24
|
+
var packageVersion = "114.54.2";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var fadeIn = keyframes({
|
|
@@ -86,6 +86,7 @@ export declare enum ACTION {
|
|
|
86
86
|
/** used in @atlassian/editor-referentiality */
|
|
87
87
|
GOT_CONNECTIONS = "gotConnections",
|
|
88
88
|
LANGUAGE_SELECTED = "languageSelected",
|
|
89
|
+
LANGUAGE_AUTO_DETECTED = "languageAutoDetected",
|
|
89
90
|
LIST_ITEM_JOINED = "listItemJoined",
|
|
90
91
|
MATCHED = "matched",
|
|
91
92
|
MEDIA_LINK_TRANSFORMED = "mediaLinkTransformed",
|
|
@@ -158,9 +158,15 @@ type RichMediaLayoutAEP = TrackAEP<ACTION.SELECTED, ACTION_SUBJECT.MEDIA_SINGLE
|
|
|
158
158
|
previousLayoutType: RichMediaLayout;
|
|
159
159
|
}, undefined>;
|
|
160
160
|
type CodeBlockLanguageSelectedAEP = TrackAEP<ACTION.LANGUAGE_SELECTED, ACTION_SUBJECT.CODE_BLOCK, undefined, {
|
|
161
|
+
autoDetectedLanguage?: string;
|
|
162
|
+
autoDetectionResult?: 'detected' | 'noneDetected';
|
|
161
163
|
language: string;
|
|
162
164
|
selectionSource?: 'all' | 'pinned' | 'recentlyUsed' | 'search';
|
|
163
165
|
}, undefined>;
|
|
166
|
+
type CodeBlockLanguageAutoDetectedAEP = TrackAEP<ACTION.LANGUAGE_AUTO_DETECTED, ACTION_SUBJECT.CODE_BLOCK, undefined, {
|
|
167
|
+
detectionResult: 'detected' | 'noneDetected';
|
|
168
|
+
language: string;
|
|
169
|
+
}, undefined>;
|
|
164
170
|
type MediaLinkTransformedAEP = OperationalAEP<ACTION.MEDIA_LINK_TRANSFORMED, ACTION_SUBJECT.EDITOR, undefined, undefined>;
|
|
165
171
|
type MediaSingleWidthTransformedAEP = OperationalAEP<ACTION.MEDIA_SINGLE_WIDTH_TRANSFORMED, ACTION_SUBJECT.EDITOR, undefined, undefined>;
|
|
166
172
|
type TextLinkCodeMarkTransformedAEP = OperationalAEP<ACTION.TEXT_LINK_MARK_TRANSFORMED, ACTION_SUBJECT.EDITOR, undefined, undefined>;
|
|
@@ -235,5 +241,5 @@ type ChangeToneMenuItemClickedAEP = UIAEP<ACTION.CLICKED, ACTION_SUBJECT.TOOLBAR
|
|
|
235
241
|
type TranslateMenuItemClickedAEP = UIAEP<ACTION.CLICKED, ACTION_SUBJECT.TOOLBAR_DROPDOWN_MENU_ITEM, ACTION_SUBJECT_ID.AI_TRANSLATE, {
|
|
236
242
|
inputMethod: INPUT_METHOD.TOOLBAR | INPUT_METHOD.FLOATING_TB;
|
|
237
243
|
}>;
|
|
238
|
-
export type GeneralEventPayload<T = void> = AnnotateButtonAEP | AnnotationAEP | AnnotationErrorAEP | BrowserFreezePayload | ButtonFeedbackAEP | ButtonHelpAEP | ButtonUploadMediaAEP | ColorPickerAEP | EditorPerfAEP | EditorRenderedAEP<T> | EditorStartAEP | EditorStopAEP | ExpandToggleAEP | FeedbackAEP | FullWidthModeAEP | HelpQuickInsertAEP | InputPerfSamplingAEP | InputPerfSamplingAvgAEP | PickerEmojiAEP | PickerImageAEP | PickerMediaInsertAEP | PickerMediaInsertClosedAEP | PickerMediaInsertCancelledAEP | ReactNodeViewRenderedAEP | RichMediaLayoutAEP | SelectionAEP | SlowInputAEP | TransactionMutatedAEP | UploadExternalFailedAEP | WithPluginStateCalledAEP | CodeBlockLanguageSelectedAEP | EditorContentRetrievalPerformedAEP | MediaLinkTransformedAEP | TextLinkCodeMarkTransformedAEP | DedupeMarksTransformedAEP | IndentationMarksTransformedAEP | NodesMissingContentTransformedAEP | InvalidProsemirrorDocumentErrorAEP | DocumentProcessingErrorAEP | InvalidMediaContentTransformedAEP | HeadingAnchorLinkButtonAEP | CollabStepsTrackerPayloadAEP | CollabOrganicChangesTrackerPayloadAEP | BlocksDragInitAEP | CodeBlockWordWrapToggleAEP | CodeBlockLineNumbersToggleAEP | RequestToEditAEP | SingleColumLayoutDetectedAEP | CopyLinkToAnchorButtonAEP | DockedPrimaryToolbarRenderedAEP | RovoMoreOptionsClickedAEP | AskRovoButtonClickedAEP | SmartLinkRovoButtonClickedAEP | SmartLinkSummarizeButtonClickedAEP | AIRemixButtonClickedAEP | ChangeToneMenuItemClickedAEP | TranslateMenuItemClickedAEP | MediaSingleWidthTransformedAEP;
|
|
244
|
+
export type GeneralEventPayload<T = void> = AnnotateButtonAEP | AnnotationAEP | AnnotationErrorAEP | BrowserFreezePayload | ButtonFeedbackAEP | ButtonHelpAEP | ButtonUploadMediaAEP | ColorPickerAEP | EditorPerfAEP | EditorRenderedAEP<T> | EditorStartAEP | EditorStopAEP | ExpandToggleAEP | FeedbackAEP | FullWidthModeAEP | HelpQuickInsertAEP | InputPerfSamplingAEP | InputPerfSamplingAvgAEP | PickerEmojiAEP | PickerImageAEP | PickerMediaInsertAEP | PickerMediaInsertClosedAEP | PickerMediaInsertCancelledAEP | ReactNodeViewRenderedAEP | RichMediaLayoutAEP | SelectionAEP | SlowInputAEP | TransactionMutatedAEP | UploadExternalFailedAEP | WithPluginStateCalledAEP | CodeBlockLanguageAutoDetectedAEP | CodeBlockLanguageSelectedAEP | EditorContentRetrievalPerformedAEP | MediaLinkTransformedAEP | TextLinkCodeMarkTransformedAEP | DedupeMarksTransformedAEP | IndentationMarksTransformedAEP | NodesMissingContentTransformedAEP | InvalidProsemirrorDocumentErrorAEP | DocumentProcessingErrorAEP | InvalidMediaContentTransformedAEP | HeadingAnchorLinkButtonAEP | CollabStepsTrackerPayloadAEP | CollabOrganicChangesTrackerPayloadAEP | BlocksDragInitAEP | CodeBlockWordWrapToggleAEP | CodeBlockLineNumbersToggleAEP | RequestToEditAEP | SingleColumLayoutDetectedAEP | CopyLinkToAnchorButtonAEP | DockedPrimaryToolbarRenderedAEP | RovoMoreOptionsClickedAEP | AskRovoButtonClickedAEP | SmartLinkRovoButtonClickedAEP | SmartLinkSummarizeButtonClickedAEP | AIRemixButtonClickedAEP | ChangeToneMenuItemClickedAEP | TranslateMenuItemClickedAEP | MediaSingleWidthTransformedAEP;
|
|
239
245
|
export {};
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { Node as PmNode, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
1
|
+
import { type CodeBlockAttrs } from '@atlaskit/adf-schema';
|
|
2
|
+
import type { Node as PmNode, NodeType, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { NodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
export declare const defaultWordWrapState = false;
|
|
6
6
|
export declare const codeBlockWrappedStates: WeakMap<PmNode, boolean | undefined>;
|
|
7
7
|
type OptionalCodeBlockAttrs = CodeBlockAttrs | undefined;
|
|
8
8
|
export declare const getDefaultCodeBlockAttrs: (attrs?: CodeBlockAttrs) => OptionalCodeBlockAttrs;
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const normalizeMarkdownCodeBlockAttrsInSlice: (slice: Slice, schema: Schema) => Slice;
|
|
10
|
+
type InsertedCodeBlock = {
|
|
11
|
+
node: PmNode;
|
|
12
|
+
pos: number;
|
|
13
|
+
};
|
|
14
|
+
type GetInsertedCodeBlocksOptions = {
|
|
15
|
+
filter?: (node: PmNode) => boolean;
|
|
16
|
+
};
|
|
17
|
+
type InsertedCodeBlockTransaction = Pick<Transaction, 'doc' | 'mapping' | 'steps'>;
|
|
18
|
+
export declare const getInsertedCodeBlocksInTransaction: (tr: InsertedCodeBlockTransaction, codeBlockType: NodeType, options?: GetInsertedCodeBlocksOptions) => InsertedCodeBlock[];
|
|
10
19
|
export interface FoldRange {
|
|
11
20
|
from: number;
|
|
12
21
|
to: number;
|
|
@@ -14,6 +14,11 @@ export declare const codeBlockButtonMessages: {
|
|
|
14
14
|
description: string;
|
|
15
15
|
id: string;
|
|
16
16
|
};
|
|
17
|
+
detectedLanguage: {
|
|
18
|
+
defaultMessage: string;
|
|
19
|
+
description: string;
|
|
20
|
+
id: string;
|
|
21
|
+
};
|
|
17
22
|
detectLanguage: {
|
|
18
23
|
defaultMessage: string;
|
|
19
24
|
description: string;
|
|
@@ -24,6 +29,11 @@ export declare const codeBlockButtonMessages: {
|
|
|
24
29
|
description: string;
|
|
25
30
|
id: string;
|
|
26
31
|
};
|
|
32
|
+
noneDetected: {
|
|
33
|
+
defaultMessage: string;
|
|
34
|
+
description: string;
|
|
35
|
+
id: string;
|
|
36
|
+
};
|
|
27
37
|
recentlyUsed: {
|
|
28
38
|
defaultMessage: string;
|
|
29
39
|
description: string;
|
|
@@ -86,6 +86,7 @@ export declare enum ACTION {
|
|
|
86
86
|
/** used in @atlassian/editor-referentiality */
|
|
87
87
|
GOT_CONNECTIONS = "gotConnections",
|
|
88
88
|
LANGUAGE_SELECTED = "languageSelected",
|
|
89
|
+
LANGUAGE_AUTO_DETECTED = "languageAutoDetected",
|
|
89
90
|
LIST_ITEM_JOINED = "listItemJoined",
|
|
90
91
|
MATCHED = "matched",
|
|
91
92
|
MEDIA_LINK_TRANSFORMED = "mediaLinkTransformed",
|
|
@@ -158,9 +158,15 @@ type RichMediaLayoutAEP = TrackAEP<ACTION.SELECTED, ACTION_SUBJECT.MEDIA_SINGLE
|
|
|
158
158
|
previousLayoutType: RichMediaLayout;
|
|
159
159
|
}, undefined>;
|
|
160
160
|
type CodeBlockLanguageSelectedAEP = TrackAEP<ACTION.LANGUAGE_SELECTED, ACTION_SUBJECT.CODE_BLOCK, undefined, {
|
|
161
|
+
autoDetectedLanguage?: string;
|
|
162
|
+
autoDetectionResult?: 'detected' | 'noneDetected';
|
|
161
163
|
language: string;
|
|
162
164
|
selectionSource?: 'all' | 'pinned' | 'recentlyUsed' | 'search';
|
|
163
165
|
}, undefined>;
|
|
166
|
+
type CodeBlockLanguageAutoDetectedAEP = TrackAEP<ACTION.LANGUAGE_AUTO_DETECTED, ACTION_SUBJECT.CODE_BLOCK, undefined, {
|
|
167
|
+
detectionResult: 'detected' | 'noneDetected';
|
|
168
|
+
language: string;
|
|
169
|
+
}, undefined>;
|
|
164
170
|
type MediaLinkTransformedAEP = OperationalAEP<ACTION.MEDIA_LINK_TRANSFORMED, ACTION_SUBJECT.EDITOR, undefined, undefined>;
|
|
165
171
|
type MediaSingleWidthTransformedAEP = OperationalAEP<ACTION.MEDIA_SINGLE_WIDTH_TRANSFORMED, ACTION_SUBJECT.EDITOR, undefined, undefined>;
|
|
166
172
|
type TextLinkCodeMarkTransformedAEP = OperationalAEP<ACTION.TEXT_LINK_MARK_TRANSFORMED, ACTION_SUBJECT.EDITOR, undefined, undefined>;
|
|
@@ -235,5 +241,5 @@ type ChangeToneMenuItemClickedAEP = UIAEP<ACTION.CLICKED, ACTION_SUBJECT.TOOLBAR
|
|
|
235
241
|
type TranslateMenuItemClickedAEP = UIAEP<ACTION.CLICKED, ACTION_SUBJECT.TOOLBAR_DROPDOWN_MENU_ITEM, ACTION_SUBJECT_ID.AI_TRANSLATE, {
|
|
236
242
|
inputMethod: INPUT_METHOD.TOOLBAR | INPUT_METHOD.FLOATING_TB;
|
|
237
243
|
}>;
|
|
238
|
-
export type GeneralEventPayload<T = void> = AnnotateButtonAEP | AnnotationAEP | AnnotationErrorAEP | BrowserFreezePayload | ButtonFeedbackAEP | ButtonHelpAEP | ButtonUploadMediaAEP | ColorPickerAEP | EditorPerfAEP | EditorRenderedAEP<T> | EditorStartAEP | EditorStopAEP | ExpandToggleAEP | FeedbackAEP | FullWidthModeAEP | HelpQuickInsertAEP | InputPerfSamplingAEP | InputPerfSamplingAvgAEP | PickerEmojiAEP | PickerImageAEP | PickerMediaInsertAEP | PickerMediaInsertClosedAEP | PickerMediaInsertCancelledAEP | ReactNodeViewRenderedAEP | RichMediaLayoutAEP | SelectionAEP | SlowInputAEP | TransactionMutatedAEP | UploadExternalFailedAEP | WithPluginStateCalledAEP | CodeBlockLanguageSelectedAEP | EditorContentRetrievalPerformedAEP | MediaLinkTransformedAEP | TextLinkCodeMarkTransformedAEP | DedupeMarksTransformedAEP | IndentationMarksTransformedAEP | NodesMissingContentTransformedAEP | InvalidProsemirrorDocumentErrorAEP | DocumentProcessingErrorAEP | InvalidMediaContentTransformedAEP | HeadingAnchorLinkButtonAEP | CollabStepsTrackerPayloadAEP | CollabOrganicChangesTrackerPayloadAEP | BlocksDragInitAEP | CodeBlockWordWrapToggleAEP | CodeBlockLineNumbersToggleAEP | RequestToEditAEP | SingleColumLayoutDetectedAEP | CopyLinkToAnchorButtonAEP | DockedPrimaryToolbarRenderedAEP | RovoMoreOptionsClickedAEP | AskRovoButtonClickedAEP | SmartLinkRovoButtonClickedAEP | SmartLinkSummarizeButtonClickedAEP | AIRemixButtonClickedAEP | ChangeToneMenuItemClickedAEP | TranslateMenuItemClickedAEP | MediaSingleWidthTransformedAEP;
|
|
244
|
+
export type GeneralEventPayload<T = void> = AnnotateButtonAEP | AnnotationAEP | AnnotationErrorAEP | BrowserFreezePayload | ButtonFeedbackAEP | ButtonHelpAEP | ButtonUploadMediaAEP | ColorPickerAEP | EditorPerfAEP | EditorRenderedAEP<T> | EditorStartAEP | EditorStopAEP | ExpandToggleAEP | FeedbackAEP | FullWidthModeAEP | HelpQuickInsertAEP | InputPerfSamplingAEP | InputPerfSamplingAvgAEP | PickerEmojiAEP | PickerImageAEP | PickerMediaInsertAEP | PickerMediaInsertClosedAEP | PickerMediaInsertCancelledAEP | ReactNodeViewRenderedAEP | RichMediaLayoutAEP | SelectionAEP | SlowInputAEP | TransactionMutatedAEP | UploadExternalFailedAEP | WithPluginStateCalledAEP | CodeBlockLanguageAutoDetectedAEP | CodeBlockLanguageSelectedAEP | EditorContentRetrievalPerformedAEP | MediaLinkTransformedAEP | TextLinkCodeMarkTransformedAEP | DedupeMarksTransformedAEP | IndentationMarksTransformedAEP | NodesMissingContentTransformedAEP | InvalidProsemirrorDocumentErrorAEP | DocumentProcessingErrorAEP | InvalidMediaContentTransformedAEP | HeadingAnchorLinkButtonAEP | CollabStepsTrackerPayloadAEP | CollabOrganicChangesTrackerPayloadAEP | BlocksDragInitAEP | CodeBlockWordWrapToggleAEP | CodeBlockLineNumbersToggleAEP | RequestToEditAEP | SingleColumLayoutDetectedAEP | CopyLinkToAnchorButtonAEP | DockedPrimaryToolbarRenderedAEP | RovoMoreOptionsClickedAEP | AskRovoButtonClickedAEP | SmartLinkRovoButtonClickedAEP | SmartLinkSummarizeButtonClickedAEP | AIRemixButtonClickedAEP | ChangeToneMenuItemClickedAEP | TranslateMenuItemClickedAEP | MediaSingleWidthTransformedAEP;
|
|
239
245
|
export {};
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { Node as PmNode, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
1
|
+
import { type CodeBlockAttrs } from '@atlaskit/adf-schema';
|
|
2
|
+
import type { Node as PmNode, NodeType, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { NodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
export declare const defaultWordWrapState = false;
|
|
6
6
|
export declare const codeBlockWrappedStates: WeakMap<PmNode, boolean | undefined>;
|
|
7
7
|
type OptionalCodeBlockAttrs = CodeBlockAttrs | undefined;
|
|
8
8
|
export declare const getDefaultCodeBlockAttrs: (attrs?: CodeBlockAttrs) => OptionalCodeBlockAttrs;
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const normalizeMarkdownCodeBlockAttrsInSlice: (slice: Slice, schema: Schema) => Slice;
|
|
10
|
+
type InsertedCodeBlock = {
|
|
11
|
+
node: PmNode;
|
|
12
|
+
pos: number;
|
|
13
|
+
};
|
|
14
|
+
type GetInsertedCodeBlocksOptions = {
|
|
15
|
+
filter?: (node: PmNode) => boolean;
|
|
16
|
+
};
|
|
17
|
+
type InsertedCodeBlockTransaction = Pick<Transaction, 'doc' | 'mapping' | 'steps'>;
|
|
18
|
+
export declare const getInsertedCodeBlocksInTransaction: (tr: InsertedCodeBlockTransaction, codeBlockType: NodeType, options?: GetInsertedCodeBlocksOptions) => InsertedCodeBlock[];
|
|
10
19
|
export interface FoldRange {
|
|
11
20
|
from: number;
|
|
12
21
|
to: number;
|
|
@@ -14,6 +14,11 @@ export declare const codeBlockButtonMessages: {
|
|
|
14
14
|
description: string;
|
|
15
15
|
id: string;
|
|
16
16
|
};
|
|
17
|
+
detectedLanguage: {
|
|
18
|
+
defaultMessage: string;
|
|
19
|
+
description: string;
|
|
20
|
+
id: string;
|
|
21
|
+
};
|
|
17
22
|
detectLanguage: {
|
|
18
23
|
defaultMessage: string;
|
|
19
24
|
description: string;
|
|
@@ -24,6 +29,11 @@ export declare const codeBlockButtonMessages: {
|
|
|
24
29
|
description: string;
|
|
25
30
|
id: string;
|
|
26
31
|
};
|
|
32
|
+
noneDetected: {
|
|
33
|
+
defaultMessage: string;
|
|
34
|
+
description: string;
|
|
35
|
+
id: string;
|
|
36
|
+
};
|
|
27
37
|
recentlyUsed: {
|
|
28
38
|
defaultMessage: string;
|
|
29
39
|
description: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "114.
|
|
3
|
+
"version": "114.55.0",
|
|
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/"
|
|
@@ -81,13 +81,13 @@
|
|
|
81
81
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
82
82
|
"@atlaskit/react-ufo": "^6.6.0",
|
|
83
83
|
"@atlaskit/section-message": "^8.13.0",
|
|
84
|
-
"@atlaskit/smart-card": "^44.
|
|
84
|
+
"@atlaskit/smart-card": "^44.20.0",
|
|
85
85
|
"@atlaskit/smart-user-picker": "^10.2.0",
|
|
86
86
|
"@atlaskit/spinner": "^19.1.0",
|
|
87
87
|
"@atlaskit/task-decision": "^20.1.0",
|
|
88
88
|
"@atlaskit/teams-app-config": "^1.12.0",
|
|
89
89
|
"@atlaskit/textfield": "^8.3.0",
|
|
90
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
90
|
+
"@atlaskit/tmp-editor-statsig": "^87.0.0",
|
|
91
91
|
"@atlaskit/tokens": "^13.1.0",
|
|
92
92
|
"@atlaskit/tooltip": "^22.5.0",
|
|
93
93
|
"@atlaskit/width-detector": "^5.1.0",
|
|
@@ -275,6 +275,9 @@
|
|
|
275
275
|
},
|
|
276
276
|
"platform_editor_ai_selection_local_ids": {
|
|
277
277
|
"type": "boolean"
|
|
278
|
+
},
|
|
279
|
+
"platform_editor_add_code_block_localid": {
|
|
280
|
+
"type": "boolean"
|
|
278
281
|
}
|
|
279
282
|
}
|
|
280
283
|
}
|