embedページの判定をconfig.tsに移行
This commit is contained in:
@@ -4,17 +4,14 @@
|
||||
*/
|
||||
import { miLocalStorage } from "@/local-storage.js";
|
||||
import type { Keys } from "@/local-storage.js";
|
||||
|
||||
export function isEmbedPage() {
|
||||
return location.pathname.startsWith('/embed');
|
||||
}
|
||||
import { embedPage } from "@/config.js";
|
||||
|
||||
/**
|
||||
* EmbedページではlocalStorageを使用できないようにしているが、
|
||||
* 動作に必要な値はsafeSessionStorage(miLocalStorage内のやつ)に移動する
|
||||
*/
|
||||
export function initEmbedPageLocalStorage() {
|
||||
if (!isEmbedPage()) {
|
||||
if (!embedPage) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -10,12 +10,12 @@ import {
|
||||
set as iset,
|
||||
del as idel,
|
||||
} from 'idb-keyval';
|
||||
import { isEmbedPage } from './embed-page.js';
|
||||
import { embedPage } from '@/config.js';
|
||||
import { miLocalStorage } from '@/local-storage.js';
|
||||
|
||||
const PREFIX = 'idbfallback::';
|
||||
|
||||
let idbAvailable = typeof window !== 'undefined' ? !!(window.indexedDB && typeof window.indexedDB.open === 'function' && !isEmbedPage()) : true;
|
||||
let idbAvailable = typeof window !== 'undefined' ? !!(window.indexedDB && typeof window.indexedDB.open === 'function' && !embedPage) : true;
|
||||
|
||||
// iframe.contentWindow.indexedDB.deleteDatabase() がchromeのバグで使用できないため、indexedDBを無効化している。
|
||||
// バグが治って再度有効化するのであれば、cypressのコマンド内のコメントアウトを外すこと
|
||||
|
@@ -11,7 +11,7 @@ import { globalEvents } from '@/events.js';
|
||||
import lightTheme from '@/themes/_light.json5';
|
||||
import darkTheme from '@/themes/_dark.json5';
|
||||
import { miLocalStorage } from '@/local-storage.js';
|
||||
import { isEmbedPage } from '@/scripts/embed-page.js';
|
||||
import { embedPage } from '@/config.js';
|
||||
|
||||
export type Theme = {
|
||||
id: string;
|
||||
@@ -96,7 +96,7 @@ export function applyTheme(theme: Theme, persist = true) {
|
||||
document.documentElement.style.setProperty(`--${k}`, v.toString());
|
||||
}
|
||||
|
||||
if (!isEmbedPage()) {
|
||||
if (!embedPage) {
|
||||
document.documentElement.style.setProperty('color-scheme', colorScheme);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user