Posted by moshe weitzman on February 20, 2004 at 5:22pm
7 followers
| Project: | Htmlarea |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | gordon |
| Status: | active |
Issue Summary
Drupal recognizes the --break-- tag as a separator between teaser and body. It would be nice to if htmlarea.module had a custom button for tag. A reasonable icon for this button might be '--'. Custom buttons are pretty easy with HTMLArea.
Comments
#1
Yes this is on the list, I need to finish some other changes and then I can add this feature.
#2
I have been doing some more thinking about this one, what I am thinking of doing is adding an additional tab that will allow you to write javascript to create such a custom button.
#3
What I did, was put a 'Teaser Breaker' icon in HTMLArea toolbar and the user has just to position the cursor in the body field where he/she wants to end the teaser and press the 'Teaser Breaker' icon. A MARK then appears in the HTMLArea that signifies a 'teaser break'. My teaser marker is "[TEASER BREAK]". I do away with because HTMLArea.js ignores 'comments' and strip them.
This just requires a two_lin_patch in htmlarea.module. I then replace all occurences of in node.module to my TEASER MARKer. :)
#4
this bug that caused comments to be stripped has been fixed.
How did you add the additional break button?
#5
this bug that caused comments to be stripped has been fixed.
is this fix came from interactivetools.com or a hacked htmlarea.js to allow comment like ?
This is how I added the customized button in htmlarea.module 4.4.0.
htmlarea_textarea($name), after line 144, i put this line of code: $htmlarea_fields[] = " $name.config.registerButton(\"my-teaserbreak\", \"Insert a Teaser Break\", \"misc/htmlarea/images/my-teaserbreak.gif\", true, function(editor, id) { editor.insertHTML('[TEASER BREAK]'); });";_htmlarea_defaults($field), in line 300, i added in the array the name of my teaser-break,,"my-teaserbreak"i also created a simple icon that indicates that's it's a teasear break. :)
attached is a patched htmlarea.module that has a customised teaser-break button. (sorry i dont have a cvs front-end, i cant diff )
hth.
#6
I knew that the process to do this is extremely simple. This is why I am thinking of adding a custom page that will allow you to enter js code into attacheditor() so that it will appear on the screen. Then you will not have to patch htmlarea to add this code.
#7
Or would a plugin(htmearea) be good for this? So there will be no patching on htmlarea script.
I already created a plugin but I am wondering if the --break-- comment is already fixed? You mentioned above, it is but on which version? Is it on the cvs or is it included in the 4.5rc version of #drupal?
#8
I have added a new tab to the settings menu called custom js. This will enable the administrator to add additional code the the attacheditor() right before the editor.generate().
This will mean that custom buttons will be able to be created here.
#9
#10
Hi
Thanks for this generic function. It will be very useful for sure.
More specially though, can someone paste some js code here that inserts a --break-- comment?
This will truly bring closure to this issue.
#11
Changing to active so the details of how to get a break key be posted before closure.
#12
If someone can post an nice Icon for it I was actually add it to the help of the js entry screen. so you can cut and paste it.
#13
I have now changed this to fixed, as the actual code is in commet #5, you just need to change the [TEASER BREAK] to <!--break-->
#14
#15
Could someone please post the javascript that should be copied into the custom js field - exactly as it should be used.
I tried to use the script in comment 5 above, but as I don't know Javascript I couldn't get it to work.
I'll be able to supply a button image for this soon.
#16
Here's an icon for the 'break' button.
Now, could someone supply the JavaScript?
#17
Well, I placed your image in modules/htmlarea/xinha-nightly/images/ and entered the following in the custom javascript textarea:
editor.config.registerButton("my-teaserbreak", "Insert a Teaser Break", _editor_url+"/images/ed_break.gif", true, function(editor, id) { editor.insertHTML('<!--break-->'); });editor.config.toolbar.push(['my-teaserbreak']);
You need to replace < and > with < and > respectively in the code above.
It adds a teaser break button, but the teaser break is not visible when entered :(
#18
I think that I (or someone else) is going to need to create a plugin for Xinha to allow this.