Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2005-06-02 08:30:21

Hmmm
New member
From: Bulgaria
Registered: 2005-06-02
Posts: 2

is clean Word on CTRL+V in FireFox working?

I am using htmlArea 3, but this doesnt work for me.

I found Xinha today, the example didnt clean Word on paste in FireFox and in IE it makes some cleaning (it keeps span lang="EN-US", I don't need that).
But this is only demo... is there way cleaning on CTRL+V in FireFox (and on all other ways for pasting content from Word, in both browsers) and "full clean" - without this span tags?

Offline

#2 2005-06-02 13:34:35

niko
Xinha Authority
From: Salzburg/Austria
Registered: 2005-02-14
Posts: 338

Re: is clean Word on CTRL+V in FireFox working?

s some cleaning (it keeps span lang="EN-US", I don't need that).

looks like a bug, please create a ticket for that.


using FF Xinha can't read out the Clipboard (security issue). see http://xinha.python-hosting.com/ticket/245


Niko

Offline

#3 2005-08-16 11:58:45

eph
New member
Registered: 2005-08-16
Posts: 3

Re: is clean Word on CTRL+V in FireFox working?

There is a way... just needs some small and elegant changes to htmlarea.js...

Add the following 2 functions to the EVENT HANDLERS Category (around line 3450):

// Called when the user Pastes from Ctrl-V;
HTMLArea.prototype._pasteSpecial = function() {
    var editor = this; // for nested functions
    editor.unPasteSpecial = function () {editor._unPasteSpecial()};
    HTMLArea._addEvent(editor._doc, "keyup",editor.unPasteSpecial);
};

// Called on Ctrl-V keyup;
HTMLArea.prototype._unPasteSpecial = function() {
    var editor = this;
    HTMLArea._removeEvent(editor._doc, "keyup",editor.unPasteSpecial);
    editor._wordClean();
};

Now, after

HTMLArea.prototype.execCommand = function(cmdID, UI, param) {
  var editor = this;    // for nested functions
  this.focusEditor();
  cmdID = cmdID.toLowerCase();
  if (HTMLArea.is_gecko) try { this._doc.execCommand('useCSS', false, true); } catch (e) {}; //switch useCSS off (true=off)
  switch (cmdID) {

add the line

    case "pastespecial" : this._pasteSpecial(); break;

And a little further (the _editorEvent function) replace

        case 'v': if (HTMLArea.is_ie || editor.config.htmlareaPaste) { cmd = "paste"; } break;

by

        case 'v': this.execCommand("pasteSpecial"); break;

That's it! big_smile

Good luck
eph

Offline

#4 2005-08-17 02:30:31

niko
Xinha Authority
From: Salzburg/Austria
Registered: 2005-02-14
Posts: 338

Re: is clean Word on CTRL+V in FireFox working?

that would be a good solution - although it does wordClean the whole html-code - not only the pasted code!
you probably could save the html-code bevore pasting and compare it to the code after pasting and clean only the difference. although this might get a bit more difficult big_smile


Niko

Offline

#5 2005-08-17 09:11:38

eph
New member
Registered: 2005-08-16
Posts: 3

Re: is clean Word on CTRL+V in FireFox working?

niko wrote:

that would be a good solution - although it does wordClean the whole html-code - not only the pasted code!

True, but who wants Word tags anyway?? wink

BTW, these problems have been solved before in the Word Cleaner & questions and the [url=http://htmlarea.com/forum/htmlArea_3_(beta)_C4/htmlArea_2_&_3_archive_(read_only)_C4/htmlArea_v3.0_-_Discussion_F14/Word_cleaner_that_only_cleans_pasted_in_text_P35683/[/url]Word cleaner that only cleans pasted in text[/url] threads.
The wordCleaners from the first thread (1.0.3 and 1.0.4) are more 'agressive' than Xinha's, and more advanced/clean than those in the 2nd thread. You'd have to mix in some stuff from the second thread to get that ultimate solution  cool

Offline

Board footer

Powered by FluxBB