docwhat's avatardocwhat's blog

It's All Text!

Have you ever had to fill in a form on a web page and wished you could open it in an editor? If you use lots of blogs, post lots of comments or file many bugs then you probably get annoyed at the lack of true editor commands.

I’ve seen some solutions that embed a JavaScript editor into a textarea on demand. Generally, I don’t like them. They are re-inventing a wheel. Especially since I like my particular flavor of wheel, Emacs, though I have no problem with other flavors.

So when I discovered the Firefox extension MozEx I was a very happy hacker indeed. But as time went on I didn’t like the way the extension was going. It was trying to solve a problem I didn’t have; it wanted to add handlers for things like ssh://, etc. and I didn’t need that. I needed an external editor!

When Firefox 2.0 came out, MozEx didn’t work. I waited for an update and it didn’t come out. Since my new job used a lot of editing stuff via web forms, I really really needed an editor. So I reached for External Editor. It seems to have gone since then, replaced with Editus Externus which seems to be an improved version by someone else.

External Editor had a huge problem. When you edited a file it would freeze up all of Firefox till the editor quit. Yikes! However, it let me do things that I needed to do, so I use it.

I started poking around in MozEx to figure out why it wasn’t working in Firefox 2.0 and discovered that in an effort to support pre-1.5 versions of Firefox, it did a lot of work in JavaScript that could now be done in Firefox (md5sums) and it did these sums way too many times for my liking.

It also had some potential security flaws where the browser could be tricked into fetching the contents of a file from one site into their site. Even more annoying, if a second user used MozEx and edited the same site, the files would collide.

So I started thinking… How hard could it be to write an extension?

So I did. :-)

It’s called It’s All Text! and is available for download today.

If you have any suggestions, feel free to post here. I’ll keep this open until I get to version 1, at which point I start a new post someplace…

My current todo list:

  • [idea] dropdown list for charsets (utf-8, western-iso, default)?
  • [low] getDocumentIdentifier should sort arguments and append the post data.
  • [security] Detect collisions using the raw key.
  • [idea] Pass in the line number to the editor, arbitrary command?
  • [high] On edit, let user pick the file extension.
  • [idea] allow the user to pick an alternative editor?
  • [med] Profiling and optimization.
  • [med] If the textarea is focused, we should refresh it.
  • [low] When the editor quits, we should refresh the textarea.
  • [idea] support for input elements as well?
  • [high] Confirm that we find textareas inside iframes and frames.
  • [med] Have gumdrop fade in and out on mouseover

Things marked as ideas, may or may not happen. Everything else will either happen or the issue will be addressed in some other way.

And yes, I edited this blog post with it. :-)

Ciao!

Download: It’s All Text!

Comments

Gravatar for docwhat
docwhat

Shift, alt or something similar clicking on the edit button would copy the path to the file for the text area. The idea being you could copy this path, then type something like:

cp /etc/hosts [paste]

And that’d update the textarea quickly. How cool is that?

Similar in concept to jeroenvrp’s idea: It would be great if you could choose an alternative editor, with clicking shift, alt or ctrl when clicking the blue edit button.

But I think more generically useful.

Ciao!

Gravatar for .jon
.jon

Hi! Would it be possible for you to create a spin-off that evaluates the $EDITOR environment-variable and only gives the button, or a text-area popup-menu in order to strip down the size of this add-on. While ca.20k might look small, as more extensions I install, the more I add ;-) And I really only need my $EDITOR (or %EDITOR% on Win32) (since that is, obviously, the editor I use all times).

Gravatar for docwhat
docwhat

I like the idea of using $EDITOR or percent-EDITOR-percent in Windows. It won’t make the extension smaller. It’ll probably make it bigger, actually.

I can make the extension smaller on disk. It currently takes 112k. If I put the chrome/contents directory in a jar, then that’ll reduce it further to 68k on disk. 24k is just the size of the extension downloaded.

However, I don’t want to write a build optimization phase into my makefile until I’m done testing. I’ll add it to my todo list.

Are you working on an embedded platform that you are counting kilobytes?

Ciao!

Gravatar for daikon
Daikon

Excellent work! I can say for certain that using your add-on combined with Dreamweaver has saved me at least two days of manual find & replace work. You might want to think about setting up a little PayPal link so that grateful people like myself might donate something ^_^

Gravatar for matt
Matt

[FF 2.0.0.1, Mac OSX 10.4.8]

No matter what text editor I select (e.g., TextEdit, TextWrangler, BBEdit), I get the pref box that says it can’t run it.

Trying another is a pain because the pref box does not dismiss. I have to quit and relaunch FF.

You may also want to correct the language in the pref box:

“You the browse button…”

Gravatar for docwhat
docwhat

Matt:

Thanks for taking the time to report the problem (and the text typo).

I suspect that you are trying to run the .app file from the Application directory. On MacOSX, you need to use the binary that the editor placed in /usr/bin. Alternatively, you can look in the /Application/<name>.app/Contents/MacOS/ for an executable. Usually the name of the executable is <name>, matching the .app directory name. However, not always.

This is one of the really annoying parts of MacOSX. I haven’t come up with a good solution. I think I’ll update the text to include this information for the next version.

If that doesn’t fix your problems, then I’ll have to borrow a Mac and see if I can reproduce the problem.

In general, I’d appreciate anyone’s help on this, since I don’t use Macs.

Thanks again!

Ciao!

Gravatar for hans
Hans

It’s a very usefull extension for Wikipedia, so you can easy edit articles in an external editor. A textarea on Wikipedia however has the full width of the screen, so the edit button felt for the half outside the screen and caused a horizontal scrollbar.

I have changed the margin of the button in itsalltext.js, so the right margin of the button is equal to the right margin of the textarea and the button doesn’t cover partly the textarea. It is row 639, I have changed it to: gumdrop.style.margin = [‘0 -‘,width,‘px’].join(”);
Before: http://xs311.xs.to/xs311/07041/BeforeMarginChange.png After: http://xs311.xs.to/xs311/07041/AfterMarginChange.png

Maybe you can make this optional.

Hans.

Gravatar for christian
Christian

Hi,

I like your plugin very much (I use MozEx at the moment). Thanks for offering it. It works fine, but your plugin does not support special characters f.e. german umlaute (üöä) or the euro sign (€). (FF 2.0, WinXP Professional) With my preferred editor Boxer I get strange characters instead of Umlaute, with Notepad.exe I get the Umlaute but not the newline.

Beste regards Christian

Gravatar for docwhat
docwhat

Hello Christian! Nice name. :-)

The plugin does indeed save the output as UTF-8 (as in the preferences). However, I don’t write a Byte-Order Mark to the beginning of the file. I don’t do that because a lot of editors don’t know what to do with it.

Try asking Boxer to read the file as UTF-8 instead of the Windows Default UTF-16 (little endian).

The fact that Notepad can read it implies that it is written correctly. If that doesn’t work, then zip up and email one of the files that Boxer cannot read correctly to me. I’ll double check that it is being written correctly.

My last name (Höltje) has an umlaut in it and I use it with It’s All Text! all the time.

Ciao!

Gravatar for christian
Christian

Thanks Christian,

I found the problem: my editor (Boxer) does not support Unicode. But I like Boxer so much, that I have to live with it. MozEx has an option to not use UTF-8. Disabling UTF-8 works fine for Boxer (€ does not work, but Umlaute are fine). With UTF-8 enabled the behaviour is identical to “It’s all text” Could you provide ANSI-encoding?

Best regards Christian

Gravatar for docwhat
docwhat

Christian:

Go to Tools->Add Ons Select It’s All Text! Then click Preferences. Where it says ‘UTF-8’, change it to ‘windows-1252’. That should fix the problem.

It’s a shame that Boxer doesn’t recognize UTF-8.

Ciao!

Gravatar for peter
Peter

Could this add a couple of options:

  1. To put emacs into wiki-mode, it’d be nice to have an association of sites to extensions (maybe this is asking for a lot?). 1a) alternatively, could the right-click menu for it’s all text bring up the option to add an extension or have a pre-configured profile or something that’s selectable?

  2. Is it posslbe to add flags to the editor? Somtimes I like to use emacsclient with a failback to running emacs in case I don’t have an emacs server running yet.

Otherwise, this is fantastic! Thanks,

-Peter

Gravatar for lulu
Lulu

What does it do? When I change the font to a different colour or effect, it doesn’t show up in the original text box; instead it shows up with the html commands… Why?

Gravatar for isaac
isaac

as vim and mac user, wondering if there’s way not to open multiple instance of the application(gvim in mac os x), but just keep editing in a single gui window? thanks

greatjob! - wish one day we could one editor that can right edit within the textarea with different choice of editors

Gravatar for lulu
Lulu

Here is the problem: My text editor previews the HTML correctly but when I save and close the editor only code is placed in the text box. What am I doing wrong? I am going to enlarge this text and color it green so you can see. Thank you.

Gravatar for docwhat
docwhat

firefox_fan: I don’t know anything about BBCodeWriter, but it looks like it isn’t a normal editor. I’m guessing that it doesn’t accept a filename as the first argument when run.

Try creating a text file and then running BBCodeWriter with the argument being that text file from a cmd.com command line.

Ciao!

Gravatar for docwhat
docwhat

Lulu:

If you create a non-text file, then you’ll get non-text loaded to the web page. These text boxes only handle “text”. If you try setting the fonts and colors, it won’t work. That is the nature of HTML and the web.

There are ways to work around this, but they depend on the authors of the site to do it. A generic plug cannot do that, unless someone comes up with a standard.

I hope I’m clear.

Ciao!

Gravatar for docwhat
docwhat

isaac:

I use dtemacs. You can trick it out do stuff like that. It’s really a question for the gvim and emacs guys, though.

You can see all my .emacs files and stuff at http://trac.gerf.org/homedir

