{"id":13535648,"url":"https://github.com/Fandom-OSS/quill-blot-formatter","last_synced_at":"2025-04-02T02:31:03.873Z","repository":{"id":43189635,"uuid":"113381903","full_name":"Fandom-OSS/quill-blot-formatter","owner":"Fandom-OSS","description":"A module for Quill that allows editor elements to be resized, repositioned, etc.","archived":false,"fork":false,"pushed_at":"2024-08-07T09:52:01.000Z","size":127,"stargazers_count":139,"open_issues_count":31,"forks_count":51,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-17T21:12:25.176Z","etag":null,"topics":["quill","quilljs"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Fandom-OSS.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2017-12-07T00:19:19.000Z","updated_at":"2025-03-01T03:35:42.000Z","dependencies_parsed_at":"2024-06-18T13:53:07.224Z","dependency_job_id":null,"html_url":"https://github.com/Fandom-OSS/quill-blot-formatter","commit_stats":{"total_commits":98,"total_committers":2,"mean_commits":49.0,"dds":"0.020408163265306145","last_synced_commit":"46e7551b36d37a3f7fbfb6c4fd0f35d003a82eeb"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fandom-OSS%2Fquill-blot-formatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fandom-OSS%2Fquill-blot-formatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fandom-OSS%2Fquill-blot-formatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fandom-OSS%2Fquill-blot-formatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Fandom-OSS","download_url":"https://codeload.github.com/Fandom-OSS/quill-blot-formatter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246743545,"owners_count":20826551,"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":["quill","quilljs"],"created_at":"2024-08-01T09:00:20.107Z","updated_at":"2025-04-02T02:31:03.613Z","avatar_url":"https://github.com/Fandom-OSS.png","language":"JavaScript","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# Quill Blot Formatter\n\nA [quill](https://quilljs.com/) module to format document [blots](https://github.com/quilljs/parchment#blots). Heavily inspired by [quill-image-resize-module](https://github.com/kensnyder/quill-image-resize-module). Out of the box supports resizing and realigning images and iframe videos, but can be easily extended using [`BlotSpec`](#blotspec) and [`Action`](#action).\n\n## Demo\n[demo](https://codesandbox.io/s/4wnwllnnl9)\n\n## Installation\nUsing `yarn`:\n```\nyarn add quill-blot-formatter\n```\n\nUsing `npm`:\n```\nnpm install --save quill-blot-formatter\n```\n\n## Usage\n### As Module\n```js\nimport Quill from 'quill';\n\n// from the index, which exports a lot of useful modules\nimport BlotFormatter from 'quill-blot-formatter';\n\n// or, from each individual module\nimport BlotFormatter from 'quill-blot-formatter/dist/BlotFormatter';\n\nQuill.register('modules/blotFormatter', BlotFormatter);\n\nconst quill = new Quill(..., {\n  modules: {\n    ...\n    blotFormatter: {\n      // see config options below\n    }\n  }\n});\n```\n\n### Script Tag\n`quill-blot-formatter.min.js` is provided which exports the same modules as `index.js` under the global `QuillBlotFormatter`.\n\n```html\n\u003cscript src=\"\u003cquill\u003e\"\u003e\u003c/script\u003e\n\u003cscript src=\"node_modules/quill-blot-formatter/dist/quill-blot-formatter.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  Quill.register('modules/blotFormatter', QuillBlotFormatter.default);\n  const quill = new Quill(..., {\n      modules: {\n          ...\n          blotFormatter: {\n            // see config options below\n          }\n      }\n    }\n  });\n\u003c/script\u003e\n```\n\n## BlotSpec\nThe [`BlotSpec`](https://github.com/Fandom-OSS/quill-blot-formatter/blob/master/src/specs/BlotSpec.js) classes define how `BlotFormatter` interacts with blots. They take the `BlotFormatter` as a constructor arg and have the following functions:\n\n### `init(): void`\nCalled after all specs have been constructed. Use this to bind to quill events to determine when to activate a specific spec.\n\n### `getActions(): Class\u003cAction\u003e[]`\nThe [`actions`](#action) that are allowed on this blot. The default is `[AlignAction, ResizeAction, DeleteAction]`.\n\n### `getTargetElement(): ?HTMLElement`\nWhen the spec is active this should return the element that is to be formatter\n\n### `getOverlayElement(): ?HTMLElement`\nWhen the spec is active this should return the element to display the formatting overlay. This defaults to `return getTargetElement()` since they will typically be the same element.\n\n### `setSelection(): void`\nAfter the spec is activated this should set the quill selection using [`setSelection`](https://quilljs.com/docs/api/#setselection). Defaults to `quill.setSelection(null)`.\n\n### `onHide(): void`\nCalled when the spec is deactivated by the user clicking away from the blot. Use this to clean up any state in the spec during activation.\n\n### Notes\nEach spec should call `this.formatter.show(this);` to request activation. See [`specs/`](https://github.com/Fandom-OSS/quill-blot-formatter/tree/master/src/specs) for the built-in specs.\n\n## Action\nThe [`Action`](https://github.com/Fandom-OSS/quill-blot-formatter/blob/master/src/actions/Action.js) classes define the actions available to a blot once its spec is activated. They take the `BlotFormatter` as a constructor arg and have the following functions:\n\n### `onCreate(): void`\nCalled immediately after the action is created. Use this to bind quill events and create elements to attach to the overlay.\n\n### `onUpdate(): void`\nCalled when the formatter has changed something on the blot. Use this to update any internal state.\n\n### `onDestroy(): void`\nCalled when the formatter is hidden by the user.\n\nSee [`actions/`](https://github.com/Fandom-OSS/quill-blot-formatter/tree/master/src/actions) for the existing actions.\n\n## Options\nUsing quill module options it's easy to disable existing specs, actions, or to override any of the styles provided by this module. For example: if you wanted to remove resizing, support only images, and change the overlay border the following config would work:\n\n```js\nimport Quill from 'quill';\n\n// from main module\nimport BlotFormatter, { AlignAction, DeleteAction, ImageSpec } from 'quill-blot-formatter'\n\n// or, from individual modules\nimport BlotFormatter from 'quill-blot-formatter/dist/BlotFormatter';\nimport AlignAction from 'quill-blot-formatter/dist/actions/align/AlignAction';\nimport DeleteAction from 'quill-blot-formatter/dist/actions/DeleteAction';\nimport ImageSpec from 'quill-blot-formatter/dist/specs/ImageSpec';\n\nQuill.register('modules/blotFormatter', BlotFormatter);\n\nclass CustomImageSpec extends ImageSpec {\n    getActions() {\n        return [AlignAction, DeleteAction];\n    }\n}\n\nconst quill = new Quill(..., {\n  modules: {\n    ...\n    blotFormatter: {\n      specs: [\n        CustomImageSpec,\n      ],\n      overlay: {\n        style: {\n          border: '2px solid red',\n        }\n      }\n    }\n  }\n});\n```\n\n### Notes\n- For all supported options as well as the default see [`Options`](https://github.com/Fandom-OSS/quill-blot-formatter/blob/master/src/Options.js).\n- object properties are merged, but array properties override the defaults.\n- To completely disable styles (`overlay.style`, `resize.handleStyle`, etc) set those to `null`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFandom-OSS%2Fquill-blot-formatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFandom-OSS%2Fquill-blot-formatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFandom-OSS%2Fquill-blot-formatter/lists"}