seppzzz/html-editor-scroll

提供一款Silverstripe TinyMCE插件,用于记录HTML编辑器字段中最后一次滚动或编辑的位置。这对于编辑长内容特别有用,可以避免在保存后需要搜索和滚动到之前的编辑位置。

安装次数: 8

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

开放问题: 0

类型:silverstripe-vendormodule

2.0.0 2024-09-27 09:25 UTC

This package is auto-updated.

Last update: 2024-09-27 14:45:44 UTC


README

此Silverstripe TinyMCE插件记录HTML编辑器字段中的最后滚动或编辑位置,确保在编辑长内容时,您可以自动返回到之前的编辑位置。这避免了在保存后手动搜索和滚动回之前的编辑位置的需求。如果没有此插件,编辑器通常在每次保存后重置到内容的顶部。此外,此插件还向TinyMCE工具栏添加了一个“滚动到顶部”按钮,以便快速导航到内容的顶部。

要求

SilverStripe 4 PHP 7.4或更高版本

对于Silverstripe 5.x,请使用silverstripe_5分支。

安装

您可以通过Composer安装此模块

composer require seppzzz/html-editor-scroll:^1.0

或者,您可以从GitHub下载.zip文件,解压缩它,将解压缩的文件夹重命名为html-editor-scroll,并将其复制到您的vendor/seppzzz/目录。

安装后,运行以下命令以重新构建您的SilverStripe项目并公开必要的资源

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

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

文档

默认情况下,每个HTMLEditorField都使用默认的TinyMCEConfig cms。要为此自定义TinyMCEConfig启用此插件,请将以下代码添加到您的SilverStripe配置中

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'),
]);