Note that there are some explanatory texts on larger screens.

plurals
  1. POGet input field value from dialog box in TinyMCE
    primarykey
    data
    text
    <p>all.</p> <p>I'm having a hard time figuring this out, it's the second time I need to do something with tinyMCE but this time I just can't find the answer.</p> <p>Here's what I want to do: I have added a button on my editor that opens a new popup with a single text input field and a button. I want to click the button and grab the value I set in my input field, then use that value to modify what I have in my editor.</p> <p>Here's what I have so far - only relevant code:</p> <pre><code> init : function( ed, url ) { ed.addCommand( 'mceTooltip', function() { ed.windowManager.open({ file: 'imageurl.html', width: 480, height: 180, inline: 1, title: 'Please enter an image URL' }, {}); }); } </code></pre> <p>This is what imageurl.html has:</p> <pre><code>&lt;input type="text" id="image-url" /&gt; &lt;input type="button" id="submit-image-url" value="Ok" /&gt; </code></pre> <p>So, what I need to do is get whatever "image-url" text input has whenever I click the OK button, and use that text inside my editor. I know I can use ed.selection.setContent( fieldValue ) and it will replace my selected text with the image-url value, I just don't know how to get the image-url value.</p> <p>The most detailed info I was able to find was <a href="http://www.tinymce.com/wiki.php/How-to_implement_a_custom_file_browser">http://www.tinymce.com/wiki.php/How-to_implement_a_custom_file_browser</a> but I can't make it work for my needs. Anybody who can help me out with this? I'm sure it should be simple for somebody with more experience on this.</p> <p>Thank you all for your attention.</p> <p><em><strong></em> Updated imageurl.html **</strong></p> <pre><code> &lt;script&gt; document.getElementById( 'submit-image-url' ).onclick = function(){ var imageUrl = document.getElementById( 'image-url' ).value; window.parent.tinyMCE.activeEditor.execCommand( 'mceInsertContent', 0, imageUrl ); window.parent.tinyMCEPopup.close(); // this line gets me this error: "Uncaught TypeError: Cannot read property 'windowManager' of undefined " }; &lt;/script&gt; </code></pre>
    singulars
    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