Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Building a Web-based Code Editor

Building a Web-based Code Editor

Scheduled Pinned Locked Moved Web Development
javascriptcsharphtmlvisual-studiocom
3 Posts 3 Posters 22 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Steve Raw
    wrote on last edited by
    #1

    I'm currently implementing a web-based code editor into my web project (Project Chromosphere.com). I think some of you might be interested. It's a work in progress, but you can see it here: https://chromosphere.com/chromosphere/scripts/js/ui/sandbox/vsCode/[^] I considered creating a web-based code editor from scratch. Then, I realized the amount of time and effort to embark on such a thing would be ridiculous. I don't want to spend 1000 hours developing a web-based code editor. So, I'm going with a third-party solution. Microsoft VS Code[^] offers a good solution. The VS Code code editors are powered by the Monaco Editor[^]. That's the code editor that you are actually embedding into your web page. To implement this web-based code editor in its most basic form is easy. See the HTML document source code below:

    Simple Example Code Editor
    
    
    
    
    
        require.config({
            paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.27.0/min/vs" }
        });
        require(\["vs/editor/editor.main"\], function () {
            var editor = monaco.editor.create(document.getElementById("container"), {
                value: 'function hello() {\\n    alert(\\'Hello World!\\');\\n}',
                language: 'javascript'
            });
    
            monaco.editor.defineTheme("jScriptTheme", {
                base: 'vs-dark',
                inherit: true,
                rules: \[
                    { token: '', foreground: 'aaaaaa' },
                    { token: 'invalid', foreground: 'ff3333' },
                    { token: 'emphasis', fontStyle: 'italic' },
                    { token: 'strong', fontStyle: 'bold' },
                    { token: 'variable',</x-turndown>
    
    Richard DeemingR V 2 Replies Last reply
    0
    • S Steve Raw

      I'm currently implementing a web-based code editor into my web project (Project Chromosphere.com). I think some of you might be interested. It's a work in progress, but you can see it here: https://chromosphere.com/chromosphere/scripts/js/ui/sandbox/vsCode/[^] I considered creating a web-based code editor from scratch. Then, I realized the amount of time and effort to embark on such a thing would be ridiculous. I don't want to spend 1000 hours developing a web-based code editor. So, I'm going with a third-party solution. Microsoft VS Code[^] offers a good solution. The VS Code code editors are powered by the Monaco Editor[^]. That's the code editor that you are actually embedding into your web page. To implement this web-based code editor in its most basic form is easy. See the HTML document source code below:

      Simple Example Code Editor
      
      
      
      
      
          require.config({
              paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.27.0/min/vs" }
          });
          require(\["vs/editor/editor.main"\], function () {
              var editor = monaco.editor.create(document.getElementById("container"), {
                  value: 'function hello() {\\n    alert(\\'Hello World!\\');\\n}',
                  language: 'javascript'
              });
      
              monaco.editor.defineTheme("jScriptTheme", {
                  base: 'vs-dark',
                  inherit: true,
                  rules: \[
                      { token: '', foreground: 'aaaaaa' },
                      { token: 'invalid', foreground: 'ff3333' },
                      { token: 'emphasis', fontStyle: 'italic' },
                      { token: 'strong', fontStyle: 'bold' },
                      { token: 'variable',</x-turndown>
      
      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      You should probably post this as a tip rather than a message in a forum that will soon be buried on page 42. :)


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      1 Reply Last reply
      0
      • S Steve Raw

        I'm currently implementing a web-based code editor into my web project (Project Chromosphere.com). I think some of you might be interested. It's a work in progress, but you can see it here: https://chromosphere.com/chromosphere/scripts/js/ui/sandbox/vsCode/[^] I considered creating a web-based code editor from scratch. Then, I realized the amount of time and effort to embark on such a thing would be ridiculous. I don't want to spend 1000 hours developing a web-based code editor. So, I'm going with a third-party solution. Microsoft VS Code[^] offers a good solution. The VS Code code editors are powered by the Monaco Editor[^]. That's the code editor that you are actually embedding into your web page. To implement this web-based code editor in its most basic form is easy. See the HTML document source code below:

        Simple Example Code Editor
        
        
        
        
        
            require.config({
                paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.27.0/min/vs" }
            });
            require(\["vs/editor/editor.main"\], function () {
                var editor = monaco.editor.create(document.getElementById("container"), {
                    value: 'function hello() {\\n    alert(\\'Hello World!\\');\\n}',
                    language: 'javascript'
                });
        
                monaco.editor.defineTheme("jScriptTheme", {
                    base: 'vs-dark',
                    inherit: true,
                    rules: \[
                        { token: '', foreground: 'aaaaaa' },
                        { token: 'invalid', foreground: 'ff3333' },
                        { token: 'emphasis', fontStyle: 'italic' },
                        { token: 'strong', fontStyle: 'bold' },
                        { token: 'variable',</x-turndown>
        
        V Offline
        V Offline
        VirtuNetz Sept Web App
        wrote on last edited by
        #3

        Here a Expert Custom Web development Company

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups