Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure image parent node exist, before select it. #2194

Merged
merged 5 commits into from
Nov 9, 2023

Conversation

juliaroldi
Copy link
Contributor

@juliaroldi juliaroldi commented Nov 7, 2023

When select a position in Image selection plugin, check if the image parent node exist, so can it be selected.

PositionType.Before
);

} else if (position) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually position can never be null. The problem could be there is no parent element so that when we create Position, we stored null as node:

image

Then in createRange, when we get nodeType, it throws:

image

To avoid this, we need to check if there is parent node of image. If not, it is impossible to select the image so we just do nothing.

@juliaroldi juliaroldi changed the title Ensure position exist, before select it. Ensure image parent node exist, before select it. Nov 8, 2023
@juliaroldi juliaroldi merged commit a3ec70f into master Nov 9, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants