mindmup / bootstrap-wysiwyg

Tiny bootstrap-compatible WISWYG rich text editor
MIT License
5.56k stars 841 forks source link

Clear Selected Text Formatting #208

Open RandomArray opened 8 years ago

RandomArray commented 8 years ago

It would be nice to clear the formatting of just the currently selected text.

To reproduce:

write some text apply formatting background color to text attempt to remove background color from selected portion of the text

expected result: Ability to remove the formatting of the currently selected text. It would clear the selected text's bold, background, colors, font, etc..

what happens: there is no way to remove formatting from text selection without retyping text. #138 destroys all formatting and is counter productive for small edits.

A workaround for the background color is adding a transparent / clear background color to the toolbar.

<div class="btn-group">
  <a class="btn btn-default dropdown-toggle" data-toggle="dropdown" title="Text Highlight Color"><i class="fa fa-paint-brush"></i>&nbsp;<b class="caret"></b></a>
  <ul class="dropdown-menu">
    <p>&nbsp;&nbsp;&nbsp;Text Highlight Color:</p>
    <li><a data-edit="backColor transparent">Clear</a></li>
    <li><a data-edit="backColor #00FFFF">Blue</a></li>
    <li><a data-edit="backColor #00FF00">Green</a></li>
    <li><a data-edit="backColor #FF7F00">Orange</a></li>
    <li><a data-edit="backColor #FF0000">Red</a></li>
    <li><a data-edit="backColor #FFFF00">Yellow</a></li>
  </ul>
</div>