No description
Find a file
2025-09-27 20:01:02 +03:00
.gitignore Initial commit 2025-09-22 23:45:24 +03:00
README.md Update README.md 2025-09-27 20:01:02 +03:00

Media Layout

A plugin that lets you freely arrange videos, images, and audio — with clone-only presets for rock-solid layouts

Break out of Markdowns linear flow: drag, resize, and position media anywhere on the page in Live Preview. You can edit both originals in the text flow and clones (recommended). Presets and page saves are now clone-only: they store and restore clones (with their size/position/background) and leave originals in the flow, which avoids fragile edge cases.

Main demo – resize & position media


Features

  • Free move & resize for videos, images, and audio in Live Preview — works for originals (in-flow) and clones.
  • Clone-only presets — save/apply page layouts that include only clones (their geometry, backgrounds, locks). Originals remain in the text flow.
  • Optional detaching of originals — you can detach originals to reposition them, but its disabled by default and not recommended (see Important notes).
  • Backgrounds
    • Global background & opacity for all media,
    • Local per-item background, with “Only for this file” to limit styling to the current note.
  • Lock / Unlock any item to avoid accidental moves.
  • Persistence — layouts (clones, settings) persist across reloads.
  • Smooth modal animation (can be disabled) for a pleasant, non-jittery UI.
  • Customization timing — tune panel hide duration, clone restore delay, and note-box restore delay.
  • Localization built-in: de, pl, es, fr, it, be, uk, uz, vi, zh-CN, zh-TW (and expandable).
  • Audio UX — resize/position works; handles are invisible but active.
  • Safety — designed to avoid text selection during drag and keep cursor behavior stable.

Why this exists

Plain Markdown keeps media glued to the text flow. Media Layout provides a floating control layer and clones so you can compose pages visually while your notes remain simple and portable. By making presets clone-only, the plugin avoids flow corruption and stays robust on complex pages.


How to use

  1. Enable the plugin.
  2. Insert media into a note (video / image / audio).
  3. Create a Clone (recommended). You can also work with originals in flow; to reposition originals by detaching them, enable the setting in Media Layout: Settings (see Important notes).
  4. Drag & resize to precise positions.
    Full control of positions
  5. Open the item menu to set Background / Opacity; toggle Only for this file for local styling.
    Customization
  6. Lock items when ready.
  7. Save a Preset — this now saves clones only. Apply will restore clones (sizes/positions/backgrounds); originals stay in the flow.
    Saving presets

Core concepts

Originals (in-flow) vs Clones

  • Originals live in the Markdown flow. You can resize them; to change their position on page, you must enable Detach originals in Media Layout: Settings (off by default).
  • Clones are independent visual instances referencing the same file, with their own size, position, background, and lock.

Recommendation: Use clones for production layouts. Presets are clone-only by design; originals remain stable in the text flow.


Important notes & limitations

  • Detaching originals can cause incorrect flow or visual glitches depending on surrounding content or other plugins.
    Best practice: keep originals in the flow and build your layout with clones.
  • Reset all truly resets everything: clones, their positions, and any detached originals (restores originals to normal flow).
  • Heavy pages (many large videos/GIFs) may impact performance — keep sizes reasonable.
  • Aggressive custom CSS or third-party media enhancers may affect overlays/backgrounds.

Settings & options

  • Detach originals (off by default) — allows repositioning originals outside the flow; use with caution.
  • Presetsclone-only save/apply; include clone geometry, backgrounds, locks.
  • Backgrounds — global defaults; per-item local background & opacity with Only for this file.
  • Timing & animation
    • Panel hide duration (how long the panel waits before hiding),
    • Clone restore delay (stagger clone appearance),
    • Note-box restore delay,
    • Modal animation — smooth open/close (can be disabled).
  • Reset & restore tools for quick cleanup.
  • Language selection (localization).

Where data is stored

The plugin uses Obsidians standard plugin storage (.obsidian/plugins/media-layout/), keeping:

  • clone layouts (positions/sizes),
  • per-item/local backgrounds & opacity,
  • clone-only preset definitions.

FAQ

Do clones duplicate files?
No. They reference the same media file — only geometry/styling is duplicated.

Will my layout persist after restart?
Yes. Clones and their presets are restored automatically.

Can I edit in Reading Mode?
Editing is meant for Live Preview. Reading Mode shows the arranged result; interactions are limited.