test logs

This commit is contained in:
Hailey
2024-04-23 19:45:05 -07:00
parent 0788d8aafa
commit f45f8faee0
2 changed files with 14 additions and 0 deletions
@@ -192,6 +192,11 @@ export const TextInput = React.forwardRef(function TextInputImpl(
newRt.detectFacetsWithoutResolution() newRt.detectFacetsWithoutResolution()
setRichText(newRt) setRichText(newRt)
console.log({
utf8Length: newRt.length,
utf16Length: newText.length,
})
if (newRt.facets) { if (newRt.facets) {
for (const facet of newRt.facets) { for (const facet of newRt.facets) {
for (const feature of facet.features) { for (const feature of facet.features) {
@@ -15,6 +15,10 @@ export function addLinkCardIfNecessary({
prevAddedLinks: Set<string> prevAddedLinks: Set<string>
byteEnd: number byteEnd: number
}) { }) {
console.log({
byteIndex: byteEnd,
})
const utf16Index = utf8IndexToUtf16Index(newText, byteEnd) const utf16Index = utf8IndexToUtf16Index(newText, byteEnd)
// Because we always trim the whitespace at the end of the text // Because we always trim the whitespace at the end of the text
newText = newText + ' ' newText = newText + ' '
@@ -28,6 +32,11 @@ export function addLinkCardIfNecessary({
toAdd = 1 toAdd = 1
} }
console.log({
utf8Index: byteEnd,
utf16Index: utf16Index,
})
if (!mayBePaste && utf16Index + toAdd !== cursorLocation) { if (!mayBePaste && utf16Index + toAdd !== cursorLocation) {
return return
} }