Closed (fixed)
Project:
TinyMCE
Version:
4.6.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
12 May 2005 at 17:14 UTC
Updated:
7 Mar 2006 at 07:16 UTC
Jump to comment: Most recent file
Comments
Comment #1
jsaints commentedI am looking into how to do this now. anyone else done it? or working on it?
Thanks
Comment #2
matt westgate commentedUntil a button is created, you can switch to the source view and add a <!--break--> where you need to.
Comment #3
matt westgate commentedAnybody want to take the lead on this?
Comment #4
anders.fajerson commentedHere is a quick and dirty patch to insert
to a textarea.
Here are some (not coded) ideas for improvements:
* make it a button instead of a link that can be enabled in the advance theme
* insert something like
so the break will be visible in the textarea
* remove the
when the node is saved, either with tinymce's save_callback (if that's possible) or with drupal
Comment #5
ahoeben commentedHere's the beginning of a tinymce plugin for a button that inserts a
sequence.
It works ok-ish in Firefox, though you don't get any visual feedback. Internet Explorer however seems to filter the HTML comment right out of the contentEditable tinyMCE html.
So the plugin should be refactored to instead of inserting the sequence immediately, it should insert a placeholder graphic. Upon saving the placeholder should be replaced by the actual sequence. Ideally, when loading a node back in tinyMCE, the sequence is replaced with the placeholder again. Can tinymce do that?
the attached plugin doesn't do anything like this, but may serve as a starting point
Comment #6
ahoeben commentedSee attached archive, which includes a patch to tinymce.module, as well as a new plugin named "drupalteaserbreak". This plugin must be moved to the tinymce/jscripts/tiny_mce/plugins folder.
The plugin implements the method I outlined above, and works with these two caveats:
PS: Sorry about the bold before, that came out to shouty.
Comment #7
ahoeben commentedTurns out the plugin 'eats' images that are included before the break. Needs work
Comment #8
anders.fajerson commentedThe wordpress team did it. Check out http://asymptomatic.net/wp/2005/08/18/1898/better-every-day/. The plugin is here: http://trac.wordpress.org/ticket/1564. I've tried it with the TinyMCE module and it works flawlessly, the code just need to be made more Drupal specific (replace more with break and remove nextpage code). I would have made a patch if I could...
Comment #9
quicksketchProps to fajerstarter for pointing out the excellent plugin by the Wordpress team. I've modified this plugin to include both break and pagebreak comments (which may be seperately included in the toolbar). I've tested in out in IE and FF with great success. I've never used the pagination module before, but it is available in this forum (thanks ahoeben). Make sure you both enable the plugin in tinyMCE and enable the buttons within the toolbar.
i.e.
Of course you'd want to include other buttons and plugins. Let me know how it works for everyone.
Comment #10
noid commentedHi quicksketch,
I added your drupalbreak to the "plugins" folder (placed the drupalbreak folder there) and modified tinymce.module such that:
It's not yet working. Am I doing things right? How do I include the buttons? Is there a code somewhere that I have to add? Is there a semi-colon missing in the code? Thanks in advance!
Comment #11
quicksketchnoid,
Which version of tinymce.module are you using? I'd also say that directly adding the code where you have it probably isn't optimal. Rather than appending the code directly, it'd be better if you modified the contents of the variable "$tinymce_settings" and left that segment of code alone.
Do a search on the tinymce.module and look for "$init['plugins']". There should already be a few values set and simply append drupalbreak to the list. There are several variables set at this point, my list looks like this:
I don't add the button to the toolbar in my list (I've done it elsewhere), but you could do this by adding:
You can change the row the buttons are added to by changing "buttons3" to "buttons2" or 1.
Check the readme file included with the plugin for more instructions on including the plugin. Let me know if this helps and if you get it to work (and what you did). More info about tinyMCE settings like these are available at http://tinymce.moxiecode.com/tinymce/docs/reference_configuration.html.
Comment #12
robert castelo commentedHere's a button image for the teaser break.
Comment #13
m3avrck commentedWhile I would like to commit this as part of the CVS version of TinyMCE, I am having a bit trouble with it. Attached is a zip file with updated code from quicksketch. I've modified the code slightly so that it will work with TinyMCE 2.0 and the CVS version of tinymce.module. Installation is *much* easier with the CVS version of tinymce.module and I've updated the README accordingly. Getting this basic plugin to work with CVS is pretty trivial.
However, a few issues need to be dealt with before I would include this in the plugins/ directory of tinymce.module.
1. Preview/Submit does not work. I am getting some sort of infinite loop that eats up all the memory of FF and it just crashes. This has to be dealt with, I suspect either the regex could be wrong or the pagination module isn't working too great.
2. The pagebreak and break images in FF are broken. For some reason the space.gif is not found, however in IE6 this is found. Not a deal breaker but this should be looked into.
3. Pagination module isn't fully compliant with Drupal CVS. Since tinymce.module CVS is poised to be 4.7 ready, I am hesistant about including a plugin that *won't* work with CVS. I'd like to see this module updated somewhere (contrib would be great!) too.
But for now though, if anyone wants to play with this plugin, extract the attached zip file into tinymce/jscripts/tinymce/plugins directory and enable it from the admin menu. Make sure you are running Drupal CVS (or 4.7) and tinymce.module CVS ... otherwise this *won't* work.
Comment #14
quicksketchThis all sounds good. I downloaded and installed a fresh Drupal and tinymce module (both cvs) and installed the the drupalbreak plugin. Unfortunately, it doesn't seem to do much at all. Besides inserting the image placeholder, it doesn't do anything. Did you have any better luck when you installed it?
It has the following functionality with the 4.6 release versions of Drupal and tinymce.module:
- Inserts an image placeholder for either < !--break-- > or < !--pagebreak-- > (works in cvs)
- Automatically converts placeholder back to breaks when HTML source is viewed
- Automatically converts placeholder when editor is disabled (user clicks on "disable rich text")
- Converts to breaks when node is previewed or submitted
The following setup works as described:
tinymce.module,v 1.38
drupal 4.6.3
tinyMCE 2.0 RC4
I'm using the following in the CVS testing:
tinymce.module,v 1.44
drupal cvs (updated 11/29/05)
tinyMCE 2.0 RC4
Comment #15
quicksketchOkay, I found my above problem. tinyMCE had been filtering out the placeholder image's "name" attribute. Possibly because name is not a valid XHTML 1.0 strict attribute for an image (I believe). I removed the name attribute and depend on the "class" attribute instead.
About the missing images, I think that this is probably related to tinyMCE's tendency to change links and urls to be relative to the tinyMCE installation or the current page. See http://drupal.org/node/32320 for more on this problem.
So, the bottom line is this plugin should work with the CVS (and any) release of tinyMCE.module.
The updated README file looks good, and I have to agree that the CVS tinyMCE makes enabling plugins much easier. Until 4.7 is released however, I'm sure that many users (like myself) will use 4.6 for production websites.
Comment #16
m3avrck commentedAh, marvelous! Just tested this and it works *much* better. Preview/Submit *now* works, no nasty infinite loop/browser crashes, yay! As for the images in FF, I tried that URL but that didn't help. The problem is in FF *only* and if you disable then enable rich text, the spacer gif is loaded, so it is being correctly found, just on the 2nd try. I'll shoot the TinyMCE guy an email to see if he knows about this problem, seems pretty interesting.
Otherwise definetly seems to be working with CVS versions of Drupal and tinymce.module, bravo! I'll talk with the other committers and see if we want to include this in the plugins directory of the downloadable module, thanks!
And oh, someone should make that pagination module a contrib module and update for 4.7 (should take all of 10 min to do that), *hint, hint* ;-)
Comment #17
m3avrck commentedThanks!
Been talking with the main TinyMCE developers and we have fixed the path issue. The fix will be present in the final release of TinyMCE which is due out in the next day or two. That with the other fixes and everything is working great so I've added this plugin to CVS and it will be released with 4.7. Very easy to setup, just need to grab that pagination module.
And oh, I used the following script to compress the JS file:
http://alex.dojotoolkit.org/shrinksafe/
And if anyone wants to make that pagination module a contrib module that would be awesome! :-)
Comment #18
quicksketchFantastic. This will make tinyMCE even more desireable to Drupal users. I'm looking forward to the new 2.0 release of the editor. Which should clean up the last few small problems. Thanks for adding to cvs, it looks great.
Comment #19
(not verified) commentedComment #20
buddaThe plugin doesn't seem to work with TinyMCE 2.0.3 - Moxie mention that their plugin architecture has changed to be OOP now, but old plugins should still work as they are wrapped in an object.
Comment #21
quicksketchI haven't yet gotten a chance to look into this, but expect a fix soon. I know that this plugin works fine with tinyMCE 2.02, but I haven't yet gotten a chance to update to the latest version. Funny that a .01 update would change so much. Anyway, it looks like the new code from moxiecode is much improved, so hopefully that will mean a much more efficient plugin when I update it. Thanks for the update.
Comment #22
buddaPlease find attached an update drupalbreak plugin (v1.2) to work withthe new TinyMCE 2.0.3 plugin API.
Tested in FireFox and IE6 without any JS errors.
It's the _src version which hasn't been optimized/compressed.
Comment #23
m3avrck commentedThanks! I've committed these changes along with adding a compressed JS file. Should be good to go now, please reopen if you have any more issues.
Comment #24
(not verified) commented