Release 1.2.10

This commit is contained in:
imeed166 2026-05-12 23:06:53 +01:00
parent f17b5c6ba7
commit 93d647a2cf
6 changed files with 53 additions and 18 deletions

23
main.js
View file

@ -3208,6 +3208,9 @@ var CrossPlayerPlugin = class extends import_obsidian.Plugin {
await this.playMedia(nextItem, true);
}
}
async permanentlyDeleteVaultFile(file) {
await this.app.vault.delete(file, true);
}
async playNextItem() {
this.rememberQueueScrollPosition();
let currentIndex = -1;
@ -3313,7 +3316,7 @@ var CrossPlayerPlugin = class extends import_obsidian.Plugin {
}
const file = this.app.vault.getAbstractFileByPath(item.path);
if (file instanceof import_obsidian.TFile) {
await this.app.fileManager.trashFile(file);
await this.permanentlyDeleteVaultFile(file);
count++;
removedIds.add(item.id);
} else if (!file) {
@ -3346,7 +3349,7 @@ var CrossPlayerPlugin = class extends import_obsidian.Plugin {
try {
const file = this.app.vault.getAbstractFileByPath(item.path);
if (file instanceof import_obsidian.TFile) {
await this.app.fileManager.trashFile(file);
await this.permanentlyDeleteVaultFile(file);
deletedFromDisk = true;
} else if (!file) {
deletedFromDisk = true;
@ -3964,12 +3967,18 @@ var CrossPlayerListView = class extends import_obsidian.ItemView {
};
}
refresh() {
var _a;
var _a, _b;
const container = this.contentEl;
const storedScrollTop = (_a = this.plugin.data.queueScrollTop) != null ? _a : this.savedScrollTop;
const oldList = container.querySelector(".cross-player-list");
if (oldList) {
this.savedScrollTop = oldList.scrollTop;
this.plugin.data.queueScrollTop = this.savedScrollTop;
const measuredScrollTop = oldList.scrollTop;
if (measuredScrollTop > 0 || storedScrollTop === 0) {
this.savedScrollTop = measuredScrollTop;
this.plugin.data.queueScrollTop = measuredScrollTop;
} else {
this.savedScrollTop = storedScrollTop;
}
}
container.empty();
container.addClass("cross-player-list-view");
@ -4138,7 +4147,7 @@ var CrossPlayerListView = class extends import_obsidian.ItemView {
});
const downloadContainer = container.createDiv({ cls: "cross-player-download-container" });
this.updateDownloadProgress(downloadContainer);
const scrollTopToRestore = (_a = this.plugin.data.queueScrollTop) != null ? _a : this.savedScrollTop;
const scrollTopToRestore = (_b = this.plugin.data.queueScrollTop) != null ? _b : this.savedScrollTop;
if (scrollTopToRestore > 0) {
list.scrollTop = scrollTopToRestore;
window.requestAnimationFrame(() => {
@ -4668,7 +4677,7 @@ var CrossPlayerMainView = class extends import_obsidian.ItemView {
return;
if (Date.now() - pointerStartTime > 500)
return;
handlePlayerTap(e.target instanceof HTMLElement ? e.target : null, e);
handlePlayerTap(e.target instanceof Element ? e.target : null, e);
};
const onPointerCancel = () => {
pointerMoved = true;

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "cross-player",
"version": "1.2.9",
"version": "1.2.10",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "cross-player",
"version": "1.2.9",
"version": "1.2.10",
"license": "MIT",
"dependencies": {
"@types/sortablejs": "^1.15.9",

View file

@ -1,6 +1,6 @@
{
"name": "cross-player",
"version": "1.2.9",
"version": "1.2.10",
"description": "Media player plugin for Obsidian focused on playback across desktop and mobile devices",
"main": "main.js",
"scripts": {

12
release.sh Executable file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -e
VERSION="${1:?Usage: ./release.sh <version>}"
npm version "$VERSION" --no-git-tag-version || true
npm run build
git add .
git commit -m "Release $VERSION"
git tag -a "$VERSION" -m "Release $VERSION"
git push origin main
git push origin "$VERSION"

View file

@ -1213,6 +1213,10 @@ export default class CrossPlayerPlugin extends Plugin {
}
}
private async permanentlyDeleteVaultFile(file: TAbstractFile) {
await this.app.vault.delete(file, true);
}
async playNextItem() {
this.rememberQueueScrollPosition();
@ -1324,7 +1328,7 @@ export default class CrossPlayerPlugin extends Plugin {
const file = this.app.vault.getAbstractFileByPath(item.path);
if (file instanceof TFile) {
await this.app.fileManager.trashFile(file);
await this.permanentlyDeleteVaultFile(file);
count++;
removedIds.add(item.id);
} else if (!file) {
@ -1364,7 +1368,7 @@ export default class CrossPlayerPlugin extends Plugin {
try {
const file = this.app.vault.getAbstractFileByPath(item.path);
if (file instanceof TFile) {
await this.app.fileManager.trashFile(file);
await this.permanentlyDeleteVaultFile(file);
deletedFromDisk = true;
} else if (!file) {
deletedFromDisk = true;
@ -2253,12 +2257,18 @@ class CrossPlayerListView extends ItemView {
refresh() {
const container = this.contentEl;
const storedScrollTop = this.plugin.data.queueScrollTop ?? this.savedScrollTop;
// Save scroll position before emptying
const oldList = container.querySelector(".cross-player-list");
const oldList = container.querySelector<HTMLElement>(".cross-player-list");
if (oldList) {
this.savedScrollTop = oldList.scrollTop;
this.plugin.data.queueScrollTop = this.savedScrollTop;
const measuredScrollTop = oldList.scrollTop;
if (measuredScrollTop > 0 || storedScrollTop === 0) {
this.savedScrollTop = measuredScrollTop;
this.plugin.data.queueScrollTop = measuredScrollTop;
} else {
this.savedScrollTop = storedScrollTop;
}
}
container.empty();
@ -3129,7 +3139,7 @@ class CrossPlayerMainView extends ItemView {
);
};
const isOverlayControlTarget = (target: HTMLElement | null) => {
const isOverlayControlTarget = (target: Element | null) => {
if (!target || !isOverlayVisible()) return false;
if (target.closest('.cross-player-big-btn')) {
@ -3146,7 +3156,7 @@ class CrossPlayerMainView extends ItemView {
);
};
const handlePlayerTap = (target: HTMLElement | null, event: Event) => {
const handlePlayerTap = (target: Element | null, event: Event) => {
if (!isOverlayVisible()) {
event.preventDefault();
event.stopPropagation();
@ -3187,7 +3197,7 @@ class CrossPlayerMainView extends ItemView {
const onPointerUp = (e: PointerEvent) => {
if (!e.isPrimary || pointerMoved) return;
if (Date.now() - pointerStartTime > 500) return;
handlePlayerTap(e.target instanceof HTMLElement ? e.target : null, e);
handlePlayerTap(e.target instanceof Element ? e.target : null, e);
};
const onPointerCancel = () => {

View file

@ -266,6 +266,9 @@
.cross-player-overlay-progress {
width: 100%;
flex: 1 1 auto;
display: block;
min-width: 0;
accent-color: var(--interactive-accent);
margin: 0;
touch-action: none;
@ -281,6 +284,7 @@
.cross-player-overlay-progress-shell {
flex: 1;
width: 100%;
display: flex;
align-items: center;
min-width: 0;