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

bryce alvord Posted in Component Development 9 months 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


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



    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


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!


us Bryce alvord Replied 9 months ago

@~Z~ Man, I have looked through the code and am certainly not qualified to code review php but to my untrained OSSN eyes it looks good. I have done happy path testing as well and it looks good. Great job man!! I have some other components I am trying to wrap up and then I might look into the notifications, I havent done those yet so it might be a good challenge though it would be a couple weeks.

German ~Z~ Man Replied 9 months ago

2.0dev3 is available for testing.

From my point of view it's safe now - I did a lot of testing: no orphan likes, comments, etc. anymore when deleting a blog or when the creator has been deleted.

Nevertheless I'd appreciate if someone else would verify this version before removing the dev3

Aside from that: Access rights and notifications are still on my wish list. Any volunteers?

German ~Z~ Man Replied 9 months ago

I've placed another developer snapshot (2.0dev2) on

It takes care of the blog accompanying wall post already,


because there's no handling of blog comments and likes yet

German ~Z~ Man Replied 9 months ago

OMG ... but ok. :)

I've placed a developer snapshot (2.0dev1) on

It shouldn't really break things,


Having a look into your database you'll notice, that
- creating a new blog will add 1 object + 3 entities/meta-data
- access
- poster_guid
- subtype 'blog'
Reading an older type 1.0 blog will add these entities automatically.
Aside from that the accompanying wall entry will add 1 object + 5 entities/meta-data

But this snapshot still has no routines to delete all these entities when deleting the blog - not to talk about the comment records. Hence you'll end up with 1 orphan object (the wall post) + 8 orphan entity records with this release - be warned again!

German Arsalan Shah Replied 9 months ago

@Bryce, i haven't touched Blog component since long so i have no idea if i should merge it or not. I'll transfer the ownership to ~Z~ Man , as he is worked on it many times, so he'll decide what to do with Blog component now.

German ~Z~ Man Replied 9 months ago

I'm not sure at the moment...

My idea was having the same 'like and comment' part below the blog we already know from the photo page.
The problem: the plugin to achieve this functionality needs OssnEntities - but the current Blog component has no entities and we need changing the blog's class.

I just did it 10 minutes ago, and things started working on my test site.

But now I need to take care about backward compatibility - to handle older blogs without entity records correctly. Without you would see all kind of wrong comments ... :)

I'll pause for now --- looking into this later

us Bryce alvord Replied 9 months ago

Hey ~Z~ Man, are you going to do a pull request into Arsalans original repo or are you doing your own? Im really looking forward to your updates so Im anxious to see the new component version posted! Thanks for those updates!

German ~Z~ Man Replied 9 months ago

I spent some thoughts on improving the Blog component meanwhile, too.

What I did so far was:
- adding a meaningful icon to the left menu
- adding a post to the newsfeed whenever a new blog has been created
And since blogs may grow really big, I limited that post to the first 300 characters ... and added a link to the original blog page

Still on my wishlist: likes/comments on the blog/view/.... pages

us Cody Jordan Replied 9 months ago

Email me? [email protected]

us Bryce alvord Replied 9 months ago

I have added a pull request into the Blog core component that will add this new functionality. We will see if Arsalan updates with that PR and posts a new version of the component. Be prepared to install the TextareaSupport2 component that was added a few days ago as that is a prerequisite of this new code