{"_id":"@axure/y-prosemirror","_rev":"3-4e0271d91406245826db742560e5945f","name":"@axure/y-prosemirror","dist-tags":{"latest":"1.3.7-fork.4"},"versions":{"1.3.7-fork.2":{"name":"@axure/y-prosemirror","version":"1.3.7-fork.2","keywords":["Yjs"],"author":{"name":"Axure Software"},"license":"MIT","_id":"@axure/y-prosemirror@1.3.7-fork.2","maintainers":[{"name":"martinaxure","email":"martin@axure.com"},{"name":"romansp","email":"rspaulau@gmail.com"}],"homepage":"https://github.com/yjs/y-prosemirror#readme","bugs":{"url":"https://github.com/Axure-Software/y-prosemirror/issues"},"dist":{"shasum":"9d9d56c1e8e7e87e148fbb9432d0f41f7c3e5140","tarball":"https://registry.npmjs.org/@axure/y-prosemirror/-/y-prosemirror-1.3.7-fork.2.tgz","fileCount":19,"integrity":"sha512-1ZkWARAcC1Hntj3ELAkgxGo8ZKO1XEC4nGM6GB6ACbdM3ZfjdShozI2JNTLngctQabAPL8o5YNZaPvoJ3MhG0g==","signatures":[{"sig":"MEUCIQCM3N7lyFGAmoIJyriI8Ww9HLB0FgkZmTIUwXze1DOONAIgZpaUtcfQBebnflAfhOdg2pWk37eORHMXoXiyxJqtPwk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":299887},"main":"./dist/y-prosemirror.cjs","type":"module","email":"support@axure.com","types":"./dist/src/y-prosemirror.d.ts","module":"./src/y-prosemirror.js","engines":{"npm":">=8.0.0","node":">=16.0.0"},"exports":{".":{"types":"./dist/src/y-prosemirror.d.ts","import":"./src/y-prosemirror.js","require":"./dist/y-prosemirror.cjs"}},"gitHead":"b705e3ddfb9a983d17bd37a36b879616e5ccbd9f","scripts":{"dist":"npm run clean && rollup -c && tsc","lint":"standard && tsc","test":"npm run lint && rollup -c && node dist/test.cjs","clean":"rm -rf dist","debug":"concurrently '0serve -o test.html' 'npm run watch'","start":"concurrently '0serve -o demo/prosemirror.html' 'npm run watch'","watch":"rollup -wc","preversion":"npm run lint && npm run dist && npm run test"},"_npmUser":{"name":"romansp","email":"rspaulau@gmail.com"},"standard":{"ignore":["/dist","/node_modules","/docs"]},"overrides":{"yjs":"npm:@axure/yjs@^13.6.27-fork.2"},"repository":{"url":"git+https://github.com/Axure-Software/y-prosemirror.git","type":"git"},"_npmVersion":"11.6.0","description":"Prosemirror bindings for Yjs","directories":{},"sideEffects":false,"_nodeVersion":"22.17.1","dependencies":{"lib0":"^0.2.109"},"_hasShrinkwrap":false,"devDependencies":{"yjs":"npm:@axure/yjs@^13.6.27-fork.2","jsdom":"^15.1.1","rollup":"^2.59.0","standard":"^17.0.0","y-webrtc":"^10.2.0","typescript":"^5.4.5","http-server":"^0.12.3","y-protocols":"^1.0.5","concurrently":"^4.1.0","prosemirror-view":"^1.26.2","prosemirror-model":"^1.18.1","prosemirror-state":"^1.4.1","prosemirror-transform":"^1.6.0","@rollup/plugin-commonjs":"^21.0.1","prosemirror-schema-basic":"^1.2.0","prosemirror-example-setup":"^1.2.1","@rollup/plugin-node-resolve":"^13.0.6"},"peerDependencies":{"yjs":"npm:@axure/yjs@^13.6.27-fork.2","y-protocols":"^1.0.1","prosemirror-view":"^1.9.10","prosemirror-model":"^1.7.1","prosemirror-state":"^1.2.3"},"_npmOperationalInternal":{"tmp":"tmp/y-prosemirror_1.3.7-fork.2_1758239235468_0.8188460512392521","host":"s3://npm-registry-packages-npm-production"}},"1.3.7-fork.3":{"name":"@axure/y-prosemirror","version":"1.3.7-fork.3","keywords":["Yjs"],"author":{"name":"Axure Software"},"license":"MIT","_id":"@axure/y-prosemirror@1.3.7-fork.3","maintainers":[{"name":"martinaxure","email":"martin@axure.com"},{"name":"romansp","email":"rspaulau@gmail.com"}],"homepage":"https://github.com/yjs/y-prosemirror#readme","bugs":{"url":"https://github.com/Axure-Software/y-prosemirror/issues"},"dist":{"shasum":"c97e306352e3b33079b291951ead2839981e978e","tarball":"https://registry.npmjs.org/@axure/y-prosemirror/-/y-prosemirror-1.3.7-fork.3.tgz","fileCount":19,"integrity":"sha512-btzwTrMHTAdJgywIfIqyhOBkujnwdrHX12/3DojbF/WQfBLZzzYcJWpVBH4RYo8YLrBJnYfVfWgGXQC45aewEQ==","signatures":[{"sig":"MEUCIHAWhc/9wfB57cwbqfl7aEAomq9gzM48REZHu4jCqgrHAiEAzVHgOqEahWmVj35K5TVcX3x+3DmA3lS8VFf8pjIZUos=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@axure%2fy-prosemirror@1.3.7-fork.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":299887},"main":"./dist/y-prosemirror.cjs","type":"module","email":"support@axure.com","types":"./dist/src/y-prosemirror.d.ts","module":"./src/y-prosemirror.js","engines":{"npm":">=8.0.0","node":">=16.0.0"},"exports":{".":{"types":"./dist/src/y-prosemirror.d.ts","import":"./src/y-prosemirror.js","require":"./dist/y-prosemirror.cjs"}},"gitHead":"90fb3fa6f0161931e9e67f7d43554d739608a6ed","scripts":{"dist":"npm run clean && rollup -c && tsc","lint":"standard && tsc","test":"npm run lint && rollup -c && node dist/test.cjs","clean":"rm -rf dist","debug":"concurrently '0serve -o test.html' 'npm run watch'","start":"concurrently '0serve -o demo/prosemirror.html' 'npm run watch'","watch":"rollup -wc","preversion":"npm run lint && npm run dist && npm run test"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:32146673-b9ee-4473-91bc-25417d858a84"}},"standard":{"ignore":["/dist","/node_modules","/docs"]},"overrides":{"yjs":"npm:@axure/yjs@^13.6.29-fork.1"},"repository":{"url":"git+https://github.com/Axure-Software/y-prosemirror.git","type":"git"},"_npmVersion":"11.6.2","description":"Prosemirror bindings for Yjs","directories":{},"sideEffects":false,"_nodeVersion":"24.13.0","dependencies":{"lib0":"^0.2.109"},"_hasShrinkwrap":false,"devDependencies":{"yjs":"npm:@axure/yjs@^13.6.29-fork.1","jsdom":"^15.1.1","rollup":"^2.59.0","standard":"^17.0.0","y-webrtc":"^10.2.0","typescript":"^5.4.5","http-server":"^0.12.3","y-protocols":"^1.0.5","concurrently":"^4.1.0","prosemirror-view":"^1.26.2","prosemirror-model":"^1.18.1","prosemirror-state":"^1.4.1","prosemirror-transform":"^1.6.0","@rollup/plugin-commonjs":"^21.0.1","prosemirror-schema-basic":"^1.2.0","prosemirror-example-setup":"^1.2.1","@rollup/plugin-node-resolve":"^13.0.6"},"peerDependencies":{"yjs":"npm:@axure/yjs@^13.6.27-fork.2","y-protocols":"^1.0.1","prosemirror-view":"^1.9.10","prosemirror-model":"^1.7.1","prosemirror-state":"^1.2.3"},"_npmOperationalInternal":{"tmp":"tmp/y-prosemirror_1.3.7-fork.3_1769455859445_0.17707050005850755","host":"s3://npm-registry-packages-npm-production"}},"1.3.7-fork.4":{"name":"@axure/y-prosemirror","version":"1.3.7-fork.4","description":"Prosemirror bindings for Yjs","main":"./dist/y-prosemirror.cjs","module":"./src/y-prosemirror.js","type":"module","types":"./dist/src/y-prosemirror.d.ts","sideEffects":false,"scripts":{"clean":"rm -rf dist","dist":"npm run clean && rollup -c && tsc","test":"npm run lint && rollup -c && node dist/test.cjs","lint":"standard && tsc","watch":"rollup -wc","debug":"concurrently '0serve -o test.html' 'npm run watch'","preversion":"npm run lint && npm run dist && npm run test","start":"concurrently '0serve -o demo/prosemirror.html' 'npm run watch'"},"exports":{".":{"types":"./dist/src/y-prosemirror.d.ts","import":"./src/y-prosemirror.js","require":"./dist/y-prosemirror.cjs"}},"repository":{"type":"git","url":"git+https://github.com/Axure-Software/y-prosemirror.git"},"keywords":["Yjs"],"author":{"name":"Axure Software"},"email":"support@axure.com","license":"MIT","standard":{"ignore":["/dist","/node_modules","/docs"]},"bugs":{"url":"https://github.com/Axure-Software/y-prosemirror/issues"},"homepage":"https://github.com/yjs/y-prosemirror#readme","dependencies":{"lib0":"^0.2.109"},"peerDependencies":{"prosemirror-model":"^1.7.1","prosemirror-state":"^1.2.3","prosemirror-view":"^1.9.10","y-protocols":"^1.0.1","yjs":"npm:@axure/yjs@^13.6.27-fork.2"},"devDependencies":{"@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-node-resolve":"^13.0.6","concurrently":"^4.1.0","http-server":"^0.12.3","jsdom":"^15.1.1","prosemirror-example-setup":"^1.2.1","prosemirror-model":"^1.18.1","prosemirror-schema-basic":"^1.2.0","prosemirror-state":"^1.4.1","prosemirror-transform":"^1.6.0","prosemirror-view":"^1.26.2","rollup":"^2.59.0","standard":"^17.0.0","typescript":"^5.4.5","y-protocols":"^1.0.5","y-webrtc":"^10.2.0","yjs":"npm:@axure/yjs@^13.6.29-fork.1"},"overrides":{"yjs":"npm:@axure/yjs@^13.6.29-fork.1"},"engines":{"npm":">=8.0.0","node":">=16.0.0"},"gitHead":"e379b8c5fb39191e931bc2be2f5d04d43b8c82c9","_id":"@axure/y-prosemirror@1.3.7-fork.4","_nodeVersion":"24.13.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-0/dtoMDb+sSHrmHSMXpEyTYjpxWArYl3+qEMHbT0PV+kgP7AescTu2IhuB0S0UtBvcI+fAHhB8ihW0J+T2mLZA==","shasum":"7a75995dbfcd906ab3f8be3a739895b4765a3992","tarball":"https://registry.npmjs.org/@axure/y-prosemirror/-/y-prosemirror-1.3.7-fork.4.tgz","fileCount":19,"unpackedSize":300372,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@axure%2fy-prosemirror@1.3.7-fork.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGZuddI2IZ0oPolvaiTbs/eGd09vK7Ul7ht6UG/jjGNwAiEAleAxicUuXzykGjRIWERYgjVn6BUdwssfXjiCRUCVnaI="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:32146673-b9ee-4473-91bc-25417d858a84"}},"directories":{},"maintainers":[{"name":"martinaxure","email":"martin@axure.com"},{"name":"romansp","email":"rspaulau@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/y-prosemirror_1.3.7-fork.4_1770252155439_0.41644261276676686"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-18T23:47:15.313Z","modified":"2026-02-05T00:42:35.909Z","1.3.7-fork.2":"2025-09-18T23:47:15.717Z","1.3.7-fork.3":"2026-01-26T19:30:59.621Z","1.3.7-fork.4":"2026-02-05T00:42:35.610Z"},"bugs":{"url":"https://github.com/Axure-Software/y-prosemirror/issues"},"author":{"name":"Axure Software"},"license":"MIT","homepage":"https://github.com/yjs/y-prosemirror#readme","keywords":["Yjs"],"repository":{"type":"git","url":"git+https://github.com/Axure-Software/y-prosemirror.git"},"description":"Prosemirror bindings for Yjs","maintainers":[{"name":"martinaxure","email":"martin@axure.com"},{"name":"romansp","email":"rspaulau@gmail.com"}],"readme":"# y-prosemirror\n\n> [ProseMirror](http://prosemirror.net/) Binding for [Yjs](https://github.com/yjs/yjs) - [Demo](https://demos.yjs.dev/prosemirror/prosemirror.html)\n\nThis binding maps a Y.XmlFragment to the ProseMirror state.\n\n## Features\n\n* Sync ProseMirror state\n* Shared Cursors\n* Shared Undo / Redo (each client has its own undo-/redo-history)\n* Successfully recovers when concurrents edit result in an invalid document schema\n\n### Example\n\n```js\nimport { ySyncPlugin, yCursorPlugin, yUndoPlugin, undo, redo, initProseMirrorDoc } from 'y-prosemirror'\nimport { exampleSetup } from 'prosemirror-example-setup'\nimport { keymap } from 'prosemirror-keymap'\n..\n\nconst type = ydocument.get('prosemirror', Y.XmlFragment)\nconst { doc, mapping } = initProseMirrorDoc(type, schema)\n\nconst prosemirrorView = new EditorView(document.querySelector('#editor'), {\n  state: EditorState.create({\n    doc,\n    schema,\n    plugins: [\n        ySyncPlugin(type, { mapping }),\n        yCursorPlugin(provider.awareness),\n        yUndoPlugin(),\n        keymap({\n          'Mod-z': undo,\n          'Mod-y': redo,\n          'Mod-Shift-z': redo\n        })\n      ].concat(exampleSetup({ schema }))\n  })\n})\n```\n\nAlso look [here](https://github.com/yjs/yjs-demos/tree/master/prosemirror) for a working example.\n\n#### Remote Cursors\n\nThe shared cursors depend on the Awareness instance that is exported by most providers. The [Awareness protocol](https://github.com/yjs/y-protocols#awareness-protocol) handles non-permanent data like the number of users, their user names, their cursor location, and their colors. You can change the name and color of the user like this:\n\n```js\nexample.binding.awareness.setLocalStateField('user', { color: '#008833', name: 'My real name' })\n```\n\nIn order to render cursor information you need to embed custom CSS for the user icon. This is a template that you can use for styling cursor information.\n\n```css\n/* this is a rough fix for the first cursor position when the first paragraph is empty */\n.ProseMirror > .ProseMirror-yjs-cursor:first-child {\n  margin-top: 16px;\n}\n.ProseMirror p:first-child, .ProseMirror h1:first-child, .ProseMirror h2:first-child, .ProseMirror h3:first-child, .ProseMirror h4:first-child, .ProseMirror h5:first-child, .ProseMirror h6:first-child {\n  margin-top: 16px\n}\n/* This gives the remote user caret. The colors are automatically overwritten*/\n.ProseMirror-yjs-cursor {\n  position: relative;\n  margin-left: -1px;\n  margin-right: -1px;\n  border-left: 1px solid black;\n  border-right: 1px solid black;\n  border-color: orange;\n  word-break: normal;\n  pointer-events: none;\n}\n/* This renders the username above the caret */\n.ProseMirror-yjs-cursor > div {\n  position: absolute;\n  top: -1.05em;\n  left: -1px;\n  font-size: 13px;\n  background-color: rgb(250, 129, 0);\n  font-family: serif;\n  font-style: normal;\n  font-weight: normal;\n  line-height: normal;\n  user-select: none;\n  color: white;\n  padding-left: 2px;\n  padding-right: 2px;\n  white-space: nowrap;\n}\n```\n\nYou can also overwrite the default Widget dom by specifying a cursor builder in the yCursorPlugin\n\n```js\n/**\n * This function receives the remote users \"user\" awareness state.\n */\nexport const myCursorBuilder = user => {\n  const cursor = document.createElement('span')\n  cursor.classList.add('ProseMirror-yjs-cursor')\n  cursor.setAttribute('style', `border-color: ${user.color}`)\n  const userDiv = document.createElement('div')\n  userDiv.setAttribute('style', `background-color: ${user.color}`)\n  userDiv.insertBefore(document.createTextNode(user.name), null)\n  cursor.insertBefore(userDiv, null)\n  return cursor\n}\n\nconst prosemirrorView = new EditorView(document.querySelector('#editor'), {\n  state: EditorState.create({\n    schema,\n    plugins: [\n        ySyncPlugin(type),\n        yCursorPlugin(provider.awareness, { cursorBuilder: myCursorBuilder }),\n        yUndoPlugin(),\n        keymap({\n          'Mod-z': undo,\n          'Mod-y': redo,\n          'Mod-Shift-z': redo\n        })\n      ].concat(exampleSetup({ schema }))\n  })\n})\n```\n\n#### Utilities\n\nThe package includes a number of utility methods for converting back and forth between\na Y.Doc and Prosemirror compatible data structures. These can be useful for persisting\nto a datastore or for importing existing documents.\n\n> _Note_: Serializing and deserializing to JSON will not store collaboration history\n> steps and as such should not be used as the primary storage. You will still need\n> to store the Y.Doc binary update format.\n\n```js\nimport { prosemirrorToYDoc } from 'y-prosemirror'\n\n// Pass JSON previously output from Prosemirror\nconst doc = Node.fromJSON(schema, {\n  type: \"doc\",\n  content: [...]\n})\nconst ydoc = prosemirrorToYDoc(doc)\n```\n\nBecause JSON is a common usecase there is an equivalent method that skips the need\nto create a Prosemirror Node.\n\n```js\nimport { prosemirrorJSONToYDoc } from 'y-prosemirror'\n\n// Pass JSON previously output from Prosemirror\nconst ydoc = prosemirrorJSONToYDoc(schema, {\n  type: \"doc\",\n  content: [...]\n})\n```\n\n```js\nimport { yDocToProsemirror } from 'y-prosemirror'\n\n// apply binary updates from elsewhere\nconst ydoc = new Y.Doc()\nydoc.applyUpdate(update)\n\nconst node = yDocToProsemirror(schema, ydoc)\n```\n\nBecause JSON is a common usecase there is an equivalent method that outputs JSON\ndirectly, this method does not require the Prosemirror schema.\n\n```js\nimport { yDocToProsemirrorJSON } from 'y-prosemirror'\n\n// apply binary updates from elsewhere\nconst ydoc = new Y.Doc()\nydoc.applyUpdate(update)\n\nconst node = yDocToProsemirrorJSON(ydoc)\n```\n\n### Undo/Redo\n\nThe package exports `undo` and `redo` commands which can be used in place of\n[prosemirror-history](https://prosemirror.net/docs/ref/#history) by mapping the\nmod-Z/Y keys - see [ProseMirror](https://github.com/yjs/yjs-demos/blob/main/prosemirror/prosemirror.js#L29)\nand [Tiptap](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-collaboration/src/collaboration.ts)\nexamples.\n\nUndo and redo are be scoped to the local client, so one peer won't undo another's\nchanges. See [Y.UndoManager](https://docs.yjs.dev/api/undo-manager) for more details.\n\nJust like prosemirror-history, you can set a transaction's `addToHistory` meta property\nto false to prevent that transaction from being rolled back by undo. This can be helpful for programmatic\ndocument changes that aren't initiated by the user.\n\n```js\ntr.setMeta(\"addToHistory\", false);\n```\n\n### License\n\n[The MIT License](./LICENSE) © Kevin Jahns\n","readmeFilename":"README.md"}