mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 17:40:13 +01:00
🐛 mobile
This commit is contained in:
parent
d316585905
commit
8457cbc5fb
2 changed files with 21 additions and 4 deletions
|
|
@ -16,8 +16,10 @@ import {showMessage} from "../../../dialog/message";
|
||||||
import {previewImage} from "../../preview/image";
|
import {previewImage} from "../../preview/image";
|
||||||
import {isLocalPath, pathPosix} from "../../../util/pathName";
|
import {isLocalPath, pathPosix} from "../../../util/pathName";
|
||||||
import {Constants} from "../../../constants";
|
import {Constants} from "../../../constants";
|
||||||
|
/// #if !MOBILE
|
||||||
import {openAsset} from "../../../editor/util";
|
import {openAsset} from "../../../editor/util";
|
||||||
import {getSearch, isMobile} from "../../../util/functions";
|
/// #endif
|
||||||
|
import {getSearch} from "../../../util/functions";
|
||||||
import {unicode2Emoji} from "../../../emoji";
|
import {unicode2Emoji} from "../../../emoji";
|
||||||
import {selectRow} from "./row";
|
import {selectRow} from "./row";
|
||||||
import * as dayjs from "dayjs";
|
import * as dayjs from "dayjs";
|
||||||
|
|
@ -126,8 +128,9 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
|
||||||
} else if (linkElement.classList.contains("b3-chip")) {
|
} else if (linkElement.classList.contains("b3-chip")) {
|
||||||
linkAddress = linkElement.dataset.url;
|
linkAddress = linkElement.dataset.url;
|
||||||
}
|
}
|
||||||
|
/// #if !MOBILE
|
||||||
const suffix = pathPosix().extname(linkAddress);
|
const suffix = pathPosix().extname(linkAddress);
|
||||||
if (isLocalPath(linkAddress) && !isMobile() && (
|
if (isLocalPath(linkAddress) && (
|
||||||
[".pdf"].concat(Constants.SIYUAN_ASSETS_AUDIO).concat(Constants.SIYUAN_ASSETS_VIDEO).includes(suffix) && (
|
[".pdf"].concat(Constants.SIYUAN_ASSETS_AUDIO).concat(Constants.SIYUAN_ASSETS_VIDEO).includes(suffix) && (
|
||||||
suffix !== ".pdf" || (suffix === ".pdf" && !linkAddress.startsWith("file://"))
|
suffix !== ".pdf" || (suffix === ".pdf" && !linkAddress.startsWith("file://"))
|
||||||
)
|
)
|
||||||
|
|
@ -136,6 +139,10 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
|
||||||
} else {
|
} else {
|
||||||
window.open(linkAddress);
|
window.open(linkAddress);
|
||||||
}
|
}
|
||||||
|
/// #else
|
||||||
|
window.open(linkAddress);
|
||||||
|
/// #endif
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,10 @@ import {Constants} from "../../../constants";
|
||||||
import {hideElements} from "../../ui/hideElements";
|
import {hideElements} from "../../ui/hideElements";
|
||||||
import {isLocalPath, pathPosix} from "../../../util/pathName";
|
import {isLocalPath, pathPosix} from "../../../util/pathName";
|
||||||
import {openEmojiPanel, unicode2Emoji} from "../../../emoji";
|
import {openEmojiPanel, unicode2Emoji} from "../../../emoji";
|
||||||
import {getSearch, isMobile} from "../../../util/functions";
|
import {getSearch} from "../../../util/functions";
|
||||||
|
/// #if !MOBILE
|
||||||
import {openAsset} from "../../../editor/util";
|
import {openAsset} from "../../../editor/util";
|
||||||
|
/// #endif
|
||||||
import {previewImage} from "../../preview/image";
|
import {previewImage} from "../../preview/image";
|
||||||
|
|
||||||
export const openMenuPanel = (options: {
|
export const openMenuPanel = (options: {
|
||||||
|
|
@ -747,7 +749,8 @@ export const openMenuPanel = (options: {
|
||||||
} else if (type === "openAssetItem") {
|
} else if (type === "openAssetItem") {
|
||||||
const assetLink = target.parentElement.dataset.content;
|
const assetLink = target.parentElement.dataset.content;
|
||||||
const suffix = pathPosix().extname(assetLink);
|
const suffix = pathPosix().extname(assetLink);
|
||||||
if (isLocalPath(assetLink) && !isMobile() && (
|
/// #if !MOBILE
|
||||||
|
if (isLocalPath(assetLink) && (
|
||||||
[".pdf"].concat(Constants.SIYUAN_ASSETS_AUDIO).concat(Constants.SIYUAN_ASSETS_VIDEO).includes(suffix) && (
|
[".pdf"].concat(Constants.SIYUAN_ASSETS_AUDIO).concat(Constants.SIYUAN_ASSETS_VIDEO).includes(suffix) && (
|
||||||
suffix !== ".pdf" || ( suffix === ".pdf" && !assetLink.startsWith("file://"))
|
suffix !== ".pdf" || ( suffix === ".pdf" && !assetLink.startsWith("file://"))
|
||||||
)
|
)
|
||||||
|
|
@ -758,6 +761,13 @@ export const openMenuPanel = (options: {
|
||||||
} else {
|
} else {
|
||||||
window.open(assetLink);
|
window.open(assetLink);
|
||||||
}
|
}
|
||||||
|
/// #else
|
||||||
|
if (Constants.SIYUAN_ASSETS_IMAGE.includes(suffix)) {
|
||||||
|
previewImage(assetLink);
|
||||||
|
} else {
|
||||||
|
window.open(assetLink);
|
||||||
|
}
|
||||||
|
/// #endif
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue