Comments (12)
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.
Could you show me some code snippet example? Let's discuss based on code.
from electron-about-window.
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.
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.
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.
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.
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.
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:
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.
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.
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.
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.
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)
- I set open_devtools: false, but the devtools window will still open. HOT 3
- getName is deprecated in Electron 7 HOT 3
- Version should be overridable by custom version string
- About dialog is initially blank on macOS HOT 2
- not working
- `package.json` not found in directory - only in prod HOT 1
- `remote` does not exist when app is launched without Electron run-time HOT 6
- About window on windows seems pretty limited HOT 5
- for loop syntax error
- Windows 11 screenshot? HOT 1
- Setting about-window with electronforge and its webpack plugin HOT 5
- Feature request: option for dark mode
- Fork for Electron 14+ HOT 2
- Typescript error - Cannot find name AboutWindowInfo HOT 5
- Calling openAboutWindow multiple times presents multiple about windows HOT 1
- Electron version shown instead of application version in dev mode
- Feature request: Copy to clipboard button
- How to import "openAboutWindow" HOT 2
- How to include CSS file
- electron: Failed to load URL: file:///Users/xxx/out/main/about.html with error: ERR_FILE_NOT_FOUND
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from electron-about-window.