Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
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
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Moodle
  3. Can someone help me embed this editor.md on Moodle?

Can someone help me embed this editor.md on Moodle?

Scheduled Pinned Locked Moved Moodle
7 Posts 2 Posters 638 Views 2 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.
  • T Offline
    T Offline
    taowang
    wrote on last edited by
    #1

    I want to embed this editor.md on Moodle, but it keeps loading.

    The following code works on any online code editor, such as:

    https://www.w3schools.com/html/tryit.asp?filename=tryhtml_intro
    

    But it does not work on moodle. I don't know why.

    You may try on the Moodle demo site by sign in as Admin.

    https://sandbox.moodledemo.net/
    

    Editor.md

    <link href="https://unpkg.com/editor.md/css/editormd.min.css" rel="stylesheet" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
    <script src="https://unpkg.com/editor.md/editormd.min.js"></script>
    
    <div id="editor">
    <textarea style="display: none;"></textarea>
    </div>
    
    <script type="text/javascript">
        $(function () {
            var editor = editormd("editor", { 
            	width: "100%", 
                height: "100%", 
                path: "https://unpkg.com/editor.md/lib/" 
            });
        });
    </script>
    

    Here is the errors I see in console:

    4877b8bf-a0df-4f35-996f-fb8a8ba8214b-image.png

    Thanks for your help!

    J 1 Reply Last reply
    0
    • T Offline
      T Offline
      taowang
      wrote on last edited by
      #2

      I found the root cause.

      Moodle is not autoloading the dependencies via the path:

      path: "https://unpkg.com/editor.md/lib/"

      But I don't know how to solve it.

      1 Reply Last reply
      0
      • T Offline
        T Offline
        taowang
        wrote on last edited by
        #3

        I downloaded the source code from github:
        https://github.com/pandao/editor.md?tab=readme-ov-file

        Can I upload it via the File Manager?

        image.png

        Will this work?

        If so, what path shoud I use?

        is this it?

        /appdata/3d3f8304-dd19-4222-a4a4-3c739485ea74/editormd

        image.png

        <link rel="stylesheet" href="/appdata/3d3f8304-dd19-4222-a4a4-3c739485ea74/editormd/css/editormd.css" />
        
        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
        
        <script src="/appdata/3d3f8304-dd19-4222-a4a4-3c739485ea74/editormd/editormd.min.js"></script>
        
        <div id="test-editor">
            <textarea style="display:none;"></textarea>
        </div>
        
        <script type="text/javascript">
            $(function() {
                var editor = editormd("test-editor", {
                    // width  : "100%",
                    // height : "100%",
                    path   : "/appdata/3d3f8304-dd19-4222-a4a4-3c739485ea74/editormd/lib/"
                });
            });
        </script>
        
        
        1 Reply Last reply
        0
        • T Offline
          T Offline
          taowang
          wrote on last edited by
          #4

          I will try the following path:

          /app/data/editormd

          1 Reply Last reply
          0
          • T Offline
            T Offline
            taowang
            wrote on last edited by
            #5

            Still not working:

            <link rel="stylesheet" href="/app/data/editormd/css/editormd.css" />
            <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
            <script src="/app/data/editormd/editormd.min.js"></script>
            
            <div id="test-editor">
                <textarea style="display:none;"></textarea>
            </div>
            
            <script type="text/javascript">
                $(function() {
                    var editor = editormd("test-editor", {
                        width: "100%",
                        height: 500,
                        path: "/app/data/editormd/lib/"
                    });
                });
            </script>
            
            1 Reply Last reply
            0
            • T taowang

              I want to embed this editor.md on Moodle, but it keeps loading.

              The following code works on any online code editor, such as:

              https://www.w3schools.com/html/tryit.asp?filename=tryhtml_intro
              

              But it does not work on moodle. I don't know why.

              You may try on the Moodle demo site by sign in as Admin.

              https://sandbox.moodledemo.net/
              

              Editor.md

              <link href="https://unpkg.com/editor.md/css/editormd.min.css" rel="stylesheet" />
              <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
              <script src="https://unpkg.com/editor.md/editormd.min.js"></script>
              
              <div id="editor">
              <textarea style="display: none;"></textarea>
              </div>
              
              <script type="text/javascript">
                  $(function () {
                      var editor = editormd("editor", { 
                      	width: "100%", 
                          height: "100%", 
                          path: "https://unpkg.com/editor.md/lib/" 
                      });
                  });
              </script>
              

              Here is the errors I see in console:

              4877b8bf-a0df-4f35-996f-fb8a8ba8214b-image.png

              Thanks for your help!

              J Offline
              J Offline
              joseph
              Staff
              wrote on last edited by
              #6

              @taowang said in Can someone help me embed this editor.md on Moodle?:

              You may try on the Moodle demo site by sign in as Admin.

              I logged in but what should I do after login ?

              1 Reply Last reply
              0
              • T Offline
                T Offline
                taowang
                wrote on last edited by
                #7

                Go to preference
                image.png

                Change "editor preference" to "plain text area"
                image.png

                Turn on the "Edit Mode" and add an activity or resource, select page

                image.png

                Then, copy and paste the following code:

                <link href="https://unpkg.com/editor.md/css/editormd.min.css" rel="stylesheet" />
                <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
                <script src="https://unpkg.com/editor.md/editormd.min.js"></script>
                
                <div id="editor">
                <textarea style="display: none;"></textarea>
                </div>
                
                <script type="text/javascript">
                    $(function () {
                        var editor = editormd("editor", { 
                        	width: "100%", 
                            height: "100%", 
                            path: "https://unpkg.com/editor.md/lib/" 
                        });
                    });
                </script>
                
                
                
                
                
                
                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
                • Bookmarks
                • Search