Edit style: use 'sublime' keymap, add custom keys
F3, Shift-F3, Ctrl-H - find/find previous/replace Ctrl-G: go to line dialog Alt-PgDn: next code section Alt-PgUp: previous code section ...and many more.
This commit is contained in:
		
							parent
							
								
									1c7eaa6903
								
							
						
					
					
						commit
						20123760ac
					
				| 
						 | 
				
			
			@ -92,6 +92,10 @@
 | 
			
		|||
		"message": "Disable",
 | 
			
		||||
		"description": "Label for the button to disable a style"
 | 
			
		||||
	},
 | 
			
		||||
	"editGotoLine": {
 | 
			
		||||
		"message": "Goto line (or line:col)",
 | 
			
		||||
		"description": "Go to line or line:column on Ctrl-G in style code editor"
 | 
			
		||||
	},
 | 
			
		||||
	"editStyleHeading": {
 | 
			
		||||
		"message": "Edit Style",
 | 
			
		||||
		"description": "Title of the page for editing styles"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,6 +29,8 @@
 | 
			
		|||
		<script src="codemirror/addon/hint/show-hint.js"></script>
 | 
			
		||||
		<script src="codemirror/addon/hint/css-hint.js"></script>
 | 
			
		||||
 | 
			
		||||
		<script src="codemirror/keymap/sublime.js"></script>
 | 
			
		||||
 | 
			
		||||
		<style type="text/css">
 | 
			
		||||
 | 
			
		||||
			body {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										18
									
								
								edit.js
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								edit.js
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -25,8 +25,26 @@ function setupCodeMirror(textarea) {
 | 
			
		|||
		matchBrackets: true,
 | 
			
		||||
		lint: CodeMirror.lint.css,
 | 
			
		||||
		smartIndent: prefs.getPref("smart-indent"),
 | 
			
		||||
		keyMap: "sublime",
 | 
			
		||||
		extraKeys: {"Ctrl-Space": "autocomplete"}
 | 
			
		||||
	});
 | 
			
		||||
	cm.addKeyMap({
 | 
			
		||||
		"Ctrl-G": function(cm) {
 | 
			
		||||
			var cur = cm.getCursor();
 | 
			
		||||
			cm.openDialog(t('editGotoLine') + ': <input type="text" style="width: 5em"/>', function(str) {
 | 
			
		||||
				var m = str.match(/^\s*(\d+)(?:\s*:\s*(\d+))?\s*$/);
 | 
			
		||||
				if (m) {
 | 
			
		||||
					cm.setCursor(m[1] - 1, m[2] ? m[2] - 1 : cur.ch);
 | 
			
		||||
				}
 | 
			
		||||
			}, {value: cur.line+1});
 | 
			
		||||
		},
 | 
			
		||||
		"Alt-PageDown": function(cm) {
 | 
			
		||||
			editors[(editors.indexOf(cm) + 1) % editors.length].focus();
 | 
			
		||||
		},
 | 
			
		||||
		"Alt-PageUp": function(cm) {
 | 
			
		||||
			editors[(editors.indexOf(cm) - 1 + editors.length) % editors.length].focus();
 | 
			
		||||
		}
 | 
			
		||||
	});
 | 
			
		||||
	cm.lastChange = cm.changeGeneration();
 | 
			
		||||
	cm.on("change", indicateCodeChange);
 | 
			
		||||
	editors.push(cm);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user