You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var selected = Math.abs(editor.state[_constants.SELECTED_MENTION_INDEX_KEY]); // selected = 0
var text = suggestions[selected % suggestions.length || 0]; // text = undefined
var at = (0, _utils.nearestAt)(state.endText.text, state.selection.startOffset);
var mentionLength = state.selection.startOffset - at - 1;
// Remove the current, incomplete text and replace it with the selected suggestion
return state.transform().deleteBackward(mentionLength).insertText(text).removeMark('mention').insertText(' ').focus().apply(); // fails to insert `undefined` text
I get this error: Cannot read property 'length' of undefined
To reproduce, just enter an @mention that doesn't exist in the example and it will throw the error.
The two normal ways of handling this are to either create an ad-hoc mention or to not allow the user to create the mention at all. Considering the generality of this library, it seems appropriate to handle both cases?
If no suggestion is specified, this block of code fails to insert a suggestion.
I get this error:
Cannot read property 'length' of undefinedTo reproduce, just enter an @mention that doesn't exist in the example and it will throw the error.
The two normal ways of handling this are to either create an ad-hoc mention or to not allow the user to create the mention at all. Considering the generality of this library, it seems appropriate to handle both cases?