FIX: avoid error when attempting to show ai helper to anon (#549)
Also adds an extra guard around ai helper context positioning.
This commit is contained in:
parent
61e4c56e1a
commit
74c6725c75
|
@ -275,6 +275,11 @@ export default class AiHelperContextMenu extends Component {
|
|||
@afterRender
|
||||
positionContextMenu() {
|
||||
this._contextMenu = document.querySelector(".ai-helper-context-menu");
|
||||
|
||||
if (!this._dEditorInput || !this._contextMenu) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.caretCoords = getCaretPosition(this._dEditorInput, {
|
||||
pos: caretPosition(this._dEditorInput),
|
||||
});
|
||||
|
|
|
@ -15,7 +15,7 @@ export function showComposerAIHelper(outletArgs, helper, featureType) {
|
|||
export function showPostAIHelper(outletArgs, helper) {
|
||||
return (
|
||||
_helperEnabled(helper.siteSettings) &&
|
||||
helper.currentUser.can_use_assistant_in_post
|
||||
helper.currentUser?.can_use_assistant_in_post
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue