We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Textile Editor Helper (TEH) extension

Development and Programming

imagehat's avatar
imagehat
68 posts
17 years ago
imagehat's avatar imagehat

After coming across the very cool Textile Editor Helper plugin for Slate via this forum post a while back, I’ve been kicking around the idea of trying an extension for it. So I just did and thought I’d see if anyone finds it useful, or has any feedback on on my additions.

If anyone’s interested in trying it out I’ve attached it here, and an image to give you the idea. The original version didn’t have link or email buttons, so I added those as well, though one of the Slate guys told me they’d be adding that in the next version so hopefully their implementation will be nicer. I didn’t add the preview as I thought it would compete with EE’s own preview area and be confusing. Though a live preview could be cool, if perhaps overkill.

I’d love to hear what people think of this idea (as well as anything I could do to improve the extension itself of course).


update: 1.2 - New version requires jQuery for the Control Panel extension (bundled with EE 1.6.6+ or available here)

Link and Email custom buttons bugfixes: -IE7+ selection handling fixed (no more duplicating text) -Fixed selection handling in all other browsers (text stays selected instead of moving cursor to end of field)

Now available for download at Github (click the download button, then choose zip or gzip) … or attached right here for people having trouble with Github.

update: 1.1- New version using jQuery instead of Prototype. Simplified extension settings. Added option to use EE encode tag pMcode for email links so they get encoded. Upgrade note: I suggest disabling and completely removing the old version first before installing 1.1.

current version: 1.2.0 (build 20090331)

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
17 years ago
Lisa Wess's avatar Lisa Wess

That’s very nice, simple too. Would you consider making a plugin for comments, too, similar to the HTML buttons plugin?

I’d also like to encourage you to submit this to our Add-on Library.

       
textdriven's avatar
textdriven
107 posts
17 years ago
textdriven's avatar textdriven

I just installed it, uploaded the files to the right places and activated it but I don’t see anything. Have missed a step?

Looks like this could be a great extension.

       
textdriven's avatar
textdriven
107 posts
17 years ago
textdriven's avatar textdriven

Hmm. It appears on already published article but not new ones until I save them.

       
imagehat's avatar
imagehat
68 posts
17 years ago
imagehat's avatar imagehat

@Lisa: Thanks, I’m hoping this fits the bill for me an my clients between having to resort to tinymce or fck (yikes!) and just sending them to an external documentation page and telling them Textile (or Markdown for that matter) is “good for them”. Plugin wouldn’t be that hard I’d guess, I may take a look. And I think I’ll kick the tires a bit before I submit it though…

@textdriven: I’ve tried it on a couple EE installs without issue. Can you check in the settings and make sure the paths area all correct adn save the settings again? I default them based on where I think they should go, but that would be my first guess. And thanks for giving it a whirl!

       
imagehat's avatar
imagehat
68 posts
17 years ago
imagehat's avatar imagehat

@textdriven: oops took too long to respond. It checks for fields that are set to (and saved or defaulted) as Textile. So if the default is something else and you select Textile as the formating I think it’s not updating. I’ll have to think of a way to live update that maybe…

       
Ryan M.'s avatar
Ryan M.
1,511 posts
17 years ago
Ryan M.'s avatar Ryan M.

I’m a big fan of Textile, and using it with EE, so thanks for this. I look forward to trying it out when I get a chance.

I put together a live preview (in the comments area of a previous site) build utilizing Textile (from some scripts I found online). That never got used, but I know I have the markup/code around.

       
Ryan M.'s avatar
Ryan M.
1,511 posts
17 years ago
Ryan M.'s avatar Ryan M.

I just tried installing this on a relatively new install and it’s not putting the editing buttons in, and it is also throwing a couple things at the top of the page like so:

Notice: Undefined variable: EXT in /home/site/public_html/system/extensions/ext.textile_editor.php on line 56

Notice: Undefined variable: EXT in /home/site/public_html/system/extensions/ext.textile_editor.php on line 58

So I went in and changed line 54 from

global $DB, $IN, $PREFS;

to

global $DB, $IN, $PREFS, $EXT;

Looks like I had to add the $EXT there - is that the correct fix? Everything seems to be working OK now.

       
imagehat's avatar
imagehat
68 posts
17 years ago
imagehat's avatar imagehat

Ah yes that is correct. Sorry about that, I forgot I added the “last_call” check to make sure this wouldn’t interfere with any other extensions using the same extension hook and forgot to add the global. I’ll fix that and also should be posting an update (hopefully later today) as I’ve got toggling working for fields that show the format select list (xhtml, br, none, etc.) to initialize or destroy the toolbar when you change the formatting selection. Also got some tips from the Slate guys who created the toolbar on a cleaner way of adding the custom buttons.

       
Ryan M.'s avatar
Ryan M.
1,511 posts
17 years ago
Ryan M.'s avatar Ryan M.

This seems to be working quite well, and I’m already looking forward to your update. Would it be easy to update with more buttons, beyond the default set?

       
imagehat's avatar
imagehat
68 posts
17 years ago
imagehat's avatar imagehat

I’ve updated the extension so it now toggles the toolbar when you change the formatting pulldown for your text area. Also cleaned a few things up and fixed the errors. Grab 1.0.2 up top.

@mdesign: If you’re just looking to add simple open/close tags that don’t require a dialog prompt or anything special it’s pretty simple to add your own buttons. If you look in /teh/javascripts/textile-helper-config.js you’ll see the first several lines are the default buttons and it’s fairly easy to duplicate one of those lines and replace a few things. Below that you’ll see where I added the custom link button code that required a new callback function to handle the user prompts - it’s a bit more complex but still pretty simple. And the images are all just the ever popular FamFam Silk icons.

Let me know if you’ve got particular buttons in mind I’m happy to help or maybe add them into the next version. An image button was my next idea.

…off to play with 1.6 some more…

       
Ryan M.'s avatar
Ryan M.
1,511 posts
17 years ago
Ryan M.'s avatar Ryan M.

I can’t get this new extension (1.0.2) to work. I did a fresh install on a new site where I want to use it. I do get a light gray bar where the buttons should go, and it does disappear/reappear when I change the field formatting. I’ll try monkeying with it a little bit more, and seeing if there might be a conflict with another extension or something. Or heck, I might have not put something in the right place!

       
imagehat's avatar
imagehat
68 posts
17 years ago
imagehat's avatar imagehat

Can you check the settings and make sure the paths are right? I know in the first version I had mixed up writing the “default” settings automatically when the extension gets installed… that may have crept back in…

       
Ryan M.'s avatar
Ryan M.
1,511 posts
17 years ago
Ryan M.'s avatar Ryan M.

The setting are correct, as far as I can tell (see attached pic). I have the ‘teh’ folder in the root of my site. Maybe some path in in the extension got tweaked inadvertently?

       
imagehat's avatar
imagehat
68 posts
17 years ago
imagehat's avatar imagehat

Oops - I see the problem - the “Config file URL” has the wrong extension - should be ….textile-editor-config.js (not .css). I think that’s some bad cutting and pasting on my part in the install function. Sorry about that.

       
1 2 3 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.