2021-02-02 12:24:54 +05:00
|
|
|
import { QuillDeltaToHtmlConverter } from "quill-delta-to-html";
|
|
|
|
|
|
2020-12-05 15:26:54 +05:00
|
|
|
export const migrations = {
|
2020-12-07 13:11:44 +05:00
|
|
|
4: {
|
|
|
|
|
note: function (item) {
|
|
|
|
|
if (item.notebooks && item.notebooks.every((n) => !n.id)) {
|
|
|
|
|
item.notebooks = undefined;
|
|
|
|
|
}
|
2020-12-08 12:23:35 +05:00
|
|
|
return migrations["4.1"].note(item);
|
|
|
|
|
},
|
2021-02-02 12:24:54 +05:00
|
|
|
delta: (item) => migrations["4.1"].delta(item),
|
2020-12-08 12:23:35 +05:00
|
|
|
},
|
|
|
|
|
4.1: {
|
|
|
|
|
note: function (item) {
|
|
|
|
|
return migrations["4.2"].note(item);
|
|
|
|
|
},
|
2021-02-02 12:24:54 +05:00
|
|
|
delta: (item) => migrations["4.2"].delta(item),
|
2020-12-08 12:23:35 +05:00
|
|
|
},
|
|
|
|
|
4.2: {
|
|
|
|
|
note: function (item) {
|
|
|
|
|
if (item.notebooks) {
|
|
|
|
|
item.notebooks = item.notebooks.map((nb) => {
|
|
|
|
|
return { id: nb.id, topics: nb.topics || [nb.topic] };
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-12-06 15:35:23 +05:00
|
|
|
item.migrated = true;
|
2020-12-06 10:52:00 +05:00
|
|
|
return item;
|
2020-12-05 15:26:54 +05:00
|
|
|
},
|
2021-02-02 12:24:54 +05:00
|
|
|
delta: (item) => migrations["4.3"].delta(item),
|
2020-12-05 15:26:54 +05:00
|
|
|
},
|
2020-12-08 12:23:35 +05:00
|
|
|
4.3: {
|
2021-02-02 12:24:54 +05:00
|
|
|
delta: function (item) {
|
|
|
|
|
const deltaConverter = new QuillDeltaToHtmlConverter(item.data, {
|
|
|
|
|
classPrefix: "nn",
|
|
|
|
|
inlineStyles: true,
|
|
|
|
|
});
|
|
|
|
|
item.data = deltaConverter.convert();
|
|
|
|
|
item.type = "tiny";
|
|
|
|
|
item.migrated = true;
|
2021-02-12 10:01:06 +05:00
|
|
|
return migrations["5"].delta(item);
|
2021-02-02 12:24:54 +05:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
5.0: {
|
2021-02-12 10:01:06 +05:00
|
|
|
tiny: function (item) {
|
|
|
|
|
return migrations["5"].delta(item);
|
|
|
|
|
},
|
2021-02-12 09:49:17 +05:00
|
|
|
delta: function (item) {
|
|
|
|
|
if (item.conflicted) {
|
|
|
|
|
const deltaConverter = new QuillDeltaToHtmlConverter(
|
|
|
|
|
item.conflicted.data,
|
|
|
|
|
{
|
|
|
|
|
classPrefix: "nn",
|
|
|
|
|
inlineStyles: true,
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
item.conflicted.data = deltaConverter.convert();
|
|
|
|
|
item.conflicted.type = "tiny";
|
|
|
|
|
item.conflicted.migrated = true;
|
|
|
|
|
}
|
|
|
|
|
return item;
|
|
|
|
|
},
|
|
|
|
|
},
|
2021-02-20 11:31:44 +05:00
|
|
|
5.1: {},
|
|
|
|
|
5.2: {
|
2020-12-06 10:52:00 +05:00
|
|
|
note: false,
|
2020-12-07 13:11:44 +05:00
|
|
|
notebook: false,
|
2020-12-06 10:52:00 +05:00
|
|
|
tag: false,
|
|
|
|
|
trash: false,
|
2021-02-12 10:01:06 +05:00
|
|
|
tiny: false,
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated
|
|
|
|
|
*/
|
2020-12-06 11:13:17 +05:00
|
|
|
delta: false,
|
2020-12-06 10:52:00 +05:00
|
|
|
settings: false,
|
2020-12-05 15:26:54 +05:00
|
|
|
},
|
|
|
|
|
};
|