Grapesjs 已选元素中的 Wrap 和 UnWrap 功能无法正常工作
问题
if(data.component.get('tagName') === 'img') {
const selectedComponent = editor.getSelected(); const href = this.getHref(); const childHtml ='<a href=“${href}”></a>' $('img#${selectedComponent.ccid}').wrap(childHtml);
data.component.view.render();
编辑。Modal.close(); }
回答(1)
相关问答
通过相似的问题讨论继续研究。
问题 #2308
创建图片链接后图片没有调整大小
'''let selectedComponent = editor.getSelected(); 令 href = this.getHref(); 令title = this.title; let childHtml ='<a id=“${selectedComponent.c...
问题 #5775
Component.get('traits').clone() 已不再可用。
葡萄JS版本 [X] 我确认使用最新版本的GrapesJS 你用的是什么浏览器? Arc 版本 1.35.0 / Chromium 引擎 123.0 可复制演示链接 https://grapesjs.com/demo.html 描述一下那个虫子 如何复现这个漏洞?开放开发工具选...
问题 #3247
问题:性状
你好@artf——你建造的东西非常壮观。这过程很温和,因为我远非JS高手。不过,我几乎所有配置都完成了——除了这个! 我想设置在选择图片时显示的特征(alt、src、id)。我相信初始化时可以完成一次,但我真不知道怎么做。我已经读遍了所有能找到的相关内容,但仍然卡住了。 我唯一...
问题 #3461
在选定组件上重新渲染特征
我知道有一个函数可以重新渲染一个特征的视图。 不过,我仍然不知道该怎么用,也不知道该在哪里使用。
与此问题匹配的付费插件
根据问题关键词和标签相关性精选,助你更快交付。
正在加载付费插件推荐……
相关教程
关于同一主题的深入指南。
教程
Vanilla GrapesJS vs GrapesJS With Plugins: What You Actually Get Out of the Box (2026)
New to GrapesJS? See exactly what the stock editor gives you, where it falls short, and which plugins close the gaps — a beginner-friendly 2026 comparison
教程
Lighthouse for GrapesJS: Audit Accessibility and SEO Without Leaving the Editor
Live WCAG 2.1/2.2 accessibility auditor + SEO manager for GrapesJS. Every finding is bound to the exact component — click to select, then one-click fix.
教程
GrapesJS DevTools: A Developer Panel Inside Your Editor
If you've ever debugged GrapesJS with console.log(editor.getSelected()) and a dozen throwaway event listeners — this post is for you.
浏览插件分类
直接跳转到市场上的插件分类页面。