
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
react-screenshots-mind
Advanced tools
基于react-screenshots的0.0.14版本修改
a picture clipping and graffiti tool by react
import React, { PureComponent } from 'react'
import Screenshot from 'react-screenshots'
import 'react-screenshots/dist/react-screenshots.css'
export default class App extends PureComponent {
state = {
width: window.innerWidth,
height: window.innerHeight
}
onSave = ({ viewer, dataURL }) => {
console.log('点击了保存按钮', dataURL, viewer)
}
onCancel = () => {
console.log('点击了取消按钮')
}
onOk = ({ dataURL, viewer }) => {
console.log('点击了确定按钮', dataURL, viewer)
}
render() {
const { width, height } = this.state
return (
<Screenshot
image="./demo.png"
width={width}
height={height}
onSave={this.onSave}
onCancel={this.onCancel}
onOk={this.onOk}
/>
)
}
}
require.resolve('react-screenshots/dist/index.html'),不推荐自己手动开发主进程,推荐直接使用electron-screenshots模块const $win = new BrowserWindow({
/** 窗口参数 */
})
// 加载页面
$win.loadURL(`file://${require.resolve('react-screenshots/dist/index.html')}`)
// 渲染进程页面加载后通知主进程
ipcMain.once('SCREENSHOTS::DOM-READY', () => {
// 发送需要截取的屏幕信息
// display = {
// id, // 屏幕id
// x, // 屏幕位置和大小
// y,
// width,
// height
// }
$win.webContents.send('SCREENSHOTS::SEND-DISPLAY-DATA', display)
})
// 渲染进程完成桌面快照捕捉之后的回调
// 通常在这个事件之后再显示窗口,避免截图窗口自己被截图
ipcMain.once('SCREENSHOTS::CAPTURED', () => {
$win.show()
$win.focus()
})
// 点击保存按钮事件
ipcMain.on('SCREENSHOTS::SAVE', (e, data) => {})
// 点击取消按钮事件
ipcMain.on('SCREENSHOTS::CANCEL', e => {})
// 点击确定按钮事件
ipcMain.on('SCREENSHOTS::OK', (e, data) => {})
interface Bounds {
x1: number
y1: number
x2: number
y2: number
}
interface Data {
dataURL: string // 图片资源base64
bounds: Bounds // 截图区域坐标信息
}
| 名称 | 说明 | 类型 |
|---|---|---|
| image | 要编辑的图像资源地址 | string |
| width | 画布宽度 | number |
| height | 画布宽度 | number |
| onSave | 保存按钮回调 | function (data:Data):void {} |
| onCancel | 取消按钮回调 | function ():void {} |
| onOk | 取消按钮回调 | function (data:Data):void {} |
import React from 'react'
function App() {
return (
<Screenshot
image="./example.png"
width={window.innerWidth}
height={window.innerHeight}
onSave={() => {}}
onCancel={() => {}}
onOk={() => {}}
/>
)
}

FAQs
a picture clipping and graffiti tool by react
The npm package react-screenshots-mind receives a total of 2 weekly downloads. As such, react-screenshots-mind popularity was classified as not popular.
We found that react-screenshots-mind demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.