Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,9 @@ function Toolbar() {

### 跨组件状态访问

ReactFabricProvider 是一个上下文提供程序,允许您从组件树中的任何位置访问流的内部状态,例如子组件,甚至在 ReactFabric 之外 元件。它通常用于应用程序的顶层。
在这种情况下,您可能需要使用 ReactFabricProvider 组件

```tsx
import { ReactFabricProvider, useReactFabric } from '@cs-open/react-fabric'

Expand Down
6 changes: 6 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @cs-open/react-fabric

## 0.0.14

### Patch Changes

- sas

## 0.0.13

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@cs-open/react-fabric",
"type": "module",
"version": "0.0.13",
"version": "0.0.14",
"description": "React Fabric",
"keywords": [
"@cs-open/react-fabric",
Expand Down
6 changes: 4 additions & 2 deletions packages/react/src/components/BackgroundImage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const BackgroundImage = forwardRef<Handle, BackgroundImageProps>(
const backgroundImageRef = useRef<FabricImage | null>(null)

const store = useStoreApi()
const newestSrcRef = useRef(src)

const { width, height } = useStore(selector)

Expand Down Expand Up @@ -132,13 +133,14 @@ const BackgroundImage = forwardRef<Handle, BackgroundImageProps>(
}
const { domNode, setLoading } = store.getState()
setLoading(true)
newestSrcRef.current = src

FabricImage.fromURL(src, { crossOrigin: 'anonymous' })
.then(imageSource => {
onLoad?.(imageSource)
const currentSrc = imageSource.getSrc()
const latestSrc = backgroundImageRef.current?.getSrc()

if (latestSrc && currentSrc !== latestSrc) {
if (currentSrc !== newestSrcRef.current) {
return
}

Expand Down
6 changes: 6 additions & 0 deletions tooling/eslint-config/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @cs-open/eslint-config

## 0.0.11

### Patch Changes

- sas

## 0.0.10

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion tooling/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cs-open/eslint-config",
"version": "0.0.10",
"version": "0.0.11",
"private": true,
"license": "MIT",
"exports": {
Expand Down
6 changes: 6 additions & 0 deletions tooling/rollup-config/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @cs-open/rollup-config

## 0.0.11

### Patch Changes

- sas

## 0.0.10

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion tooling/rollup-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cs-open/rollup-config",
"version": "0.0.10",
"version": "0.0.11",
"private": true,
"license": "MIT",
"type": "module",
Expand Down
6 changes: 6 additions & 0 deletions tooling/tsconfig/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @cs-open/tsconfig

## 0.0.11

### Patch Changes

- sas

## 0.0.10

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion tooling/tsconfig/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cs-open/tsconfig",
"version": "0.0.10",
"version": "0.0.11",
"private": true,
"license": "MIT"
}