Vanessa 2024-01-01 23:25:09 +08:00
parent 6f0c68f506
commit 68b0cd0e40
3 changed files with 24 additions and 12 deletions

View file

@ -13,7 +13,7 @@ import {Dialog} from "../../dialog";
import {pathPosix} from "../../util/pathName";
import {replaceLocalPath} from "../../editor/rename";
import {setStorageVal} from "../util/compatibility";
import {needSubscribe} from "../../util/needSubscribe";
import {isPaidUser, needSubscribe} from "../../util/needSubscribe";
export const saveExport = (option: IExportOptions) => {
/// #if !BROWSER
@ -246,7 +246,7 @@ const renderPDF = (id: string) => {
</div>
<span class="fn__hr"></span>
<input id="watermark" class="b3-switch" type="checkbox" ${localData.watermark ? "checked" : ""}>
<div style="display:none;font-size: 12px;margin-top: 12px;color: var(--b3-theme-on-surface);">${window.siyuan.languages._kernel[29]}</div>
<div style="display:none;font-size: 12px;margin-top: 12px;color: var(--b3-theme-on-surface);">${window.siyuan.languages._kernel[214]}</div>
</label>
<div class="fn__flex">
<div class="fn__flex-1"></div>
@ -452,7 +452,7 @@ id="preview">
});
const watermarkElement = actionElement.querySelector('#watermark');
watermarkElement.addEventListener('change', () => {
if (watermarkElement.checked && ${needSubscribe("")}) {
if (watermarkElement.checked && ${!isPaidUser()}) {
watermarkElement.nextElementSibling.style.display = "";
watermarkElement.checked = false;
}

View file

@ -12,7 +12,7 @@ import {highlightRender} from "../render/highlightRender";
import {processRender} from "../util/processCode";
import {openByMobile, setStorageVal} from "../util/compatibility";
import {showFileInFolder} from "../../util/pathName";
import {needSubscribe} from "../../util/needSubscribe";
import {isPaidUser, needSubscribe} from "../../util/needSubscribe";
export const afterExport = (exportPath: string, msgId: string) => {
/// #if !BROWSER
@ -97,13 +97,16 @@ export const exportImage = (id: string) => {
const watermarkElement = (exportDialog.element.querySelector("#watermark") as HTMLInputElement);
watermarkElement.addEventListener("change", () => {
window.siyuan.storage[Constants.LOCAL_EXPORTIMG].watermark = watermarkElement.checked;
if (watermarkElement.checked && needSubscribe("")) {
if (watermarkElement.checked && !isPaidUser()) {
watermarkElement.checked = false;
showMessage(window.siyuan.languages._kernel[29]);
showMessage(window.siyuan.languages._kernel[214]);
}
updateWatermark();
});
const updateWatermark = () => {
if (!isPaidUser()) {
return;
}
const watermarkPreviewElement = exportDialog.element.querySelector(".export-img__watermark") as HTMLElement;
watermarkPreviewElement.innerHTML = "";
if (watermarkElement.checked) {