This commit is contained in:
parent
6f0c68f506
commit
68b0cd0e40
3 changed files with 24 additions and 12 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -10,6 +10,8 @@ import {Dialog} from "../dialog";
|
|||
import {Menu} from "../plugin/Menu";
|
||||
import {hasClosestByClassName} from "../protyle/util/hasClosest";
|
||||
import {addClearButton} from "../util/addClearButton";
|
||||
import {isPaidUser} from "../util/needSubscribe";
|
||||
import {showMessage} from "../dialog/message";
|
||||
|
||||
export const openSearchAsset = (element: Element, isStick: boolean) => {
|
||||
/// #if !MOBILE
|
||||
|
@ -169,6 +171,15 @@ export const openSearchAsset = (element: Element, isStick: boolean) => {
|
|||
|
||||
let inputTimeout: number;
|
||||
export const assetInputEvent = (element: Element, localSearch?: ISearchAssetOption, page = 1) => {
|
||||
if (!isPaidUser()) {
|
||||
element.nextElementSibling.classList.add("fn__none");
|
||||
element.querySelector(".search__drag")?.classList.add("fn__none");
|
||||
element.querySelector("#searchAssetPreview").classList.add("fn__none");
|
||||
element.querySelector("#searchAssetList").innerHTML = `<div class="search__empty">
|
||||
${window.siyuan.languages["_kernel"][214]}
|
||||
</div>`;
|
||||
return;
|
||||
}
|
||||
element.nextElementSibling.classList.remove("fn__none");
|
||||
clearTimeout(inputTimeout);
|
||||
inputTimeout = window.setTimeout(() => {
|
||||
|
@ -190,12 +201,6 @@ export const assetInputEvent = (element: Element, localSearch?: ISearchAssetOpti
|
|||
orderBy: localSearch.sort
|
||||
}, (response) => {
|
||||
element.nextElementSibling.classList.add("fn__none");
|
||||
if (response.code === 1) {
|
||||
element.querySelector("#searchAssetList").innerHTML = `<div class="search__empty">
|
||||
${window.siyuan.languages["_kernel"][214]}
|
||||
</div>`;
|
||||
return;
|
||||
}
|
||||
const nextElement = element.querySelector('[data-type="assetNext"]');
|
||||
if (page < response.data.pageCount) {
|
||||
nextElement.removeAttribute("disabled");
|
||||
|
@ -518,6 +523,10 @@ export const assetMoreMenu = (target: Element, element: Element, cb: () => void)
|
|||
iconHTML: Constants.ZWSP,
|
||||
label: window.siyuan.languages.rebuildIndex,
|
||||
click() {
|
||||
if (!isPaidUser()) {
|
||||
showMessage(window.siyuan.languages["_kernel"][214]);
|
||||
return;
|
||||
}
|
||||
element.nextElementSibling.classList.remove("fn__none");
|
||||
fetchPost("/api/asset/fullReindexAssetContent", {}, () => {
|
||||
assetInputEvent(element, localData);
|
||||
|
|
Loading…
Add table
Reference in a new issue