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: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:silverstripe-vendormodule
Requires
- php: ^8.0
- silverstripe/login-forms: ^5.0
- silverstripe/recipe-cms: ^5.0
- silverstripe/recipe-plugin: ^2.0
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-12-27 15:21:48 UTC
README
This Silverstripe TinyMCE plugin records the last scrolled or edited position within the HTML editor field, ensuring that when editing long content, you are automatically returned to your previous position. This prevents the need to manually search and scroll back after saving. Without this plugin, the editor typically resets to the top of the content after each save. Additionally, the plugin adds a "Scroll-To-Top" button to the TinyMCE toolbar for quick navigation to the top of the content.
Requirements
SilverStripe 4 PHP 7.4 or higher
For Silverstripe 5.x use the silverstripe_5 - branch.
Installation
You can install the module via Composer:
composer require seppzzz/html-editor-scroll:^1.0
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'), ]);