import { t } from "../../services/i18n.js"; import utils from '../../services/utils.js'; import server from '../../services/server.js'; import toastService from "../../services/toast.js"; import appContext from "../../components/app_context.js"; import libraryLoader from "../../services/library_loader.js"; import openService from "../../services/open.js"; import protectedSessionHolder from "../../services/protected_session_holder.js"; import BasicWidget from "../basic_widget.js"; import dialogService from "../../services/dialog.js"; import OnClickButtonWidget from "../buttons/onclick_button.js"; import options from "../../services/options.js"; const TPL = `
").text(fullRevision.content));
} else if (revisionItem.type === 'image') {
if (fullRevision.mime === "image/svg+xml") {
this.$content.html($("
")
.attr("src", `data:${fullRevision.mime};utf8,${fullRevision.content}`)
.css("max-width", "100%")
.css("max-height", "100%"));
} else {
this.$content.html($("
")
// the reason why we put this inline as base64 is that we do not want to let user copy this
// as a URL to be used in a note. Instead, if they copy and paste it into a note, it will be uploaded as a new note
.attr("src", `data:${fullRevision.mime};base64,${fullRevision.content}`)
.css("max-width", "100%")
.css("max-height", "100%"));
}
} else if (revisionItem.type === 'file') {
const $table = $("| ").text(t("revisions.mime")), $(" | ").text(revisionItem.mime) )) .append($(" |
|---|---|
| ").text(t("revisions.file_size")), $(" | ").text(utils.formatSize(revisionItem.contentLength)) )); if (fullRevision.content) { $table.append($(" |
| ').append(
$(' ').text(t("revisions.preview")),
$('')
.text(fullRevision.content)
)
));
}
this.$content.html($table);
} else if (["canvas", "mindMap"].includes(revisionItem.type)) {
const encodedTitle = encodeURIComponent(revisionItem.title);
this.$content.html($(" ").text(fullRevision.content));
} else {
this.$content.text(t("revisions.preview_not_available"));
}
}
}
| |