1
0
mirror of https://github.com/S2-/gitlit synced 2025-08-03 12:50:04 +02:00

fix search window

This commit is contained in:
s2
2019-06-06 15:56:42 +02:00
parent c5f9b551ab
commit 1313cff86a
21 changed files with 1297 additions and 0 deletions

14
app/node_modules/electron-find/example/example.css generated vendored Normal file
View File

@@ -0,0 +1,14 @@
html,
body{
margin: 0;
padding: 0;
box-sizing: border-box;
overflow: auto;
}
section{
padding: 10px 20px;
}
h3{
margin-top: 30px;
}

26
app/node_modules/electron-find/example/example.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
const { remote, ipcRenderer } = require('electron')
const { FindInPage } = require('../src/index.js')
let findInPage = new FindInPage(remote.getCurrentWebContents(), {
preload: true,
offsetTop: 6,
offsetRight: 10
})
// let findInPage = new FindInPage(remote.getCurrentWebContents(), {
// boxBgColor: '#333',
// boxShadowColor: '#000',
// inputColor: '#aaa',
// inputBgColor: '#222',
// inputFocusColor: '#555',
// textColor: '#aaa',
// textHoverBgColor: '#555',
// caseSelectedColor: '#555',
// offsetTop: 8,
// offsetRight: 12
// })
ipcRenderer.on('on-find', (e, args) => {
findInPage.openFindWindow()
})

54
app/node_modules/electron-find/example/index.html generated vendored Normal file
View File

@@ -0,0 +1,54 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Example</title>
<link rel="stylesheet" type="text/css" href="./example.css">
</head>
<body>
<section>
<h3>关于 Electron</h3>
<p>
Electron是由Github开发用HTMLCSS和JavaScript来构建跨平台桌面应用程序的一个开源库。
</p>
<p>
Electron通过将Chromium和Node.js合并到同一个运行时环境中并将其打包为MacWindows和Linux系统下的应用来实现这一目的。
</p>
<p>
Electron于2013年作为构建Github上可编程的文本编辑器Atom的框架而被开发出来。这两个项目在2014春季开源。
</p>
<p>
目前它已成为开源开发者、初创企业和老牌公司常用的开发工具。
</p>
<h3>长期支持</h3>
<p>
当前并不存在对Electron旧版本的长期支持
</p>
<p>
如果现在你使用的Electron版本跑得不错你就可以一直使用这个版本。
</p>
<p>
如果你想使用新发布的特性,那就升级到更新的版本。
</p>
<p>
版本v1.0.0发布了重大的更新。 如果你现在没有在用这个版本你应该了解更多关于v1.0.0的改变。
</p>
<h3>核心理念</h3>
<p>
为了保持Electron的小巧 (文件体积) 和可持续性开发 (以防依赖库和API的泛滥) Electron限制了所使用的核心项目的数量。
</p>
<p>
比如Electron只用了Chromium的渲染库而不是其全部组件。
</p>
<p>
这使得升级Chromium更加容易但也意味着Electron缺少了Google Chrome里的一些浏览器相关的特性
</p>
<p>
添加到Electron的新功能应该主要是原生 API。 如果可以的话一个功能应该尽可能的成为一个Node.js模块。
</p>
</section>
<script src="example.js"></script>
</body>
</html>

47
app/node_modules/electron-find/example/main.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
const electron = require('electron')
const { app, BrowserWindow, globalShortcut } = electron
const path = require('path')
let win
const winURL = 'file://' + path.normalize(`${__dirname}/index.html`)
function createWindow () {
win = new BrowserWindow({
width: 1280,
height: 1040,
center: false,
webPreferences: {
nodeIntegration: true,
plugins: true,
}
})
win.loadURL(winURL)
//win.webContents.openDevTools()
win.on('closed', () => {
win = null
})
win.on('focus', () => {
globalShortcut.register('CommandOrControl+F', function () {
if (win && win.webContents) {
win.webContents.send('on-find', '')
}
})
})
win.on('blur', () => {
globalShortcut.unregister('CommandOrControl+F')
})
}
app.on('ready', createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
globalShortcut.unregister('CommandOrControl+F')
})
app.on('activate', () => {
if (win === null) createWindow()
})