Skip to content

Commit

Permalink
[I] Updated TinyMCE4 to v4.7.4 (from v4.6.3)
Browse files Browse the repository at this point in the history
- added param "mobile" to theme.base
- added param "Skin-Theme" to settings
- fixed/improved theme/skin settings and labels
  • Loading branch information
Deesen committed Jan 26, 2018
1 parent 6cff1ad commit 6609e8c
Show file tree
Hide file tree
Showing 81 changed files with 3,810 additions and 2,683 deletions.
42 changes: 39 additions & 3 deletions assets/lib/class.modxRTEbridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function __construct($editorKey = NULL, $bridgeConfig=array(), $tvOptions

// Modx default WYSIWYG-params
$modxParamsArr = array(
'theme', 'skin', 'entermode', 'element_format', 'schema', 'css_selectors',
'theme', 'skin', 'skintheme', 'entermode', 'element_format', 'schema', 'css_selectors',
'custom_plugins', 'custom_buttons1', 'custom_buttons2', 'custom_buttons3', 'custom_buttons4',
'template_docs', 'template_chunks'
);
Expand Down Expand Up @@ -123,6 +123,7 @@ public function __construct($editorKey = NULL, $bridgeConfig=array(), $tvOptions
$this->pluginParams['editorVersion'] = isset($bridgeConfig['editorVersion']) ? $bridgeConfig['editorVersion'] : 'No editorVersion set';
$this->pluginParams['editorLogo'] = isset($bridgeConfig['editorLogo']) ? $bridgeConfig['editorLogo'] : '';
$this->pluginParams['skinsDirectory'] = isset($bridgeConfig['skinsDirectory']) && !empty($bridgeConfig['skinsDirectory']) ? trim($bridgeConfig['skinsDirectory'], "/") . "/" : '';
$this->pluginParams['skinthemeDirectory'] = isset($bridgeConfig['skinthemeDirectory']) && !empty($bridgeConfig['skinthemeDirectory']) ? trim($bridgeConfig['skinthemeDirectory'], "/") . "/" : '';
$this->pluginParams['base_path'] = $basePath;
$this->pluginParams['base_url'] = $baseUrl;
}
Expand Down Expand Up @@ -517,7 +518,10 @@ public function getModxSettings()

// Prepare setting "skin"
$ph['skin_options'] = $this->getSkinNames();


// Prepare setting "skin-theme"
$ph['skintheme_options'] = $this->getSkinThemeNames();

// Prepare setting "entermode_options"
$entermode = !empty($ph[$this->editorKey . '_entermode']) ? $ph[$this->editorKey . '_entermode'] : 'p';
$ph['entermode_options'] = '<label><input name="[+name+]" type="radio" value="p" ' . $this->checked($entermode == 'p') . '/>' . $this->lang('entermode_opt1') . '</label><br />';
Expand Down Expand Up @@ -656,7 +660,9 @@ public function getThemeNames()
//$file = str_replace('\\', '/', $file);
$file = str_replace($themeDir, '', $file);
$file = str_replace('theme.' . $this->editorKey . '.', '', $file);


if(in_array($file,array('index.html'))) continue;

$theme = trim(str_replace('.inc.php', '', $file));
if ($theme == 'base') continue; // Why should user select base-theme?
$label = $this->lang("theme_{$theme}", true) ? $this->lang("theme_{$theme}") : $theme; // Get optional translation or show raw themeKey
Expand Down Expand Up @@ -715,6 +721,36 @@ public function getSkinNames()
return is_array($option) ? implode("\n", $option) : '<!-- ' . $this->editorKey . ': No skins found -->';
}

public function getSkinThemeNames()
{
global $modx;
$params = $this->pluginParams;

$themeDir = "{$params['base_path']}{$params['skinthemeDirectory']}";

switch ($modx->manager->action) {
case '11':
case '12':
case '119':
$selected = $this->selected(empty($params[$this->editorKey . '_skintheme']));
$option[] = '<option value=""' . $selected . '>' . $this->lang('theme_global_settings') . '</option>';
break;
}

foreach (glob("{$themeDir}*") as $theme) {
//$file = str_replace('\\', '/', $file);
$theme = str_replace($themeDir, '', $theme);

if(in_array($theme,array('index.html'))) continue;

$selected = $this->selected($theme == $this->modxParams['skintheme']);

$option[] = '<option value="' . $theme . '"' . $selected . '>' . "{$theme}</option>";
}

return isset($option) && is_array($option) ? implode("\n", $option) : '<!-- ' . $this->editorKey . ': No themes found -->';
}

