Home > Article > Web Front-end > How to turn browser into editor
This time I will bring you how to turn the browser into an editor, and what are the things to note. The following is a practical case, let’s take a look.
Copy the code directly into the browser: paste it and use it. Of course, you can also save it to your favorites (provided there is an Internet connection) Shortcut keys: Ctrl+F Search Alt+F Format
Ctrl+Shift+Space displays prompts
Ctrl+Left mouse button can select multiple lines
Alt+Click the left mouse button and move to select multiple lines
Ctrl+S Download code (need to enter a suffix)
Ctrl+ R enters the browser and supports emmet.
I am using the Chrome browser. I have not tested other browsers. There are others I have not mentioned. If you are interested, you should research it yourself!
----The save function may not be perfect yet. In my case, I mainly use Ctrl+R to enter the browser. I usually look at other people’s codes. Then if I want to see the effect, just click on the link and copy the code into it, then Ctrl+R.
data:text/html, <style type='text/css'> #e{position:absolute;top:0;right:0;bottom:0;left:0;}</style> <div id='e'></div> <script src='https://ace.c9.io/build/src-min-noconflict/ace.js' type='text/javascript' charset='utf-8'></script> <script src='https://ace.c9.io/build/src-min-noconflict/ext-language_tools.js'></script> <script src='https://cloud9ide.github.io/emmet-core/emmet.js' type='text/javascript' charset='utf-8'></script> <script src='https://ace.c9.io/build/src-min-noconflict/ext-emmet.js' type='text/javascript' charset='utf-8'></script> <script src='https://ace.c9.io/build/src-min-noconflict/ext-language_tools.js'></script> <script> var e=ace.edit('e'); e.setTheme('ace/theme/monokai'); e.getSession().setMode('ace/mode/html'); e.setOption('enableEmmet', true); ace.require('ace/ext/language_tools'); e.setOption('enableLiveAutocompletion',true); e.setOptions({enableBasicAutocompletion: true}); e.getSession().setUseWrapMode(true); function SaveTextArea() { window.location = 'data:application/octet-stream,' + e.getValue(); }; function do_js_beautify() { js_source = (e.getValue()).replace(/^\s+/, ''); tabsize =1; tabchar = '\t'; if (js_source && js_source.charAt(0) === '<') { e.setValue(style_html(js_source, tabsize, tabchar, 80)); } else { e.setValue(js_beautify(js_source, tabsize, tabchar)); }; return false; }; document.onkeydown = function(e){ if( e.ctrlKey == true && e.keyCode == 83 ){ SaveTextArea(); return false; }; if(e.altKey == true &&e.keyCode ==70){ do_js_beautify(); return false; }; if(e.ctrlKey == true &&e.keyCode ==82){ runEx(); return false; }; if(e.altKey == true &&e.keyCode ==82){ runEx(); return false; }; }; function runEx() { var code=e.getValue(); if (code!=''){ var newwin=window.open('','',''); newwin.opener = null ; newwin.document.write(code); newwin.document.close(); }; }; </script> <script src='http://tool.chinaz.com/template/default/js/jsformat.js'></script> <script src='http://tool.chinaz.com/template/default/js/htmlformat.js'></script>I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website! Related reading:
The most brief search box with icons
JS can capture the tagged video thumbnail of the video ?
The above is the detailed content of How to turn browser into editor. For more information, please follow other related articles on the PHP Chinese website!