taozi wrote:

Does autosave included with TinyMCE 3.4.4 actually work? I am not seeing anything loaded,

This thread is about the TinyAutoSave plugin that I wrote, not the built-in plugin.  So if you're having problems with the built-in plugin, you should ask for support in a different thread.

BTW, the TinyAutoSave plugin continues working great with TinyMCE 3.x.  I use it in my production website.

2

(2 replies, posted in Tips, Tricks & HowTo's)

Without know anything about the webpage (other than trying the demo), my first thought would be to listen for the start of drag event, save the content when the drag starts, then restore the content upon drag end.

It will require a lot of testing and debugging across several browsers, because drag and drop events are among the most buggy and inconsistent of any web technology.

You don't need anything as elaborate as TinyAutoSave, because you don't need to save the content across page refreshes -- you just need to temporarily save the content in a JavaScript variable until the row is dropped.

Doesn't sound related to tinyautosave, sounds like you have some basic problems with your setup.

Solution verified, new release added.

You can download the new release of TinyAutoSave (version 2.1.3) at http://tinyautosave.googlecode.com/

The new release fixes the problem with IE6 and IE7, where the editor won't finish loading after you upgrade to the latest version of TinyMCE (currently 3.4).

I think I have found a solution.  I'll post back if it tests out OK on all browsers.

I got to that same point too -- disabling the userdata save method makes the bug go away.  The problem is that it limits IE6 & IE7 to the cookie method of saving, which is pretty limiting.

I can't determine anything in the plugin code that is failing.  I also found those two lines, which seem disconnected from anything happening in the plugin.  Which leads me to believe that something in TinyMCE has changed (a breaking change).

Sorry to say that I spent nearly a day trying to figure out what is not working with IE6 and IE7, but I am stumped.  Something in TinyMCE has changed, but for the life of me I can't figure it out.

My guess is that it has something to do with the userdata storage method used for IE6 and IE7 (IE8+ uses the new HTML5 localStorage).  But I have debugged and break-pointed till I'm blue in the face and came up empty.

I will definitely post a fix if I can figure it out, but if anyone else knows the answer, I would be greatly appreciative for your help.

8

(23 replies, posted in News)

Great release, IE9 seems to work great with it.  Thanks for the huge update!

yrosalynlambertt wrote:

I know this is a bit old, but this is a great plugin.  I have lost data a few times and this works out fantastically.

Thanks!

I don't mind the props at all, no matter how old it is!  smile

Actually, the plugin continues to save my butt periodically as well, which is why I built it in the first place.  Thanks for the note.

Update to my previous post:

Looks like a little more tweaking is necessary.  Firefox is not cooperating.  Use the following expanded CSS code instead of the code above.

body {
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    -ms-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    height: 100%;
    height: expression((window) && ((document.documentElement.clientHeight - 6) + "px"));
    cursor: text;
}

I wanted to pass along a tip for a problem I finally solved today.

The problem is that in Internet Explorer, when you hover your mouse over the blank text editor (no content currently in the editor), instead of the nice I-beam mouse cursor, you still see the arrow pointer.

In all other browsers you see the proper I-beam.

Why is this?  Because in IE the body tag does not automatically extend to 100% width and height.  Furthermore, the HTML tag is an actual DOM element in IE, and the body tag seems to adapt to the dimensions of that HTML element.

As a result, even if you set "cursor: text" on the body tag, you won't see the I-beam in IE, because the body tag's width and height are zero.  (Or maybe just the height of one line of content.)  Because all other browsers automatically extend the body tag dimensions to 100%, you'll see the I-beam in those other browsers.

So, I knew from previous experience that the trick is to set 100% height on BOTH the html tag and body tag, like this:

html { height: 100%; }

body {
   height: 100%;
   cursor: text;
}

(Note, I also included the cursor: text definition in the body tag that forces the I-beam to appear.)

But there's a problem with doing that in TinyMCE.  Because the body tag contains top and bottom padding, the height of the body tag ends up becoming 100% plus 6 pixels (given a top and bottom padding of 3px).  As a result, the scroll bar shows up on the right, ruining the editor appearance.

In non-IE browsers, the answer to this would be pretty simple: set the box sizing model for the body tag to border-width, and the body tag height would become 100% exactly, because the height calculation would include the padding.  But, of course, IE does not have support for the box sizing model, so that won't work.

This got me to thinking about any possible IE-only browser capabilities that could help to get that body tag to exactly 100%, including the padding.  Dusting off my ancient CSS knowledge, I remembered the IE-only expression() capability, which lets you use JavaScript code within CSS.

So I changed my CSS to the following:

html { height: 100%; }

body {
   height: expression((document.documentElement.clientHeight - 6) + "px");
   cursor: text;
}

This would seemingly solve my problem perfectly, because the 100% height set on the html tag would not be a problem for any other browser, since no other browser recognizes it as a real DOM element, and the expression() set on the body tag's height would also be ignored by all other browsers.

So I fired up my test editor, and voila -- it worked!  I could hover my mouse over the blank text editor and see the I-beam all everywhere the mouse moved.  I tested it in other browsers -- fine there too.

Then I used the resize handle on the text editor to change the editor's size, and oops -- the body tag height was frozen at whatever the initial height was.  The editor size was changing just fine, but the body tag stayed a fixed height.

This didn't make sense -- I thought expression() was supposed to be a dynamic property that would constantly refresh itself.  After all, so many performance books and blogs complain about how expression() should be avoided because it slows everything down from constant refreshing.

So I did some more research and discovered that when IE first interprets the expression, it makes a determination of whether the expression will always return a fixed value (a static value) or if the value will change over time (a dynamic value).  I guess this is a performance tweak to make expressions faster.

The way I had coded my expression apparently made IE think that the value was static, so it was only evaluated upon initial page load, and never refreshed after that.

I could not locate a set of hard-and-fast rules for forcing an expression to become dynamic, so I tinkered with it a bit and found that including some kind of test condition would do the trick.

There are indeed many things you can put in the expression that will slow performance to a crawl.  For example, you can assign variables, do conditionals (e.g., test? one : two), etc., but they all kill performance because they get executed so many times.

But I did find a dynamic expression that seems to evaluate very fast, and does not slow performance significantly.  (IE is slow anyway, but I digress...)

Simply testing for the existance of the window object -- something that will always be there -- was enough to force a dynamic value, while remaining very fast.

So my final CSS that dyanimcally updates the body tag height as the user changes the editor size is:

html { height: 100%; }

body {
   height: expression((window) && ((document.documentElement.clientHeight - 6) + "px"));
   cursor: text;
}

Simply insert this CSS code at the top of the content.css file in the skin folder you're using, and IE will give you the proper behavior for mouse-over.  I tested it in IE 6, 7, and 8, and all work fine.  I also tested it in the IE 9 preview, and it didn't work (because it no longer supports expressions), but there's still plenty of time to deal with that.

I did some searches in the forums here and saw a few threads where people were stumped by this, so hopefully this tip will help alleviate some long-standing headaches!

krusty76 wrote:
speednet wrote:

Frames make it impossible to do many types of interaction between the content in the frame and the rest of the page.  They should be avoided if other methods are possible.  Most web developers worth their salt will tell you that.

Sounds like you are assuming we are using iframes, which we are not.  Just normal ol' frames that make it very possible to interact with the content of the page, since the whole page is in its own frame separate from any functionality presented by the outlying frames.  (Think of a typical two column layout with a header and that's what our frames look like.)