Ciao!

Gravatar for peter
Peter

Reliability…

It seems that the plug-in does a pretty good job of checking for file updates, but I have had many times where the edited file did not update the textearea when I’ve quite my editor.

Is there anything equivelant to waitpid() in the firefox plug-in API that could make this more reliable?

-Peter

Gravatar for docwhat
docwhat

Alas, there isn’t a waitpid or anything similar that I can find in Mozilla. Very sad. If there is one. PLEASE tell me! nsIProccess doesn’t even have the exitValue and pid attributes working. sigh

It checks regularly, every few moments (modulo the browser being busy somewhere else, it’s only single threaded). You can control the refresh rate via the preferences.

The next version (0.4.x due out very soon) also refreshes when you mouse over the text area. And it should update better, too.

Ciao!

Gravatar for peter
Peter

Can you add, at the same time, a mutex? If there’s already a running editor on a textarea, and the edit button is hit, could it confirm the desired action?

Also, what is the interaction with itsjusttext and something like the moinmoin preview button?

Let me describe what just happened to me, which is I was foolish about both of the above things

  1. Edited document (moinmoin wiki page)
  2. After many hours of editing, left the editor open, came back (lots of fact finding).
  3. Saved multiple times, but accidentally opened a new editor.
  4. Closed the new editor, felt an idiot, kept going. Documents saved in editor1 still caused updates.
  5. Saved the document, closed up, and hit “preview”
  6. Moin had timed out my session and told me to click the editor again or something silly. 1 day of work down the drain (fortunately only about an hour of editing to recover it, but how do I avoid it?)

Thanks,

-Peter

Gravatar for peter
Peter

I just answered my own question about moin previews - it doesn’t work. By this I mean that if I click preview while editing a form, the form gets rendered but future edits within the (still open) editor aren’t refleted by the form in the preview page.

This would be a very useful feature.

Thanks,

-Peter

Gravatar for docwhat
docwhat

Hi Peter!

I don’t have much experience with moinmoin and cannot think of an installation I could play with. If you have one, post it.

This feature is there, sort of… It’s hard to make it as nice as I would like because I cannot tell when the editor returns. :-/

Here is the use case: You visit a page with your typical compose->preview->edit->submit pattern. It sounds like moinmoin is like that.

  1. You edit it via “It’s All Text!” starting your editor of choice.
  2. You compose your message and hit save, but leave the editor open.
  3. You hit “preview” on the web page.
  4. You examine it and the press the “It’s All Text!” button. If you now have two editors open to the same file, then close one of them.
  5. You make changes in your editor based on the preview and save.
  6. The changes should be reflected in the textarea.

Step 5) is needed because the textarea is not monitored for changes until you edit at least once. This behavior is changing because it’s hard to make it maximally useful and keep it from being too confusing to normal users at the same time. Especially since I cannot tell when the editor quits.

Actually, it would be useful if there was a menu item to let you start the monitoring, instead of step 5). Or actually to pick the file to load into it.

Hmm…

Re: loosing your work.

As soon as you see that message about a session time out, stop using your browser. The file you submitted is still in your FireFox profile directory! It’s in a subdirectory called ‘itsalltext’ and will be named something like ‘docwhat.org.1j2t2z2t1z.txt’ (the example for this site) or if it is an older version of It’s All Text! then it may only have the garbage letters.

The old copy of the file isn’t deleted until you quit FireFox or you re-visit the page.

Ciao!

Gravatar for lieven
Lieven

Docwhat: I cannot try your suggestion to point It’s All Text to /Application/.app/Contents/MacOS/ because the Editor field in Preferences is not editable (and you can’t peak into packages with Browse). SI’ve found the file with the defaults prefs for It’s All Text, but I cannot find the file with the current setting. Can you please tell the location of the prefs file?

Thanks Lieven

Gravatar for docwhat
docwhat

Lieven: Sorry. I don’t have a Mac, so I couldn’t check it out the advice with regards to the file picker. All browser preferences are kept in prefs.js in your firefox profile directory. They are not kept in the extension directory (which is what you found, I think).

Most editors now days include an executable in /usr/bin/ for running the editor externally. What editor are you using that doesn’t have this?

Ciao!

Gravatar for peter
Peter

moinmoin and preview, redux

Docwhat, I don’t think that the same filename gets generated when moinmoin generates a preview.

I’m going to see if there’s a workflow I can glom onto, like forcing myself to use emacserver, that makes this easier, but for now I’d have to open a new emacs instance (and close the old one) every time I want to preview.

I’ll think about this and see if there’s any way to improve this.

Thanks,

-Peter

Gravatar for sue
Sue

I’m on Mac OSX and have had the same issues described above. I use BBEdit, and in /usr/bin/ there IS an executable for BBEdit.

If you choose that, the dialog box will not go away, and you have to quit FF. When you relaunch, however, the system seems to work, bringing up BBedit when you click the Edit button.

