fi(wysiwyg): fix navigation
This commit is contained in:
@ -125,20 +125,9 @@ export class WysiwygSelection {
|
||||
// Use our Shadow DOM-aware contains method
|
||||
const isContained = this.containsAcrossShadowDOM(element, selectionInfo.startContainer);
|
||||
|
||||
console.log('getCursorPositionInElement debug:', {
|
||||
element: element.tagName,
|
||||
elementText: element.textContent,
|
||||
selectionContainer: selectionInfo.startContainer,
|
||||
selectionOffset: selectionInfo.startOffset,
|
||||
isContained,
|
||||
elementShadowRoot: element.getRootNode(),
|
||||
selectionShadowRoot: selectionInfo.startContainer.getRootNode()
|
||||
});
|
||||
|
||||
if (isContained) {
|
||||
range.setEnd(selectionInfo.startContainer, selectionInfo.startOffset);
|
||||
const position = range.toString().length;
|
||||
console.log('Cursor position calculated:', position);
|
||||
return position;
|
||||
} else {
|
||||
// Selection might be in shadow DOM or different context
|
||||
@ -148,10 +137,8 @@ export class WysiwygSelection {
|
||||
|
||||
// If the selection is at the beginning or end, handle those cases
|
||||
if (selectionInfo.startOffset === 0) {
|
||||
console.log('Fallback: returning 0 (beginning)');
|
||||
return 0;
|
||||
} else if (selectionInfo.startOffset === selectionText.length) {
|
||||
console.log('Fallback: returning text length:', text.length);
|
||||
return text.length;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user