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

fix: 修复editable插件在点击换图时,出现的domain前缀未添加的问题 #497

Merged
merged 4 commits into from
Mar 24, 2023

Conversation

TwoKe945
Copy link

问题描述
在使用editable插件过程中,全局设置domain,点击图片换图时,没有添加domain,而是直接将请求的url直接返回。

修复对象
editable 插件 换图功能

修复方案
在getSrc('img', node.attrs.src || '')之前添加

const getImgUrl = (src) => {
  return this.root.domain ? (this.root.domain+src) : src
}

将返回的url进行封装

@jin-yufeng
Copy link
Owner

有道理👍
不过这个 getImgUrl 不能覆盖所有情况,比如 domain 的结尾和 src 的开头都没有 / 的话直接拼接就不是正确的链接了
建议参考 这里,引用这个 方法,大概这样

const parser = new Parser(this.root)
parser.getUrl(url)

另外 dist 目录下的可以不用修改,发布新版本时会自动更新

@TwoKe945
Copy link
Author

对的,就在想应该已有解析url的函数,只是没找到

@jin-yufeng jin-yufeng merged commit ca66d5e into jin-yufeng:master Mar 24, 2023
sonofmagic added a commit to sonofmagic/mp-html that referenced this pull request Jun 26, 2023
commit d67be37
Author: Jin Yufeng <1750665@tongji.edu.cn>
Date:   Sun May 14 21:00:47 2023 +0800

    release v2.4.2

commit 9acb1d3
Author: Jin Yufeng <1750665@tongji.edu.cn>
Date:   Sun May 14 20:06:00 2023 +0800

    修复了 editable 插件点击音视频时其他标签框不消失的问题

commit 09c8d42
Author: Jin Yufeng <1750665@tongji.edu.cn>
Date:   Sun May 14 19:39:26 2023 +0800

    editable 插件支持修改文字颜色 jin-yufeng#254

commit 0a18c02
Author: Jin Yufeng <1750665@tongji.edu.cn>
Date:   Sun May 14 11:47:55 2023 +0800

    修复了 uni-app 包使用旧版编译器可能报错的问题 jin-yufeng#472

commit 2d0821f
Author: Jin Yufeng <1750665@tongji.edu.cn>
Date:   Sat May 13 17:25:52 2023 +0800

    修复了 svg 中有 style 不生效的问题 jin-yufeng#505

commit 8e50ea7
Author: Jin Yufeng <1750665@tongji.edu.cn>
Date:   Sat May 13 16:20:05 2023 +0800

    修复了 uni-app 包 app 端可能出现无法读取 lazyLoad 的问题 jin-yufeng#513

commit 38402ca
Author: Jin Yufeng <1750665@tongji.edu.cn>
Date:   Sat May 13 15:32:39 2023 +0800

    修复了latex插件部分情况下不显示的问题 jin-yufeng#515

commit ca66d5e
Merge: c0b780b 380c674
Author: jin-yufeng <48236054+jin-yufeng@users.noreply.github.com>
Date:   Fri Mar 24 21:21:55 2023 +0800

    Merge pull request jin-yufeng#497 from TwoKe945/master

    fix: 修复editable插件在点击换图时,出现的domain前缀未添加的问题

commit 380c674
Author: TwoKe <twoke945@163.com>
Date:   Mon Mar 13 15:58:43 2023 +0800

    fix: 图片设置超链接以及预览图链接url转化

commit ebd1bba
Author: TwoKe <twoke945@163.com>
Date:   Sun Mar 12 23:01:07 2023 +0800

    fix: miniprogram平台node.js Parser引入路径错误

commit 4060075
Author: TwoKe <twoke945@163.com>
Date:   Sun Mar 12 22:57:23 2023 +0800

    chore: 更换getImgUrl为通用url解析函数Parser.getUrl

commit 467cc0f
Author: TwoKe <twoke945@163.com>
Date:   Sun Mar 12 21:09:38 2023 +0800

    fix: 修复editable插件在点击换图时,出现的domain前缀未添加的问题
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

Successfully merging this pull request may close these issues.

2 participants