بنقرة واحدة
mobile-development
Use this skill when making changees related to the mobile version of this plugin
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Use this skill when making changees related to the mobile version of this plugin
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| name | mobile-development |
| description | Use this skill when making changees related to the mobile version of this plugin |
Background: this plugin also works on Obsidian Mobile - which is quite different from Obsidian Desktop. To achieve consistent design, its necessary to use Obsidian variables / components instead of custom ones.
Obsidian provides built-in platform detection through the Platform API:obsidian+1
typescript
import { Platform } from 'obsidian'; if (Platform.isIosApp) { // iOS-specific code } if (Platform.isMobileApp) { // Mobile (iOS or Android) } if (Platform.isPhone) { // Phone-sized screen } if (Platform.isTablet) { // Tablet-sized screen }
Obsidian supports CSS safe area inset variables to handle notches and floating UI elements. Use these in your plugin's CSS:[github]
css
/* Basic safe area usage */ .your-plugin-element { padding-top: env(safe-area-inset-top); padding-right: env(safe-area-inset-right); padding-bottom: env(safe-area-inset-bottom); padding-left: env(safe-area-inset-left); } /* With fallback values */ .your-element { padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: max(12px, env(safe-area-inset-bottom)); } /* Calculate height accounting for safe areas */ .full-height-element { height: calc(100vh - var(--safe-area-inset-top) - var(--safe-area-inset-bottom)); }
Obsidian provides variables that account for its own UI elements:[github]
css
.is-mobile #your-modal { --top-space: calc(var(--safe-area-inset-top) + var(--header-height) + var(--size-4-2)); height: calc(100vh - var(--top-space)) !important; margin-top: var(--top-space); }
Use these classes to target mobile devices specifically:obsidian+1
css
/* Target mobile devices */ .is-mobile .your-element { /* Mobile-specific styles */ } /* Target phone-sized screens */ .is-phone .your-element { /* Phone-specific styles */ } /* Target tablet-sized screens */ .is-tablet .your-element { /* Tablet-specific styles */ }
css
/* Floating button that respects safe areas */ .floating-button { position: fixed; bottom: calc(env(safe-area-inset-bottom) + 20px); right: calc(env(safe-area-inset-right) + 20px); } /* Full-screen modal avoiding UI overlays */ .plugin-modal { position: fixed; top: env(safe-area-inset-top); left: env(safe-area-inset-left); right: env(safe-area-inset-right); bottom: env(safe-area-inset-bottom); } /* Toolbar at bottom avoiding iOS home indicator */ .bottom-toolbar { position: fixed; bottom: 0; left: 0; right: 0; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
Handle landscape orientation on phones:[github]
css
@media only screen and (min-device-width: 480px) and (orientation: landscape) { .is-phone .your-element { /* Landscape-specific layout */ flex-direction: row; } }
Ensure your plugin doesn't interfere with the viewport settings. The safe area variables only work with proper viewport configuration (Obsidian handles this, but be aware):[github]
xml
<meta name="viewport" content="viewport-fit=cover" />
env(safe-area-inset-*) for positioning - This automatically adjusts for notches, home indicators, and rounded cornersapp.emulateMobile(true) during development--header-height and other built-in variables[docs.obsidian]max() function to ensure minimum spacing even on devices without safe areas"isDesktopOnly": false in your plugin's manifest[reddit]While there isn't a single comprehensive guide, these are the official documentation sources:
The key is combining standard web safe area CSS with Obsidian's platform detection and built-in CSS variables to create a responsive, iOS-friendly plugin interface.