seppzzz/html-editor-scroll

Provides a Silverstripe TinyMCE plugin that records the last scrolled or edited position in the HTML editor field. This is especially useful for editing long content, preventing the need to search and scroll to your previous position after saving.

Installs: 10

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:silverstripe-vendormodule

2.0.0 2024-09-27 09:25 UTC

This package is auto-updated.

Last update: 2025-07-12 19:25:21 UTC


README

Provides a Silverstripe TinyMCE plugin that records the last scrolled or edited position in the HTML editor field. This is especially useful for editing long content, preventing the need to search and scroll to your previous position after saving. Also adds a Scroll-To-Top Button to TinyMce.

Requirements

SilverStripe 4 / 5 / 6

Installation

You can install the module via Composer by specifying the appropriate branch alias or version constraint for your SilverStripe version:

SilverStripe Version Composer Command
^6.0 composer require seppzzz/html-editor-scroll
^5.0 composer require seppzzz/html-editor-scroll:dev-silverstripe_5
^4.0 composer require seppzzz/html-editor-scroll:dev-silverstripe_4

Alternatively, you can download the .zip file from GitHub, extract it, rename the extracted folder to html-editor-scroll, and copy it to your vendor/seppzzz/ directory.

After installation, run the following commands to rebuild your SilverStripe project and expose the necessary assets:

# Rebuild the database and regenerate the manifest
vendor/bin/sake dev/build

# Expose the module's public assets
vendor/bin/vendor-expose

Documentation

By default, every HTMLEditorField uses the default TinyMCEConfig cms. To enable this plugin for a custom TinyMCEConfig, add the following code to your SilverStripe configuration:

use SilverStripe\Forms\HTMLEditor\TinyMCEConfig;
use SilverStripe\Core\Manifest\ModuleLoader;

// Load the module where the scroll plugin is located
$editorScrollModule = ModuleLoader::inst()->getManifest()->getModule('seppzzz/html-editor-scroll');

// Enable the scrollposition plugin in the custom TinyMCE configuration
TinyMCEConfig::get('mycustomconfig')->enablePlugins([
    'scrollposition' => $editorScrollModule->getResource('dist/javascript/mceplugin/editorscrollpos/scroll-pos-mce-plugin.js'),
]);