By neko on
Hey guys,
I'm working on dropping in a DHTML editor for my drupal site and I need to add some javascript to the head of the page where you create a node (story). Not having much luck finding the right part in the code - any pointers?
I'm currently using the polder module/theme
cheers,
neko
Comments
Update
got it running smooth-as - here's a quick summary
Part 1
story.module->story_form()
calls form_dhtml_editor() in common.inc
which calls form_textarea but modifes the $description variable with some dhtml editor specific JS.
Part 2
we also need some js in the head tag, to get that we add
dhtml_editor_header() to common.inc (has the required js), then theme_head() looks like this:
that means theme.inc has to now:
Part 3
The reason for doing the above is to provide the same function to admin.php, which has the following echo in the appropriate place:
testing now, when I get it working I'll let you know Future plans could be setting this up as a generic module that you can configure in the admin interface, and choose what node-types use it and for which fields. Or something, haven't really thought much on it.
neko
use the head() hook
any module can add custom javascript, CSS, etc. to the HEAD section using the head hook. no need to patch theme.inc
sounds interesting. looking forward to seeing your invention.
can't reach "the head hook" page
I'm getting the dreaded:
You are not authorized to access this page.
When trying to reach "the head hook" link from above. Is this still the preferred method for adding your own javascript to the page's HEAD? If so, how can I learn how to use it?
This sounds great.
Text entry usability is a big issue. I'm excited to hear that you are trying to find a solution for drupal sites.
Thanks!
Joe Lombardo | joe@familytimes.com | My Blog
Screenshot in action
Screenshot
Still working on ironing it out for different browser versions, but all seems good so far!
Currently it's not a module or anything, it's just hacked into drupal for the body field of story nodes, but If I have time I might do so and release (anyone else feel free to step in, but I want to learn how to write Drupal modules anyway).
neko