javascript - execCommand 'undo' not working properly in Internet Explorer -
in our project using bootstrap wysiwyg plugin (http://mindmup.github.io/bootstrap-wysiwyg/) , facing problem net explorer. although not officially supported, works in ie10 except 'undo' , 'redo' actions. plugin relies on document.execcommand()
execute actions user needs.
you can test issue in demo editor in plugin's site. making debug if click undo button can see document.execcommand('undo')
called nil happens. if type command in console undo lastly action.
i thinking if ie problem (as works on chrome , ff), execcommand('undo') works -> http://jsfiddle.net/c8mq2/1/
as using backbone.js , in order clarify wether if plugin issue or not dettached undo button plugin , created custom event follows:
backbone view:
events: { 'click #undoaction': 'undoaction' }, undoaction: function (e) { e.preventdefault(); document.execcommand('undo'); }
html:
<div class="btn-group"> <!-- undo dettached plugin --> <a class="btn" id="undoaction"><i class="icon-undo"></i></a> <!-- redo keeps attached plugin's data-edit attribute --> <a class="btn" data-edit="redo" "><i class="icon-repeat"></i></a> </div>
however no luck here neither, seems not plugin issue. can affecting ie's undo/redo stack not allow execcommand work under circumstances?
i cannot think on different , straighter way of calling execcommand('undo') in lastly backbone example. lite on highly appreciated!
update: new findings
i found way create undo action work , maybe can show happening, still don't understand why (you can seek in bootstrap wysiwyg demo page above) ->
click on textarea , input text. click on undo button result: nothing happens. click on textarea again. move cursor undo button (don't click on yet) type text without moving cursor button. click on undo button result: it works repeat steps 6 , 7 without moving cursor , still work.it seems hovering cursor undo button breaks undo/redo stack , that's makes document.execcommand('undo') stop working on cases. there way query stack , see happening?
thanks in advance!
thanks lastly findings found origin of problem. thing both bootstrap wysiwyg demo page , our own project using editor in conjunction bootstrap tooltip plugin , everytime hover button tooltip element attached dom. somehow chrome , firefox don't take element alter affects document.execcommand('undo') net explorer does.
there may other solutions did disabling tooltips net explorer browsers , relying on native titles on cases.
javascript internet-explorer backbone.js
No comments:
Post a Comment