diff --git a/src/_h5ai/client/js/inc/ext/preview-img.js b/src/_h5ai/client/js/inc/ext/preview-img.js index a9dc5a4a..d118a95e 100644 --- a/src/_h5ai/client/js/inc/ext/preview-img.js +++ b/src/_h5ai/client/js/inc/ext/preview-img.js @@ -3,7 +3,7 @@ modulejs.define('ext/preview-img', ['_', '$', 'core/settings', 'core/event', 'ex var settings = _.extend({ enabled: false, - types: ['bmp', 'gif', 'ico', 'image', 'jpg', 'png', 'tiff'] + types: [] }, allsettings['preview-img']), preloadImg = function (src, callback) { diff --git a/src/_h5ai/client/js/inc/ext/preview-txt.js b/src/_h5ai/client/js/inc/ext/preview-txt.js index ef5fcf12..a6a85a2c 100644 --- a/src/_h5ai/client/js/inc/ext/preview-txt.js +++ b/src/_h5ai/client/js/inc/ext/preview-txt.js @@ -3,29 +3,7 @@ modulejs.define('ext/preview-txt', ['_', '$', 'core/settings', 'core/event', 'ex var settings = _.extend({ enabled: false, - types: { - authors: 'plain', - copying: 'plain', - c: 'c', - cpp: 'cpp', - css: 'css', - h: 'c', - hpp: 'cpp', - install: 'plain', - log: 'plain', - java: 'java', - makefile: 'xml', - markdown: 'plain', - // php: 'php', - python: 'python', - readme: 'plain', - rb: 'ruby', - rtf: 'plain', - script: 'shell', - text: 'plain', - js: 'js', - xml: 'xml' - } + types: {} }, allsettings['preview-txt']), templateText = '
',
@@ -142,7 +120,15 @@ modulejs.define('ext/preview-txt', ['_', '$', 'core/settings', 'core/event', 'ex
 
 							var $text;
 
-							if (currentItem.type === 'markdown') {
+							if (settings.types[currentItem.type] === 'none') {
+
+								$text = $(templateMarkdown).text(textContent);
+
+							} else if (settings.types[currentItem.type] === 'fixed') {
+
+								$text = $(templateText).text(textContent);
+
+							} else if (settings.types[currentItem.type] === 'markdown') {
 
 								$text = $(templateMarkdown).text(textContent);
 
diff --git a/src/_h5ai/conf/options.json b/src/_h5ai/conf/options.json
index 06562ed7..3f037a41 100644
--- a/src/_h5ai/conf/options.json
+++ b/src/_h5ai/conf/options.json
@@ -214,38 +214,41 @@ Options
 
 	/*
 	Show text file preview on click.
-	"types" maps file types to SyntaxHighligher brushes. Special case: "markdown" will
-	be rendered as HTML.
-
+	"types" maps file types to SyntaxHighligher brushes.
 	For available brushes see http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/
 
+	Additional type are:
+	 - "markdown" to render Markdown text
+	 - "none" for floating text
+	 - "fixed" for fixed width text
+
 	- types: maps types to brushes
 	*/
 	"preview-txt": {
 		"enabled": true,
 		"types": {
-			"authors": "plain",
-			"copying": "plain",
+			"authors": "fixed",
+			"copying": "fixed",
 			"c": "c",
 			"cpp": "cpp",
 			"css": "css",
 			"diff": "diff",
 			"h": "c",
 			"hpp": "cpp",
-			"install": "plain",
-			"log": "plain",
+			"install": "fixed",
+			"log": "fixed",
 			"java": "java",
 			"js": "js",
 			"json": "js",
 			"makefile": "xml",
-			"markdown": "plain",
+			"markdown": "markdown",
 			// "php": "php",
 			"python": "python",
-			"readme": "plain",
+			"readme": "fixed",
 			"rb": "ruby",
-			"rtf": "plain",
+			"rtf": "fixed",
 			"script": "shell",
-			"text": "plain",
+			"text": "fixed",
 			"xml": "xml"
 		}
 	},