textarea....adding images for blogging
Moderator: General Moderators
textarea....adding images for blogging
how could i work with the textarea that will accept pictures or links. If javascript give me a hint.
i will be using it for blogging. and i am a newbie for doing it. I needed your help masters, to enable images in the textarea thank you so much. I am looking forward for help replies.
i will be using it for blogging. and i am a newbie for doing it. I needed your help masters, to enable images in the textarea thank you so much. I am looking forward for help replies.
Re: textarea....adding images for blogging
Impossible. A text area is just that - an area for plain text. Your best bet is to not reinvent the wheel & use a WYSIWYG editor like FCKEditoror TinyMCE.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: textarea....adding images for blogging
Just out of curiosity, what is the general method behind those?
Re: textarea....adding images for blogging
I think they use Javascript to render html etc where the textbox would normally go
Re: textarea....adding images for blogging
tinyMCE & FCKEditor plop an iframe overtop the textbox I believe.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: textarea....adding images for blogging
Interesting. And how do they enable you to edit?
Re: textarea....adding images for blogging
That's a very obvious question - one that I've never asked myself before and don't have an answer to.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: textarea....adding images for blogging
~pickle | Please use
Something to that effect anyways, Google edit mode and you'll see...
Thing get interesting in their own unique implementations which counter-attack browser caveats. For instance, under IE (5 anyways it's been a while since I did this) UNDO would stop working in most WYSIWYG (HtmlArea) because HtmlArea (if memory serves correct) updated the TEXTAREA each time a key was pressed - updating the textarea it turns out - erased the internal UNDO buffer.
This was eventually rectified by capturing the onsubmit() event and updating the textarea only at submittion time - at least thats how we fixed the problem.
Then of course, there are the infamous double line break in IE - which requires a wicked buggy hack or the user to hold down the shift key when pressing enter if only a single line break is desired.
With all the browser caveats...and difficult manipulation of the browser and it's DOM via javascript...those were the worst most irritating moments of my life. Something works one moment and then because of a cache issue or something similar BAM the code doesn't work on next refresh.
~pickle | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
WYSIWYG editors work by basically replacing (actually hiding) the TEXTAREA and inserting a IFRAME.
The IFRAME is then told to turn into "edit" mode - how this is done might vary from browser to browser but most will work by setting the "document" editMode property to on.Code: Select all
document.getElementById("wysiwyg_iframe").editMode = "on";Thing get interesting in their own unique implementations which counter-attack browser caveats. For instance, under IE (5 anyways it's been a while since I did this) UNDO would stop working in most WYSIWYG (HtmlArea) because HtmlArea (if memory serves correct) updated the TEXTAREA each time a key was pressed - updating the textarea it turns out - erased the internal UNDO buffer.
This was eventually rectified by capturing the onsubmit() event and updating the textarea only at submittion time - at least thats how we fixed the problem.
Then of course, there are the infamous double line break in IE - which requires a wicked buggy hack or the user to hold down the shift key when pressing enter if only a single line break is desired.
With all the browser caveats...and difficult manipulation of the browser and it's DOM via javascript...those were the worst most irritating moments of my life. Something works one moment and then because of a cache issue or something similar BAM the code doesn't work on next refresh.
~pickle | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]