A page on Olivero with editing on: the hero heading has a blue outline and a pencil, and the P-Pencil toolbar sits at the bottom.
The Edit Heading popup under a heading, with its breadcrumb, the new words previewed in the page, the help text, More fields…, Cancel and Save.
The Edit Text popup under two paragraphs, with the field's own CKEditor 5 toolbar.
The Edit Image popup next to a photo: a preview, Upload new, Choose from the site and the required alt text.
The changed heading in the page, with a "Changes saved" message and an Undo button above the toolbar.
The popup's conflict panel showing the latest saved version and your version, with Use latest version and Overwrite with my version.
The Edit all fields popup with Drupal's own widgets for a card: image, title, text and link.
A calm panel instead of the editor: No edits left this month, when they come back, Edit in the backend and Add a pack.
The page at phone width with the Edit Heading popup open as a sheet at the bottom of the screen.

This project is not covered by Drupal’s security advisory policy.

Edit content where you read it. Point at a heading, a paragraph, a link or an image on the page, click the pencil, change it in a small popup and save. The change goes back to the exact entity field it came from, through the Entity API, with the same access checks and validation as the edit form, as one new revision of the page.

The screenshots on this page were taken on Olivero, Drupal's stock theme, with no theme work. The README is the full guide, with a screenshot of every step.

What it does

  • A pencil on every value an editor may change. People with the "Edit content on the page" permission get a toolbar and pencils, and only where they could already edit the entity, the field and the text format in the backend. Visitors get nothing: no script, no extra markup, and Drupal's page cache is untouched.
  • The right editor for the field. Plain text gets one line, and formatted text a small editor or the field's own CKEditor 5. Links get their text and address, and images their alt text and an upload. Anything else opens the entity's own form widgets in "More fields…".
  • Paragraphs, saved through their page. A change deep inside a paragraph is saved as one new revision of the page that holds it, so Revisions and Revert keep working. Paragraphs is optional: any entity's text, link and image fields work, and so do taxonomy terms and menu links.
  • Safe saves. Every item is validated before anything is written. Each save offers Undo, and a change someone else saved first is never overwritten without a choice: "Use latest version" or "Overwrite with my version".
  • No theme work for the usual case. Text, link text and image alt text get a pencil on the page's own entity and its paragraphs, in any theme that prints them through Drupal's field templates. A Twig filter, a PHP service and two alter hooks cover what a theme prints itself.

It needs p-pencil.cloud after a free allowance

The module is free software under the GPL, and all of it is here. Saves on a live site are counted in credits by p-pencil.cloud, a paid service run by the maintainer:

  • One credit is one save that changes content. Undo, Revisions › Revert, uploads, saves that change nothing, failed saves and local development hosts (localhost, 127.0.0.1, *.ddev.site, *.lndo.site, *.docksal.site and *.test) are free.
  • A new site gets 50 trial edits. After that it needs connecting to a p-pencil.cloud account, which includes 100 free credits a month. More credits come in packs: the README's Credits and billing has the prices.
  • When the credits run out, editors are told before they start and a save already under way still lands. Editing in Drupal's backend always works, and visitors notice nothing.
  • Counting happens in this module, on your server, and is honour-based. There is no obfuscated code and no licence check.

What it sends

Nothing until an admin connects the site. Once connected, the site sends p-pencil.cloud the number and kind of saves (text, link, image, form or dev), their times, the allowance they came from, the site's origin and host name, the site's public key and the module and Drupal versions. Never content, and never who edited.

Requests go out from your server over HTTPS, signed with an Ed25519 key the site makes itself; the private key never leaves the site. Nothing needs to reach your site from outside.

Requirements

  • Drupal 11 and PHP 8.3 or later, with the sodium extension (ext-sodium, included in most PHP builds).
  • Core's Field, File, Filter, Image, Link, Path alias, Text and User modules.
  • Outbound HTTPS to p-pencil.cloud once the site is connected.
  • Optional: Paragraphs.

Installation

composer require 'drupal/p_pencil:^1.0@alpha'
drush en p_pencil
drush role:perm:add editor 'use p-pencil'

Use your own editor role in place of editor. Then connect the site from the banner admins see, at Configuration › Content authoring › P-Pencil, or with drush p-pencil:connect. The README has every step.

Known limits

  • Empty fields and images with an empty alt text have nothing to click: edit them through "More fields…".
  • Text written into templates, rather than kept in a field or config, isn't editable.
  • This is an alpha: the API between the module and the cloud is versioned, but hooks and settings may still change before 1.0.0.

Similar projects

Both are free and need no service. P-Pencil differs in finding values in the printed page, whatever the template does with them, and in saving Paragraphs through their page as one revision.

Support

Report bugs and ask for features in the issue queue. The README is the guide until the full documentation goes live at p-pencil.cloud/docs.

Please report security issues privately to ciao@hamadhere.de, never in the public issue queue. The same address is for collaboration. Until this project is covered by drupal.org's security advisory policy, the Drupal Security Team doesn't handle its reports.

Project information

Releases