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

On Windows, clicking on an image element in RichText without a URL causes File Explorer to open #19866

Open
tankorsmash opened this issue Jun 26, 2019 · 0 comments

Comments

@tankorsmash
Copy link
Contributor

tankorsmash commented Jun 26, 2019

imageRenderer->addComponent(ListenerComponent::create(imageRenderer,

   auto rich_text = cocos2d::ui::RichText::initWithXML(
        "This is a tiny image of a hand: <img src='combined_hand.png' width='36' height='36' type='1'/>");
   ... add to parent etc

then click on the image, and the OS will try to open the URL, but since it's blank, it defaults to the root filesystem path I think.

On my fork I've just added an 'if URL length' check in this one spot, but I haven't tried much more. Seems like there's a few spots the ListenerComponent is bound to the image element but I haven't ran into it yet.

       if (url.length() > 0) {
        imageRenderer->addComponent(ListenerComponent::create(imageRenderer,
                                                              url,
                                                              std::bind(&RichText::openUrl, this, std::placeholders::_1)));
        }
@tankorsmash tankorsmash changed the title On Windows, setting an image element in RichText without a URL causes File Explorer to open On Windows, clicking on an image element in RichText without a URL causes File Explorer to open Jun 26, 2019
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

No branches or pull requests

1 participant