3

At the end of my document before </body> tag I have the required resources:

{{ HTML::script('/themes/admin/js/jquery.js') }}
{{ HTML::script('/themes/admin/js/jquery-ui.js') }}
{{ HTML::script('/themes/admin/js/bootstrap.min.js') }}
{{ HTML::script('/themes/admin/js/wys.js') }} // Bootstrap-wysiwyg

All scripts are linked and there and working. This is my HTML:

<div id="editor" class="well col-md-3" contenteditable="true">

</div>

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

And this is my toolbar code right above that:

    <div class="well">
      <div class="btn-toolbar" data-role="editor-toolbar" data-target="#editor">
      <div class="btn-group">
        <a class="btn btn-primary dropdown-toggle" data-toggle="dropdown" title="" data-original-title="Font"><i class="glyphicon glyphicon-font"></i><b class="caret"></b></a>
          <ul class="dropdown-menu">
          <li><a data-edit="fontName Serif" style="font-family:'Serif'">Serif</a></li><li><a data-edit="fontName Sans" style="font-family:'Sans'">Sans</a></li><li><a data-edit="fontName Arial" style="font-family:'Arial'">Arial</a></li><li><a data-edit="fontName Arial Black" style="font-family:'Arial Black'">Arial Black</a></li><li><a data-edit="fontName Courier" style="font-family:'Courier'">Courier</a></li><li><a data-edit="fontName Courier New" style="font-family:'Courier New'">Courier New</a></li><li><a data-edit="fontName Comic Sans MS" style="font-family:'Comic Sans MS'">Comic Sans MS</a></li><li><a data-edit="fontName Helvetica" style="font-family:'Helvetica'">Helvetica</a></li><li><a data-edit="fontName Impact" style="font-family:'Impact'">Impact</a></li><li><a data-edit="fontName Lucida Grande" style="font-family:'Lucida Grande'">Lucida Grande</a></li><li><a data-edit="fontName Lucida Sans" style="font-family:'Lucida Sans'">Lucida Sans</a></li><li><a data-edit="fontName Tahoma" style="font-family:'Tahoma'">Tahoma</a></li><li><a data-edit="fontName Times" style="font-family:'Times'">Times</a></li><li><a data-edit="fontName Times New Roman" style="font-family:'Times New Roman'">Times New Roman</a></li><li><a data-edit="fontName Verdana" style="font-family:'Verdana'">Verdana</a></li></ul>
     </div>
     </div>
    </div>

And now I can click inside my Div and enter text or delete it etc. However if I select the text and then click on one of the options in the toolbar nothing happens.

Also when I click inside the editable div and select some text the div is outlined showing as selected but when I click on one of the toolbar items the div/text gets deselected.

Sterling Duchess
  • 1,970
  • 16
  • 51
  • 91

2 Answers2

7

Mindmup WYSIWYG (http://mindmup.github.io/bootstrap-wysiwyg/) should work with Bootstrap 3, but you need to change the toolbar -- https://github.com/mindmup/bootstrap-wysiwyg/issues/101

Here is a working demo:

http://bootply.com/87859

The toolbar functions and editor text selection seem to function as expected.

Carol Skelly
  • 351,302
  • 90
  • 710
  • 624
  • Very nice demo. Link-button closes when the input is clicked though, you can find a fix for that here http://stackoverflow.com/questions/10863821/bootstrap-dropdown-closing-when-clicked – mpartan May 07 '15 at 07:18
0

I found http://mindmup.github.io/bootstrap-wysiwyg/ and http://jhollingworth.github.com/bootstrap-wysihtml5/ which one do you try to use?

You have tagged your question with Twitter's Bootstrap 3.

The mindup version: Includes TB 2.3.1 here https://github.com/mindmup/bootstrap-wysiwyg/blob/master/index.html

Bootstrap-wysihtml5 latest update 6 maonth ago show in commit message "Updated Bootstrap JavaScript plugins to 2.2.1"

I seems the plugins you try to use are not ready for Twitter's Bootstrap 3 in the first place.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
Bass Jobsen
  • 48,736
  • 16
  • 143
  • 224