Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #135: Add importcss feature for styles dropdown #136

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tinymce.admin.inc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function _tinymce_settings_form(array &$form, array $form_state, $format) {
'#attributes' => array(
'placeholder' => '/core/themes/basis/css/skin.css',
),
'#description' => t('Add URLs to CSS files, the editor should use to display its content, one file per line.'),
'#description' => t('Add URLs to CSS files, the editor should use to display its content, one file per line.<br>If a file is named <code>tinymce-styles-dropdown.css</code>, this file additionally gets parsed for items to append to the toolbar styles dropdown.'),
);

$elements['tabs']['image_browser'] = array(
Expand Down
10 changes: 10 additions & 0 deletions tinymce.module
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,16 @@ function _tinymce_js_settings($format, array $existing_settings) {
$options['tiny_options']['skin'] = $settings['tinymce_settings']['skin'];
$options['tiny_options']['content_css'] = _tinymce_get_content_css($settings['tinymce_settings']);

// If that specific file is also part of content CSS, let Tiny parse it.
if (count($options['tiny_options']['content_css']) > 1) {
$parse_file_found = preg_grep('#tinymce-styles-dropdown\.css$#', $options['tiny_options']['content_css']);
if (!empty($parse_file_found)) {
$options['tiny_options']['plugins'] .= ' importcss';
$options['tiny_options']['importcss_file_filter'] = 'tinymce-styles-dropdown.css';
$options['tiny_options']['importcss_append'] = TRUE;
}
}

// Collect additional TinyMCE plugins from hook.
$external_plugins = module_invoke_all('tinymce_external_plugins', $format);
$icon_registry = array();
Expand Down