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