Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何重写编辑器 engine.request.upload 方法 #375

Open
tenglongwentian opened this issue Mar 25, 2024 · 10 comments
Open

如何重写编辑器 engine.request.upload 方法 #375

tenglongwentian opened this issue Mar 25, 2024 · 10 comments

Comments

@tenglongwentian
Copy link

如何重写编辑器 engine.request.upload 方法

@big-camel
Copy link
Member

@tenglongwentian
Copy link
Author

https://editor.aomao.com/config/upload

这个今天凌晨的时候看了,参考单个插件上传“以 ImageUploader 为例”,其中在“handleUpload”中植入了外部上传组件触发逻辑,但是却没有阻止默认的原有逻辑机制,比如两次弹出文件选择对话框,而且植入的外置组件是异步分块上传的,上传结果不会马上返回。

@big-camel
Copy link
Member

big-camel commented Mar 25, 2024 via email

@tenglongwentian
Copy link
Author

全局的也在文档那个下方------------------------------------------------------------------ @.> 日 期:2024年03月25日 20:37:33 @.> @.>; @.> 主 题:Re: [red-axe/am-editor] 如何重写编辑器 engine.request.upload 方法 (Issue #375) https://editor.aomao.com/config/upload 这个今天凌晨的时候看了,参考单个插件上传“以 ImageUploader 为例”,其中在“handleUpload”中植入了外部上传组件触发逻辑,但是却没有阻止默认的原有逻辑机制,比如两次弹出文件选择对话框,而且植入的外置组件是异步分块上传的,上传结果不会马上返回。 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

看到这个了https://editor.aomao.com/zh-CN/config/upload#%E5%85%A8%E5%B1%80%E4%B8%8A%E4%BC%A0
但是属实没看懂,重写后咋植入生效,重新创建一个ts文件然后参考植入?

@big-camel
Copy link
Member

big-camel commented Mar 25, 2024 via email

@tenglongwentian
Copy link
Author

如果你有仔细看会发现在 setGlobalUpload 方法里面 有 engine.request.upload = async ... 的覆盖操作------------------------------------------------------------------ @.> 日 期:2024年03月25日 20:43:42 @.> @.>; @.> 主 题:Re: [red-axe/am-editor] 如何重写编辑器 engine.request.upload 方法 (Issue #375) 全局的也在文档那个下方------------------------------------------------------------------ @.> 日 期:2024年03月25日 20:37:33 @.> @.>; @.> 主 题:Re: [red-axe/am-editor] 如何重写编辑器 engine.request.upload 方法 (Issue #375) https://editor.aomao.com/config/upload 这个今天凌晨的时候看了,参考单个插件上传“以 ImageUploader 为例”,其中在“handleUpload”中植入了外部上传组件触发逻辑,但是却没有阻止默认的原有逻辑机制,比如两次弹出文件选择对话框,而且植入的外置组件是异步分块上传的,上传结果不会马上返回。 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.> 看到这个了https://editor.aomao.com/zh-CN/config/upload#%E5%85%A8%E5%B1%80%E4%B8%8A%E4%BC%A0 但是属实没看懂,重写后咋植入生效,重新创建一个ts文件然后参考植入? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.>

image
这段并未输出console.log('setGlobalUpload', engine)
image
这个是触发外置上传组件

@big-camel
Copy link
Member

big-camel commented Mar 25, 2024 via email

@tenglongwentian
Copy link
Author

这个只是个自定义方法,你要自己调用------------------------------------------------------------------ @.> 日 期:2024年03月25日 20:53:13 @.> @.>; @.> 主 题:Re: [red-axe/am-editor] 如何重写编辑器 engine.request.upload 方法 (Issue #375) 如果你有仔细看会发现在 setGlobalUpload 方法里面 有 engine.request.upload = async ... 的覆盖操作------------------------------------------------------------------ @.> 日 期:2024年03月25日 20:43:42 @.> @.>; @.> 主 题:Re: [red-axe/am-editor] 如何重写编辑器 engine.request.upload 方法 (Issue #375) 全局的也在文档那个下方------------------------------------------------------------------ @.> 日 期:2024年03月25日 20:37:33 @.> @.>; @.> 主 题:Re: [red-axe/am-editor] 如何重写编辑器 engine.request.upload 方法 (Issue #375) https://editor.aomao.com/config/upload 这个今天凌晨的时候看了,参考单个插件上传“以 ImageUploader 为例”,其中在“handleUpload”中植入了外部上传组件触发逻辑,但是却没有阻止默认的原有逻辑机制,比如两次弹出文件选择对话框,而且植入的外置组件是异步分块上传的,上传结果不会马上返回。 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.> 看到这个了https://editor.aomao.com/zh-CN/config/upload#%E5%85%A8%E5%B1%80%E4%B8%8A%E4%BC%A0 但是属实没看懂,重写后咋植入生效,重新创建一个ts文件然后参考植入? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.> image.png (view on web) 这段并未输出console.log('setGlobalUpload', engine) image.png (view on web) 这个是触发外置上传组件 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

咋调用o(╥﹏╥)o

@big-camel
Copy link
Member

import CustomUpload from './xxxx'

const customUpload = new CustomUpload()
customUpload.setGlobalUpload(engine)

@tenglongwentian
Copy link
Author

import CustomUpload from './xxxx'

const customUpload = new CustomUpload() customUpload.setGlobalUpload(engine)

自定义图片上传组件,实现了自定义图片文件上传。组件级别的,上传每个都需要重写吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants