Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoLC committed Dec 23, 2024
1 parent b24516a commit 55238a7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
- "1081:1080"

minio:
user: ${DOCKER_USER:-1000}
# user: ${DOCKER_USER:-1000}
image: minio/minio
environment:
- MINIO_ROOT_USER=impress
Expand Down Expand Up @@ -166,6 +166,8 @@ services:
- env.d/development/common
ports:
- "4444:4444"
volumes:
- ./src/frontend/servers/y-provider:/home/frontend/servers/y-provider

kc_postgresql:
image: postgres:14.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ export const BlockNoteEditor = ({ doc, provider }: BlockNoteEditorProps) => {
const { setEditor } = useEditorStore();
const { t } = useTranslation();

const readOnly = !doc.abilities.partial_update;
//const readOnly = !doc.abilities.partial_update;
const readOnly = false;
useSaveDoc(doc.id, provider.document, !readOnly);
const { i18n } = useTranslation();
const lang = i18n.language;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as Y from 'yjs';
import { create } from 'zustand';

import { Base64 } from '@/features/docs/doc-management';
import { isFirefox } from '@/utils';

export interface UseCollaborationStore {
createProvider: (
Expand Down Expand Up @@ -35,8 +36,13 @@ export const useProviderStore = create<UseCollaborationStore>((set, get) => ({
Y.applyUpdate(doc, Buffer.from(initialDoc, 'base64'));
}

// console.log('navigator.userAgent', navigator.userAgent);
// console.log('providerUrl', wsUrl);
const withWS = isFirefox();
//const withWS = true;

const provider = new HocuspocusProvider({
url: wsUrl,
url: !withWS ? 'ws://localhost:6666' : wsUrl,
name: storeId,
document: doc,
onConnect: () => {
Expand Down
3 changes: 3 additions & 0 deletions src/frontend/apps/impress/src/utils/userAgent.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
export const isFirefox = () =>
navigator.userAgent.toLowerCase().indexOf('firefox') > -1;

export const isEdge = () =>
navigator.userAgent.toLowerCase().indexOf('edg') > -1;

0 comments on commit 55238a7

Please sign in to comment.