Skip to content

Commit

Permalink
Fix Picker Plugin issue (microsoft#1832)
Browse files Browse the repository at this point in the history
* fix for microsoft#1830
  • Loading branch information
Andres-CT98 authored May 25, 2023
1 parent f0f147d commit 1be0d27
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
isCharacterValue,
isModifierKey,
PartialInlineElement,
safeInstanceOf,
} from 'roosterjs-editor-dom';
import {
ChangeSource,
Expand Down Expand Up @@ -247,9 +248,12 @@ export default class PickerPlugin<T extends PickerDataProvider = PickerDataProvi
}

private getIdValue(node: Node): string | null {
let element = node as Element;
let attribute = element.attributes.getNamedItem('id');
return element.attributes && attribute ? (attribute.value as string) : null;
if (safeInstanceOf(node, 'HTMLElement')) {
const attribute = node.attributes.getNamedItem('id');
return attribute ? (attribute.value as string) : null;
} else {
return null;
}
}

private getWordBeforeCursor(event: PluginKeyboardEvent | null): string | null {
Expand Down

0 comments on commit 1be0d27

Please sign in to comment.