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

改善图片预览 #1220

Open
de1ck opened this issue May 6, 2022 · 5 comments
Open

改善图片预览 #1220

de1ck opened this issue May 6, 2022 · 5 comments
Assignees
Milestone

Comments

@de1ck
Copy link

de1ck commented May 6, 2022

PreviewImage 没有提供缩等功能,可不可以提供一个开关用于关闭默认previewImage的功能,目前是通过css隐藏

@Vanessa219
Copy link
Owner

看需求,如果优化图片预览功能,关闭就应该不需要了吧?

@de1ck
Copy link
Author

de1ck commented May 6, 2022

看需求,如果优化图片预览功能,关闭就应该不需要了吧?

编辑模式下,默认是开启图片预览功能的,而且我没有找到关闭入口

@Vanessa219
Copy link
Owner

那就加强一下图片预览功能吧

@Vanessa219 Vanessa219 changed the title previewImage options 改善图片预览 May 16, 2022
@Vanessa219 Vanessa219 self-assigned this May 16, 2022
@Vanessa219 Vanessa219 added this to the 3.8 milestone May 16, 2022
@Vanessa219 Vanessa219 modified the milestones: 3.8, 3.9 Oct 23, 2022
heiyehk added a commit to heiyehk/vditor that referenced this issue Jan 7, 2023
- Vanessa219#1220 改善图片预览问题,增加options->preview->showImage: boolean控制是否双击预览
- 增加options->previewImage函数获取触发的图片节点,参数img: HTMLImageElement

链接相关
- 增加options-> link属性,options->open: boolean控制点击打开链接,intercept函数控制点击的链接,参数 url: string
Vanessa219 pushed a commit that referenced this issue Jan 15, 2023
* feat: 图片相关
- #1220 改善图片预览问题,增加options->preview->showImage: boolean控制是否双击预览
- 增加options->previewImage函数获取触发的图片节点,参数img: HTMLImageElement

链接相关
- 增加options-> link属性,options->open: boolean控制点击打开链接,intercept函数控制点击的链接,参数 url: string

* style: 回滚主分支的代码格式

* refactor: 重新对link的触发函数命名

* docs: 增加对img和link的readme
@ryanlin1986
Copy link

image

是这个吗?可以关闭预览,我们的场景有特殊需求,项目中内置了高级图片预览所以通过这个把内置的给禁用掉。

@Vanessa219
Copy link
Owner

会先判断 preview 方法,然后再判断是否启用。

           if (vditor.options.image.preview) {
                vditor.options.image.preview(event.target);
            } else if (vditor.options.image.isPreview) {
                previewImage(event.target as HTMLImageElement, vditor.options.lang, vditor.options.theme);
            }

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

No branches or pull requests

3 participants