简体   繁体   English

如何使用节点模块?

[英]How do I use node modules?

Sorry for the basic question. 对不起这个基本问题。 I'm new to coding and I've already googled "how to run code from node modules" "how to use code from node modules" etc. for a few hours without any real progress. 我是编码的新手,我已经在Google搜索了“如何从节点模块运行代码”,“如何从节点模块使用代码”等内容,搜索了几个小时而没有任何实际进展。

Basically, I want to create a editable div with the text editor ( https://github.com/yabwe/medium-editor ) and I already manually downloaded and followed the directions to inserting the code inside the editor (can be found on the GitHub page). 基本上,我想使用文本编辑器( https://github.com/yabwe/medium-editor )创建一个可编辑的div,并且我已经手动下载并按照说明将代码插入编辑器中(可以在GitHub页面)。 Here is my code for the editable div in its entirety: HTML: 这是我整个可编辑div的代码:HTML:

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<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>
</body>

Javascript (other.js -referenced in html code): Javascript(other.js-在html代码中引用):

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). 我还将文件从下载的文件中复制并粘贴到一个新文件夹中,该文件夹包含可编辑div的HTML / CSS / Javascript代码(不确定这是否有所不同)。 Thank you so much for helping a new coder. 非常感谢您对新编码器的帮助。 EDIT: Figured it out! 编辑:想通了! My paths were in the wrong order and I wasn't referencing some of the necessary code in the 我的路径顺序错误,并且没有在其中引用某些必要的代码

You need some simple html css js basics knowledge to start dealing with such code 您需要一些简单的HTML CSS CSS基础知识才能开始处理此类代码

here are some tips: 这里有一些提示:

*put link tag in the head *将link标签放在头部

*put script tags in before the ending of the body *在正文结尾之前放入script标签

try now to run this code and double tap the word you want to edit 现在尝试运行此代码,然后双击要编辑的单词

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM