fix: Layout only changes not synced to content property
This commit is contained in:
@@ -111,6 +111,7 @@
|
|||||||
"emoji-mart": "^5.6.0",
|
"emoji-mart": "^5.6.0",
|
||||||
"emoji-regex": "^10.3.0",
|
"emoji-regex": "^10.3.0",
|
||||||
"es6-error": "^4.1.1",
|
"es6-error": "^4.1.1",
|
||||||
|
"fast-deep-equal": "^3.1.3",
|
||||||
"fetch-retry": "^5.0.6",
|
"fetch-retry": "^5.0.6",
|
||||||
"fetch-with-proxy": "^3.0.1",
|
"fetch-with-proxy": "^3.0.1",
|
||||||
"focus-visible": "^5.2.0",
|
"focus-visible": "^5.2.0",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { yDocToProsemirrorJSON } from "@getoutline/y-prosemirror";
|
import { yDocToProsemirrorJSON } from "@getoutline/y-prosemirror";
|
||||||
|
import isEqual from "fast-deep-equal";
|
||||||
import uniq from "lodash/uniq";
|
import uniq from "lodash/uniq";
|
||||||
import { Node } from "prosemirror-model";
|
import { Node } from "prosemirror-model";
|
||||||
import * as Y from "yjs";
|
import * as Y from "yjs";
|
||||||
@@ -45,7 +46,7 @@ export default async function documentCollaborativeUpdater({
|
|||||||
const content = yDocToProsemirrorJSON(ydoc, "default") as ProsemirrorData;
|
const content = yDocToProsemirrorJSON(ydoc, "default") as ProsemirrorData;
|
||||||
const node = Node.fromJSON(schema, content);
|
const node = Node.fromJSON(schema, content);
|
||||||
const text = serializer.serialize(node, undefined);
|
const text = serializer.serialize(node, undefined);
|
||||||
const isUnchanged = document.text === text;
|
const isUnchanged = isEqual(document.content, content);
|
||||||
const lastModifiedById = userId ?? document.lastModifiedById;
|
const lastModifiedById = userId ?? document.lastModifiedById;
|
||||||
|
|
||||||
if (isUnchanged) {
|
if (isUnchanged) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable @typescript-eslint/ban-types */
|
/* eslint-disable @typescript-eslint/ban-types */
|
||||||
|
import isEqual from "fast-deep-equal";
|
||||||
import isArray from "lodash/isArray";
|
import isArray from "lodash/isArray";
|
||||||
import isEqual from "lodash/isEqual";
|
|
||||||
import isObject from "lodash/isObject";
|
import isObject from "lodash/isObject";
|
||||||
import pick from "lodash/pick";
|
import pick from "lodash/pick";
|
||||||
import { FindOptions, NonAttribute } from "sequelize";
|
import { FindOptions, NonAttribute } from "sequelize";
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import isEqual from "fast-deep-equal";
|
||||||
import revisionCreator from "@server/commands/revisionCreator";
|
import revisionCreator from "@server/commands/revisionCreator";
|
||||||
import { Revision, Document, User } from "@server/models";
|
import { Revision, Document, User } from "@server/models";
|
||||||
import { DocumentEvent, RevisionEvent, Event } from "@server/types";
|
import { DocumentEvent, RevisionEvent, Event } from "@server/types";
|
||||||
@@ -25,11 +26,11 @@ export default class RevisionsProcessor extends BaseProcessor {
|
|||||||
});
|
});
|
||||||
const previous = await Revision.findLatest(document.id);
|
const previous = await Revision.findLatest(document.id);
|
||||||
|
|
||||||
// we don't create revisions if identical to previous revision, this can
|
// we don't create revisions if identical to previous revision, this can happen if a manual
|
||||||
// happen if a manual revision was created from another service or user.
|
// revision was created from another service or user.
|
||||||
if (
|
if (
|
||||||
previous &&
|
previous &&
|
||||||
document.text === previous.text &&
|
isEqual(document.content, previous.content) &&
|
||||||
document.title === previous.title
|
document.title === previous.title
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user