Browse code

tinymce inits: prevent html entity encoding from wrecking special characters in any text form it uses, especially in stories

Clarissa Walker authored on 2026/09/18 00:11:38
Showing 1 changed files
... ...
@@ -34,6 +34,7 @@ echo "
34 34
 		relative_urls: false,
35 35
 		remove_script_host: false,
36 36
     	convert_urls: true,
37
+		entity_encoding: 'raw',
37 38
 		paste_word_valid_elements: 'b,strong,i,em,h1,h2,u,p,ol,ul,li,a[href],span,color,font-size,font-color,font-family,mark,table,tr,td',
38 39
 		toolbar1: 'bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist | undo redo | fullscreen code | link unlink | emoticons image anchor hr ',	image_advtab: true,
39 40
      	paste_word_valid_elements: 'b,strong,i,em,p,span,u,strike,br',
Browse code

version 3.5.7

Jimako authored on 2024/04/08 12:21:57
Showing 1 changed files
... ...
@@ -1,5 +1,12 @@
1 1
 <?php
2
-
2
+$image_list_path = STORIESPATH . "/" . USERUID . "/images/imagelist.js";
3
+$image_list_exists = file_exists($image_list_path); 
4
+ 
5
+if (USERUID && $image_list_exists)
6
+{
7
+echo "
8
+<script src='".STORIESPATH . "/" . USERUID . "/images/imagelist.js"."'></script>";
9
+} 
3 10
 echo "
4 11
 	<script language=\"javascript\" type=\"text/javascript\"><!--";
5 12
 	$tinylanguage = $language;
... ...
@@ -19,30 +26,28 @@ echo "
19 26
   		menubar: false,
20 27
 		language: '$tinylanguage',
21 28
   		theme: 'modern',
29
+		invalid_styles: 'color,font-size,margin,line-height,font-family,margin-top,margin-bottom',
30
+		plugins: 'wordcount emoticons fullscreen anchor code hr image link paste ',
22 31
 		skin: 'lightgray',
23 32
 		min_height: 200,
24
-		plugins: [
25
-		    'autolink lists link image charmap paste preview hr anchor pagebreak',
26
-		    'searchreplace wordcount visualblocks visualchars code fullscreen',
27
-		    'insertdatetime media nonbreaking save table contextmenu directionality',
28
-		    'emoticons template textcolor colorpicker textpattern imagetools toc textcolor table'
29
-		],
33
+	    browser_spellcheck: true,
34
+		relative_urls: false,
35
+		remove_script_host: false,
36
+    	convert_urls: true,
30 37
 		paste_word_valid_elements: 'b,strong,i,em,h1,h2,u,p,ol,ul,li,a[href],span,color,font-size,font-color,font-family,mark,table,tr,td',
31
-		paste_retain_style_properties : 'all',
32
-		paste_strip_class_attributes: 'none',
33
-		toolbar1: 'undo redo | insert styleselect | bold italic underline strikethrough | link image | alignleft aligncenter alignright alignjustify code pastetext',
34
-		toolbar2: 'preview | bullist numlist | forecolor backcolor emoticons | fontselect |  fontsizeselect wordcount', 
35
-		image_advtab: true,
36
-		templates: [
37
-		    { title: 'Test template 1', content: 'Test 1' },
38
-		    { title: 'Test template 2', content: 'Test 2' }
39
-		],
40
-		content_css: [
41
-		    '//fonts.googleapis.com/css?family=Lato:300,300i,400,400i',
42
-		    '//www.tinymce.com/css/codepen.min.css'
43
-		],";
44
-		if(USERUID) 
45
-			echo "		external_image_list_url : '".STORIESPATH."/".USERUID."/images/imagelist.js',";
38
+		toolbar1: 'bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist | undo redo | fullscreen code | link unlink | emoticons image anchor hr ',	image_advtab: true,
39
+     	paste_word_valid_elements: 'b,strong,i,em,p,span,u,strike,br',
40
+    	paste_retain_style_properties: 'text-decoration,text-align',
41
+	    menu: {
42
+			file: { title: 'File', items: 'newdocument' },
43
+			edit: { title: 'Edit', items: 'undo redo | cut copy paste pastetext | selectall' },
44
+			insert: { title: 'Insert', items: 'link media | template hr' },
45
+			view: { title: 'View', items: 'visualaid' },
46
+			table: { title: 'Table', items: 'inserttable tableprops deletetable | cell row column' },
47
+			tools: { title: 'Tools', items: '' }
48
+    	},";
49
+		if (USERUID && $image_list_exists)
50
+			echo "	image_list: tinyMCE4ImageList ,";
46 51
 		echo "
