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:08:35
Showing 1 changed files
... ...
@@ -38,6 +38,7 @@ echo "
38 38
 		relative_urls: false,
39 39
 		remove_script_host: false,
40 40
     	convert_urls: true,
41
+		entity_encoding: 'raw',
41 42
 		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',
42 43
 		toolbar1: 'bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist | undo redo | fullscreen code | link unlink | emoticons image anchor hr ',	image_advtab: true,
43 44
      	paste_word_valid_elements: 'b,strong,i,em,p,span,u,strike,br',
Browse code

add support for later tinyMCE image list handling

Clarissa Walker authored on 2026/09/07 19:31:10
Showing 1 changed files
... ...
@@ -51,7 +51,7 @@ echo "
51 51
 			tools: { title: 'Tools', items: '' }
52 52
     	},";
53 53
 		if (USERUID && $image_list_exists)
54
-			echo "	image_list: tinyMCE5ImageList ,";
54
+			echo "	image_list: tinyMCENewImageList ,";
55 55
 		echo "
56 56
 		theme_silver_resizing: true,".($current == "adminarea" ? "\n\t\tentity_encoding: 'raw'" : "\n\t\tinvalid_elements: 'script,object,applet,iframe'")."
57 57
    });
Browse code

Add tinyMCE 5.3.2 support - Clean up init.php for tinyMCE 6

Clarissa Walker authored on 2026/09/06 02:25:52
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,72 @@
1
+<?php
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
+} 
10
+echo "
11
+	<script language=\"javascript\" type=\"text/javascript\"><!--";
12
+	$tinylanguage = $language;
13
+	if (!file_exists(_BASEDIR . "tinymce/langs/{$language}.js"))
14
+	{
15
+		$tinylanguage = "en";
16
+	}
17
+	$tinymessage = dbquery("SELECT message_text FROM ".TABLEPREFIX."fanfiction_messages WHERE message_name = 'tinyMCE' LIMIT 1");
18
+	list($tinysettings) = dbrow($tinymessage);
19
+	if(!empty($tinysettings) && $current != "adminarea") {
20
+		echo $tinysettings;
21
+	}
22
+	else {
23
+		echo "
24
+	tinymce.init({
25
+  		selector: 'textarea:not(.mceNoEditor)',
26
+  		resize: 'both',
27
+  		menubar: false,
28
+		language: '$tinylanguage',
29
+  		theme: 'silver',
30
+		invalid_styles: 'color,font-size,margin,line-height,font-family,margin-top,margin-bottom',
31
+		plugins: 'wordcount emoticons fullscreen anchor code hr image link paste ',
32
+		skin: 'oxide',
33
+		min_height: 300,
34
+		min_width: 200,
35
+		width: 500,
36
+		toolbar_location: 'top',
37
+	    browser_spellcheck: true,
38
+		relative_urls: false,
39
+		remove_script_host: false,
40
+    	convert_urls: true,
41
+		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',
42
+		toolbar1: 'bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist | undo redo | fullscreen code | link unlink | emoticons image anchor hr ',	image_advtab: true,
43
+     	paste_word_valid_elements: 'b,strong,i,em,p,span,u,strike,br',
44
+    	paste_retain_style_properties: 'text-decoration,text-align',
45
+	    menu: {
46
+			file: { title: 'File', items: 'newdocument' },
47
+			edit: { title: 'Edit', items: 'undo redo | cut copy paste pastetext | selectall' },
48
+			insert: { title: 'Insert', items: 'link media | template hr' },
49
+			view: { title: 'View', items: 'visualaid' },
50
+			table: { title: 'Table', items: 'inserttable tableprops deletetable | cell row column' },
51
+			tools: { title: 'Tools', items: '' }
52
+    	},";
53
+		if (USERUID && $image_list_exists)
54
+			echo "	image_list: tinyMCE5ImageList ,";
55
+		echo "
56
+		theme_silver_resizing: true,".($current == "adminarea" ? "\n\t\tentity_encoding: 'raw'" : "\n\t\tinvalid_elements: 'script,object,applet,iframe'")."
57
+   });
58
+	
59
+";
60
+	}
61
+	echo "
62
+var tinyMCEmode = true;
63
+	function toogleEditorMode(id) {
64
+		var elm = document.getElementById(id);
65
+
66
+		if (tinyMCE.get(id) == null)
67
+		tinymce.EditorManager.execCommand('mceToggleEditor', true, id);
68
+		else
69
+		tinymce.EditorManager.execCommand('mceToggleEditor', false, id);
70
+	}
71
+";
72
+echo " --></script>";