Thanks for the great extension. However, when I load the publish page (the Textile menu shows up fine), I get an error message: Notice: Array to string conversion in /www/eh9504/public_html/uvamagee/extensions/ext.ih_textile_editor.php on line 103
Check the extension’s settings to make sure the email radio button is selected.
Thanks for the great extension. However, when I load the publish page (the Textile menu shows up fine), I get an error message: Notice: Array to string conversion in /www/eh9504/public_html/uvamagee/extensions/ext.ih_textile_editor.php on line 103
I got this recently, too.
quick fix
after the play nice line
// Play nice with others
$js = ($EXT->last_call !== FALSE) ? $EXT->last_call : '';
insert
$enc_email = (is_array( $this->settings['encode_email'] ) ) ? 'no' : $this->settings['encode_email'];
replace
encode_email: "'.trim($this->settings['encode_email']).'"
with
encode_email: "'.trim($enc_email).'"
This will make it so that the default treatment will be ‘no’ (do not encode email links) in the case that the user hasn’t selected yes/no yet, that is freshly installed or disabled/re-enabled the extension. The lang file already has a default of ‘no’ but for some reason we’re getting the array of yes/no instead of the default.
I’m trying to make a custom button. I want to wrap an <img> tag with code. Here’s my js:
teButtons.push(new TextileEditorButton(‘imageleft’, ‘imageleft.png’, ‘<table class=”imageleft”><tbody><tr><td>’, ‘</td></tr></tbody><caption align=”bottom”>CAPTION HERE</caption></table>’, ‘f’, ‘Image Left’));
However, when I highlight text and select that button, this appears: p<table class=”imageleft”><tbody><tr><td>. Test Text
and when I highlight an <img> tag, nothing appears!
Any ideas?
Sorry – my mistake, I was writing in Textile format. Here’s my code now:
teButtons.push(new TextileEditorButton(‘imageleft’, ‘imageleft.png’, ‘table(imageleft).|’, ‘<caption align=”bottom”>CAPTION HERE</caption>|’, ‘f’, ‘Image Left’));
Even still, my text appears like this when I apply that button:
t
e
s
t
What in the world??
the TextileEditorButton is basically for existing Textile commands (iirc everything in open/close gets parsed, so you will have…. varying results as it is built to match what it knows to look for). (feel free to correct me if i’m wrong about this)
You’d have to follow the custom addLink button which does the parsing all over
I’ve heavily modified my own code so it will be different, but the add button code would be similar to the below
teButtons.push("<button id=\"ed_link\"><img ></button>");
then in your function, in this case ‘addLink’ you’ll have to test if the user has some text that is selected, if not then place open/close tags where the text marker is (last place they clicked), if so then replace open/selected text/close tags.
the code for that is essentially taken verbatim from textile-editor.js, something like grab text range from IE and other browsers. if IE replace the selected text with new text, if other browser replace all the text up til the text cursor with A and all text after with new text + B.
you should be able to basically copy/paste the addlink function and trim it down to do what you want, though you would have to test to see if the selected text is an image, e.g.
if((/<img.+?\>/).test(selectedText)) ...
I’ve emailed the author of TEH about the changes I made to my own version but never received a response. Basically I made it IE6 friendly, had all the settings configurable (css, htc, images can all have separate paths, which will probably be undesirable), and the add link/email links actually check if a link is selected as well as gives the user an option to add ‘rel=”external”’ to their link (should keep existing rels intact and if you want ‘target=”_blank”’ instead that wouldn’t be hard to change). also can convert mailto:email links to encoded version, some other stuff.
i did the bulk of a work in the version before the jQuery version was introduced, but I did port over those changes to the jQuery version seemingly without a hitch. if anyone’s interested i can upload the ie6-friendly files (.gifs) here and look for the changes in code so one could adjust accordingly.
Ok finally heard from imagehat and he said it’s alright to post the code.
I don’t recall why I edited the settings and made it more complicated than it needed to, there was either a reason for it or perhaps I was being overzealous.
Regardless it is IE6-friendly. Even 8-bit PNGs would cause inexplicable distortions so I made GIFs of all the icons and added a .htc script so css hover declarations work in IE, too.
I’ve attached screenshots of the settings and an animated GIF of the improved link / email buttons in action.
Since I haven’t modified the version or extension name I wouldn’t recommend replacing previous TEH on a live site. Hypothetically you could just disable, upload over, re-enable, adjust settings accordingly since TEH has no bearing on custom fields themselves, but again I don’t recall if I tried this myself and even if I did it was not on a live site.
I don’t see any errors when I load the page. Is there an easy method to find out if it is an extension conflict?Hrm. Not sure. I guess for starters you can list what extensions are being loaded? Though if there are no errors I’m already baffled. I guess what we can do is play with the javascript to see what is or isn’t going on. edit: Oh. Maybe somehow it’s a CSS issue? I doubt that but it’s a possibility (e.g. the toolbar is actually loaded but if its height is determined by a stylesheet and some other rule elsewhere has a higher priority that could be the problem). I’ll have to take a look at how it’s loaded and what not when i get the chance.
Now on my live site and it’s still not working. Sorry I took so long to get back with the extension list - thought I could live without the editor, but I can’t.
extension list:
template Management with images 1.0.0 Textarea Resizer 1.0.0 Link Entry from the control panel to your site 1.1.1 tab forward 1.0 accessible captcha 1.0.3 nested weblog 1.0.5 tag submit 2.0.7 filter by author 1.0 textile editor helper 1.1.0 lg addon updater 1.0.2 lg better meta 1.7.1 multi-drop-down list 1.1.1 jQuery for the control panel 1.1.1 comment spam prevention 1.1 nofocus 1.0.0 category checkboxes 1.1.5
for the record the custom field is set to textile and the editor extension settings are all correct and up to date.
Sean - if you have jQuery for the control panel active then TEH is probably trying to load jquery again causing the problem. I’ve been trying to get a minute to update the extension and re-upload, but for now here’s a quick fix you can try, before going through and turning extensions off and all that business:
Around line 110 in ext.ih_textile_editor.php find these bits in the add_header function:
<link rel="stylesheet" href="'.trim($this->settings['teh_path']).'stylesheets/textile-editor.css" type="text/css" media="screen">
< script type="text/javascript" src="'.trim($this->settings['jquery_url']).'"></ script>
< script type="text/javascript" src="'.trim($this->settings['teh_path']).'javascripts/textile-editor.js"></ script>
< script type="text/javascript" src="'.trim($this->settings['teh_path']).'javascripts/textile-editor-config.js"></ script>
… and comment out loading jquery like so:
<link rel="stylesheet" href="'.trim($this->settings['teh_path']).'stylesheets/textile-editor.css" type="text/css" media="screen">
//< script type="text/javascript" src="'.trim($this->settings['jquery_url']).'"></ script>
< script type="text/javascript" src="'.trim($this->settings['teh_path']).'javascripts/textile-editor.js"></ script>
< script type="text/javascript" src="'.trim($this->settings['teh_path']).'javascripts/textile-editor-config.js"></ script>
NOTE: I added the spaces around the script tags to get it to show here on the forum, all you’ll need to do is add the comment brackets to the beginning of the line to stop calling jquery.
Let me know if that works…
well, then it must be a conflict with another extension. I use many of the ones you mention with TEH fine, but not all. (and some I’ve never heard of).
I’d say if you’re willing the thing to do would be extension troubleshooting 101… turn all other extensions off (especially the ones that modify CP behavior), and make sure TEH is working on its own, then enable the others one by one until you find the conflict.
One thing to start with - I’ve never used it, but the Textarea Resizer plugin rings a bell that I think others have had problems with these two together, so start with that one. It makes sense that two extensions trying to work on the same field might butt heads…
ignore the above. I checked and I had an old version of the textarea resizer extension as soon as I updated to the newest version everything worked fine.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.