{"id":15644813,"url":"https://github.com/bgrand-ch/grapesjs-float","last_synced_at":"2025-04-30T10:17:57.581Z","repository":{"id":214372079,"uuid":"735967211","full_name":"bgrand-ch/grapesjs-float","owner":"bgrand-ch","description":"GrapesJS float plugin with Floating UI","archived":false,"fork":false,"pushed_at":"2024-02-19T07:39:18.000Z","size":85,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-30T10:17:42.887Z","etag":null,"topics":["float","floating","floating-ui","gjs","grapesjs","grapesjs-plugin","plugin","positioning"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bgrand-ch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-26T15:45:26.000Z","updated_at":"2024-05-24T13:30:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"6a69fc76-e22c-4951-b9c4-9c87868eca05","html_url":"https://github.com/bgrand-ch/grapesjs-float","commit_stats":{"total_commits":15,"total_committers":1,"mean_commits":15.0,"dds":0.0,"last_synced_commit":"995a583ebe216a2da712880a66f3700f0c25552f"},"previous_names":["bgrand-ch/grapesjs-float"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgrand-ch%2Fgrapesjs-float","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgrand-ch%2Fgrapesjs-float/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgrand-ch%2Fgrapesjs-float/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgrand-ch%2Fgrapesjs-float/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bgrand-ch","download_url":"https://codeload.github.com/bgrand-ch/grapesjs-float/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251683380,"owners_count":21626956,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["float","floating","floating-ui","gjs","grapesjs","grapesjs-plugin","plugin","positioning"],"created_at":"2024-10-03T12:02:33.334Z","updated_at":"2025-04-30T10:17:57.558Z","avatar_url":"https://github.com/bgrand-ch.png","language":"TypeScript","funding_links":["https://opencollective.com/floating-ui"],"categories":[],"sub_categories":[],"readme":"# GrapesJS float plugin with Floating UI\n\n\u003e `grapesjs-float` plugin is not an official Floating UI plugin and is not maintained by the Floating UI team. If you use `grapesjs-float` plugin, please [donate to Floating UI](https://opencollective.com/floating-ui).\n\n## Installation\n\n```shell\nnpm install grapesjs grapesjs-float @floating-ui/dom\n```\n\n## Usage\n\n### JavaScript\n\n```js\nimport grapesjs from 'grapesjs'\nimport grapesjsFloat from 'grapesjs-float'\n\nconst pluginOptions = {\n  floatingElement: HTMLElement // optional, if specified in \"float:show-element\" command options\n}\nconst editor = grapesjs.init({\n  // ...\n  plugins: [\n    grapesjsFloat\n  ],\n  pluginOpts: {\n    [grapesjsFloat]: pluginOptions\n  }\n  // ...\n})\n```\n\n### TypeScript\n\n```ts\nimport grapesjs, { usePlugin } from 'grapesjs'\nimport grapesjsFloat from 'grapesjs-float'\n\nimport type { PluginOptions, CommandOptions } from 'grapesjs-float'\n\nconst pluginOptions: PluginOptions = {\n  floatingElement: HTMLElement // optional, if specified in \"float:show-element\" command options\n}\nconst editor = grapesjs.init({\n  // ...\n  plugins: [\n    usePlugin(grapesjsFloat, pluginOptions)\n  ]\n  // ...\n})\n```\n\n## Commands\n\n```ts\n// Your reference HTML element.\nconst selectedEl = editor.getSelected()?.getEl()\n\n// Your floating HTML element.\nconst floatingEl = document.getElementById('floating-element')\n```\n\n\u003e Full demonstration in the [`src/example.ts`](https://github.com/bgrand-ch/grapesjs-float/blob/main/src/example.ts) file.\n\n### Show floating element\n\n```ts\nconst commandOptions: CommandOptions = {\n  referenceElement: selectedEl, // optional, selected component by default\n  floatingElement: floatingEl // optional, if specified in the plugin options\n}\n\neditor.runCommand('float:show-element', commandOptions)\n```\n\n### Hide floating element\n\n```ts\nconst commandOptions: CommandOptions = {\n  referenceElement: selectedEl, // optional, selected component by default\n  floatingElement: floatingEl // optional, your floating html element by default\n}\n\neditor.runCommand('float:hide-element', commandOptions)\n```\n\n## Events\n\n### On floating element shown\n\n```ts\neditor.on('float:show-element', (floatingElement, referenceElement) =\u003e {\n  console.log('Floating element is shown', {\n    floatingElement,\n    referenceElement\n  })\n})\n```\n\n### On floating element hidden\n\n```ts\neditor.on('float:hide-element', (floatingElement, referenceElement) =\u003e {\n  console.log('Floating element is hidden', {\n    floatingElement,\n    referenceElement\n  })\n})\n```\n\n## Options\n\n```ts\n{\n  floatingElement: HTMLElement // optional, if specified in \"float:show-element\" command options\n}\n```\n\n## Question? Idea?\n\nIf you have a question about how `grapesjs-float` works or an idea to improve it, the [Discussions](https://github.com/bgrand-ch/grapesjs-float/discussions) tab in GitHub is the place to be.\n\nHowever, if you get an error, you should open an [issue](https://github.com/bgrand-ch/grapesjs-float/issues).\n\n## License\n\nDistributed under the BSD 3-Clause License. See [LICENSE](https://github.com/bgrand-ch/grapesjs-float/blob/main/LICENSE.md) for more information.\n\n## Contact\n\nBenjamin Grand [@bgrand_ch](https://twitter.com/bgrand_ch)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbgrand-ch%2Fgrapesjs-float","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbgrand-ch%2Fgrapesjs-float","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbgrand-ch%2Fgrapesjs-float/lists"}