From d5f31c22084dafe86c8e77d7e08f3ea998d270d1 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Mon, 14 Aug 2023 10:44:07 +0200 Subject: [PATCH] docs: remove duplicate fiddles (part #2) (#39474) docs: remove duplicate fiddles --- .../external-links/index.html | 68 ------------------- .../external-links/main.js | 26 ------- .../external-links/renderer.js | 7 -- .../path-in-file-manager/index.html | 24 ------- .../path-in-file-manager/main.js | 26 ------- .../path-in-file-manager/renderer.js | 8 --- 6 files changed, 159 deletions(-) delete mode 100644 docs/fiddles/native-ui/external-links-file-manager/external-links/index.html delete mode 100644 docs/fiddles/native-ui/external-links-file-manager/external-links/main.js delete mode 100644 docs/fiddles/native-ui/external-links-file-manager/external-links/renderer.js delete mode 100644 docs/fiddles/native-ui/external-links-file-manager/path-in-file-manager/index.html delete mode 100644 docs/fiddles/native-ui/external-links-file-manager/path-in-file-manager/main.js delete mode 100644 docs/fiddles/native-ui/external-links-file-manager/path-in-file-manager/renderer.js diff --git a/docs/fiddles/native-ui/external-links-file-manager/external-links/index.html b/docs/fiddles/native-ui/external-links-file-manager/external-links/index.html deleted file mode 100644 index 94fc2f438556..000000000000 --- a/docs/fiddles/native-ui/external-links-file-manager/external-links/index.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - - Open external links - - -
-
-
-
- -
-

- If you do not want your app to open website links - within the app, you can use the shell module - to open them externally. When clicked, the links will open outside - of your app and in the user's default web browser. -

-

- When the demo button is clicked, the electron website will open in - your browser. -

-

-
Renderer Process
-

-                const { shell } = require('electron')
-                const exLinksBtn = document.getElementById('open-ex-links')
-                exLinksBtn.addEventListener('click', (event) => {
-                shell.openExternal('https://electronjs.org')
-                })
-            
- -
-

ProTip

- Open all outbound links externally. -

- You may want to open all http and - https links outside of your app. To do this, query - the document and loop through each link and add a listener. This - app uses the code below which is located in - assets/ex-links.js. -

-
Renderer Process
-

-                const { shell } = require('electron')
-                const links = document.querySelectorAll('a[href]')
-                for (const link of links) {
-                    const url = link.getAttribute('href')
-                    if (url.indexOf('http') === 0) {
-                        link.addEventListener('click', (e) => {
-                            e.preventDefault()
-                            shell.openExternal(url)
-                        })
-                    }
-                }
-            
-
-
-
-
- - - - diff --git a/docs/fiddles/native-ui/external-links-file-manager/external-links/main.js b/docs/fiddles/native-ui/external-links-file-manager/external-links/main.js deleted file mode 100644 index d068254d1cdd..000000000000 --- a/docs/fiddles/native-ui/external-links-file-manager/external-links/main.js +++ /dev/null @@ -1,26 +0,0 @@ -const { app, BrowserWindow } = require('electron') - -let mainWindow = null - -function createWindow () { - const windowOptions = { - width: 600, - height: 400, - title: 'Open External Links', - webPreferences: { - contextIsolation: false, - nodeIntegration: true - } - } - - mainWindow = new BrowserWindow(windowOptions) - mainWindow.loadFile('index.html') - - mainWindow.on('closed', () => { - mainWindow = null - }) -} - -app.whenReady().then(() => { - createWindow() -}) diff --git a/docs/fiddles/native-ui/external-links-file-manager/external-links/renderer.js b/docs/fiddles/native-ui/external-links-file-manager/external-links/renderer.js deleted file mode 100644 index 8a9b14505a07..000000000000 --- a/docs/fiddles/native-ui/external-links-file-manager/external-links/renderer.js +++ /dev/null @@ -1,7 +0,0 @@ -const { shell } = require('electron') - -const exLinksBtn = document.getElementById('open-ex-links') - -exLinksBtn.addEventListener('click', (event) => { - shell.openExternal('https://electronjs.org') -}) diff --git a/docs/fiddles/native-ui/external-links-file-manager/path-in-file-manager/index.html b/docs/fiddles/native-ui/external-links-file-manager/path-in-file-manager/index.html deleted file mode 100644 index be6a38c9fa16..000000000000 --- a/docs/fiddles/native-ui/external-links-file-manager/path-in-file-manager/index.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - -
-
-

Open Path in File Manager

- Supports: Win, macOS, Linux | Process: Both -
-

This demonstrates using the shell module to open the system file manager at a particular location.

-

Clicking the demo button will open your file manager at the root.

-
- -
-
-
-
- - - \ No newline at end of file diff --git a/docs/fiddles/native-ui/external-links-file-manager/path-in-file-manager/main.js b/docs/fiddles/native-ui/external-links-file-manager/path-in-file-manager/main.js deleted file mode 100644 index c5901ffd223c..000000000000 --- a/docs/fiddles/native-ui/external-links-file-manager/path-in-file-manager/main.js +++ /dev/null @@ -1,26 +0,0 @@ -const { app, BrowserWindow } = require('electron') - -let mainWindow = null - -function createWindow () { - const windowOptions = { - width: 600, - height: 400, - title: 'Open Path in File Manager', - webPreferences: { - contextIsolation: false, - nodeIntegration: true - } - } - - mainWindow = new BrowserWindow(windowOptions) - mainWindow.loadFile('index.html') - - mainWindow.on('closed', () => { - mainWindow = null - }) -} - -app.whenReady().then(() => { - createWindow() -}) diff --git a/docs/fiddles/native-ui/external-links-file-manager/path-in-file-manager/renderer.js b/docs/fiddles/native-ui/external-links-file-manager/path-in-file-manager/renderer.js deleted file mode 100644 index 600045d1e047..000000000000 --- a/docs/fiddles/native-ui/external-links-file-manager/path-in-file-manager/renderer.js +++ /dev/null @@ -1,8 +0,0 @@ -const { shell } = require('electron') -const os = require('node:os') - -const fileManagerBtn = document.getElementById('open-file-manager') - -fileManagerBtn.addEventListener('click', (event) => { - shell.showItemInFolder(os.homedir()) -})