public function selected($cond = false)
{
if ($cond !== false) return ' selected="selected"';
Expand Down
3 changes: 2 additions & 1 deletion assets/plugins/tinymce4/bridge.tinymce4.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public function __construct($tvOptions=array())
// Editor-Settings
'editorLabel' => 'TinyMCE4', // Name displayed in Modx-Dropdowns - No HTML!
'skinsDirectory'=> 'tinymce/skins', // Relative to plugin-dir
'editorVersion' => '4.6.3', // Version of TinyMCE4-Library
'skinthemeDirectory'=> 'tinymce/themes', // Relative to plugin-dir
'editorVersion' => '4.7.4', // Version of TinyMCE4-Library
'editorLogo' => 'tinymce/logo.png', // Optional Image displayed in Modx-settings

'bridgeParams'=>array('url_setup','style_formats','advanced_resizing','forced_root_block','contentsLangDirection','disabledButtons','selectorPrefix','selector','block_formats'),
Expand Down
14 changes: 12 additions & 2 deletions assets/plugins/tinymce4/gsettings/gsettings.rows.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
<select name="[+name+]" class="inputBox">
[+theme_options+]
</select>',
'message'=>'editor_theme_message'
'message'=>'editor_theme_message',
'messageVal'=>'<b>'. $params['base_url'].'<u>theme</u></b>'
),
'skin'=>array(
'title'=>'editor_skin_title',
Expand All @@ -20,7 +21,16 @@
[+skin_options+]
</select>',
'message'=>'editor_skin_message',
'messageVal'=>'<b>'. $params['base_url'].$params['skinsDirectory'] .'</b>'
'messageVal'=>'<b>'. $params['base_url'].'<u>'.$params['skinsDirectory'] .'</u></b>'
),
'skintheme'=>array(
'title'=>'editor_skintheme_title',
'configTpl'=>'
<select name="[+name+]" class="inputBox">
[+skintheme_options+]
</select>',
'message'=>'editor_skintheme_message',
'messageVal'=>'<b>'. $params['base_url'].'<u>'.$params['skinthemeDirectory'] .'</u></b>'
),
'template'=>array(
'title'=>'tpl_title',
Expand Down
6 changes: 4 additions & 2 deletions assets/plugins/tinymce4/lang/gsettings/english.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

$_lang['lang_code'] = 'en';
$_lang['editor_theme_title'] = 'Theme';
$_lang['editor_theme_message'] = 'Here you can select which theme or skin to use with the editor.';
$_lang['editor_theme_message'] = 'Here you can select which configuration should be used. See ';
$_lang['editor_custom_plugins_title'] = 'Custom Plugins';
$_lang['editor_custom_plugins_message'] = 'Enter the plugins to use for the \'custom\' theme as a comma separated list.';
$_lang['editor_custom_buttons_title'] = 'Custom Buttons';
Expand All @@ -28,7 +28,9 @@
$_lang['theme_legacy'] = 'legacy style';
$_lang['theme_global_settings'] = 'Use the global setting';
$_lang['editor_skin_title'] = 'Skin';
$_lang['editor_skin_message'] = 'Design of toolbar. see ';
$_lang['editor_skin_message'] = 'Skin of TinyMCE toolbar. See ';
$_lang['editor_skintheme_title'] = 'Skin-Theme';
$_lang['editor_skintheme_message'] = 'Skin-Theme of TinyMCE toolbar. See ';
$_lang['editor_entermode_title'] = 'Enter Key Mode';
$_lang['editor_entermode_message'] = 'Operation when the enter key is pressed is set up.';
$_lang['entermode_opt1'] = 'Wrap &lt;p&gt;&lt;/p&gt;';
Expand Down
4 changes: 2 additions & 2 deletions assets/plugins/tinymce4/plugin.tinymce.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Javascript rich text editor
*
* @category plugin
* @version 4.6.3
* @version 4.7.4
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License (GPL)
* @internal @properties &styleFormats=Custom Style Formats <b>RAW</b><br/><br/><ul><li>leave empty to use below block/inline formats</li><li>allows simple-format: <i>Title,cssClass|Title2,cssClass2</i></li><li>Also accepts full JSON-config as per TinyMCE4 docs / configure / content-formating / style_formats</li></ul>;textarea; &styleFormats_inline=Custom Style Formats <b>INLINE</b><br/><br/><ul><li>will wrap selected text with span-tag + css-class</li><li>simple-format only</li></ul>;textarea;InlineTitle,cssClass1|InlineTitle2,cssClass2 &styleFormats_block=Custom Style Formats <b>BLOCK</b><br/><br/><ul><li>will add css-class to selected block-element</li><li>simple-format only</li></ul>;textarea;BlockTitle,cssClass3|BlockTitle2,cssClass4 &customParams=Custom Parameters<br/><b>(Be careful or leave empty!)</b>;textarea; &entityEncoding=Entity Encoding;list;named,numeric,raw;named &entities=Entities;text; &pathOptions=Path Options;list;Site config,Absolute path,Root relative,URL,No convert;Site config &resizing=Advanced Resizing;list;true,false;false &disabledButtons=Disabled Buttons;text; &webTheme=Web Theme;test;webuser &webPlugins=Web Plugins;text; &webButtons1=Web Buttons 1;text;bold italic underline strikethrough removeformat alignleft aligncenter alignright &webButtons2=Web Buttons 2;text;link unlink image undo redo &webButtons3=Web Buttons 3;text; &webButtons4=Web Buttons 4;text; &webAlign=Web Toolbar Alignment;list;ltr,rtl;ltr &width=Width;text;100% &height=Height;text;400px &introtextRte=<b>Introtext RTE</b><br/>add richtext-features to "introtext";list;enabled,disabled;disabled &inlineMode=<b>Inline-Mode</b>;list;enabled,disabled;disabled &inlineTheme=<b>Inline-Mode</b><br/>Theme;text;inline &browser_spellcheck=<b>Browser Spellcheck</b><br/>At least one dictionary must be installed inside your browser;list;enabled,disabled;disabled &paste_as_text=<b>Force Paste as Text</b>;list;enabled,disabled;disabled
* @internal @events OnLoadWebDocument,OnParseDocument,OnWebPagePrerender,OnLoadWebPageCache,OnRichTextEditorRegister,OnRichTextEditorInit,OnInterfaceSettingsRender
Expand All @@ -17,7 +17,7 @@
* @documentation Plugin docs https://github.com/extras-evolution/tinymce4-for-modx-evo
* @documentation Official TinyMCE4-docs https://www.tinymce.com/docs/
* @author Deesen
* @lastupdate 2017-10-25
* @lastupdate 2018-01-17
*/
if (!defined('MODX_BASE_PATH')) { die('What are you doing? Get out of here!'); }

Expand Down
12 changes: 11 additions & 1 deletion assets/plugins/tinymce4/theme/theme.tinymce4.base.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
$this->set('skin', 'lightgray', 'string' ); // Set default skin (setting param first time sets its value also as default val)
$this->set('skin', $this->modxParams['skin'] ); // Overwrite with Modx-setting (if empty, default is used))

$this->set('theme', 'modern', 'string' ); // Set default skin (setting param first time sets its value also as default val)
$this->set('theme', $this->modxParams['skintheme'] ); // Overwrite with Modx-setting (if empty, default is used))

$this->set('width', $this->pluginParams['width'], 'string' ); // https://www.tinymce.com/docs/configure/editor-appearance/#width
$this->set('height', $this->pluginParams['height'], 'string' ); // https://www.tinymce.com/docs/configure/editor-appearance/#height

Expand Down Expand Up @@ -88,4 +91,11 @@
$this->set('forced_root_block', '', 'string'); // https://www.tinymce.com/docs/configure/content-filtering/#forced_root_block

$this->set('setup', 'function(ed) { ed.on("change", function(e) { documentDirty=true; }); }', 'object');
$this->set('save_onsavecallback', 'function () { documentDirty=false; document.getElementById("stay").value = 2; document.mutate.save.click(); }', 'object');
$this->set('save_onsavecallback', 'function () { documentDirty=false; document.getElementById("stay").value = 2; document.mutate.save.click(); }', 'object');

// https://www.tinymce.com/docs/themes/mobile/
$this->set('mobile', '{
theme: "mobile",
plugins: [ "autosave", "lists", "autolink" ],
toolbar: [ "undo", "bold", "italic", "styleselect" ]
}', 'json' );
Loading

0 comments on commit 6609e8c

Please sign in to comment.