Would be nice to fix this, or at least make a note to that effect on the plugin page where you download the thing so other OSX users won’t waste their time. Also, the default editor is something I’ve never heard of - would be nice to choose something most Mac users are likely to have.

Gravatar for docwhat
docwhat

Hi Sue!

The dialog box sounds like a bug. I think I might have solved in the latest version, but I can’t be sure since I don’t have easy access to Mac OS X. I’ll see if my wife will let me borrow her laptop to try this out. :-/

As I said, I don’t have a Mac. I’ll spend a little time playing with it this weekend, depending on how things go.

Ciao!

Gravatar for martin polley
Martin Polley

Hi!

Nice extension!

Couple of things:

  • It does not seem work with Flock (http://flock.com).

  • I can’t get jEdit to work with it. To run it, you need to run something like this:

    C:\j2sdk1.4.2_09\bin\javaw.exe -jar “C:\Program Files\jEdit\jedit.jar”

And you can’t select this from a file chooser…

Thanks,

Martin Polley

Gravatar for marc
marc

I repost here what the same thing that I submitted on the mozilla home page:

MacOSX: Works with all editors…it’s just a little bit tricky. First, in the Finder, click with right mouse button on Application icon, choose “Show Package Contents”, then navigate through Contents to MacOS. Second, in the preference of this add-on, click on the browse button and then drag&drop the executable within the folder MacOS from before into this “Choose your Editor” window. Third, in the drop-down menu of the “Choose your Editor” go up one level to “Contents” and then navigate to the executable in the “MacOS” folder. Finally, you have chosen your editor! This might look like “/Applications/Smultron.app/Contents/MacOS/Smultron”. If the developer would just make the “Editor” field manually editable we could just add the paths ourself or copy&paste paths from the Terminal.app.

And there is the problem of opening multiple instances of the same program. I wonder if we should have an interim shell or applescript that checks if the preferred editor is already running or not…

Gravatar for docwhat
docwhat

Thank you for the feed back. :-D I can’t act on everything, in part because I’ve been busy. I know that’s frustrating if you like the extension and there is just one little thing that you want fixed… On the other hand, maybe it’s the excuse you need to learn Javascript. :-D

@Martin Polley

re: flock - Yeah, that won’t work because I hadn’t heard of it before now. I’ll take a look.

re: JEdit - Since I don’t allow setting arguments to the executable at the moment (because it is so hard to do cross-platform safely), you’ll have to create a .cmd file to run those commands for you.

@marc

I’m planning on making the editor box editable again. I have to verify that the file picker won’t get interfere.

re: multiple instances of the same program.

Is that a problem? I only had TextEdit on my wifes Mac this morning and it works fine with multiple runnings. I suspect that this is something beyond the scope of this extension. :-/

Thanks again for all your feedback. :-)

Ciao!

Gravatar for marc
Marc

Having multiple instances open of the same program is not a good thing. On slower computers it takes too long to start the application all the time. And each instance use memory. There is a nice UNIX command available on MacOSX which takes care of starting a program only once: “open”. So theoretically, we could have a small shell script like the one below which takes care of the preferred editor as well as only having the editor open once. The only problem is that I don’t know how to pass the file ”~/Library/Application Support/Firefox/Profiles/default.ju5/itsalltext/1j1i23382p2r1w2.txt” to the “open” command as e.g. parameter $FILE.

[code lang=“shell”]

!/bin/sh

EDITOR=”/Applications/Text/Smultron.app” open -a $EDITOR $FILE [/code]

Any hints about passing parameters to an externals shell script?

Regards, Marc

Gravatar for docwhat
docwhat

@marc

