Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Five-菜鸟级
NodeJS_668036
提交
8be18dd8
N
NodeJS_668036
项目概览
Five-菜鸟级
/
NodeJS_668036
与 Fork 源项目一致
Fork自
inscode / NodeJS
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
NodeJS_668036
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
8be18dd8
编写于
2月 14, 2025
作者:
Q
qq_41923622
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fri Feb 14 13:04:00 CST 2025 inscode
上级
7ac2f57f
变更
6
展开全部
显示空白变更内容
内联
并排
Showing
6 changed file
with
476 addition
and
1857 deletion
+476
-1857
demos/Basic.tsx
demos/Basic.tsx
+51
-0
dist2/tiny-image-editor.min.css
dist2/tiny-image-editor.min.css
+1
-272
dist2/tiny-image-editor.min.js
dist2/tiny-image-editor.min.js
+420
-1581
src/tiny-image-editor/src/components/Download.tsx
src/tiny-image-editor/src/components/Download.tsx
+2
-2
src/tiny-image-editor/src/components/Upload.tsx
src/tiny-image-editor/src/components/Upload.tsx
+1
-2
src/tiny-image-editor/src/util.ts
src/tiny-image-editor/src/util.ts
+1
-0
未找到文件。
demos/Basic.tsx
浏览文件 @
8be18dd8
import
React
,
{
useRef
}
from
'
react
'
;
import
{
Editor
}
from
'
tiny-image-editor
'
;
import
image
from
'
./basic.jpg
'
;
//
const
Demo
=
()
=>
{
const
EditorRefID
=
useRef
<
HTMLCanvasElement
>
(
null
);
setTimeout
(()
=>
{
console
.
log
(
`dddd`
,
EditorRefID
);
const
handleUpload
=
EditorRefID
?.
current
?.
uploadRef
?.
current
?.
handleUpload
;
handleUpload
(
'
https://erp-new.cdn.yingtaoyun.com/flw/1784/Q2406170015/jx/1241858/TY990010.jpg!w320
'
)
},
1000
)
setTimeout
(()
=>
{
const
handleUpload
=
EditorRefID
?.
current
?.
uploadRef
?.
current
?.
handleUpload
;
const
xhr
=
new
XMLHttpRequest
();
// 要请求的 URL
const
url
=
'
https://vercel-api.fivecc.cn/api/annotation
'
;
xhr
.
open
(
'
GET
'
,
url
,
true
);
xhr
.
onreadystatechange
=
function
()
{
if
(
xhr
.
readyState
===
4
)
{
if
(
xhr
.
status
===
200
)
{
const
responseData
=
JSON
.
parse
(
xhr
.
responseText
);
console
.
log
(
`asd`
,
responseData
)
Object
.
keys
(
responseData
.
data
).
forEach
((
k
)
=>
{
let
itemObj
=
responseData
.
data
[
k
]
handleUpload
(
itemObj
.
imgUrl
,
itemObj
)
})
}
else
{
resultDiv
.
textContent
=
`Error:
${
xhr
.
status
}
`
;
}
}
};
xhr
.
send
();
},
6000
)
return
(
<
div
style
=
{
{
width
:
"
100%
"
,
height
:
"
100%
"
}
}
>
<
Editor
ref
=
{
EditorRefID
}
url
=
{
image
}
/>
</
div
>
);
};
export
default
Demo
;
dist2/tiny-image-editor.min.css
浏览文件 @
8be18dd8
此差异已折叠。
点击以展开。
dist2/tiny-image-editor.min.js
浏览文件 @
8be18dd8
此差异已折叠。
点击以展开。
src/tiny-image-editor/src/components/Download.tsx
浏览文件 @
8be18dd8
...
@@ -3,7 +3,7 @@ import { IMAGE_NAME, LANG, MENU_TYPE_TEXT } from '../constants';
...
@@ -3,7 +3,7 @@ import { IMAGE_NAME, LANG, MENU_TYPE_TEXT } from '../constants';
import
{
EditorContext
,
base64ToBlob
,
isSupportFileApi
}
from
'
../util
'
;
import
{
EditorContext
,
base64ToBlob
,
isSupportFileApi
}
from
'
../util
'
;
import
Popover
from
'
./setting/Popover
'
;
import
Popover
from
'
./setting/Popover
'
;
function
extractImageNames
(
str
)
{
function
extractImageNames
(
str
:
any
)
{
// 定义更通用的正则表达式
// 定义更通用的正则表达式
const
regex
=
/
([^\/
!
]
+
?)\.(?:
jpeg|jpg|png|gif|bmp
)(?![^
!
]
*
\.)
/gi
;
const
regex
=
/
([^\/
!
]
+
?)\.(?:
jpeg|jpg|png|gif|bmp
)(?![^
!
]
*
\.)
/gi
;
const
matches
=
[];
const
matches
=
[];
...
@@ -25,7 +25,7 @@ const useDownload = () => {
...
@@ -25,7 +25,7 @@ const useDownload = () => {
// 获取画布上的所有元素
// 获取画布上的所有元素
const
allObjects
=
canvas
.
getObjects
();
const
allObjects
=
canvas
.
getObjects
();
// 存储标注信息的数组
// 存储标注信息的数组
const
annotations
=
[];
const
annotations
:[]
=
[];
function
getDeviceId
()
{
function
getDeviceId
()
{
let
deviceId
=
localStorage
.
getItem
(
'
deviceId
'
);
let
deviceId
=
localStorage
.
getItem
(
'
deviceId
'
);
...
...
src/tiny-image-editor/src/components/Upload.tsx
浏览文件 @
8be18dd8
...
@@ -14,7 +14,6 @@ function annotationsInit(imgData, canvas, historyRef, positionInfo) {
...
@@ -14,7 +14,6 @@ function annotationsInit(imgData, canvas, historyRef, positionInfo) {
// 遍历标注信息,重新创建元素并添加到画布上
// 遍历标注信息,重新创建元素并添加到画布上
imgData
.
annotations
.
forEach
((
annotation
)
=>
{
imgData
.
annotations
.
forEach
((
annotation
)
=>
{
let
newObject
;
let
newObject
;
switch
(
annotation
.
type
)
{
switch
(
annotation
.
type
)
{
case
'
rect
'
:
case
'
rect
'
:
newObject
=
new
fabric
.
Rect
({
newObject
=
new
fabric
.
Rect
({
...
@@ -157,7 +156,7 @@ export const useUpload = () => {
...
@@ -157,7 +156,7 @@ export const useUpload = () => {
});
});
return
;
return
;
},
{
},{
newLeft
,
newLeft
,
newTop
,
newTop
,
newScaleFactor
,
newScaleFactor
,
...
...
src/tiny-image-editor/src/util.ts
浏览文件 @
8be18dd8
...
@@ -23,6 +23,7 @@ export interface IEditorContextProps extends IEditorProps {
...
@@ -23,6 +23,7 @@ export interface IEditorContextProps extends IEditorProps {
imageUrl
:
string
,
imageUrl
:
string
,
justBackground
:
boolean
,
justBackground
:
boolean
,
callback
?:
()
=>
void
,
callback
?:
()
=>
void
,
annotationsData
?:
any
)
=>
void
;
)
=>
void
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录