47 52
 		theme_modern_resizing: true,".($current == "adminarea" ? "\n\t\tentity_encoding: 'raw'" : "\n\t\tinvalid_elements: 'script,object,applet,iframe'")."
48 53
    });
Browse code

3.5.6 efiction version

Jimako authored on 2024/03/09 16:09:42
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,76 @@
1
+<?php
2
+
3
+echo "
4
+	<script language=\"javascript\" type=\"text/javascript\"><!--";
5
+	$tinylanguage = $language;
6
+	if (!file_exists(_BASEDIR . "tinymce/js/tinymce/langs/{$language}.js"))
7
+	{
8
+		$tinylanguage = "en";
9
+	} 
10
+	$tinymessage = dbquery("SELECT message_text FROM ".TABLEPREFIX."fanfiction_messages WHERE message_name = 'tinyMCE' LIMIT 1");
11
+	list($tinysettings) = dbrow($tinymessage);
12
+	if(!empty($tinysettings) && $current != "adminarea") {
13
+		echo $tinysettings;
14
+	}
15
+	else {
16
+		echo "
17
+	tinymce.init({
18
+  		selector: 'textarea:not(.mceNoEditor)',
19
+  		menubar: false,
20
+		language: '$tinylanguage',
21
+  		theme: 'modern',
22
+		skin: 'lightgray',
23
+		min_height: 200,
24
+		plugins: [
25
+		    'autolink lists link image charmap paste preview hr anchor pagebreak',
26
+		    'searchreplace wordcount visualblocks visualchars code fullscreen',
27
+		    'insertdatetime media nonbreaking save table contextmenu directionality',
28
+		    'emoticons template textcolor colorpicker textpattern imagetools toc textcolor table'
29
+		],
30
+		paste_word_valid_elements: 'b,strong,i,em,h1,h2,u,p,ol,ul,li,a[href],span,color,font-size,font-color,font-family,mark,table,tr,td',
31
+		paste_retain_style_properties : 'all',
32
+		paste_strip_class_attributes: 'none',
33
+		toolbar1: 'undo redo | insert styleselect | bold italic underline strikethrough | link image | alignleft aligncenter alignright alignjustify code pastetext',
34
+		toolbar2: 'preview | bullist numlist | forecolor backcolor emoticons | fontselect |  fontsizeselect wordcount', 
35
+		image_advtab: true,
36
+		templates: [
37
+		    { title: 'Test template 1', content: 'Test 1' },
38
+		    { title: 'Test template 2', content: 'Test 2' }
39
+		],
40
+		content_css: [
41
+		    '//fonts.googleapis.com/css?family=Lato:300,300i,400,400i',
42
+		    '//www.tinymce.com/css/codepen.min.css'
43
+		],";
44
+		if(USERUID) 
45
+			echo "		external_image_list_url : '".STORIESPATH."/".USERUID."/images/imagelist.js',";
46
+		echo "
47
+		theme_modern_resizing: true,".($current == "adminarea" ? "\n\t\tentity_encoding: 'raw'" : "\n\t\tinvalid_elements: 'script,object,applet,iframe'")."
48
+   });
49
+	
50
+";
51
+	}
52
+	echo "
53
+var tinyMCEmode = true;
54
+	function toogleEditorMode(id) {
55
+		var elm = document.getElementById(id);
56
+
57
+		if (tinyMCE.get(id) == null)
58
+		tinymce.EditorManager.execCommand('mceAddEditor',true, id);
59
+		//tinyMCE.execCommand('mceAddControl', false, id);
60
+		else
61
+		tinymce.EditorManager.execCommand('mceRemoveEditor', true, id);
62
+		//	tinyMCE.execCommand('mceRemoveControl', false, id);
63
+	}
64
+";
65
+/*echo "
66
+var tinyMCEmode = true;
67
+	function toogleEditorMode(id) {
68
+		var elm = document.getElementById(id);
69
+
70
+		if (tinyMCE.get(id) == null)
71
+			tinyMCE.execCommand('mceAddControl', false, id);
72
+		else
73
+			tinyMCE.execCommand('mceRemoveControl', false, id);
74
+	}
75
+";*/
76
+echo " --></script>";