JSON to client (#5553)
This commit is contained in:
@@ -8,7 +8,7 @@ import * as Y from "yjs";
|
||||
import Logger from "@server/logging/Logger";
|
||||
import { trace } from "@server/logging/tracing";
|
||||
import Document from "@server/models/Document";
|
||||
import ProsemirrorHelper from "@server/models/helpers/ProsemirrorHelper";
|
||||
import { ProsemirrorHelper } from "@server/models/helpers/ProsemirrorHelper";
|
||||
import { sequelize } from "@server/storage/database";
|
||||
import documentCollaborativeUpdater from "../commands/documentCollaborativeUpdater";
|
||||
import { withContext } from "./types";
|
||||
@@ -51,11 +51,20 @@ export default class PersistenceExtension implements Extension {
|
||||
return ydoc;
|
||||
}
|
||||
|
||||
Logger.info(
|
||||
"database",
|
||||
`Document ${documentId} is not in state, creating from markdown`
|
||||
);
|
||||
const ydoc = ProsemirrorHelper.toYDoc(document.text, fieldName);
|
||||
let ydoc;
|
||||
if (document.content) {
|
||||
Logger.info(
|
||||
"database",
|
||||
`Document ${documentId} is not in state, creating from content`
|
||||
);
|
||||
ydoc = ProsemirrorHelper.toYDoc(document.content, fieldName);
|
||||
} else {
|
||||
Logger.info(
|
||||
"database",
|
||||
`Document ${documentId} is not in state, creating from text`
|
||||
);
|
||||
ydoc = ProsemirrorHelper.toYDoc(document.text, fieldName);
|
||||
}
|
||||
const state = ProsemirrorHelper.toState(ydoc);
|
||||
await document.update(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user