=== Inline Context – Footnotes, Tooltips & Glossary Notes ===
Contributors: joop
Tags: footnotes, tooltip, glossary, annotations, sidenotes
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 2.8.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Footnotes, tooltips and glossary notes for the block editor. Click a term to reveal context inline — no page jumps.

== Description ==

Add footnotes, tooltips and glossary notes to any text in the block editor. A reader clicks a term, the explanation opens in place, and they carry on reading - no jump to the bottom of the page, no new tab.

**[Try it in your browser](https://wordpress.org/plugins/inline-context/?preview=1)** - a real WordPress with the plugin already set up. Nothing to install.

Built for sites with a lot of text: editorial, research, documentation and education.

= How it works =

1. Select text in the block editor and press Cmd+Shift+I.
2. Write the note. Rich text, links and images are supported.
3. Optionally give it a category, with its own icon and colour.
4. Publish. The note opens inline or as a tooltip, whichever you choose.

Mark a note **reusable** and it joins your Notes Library. Edit it once and every post that uses it updates.

== Key Features ==

* **Two display modes** - an inline panel or a tooltip, with smart positioning and optional hover activation.
* **Reusable notes** - a Notes Library showing each note's usage count and the posts it appears in, searchable from inside the editor.
* **Categories** - as many as you like, each with any of 300+ Dashicons and its own colour.
* **Styling without CSS** - five WCAG 2.1 AA colour presets, plus live-preview control of colours, spacing, borders and shadows.
* **Images in notes** - inserted straight from the Media Library.
* **Deep links** - every note has its own anchor and opens automatically when someone follows that link.
* **Print** - notes expand and number themselves as footnotes.
* **Keyboard shortcuts** - Cmd+Shift+I to insert, Cmd+Shift+K to edit the note under the cursor.
* **Settings backup** - export and import your configuration as JSON.

== Accessibility ==

Operable by keyboard throughout, with full ARIA state, Escape to close, and focus returned to where it started. Note content is sanitised with DOMPurify.

If JavaScript does not run, the notes fall back to a numbered endnote list at the foot of the post, each with a link back to its place in the text, so the content stays reachable either way.

Translation-ready.

== Credits & source ==

Built with visual artist Renée Kool, who wanted a single link to reveal several related sources. The model was the Dutch journalism platform De Correspondent - see their inline notes in [this article](https://decorrespondent.nl/15887/hoe-nederland-kampioen-deeltijdwerken-werd/9053b712-3591-0002-29b3-8c7b69eae0c3).

Full source, including uncompiled JS and CSS: [codeberg.org/joop/inline-context](https://codeberg.org/joop/inline-context)

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/inline-context`, or install via the Plugins screen.
2. Activate the plugin.
3. Configure categories and styling under **Settings → Inline Context**.
4. In the Block Editor, select text and click **Inline Context**.
5. Add your note content and choose a category (optional).

== Frequently Asked Questions ==

= Can I use this for footnotes, sidenotes or a glossary? =
All three - they are the same feature with different settings. Inline mode reads as a sidenote, tooltip mode as a glossary pop-up, and without JavaScript every note is numbered as a footnote at the end of the post. Reusable notes give you a glossary you edit in one place.

= Does this work with the Classic Editor? =
No. Inline Context is built specifically for the WordPress Block Editor (Gutenberg).

= Does it work with page builders like Elementor or Divi? =
Notes are created in the block editor, so you cannot insert one from a page builder's own editing screen. Notes already in your content display normally on the front end, whatever renders the page.

= Does it work with caching and optimisation plugins? =
Yes. If notes jump to the bottom of the page instead of opening, you are on a version before 2.8.2, where a plugin that delayed or deferred JavaScript could stop the script running. Update, or exclude `inline-context/build/frontend.js` from JavaScript delay and defer.

= What happens to my notes if I deactivate the plugin? =
Nothing is lost. The note text stays in the post and comes back when you reactivate. If you uninstall, the uninstaller can optionally strip the markup and leave your text clean.

= Is it accessible? =
Yes. Triggers are operable by keyboard with full ARIA state and Escape to close, and focus returns to where it started. If JavaScript does not run, the notes appear as a numbered endnote list at the foot of the post, each linking back to its place in the text.

= Will it slow my site down? =
No. A note's content is stored with the post, so showing one costs no extra database queries.

= Can notes contain images and links? =
Yes. Notes accept rich text, links, and images from the Media Library. Images can be switched off under Settings if you want text-only notes.

= Can I use the same note in several posts? =
Yes. Mark it reusable and edit it once - every post that uses it updates.

= Can I change the styles? =
Yes. Pick one of five accessible colour presets, or set colours, spacing, borders and shadows yourself under **Settings → Inline Context → Styling**, with a live preview.

= Is there a limit to the number of categories? =
No. Create as many categories as your content structure requires.

= Can I use any Dashicon? =
Yes. You can type any Dashicon class name to use all 300+ icons.

== Screenshots ==
1. Click a term and the note opens right there - the reader never leaves the paragraph.
2. Tooltip mode shows the same note as a compact popover that stays on screen.
3. Add a note from the block editor toolbar, or press Cmd+Shift+I on a selection.
4. Write the note in a rich text editor and give it a category.
5. Search your existing notes and reuse one instead of retyping it.
6. The Notes Library lists every reusable note, how often it is used and which posts use it.
7. Pill link style, before the reader clicks.
8. Underlined link style with the note expanded inline.
9. Underlined link style shown as a tooltip.

== Changelog ==

= 2.8.3 - October 17, 2026 =
* FIX: The editor popover opened at the far left of the screen instead of next to the text it belongs to, on WordPress 6.3 and later
* FIX: Reusable notes showed a formatting toolbar over content that cannot be edited there; the panel now reads as the preview it is
* FIX: Cmd+Shift+I did nothing when the cursor was inside an existing note. It now opens that note, as well as creating one from a selection
* IMPROVED: The two links in the reusable-note panel each carry an icon, so it is clear which one opens a new tab and which copies to the clipboard
* FIX: The note editor's help text showed the literal characters &lt;/&gt; instead of the code icon `</>` it was describing
* FIX: Note excerpts in the editor's "search existing notes" panel ended in &hellip; instead of an ellipsis; the same escape sequence was also returned by the Abilities API
* FIX: Icon placement "middle" in the repository now matches the value WordPress.org has shipped since 2.7.2, so the released plugin and the source agree. Nothing changes in how notes look
* DEV: New tooling for contributors - a one-command local WordPress environment, a demo-content seeder, a screenshot capture script, and an SVG source for the plugin banner
* DEV: The canonical repository moved to Codeberg

= 2.8.2 - August 27, 2026 =
* FIX: The "Notes" fallback section could stay visible at the bottom of posts, with clicks on a note jumping down to it instead of expanding in place. The frontend script tied its startup to DOMContentLoaded, so it never ran when a caching or optimization plugin deferred, delayed or combined the bundle until after that event had already fired
* FIX: Accessibility — the fallback section was hidden by the generic `js` class, which Twenty Twenty, Seventeen, Sixteen and Fifteen add to the page themselves. On those themes the fallback was hidden even when this plugin's script had not run, leaving screen reader and keyboard users pointed at a hidden anchor with no way to reach the note text. Hiding is now tied to the plugin's own initialisation, so the fallback stays in place until the notes genuinely work
* IMPROVED: Confirmed WordPress 7.1 compatibility — "Tested up to" header bumped to 7.1
* DEV: Added a `@wordpress/env` configuration and `npm run env:*` scripts for a one-command local WordPress environment
* DEV: Added `tests/test-frontend.php` covering the endnotes fallback and its accessibility guarantees
* DEV: `uninstall.php` now removes every plugin option, not just three of them

= 2.8.1 - May 2, 2026 =
* FIX: Inline context popover no longer closes when inserting an image from the WordPress Media Library

= 2.8.0 - May 2, 2026 =
* NEW: Embed images inside inline context notes via the WordPress Media Library
* NEW: Image button in the note editor toolbar (shown when image support is enabled)
* NEW: "Allow images in notes" admin setting in the General tab (default: enabled)
* NEW: Custom Quill image blot preserves alt, loading, decoding, and class attributes
* NEW: `inline_context_allowed_image_protocols` filter for sites that need data URIs or other schemes
* NEW: Three CSS variables for image sizing customization (tooltip max width/height, inline max height)
* IMPROVED: Tooltip mode caps images at ~280×200 to keep tooltips compact
* IMPROVED: Inline mode caps image height at 400px while allowing full content width
* IMPROVED: Print styles handle images with page-break avoidance and sensible sizing
* IMPROVED: Confirmed WordPress 7.0 compatibility — "Tested up to" bumped to 7.0
* IMPROVED: Always sets alt="" on images missing alt text so screen readers don't announce filenames
* IMPROVED: Image src restricted to http(s) and relative paths by default for security
* IMPROVED: Settings export/import now includes the image-support toggle

= 2.7.3 - March 21, 2026 =
* FIX: Category icons now align correctly with text at all icon placement settings
* FIX: Category icon double-scaling issue causing icons to render at half the intended size

= 2.7.2 - March 20, 2026 =
* FIX: Custom category icons now respond to size and placement settings
* FIX: Default chevron icon now responds to color and placement settings
* FIX: Tooltip hover mode no longer shows erratic show/hide behavior
* FIX: Admin settings JS toggles now work (display mode, link style, preset warnings)
* NEW: Icon right margin CSS variable for theme.json and admin settings
* IMPROVED: Refactored icon rendering to use consistent HTML elements for both default and category icons
* IMPROVED: Fine-tuned icon placement values for top, middle, and bottom positions
* IMPROVED: Pill style always centers icons regardless of placement setting

= 2.7.1 - December 30, 2025 =
* FIX: Keyboard shortcut Cmd+Shift+K now works correctly on first try for reusable notes
* IMPROVED: Documentation for automatic cleanup feature with WP-CLI command

= 2.7.0 - December 29, 2025 =
* NEW: Export/Import Settings - Backup and restore all plugin configurations as JSON
* NEW: Print Styles - Professional print formatting with automatic note expansion
* NEW: Footnote-style numbering for printed documents using CSS counters
* NEW: Import/Export tab in admin settings with validation and error handling
* IMPROVED: Smart link URL display in print (shows URLs except for anchor links)
* IMPROVED: Print-optimized typography and colors for professional documents
* FIX: Export/Import now properly handles headers to prevent HTML output issues

= 2.6.0 - December 27, 2025 =
* NEW: Color preset system with five pre-configured professional color schemes
* NEW: Modern Blue (Default), Minimalist Gray, High Contrast, Warm Earth Tones, and Dark Mode presets
* NEW: Automatic preset detection and "Custom" indicator when values are modified
* NEW: Warning dialog before applying preset over custom settings
* IMPROVED: All presets meet WCAG 2.1 AA accessibility standards
* IMPROVED: One-click preset application with instant visual feedback

= 2.4.1 - December 19, 2025 =
* IMPROVED: Documentation

= 2.4.0 - December 19, 2025 =
* NEW: Pill-style link display option with button-like appearance
* NEW: WordPress 6.9+ Abilities API integration for AI assistant discovery
* NEW: Five REST API abilities for AI-powered content enhancement
* NEW: Context Library Panel in editor sidebar
* IMPROVED: Updated "Tested up to" WordPress 6.9

For complete version history, see [changelog.txt](https://codeberg.org/joop/inline-context/src/branch/main/changelog.txt)
