fiat.lucy fiat.lucy - 1 year ago 69
Javascript Question

How do I use plugin code downloaded from Github?

Sorry for the basic question. I'm new to coding and I've already googled "how to run code from Github" "how to use code from Github" etc. for a few hours without any real progress.

Basically, I want to create a editable div with the text editor ( and I already manually downloaded and followed the directions to inserting the code inside the editor (can be found on the GitHub page).
Here is my code for the editable div in its entirety:

<!DOCTYPE html>
<link rel="stylesheet" type="text/css" href="post.css">
<script src="other.js"></script>
<link rel="stylesheet" href="css/medium-editor.css">
<link rel="stylesheet" href="css/themes/default.css">
<script src="js/medium-editor.js"></script>
<div contenteditable="true" class= ".editable" id="posteditor"> <p> test words</p></div>

Javascript (other.js -referenced in html code):

var elements = document.querySelectorAll('.editable'),
editor = new MediumEditor('.editable');

I also copy and pasted the files from the downloaded file into a new file folder holding the HTML/CSS/Javascript code for the editable div (not sure if this even makes a difference).
Thank you so much for helping a new coder.

Answer Source

You need some simple html css js basics knowledge to start dealing with such code

here are some tips:

*put link tag in the head

*put script tags in before the ending of the body

try now to run this code and double tap the word you want to edit

<!DOCTYPE html>
    <meta charset="utf-8">
    <link rel="stylesheet" href="//" type="text/css" media="screen" charset="utf-8">
    <div class="editable"><h4>hi I am editable</h4></div>
    <script src="//"></script>
    <script>var editor = new MediumEditor('.editable');</script>