Adding TinyMCE to Blog Component but Im missing how to inject the JS

bryce alvord Posted in Component Development 5 years ago

I am working on adding the tinymce editor to the blog component. Im fairly certain I have everything correct to render the html created by the editor. My problem is that the editor does not seem to initialize as far as I can tell.

I have created this php file to handle the javascript

componentsBlogpluginsdefaultjslog.php

In this location I have the following code which was sourced from the admin path:

themesgobluepluginsdefault  hemepageadministrator.php

code:

tinymce.init({
    toolbar: "bold italic underline alignleft aligncenter alignright bullist numlist image media link unlink emoticons autoresize fullscreen insertdatetime print spellchecker preview",
    selector: '.ossn-editor',
    plugins: "code image media link emoticons fullscreen insertdatetime print spellchecker preview",
    convert_urls: false,
    relative_urls: false,
    language: "<?php echo ossn_site_settings('language'); ?>",
});

In the add.php form I have added to the textarea element

class="ossn-editor"

And in my ossn_com.php I have this

ossn_extend_view('js/opensource.socialnetwork', 'js/blog');

So I feel like I have everything linked up and I have looked through the code for the administrator page but Im obviously missing something because it doesnt open the tinymce editor, it is just a standard text area. If someone could just help point me in the right direction for what i am missing that would be great. Thanks!

Bryce

Replies
us Cody Jordan Replied 5 years ago

I’ve been wanting this. Let me know when you do this.

us Bryce alvord Replied 5 years ago

Awesome, thanks!!! Worked perfectly

German Michael Zülsdorff Replied 5 years ago

TextareaSupport (https://www.opensource-socialnetwork.org/component/view/3196/textareasupport) is your friend.

Free your component in work from all TinyMCE references, replace the &lt;textarea&gt; elements in add.php and edit.php by a plugin call as explained on the component's page, and you should be fine.

Premium Version

Due to the many requests in the past for additonal features and components we have decided to develope a premium version. Features like Hashtags, Videos, Polls, Events, Stories, Link Preview, etc included in it.

$199 (Life Time)
Learn More

Other Questions