I know about open. However, ‘open’ isn’t a UNIX command, it’s only a MacOSX command. :-( I couldn’t figure out how to deal with it portably or even how to reliably detect MacOSX.

Anyway, you want your shell script to look like so: [code lang=“shell”]

!/bin/sh

EDITOR=”/Applications/Text/Smultron.app” open -a ”${EDITOR}” ”$@” [/code]

Ciao!

Gravatar for marc
Marc

Very nice. Works like a charm. This is what I was looking for and I can perfectly live with this external script.

Gravatar for vikas
vikas

Works well with Firefox! Is it possible to make it work with thunderbird too. I do a lot more editing there. There is an external editor extension for thunderbird, but it does work with 1.5+.

Gravatar for codemac
codemac

I can’t seem to get this working with the following script:

[code lang=“shell”]

!/bin/sh

urxvt -e zsh -c ”vim $@” [/code]

All that happens is vim tries to edit a “visible-stats” buffer and an “on” buffer. What do you pass as parameters to the program? It seems to me you are sending “visible-stats on” at some point, which is bizarre. Any ideas?

Gravatar for docwhat
docwhat

@vikas: You’re the second person to ask. I honestly don’t know what’s needed to make it work in Thunderbird. I think I want to make this work as well as possible in Firefox first.

@codemac: It’s All Text! only sends the filename. I definitely don’t send the words “visible-stats on”. Is it possible that you have a weird alias, or some sort of setting in your .vimrc? Otherwise, I’m not sure what it could be, since it works for everyone else.

I guess I’d suggest starting with basic principles, like echo ”$@” > /tmp/testing and work your way up. I assume you tried running your script directly…

Ciao!

Gravatar for shufla
Shufla

Hello,

There are little problems with rendering edit button on trac (http://trac.edgewall.org/). Edit button is sometimes to low. I know, that more info are needed for good bug report - please contact me directly.

Gravatar for brad
Brad

Please make it so the “Edit” button doesn’t show for a textarea with the readOnly property set to true (which can be initially set via the readonly HTML attribute).

Thanks.

Gravatar for brad
Brad

It would also be awesome if there were an option to disable the “Edit” button and have an option on the browser context menu instead (right click a textarea > Edit in external editor).

Gravatar for terry lee
Terry Lee

Maybe it’s me, but I can’t seem to get “It’s All Text” to work. I see the grey’d out Edit button, but when I click on it, I get the following message: “I was unable to run your editor, ‘usr/bin/gedit’ You the browse button to choose another editor and try again.” Could you tell me how I might fix my problem? Also, You might want to change the word “You” in the error message to “Use.”

Gravatar for docwhat
docwhat

@Shufla: I’m trying to collect test cases where the button doesn’t appear correctly. I currently have trac, wordpress, and wikipedia (I think).

@Brad: I’ve added your bug and idea to my todo list. :-) Thanks for the feedback.

@Terry Lee: The “You the browse button” typo was fixed in newer versions (0.4+). I can’t figure out what is going on from your description, I’ll email you and if there is any generally useful info, I’ll post it back here.

Gravatar for codemac
codemac

Ok, I got it fixed :P

It had to do with a syntax error in my .zshenv

Gravatar for scott
Scott

Cool plugin. works well with TextWrangler on OS X. One odd behavior, though, is that the edit button shows up about an inch below the textarea in Trac. Any idea what might be causing that?

Thanks! Scott

Gravatar for hans
Hans

I have installed the new version (4.2). However the button is displayed far away from the textarea when using it in Wikipedia.

I discovered what causes the problem: the button is positioned on an absolulte place from the top and left depending on the width and height of the window. However the real position is not related to the top-left corner of the window, but the top-left position of the div where it is wrapped in. That div is placed 2.8em from the top and 12.2em from the left, so the edit-button is also placed at that distance from the textarea.

Gravatar for docwhat
docwhat

@Hans: Thanks for pointing that out. I don’t know why I was trying to position it from the page edge instead of the parent node edge. I think I just got into this zone of frustration where I went nuts. sigh It’ll be fixed in the next version.

To all those who pointed out the gumdrop edit button was in the wrong place: Thanks reporting the edit button being off. It’s fixed currently and should be fixed in any version > 0.4.2

Gravatar for doug hellmann
Doug Hellmann

Hi, Christian,

If you need someone with a Mac to test new releases for you, let me know. I’d be happy to test a prelease version with the edit button position fix. :-)

Doug

Gravatar for prasun
prasun

It does not work with unicode, I guess?

Gravatar for docwhat
docwhat

@prasun It sure does! That was definitely one of the requirements. As someone who has an umlaut in his last name, I insist on Unicode wherever I travel.

Now, it may not work on pages that don’t set their charsets correctly. This is because IAT converts from the page charset to UTF-8 for editing (see the preferences) and then back again. So if the page is in (for example) telugu, but has a charset of ascii, then the IAT cannot figure that out that the page is lying.

Do you have a specific failure case? I’m happy to take a look.

Ciao!

Gravatar for benct
Benct

I use a Swedish version of Firefox 2.0.0.2 on Windows XP.

After upgrading to It’s All Text! 0.4.2 it didn’t work for me anymore, so I had to downgrade. What’s up, or rather down?

/Benct

Gravatar for docwhat
docwhat

@Benct:

Interesting. One of the big changes between the previous version and 0.4.2 is that I now have localization, but only a translation for en-us. Can you tell me more about the failure? You only say it doesn’t work anymore.

Thanks!

Ciao!

Gravatar for john
John

This extension absolutely rules. I had an extension which allowed me to resize textareas, but it didn’t always work right. This just works.

If I may propose a feature request. Today I was working on a website and the layout was kind of blown out. I switched over to safe mode and the layout was fine. Turns out the “edit” graphic was off to the side about 300 pixels from the textarea causing the layout issue.

Perhaps you could implement a toggle. Where I could switch it off temporarily while I test websites and then back on when I need it. That would so very much rock!

Thanks, and keep up the good work.

Gravatar for docwhat
docwhat

@John: Thanks for the feedback! The next version will have a preference to turn off the “edit” button. Unfortunately, addons has been busy with their upgrade and aren’t scheduled to be done till the 15th.

Ciao!

Gravatar for martin polley
Martin Polley

Re: jEdit/Flock

Yeah, that worked, invoking it from a .cmd file. Thanks for the tip.

