简体   繁体   English

插入Bootstrap所见即所得

[英]Insert Bootstrap WYSIWYG

I want to insert this script ( https://mindmup.github.io/bootstrap-wysiwyg/ ) to my site, but I don't know how to do that exactely. 我想将此脚本( https://mindmup.github.io/bootstrap-wysiwyg/ )插入我的网站,但是我不知道该怎么做。 Can anyone explain how to insert this into my HTML-code? 谁能解释如何将其插入我的HTML代码? Or is there a better bootstrap plugin for text editing? 还是有一个更好的bootstrap插件来进行文本编辑?

Right now my code looks like this: 现在,我的代码如下所示:

<form action="" method="POST">

    <div class="form-group">
        <label for="artikel-titel">Titel</label>
        <input type="text" class="form-control" id="artikel-titel" name="titel" placeholder="Titel">
    </div>

    <div class="form-group" id="editor">
        <label for="artikel-content">Innehåll</label>
        <textarea rows="10" class="form-control" id="artikel-content" name="content"></textarea>
    </div>

    <input type="submit" value="Spara" class="btn btn-primary">

</form>

Edit: 编辑:
I found this script and that fits my project better, so now I wounder how I insert it on my site (the code is above) and how to activate the translations? 我找到了该脚本,并且该脚本更适合我的项目,因此现在我很讨厌如何将其插入网站(上面的代码)以及如何激活翻译?

http://bootstrap-wysiwyg.github.io/bootstrap3-wysiwyg/ http://bootstrap-wysiwyg.github.io/bootstrap3-wysiwyg/

Download or copy paste code of file from here , put this file in your project directory. 此处下载或复制文件的粘贴代码,将此文件放在您的项目目录中。

<script src="bootstrap-wysiwyg.js"></script> 

To include bootsrap wysiwyg plugin in current scope - only if you're in the same directory as bootstrap-wysiwyg.js file script, if you not, you must give path to bootstrap-wysiwyg.js file from current scope localisation. 要将bootsrap wysiwyg插件包括在当前范围内-仅当您与bootstrap-wysiwyg.js文件脚本位于同一目录中时,否则,您必须提供当前范围本地化中的bootstrap-wysiwyg.js文件的路径。

Next place some div with specific id attribute - that will be your wysiwyg container: 接下来放置一些具有特定id属性的div-这将是您的所见即所得容器:

<div id="your_id_name" style="overflow:scroll; max-height:300px"></div>

(You can declare style in main style file or wherever you want write: #your_id_name is the reference) or leave it in attribute like above. (您可以在主样式文件中或要编写的任何位置声明样式: #your_id_name是引用)或将其保留在上述属性中。

Last thing is initiate plugin, write this after div or place initiation code between script tags in your main javascript file: 最后一件事是启动插件,在div之后编写此代码,或将启动代码放置在主javascript文件中的脚本标签之间:

<script type="text/javascript"> $('#your_id_name').wysiwyg(); </script>

Also make sure you have jQuery on board, if not: 如果没有,还请确保您已安装jQuery:

<script src="https://code.jquery.com/jquery-2.2.0.min.js"></script>

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

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