How can I create my own document.execCommand? So for example I want to create something like center the text(execCommand support only justifyCenter,justifyLeft,justifyRight) or if I want to create aligment for images.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can not create your own
document.execCommand, but you can use Rangy to modify text selection.For example, if you want to center text, try this:
http://jsfiddle.net/DerekL/h9Ym2/
See more demos here.