htmlArea

A directory of browser-based WYSIWYG editors

  MAIN
INDEX
SEARCH
POSTS
WHO'S
ONLINE
LOG
IN

Home: htmlArea 3 (beta): htmlArea 2 & 3 archive (read only): htmlArea v3.0 - Discussion:
Avoid cut & paste with format


The htmlArea 2 & 3 editors have been discontinued.

We've made these forums available as a read-only reference and knowledge-base for people using or developing editors based on htmlArea 2 or 3.

Anyone who is interested in taking over version 2 or 3 is free to do so. All we ask is that you choose a new name that doesn't have "htmlarea" in it to avoid confusion with this site. We'll even give you a link in the directory to make it easier for people to find you. If you are developing or hosting an htmlArea based-editor under a new name, please submit it to our directory.

 


c0p0n
Novice

Jun 16, 2004, 10:40 AM

Post #1 of 5 (1199 views)
Shortcut
Avoid cut & paste with format Can't Post

When pasting something from i.e. M$ Word, it copies even the font things (eg, times new roman, 12pt). This is impressive for me, but I would want to know if I can deactivate this.

You may also notice that on recent versions of Mozilla Firefox (0.9 so far), you cannot paste to an HTMLArea by default (http://mozilla.org/editor/midasdemo/securityprefs.html), which may be annoying for a web programmer (as I am).

In a wonderful life I would ask (if is not possible at this time) to preserve, on cut&paste functionality, only selected groups of text format things, that is to say, I wanna config the script for allowing the paste of bold, italic, un/ordered lists and links, but not font size, alignment and face.

Thank you in advance :D


ps: as my english is horrible, please feel free to ask me to explain better what you cannot understand. Thanks!


Octoate
Novice

Jun 16, 2004, 11:01 AM

Post #2 of 5 (1193 views)
Shortcut
Re: [c0p0n] Avoid cut & paste with format [In reply to] Can't Post

You can set a flag in your configuration for killing the tags when pasting from Word:

From htmlarea.js:

Code
// set to true if you want Word code to be cleaned upon Paste 
this.killWordOnPaste = false;


It is disabled by default, so you have to enable it with your own configuration when instantiating a new object of htmlarea.


c0p0n
Novice

Jun 16, 2004, 11:17 AM

Post #3 of 5 (1193 views)
Shortcut
Re: [Octoate] Avoid cut & paste with format [In reply to] Can't Post

Thanks for your quick reply!

I tried to make it from the html code and from htmlarea.js itself, but I had no luck - it remains pasting tables, font colors and so :(

Code
From my html file: 
function initEditor()
{
var editor = new HTMLArea("texto");
var cfg = editor.config;

cfg.toolbar = [
[
//"htmlmode",
"bold", // negrita
"italic", // cursiva
"underline", // subrayado
"separator",
"insertunorderedlist", // lista sin ordenar
"separator",
"createlink" // enlaces
]
];
cfg.statusBar = false;
cfg.killWordOnPaste = true;
editor.generate();

}
------------------------------
From htmlarea.js:
// set to true if you want Word code to be cleaned upon Paste
this.killWordOnPaste = true;


I tried with only one of them at once, then with both but as I said, no luck.
Am I doing something wrong?

Edit: Ups!!! I forgot:
FireFox 0.9 & IE 6SP1, Win2k PRO.
HTMLArea 3.0RC1



(This post was edited by c0p0n on Jun 16, 2004, 11:19 AM)


Octoate
Novice

Jun 17, 2004, 2:48 AM

Post #4 of 5 (1183 views)
Shortcut
Re: [c0p0n] Avoid cut & paste with format [In reply to] Can't Post

Your code looks ok.
My instantiation of the editor is a bit different, so you maybe can test it, too:


Code
function initEditor()  
{
var cfg = HTMLArea.Config();

cfg.toolbar = [
[
//"htmlmode",
"bold", // negrita
"italic", // cursiva
"underline", // subrayado
"separator",
"insertunorderedlist", // lista sin ordenar
"separator",
"createlink" // enlaces
]
];
cfg.statusBar = false;
cfg.killWordOnPaste = true;

var editor = new HTMLArea( "texto", config );
editor.generate();
}



c0p0n
Novice

Jun 18, 2004, 7:03 AM

Post #5 of 5 (1165 views)
Shortcut
Re: [Octoate] Avoid cut & paste with format [In reply to] Can't Post

Thanks for your reply :)

It doesn´t work, FFox JS console says this:

Code
Error: cfg has no properties 
Source File: http://servidor/proyectos/cincopuntocero/admin/noticias/agregar_noticia.php?idioma=5&idcat=32
Line: 27


The highlighted line is this:

Code
"createlink" // enlaces


 
 
 


Search for (options)