As for Flock, I tried it again just now and it worked fine… Strange.

Thanks,

Martin

Gravatar for prasun
prasun

I tried entering Hindi in gmail’s compose box. didn’t work

Gravatar for docwhat
docwhat

@prasun: Hmmm… I am able to get it to work using the string below. gmail.com is correctly set for UTF-8.

I think the problem must be your editor. It must not be saving as UTF-8. Perhaps it is using one of the other charsets for saving? If you know what charset it is using then you can set it in the preferences. Alternatively you can get your editor to save in UTF-8.

I know some of the non-arabic speakers use non-unicode charsets because they are rather verbose. If Firefox understands that charset, it should be able to convert it correctly to UTF-8.

Example:

Hindi: मैं काँच खा सकता हूँ, मुझे उस से कोई पीडा नहीं होती.

I don’t know what it says, but it is pretty. source

Gravatar for giuseppe
Giuseppe

Fantastic add-on! Until updated to 0.4.2 … [using Firefox 2.0.0.2 under XP]

This is somehow related to previous postings about using It’sAllText (IAT) with moinmoin wiki. That’s in fact my main use of IAT, and the main reason why I moved from mozex. Mozex was fine until I upgraded firefox to 2.0, when it stopped updating across ‘previews’. So I moved to It’sAllText 0.4.1 and it was fantastic. Mind you, there is a little trick to make it work with moinmoin: if the URL of the page open for editing is “XYZ”, the URL after the first preview changes to “XYZ#preview”, so with mozex (before it broke) as well as with IAT 0.4.1 I needed to click on the preview button before starting the external editor. I could then save changes any number of times and do any number of previews without need to restart the editor.

The problem is now that this does not work any longer in IAT 0.4.2. After clicking on ‘preview’, the text field is no longer updated. This is a real pity, since this feature (being able to edit wiki pages with an external editor) is the main reason I was using IAT, but as it is now it’s easier to just do cut&paste from an editor into the text field…

If you want to try the ‘preview’ feature yourself, go to

http://moinmoin.wikiwikiweb.de/WikiSandBox

or to

http://trac.edgewall.org/wiki/SandBox

This last site also shows another problem, the little ‘edit’ icon is displayed far below the bottom edge of the text field. I am not sure if this is a problem with IAT or with the html layout of the particular page.

Best regards,

Giuseppe

Gravatar for docwhat
docwhat

@Guisepee:

There are two things that broke this behavior:

  1. I started using the #hashpart of the url to uniquely identify a url. This is probably the wrong thing to do, so I changed that in the next version.
  2. IAT starts looking for the file on disk only after the user clicks edit.

The second change is the harder to deal with one. Previously I had this flow:

  1. Load page
    1. delete all files for textareas in this page
  2. If file updates on disk then refresh the textarea
  3. If user clicks edit:
    1. If file doesn't exist, then create it
    2. Open editor on file

However, this causes problems because if a user visits the same page twice, then they can end up deleting already done work.

If I remove the delete all files on page load, then if you visit a page you already visited then it’ll update all your textareas with stale information.

So I changed the flow to not delete files on the disk, but it doesn’t start looking for updates on the disk until you click the edit button.

I think what I’ll do is add a dialog when the user clicks edit asking the user what they want to do. This should eliminate confusion and prevent accidental deletion of data.

Any suggestions are welcome, though. :-D

Ciao!

PS: regarding the edit button being in the wrong place, I fixed it for Trac, but it’s broken in other places. It’s very annoying. I’m not sure what I’m doing wrong. Sigh.

Gravatar for prasun
prasun

I’m using Wordpad on Windows. What editor would you suggest?

Gravatar for docwhat
docwhat

@prasun:

Yeah, Wordpad is definitely not what you want to be using. It doesn’t understand UTF-8 at all.

I usually use notepad++ when I work with Windows. It supports UTF-8.

Ciao!

Gravatar for giuseppe
Giuseppe

Christian,

> The second change is the harder to deal with one. Previously I had > this flow: > > 1. Load page > 1. delete all files for textareas in this page > 2. If file updates on disk then refresh the textarea > 3. If user clicks edit: > 1. If file doesn\u2019t exist, then create it > 2. Open editor on file > > However, this causes problems because if a user visits the same page > twice, then they can end up deleting already done work.

I don’t understand this. The first time you visit the page you open your editor by clicking on ‘edit’. This creates a new file when you save (since all previous files have been deleted.) Then you go somewhere else and after a while come back to the page you were editing. OK, IAT removes all previous files, but you still have your editor open with the latest contents. Whenever you save the next change, IAT will update the text field. I don’t see how this can cause loss of data, unless you close your editor without saving or you save but you move to a different page before the field gets updated. Unless I am missing something.

Ciao,

Giuseppe

Gravatar for docwhat
docwhat

Giuseppe:

I think what you say makes sense and matches much what I had originally. I’m trying to remember why I changed it. I think one of the reasons is that there are a lot of stat() calls happening because every textarea is monitored. In the newer code there is also a problem with file extensions; the user can change the file extension at will.

