Cet article vous apprend à utiliser Bootstrap-Wysiwyg Text Editor pour donner un jeu complet aux avantages de l'éditeur. J'espère que vous pourrez gagner quelque chose.
Caractéristiques principales:
Super petit 5KB
Prise en charge automatique de la section botable (Mac et Windows)
Faites glisser et déposez des images d'insertion, support le téléchargement des images (prend en charge la photographie de téléphone mobile)
Soutien Sound Entrée (support Chrome)
Autoriser les barres d'outils personnalisées pour utiliser tout le contenu de bootstrap, les polices
Aucun style obligatoire n'est utilisé
……………………………………………………………………
En fait, c'est plus que cela, tout le monde doit l'explorer lui-même, allez!
Il est en fait très simple à utiliser. Versez le JS de CSS, JS, JQuery et Bootstrap-Wysiwyg liés à Bootstrap, comme suit:
<link href = "bootstrap-Combined.no-icons.min.css" rel = "Stylesheet"> <link href = "bootstrap-re-qui href = "http://netdna.bootstrappcdn.com/font-awesome/3.0.2/css/font-awesome.css" rel = "Stylesheet"> <link rel = "Stylesheet" href = "index.css" type = "text / css"> </ket> <script src = "jQuery1.1. type = "text / javascript"> </ script> <script src = "bootstrap.min.js"> </ script> <script src = "bootstrap-wysiwyg.js" type = "text / javascrip
Définir les propriétés et méthodes des élément de menu::
fonction inittoolbarbootstrapbindings () {var fonts = ['serif', 'sans', 'arial', 'arial noir', 'Courier', 'Courier New', 'comic Sans ms', 'Helvetica', 'Impact', 'Lucida Grande', 'Lucida Sans', ', Times', ',' LuCida Grande ' $ ('[Title = Font]'). SIBLINGS ('. Dropdown-menu'); $ .each (polices, function (idx, fontname) {fonttarget.append ($ ('<li> <a data-edit = "Fontname' + fontname + '" style = "font-family: /' '+ fontname +' / '">' + fontname + '</a> </li>'));}); $ ('a [title]'). ToolTip ({conteneur: 'body'}); $ ('. Dropdown-menu entrée'). cliquez (function () {return false;}) .change (function () {$ (this) .parent ('. dropdown-menu'). froids ('. dropdown-toggle'). dropdown ('toggle');}). $ ('[Data-Role = Magic-Overlay]'). Chaque (fonction () {var overlay = $ (this), cible = $ (superlay.data ('cible')); overlay.css ('Opacity', 0) .css ('position', 'Absolut'). Offset (Target.offset (). largent (cible.outerwidth ()). }); if ("onwebKitsPeEchChange" dans document.CreateElement ("Input")) {var editorOffset = $ ('# editor'). offset (); $ ('# VoiceBtn'). CSS ('Position', 'Absolute'). Offset ({top: editoroffset.top, Left: editorOffset.left + $ ('# editor'). InnerWidth () - 35}); } else {$ ('# vocalbtn'). hide (); }}; Fonction DownRororert (raison, détail) {var msg = ''; if (raison === 'Type de file non soutenu') {msg = "format non pris en charge" + détail; } else {console.log ("Fichier de téléchargement d'erreur", raison, détail); } $ ('<v> <Button Type = "Button" Data-Dismiss = "Alert"> × </ Button>' + '<strong> Erreur de téléchargement de fichiers </strong>' + msg + '</div>'). prePendto ('# alerts'); }; inittoolbarbootstrapbindings (); $ ('# editor'). wysiwyg ({fileUploadError: showerRororert});Enfin, le code HTML:
<div data-role = "editor-toolbar" data-target = "# editor"> <div> <a data-toggle = "dropdown"> <i> </i> <b> </b> </a> <ul> </ul> </div> <v> <a data-toggle = "dropdown"> <i> </i> <b> </b> </a> <ul> 5 "> <font size =" 5 "> énorme </font> </a> </li> <li> <a data-edit =" Fontize 3 "> <font size =" 3 "> normal </font> </a> </li> <li> <a data-edit =" Fontize 3 "> <font size =" 3 "> normal </font> data-edit = "Fontize 1"> <font size = "1"> small </font> </a> </li> </ul> </div> <div> <a data-edit = "bold"> <i> </i> </a> <a data-edit = "italic"> <i> </i> </a> <a data-edit = "strikethrough"> <i> </i> </a> <a data-edit = "Underline"> <i> </i> </a> </div> <v> <a data-edit = "insertUnderEdList"> <i> </i> </a> <a data-edit = "Outdent"> <i> </i> </a> data-edit = "outdent"> <i> </i> </a> <a data-edit = "outdent"> <i> </i> </a> <a data-edit = "outdent"> <i> </i> </a> <a data-edit = "indente"> <i> </i> </a> </v> <v> <v> <v> <A data-edit = "justifyleft"> <i> </i> </a> <a data-edit = "JustifyCenter"> <i> </i> </a> <a data-edit = "JustifyRight"> <i> </i> </a> <a data-edit = "Justifyfulll"> <i> </i> </a> </v> <a div> <a data-toggle = "Dropdown"> <i> </i> </a> <v> <entrée placeholder = "url" type = "text" data-edit = "CreateLink" /> <Button type = "Button"> Ajouter </ Button> </div> <a data-edit = "Unink"> <i> </i> </a> </div> <div> <a id = "picturebtn"> <i> </i> </a> <input type = "file" data-role = "magic-overlay" data-target = "# picturebtn" data-edit = "insertimage" /> </v> <v> <a data-edit = "unno"> <i> </i> </a> <a data-edit = "red"> <i> <input type = "text" data-edit = "inserttex
Si vous souhaitez toujours étudier en profondeur, vous pouvez cliquer ici pour apprendre et vous attacher un sujet merveilleux: Tutoriel d'apprentissage bootstrap
Ce qui précède est tout le contenu de cet article. J'espère que cela sera utile à l'apprentissage de tous et j'espère que tout le monde soutiendra davantage Wulin.com.