| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| OpenPublisher5-i386-windowsXP.exe | 2026-10-17 | 56.5 MB | |
| openpublisher5_amd64-windows-portable.exe | 2026-10-17 | 183.2 MB | |
| openpublisher5_amd64-windows.exe | 2026-10-17 | 165.2 MB | |
| openpublisher5_amd64-macos.dmg | 2026-10-17 | 233.1 MB | |
| 5.9.0_ Seamless Highlight Override on Pasted CSS-Styled Text source code.tar.gz | 2026-10-17 | 23.3 MB | |
| 5.9.0_ Seamless Highlight Override on Pasted CSS-Styled Text source code.zip | 2026-10-17 | 23.6 MB | |
| README.md | 2026-10-17 | 9.9 kB | |
| openpublisher5_amd64-linux.run | 2026-10-17 | 193.4 MB | |
| openpublisher5_amd64-linux.rpm | 2026-10-17 | 215.4 MB | |
| openpublisher5_amd64-linux.flatpak | 2026-10-17 | 153.6 MB | |
| openpublisher5_amd64-linux.deb | 2026-10-17 | 156.2 MB | |
| openpublisher5_amd64-linux.AppImage | 2026-10-17 | 166.4 MB | |
| openpublisher5_amd64-freebsd.pkg | 2026-10-17 | 185.5 MB | |
| Totals: 13 Items | 1.8 GB | 0 | |
π Summary
Version 5.9.0 addresses an important usability and styling interaction in Open Publisher: when users copy and paste rich text from external websites or dark-themed applications into text boxes or tables, the pasted HTML preserves its inline and block CSS background styling (such as solid black backgrounds around the text). While preserving this pasted styling upon initial paste is intended and desired, users frequently mistake that background styling for Open Publisher's native text highlight feature, becoming confused when attempting to change the highlight color with the Highlight Color tool because the external CSS styling overrides and conflicts with browser highlight formatting.
To eliminate this confusion without losing any capabilities, Open Publisher v5.9.0 implements a seamless highlight override architecture:
- Initial Paste Preservation: Rich HTML/CSS text pasted from external applications continues to retain its full visual styling, including original background colors, padding, and font styling upon paste.
- Seamless Highlight Override Engine: When the user subsequently activates the Highlight Color tool (
execCmd('hiliteColor', val)orexecCmd('backColor', val)), the text engine automatically strips conflicting pasted CSS background styles from the editable root, block wrappers (<div>,<p>,<pre>,<blockquote>, headings, lists, etc.), and pasted inline elements, applying the newly chosen highlight color cleanly. - Pasted Background vs. Native Highlight Distinction: Native Open Publisher highlights are explicitly tagged with
data-opub-hilite="true". A capture-phase paste listener clears this attribute on newly pasted foreign DOM nodes, allowing the engine to distinguish between foreign CSS backgrounds and intentional user highlights. - Collapsed Caret & Quick Highlight Support: When a user pastes CSS-styled text and immediately clicks the Highlight tool without first drag-selecting (or when clicking into a styled text box with a collapsed caret), the engine automatically selects all contents of the active editable container and applies the highlight seamlessly across the text.
- Color Picker Text Selection Preservation: Fixed an issue in
extensions/ui-interactions.jswhere clicking swatches, switching tabs, or dragging on the custom HSV color picker canvas cleared the active text selection and blurred the editable container. Added#custom-color-picker,.ribbon-container, and.custom-dropdownto the toolbar exclusion whitelist. - Instant Selection Range Snapshotting: In
core/boot.jsandCustomColorPicker.open,state.lastRangeis now snapshotted immediately upon selection changes rather than waiting for UI debounce timers, ensuring live HSV canvas dragging and rapid swatch clicking always execute against the exact text range.
π Architecture & Technical Implementation
1. Pasted CSS Background Override & Native Highlight Engine
- The Issue: When rich text is copied from external sites (such as dark-mode documentation, Discord, ChatGPT, Notion, or code editors), browsers serialize computed styles into block containers (
<p style="background-color: rgb(0,0,0)">,<div style="background: #000">,<pre>), inline spans (<span style="background-color: ...">),<mark>tags, and<style>blocks. Whendocument.execCommand('hiliteColor', false, val)runs: - Block-level elements retain their CSS background color, painting a black rectangular block behind the text.
- Inner child spans and code elements retain their own inline background colors, painting over any outer highlight span.
- User-agent default styling on
<mark>tags overrides inline highlight spans. - Calling
document.execCommand('backColor', false, val)can set block-level backgrounds rather than inline text highlights. - The Solution in
elements/text/text.js: - Implemented
stripCssBackgroundProps(el, isRootEditable)to removebackground,background-color,background-image,background-clip,-webkit-background-clip,box-shadow, andbgcolorattributes. - Implemented
isElementTextFullyInRange(el, range)using DOMTreeWalkerto accurately identify whether an element's text content is completely covered by the active selection range. - Implemented
applySeamlessHighlight(editableRoot, val):- Removes any foreign
<style>tags pasted inside the editable container. - Strips CSS background styling from the editable root (preserving
.element-contentand table cells). - If the current selection is collapsed or outside the editable, selects all contents of
editableRootso pasted text can be highlighted in a single click. - Strips CSS background styling from all block elements and non-highlight elements, as well as any existing highlight spans fully contained within the selection range.
- Neutralizes user-agent yellow backgrounds on
<mark>tags by defaulting unstyled marks totransparent. - Applies the highlight color via
document.execCommand('hiliteColor', false, val)(withbackColorfallback). - Performs a post-pass DOM
TreeWalkerscan to tag highlight spans withdata-opub-hilite="true"and wraps any missed text nodes (such as inside<pre>/<code>ordisplay: inline-blockcontainers) in<span style="background-color: ${val}" data-opub-hilite="true">.
- Removes any foreign
- Added a capture-phase
pastelistener ondocumentthat strips any foreigndata-opub-hiliteattributes from newly pasted elements while preserving pre-existing user highlights.
2. Color Picker Selection Preservation & Selection Synchronization
- The Issue: In
extensions/ui-interactions.js, theinstallSmartTextInteractionglobalmouseuplistener checked whethere.targetwas inside a toolbar. Because#custom-color-pickeris appended directly to<body>, clicking any swatch, tab, or dragging on the custom HSV canvas triggered the!clickedToolbarbranch, clearingwindow.getSelection()and blurring the active text box. Furthermore,core/boot.jsupdatedstate.lastRangeinside a 150ms debounce timer, causing rapid color picker interactions to lose range context. - The Solution in
extensions/ui-interactions.js,ui/components/color-picker.js, andcore/boot.js: - In
extensions/ui-interactions.js, addede.target.closest('#custom-color-picker'),e.target.closest('.ribbon-container'), ande.target.closest('.custom-dropdown')toclickedToolbar. - In
ui/components/color-picker.js, updatedCustomColorPicker.opento immediately snapshot the active selection range inside#paperintostate.lastRange. - In
core/boot.js, updated theselectionchangelistener to updatestate.lastRangesynchronously on every change before running the debounced toolbar UI updates.
π Files Modified in 5.9.0
| File | Changes |
|---|---|
elements/text/text.js |
Implemented stripCssBackgroundProps, isElementTextFullyInRange, and applySeamlessHighlight. Added capture-phase paste listener for highlight tagging. Integrated seamless highlight overrides into execCmd for both standard text boxes and multi-cell tables. Header bumped to (v5.9.0). |
ui/components/color-picker.js |
Snapshotted active selection range inside #paper into state.lastRange in CustomColorPicker.open. |
extensions/ui-interactions.js |
Whitelisted #custom-color-picker, .ribbon-container, and .custom-dropdown in clickedToolbar to prevent text selection clearing on swatch and canvas clicks. Header and console log bumped to (v5.9.0). |
core/boot.js |
Updated selectionchange listener to capture state.lastRange immediately. Header bumped to (v5.9.0). |
core/core.js |
Bumped header comment to (v5.9.0). |
index.html |
Bumped all script and style cachebusters to ?v=5.9.0. |
sw.js |
Updated Service Worker cache namespace to open-publisher-v5-9-0 and header to (v5.9.0). |
ui/menus.js |
Bumped header comment to (v5.9.0). |
ui/sidebar-context.js |
Bumped header comment to (v5.9.0). |
ui/modals/card-sheet-modal.js |
Bumped header comment to (v5.9.0). |
ui/modals/options-modal.js |
Bumped header comment to (v5.9.0). |
tools/proofing/spellcheck-engine.js |
Bumped header comment to (v5.9.0). |
extensions/legacy-fixes.js |
Bumped header comment to (v5.9.0). |
extensions/print-engine.js |
Bumped header comment to (v5.9.0). |
extensions/pwa-install.js |
Bumped header comment to (v5.9.0). |
wrapper.html was not modified.
β v5.9.0 Verification Checklist
- [x] Initial Paste Styling Preserved: Pasting CSS-styled text from dark-themed sites retains its original background color and styling on initial paste.
- [x] Conflicting CSS Background Stripping: Attempting to change highlight color on pasted text removes block and inline CSS background styling and applies the new highlight cleanly.
- [x] Collapsed Caret Support: Clicking the Highlight tool with a collapsed caret immediately after pasting highlights all text in the target box.
- [x] Multi-Highlight Coexistence: Changing highlight color on one word does not strip or corrupt existing Open Publisher highlights on neighboring words.
- [x] Color Picker Interaction: Clicking swatches, switching tabs, or dragging the HSV canvas in
#custom-color-pickerpreserves active text selection and range. - [x] Service Worker & Cachebuster Sync: Verified
sw.jscache name isopen-publisher-v5-9-0and all asset query strings inindex.htmlreference?v=5.9.0. - [x] Subsystem Version Consistency: Confirmed all modified subsystems and modules reflect version 5.9.0.
π Version 5.9.0: Open Publisher