TinyMCE - Make a url clickable - javascript

I'm working on a TinyMCE client request. In TinyMCE, a user inputs a url into the editor. (Let's say www.google.com). The user saves the input and "www.google.com" is rendered as plain text inside of a p tag. How can I make this url clickable? Our application is using TinyMCE version 3.5. I would very much appreciate some guidance here as I'm new to the inner workings of TinyMCE. Thank you.

If you've upgraded to TinyMCE 4, add plugins: "autolink" to your TinyMCE init function.
If not, http://www.tinymce.com/wiki.php/Plugin3x:autolink

Related

Can a Chrome Extension content.js file update a draft.js text editor?

I'm used to updating input, textarea etc. elements with text content from my Chrome Extension.
But adding/updating text to a draft.js text editor is a new beast.
Since a content script exists ON the page, it can use whatever frameworks are already in use - right? So if I know a specific URL I'm interacting with uses jQuery, my Extension can use jQuery. Otherwise I need to use plain vanilla Javascript.
So if I know I'm on a react/draft.js page can I use the draft.js APIs to update the contents of the editor (https://draftjs.org/docs/quickstart-api-basics.html)? How would I access/initiate the editor? Or even know what it's ID is?
Any help/direction appreciated. I just want to append text programmatically to the text editor and update (event handler) React/Draft.js so it understands that the contents of the editor have changed.

How can I use TinyMCE editor only for image uploading?

I want to use TinyMCE editor only for image using also imagetools plugin to edit the image. Thus I need following options:
No editor field should be visible: only field like this(I can do the design )
Then after selecting image : user can edit/resize/etcjust like used in TinyMCE editor using imagetools plugin .
Actually How can I override TinyMCE editor and use ?
If there is any other work around beside TinyMCE or mentioned above Please reply with it also.
Thanks in advance.

Javascript WYSIWYG that ignores PHP Code with Bootstrap3

I'm adding an *.php editor to a CMS similar to as is done in Drupal's node editor. Currently, I have a selectbox with the values WYSIWYG and PHP Code. If WYSIWYG is selected then code inside the text area will be parsed with something like Tinymce (I've read other answers and found markitup.jaysalvat.com but that seemed WYSIWYG less). Whatever the javascript editor, I'd like (or will be building) a bootstrap front end to allow col, rows, btn, etc.
If PHP Code is selected then the raw PHP code will be shown and editable. I played around with this a little the other day using htmlspecialchars_encode and htmlspecialchars_decode with $_POST and everything seems fine when using PHP Code editor.
However, when I used Tinymce it wrapped all my PHP in paragraph tags, etc. Is anyone aware of a addon or alternative WYSIWYG javascript script that can parse HTML code without messing up PHP code, preferably, but NOT necessarily with builtin Bootstap3 components?
If there is something open source already out there already, it could save me from developing the whole thing from scratch.
Thank you in advance.
Try adding this to your TinyMCE configuration:
protect: [
/<\?php.*?\?>/g // Protect php code
],

Sitefinity Javascript Issue

I am using Sitefinity 6.X . The requirement is to create a photo gallery.But Sitefinity does not seem to work with javascript /jquery. I am always getting the error "Function Not defined", even though i included references to all jQueries.
Experts help is much appreciated.
If you are using Sitefinity 6.x go to Widget section drag JavaScript widget from Script and Style Widget and embed your JavaScript/Jquery. There will be a choice to embed your script in html. Please select "Before the closing body" option or "Where the widget is dropped".
Refresh your page again. You will be able to see your photo gallery /Carousel running.
-Rengaseshan
First drag and drop the JavaScript widget
Second either link the file or paste your JavaScript code in the widget
Finally, click more options at the bottom and select the option of inserting your code Before the Closing tag
As a rule of thumb always have JavaScript code/files just before the end of the body tag

Send content to WordPress' plain text editor

I'm developing a WordPress plugin that allows sending a short code into the rich text editor. Assuming the short code content is stored inside shortcode variable, the following code works perfectly:
tinyMCE.execCommand('mceInsertContent', false, shortcode);
...if the user is in "Visual Editor" mode. If they switch to "Plain Text" mode, the code doesn't work anymore - no content appears in the textarea.
Anyone can help? Thanks in advance.
(Ah, if that matters, I have several instance of editors on the same "Add Post" page).
Just got it! Simply do
send_to_editor(shortcode);
this function is located inside media-upload.js, which should be loaded in Edit/Add Post pages.

Categories