Rev 13722 | Rev 13726 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
13602 | obado | 1 | !! insert this before `!header` : `!read js/external/tinymce.phtml xxxx` |
2 | !! with xxxx pointing to an existing DOM element (a textarea) |
||
3 | |||
4 | !if $wims_read_parm!= |
||
5 | |||
13722 | obado | 6 | !if createxo notin $module |
7 | !set iEdit_plugins=code help hr link lists |
||
8 | !set iEdit_toolbar=undo redo | formatselect aligncenter | bold italic strikethrough | subscript superscript | hr link | bullist numlist | removeformat | code | help |
||
9 | !reset iEdit_formats |
||
10 | !else |
||
11 | !set iEdit_plugins=code help hr lists |
||
12 | !set iEdit_toolbar=undo redo | styleselect aligncenter | bold italic strikethrough | subscript superscript | hr link | bullist numlist | removeformat | code | help |
||
13 | !set iEdit_formats=formats: {\ |
||
13724 | obado | 14 | /*oef_indgood: { inline: 'span', classes: 'oef_indgood', exact: true },\ |
13722 | obado | 15 | oef_indbad: { inline: 'span', classes: 'oef_indbad', exact: true },\ |
16 | oef_indpartial: { inline: 'span', classes: 'oef_indpartial' },\ |
||
13724 | obado | 17 | oef_indforget: { inline: 'span', classes: 'oef_indforget' },*/\ |
13722 | obado | 18 | aligncenter: { selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes: 'wimscenter' },\ |
19 | wims_instruction: { block: 'div', classes: 'wims_instruction'},\ |
||
13724 | obado | 20 | /*wims_msg_success: { block: 'div', classes: 'wims_msg success'},\ |
13722 | obado | 21 | wims_msg_alert: { block: 'div', classes: 'wims_msg alert'},\ |
22 | wims_msg_warning: { block: 'div', classes: 'wims_msg warning'},\ |
||
23 | wims_msg_info: { block: 'div', classes: 'wims_msg info'},\ |
||
13724 | obado | 24 | wims_msg_help: { block: 'div', classes: 'wims_msg help'},*/\ |
25 | wims_difficultylevel: { inline: 'span', classes: 'wims_difficultylevel'},\ |
||
26 | wims_emph: { inline: 'span', classes: 'wims_emph'},\ |
||
27 | wims_smallhelp: { block: 'div', classes: 'wims_smallhelp'},\ |
||
28 | wims_color1: { block: 'div', classes: 'wims_color1'},\ |
||
29 | wims_color2: { block: 'div', classes: 'wims_color2'},\ |
||
30 | wims_color3: { block: 'div', classes: 'wims_color3'},\ |
||
13722 | obado | 31 | },style_formats: [\ |
32 | { title: 'Paragraph', format: 'p'},\ |
||
33 | { title: 'Headings', items: [\ |
||
34 | { title: 'Heading 1', format: 'h2' },\ |
||
35 | { title: 'Heading 2', format: 'h3' },\ |
||
36 | { title: 'Heading 3', format: 'h4' },\ |
||
37 | { title: 'Heading 4', format: 'h5' },\ |
||
38 | { title: 'Heading 5', format: 'h6' }\ |
||
39 | ]},\ |
||
13724 | obado | 40 | /*{ title: 'OEF answers', items: [\ |
13722 | obado | 41 | { title: 'Good answer', format: 'oef_indgood' },\ |
42 | { title: 'Bad answer', format: 'oef_indbad' },\ |
||
43 | { title: 'Partial answer', format: 'oef_indpartial' },\ |
||
44 | { title: 'Forgotten answer', format: 'oef_indforget' },\ |
||
45 | ]},\ |
||
46 | { title: 'WIMS Messages', items: [\ |
||
47 | { title: 'Success', format: 'wims_msg_success' },\ |
||
48 | { title: 'Alert', format: 'wims_msg_alert' },\ |
||
49 | { title: 'Warning', format: 'wims_msg_warning' },\ |
||
50 | { title: 'Info', format: 'wims_msg_info' },\ |
||
51 | { title: 'Help', format: 'wims_msg_help' },\ |
||
13724 | obado | 52 | ]},*/\ |
53 | { title: 'Theme colors', items: [\ |
||
54 | { title: 'Color 1', format: 'wims_color1' },\ |
||
55 | { title: 'Color 2', format: 'wims_color2' },\ |
||
56 | { title: 'Color 3', format: 'wims_color3' },\ |
||
13722 | obado | 57 | ]},\ |
58 | { title: 'Other WIMS styles', items: [\ |
||
59 | { title: 'Instructions', format: 'wims_instruction' },\ |
||
13724 | obado | 60 | { title: 'Small help', format: 'wims_smallhelp' },\ |
61 | { title: 'Blockquote', format: 'blockquote' },\ |
||
13722 | obado | 62 | { title: 'Code', format: 'code' },\ |
13724 | obado | 63 | { title: 'Difficulty level', format: 'wims_difficultylevel' },\ |
64 | { title: 'Emphase', format: 'wims_emph' },\ |
||
13722 | obado | 65 | ]},\ |
66 | ], |
||
67 | !endif |
||
68 | |||
69 | |||
13695 | obado | 70 | !let name_WYSIWYG_activate=Activate editor |
71 | !let name_WYSIWYG_disable=Disable editor |
||
13602 | obado | 72 | !if $lang=fr |
13614 | obado | 73 | !set tiny_lang=language: 'fr_FR', |
13695 | obado | 74 | !let name_WYSIWYG_activate=Activer l'éditeur |
75 | !let name_WYSIWYG_disable=Désactiver l'éditeur |
||
13602 | obado | 76 | !endif |
13614 | obado | 77 | !if $lang=it |
78 | !set tiny_lang=language: 'it', |
||
13695 | obado | 79 | !let name_WYSIWYG_activate=Activate editor |
80 | !let name_WYSIWYG_disable=Disable editor |
||
13614 | obado | 81 | !endif |
13602 | obado | 82 | !if $lang=cn |
13648 | obado | 83 | !set tiny_lang=language: 'zh_CN', |
13695 | obado | 84 | !let name_WYSIWYG_activate=Activate editor |
85 | !let name_WYSIWYG_disable=Disable editor |
||
13602 | obado | 86 | !endif |
87 | |||
13606 | obado | 88 | !set wims_html_header= !append line <script src="scripts/js/external/tinymce/tinymce.min.js"></script>\ |
13695 | obado | 89 | <style>.hidden_btn{display:none}.wysiwyg_btns{text-align:right;font-size:.6em}</style>\ |
13602 | obado | 90 | <script>\ |
13695 | obado | 91 | document.addEventListener("DOMContentLoaded", function() {\ |
92 | /* Insert "enable/disable editor" buttons */\ |
||
93 | var ed_instances = document.querySelectorAll("$wims_read_parm");\ |
||
94 | ed_instances.forEach(function(ed) {\ |
||
95 | if(ed.id){\ |
||
96 | var div = document.createElement('div');\ |
||
97 | div.classList.add('wysiwyg_btns');\ |
||
98 | var a1 = document.createElement('a');\ |
||
99 | var linkText = document.createTextNode("$name_WYSIWYG_disable");\ |
||
100 | a1.appendChild(linkText);\ |
||
101 | a1.setAttribute("onclick","javascript:tinymce.execCommand('mceRemoveEditor',true,'"+ed.id+"');this.classList.add('hidden_btn');this.nextElementSibling.classList.remove('hidden_btn');");\ |
||
102 | div.appendChild(a1);\ |
||
103 | var a2 = document.createElement('a');\ |
||
104 | var linkText = document.createTextNode("$name_WYSIWYG_activate");\ |
||
105 | a2.appendChild(linkText);\ |
||
106 | a2.setAttribute("onclick","javascript:tinymce.execCommand('mceAddEditor',true,'"+ed.id+"');this.classList.add('hidden_btn');this.previousElementSibling.classList.remove('hidden_btn');");\ |
||
107 | a2.classList.add("hidden_btn");\ |
||
108 | div.appendChild(a2);\ |
||
109 | /* insert just after editor */\ |
||
110 | ed.parentNode.insertBefore(div, ed.nextSibling);\ |
||
111 | }\ |
||
112 | });\ |
||
113 | /* Initialize editors */\ |
||
13602 | obado | 114 | tinymce.init({\ |
115 | selector:'$wims_read_parm',\ |
||
13722 | obado | 116 | plugins: '$iEdit_plugins',\ |
117 | block_formats : tinymce.translate('Paragraph')+'=p;' +tinymce.translate('Heading 1')+'=h2;'+tinymce.translate('Heading 2')+'=h3;' +tinymce.translate('Heading 3')+'=h4;' +tinymce.translate('Heading 4')+'=h5;' +tinymce.translate('Heading 5')+'=h6;' +tinymce.translate('Preformatted')+'=pre;' +tinymce.translate('Blockquote')+'=blockquote;',\ |
||
13602 | obado | 118 | menubar: false,\ |
119 | branding: false,\ |
||
13722 | obado | 120 | toolbar: '$iEdit_toolbar',\ |
13614 | obado | 121 | $tiny_lang\ |
13722 | obado | 122 | $iEdit_formats\ |
13622 | obado | 123 | content_css : 'html/themes/$wims_theme/css.css',\ |
124 | body_class: 'main_body',\ |
||
125 | content_style : 'a, .ui-widget-content a{color:$wims_link_color;}a:hover, a:focus {color:$wims_hlink_color;}table.wimstable th{background-color: $wims_ref_bgcolor;color: $wims_ref_menucolor;}table.wimstable th a{color: $wims_ref_menucolor;}.wimstable caption a{color: $wims_ref_menucolor;}.wims_emph {color:$wims_ref_bgcolor;}input[type="submit"],input[type="button"],.main_body .wims_button{background-color:$wims_ref_button_bgcolor;color:$wims_ref_button_color;}.main_body .wims_button_help{background-color:$wims_ref_button_help_bgcolor;color:$wims_ref_button_help_color;}.property_fields{border-color:$wims_ref_bgcolor;}.property_fields legend{background-color: $wims_ref_bgcolor;}.property_fields legend,.property_fields legend>a{color:$wims_ref_menucolor;}.wims_color1 {background-color: $wims_ref_bgcolor;color:$wims_ref_menucolor;}.wims_color2 {background-color:$wims_ref_button_bgcolor;color:$wims_ref_button_color;}.wims_color3 {background-color:$wims_ref_button_help_bgcolor;color:$wims_ref_button_help_color;}'\ |
||
13602 | obado | 126 | });\ |
13695 | obado | 127 | });</script> to $wims_html_header |
13602 | obado | 128 | !endif |