I’ll need to think about it some.

Maybe something like this:

  1. Load Page
  2. Walk through all files, looking for ones that match this base-name (host + hash), stripping off extension.
    • If none are found, continue. Don't monitor for changes until edit button is pressed.
    • If one is found, set the textarea to match that extension, delete the file and start monitoring for changes.
    • If more than one is found, pick one and do the above.

One problem I do remember is that some editors, like gedit, will empty the buffer for a file that is deleted, which made the original behavior annoying.

Ciao!

Gravatar for florin andrei
Florin Andrei

Very nice extension! Couple of observations:

  1. The fact that the extension can be selected is somewhat “hidden”. It took me a while to discover that I could force a .php extension (*) to the file (to enable syntax highlighting in Gedit). If it could be made a bit more obvious, that would be great.
  2. Would be nice to allow parameters to the editor command-line. E.g., to allow running mcedit in gnome-terminal or something like that.

(*) - Oh, and I had to add .php to the list. ;-)

Gravatar for docwhat
docwhat

Florin Andrei:

Thank you for the complement and for taking the time to give me feedback. :-)

Regarding the extension changing being hidden. I agree. I originally wanted a right-click on the gumdrop to popup that menu. At the moment, there is a menu, but it is control-click not right-click. This is due to the way the context menu works in browser context in Firefox. I don’t seem to be able to override it. Other developers confirmed it, unfortunately. I have another idea, but I’m not sure it’s a good one…

Regarding parameters: It would be nice, but because it works across multiple platforms (Windows, Linux, MacOSX) and because firefox doesn’t have execl*() type functions, only the exec() like nsIProcess, I would have to write my own parameter parser and quoter for every platform. This is a very trick and hard to do in a cross-platform way. I may yet do it, but it will be a late addition.

Meanwhile, you can create a shell script (sh, bash, cmd, bat or whatever your platform handles well) to do what you want. In your example, you could do something like:

[code lang=“shell”]#!/bin/sh gnome-terminal -x someeditor ”$@” [/code]

Thanks again!

Ciao!

Gravatar for pz
PZ

Is there a way to configure Its All Text! to be activated by a hotkey?

Gravatar for docwhat
docwhat

PZ: Not currently. I know that Mozex added that feature in the last year or so.

You’d have to click on the textarea or select it via keyboard before you used the key-combination to fire up your editor. Since you can pick the extension, I’m not entirely sure how this’d work.

I’ll add it as a future item. Right now, getting the kinks out of the basic system comes first.

Ciao!

Gravatar for era
era

Installed this today and love it already. However, it seems to leave the temporary files behind in ~/.mozilla/firefox/i4q7b44rf.default/itsalltext/

Not a big problem yet, but I expect it will be …

Gravatar for docwhat
docwhat

era: I’m glad you like it! It does indeed leave temporary files around. However, they should be cleaned up by one of two processes:

  • On exit, they should be deleted by Firefox (assuming it doesn't crash or something).
  • If the file hangs around more than a certain time (I think a week), then It's All Text! will delete it on it's own, assuming your clock isn't jumping around like crazy.

Thanks for checking on that though. :-D

Ciao!

Gravatar for hugh
Hugh

For some reason, I don’t see the edit button when composing an email in gmail. The edit button is visible on the “To:” text area where I can type in email addresses, but not in the main text area.

I can send you a gmail invitation if you want to debug it ;-)

Thanks for an excellent extension.

Gravatar for hugh
Hugh

Too get this working in MacOS X, I had to make a symlink to my editor (in my case emacsclient), then I browsed to the symlink and selected in the “It’s All Text!” preferences.

For example, in Terminal I found the emacsclient program in /Applications/Aquamacs Emacs.app/Contents/MacOS/bin/emacsclient and made a link like this:

cd ~
ln -s /Applications/Aquamacs Emacs.app/Contents/MacOS/bin/emacsclient .

Then I switched to Firefox and selected Tools -> Add-Ons, then selected “It’s All Text” and clicked Preferences, then clicked Browse and selected the emacsclient link in my Home directory.

You can substitute any editor for emacsclient.

Gravatar for docwhat
docwhat

Hugh: You’re welcome! :-D I’m happy people are using It’s All Text!

Thanks for describing this strategy for MacOsX users. It’ll be helpful, I’m sure.

Regarding the button in the wrong place in gmail: I’m still having troubling getting the button in the right place. It’s very irritating. I had a strategy that worked some places, but not others. I now have another strategy that works in other places, but not in some… sigh I don’t seem to be able to win.

Ciao!

Gravatar for mario grgic
Mario Grgic

This is a neat idea. However, edit icon is often not rendered at all for textareas (e.g. gmail compose new mail, slashdot.org comment etc). Sometimes the edit image is rendered “off screen” (for example blogspot comment text area) etc.

Extension is also supposed to work with entire web pages? In my case context menu is available only on about:blank, and as soon as I load any other page, context menu is not there?

