Archive for May, 2009

Git: Ignore changes in a working tree file

Posted on May 21st, 2009 in git | 3 Comments »

Lately, I’ve transferred all my repos over from Subversion to Git and have become familiar enough with the Git SVN bindings to even work on my work projects in Git while still being able to check-in as a regular SVN user.

I’ve found that some usual stuff Subversion would ignore in projects Git doesn’t. The Git exclude file doesn’t work here since these are files being tracked in the working tree that are just specific to your instance. After digging around, I found the proper command to ignore these files:

# ignore changes in a working tree file
git update-index --assume-unchanged .classpath

TinyMCE: TypeError: t.win.document is null in Firebug Console

Posted on May 15th, 2009 in tinymce | 1 Comment »

I came across this error on a site I was helping to troubleshoot today and with a little Googling found it happens when you move the DOM containing a TinyMCE editor to another place in the document: TinyMCE loses it’s reference to that original element.

To get around this, showing or hiding the editor won’t work, instead destroying the element before you move it and recreating it (same as the previous post) does the trick:

tinyMCE.execCommand('mceRemoveControl', false, 'idOfElement');
// move DOM element
tinyMCE.execCommand('mceAddControl', false, 'idOfElement');

Removing all TinyMCE editors on the page for reinitializing

Posted on May 6th, 2009 in tinymce | 3 Comments »

Sometimes, one needs to remove (not hide) all TinyMCE editors on the page to run a modified version of the global tinyMCE.init code again. This is the best way I’ve found to do it so far:

var i, t = tinyMCE.editors;
for (i in t){
    if (t.hasOwnProperty(i)){
        t[i].remove();
    }
}
// new tinyMCE.init code here

Additionally, you can “destrory” and “recreate” specific editors via:

tinyMCE.execCommand('mceRemoveControl', false, 'idOfElement');
tinyMCE.execCommand('mceAddControl', false, 'idOfElement');

If anyone knows a better way, post in the comments.