I did not appreciate the implication that our company has no worthwhile developers because of our use of frames.

Heh, no I wasn't implicating your company of anything, don't take it so personally.

krusty76 wrote:

Yes, we have the editor in a frame.  Our site hasn't had a major redesign in a while and it would be a major undertaking to do so.  Frames provide us with our navigation / menuing system and a couple other things.

I'm not sure what the intention of your post was (tone is lost in cyberspace) ... but I don't see why having an editor in a frame is any worse than having frames in general (which I agree is not entirely desirable in this Web 2.0 era).

Frames make it impossible to do many types of interaction between the content in the frame and the rest of the page.  They should be avoided if other methods are possible.  Most web developers worth their salt will tell you that.

krusty76 wrote:

Just for informational purposes I wanted to let people know that WebKit has a known issue with onunload and onbeforeunload when used in frames.  Essentially it doesn't fire when subframes are unloaded.  We've had to work around this issue and unfortunately there's no way for these plugins to deal with that special case.

You put a text editor into a frame?  Doesn't sound like a great idea to start with.

Yes, that's possible, and the way to do it is described on the TinyAutoSave project page.

krusty76 wrote:

I see that TinyMCE's own autosave plugin (in v3.3) is based on speednet's wonderful work.  How closely are the two related?  Should we be using the TinyMCE autosave or speednet's tinyautosave?  Just curious because I am concerned that TinyMCE's might be lagging and I want to have the most up-to-date option running for our customers.

