google-code-export / lwrte

Automatically exported from code.google.com/p/lwrte
1 stars 0 forks source link

Removing formatting when parsing into texareea #44

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. when pasting the content from a already formatted document, it keep the 
original formatting.
2.
3.

What is the expected output? What do you see instead?
- When pasting into the textarea, it must remove all formating code and 
keep only the text.

What version of the product are you using? On what operating system?
rte1.2 / Vista /IE8/FF/Chrome

Original issue reported on code.google.com by 06stu...@gmail.com on 19 Nov 2009 at 1:46

GoogleCodeExporter commented 9 years ago
I disagree the editor should keep the format of the text it a H1 tag stays a H1 
tag

there is a button to remove extra formatting in the example tool bar though i 
haven't  tested too much.

to do what you want open notepad and paste content into it first then into the 
editor it will have lost its formatting this is because notepad is a plain 
ascii editor while word, html, rtf, excel are typed data and when you copy into 
a clipboard the clipboard trys to hold the format of the data so when you paste 
it into a RTE editor it trys to convert it to HTML so excel becomes a table of 
data etc.

Original comment by spambot....@googlemail.com on 2 Sep 2010 at 8:32

GoogleCodeExporter commented 9 years ago
i know how to workaround the problem... but when your dont project for client 
who doesnt care and doesnt want to do a extra step to pasting the text without 
any formatting... that,s i pain in the a** to explain each time.

Mainly, they copy/paste from Word document... as you know, word document got 
95% of extra preformatted code.

Anyway, i'll keep TinyMCE for my production script (they auto remove the code 
if we want). THe main reason i wanted to switch is the only option you got and 
they dont : the basic upload image.

regards

Original comment by 06stu...@gmail.com on 2 Sep 2010 at 11:01

GoogleCodeExporter commented 9 years ago
How can I bind events in the textarea?

Original comment by ecolasu...@gmail.com on 2 Sep 2010 at 12:37

GoogleCodeExporter commented 9 years ago
in the function "lwRTE.prototype.enable_design_mode = function() {"

look for  this line

$(self.iframe_doc).keyup(function(event) { self.set_selected_controls( 
self.get_selected_element(), self.controls.rte); });

the event has the key press if paste then run the tidy function from the 
toolbar.

Original comment by spambot....@googlemail.com on 2 Sep 2010 at 1:07

GoogleCodeExporter commented 9 years ago
I added the function

$(self.iframe_doc).bind('paste',function(){  });

but... no luck...

Besides.. I need to SELECT ALL text before using the WORD function :(

Original comment by ecolasu...@gmail.com on 3 Sep 2010 at 1:57

GoogleCodeExporter commented 9 years ago
create a function called tidy that takes all the content and tidy ups the 
content

then as in my post above use

$(self.iframe_doc).keyup(function(event) { self.set_selected_controls( 
self.get_selected_element(), self.controls.rte); tidy();});

instead of 
$(self.iframe_doc).keyup(function(event) { self.set_selected_controls( 
self.get_selected_element(), self.controls.rte); });

a better way would for all locations where it is possible to change the content 
have it call an empty function called onchange then if you need to do some 
processing for your project you overwrite the onchange function to do what you 
want.

Original comment by spambot....@googlemail.com on 3 Sep 2010 at 9:02