Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Incorrect type definition for PanelManager.addPanel #5144

Closed
2 tasks done
duclet opened this issue May 25, 2023 · 2 comments
Closed
2 tasks done

BUG: Incorrect type definition for PanelManager.addPanel #5144

duclet opened this issue May 25, 2023 · 2 comments

Comments

@duclet
Copy link

duclet commented May 25, 2023

GrapesJS version

  • I confirm to use the latest version of GrapesJS

What browser are you using?

All

Reproducible demo link

None

Describe the bug

The definition of the function located here: https://github.com/GrapesJS/grapesjs/blob/v0.21.1/src/panels/index.ts#L82 requires the data given as the full panel instance itself or an array of properties. The documentation on the site (https://grapesjs.com/docs/getting-started.html#panels-buttons) says the parameters given can be only an object with the properties (essentially a partial of the attributes of a panel).

Code of Conduct

  • I agree to follow this project's Code of Conduct
@artf
Copy link
Member

artf commented May 27, 2023

The documentation on the site says the parameters given can be only an object with the properties

Sorry, where exactly do you read that statement?

@duclet
Copy link
Author

duclet commented Jun 13, 2023

@artf - You didn't read the full sentence. You can clearly see in the code itself, it requires the argument given as the full Panel object. In your docs (as linked), you are not giving it the full Panel object in the example, but rather just an object with those projects. Your example is the following:

editor.Panels.addPanel({
  id: 'panel-top',
  el: '.panel__top',
});

Which TypeScript will complain about because the object given to it isn't an instance of a Panel nor is it an array of the object's properties.

artf added a commit that referenced this issue Jun 15, 2023
artf added a commit that referenced this issue Jul 4, 2023
* Add autoFormat option to CodeMirrorEditor

* Add optsCodeViewer

* Remove unused options

* Use createViewer in ExportTemplate

* Up ExportTemplate

* Cleanup

* Up panel/index to TS

* Refactor Panels TS #5144

* Cleanup

* Up panels test

* Fix `usePlugin is not a function`. Closes #5167

* Move css_composer/index to TS

* Up css_composer tests

* Up tests

* Add `addStyles` option to `editor.Css.setRule`. Closes #5173

* Update setRule JSDoc

* Fix PropertyStack in bundled dts file. Closes #5154

* Fixed broken link in README.md (#5188)

Update README.md

added ".com" in a not functioning link.

* Refactor Traits Collection (#4983)

* Refactor Traits Collection

* Fix css prefix

* Fix trait undo and add test for it

---------

Co-authored-by: Artur Arseniev <artur.catch@hotmail.it>

* Update keymaps add jsdoc

* Improve typings (#5192)

* add component:resize to ComponentEvent type

* limit storageManager type to be 'local' | 'remote' | undefined

* add type to components parameter

* Use LiteralUnion in storage_manager config

* Up editor TS

* Improve components TS

* Update ComponentModelDefinition

* [Docs] Update Broken Links for (Component Types, and Commands) (#5196)

update links

* Don't remove styles with avoidInlineStyle #4503

* Up block_manager

* Up device_manager

* Up pages TS

* Add PageProperties

* Update PageManager TS

* Export Sector/s in TS

* Up style_manager TS

* Up Property TS

* Up TS

* Up TS

* Up canvas class

* Fix SwitchVisibility

* Store custom selector manager container

* Refactor OpenStyleManager

* Up OpenStyleManager

* Up OpenStyleManager

* Up selector_manager

* Add custom option to trait_manager

* Up trait model

* Up OpenTraitManager for custom traits

* Up

* Handle properly Component model `defaults` as functions. Closes #5199

* Fix PropertyFactory tests

* Up RTE doc

* Update rich_text_editor.md (#5201)

The previous code snippet encountered a syntax error when attempting to use it in my application. To ensure its usability for others, I have made necessary updates to resolve the syntax error and enable successful execution. These modifications aim to provide a code snippet that can be easily utilized by anyone without encountering any syntax-related issues.

* Build

* Up docs

---------

Co-authored-by: pfaffmann <48207288+pfaffmann@users.noreply.github.com>
Co-authored-by: Alex Ritter <ritt.alex@gmail.com>
Co-authored-by: Julia Alberici <julia.jpa0@gmail.com>
Co-authored-by: Abdelrhman Said <70618755+AbdelrhmanSaid@users.noreply.github.com>
Co-authored-by: Ai Anshu <68537640+gxanshu@users.noreply.github.com>
pety-dc pushed a commit to d-code-ltd/grapesjs that referenced this issue Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants