Ticket #349 (assigned defect)
Paste support for Firefox!
| Reported by: | paulb | Owned by: | paulb |
|---|---|---|---|
| Priority: | normal | Milestone: | Version 1.0 |
| Component: | Xinha Core | Version: | |
| Severity: | normal | Keywords: | |
| Cc: |
Description
FCKEditor has a brilliant solution to the paste problem on firefox: popup a window and allow the user to paste into it. I've shamelessly stolen their code and implemented a WordPaste? plugin. It will remove all of MSWord's junk and then some (it may remove too much for general use - feel free to make changes). I've attached the plugin code, and there is one modification required in htmlarea.js:
line 3479:
case "cut":
case "copy":
case "paste":
try {
this._doc.execCommand(cmdID, UI, param);
} catch (e) { }
if (this.config.killWordOnPaste) {
if(typeof WordPaste == 'undefined')
{
HTMLArea.loadPlugin("WordPaste", function() { editor.generate(); } );
editor.registerPlugin('WordPaste');
}
editor.plugins['WordPaste'].instance._buttonPress(null, null);
}
break;
I'm not sure if all of that is necessary, I just copied how it was done in another part of the program and it seemed to work.
Also, when you load your editor, you must enable the "WordPaste?" plugin.
This is solving two problems at once: pasting from FireFox?, and MSWord clean. Probably most people will want to configure these things individually, and so this code will have to be modified to accommodate that.
