Skip to content

Commit

Permalink
added new editor filters #251
Browse files Browse the repository at this point in the history
  • Loading branch information
AndiDittrich committed Apr 25, 2020
1 parent b9cc4c2 commit 38f95f4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 42 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Added: EnlighterJS `v3.3.0`
* Added: EnlighterJS Theme-Customizer `v2.2.0`
* Added: compatbility mode for [CodeColorer](https://wordpress.org/support/plugin/codecolorer/) . features requested [by ajtruckle on GitHub](https://github.com/EnlighterJS/Plugin.WordPress/issues/222)
* Added: filters to alter the editor config (Gutenberg+TinyMCE) - features requested [by ajtruckle on GitHub](https://github.com/EnlighterJS/Plugin.WordPress/issues/251)
* Bugfix: added missing languages to the list (abap,scala,qml,verilog)

* Added: [apachehttpd/htaccess](https://httpd.apache.org/docs/2.4/configuring.html) support
Expand All @@ -25,6 +26,8 @@
* Changed: removed tab "fonts"
* Bugfix: highlighted-line hover selector was invalid -> selection of `background-color:hover` was not possible - thanks to [ajtruckle on GitHub](https://github.com/EnlighterJS/Plugin.ThemeCustomizer/issues/4) #4

* Bugfix: removed typos in code edit dialog - thanks to [ajtruckle on GitHub](https://github.com/EnlighterJS/Plugin.TinyMCE/issues/10)


### 4.1.0 ###

Expand Down
38 changes: 2 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: syntax highlighting, javascript, code, coding, sourcecode, mootools, jquer
Donate link: https://enlighterjs.org
Requires at least: 5.0
Tested up to: 5.4
Stable tag: 4.1.0
Stable tag: 4.2.0
License: GPL-2.0
License URI: https://opensource.org/licenses/gpl-2.0.php

Expand All @@ -31,7 +31,7 @@ It also supports the automatic creation of tab-panes to display code-groups toge
* Powerful generic highlighting engine for unknown languages
* Theme Customizer
* Inline Syntax Highlighting
* Advanced configuration options (CDN usage, ..) are available within the options page.
* Advanced configuration options are available within the options page.
* Supports code-groups (displays multiple code-blocks within a tab-pane)
* Extensible language and theme engines - add your own one.
* Simple CSS based themes
Expand Down Expand Up @@ -131,40 +131,6 @@ All modern webbrowsers with enabled Javascript and HTML5 capabilities for "data-
### 4.2 ###
Everything has been changed - read enlighterjs.org/wp-v4 before upgrading - THIS RELEASE IS NOT BACKWARD COMPATIBLE

### 4.1 ###
Everything has been changed - read enlighterjs.org/wp-v4 before upgrading - THIS RELEASE IS NOT BACKWARD COMPATIBLE

### 4.0 ###
Everything has been changed - read enlighterjs.org/wp-v4 before upgrading - THIS RELEASE IS NOT BACKWARD COMPATIBLE

### 3.3 ###
PHP 5.3 Backward Compatibility

### 3.0 ###
New fault-tolerant Shortcode-Processor is integrated. You can switch back to the old one on the Enlighter Settings Page -> Editing -> Shortcode

### 2.11 ###
Bugfix Release (initialization may fail when upgrading to 2.10)

### 2.9 ###
Bugfix Release (TinyMCE and EnlighterJS Core)

### 2.6 ###
Renamed the EnlighterJS files to `EnlighterJS.min.css` and `EnlighterJS.min.js`. In case you have applied custom modifications these changes may broke your setup and you need to change it!
Added [EnlighterJS v2.5](https://enlighterjs.org/) with some optimization.

### 2.4 ###
Removed WordPress 3.8 Visual Editor compatibility - Enlighter now requires WordPress >= 3.9 including TinyMCE 4

### 2.2 ###
Full Visual-Editor (TinyMCE4) Integration including codeblock-settings (WordPress >= 3.9 required)

### 2.0 ###
Added Inline-Syntax-Highlighting as well as some other cool feature - please go to the settings page and click "Apply Settings"

### 1.8 ###
Added Visual-Editor (TinyMCE) Integration (will avoid auto-whitespace-removing issues)

## Frequently Asked Questions ##

The WordPress plugin [related FAQ page](https://github.com/EnlighterJS/documentation/blob/master/wordpress/FAQ.md) is available [on GitHub](https://github.com/EnlighterJS/documentation/blob/master/wordpress/FAQ.md) within the documentation repository!
20 changes: 16 additions & 4 deletions modules/editor/EditorConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@ public function __construct($config, $ejs, $languageManager, $themeManager){
}

public function getEditorConfigCode(){
// filtered languages
$languages = apply_filters('enlighter_editor_languages', $this->_languageManager->getLanguages());

// filtered themes
$themes = apply_filters('enlighter_editor_themes', $this->_themeManager->getThemes());

// create config object
return 'EnlighterJS_EditorConfig = ' . json_encode(array(
'languages' => $this->_languageManager->getLanguages(),
'themes' => $this->_themeManager->getThemes(),
$config = array(
'languages' => $languages,
'themes' => $themes,
'config' => $this->_enlighterjs->getConfig(),
'tinymce' => array(
'tabIndentation' => $this->_config['tinymce-tabindentation'],
Expand All @@ -39,6 +45,12 @@ public function getEditorConfigCode(){
'text' => array(
'quicktags' => $this->_config['quicktag-mode']
)
)) . ';';
);

// apply config
$config = apply_filters('enlighter_editor_config', $config);

// create config object
return 'EnlighterJS_EditorConfig = ' . json_encode($config) . ';';
}
}
4 changes: 2 additions & 2 deletions resources/tinymce/enlighterjs.tinymce.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 38f95f4

Please sign in to comment.