Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to style blockquotes in a WYSIWYG editor
    primarykey
    data
    text
    <p>I'm kind of new to Javascript and have been doing small projects to get myself acquainted with the language. I've done things like draggable boxes, a calculator, etc., and now I'm working on a small WYSIWYG editor for practice and possibly a future site.</p> <p>In this project I'm using an <code>iframe</code> as the text box using this snippet of code:</p> <pre><code>&lt;!-- images as buttons --&gt; &lt;iframe id='reply'&gt;&lt;/iframe&gt; &lt;script&gt; var doc; doc = document.getElementById('reply'); doc = doc.contentDocument || document.frames.reply.document; doc.designMode = 'on'; &lt;/script&gt; </code></pre> <p>to access the document of the iframe. After accessing the document I use various calls to <code>doc.execCommand('someCommand', false, null);</code> to create the editing interface. I've gotten several buttons to work (bold, italic, underline, strikethrough, sub and superscript, etc.) but I'm having trouble with block quotes. This is for a theoretical message board and the editor needs to be able to make long quotations recognizable, much like how the blockquote button on Stack Overflow operates.</p> <p>To make this work, so far I've used <code>doc.execCommand('formatblock', false, '&lt;blockquote&gt;');</code>. This method will indent the text properly, but my CSS doesn't effect it. I assume this is because the CSS on that document doesn't apply inside the iframe . . . but I don't know how to style the stuff inside of it. Is there a way to insert a stylesheet inside the iframe? Am I going about this all wrong? Should I perhaps try a textarea over an iframe? Thanks for the help! </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload