GrapesJS 删除了 HTML 属性
问题
你好,我从以下内容开始:
'<table style=“width:100%;height:100%” border=“1” data-template=“true”>' ... '<h4 data-fieldname=“dateEventoString” data-gjs-editable=“false” data-gjs-removable=“false” >' .... “</h4> ... “</table>
但当我用 editor.getHtml() 时,返回的 HTML 缺少了一些原始属性! 这里是返回的html:
'<table border=“1” data-template=“true” id=“i8wv”>' ... '<h4 data-fieldname=“dateEventoString”>' ... “</h4> ... “</table>
我需要 GrapesJS 保持属性不变,这可能吗?
谢谢, 沃尔特
回答(1)
相关问答
通过相似的问题讨论继续研究。
问题 #1661
我已经创建了 html 表格,但无法将新元素拖拽到表格单元格
你好。 如果我用下一块代码创建html表,一切都正常,比如我可以在任意单元格里插入一个引号: 但下一个代码生成的 HTML 表格却无法在单元格中添加新元素。我到底哪里做错了?
问题 #1949
启用 keepEmptyTextNodes 解析器选项后,拖曳的方块会被丢弃在目标位置之上
你好@artf, 按照你的建议,启用解析器中的“keepEmptyTextNodes”选项来修复我的#1915问题(标签间的葡萄色剥离 ),我们发现了以下(奇怪的)副作用,使用最新的0.14.57版本: 启用此选项后,在给定的HTML结构上拖放某些块(主要是table...
问题 #1620
无法在块内编辑文本
我写了一个插件,为一个简单的标题定义了一个新的块。 但是当我拖拽这个块到画布时,会出现占位文字“Text Here”,我无法编辑它。 我到底漏掉了什么?
问题 #1887
获取特定 gjs-data-type 的 JSON
我想导出只包含特定 gjs-data-type=“img” 的 JSON 我正在尝试,但没有任何结果:
与此问题匹配的付费插件
根据问题关键词和标签相关性精选,助你更快交付。
正在加载付费插件推荐……
相关教程
关于同一主题的深入指南。
教程
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.
浏览插件分类
直接跳转到市场上的插件分类页面。