add clipboardjs support

Created on 16 February 2025, 21 days ago

Problem/Motivation

Currently, the module can highlight code in many programming languages and colour the corresponding tags. However, to add a little more convenience from the end user's point of view, it should be possible to copy the individual code blocks to the clipboard.

In principle, this can also be done with the module Copy 2 Clipboard, which already exists for Drupal.
However, this has to be installed separately and, on the other hand, content editors then have to manually wrap each code block in a div. This is very cumbersome to use. It would be much nicer if the module provided a button for each inserted code block, for example using clipboardjs.

This would be an advantage for content editors and site visitors alike, and they could provide code examples as usual.

The crowning glory would be if you could select whether you wanted to display a button for copying to the clipboard when inserting the respective code block, or not, and you could also specify in the module settings whether this button should be activated or deactivated by default.

Steps to reproduce

There are no steps to reproduce, because that functionallity doesn't exist, yet

Proposed resolution

Write a patch to extend the module with clipboard js copy to clipboard button

Remaining tasks

create patch
test
create new release

User interface changes

Codeblocks will contain copy to clipboard button

API changes

tbd

Data model changes

tbd

Feature request
Status

Active

Version

1.1

Component

Code

Created by

🇩🇪Germany joachim namyslo Kulmbach 🇩🇪 🇪🇺

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024