mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 06:30:14 +01:00
🎨 Change Search asset content and Add watermark to exported PDF or image from paid features to free features
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
4c0d3365f1
commit
86431cc106
5 changed files with 0 additions and 43 deletions
|
|
@ -12,8 +12,6 @@ import {fetchPost, fetchSyncPost} from "../../util/fetch";
|
|||
import {Dialog} from "../../dialog";
|
||||
import {replaceLocalPath} from "../../editor/rename";
|
||||
import {setStorageVal} from "../util/compatibility";
|
||||
import {isPaidUser} from "../../util/needSubscribe";
|
||||
import {getCloudURL} from "../../config/util/about";
|
||||
import {getFrontend} from "../../util/functions";
|
||||
|
||||
const getPluginStyle = async () => {
|
||||
|
|
@ -269,7 +267,6 @@ const renderPDF = async (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[214].replaceAll("${accountServer}", getCloudURL(""))}</div>
|
||||
</label>
|
||||
</div>
|
||||
<div class="fn__flex" style="padding: 0 16px">
|
||||
|
|
@ -477,12 +474,6 @@ const renderPDF = async (id: string) => {
|
|||
refreshPreview();
|
||||
});
|
||||
const watermarkElement = actionElement.querySelector('#watermark');
|
||||
watermarkElement.addEventListener('change', () => {
|
||||
if (watermarkElement.checked && ${!isPaidUser()}) {
|
||||
watermarkElement.nextElementSibling.style.display = "";
|
||||
watermarkElement.checked = false;
|
||||
}
|
||||
});
|
||||
const refreshPreview = () => {
|
||||
previewElement.innerHTML = '<div class="fn__loading" style="left:0;height: 100vh"><img width="48px" src="${servePath}/stage/loading-pure.svg"></div>'
|
||||
fetchPost("/api/export/exportPreviewHTML", {
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@ import {highlightRender} from "../render/highlightRender";
|
|||
import {processRender} from "../util/processCode";
|
||||
import {isIPhone, isSafari, openByMobile, setStorageVal} from "../util/compatibility";
|
||||
import {useShell} from "../../util/pathName";
|
||||
import {isPaidUser} from "../../util/needSubscribe";
|
||||
import {getCloudURL} from "../../config/util/about";
|
||||
|
||||
export const afterExport = (exportPath: string, msgId: string) => {
|
||||
/// #if !BROWSER
|
||||
|
|
@ -121,16 +119,9 @@ 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 && !isPaidUser()) {
|
||||
watermarkElement.checked = false;
|
||||
showMessage(window.siyuan.languages._kernel[214].replaceAll("${accountServer}", getCloudURL("")));
|
||||
}
|
||||
updateWatermark();
|
||||
});
|
||||
const updateWatermark = () => {
|
||||
if (!isPaidUser()) {
|
||||
return;
|
||||
}
|
||||
const watermarkPreviewElement = exportDialog.element.querySelector(".export-img__watermark") as HTMLElement;
|
||||
watermarkPreviewElement.innerHTML = "";
|
||||
if (watermarkElement.checked) {
|
||||
|
|
|
|||
|
|
@ -8,10 +8,7 @@ import {genQueryHTML} from "./util";
|
|||
import {MenuItem} from "../menus/Menu";
|
||||
import {Dialog} from "../dialog";
|
||||
import {addClearButton} from "../util/addClearButton";
|
||||
import {isPaidUser} from "../util/needSubscribe";
|
||||
import {showMessage} from "../dialog/message";
|
||||
import {saveAssetKeyList} from "./toggleHistory";
|
||||
import {getCloudURL} from "../config/util/about";
|
||||
|
||||
export const openSearchAsset = (element: HTMLElement, isStick: boolean) => {
|
||||
/// #if !MOBILE
|
||||
|
|
@ -165,15 +162,6 @@ export const openSearchAsset = (element: HTMLElement, isStick: boolean) => {
|
|||
let inputTimeout: number;
|
||||
export const assetInputEvent = (element: Element, localSearch?: ISearchAssetOption, page = 1) => {
|
||||
const loadingElement = element.parentElement.querySelector(".fn__loading--top");
|
||||
if (!isPaidUser()) {
|
||||
loadingElement.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].replaceAll("${accountServer}", getCloudURL(""))}
|
||||
</div>`;
|
||||
return;
|
||||
}
|
||||
loadingElement.classList.remove("fn__none");
|
||||
clearTimeout(inputTimeout);
|
||||
inputTimeout = window.setTimeout(() => {
|
||||
|
|
@ -449,10 +437,6 @@ export const assetMoreMenu = (target: Element, element: Element, cb: () => void)
|
|||
iconHTML: "",
|
||||
label: window.siyuan.languages.rebuildIndex,
|
||||
click() {
|
||||
if (!isPaidUser()) {
|
||||
showMessage(window.siyuan.languages["_kernel"][214].replaceAll("${accountServer}", getCloudURL("")));
|
||||
return;
|
||||
}
|
||||
element.parentElement.querySelector(".fn__loading--top").classList.remove("fn__none");
|
||||
fetchPost("/api/asset/fullReindexAssetContent", {}, () => {
|
||||
assetInputEvent(element, localData);
|
||||
|
|
|
|||
|
|
@ -88,11 +88,6 @@ func fullTextSearchAssetContent(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if !model.IsPaidUser() {
|
||||
ret.Code = 1
|
||||
return
|
||||
}
|
||||
|
||||
page, pageSize, query, types, method, orderBy := parseSearchAssetContentArgs(arg)
|
||||
assetContents, matchedAssetCount, pageCount := model.FullTextSearchAssetContent(query, types, method, orderBy, page, pageSize)
|
||||
ret.Data = map[string]interface{}{
|
||||
|
|
|
|||
|
|
@ -1110,10 +1110,6 @@ func processPDFWatermark(pdfCtx *model.Context, watermark bool) {
|
|||
return
|
||||
}
|
||||
|
||||
if !IsPaidUser() {
|
||||
return
|
||||
}
|
||||
|
||||
mode := "text"
|
||||
if gulu.File.IsExist(str) {
|
||||
if ".pdf" == strings.ToLower(filepath.Ext(str)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue