fix(commons): extract name of markdown content yjs channel into the commons package

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2023-02-09 14:21:26 +01:00
parent 329a4d4e55
commit 11c2f57e4b
6 changed files with 22 additions and 13 deletions

View file

@ -0,0 +1,7 @@
/*
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
export const MARKDOWN_CONTENT_CHANNEL_NAME = 'markdownContent'

View file

@ -33,3 +33,5 @@ export {
export type { MessageTransporterEvents } from './y-doc-message-transporter.js'
export { waitForOtherPromisesToFinish } from './utils/wait-for-other-promises-to-finish.js'
export { MARKDOWN_CONTENT_CHANNEL_NAME } from './constants/markdown-content-channel-name.js'

View file

@ -3,6 +3,7 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { MARKDOWN_CONTENT_CHANNEL_NAME } from './constants/markdown-content-channel-name.js'
import { encodeDocumentUpdateMessage } from './messages/document-update-message.js'
import { MessageType } from './messages/message-type.enum.js'
import { YDocMessageTransporter } from './y-doc-message-transporter.js'
@ -55,9 +56,9 @@ describe('message transporter', () =>
const docClient2: Doc = new Doc()
const dummyAwareness: Awareness = new Awareness(docServer)
const textServer = docServer.getText('markdownContent')
const textClient1 = docClient1.getText('markdownContent')
const textClient2 = docClient2.getText('markdownContent')
const textServer = docServer.getText(MARKDOWN_CONTENT_CHANNEL_NAME)
const textClient1 = docClient1.getText(MARKDOWN_CONTENT_CHANNEL_NAME)
const textClient2 = docClient2.getText(MARKDOWN_CONTENT_CHANNEL_NAME)
textServer.insert(0, 'This is a test note')
textServer.observe(() =>