Gravatar for hugh
Hugh

Christian: perhaps you could have a special case for sites like gmail that need a different button placement strategy. I know it would be ugly, but it might work.

Gravatar for docwhat
docwhat

Mario Grgic:

I finally, finally, finally have fixed the edit button for all the places it has been broken. I think this was the correct fix, I understand new things, etc. etc. The next version should be fixed. Alas, addons.mozilla.org is not yet done migrating. When they do, I’ll submit a new version.

Re: the context menu. It is one of the last things I am still fixing before version 1. It currently only works when you right-click on a textarea.

Ciao!

Gravatar for docwhat
docwhat

As a temporary measure, until addons is back again …

It’s All Text! Version 0.6.0

Get the latest at Addons

I’ll delete this comment once addons is back.

EDITED: I fixed the above URL. Somehow it got an extra ’/‘. :-/ EDITED: A newer version is available on addons.

Gravatar for jon
jon

Christian,

Thank you so much for this - I have it running beautifully on my MacBook Pro, with Firefox 2.0.0.3 and Aquamacs, and am using it to type this message :-) I couldn’t figure out how to get Darwin Emacs to work, but Aquamacs worked first time. Thanks also to Hugh for nice clear instructions on how to make that work.

Gravatar for katy
katy

mozilla launched their new, read crappy, addon site and its all text is gone. would you pretty please post it… pretty please & thank you.

Gravatar for docwhat
docwhat

They have rolled back to the older (working) addons site now. So it’s not an issue at the moment. They had my extension in “the sandbox”. Which I think is a polite way of saying purgitory. If you disliked that experience as much as I did, then sign up for bug 374406.

Remember to be polite. They made a couple of bad choices, but they have worked really hard on this stuff.

Meanwhile…

I posted (about 3 posts above) a temporary link to a newer version, since addons isn’t accepting updates.

Gravatar for hugh
Hugh

Hi Christian,

0.6.0 is working well on my Mac too. I like the context menu.

I notice that I still can’t edit the main textarea in the GMail compose screen, the button doesn’t appear and the context menu is all gray except for the Preferences item. So it seems to me that It’s All Text! is not recognizing the main textarea as a text area. I guess Google might be doing something funny.

I also notice that if I bring up the preferences dialog from the context menu, there are no buttons that I can use to dismiss it (no OK or Cancel buttons). I have to hit Escape to get out. This is probably an OSX thing as the preferences dialog is displayed as a drop down sheet attached to the current window, rather than in a separate window. See http://flickr.com/photos/vanessahugh/434243324/

If I launch the preferences dialog by clicking on the Preferences button in the Add-ons manager, then I get a normal dialog with a close button. See http://flickr.com/photos/vanessahugh/434254886/

If there is anything I can do to help with these bugs, please tell me.

Thanks again.

Gravatar for thomas
Thomas

Hi,

I really would like to use this gadget, but, alas, when trying to download it today (26 March, 8.00am CET) from Firefox extensions page it says “Couldn’t install. Bad file hash”.

Any idea?

Gravatar for docwhat
docwhat

Hugh:

Hi! Thanks for trying it out. I’ll take a look at gmail again. :-/ I’ve had a strange bug where in the wordpress admin screen the button won’t show up sometimes. It’s very strange.

I knew about the Mac OS X problem but have been having a hard time searching for what the problem is. Obviously, I must be using an incorrect call to openDialog(). Your information should help me narrow that down.

Thanks again for the feedback.

Ciao!

Gravatar for docwhat
docwhat

Thomas:

I assume you tried to download from http://addons.mozilla.org/ and not from here? Or was it from here? Addons is having problems of late. I’ll probably post about that in a little bit.

Ciao!

Gravatar for dave
Dave

ItsAllText (IAT) is one of my favorite plug-ins, and I’ve got plenty. Too many, honestly.

But it has one behavior that I don’t quite understand. I can live with it, but it makes me think that something’s slightly amiss with the interaction of IAT and Firebug…

I use the fabulous Firebug web development extension (http://getfirebug.org/) every day. It has a fine feature that makes it easy to inspect a specific element on a page: control-click the element of interest and select “Inspect Element” from the context menu, and it opens Firebug with that element selected in the HTML pane on the left, and its styles showing in the CSS pane on the right. Beauty.

With IAT installed, however, that selected element has two new properties added to it:

id="itsalltext_generated_id__1"

and

itsalltext_uid="1i22272h2135352u2p1k2w1z2x1b1w2d3b1k261i1y3b1p1p"

These are present no matter what element I select on the page. I guess it’s part of IAT’s inner workings, but it is somewhat distracting.

Gravatar for docwhat
docwhat

Thanks again to everyone who took the time to give me feedback to make this extension better!

I have closed comments on this post because I have a new post about it.

Go to the new post: It’s All Text! v0.6+ (March 26th, 2007)

Submit a Comment

docwhat

The personal blog of Christian Höltje.
docwhat docwhat contact