update
This commit is contained in:
@ -1196,6 +1196,12 @@ export class DeesWysiwygBlock extends DeesElement {
|
||||
}
|
||||
|
||||
public focusWithCursor(position: 'start' | 'end' | number = 'end'): void {
|
||||
console.log('focusWithCursor called', {
|
||||
blockId: this.block?.id,
|
||||
blockType: this.block?.type,
|
||||
position
|
||||
});
|
||||
|
||||
// Check if we have a registered handler for this block type
|
||||
const handler = BlockRegistry.getHandler(this.block.type);
|
||||
if (handler && handler.focusWithCursor) {
|
||||
@ -1389,9 +1395,10 @@ export class DeesWysiwygBlock extends DeesElement {
|
||||
return handler.setCursorToStart(container, context);
|
||||
}
|
||||
|
||||
// Always find the element fresh, don't rely on cached blockElement
|
||||
const editableElement = this.block?.type === 'code'
|
||||
? this.shadowRoot?.querySelector('.block.code') as HTMLDivElement
|
||||
: this.blockElement;
|
||||
: this.shadowRoot?.querySelector('.block') as HTMLDivElement;
|
||||
if (editableElement) {
|
||||
WysiwygBlocks.setCursorToStart(editableElement);
|
||||
}
|
||||
@ -1406,9 +1413,10 @@ export class DeesWysiwygBlock extends DeesElement {
|
||||
return handler.setCursorToEnd(container, context);
|
||||
}
|
||||
|
||||
// Always find the element fresh, don't rely on cached blockElement
|
||||
const editableElement = this.block?.type === 'code'
|
||||
? this.shadowRoot?.querySelector('.block.code') as HTMLDivElement
|
||||
: this.blockElement;
|
||||
: this.shadowRoot?.querySelector('.block') as HTMLDivElement;
|
||||
if (editableElement) {
|
||||
WysiwygBlocks.setCursorToEnd(editableElement);
|
||||
}
|
||||
|
Reference in New Issue
Block a user