@atlaskit/editor-plugin-autocomplete 4.1.1 → 4.1.3
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 +16 -0
- package/dist/cjs/pm-plugins/autocomplete-plugin.js +4 -2
- package/dist/cjs/pm-plugins/local-slow-lane-client.js +16 -16
- package/dist/es2019/pm-plugins/autocomplete-plugin.js +4 -2
- package/dist/es2019/pm-plugins/local-slow-lane-client.js +2 -2
- package/dist/esm/pm-plugins/autocomplete-plugin.js +4 -2
- package/dist/esm/pm-plugins/local-slow-lane-client.js +16 -16
- package/package.json +2 -2
- package/src/pm-plugins/autocomplete-plugin.ts +4 -2
- package/src/pm-plugins/local-slow-lane-client.ts +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-autocomplete
|
|
2
2
|
|
|
3
|
+
## 4.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5cd6c10a9394f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5cd6c10a9394f) -
|
|
8
|
+
Fix autocomplete context extraction when inline formatting inserts leaf nodes before the cursor,
|
|
9
|
+
preventing misaligned ghost-text suggestions that can surface as stray spaces.
|
|
10
|
+
|
|
11
|
+
## 4.1.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`88a1176b97a25`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/88a1176b97a25) -
|
|
16
|
+
Internal TypeScript typecheck fixes for ts7 (tsgo) adoption. No functional or API changes.
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 4.1.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -38,6 +38,7 @@ var MAX_INGESTED_CONTEXT_TEXTS = 50;
|
|
|
38
38
|
// non-comment editors (where parentCommentContent never arrives) don't refetch
|
|
39
39
|
// on every word boundary for the plugin's lifetime.
|
|
40
40
|
var MAX_CONTEXT_REFRESH_ATTEMPTS = 5;
|
|
41
|
+
var INLINE_LEAF_TEXT = ' ';
|
|
41
42
|
|
|
42
43
|
// eslint-disable-next-line require-unicode-regexp
|
|
43
44
|
var TRAILING_NON_BOUNDARY_TOKEN_REGEX = /([^\s.,;:!?]*)$/;
|
|
@@ -63,7 +64,8 @@ var getTextBeforeCursor = function getTextBeforeCursor(state) {
|
|
|
63
64
|
var maxChars = 200;
|
|
64
65
|
var blockNode = $from.parent;
|
|
65
66
|
var offsetInBlock = $from.parentOffset;
|
|
66
|
-
|
|
67
|
+
// PM offsets count inline leaf nodes; textContent indices do not.
|
|
68
|
+
var blockText = blockNode.textBetween(0, offsetInBlock, undefined, INLINE_LEAF_TEXT);
|
|
67
69
|
if (blockText.length >= maxChars) {
|
|
68
70
|
return blockText.slice(-maxChars);
|
|
69
71
|
}
|
|
@@ -76,7 +78,7 @@ var getTextBeforeCursor = function getTextBeforeCursor(state) {
|
|
|
76
78
|
var indexInParent = $from.index(depth);
|
|
77
79
|
for (var i = indexInParent - 1; i >= 0 && fullText.length < maxChars; i--) {
|
|
78
80
|
var sibling = parentNode.child(i);
|
|
79
|
-
var siblingText = sibling.
|
|
81
|
+
var siblingText = sibling.textBetween(0, sibling.content.size, '\n', INLINE_LEAF_TEXT);
|
|
80
82
|
fullText = siblingText + '\n' + fullText;
|
|
81
83
|
}
|
|
82
84
|
depth--;
|
|
@@ -686,7 +686,7 @@ var createLocalSlowLaneClient = exports.createLocalSlowLaneClient = function cre
|
|
|
686
686
|
*/
|
|
687
687
|
var probeWebGpuCapabilities = /*#__PURE__*/function () {
|
|
688
688
|
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
689
|
-
var gpu, _adapter$limits, _adapter$limits2, adapter, vendor, architecture,
|
|
689
|
+
var gpu, _adapter$limits, _adapter$limits2, adapter, vendor, architecture, _info, _requestAdapterInfo, _ref9, info, _t, _t2, _t3;
|
|
690
690
|
return _regenerator.default.wrap(function (_context2) {
|
|
691
691
|
while (1) switch (_context2.prev = _context2.next) {
|
|
692
692
|
case 0:
|
|
@@ -714,16 +714,16 @@ var createLocalSlowLaneClient = exports.createLocalSlowLaneClient = function cre
|
|
|
714
714
|
});
|
|
715
715
|
case 3:
|
|
716
716
|
_context2.prev = 3;
|
|
717
|
-
if (!((
|
|
717
|
+
if (!((_info = adapter.info) !== null && _info !== void 0)) {
|
|
718
718
|
_context2.next = 4;
|
|
719
719
|
break;
|
|
720
720
|
}
|
|
721
|
-
_t =
|
|
721
|
+
_t = _info;
|
|
722
722
|
_context2.next = 6;
|
|
723
723
|
break;
|
|
724
724
|
case 4:
|
|
725
725
|
_context2.next = 5;
|
|
726
|
-
return (
|
|
726
|
+
return (_requestAdapterInfo = (_ref9 = adapter).requestAdapterInfo) === null || _requestAdapterInfo === void 0 ? void 0 : _requestAdapterInfo.call(_ref9);
|
|
727
727
|
case 5:
|
|
728
728
|
_t = _context2.sent;
|
|
729
729
|
case 6:
|
|
@@ -815,7 +815,7 @@ var createLocalSlowLaneClient = exports.createLocalSlowLaneClient = function cre
|
|
|
815
815
|
initFailed = true;
|
|
816
816
|
};
|
|
817
817
|
var initEngine = /*#__PURE__*/function () {
|
|
818
|
-
var
|
|
818
|
+
var _ref0 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
819
819
|
var capabilities, startTime, _yield$Promise$all3, _yield$Promise$all4, _yield$Promise$all4$, MLCEngineCtor, prebuiltAppConfig, customModelRecord, appConfig, newEngine, loadDurationMs, errorMsg, _t4;
|
|
820
820
|
return _regenerator.default.wrap(function (_context3) {
|
|
821
821
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -933,7 +933,7 @@ var createLocalSlowLaneClient = exports.createLocalSlowLaneClient = function cre
|
|
|
933
933
|
}, _callee3, null, [[5, 9]]);
|
|
934
934
|
}));
|
|
935
935
|
return function initEngine() {
|
|
936
|
-
return
|
|
936
|
+
return _ref0.apply(this, arguments);
|
|
937
937
|
};
|
|
938
938
|
}();
|
|
939
939
|
var ensureEngineInitialized = function ensureEngineInitialized() {
|
|
@@ -960,7 +960,7 @@ var createLocalSlowLaneClient = exports.createLocalSlowLaneClient = function cre
|
|
|
960
960
|
* 384-d semantic vector (passage-encoded; see `wrapForArctic`).
|
|
961
961
|
*/
|
|
962
962
|
var runInference = /*#__PURE__*/function () {
|
|
963
|
-
var
|
|
963
|
+
var _ref1 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(text, requestId) {
|
|
964
964
|
var experienceId, lmText, semanticText, arcticInput, captureCompletionTime, _data, tStart, tLmDone, tEmbDone, _yield$Promise$all5, _yield$Promise$all6, embeddingResponse, rawLogits, payload, embedding, sumSq, i, topTokens, errorMsg, _t5;
|
|
965
965
|
return _regenerator.default.wrap(function (_context4) {
|
|
966
966
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -1080,17 +1080,17 @@ var createLocalSlowLaneClient = exports.createLocalSlowLaneClient = function cre
|
|
|
1080
1080
|
// eslint-disable-next-line no-console
|
|
1081
1081
|
console.log(storedLmLogits ? "\u2705 lm_logits: ".concat(Object.keys(storedLmLogits).length, " words") : '❌ No lm_logits');
|
|
1082
1082
|
if (storedLmLogits) {
|
|
1083
|
-
topTokens = Object.entries(storedLmLogits).sort(function (
|
|
1084
|
-
var _ref11 = (0, _slicedToArray2.default)(_ref1, 2),
|
|
1085
|
-
a = _ref11[1];
|
|
1083
|
+
topTokens = Object.entries(storedLmLogits).sort(function (_ref10, _ref11) {
|
|
1086
1084
|
var _ref12 = (0, _slicedToArray2.default)(_ref10, 2),
|
|
1087
|
-
|
|
1085
|
+
a = _ref12[1];
|
|
1086
|
+
var _ref13 = (0, _slicedToArray2.default)(_ref11, 2),
|
|
1087
|
+
b = _ref13[1];
|
|
1088
1088
|
return b - a;
|
|
1089
1089
|
}).slice(0, 10); // eslint-disable-next-line no-console
|
|
1090
|
-
console.log('Top 10 predictions:', topTokens.map(function (
|
|
1091
|
-
var
|
|
1092
|
-
t =
|
|
1093
|
-
p =
|
|
1090
|
+
console.log('Top 10 predictions:', topTokens.map(function (_ref14) {
|
|
1091
|
+
var _ref15 = (0, _slicedToArray2.default)(_ref14, 2),
|
|
1092
|
+
t = _ref15[0],
|
|
1093
|
+
p = _ref15[1];
|
|
1094
1094
|
return "".concat(t, ": ").concat((p * 100).toFixed(1), "%");
|
|
1095
1095
|
}).join(', '));
|
|
1096
1096
|
}
|
|
@@ -1151,7 +1151,7 @@ var createLocalSlowLaneClient = exports.createLocalSlowLaneClient = function cre
|
|
|
1151
1151
|
}, _callee4, null, [[2, 5]]);
|
|
1152
1152
|
}));
|
|
1153
1153
|
return function runInference(_x, _x2) {
|
|
1154
|
-
return
|
|
1154
|
+
return _ref1.apply(this, arguments);
|
|
1155
1155
|
};
|
|
1156
1156
|
}();
|
|
1157
1157
|
|
|
@@ -24,6 +24,7 @@ const MAX_INGESTED_CONTEXT_TEXTS = 50;
|
|
|
24
24
|
// non-comment editors (where parentCommentContent never arrives) don't refetch
|
|
25
25
|
// on every word boundary for the plugin's lifetime.
|
|
26
26
|
const MAX_CONTEXT_REFRESH_ATTEMPTS = 5;
|
|
27
|
+
const INLINE_LEAF_TEXT = ' ';
|
|
27
28
|
|
|
28
29
|
// eslint-disable-next-line require-unicode-regexp
|
|
29
30
|
const TRAILING_NON_BOUNDARY_TOKEN_REGEX = /([^\s.,;:!?]*)$/;
|
|
@@ -47,7 +48,8 @@ const getTextBeforeCursor = state => {
|
|
|
47
48
|
const maxChars = 200;
|
|
48
49
|
const blockNode = $from.parent;
|
|
49
50
|
const offsetInBlock = $from.parentOffset;
|
|
50
|
-
|
|
51
|
+
// PM offsets count inline leaf nodes; textContent indices do not.
|
|
52
|
+
const blockText = blockNode.textBetween(0, offsetInBlock, undefined, INLINE_LEAF_TEXT);
|
|
51
53
|
if (blockText.length >= maxChars) {
|
|
52
54
|
return blockText.slice(-maxChars);
|
|
53
55
|
}
|
|
@@ -60,7 +62,7 @@ const getTextBeforeCursor = state => {
|
|
|
60
62
|
const indexInParent = $from.index(depth);
|
|
61
63
|
for (let i = indexInParent - 1; i >= 0 && fullText.length < maxChars; i--) {
|
|
62
64
|
const sibling = parentNode.child(i);
|
|
63
|
-
const siblingText = sibling.
|
|
65
|
+
const siblingText = sibling.textBetween(0, sibling.content.size, '\n', INLINE_LEAF_TEXT);
|
|
64
66
|
fullText = siblingText + '\n' + fullText;
|
|
65
67
|
}
|
|
66
68
|
depth--;
|
|
@@ -560,8 +560,8 @@ export const createLocalSlowLaneClient = (config = {}) => {
|
|
|
560
560
|
let vendor;
|
|
561
561
|
let architecture;
|
|
562
562
|
try {
|
|
563
|
-
var
|
|
564
|
-
const info = (
|
|
563
|
+
var _info, _requestAdapterInfo, _ref;
|
|
564
|
+
const info = (_info = adapter.info) !== null && _info !== void 0 ? _info : await ((_requestAdapterInfo = (_ref = adapter).requestAdapterInfo) === null || _requestAdapterInfo === void 0 ? void 0 : _requestAdapterInfo.call(_ref));
|
|
565
565
|
vendor = (info === null || info === void 0 ? void 0 : info.vendor) || undefined;
|
|
566
566
|
architecture = (info === null || info === void 0 ? void 0 : info.architecture) || undefined;
|
|
567
567
|
} catch {
|
|
@@ -31,6 +31,7 @@ var MAX_INGESTED_CONTEXT_TEXTS = 50;
|
|
|
31
31
|
// non-comment editors (where parentCommentContent never arrives) don't refetch
|
|
32
32
|
// on every word boundary for the plugin's lifetime.
|
|
33
33
|
var MAX_CONTEXT_REFRESH_ATTEMPTS = 5;
|
|
34
|
+
var INLINE_LEAF_TEXT = ' ';
|
|
34
35
|
|
|
35
36
|
// eslint-disable-next-line require-unicode-regexp
|
|
36
37
|
var TRAILING_NON_BOUNDARY_TOKEN_REGEX = /([^\s.,;:!?]*)$/;
|
|
@@ -56,7 +57,8 @@ var getTextBeforeCursor = function getTextBeforeCursor(state) {
|
|
|
56
57
|
var maxChars = 200;
|
|
57
58
|
var blockNode = $from.parent;
|
|
58
59
|
var offsetInBlock = $from.parentOffset;
|
|
59
|
-
|
|
60
|
+
// PM offsets count inline leaf nodes; textContent indices do not.
|
|
61
|
+
var blockText = blockNode.textBetween(0, offsetInBlock, undefined, INLINE_LEAF_TEXT);
|
|
60
62
|
if (blockText.length >= maxChars) {
|
|
61
63
|
return blockText.slice(-maxChars);
|
|
62
64
|
}
|
|
@@ -69,7 +71,7 @@ var getTextBeforeCursor = function getTextBeforeCursor(state) {
|
|
|
69
71
|
var indexInParent = $from.index(depth);
|
|
70
72
|
for (var i = indexInParent - 1; i >= 0 && fullText.length < maxChars; i--) {
|
|
71
73
|
var sibling = parentNode.child(i);
|
|
72
|
-
var siblingText = sibling.
|
|
74
|
+
var siblingText = sibling.textBetween(0, sibling.content.size, '\n', INLINE_LEAF_TEXT);
|
|
73
75
|
fullText = siblingText + '\n' + fullText;
|
|
74
76
|
}
|
|
75
77
|
depth--;
|
|
@@ -676,7 +676,7 @@ export var createLocalSlowLaneClient = function createLocalSlowLaneClient() {
|
|
|
676
676
|
*/
|
|
677
677
|
var probeWebGpuCapabilities = /*#__PURE__*/function () {
|
|
678
678
|
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
679
|
-
var gpu, _adapter$limits, _adapter$limits2, adapter, vendor, architecture,
|
|
679
|
+
var gpu, _adapter$limits, _adapter$limits2, adapter, vendor, architecture, _info, _requestAdapterInfo, _ref9, info, _t, _t2, _t3;
|
|
680
680
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
681
681
|
while (1) switch (_context2.prev = _context2.next) {
|
|
682
682
|
case 0:
|
|
@@ -704,16 +704,16 @@ export var createLocalSlowLaneClient = function createLocalSlowLaneClient() {
|
|
|
704
704
|
});
|
|
705
705
|
case 3:
|
|
706
706
|
_context2.prev = 3;
|
|
707
|
-
if (!((
|
|
707
|
+
if (!((_info = adapter.info) !== null && _info !== void 0)) {
|
|
708
708
|
_context2.next = 4;
|
|
709
709
|
break;
|
|
710
710
|
}
|
|
711
|
-
_t =
|
|
711
|
+
_t = _info;
|
|
712
712
|
_context2.next = 6;
|
|
713
713
|
break;
|
|
714
714
|
case 4:
|
|
715
715
|
_context2.next = 5;
|
|
716
|
-
return (
|
|
716
|
+
return (_requestAdapterInfo = (_ref9 = adapter).requestAdapterInfo) === null || _requestAdapterInfo === void 0 ? void 0 : _requestAdapterInfo.call(_ref9);
|
|
717
717
|
case 5:
|
|
718
718
|
_t = _context2.sent;
|
|
719
719
|
case 6:
|
|
@@ -805,7 +805,7 @@ export var createLocalSlowLaneClient = function createLocalSlowLaneClient() {
|
|
|
805
805
|
initFailed = true;
|
|
806
806
|
};
|
|
807
807
|
var initEngine = /*#__PURE__*/function () {
|
|
808
|
-
var
|
|
808
|
+
var _ref0 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
809
809
|
var capabilities, startTime, _yield$Promise$all3, _yield$Promise$all4, _yield$Promise$all4$, MLCEngineCtor, prebuiltAppConfig, customModelRecord, appConfig, newEngine, loadDurationMs, errorMsg, _t4;
|
|
810
810
|
return _regeneratorRuntime.wrap(function (_context3) {
|
|
811
811
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -921,7 +921,7 @@ export var createLocalSlowLaneClient = function createLocalSlowLaneClient() {
|
|
|
921
921
|
}, _callee3, null, [[5, 9]]);
|
|
922
922
|
}));
|
|
923
923
|
return function initEngine() {
|
|
924
|
-
return
|
|
924
|
+
return _ref0.apply(this, arguments);
|
|
925
925
|
};
|
|
926
926
|
}();
|
|
927
927
|
var ensureEngineInitialized = function ensureEngineInitialized() {
|
|
@@ -948,7 +948,7 @@ export var createLocalSlowLaneClient = function createLocalSlowLaneClient() {
|
|
|
948
948
|
* 384-d semantic vector (passage-encoded; see `wrapForArctic`).
|
|
949
949
|
*/
|
|
950
950
|
var runInference = /*#__PURE__*/function () {
|
|
951
|
-
var
|
|
951
|
+
var _ref1 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(text, requestId) {
|
|
952
952
|
var experienceId, lmText, semanticText, arcticInput, captureCompletionTime, _data, tStart, tLmDone, tEmbDone, _yield$Promise$all5, _yield$Promise$all6, embeddingResponse, rawLogits, payload, embedding, sumSq, i, topTokens, errorMsg, _t5;
|
|
953
953
|
return _regeneratorRuntime.wrap(function (_context4) {
|
|
954
954
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -1068,17 +1068,17 @@ export var createLocalSlowLaneClient = function createLocalSlowLaneClient() {
|
|
|
1068
1068
|
// eslint-disable-next-line no-console
|
|
1069
1069
|
console.log(storedLmLogits ? "\u2705 lm_logits: ".concat(Object.keys(storedLmLogits).length, " words") : '❌ No lm_logits');
|
|
1070
1070
|
if (storedLmLogits) {
|
|
1071
|
-
topTokens = Object.entries(storedLmLogits).sort(function (
|
|
1072
|
-
var _ref11 = _slicedToArray(_ref1, 2),
|
|
1073
|
-
a = _ref11[1];
|
|
1071
|
+
topTokens = Object.entries(storedLmLogits).sort(function (_ref10, _ref11) {
|
|
1074
1072
|
var _ref12 = _slicedToArray(_ref10, 2),
|
|
1075
|
-
|
|
1073
|
+
a = _ref12[1];
|
|
1074
|
+
var _ref13 = _slicedToArray(_ref11, 2),
|
|
1075
|
+
b = _ref13[1];
|
|
1076
1076
|
return b - a;
|
|
1077
1077
|
}).slice(0, 10); // eslint-disable-next-line no-console
|
|
1078
|
-
console.log('Top 10 predictions:', topTokens.map(function (
|
|
1079
|
-
var
|
|
1080
|
-
t =
|
|
1081
|
-
p =
|
|
1078
|
+
console.log('Top 10 predictions:', topTokens.map(function (_ref14) {
|
|
1079
|
+
var _ref15 = _slicedToArray(_ref14, 2),
|
|
1080
|
+
t = _ref15[0],
|
|
1081
|
+
p = _ref15[1];
|
|
1082
1082
|
return "".concat(t, ": ").concat((p * 100).toFixed(1), "%");
|
|
1083
1083
|
}).join(', '));
|
|
1084
1084
|
}
|
|
@@ -1139,7 +1139,7 @@ export var createLocalSlowLaneClient = function createLocalSlowLaneClient() {
|
|
|
1139
1139
|
}, _callee4, null, [[2, 5]]);
|
|
1140
1140
|
}));
|
|
1141
1141
|
return function runInference(_x, _x2) {
|
|
1142
|
-
return
|
|
1142
|
+
return _ref1.apply(this, arguments);
|
|
1143
1143
|
};
|
|
1144
1144
|
}();
|
|
1145
1145
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-autocomplete",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.3",
|
|
4
4
|
"description": "Client-side text autocomplete plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"wink-nlp": "^2.4.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@atlaskit/editor-common": "^116.
|
|
33
|
+
"@atlaskit/editor-common": "^116.30.0",
|
|
34
34
|
"@atlaskit/editor-plugin-analytics": "^12.0.0",
|
|
35
35
|
"react": "^18.2.0"
|
|
36
36
|
},
|
|
@@ -47,6 +47,7 @@ const MAX_INGESTED_CONTEXT_TEXTS = 50;
|
|
|
47
47
|
// non-comment editors (where parentCommentContent never arrives) don't refetch
|
|
48
48
|
// on every word boundary for the plugin's lifetime.
|
|
49
49
|
const MAX_CONTEXT_REFRESH_ATTEMPTS = 5;
|
|
50
|
+
const INLINE_LEAF_TEXT = ' ';
|
|
50
51
|
|
|
51
52
|
// eslint-disable-next-line require-unicode-regexp
|
|
52
53
|
const TRAILING_NON_BOUNDARY_TOKEN_REGEX = /([^\s.,;:!?]*)$/;
|
|
@@ -82,7 +83,8 @@ const getTextBeforeCursor = (state: EditorState): string => {
|
|
|
82
83
|
|
|
83
84
|
const blockNode = $from.parent;
|
|
84
85
|
const offsetInBlock = $from.parentOffset;
|
|
85
|
-
|
|
86
|
+
// PM offsets count inline leaf nodes; textContent indices do not.
|
|
87
|
+
const blockText = blockNode.textBetween(0, offsetInBlock, undefined, INLINE_LEAF_TEXT);
|
|
86
88
|
|
|
87
89
|
if (blockText.length >= maxChars) {
|
|
88
90
|
return blockText.slice(-maxChars);
|
|
@@ -99,7 +101,7 @@ const getTextBeforeCursor = (state: EditorState): string => {
|
|
|
99
101
|
|
|
100
102
|
for (let i = indexInParent - 1; i >= 0 && fullText.length < maxChars; i--) {
|
|
101
103
|
const sibling = parentNode.child(i);
|
|
102
|
-
const siblingText = sibling.
|
|
104
|
+
const siblingText = sibling.textBetween(0, sibling.content.size, '\n', INLINE_LEAF_TEXT);
|
|
103
105
|
fullText = siblingText + '\n' + fullText;
|
|
104
106
|
}
|
|
105
107
|
depth--;
|
|
@@ -742,7 +742,9 @@ export const createLocalSlowLaneClient = (
|
|
|
742
742
|
let vendor: string | undefined;
|
|
743
743
|
let architecture: string | undefined;
|
|
744
744
|
try {
|
|
745
|
-
const info =
|
|
745
|
+
const info =
|
|
746
|
+
(adapter as MinimalGpuAdapter).info ??
|
|
747
|
+
(await (adapter as MinimalGpuAdapter).requestAdapterInfo?.());
|
|
746
748
|
vendor = info?.vendor || undefined;
|
|
747
749
|
architecture = info?.architecture || undefined;
|
|
748
750
|
} catch {
|