You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-23 22:36:32 +02:00
Fixed revision issue for old revisions
This commit is contained in:
@@ -45,7 +45,10 @@ export default class Revision extends BaseItem {
|
|||||||
if (this.isLegacyPatch(patch)) {
|
if (this.isLegacyPatch(patch)) {
|
||||||
return this.applyTextPatchLegacy(text, patch);
|
return this.applyTextPatchLegacy(text, patch);
|
||||||
} else {
|
} else {
|
||||||
const result = dmp.patch_apply(JSON.parse(patch), text);
|
// An empty patch should be '[]', but legacy data may be just "".
|
||||||
|
// However an empty string would make JSON.parse fail so we set it
|
||||||
|
// to '[]'.
|
||||||
|
const result = dmp.patch_apply(JSON.parse(patch ? patch : '[]'), text);
|
||||||
if (!result || !result.length) throw new Error('Could not apply patch');
|
if (!result || !result.length) throw new Error('Could not apply patch');
|
||||||
return result[0];
|
return result[0];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user