innoweb/silverstripe-fluent-inline-language

Allow inline language change for Accessibility in CMS WYSIWYG editor

Installs: 50

Dependents: 0

Suggesters: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:JavaScript

Type:silverstripe-vendormodule

1.0.0 2019-03-27 02:55 UTC

README

Version License

Overview

This module allows inline language change for Accessibility in CMS WYSIWYG editor.

Requirements

  • SilverStripe CMS 4.x
  • Fluent 4.x

If you are using RTL (right-to-left) languages, please consider installing the Fluent RTL module.

Installation

Install the module using composer:

composer require innoweb/silverstripe-fluent-inline-language dev-master

Then run dev/build.

Functionality

The module adds buttons to the editor to change the language of the selected text to one of the configured Fluent locales and wraps the selected text in a span:

<span lang="en_AU" data-language="English">selected text</span>

If the target language has a different writing direction than the current one, it also adds the dir="ltr|rtl" attribute to the span.

The data-language attribute is used to highlight and display the changed language in the editor.

Configuration

If you are using a custom editor css for TinyMCE, please merge the existing editor css files with your current one as below. Otherwise the css file applied by the module will not be loaded.

TinyMCEConfig::get('cms')->setContentCSS(
    array_merge(
        TinyMCEConfig::get('cms')->getContentCSS(),
        [ModuleResourceLoader::resourceURL(
            ThemeResourceLoader::inst()->findThemedResource('path/to/your/editor.css')
        )]
    )
);

License

BSD 3-Clause License, see License