Thanks.

Thanks for the nice comment!

The version included with TinyMCE was originally going to be a straight-shot copy, but it turned out that the TinyMCE developers preferred a more slimmed-down plugin.  So they re-wrote many parts internally, and removed the toolbar button and graphics.  For example, if you use the version that comes with TinyMCE, you will no longer see the spinning graphic indicating that an autosave has occurred.  It will happen silently.

Also, in the built-in version, they decided to drop the use of cookies as a fall-back plan for autosaves, so the plugin will NOT work with Opera browsers.  The TinyAutoSave plugin WILL work with Opera browsers, autosaving content of up to about 4,000 characters in length.

I guess an advantage of the built-in version may be a little less code during the download, but I'm honestly not sure what real time savings there is.  Also, if you want the plugin to operate more silently, the built-in version may be better, although TinyAutoSave does offer a configuration option to turn off the animated indicator.

I don't know what the plans are for the built-in version, but because a lot of it was re-written, my guess is that over time the two plugins will become more different, rather than more alike, because I can't see how the code could get reconciled again.  It's very different.

I hope this description is helpful in making a choice of which one to go with.

Either way, I can tell you from personal experience that having an autosave plugin is a life-saver.  I post lots of long articles using the TinyMCE editor, and TinyAutoSave has saved my butt on more occasions than I could count.

Ugh, no thanks.  I hate writing documentation.  It's only because of my career as a consultant that I know how to force myself to do it!  smile

Glad you like the watermark plugin.  Hopefully you grabbed the latest release.  It's the only plugin I know of that properly handles drag-and-drop.  Another thing that I haven't seen anywhere else is its support of native browser watermarks ("placeholder" property on Safari).

Version 2.0.1 of the plugin has been published to the project page at http://tinyautosave.googlecode.com/.  See my earlier message in this thread for the two changes.  The changes are not huge, but they are recommended.

Hi Spocke,

Yes, I did, sorry I've been delayed in getting you a response.  Work on the plugin is partially responsible.  I'll send you a note.

Thank you.

There is another update coming today, which addresses a couple of minor issues:

1. I am changing the event hooked from window.onbeforeunload to window.onunload.  The reason is that onunload is a W3C standard DOM event, and onbeforeunload is not.  Plus, Opera is really picky about the event, especially older versions.  Note: Opera still has no way of intercepting an accidental browser refresh and/or back/forward buttons, although it will autosave upon accidentally clicking a link or other navigation that is accomplished inside the confines of the page.  Opera simply does not support any method of trapping refresh or back/forward that I am aware of.

2. I have resized all of the progress images (animated GIFs) to 20x20 size, so they will no longer be distorted when displayed in a TinyMCE toolbar button.  TinyMCE forces toolbar button images to 20x20, so if they are not those dimensions, they will distort.  (In TinyAutoSave version 2.0 I already resized the regular non-animated toolbar image to 20x20, so this change puts all images in compliance.)

