Home >Web Front-end >JS Tutorial >Easily implement an online editor with just one line of code_javascript skills

Easily implement an online editor with just one line of code_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:16:081458browse

In the eyes of most people, the technical nerd gives the impression that he is taciturn and can never figure out what he is thinking, so they keep a distance from each other. As a half-programmer, I think real technical nerds spend most of their time having fun and tinkering with various ideas. They have the same geek mentality as most people. Programmers also like to tell jokes and cook. Although most of the meals are for stress relief, it seems no different from ordinary people.

The difference is that tech nerds advocate extremes, like minimalism, and hope that simplicity is not simple. Behind the scenes are the constant attempts of tech nerds. I am watching a good show being performed:



"Programmer Jose Jesus Perez Aguinaga shared a little trick on CoderWall: enter a line of code in the browser address bar: data:text/html, and press Enter to turn the browser into a temporary editor. (The browser needs to support the HTML5 attribute contenteditable). Inspired by Jose, many programmers began to modify this line of code, such as changing it to an editor that supports Ruby syntax highlighting..."

As you can see from the introduction, it was originally just a short piece of code: data:text/html, . After continuous modification by programmers, it gradually changed from a simple editable page to include support A code editor with highlighting for Java, Ruby, Python and other programming languages. As of the last update in less than an hour, I have seen a website with similar functions to notepad.cc, which uses a third-party website database API service to store content. Online editor:

Copy code The code is as follows:

data:text/html,


< script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js">