Questions tagged [execcommand]

Executes a command on the current document, current selection, or the given range.

294 questions
246
votes
9 answers

execCommand() is now obsolete, what's the alternative?

I intended to use Document.execCommand() method along with contenteditable attribute to build my custom WYSIWYG editor. But when I checked the documentation for Document.execCommand(), I found that it's now obsolete. What's the modern (or extant)…
Omar
  • 6,681
  • 5
  • 21
  • 36
138
votes
13 answers

Javascript trick for 'paste as plain text` in execCommand

I have a basic editor based on execCommand following the sample introduced here. There are three ways to paste text within the execCommand area: Ctrl+V Right Click -> Paste Right Click -> Paste As Plain Text I want to allow pasting only plain…
Googlebot
  • 15,159
  • 44
  • 133
  • 229
32
votes
2 answers

Contenteditable div vs. iframe in making a rich-text/wysiwyg editor

i'm trying to weigh the pros and cons of using a
vs.