无法在 Grapesjs 下加载 JavaScript
你好@henry930, 我通过开发一个装弹器解决了这个问题。 “''js let editorConfig = { 你的配置 } 设编辑器 = false; 函数 editorLoad(){ $(editorConfig.container).empty();与JQuery合作 editor = grapesjs.init(editorConfig); editor.load(); } editorLoad(); 你的编辑器会重新加载。你的html、css......将会留下。
阅读下方完整回答 ↓问题
Grapesjs面板下的JavaScript能加载吗?
回答(4)
你好@henry930, 我通过开发一个装弹器解决了这个问题。 “''js let editorConfig = { 你的配置 } 设编辑器 = false; 函数 editorLoad(){ $(editorConfig.container).empty();与JQuery合作 editor = grapesjs.init(editorConfig); editor.load(); } editorLoad(); 你的编辑器会重新加载。你的html、css......将会留下。
我不明白四年过去了,为什么它还不支持导入用JavaScript渲染的单个HTML文件?大多数造型都非常不对劲
谢谢你举报,@henry930。 关于无法在Grapesjs下加载JavaScript的好问题。GrapesJS 推荐的方法是使用事件驱动 API。 从这里开始: 查看你所在模块的[GrapesJS文档](https://grapesjs.com/docs/) 寻找“on()”事件监听器方法 大多数操作可以通过监听编辑器和组件事件来实现 常见模式: “JavaScript 留意变化 editor.on('change', () => console.log('something changed')); 组件生命周期 editor.on('component:mount', (c) => co...
相关问答
通过相似的问题讨论继续研究。
问题 #6092
@artf,我有个问题,我们能在Studio里实现自定义JS吗?意思是,有嵌入的 JavaScript 代码功能吗?
@artf,我有个问题,我们能在Studio里实现自定义JS吗?意思是,有嵌入的 JavaScript 代码功能吗? Originally由@MdShadabAhamad在 https://github.com/GrapesJS/grapesjs/discussions/608...
问题 #6654
富文本编辑器无法激活
GrapesJS版本 [x] 我确认使用最新版本的GrapesJS 你用的是什么浏览器? 铬V91 可复制演示链接 https://codepen.io/asenper/pen/QwNMwpV 描述一下那个虫子 我本以为点击文本时RTE会打开,但什么都没发生。 这是个bug,还...
问题 #3250
问题:图层标签
@artf我很喜欢和GJS合作。我还有最后一件事希望你能帮忙。 如果能在图层管理器中自定义标签会非常有帮助。我到处找过,但都没找到。 默认显示“文本”和“框”的方式,对于想要高效导航来说帮助不大。 <img width=“204” alt=“截图 2021-01-28 07 2...
问题 #6180
Trait 的“setValue()”方法在值变更时不会被调用
葡萄JS版本 [X] 我确认使用最新版本的GrapesJS 你用的是什么浏览器? Chrome最新款 可复制演示链接 https://codesandbox.io/p/sandbox/withered-rgb-xmw8gk 描述一下那个虫子 如何复现这个漏洞?开放代码沙盒选择“...
与此问题匹配的付费插件
根据问题关键词和标签相关性精选,助你更快交付。
正在加载付费插件推荐……
相关教程
关于同一主题的深入指南。
教程
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.
浏览插件分类
直接跳转到市场上的插件分类页面。