The changes are all checked into SVN, and the download package will be available later today.  I'll post another reply on this thread when it's ready.

Thanks!  (And thanks for the sticky!)

Hello,

Back in June I submitted a new Paste plugin to the Moxiecode folks, and I've been using it on my own [very busy] Web site since that time without many issues.

In addition to a new Paste as Plain Text mode that can be toggled (probably my favorite new feature in the plugin), one of the areas I focused on was vastly superior integration with Word and Excel.

You may want to download and try my new Paste plugin to see if it works for you.

When you give it a try, first just try pasting directly into the editor from Word or Excel (Ctrl+V or click the Paste button).  If you find that all the formatting does not make it across, you can try using the Paste from Word button in the new plugin.

Word has been giving me very good results with the new plugin code, and Excel has been good, but it's tricker.  I have found that the Paste from Word button gives great results for Excel.

My hope was that Moxiecode would integrate the Paste plugin I submitted, but I know they are very busy with several different things, so it hasn't made it so far.  Plus, I'm sure it would have to be modified with a couple of changes they have made since June.

Anyway, give it a try and see if it helps.

The download package can be found here:

http://www.lotterypost.com/download/pas … eednet.zip

I included extensive documentation of the changes in the text file included in the download, and the code itself has extensive documentation.

Good luck!

-Todd

Today TinyAutoSave version 2.0 was released, which includes the most-asked-for new feature: multiple independent autosave storage.

Now each editor instance can have its own autosave storage, UI, and behavior.  (This is the default behavior.)  Or, you can choose any editors to share these things by setting a common tinyautosave_key setting (new setting in version 2.0).

The project page and download package can be found here:  http://tinyautosave.googlecode.com/

I have also updated the wiki to include the new features and documentation.

The new version 2.0 code is actually smaller than the last release, due to more efficient string usage.  (Minified version.)  It is also completely re-worked to properly scope private variables and methods - no pollution of the global namespace, and no private-scope code is visible outside the plugin.

I am interested in getting your feedback, including any bugs found (please report bugs on the project page's Issues list).

Edit: I forgot to mention, this release was "rushed" a bit into production, because the new Google Chrome v 3.0 has a bug that breaks version 1.2.  It seems that Chrome is not able to do simple object detection for the HTML 5 storage methods, so I had to come up with a new way to do it that works with Chrome 3.0.

The new method of storage detection is better than the old way:  it attempts to store actual data using the various methods, and only uses a storage method if all 3 operations succeed: set, get, and remove.

-Todd

jecicapapa wrote:

If I were to place them in order, this is my vote:

1. DHTML windows, possibility to use layers instead of popups   
2. Better cleanup options (cleanup chaining) - more control over cleanup
3. Performance, it's to slow make it run faster.   
4. Reduce size, it's too big make it smaller.   
5. Safari support, focus on making it work on Tiger/Safari.   
6. Better documentation (make it up to date and add lots of info)
7. Separate toolbar, floating toolbar or within a external div.   
8. Better CSS style support (having a style inspector, XML config for styles)   
9. Spellchecker in PHP and possible .NET

Too bad you haven't really investigated TinyMCE.  It can already do most of that stuff right out of the box.  RT_M.

@spocke,

Maybe we could do both?  I could always continue development on the Google site, tracking issues, and keeping the code fresh, while you could choose to include release versions that you wanted.  That always leaves open the possibility of forking it in the future, if you needed to for some reason.  Of course, anyone can contribute.  But maybe it would be attractive to you to have a plugin that you don't need to be the primary gate-keeper on?  ;-)

If you're interested in doing this, perhaps a good time to grab a release would be when I have finished the new version that includes multiple auto-save storage spaces.  Since that has been requested a few times, I'm thinking it is the biggest missing piece right now.