Init() 方法类型错误
问题
葡萄JS版本
- 我确认使用最新版本的GrapesJS
你用的是什么浏览器?
Chrome v 100.0.4896.75
可复制演示链接
https://stackblitz.com/edit/typescript-ou8qpc?file=index.ts&view=editor
描述一下那个虫子
如何复现这个漏洞?
- 尝试用葡萄开头index.d.ts
预期的行为是什么? 编辑器初始化时无错误
目前的行为是什么? 'Type'[字符串, 任意]' 不可分配到类型 '[]'。 Source有2个元素,但目标只允许0'
行为准则
- 我同意遵守本项目的行为准则
回答(2)
谢谢@dinosaurawr在这里解决了这个问题 https://github.com/artf/grapesjs/pull/4216/files
谢谢你举报,@dinosaurawr。 关于init()方法类型错误的建议很棒!虽然这个具体功能还没有出现在核心 API 中,但有几种方法可以实现类似的行为。 使用事件系统: “JavaScript editor.on('component:update', (component) => { 你的逻辑 }); ``` 替代方法: 听取“selector:add”以获取CSS选择器更改 使用“selector:custom”来表示自定义规则 利用“change:*”事件进行细致跟踪 构建一个插件,扩展编辑器并具备此功能 正式宣布: 如果此功能能惠及更多用户,考虑在 GrapesJS 仓库上正式...
相关问答
通过相似的问题讨论继续研究。
问题 #4940
销毁并重新初始化时,会出现“无法读取未定义属性(读取'get')”。
葡萄JS版本 [X] 我确认使用最新版本的GrapesJS 你用的是什么浏览器? Google Chrome 版本 110.0.5481.100(官方版本)(64 位) 可复制演示链接 https://stackblitz.com/edit/js-3urscf?file=ind...
问题 #4654
文本节点自定义组件,包含特殊字符
葡萄JS版本 [X] 我确认使用最新版本的GrapesJS 你用的是什么浏览器? Chrome v105 可复制演示链接 https://codesandbox.io/s/fancy-brook-ppyc8v?file=/index.js 描述一下那个虫子 背景: 我正在尝试配...
问题 #6603
属性值中不逃避 & 符号
GrapesJS版本 [x] 我确认使用最新版本的GrapesJS 你用的是什么浏览器? Chrome v142.0.7392.0 (canary) 可复制演示链接 https://jsfiddle.net/xce183nm/1/ 描述一下那个虫子 如何复现这个漏洞? 创建一个...
问题 #3939
在预览中禁用拖放功能
葡萄JS版本[X] 我确认使用最新版本的GrapesJS你用的是什么浏览器? 第95卷可复制演示链接 https://codesandbox.io/s/grapes-border-issue-forked-2c0ib?file=/src/index.js:10258-10261...
与此问题匹配的付费插件
根据问题关键词和标签相关性精选,助你更快交付。
正在加载付费插件推荐……
相关教程
关于同一主题的深入指南。
教程
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.
浏览插件分类
直接跳转到市场上的插件分类页面。