问题:在选择某个类或 div 元素时,预定义的背景色。
你可以用一个简单的选择特性类型和颜色列表,并在颜色更改后更新它的样式。 这里有所有与你案件相关的例子:https://grapesjs.com/docs/modules/Traits.html
阅读下方完整回答 ↓问题
我有个问题,希望有人能帮忙。
我想做一个特性,让我在选择某个 div 的 div 时可以选择预定义的颜色。有人能帮我,如何简单地实现这个目标吗?
回答(2)
你可以用一个简单的选择特性类型和颜色列表,并在颜色更改后更新它的样式。 这里有所有与你案件相关的例子:https://grapesjs.com/docs/modules/Traits.html
谢谢你举报,@ikenderham。 关于问题:选择某个类或分元素时预定义的背景色,这是个很好的问题。GrapesJS 推荐的方法是使用事件驱动 API。 从这里开始: 查看你所在模块的[GrapesJS文档](https://grapesjs.com/docs/) 寻找“on()”事件监听器方法 大多数操作可以通过监听编辑器和组件事件来实现 常见模式: “JavaScript 留意变化 editor.on('change', () => console.log('something changed')); 组件生命周期 editor.on('component:mount', (c) =>...
相关问答
通过相似的问题讨论继续研究。
问题 #3365
图层名称范围上的contenteditable属性
你好@artf 我想知道为什么图层的名称范围会有一个“contenteditable”属性。 如果我没记错的话,grapesJs 上并没有实现任何机制,可以在刷新页面后真正更改图层名称。 这对用户来说可能会有点困惑。 '''html <div class=“gjs-layer-...
问题 #4921
[X] 我确认使用最新版本的GrapesJS
葡萄JS版本 [X] 我确认使用最新版本的GrapesJS 你用的是什么浏览器? Chrome 版本 110.0.5481.78(官方构建)(64 位) 可复制演示链接 https://grapesjs.com/demo.html 描述一下那个虫子 如何复现这个漏洞?安装带有n...
问题 #6654
富文本编辑器无法激活
GrapesJS版本 [x] 我确认使用最新版本的GrapesJS 你用的是什么浏览器? 铬V91 可复制演示链接 https://codepen.io/asenper/pen/QwNMwpV 描述一下那个虫子 我本以为点击文本时RTE会打开,但什么都没发生。 这是个bug,还...
问题 #3195
无法在 Grapesjs 下加载 JavaScript
Grapesjs面板下的JavaScript能加载吗?
与此问题匹配的付费插件
根据问题关键词和标签相关性精选,助你更快交付。
正在加载付费插件推荐……
相关教程
关于同一主题的深入指南。
教程
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.
教程
How to Build a Production GrapesJS Editor: The Complete Walkthrough of Brief, Preset, Plugins, and Services
A complete walkthrough of building a production GrapesJS editor: how to choose a preset, pick plugins, and scope setup services without burning a sprint.
教程
Big Updates: TinyMCE 8 and Placeholder 2.0 for GrapesJS
In May we shipped major updates to two of our most popular GrapesJS plugins — TinyMCE Inline Text Editor and Placeholder.
浏览插件分类
直接跳转到市场上的插件分类页面。