GithubHelp home page GithubHelp logo

Using html about electron-about-window HOT 12 CLOSED

rhysd avatar rhysd commented on June 24, 2024
Using html

from electron-about-window.

Comments (12)

rhysd avatar rhysd commented on June 24, 2024 1

OK, I think we can use will-navigate event to prevent navigation and open the URL with external browser. I'll try to implement

from electron-about-window.

rhysd avatar rhysd commented on June 24, 2024

Could you show me some code snippet example? Let's discuss based on code.

from electron-about-window.

mifi avatar mifi commented on June 24, 2024

Example:

openAboutWindow({
  icon_path: join(__dirname, 'icon.png'),
  description: '<b>Some bold test</b><a href="myawesomeapp.com">See more here</a>.'
                            })

Currently it just renders the html markup as text, because in the code you're using innerText (https://github.com/rhysd/electron-about-window/blob/master/src/renderer.ts#L30)
Could maybe use innerHTML instead.

from electron-about-window.

rhysd avatar rhysd commented on June 24, 2024

Thanks. I think implementation is very simple as you said. Let me think if there is no risk about XSS because of setting inner HTML.

from electron-about-window.

rhysd avatar rhysd commented on June 24, 2024

I noticed that your example doesn't work. <a> tag navigates to your project page in the 'About Me' window. The window is not protected with sandbox. So we should not navigate to any external page in the window. We need to open the page in external browser.

Regarding to your use case, is it also acceptable to add 'See more' link to description?

from electron-about-window.

rhysd avatar rhysd commented on June 24, 2024

I added a link to application's homepage to application's name instead of adding 'see more' to description because longer description may break the layout. Change is 1e0f5e6.

Does it meet your usecase?

from electron-about-window.

mifi avatar mifi commented on June 24, 2024

Oh I see. That sounds like a nice addition too (the link.)

Actually the link wasn't a particular use case, more an example. It was more that it would be nice to be able to add custom HTML block, if someone needs to write some more text with formatting in their about page.

from electron-about-window.

rhysd avatar rhysd commented on June 24, 2024
openAboutWindow({
   icon_path: join(__dirname, 'icon.png'),
   copyright: 'Copyright (c) 2015 rhysd',
   description: 'Hello, world <a href="https://github.com" class="link">(see more)</a>'
})

now opens a window like below:

2016-11-07 2 28 12

I added will-navigate hook and new-window hook. So <a> tag will open the link with external browser.

I published v1.5.0.

from electron-about-window.

mifi avatar mifi commented on June 24, 2024

Great! thanks! However I think changing from innerText to innerHtml is a breaking change, so we should either bump version to 2.0.0 or introduce a flag in order to use innerHtml instead of innerText.
Maybe introduce a property called "useHtml" ?

from electron-about-window.

rhysd avatar rhysd commented on June 24, 2024

Hmm... I think adding new property is better because innerHTML is dangerous. In the case, current behavior is not broken. I'll unpublish 1.5.0 and add useInnerHTML option in 1.6.0.

from electron-about-window.

mifi avatar mifi commented on June 24, 2024

You can have useInnerHtml property in 1.5 as well, as long as it defaults to innerText, because then it is backwards compatible :)

from electron-about-window.

rhysd avatar rhysd commented on June 24, 2024

Following semantic versioning, we need to up minor version because it's a new feature without breaking change. Anyway, I already published v1.6.0 👍

from electron-about-window.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.