Skip to content

Commit d061e6d

Browse files
authored
Issue #10: Support for TinyMCE (#11)
1 parent 70a2543 commit d061e6d

File tree

3 files changed

+109
-0
lines changed

3 files changed

+109
-0
lines changed

css/editor.css

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/**
2+
* @file
3+
* Basic styles to apply to editor content.
4+
*/
5+
body {
6+
font: 1rem/1.6 verdana, sans-serif;
7+
}
8+
a {
9+
text-decoration: none;
10+
}
11+
a:hover {
12+
text-decoration: underline;
13+
}
14+
ol,
15+
ul {
16+
margin: 1em 0 1em 1em;
17+
padding: 0 0 0 1.2em;
18+
}
19+
blockquote {
20+
margin: 1em 0;
21+
padding: 0 0 0 1em;
22+
border-left: 4px solid #ddd;
23+
}
24+
pre {
25+
padding: 4px;
26+
max-width: 100%;
27+
overflow: auto;
28+
border-radius: 3px;
29+
}
30+
table {
31+
border-collapse: collapse;
32+
max-width: 100%;
33+
margin: 1em 0 1.5em;
34+
}
35+
tr.even {
36+
background-color: initial;
37+
}
38+
td, th {
39+
padding: 4px 10px;
40+
vertical-align: top;
41+
}
42+
audio,
43+
video,
44+
iframe,
45+
form,
46+
button,
47+
input,
48+
optgroup,
49+
select,
50+
textarea {
51+
max-width: 100%;
52+
}
53+
h1 {
54+
font-size: 2em;
55+
line-height: 1.4;
56+
}
57+
h2 {
58+
font-size: 1.6em;
59+
line-height: 1.5;
60+
}
61+
h3 {
62+
font-size: 1.5em;
63+
}
64+
h4 {
65+
font-size: 1.1em;
66+
}
67+
h5 {
68+
font-size: 1em;
69+
}
70+
h6 {
71+
font-size: 1em;
72+
}
73+
@media screen and (min-width: 960px) {
74+
h1 {
75+
font-size: 2.3em;
76+
}
77+
h2 {
78+
font-size: 1.7em;
79+
}
80+
}

lateral.info

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ stylesheets[all][] = css/colors.css
99
stylesheets[screen][] = css/maintenance.css
1010

1111
scripts[] = js/helper.js
12+
tinymce_content_css[] = css/editor.css
1213

1314
settings[header_position] = 'left'
1415
settings[font] = 'opensans'

template.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,31 @@ function lateral_ckeditor_settings_alter(&$settings, $format) {
110110
$settings['contentsCss'][] = $path . '/css/colors.css';
111111
}
112112
}
113+
114+
/**
115+
* Implements hook_tinymce_options_alter().
116+
*/
117+
function lateral_tinymce_options_alter(array &$options, $format) {
118+
global $base_url, $base_path;
119+
$path = $base_path . backdrop_get_path('theme', 'lateral');
120+
$font_selected = theme_get_setting('font');
121+
122+
if ($font_selected == 'merriweather') {
123+
$options['tiny_options']['content_css'][] = $path . '/css/merriweather.css';
124+
}
125+
elseif ($font_selected == 'opensans') {
126+
$options['tiny_options']['content_css'][] = $path . '/css/use-opensans.css';
127+
}
128+
$color_uris = theme_get_setting('color.files');
129+
if ($color_uris) {
130+
// We only have a single color css file.
131+
$color_uri = reset($color_uris);
132+
$url = file_create_url($color_uri);
133+
$color_css = substr($url, strlen($base_url));
134+
$options['tiny_options']['content_css'][] = $color_css;
135+
}
136+
else {
137+
// No color module setting, add the theme's default file.
138+
$options['tiny_options']['content_css'][] = $path . '/css/colors.css';
139+
}
140+
}

0 commit comments

Comments
 (0)