{"id":24379694,"url":"https://github.com/y-js/y-richtext","last_synced_at":"2025-07-06T08:40:20.703Z","repository":{"id":29579381,"uuid":"33119074","full_name":"y-js/y-richtext","owner":"y-js","description":"Rich Text type for Yjs","archived":false,"fork":false,"pushed_at":"2021-03-09T10:27:56.000Z","size":930,"stargazers_count":29,"open_issues_count":0,"forks_count":7,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-10T21:09:52.374Z","etag":null,"topics":["yjs","yjs-type"],"latest_commit_sha":null,"homepage":"http://y-js.org/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/y-js.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-30T11:24:57.000Z","updated_at":"2024-04-02T17:40:31.000Z","dependencies_parsed_at":"2022-08-30T20:01:11.043Z","dependency_job_id":null,"html_url":"https://github.com/y-js/y-richtext","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-js%2Fy-richtext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-js%2Fy-richtext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-js%2Fy-richtext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-js%2Fy-richtext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/y-js","download_url":"https://codeload.github.com/y-js/y-richtext/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248298325,"owners_count":21080320,"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":["yjs","yjs-type"],"created_at":"2025-01-19T07:18:46.948Z","updated_at":"2025-04-10T21:09:59.002Z","avatar_url":"https://github.com/y-js.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Rich Text type for [Yjs](https://github.com/y-js/yjs)\nThe fabulous feature of y-richtext is that you can bind it to a [Quill](https://quilljs.com) instance (\u003e v1.0.0) in order to enable collaborative richtext editing.\n\n## Use it!\n\n### Bower\nRetrieve y-richtext and [Quill](https://quilljs.com) Editor with bower.\n\n```\nbower install y-richtext quill --save\n```\n\n### NPM\n\n```\nnpm install y-richtext y-array quill --save\n```\n\nThis type depends on [y-array](https://github.com/y-js/y-array). So you have to extend Yjs in the right order:\n\n```javascript\nvar Y = require('yjs')\nrequire('y-array')(Y)\nrequire('y-richtext')(Y)\n```\n\n## Example\n```javascript\nY({\n  db: {\n    name: 'memory'\n  },\n  connector: {\n    name: 'websockets-client',\n    room: 'richtext-example'\n  },\n  share: {\n    richtext: 'Richtext' // y.share.richtext is of type Y.Richtext\n  }\n}).then(function (y) {\n  window.yquill = y\n\n  // create quill element\n  window.quill = new Quill('#editor', {\n    modules: {\n      'toolbar': { container: '#toolbar' },\n      'link-tooltip': true\n    },\n    theme: 'snow'\n  })\n  // bind quill to richtext type\n  y.share.richtext.bindQuill(window.quill)\n})\n```\n\n### RichText Object\n\n##### Reference\n* .bind(editor)\n  * Bind this type to an rich text editor. (Currently, only QuillJs is supported)\n  * `.bind(editor)` does not preserve the existing value of the bound editor\n* .bindQuill(quill)\n  * Explicitely bind a Quill editor\n* unbindQuill(quill)\n  * Remove binding\n* unbindQuillAll()\n  * Remove all quill bindings\n* .insert(position, string)\n  * Insert text at a position\n* .delete(position, length)\n  * Delete text\n* select(from, to, attrName, attrValue)\n  * Assign meaning to a selection of text (application depending to what you bind, this can assign text to be bold, italic, ..). Set null to remove selection.\n* toString()\n  * Get the string representation of this type (without selections)\n* toDelta()\n  * Convert internal structure to a Quill delta https://quilljs.com/docs/delta/\n* applyDelta()\n  * Apply a Quill delta https://quilljs.com/docs/delta/\n\n\n## Contribution\nWe thank [Linagora](https://www.linagora.com/) who sponsored this work, and agreed to publish it as Open Source.\n\n## Changelog\n\n### 8.2.1\n* support for Quill@^1.0.0-rc.2\n* relies on Yjs@^12.0.0 \n\n## License\nYjs and the RichText type are licensed under the [MIT License](./LICENSE).\n\n- Corentin Cadiou \u003ccorentin.cadiou@linagora.com\u003e\n- Kevin Jahns \u003ckevin.jahns@rwth-aachen.de\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fy-js%2Fy-richtext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fy-js%2Fy-richtext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fy-js%2Fy-richtext/lists"}