Skip to content

Commit

Permalink
fix: pass file id for direct editing and fail y.js provider setup if …
Browse files Browse the repository at this point in the history
…none was passed

Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed May 5, 2023
1 parent bb7ff0a commit ff0249f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/services/SyncServiceProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ import { logger } from '../helpers/logger.js'
* @param {object} options.initialSession - initialSession to start from
*/
export default function createSyncServiceProvider({ ydoc, syncService, fileId, initialSession }) {
if (!fileId) {
throw new Error('fileId is required')
}
const WebSocketPolyfill = initWebSocketPolyfill(syncService, fileId, initialSession)
const websocketProvider = new WebsocketProvider(
'ws://localhost:1234',
Expand Down
1 change: 1 addition & 0 deletions src/views/DirectEditing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<div id="direct-editor" :class="{'icon-loading': saving}">
<Editor ref="editor"
:initial-session="initialSession"
:file-id="initial.fileId"
:active="true"
:mime="initial.mimetype"
:is-direct-editing="true"
Expand Down

0 comments on commit ff0249f

Please sign in to comment.