Home  >  Article  >  Web Front-end  >  How to cancel the pop-up window when fckeditor pastes Word_javascript skills

How to cancel the pop-up window when fckeditor pastes Word_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:32:411233browse

The example in this article describes how to cancel the pop-up window when fckeditor pastes Word. Share it with everyone for your reference. The specific method is as follows:

Use fckeditor as the editing box for user publishing, allowing users to publish Word. By default, when pasting into word, you will be prompted whether to clear the word style. If you select "Yes", a box will pop up and you need to paste again to clear the word style. This operation is very troublesome, so cancel it.

The first way to find it is to put ckeditor/" target="_blank">fckeditorcode_ie.js under fckeditoreditorjs. Searching for PasteFromWord will find the following content:

Copy code The code is as follows:
PasteFromWord:function(){FCKDialog.OpenDialog('FCKDialog_Paste',FCKLang .PasteFromWord,'dialog/fck_paste.html',400,330,'Word');}

Change it to

Copy code The code is as follows:
PasteFromWord:function(){FCK.InsertHtml( clipboardData.getData(" Text") );}

But this way, it becomes plain text, no!

Later I found some solutions:

Since JS and other things are automatically cached, every time you test, you have to clear the temporary files and refresh the page. It’s really troublesome!
The specific operations are as follows:
Open fckeditorcode_ie.js under fckeditoreditorjs,
Found

Copy code The code is as follows:
if (confirm(FCKLang.PasteWordConfirm))

That one, change it to:

Copy code The code is as follows:
if (confirm(FCKLang.PasteWordConfirm)){var D=A; D=CleanWord(D,true,true);FCK.InsertHtml(D);return false;}

Open dialogfck_paste.html and paste the CleanWord function inside into the header.

When pasting Word at this time, after selecting Yes, the format will be cleared directly. If you don’t want the prompt of yes, just remove the judgment of confirm(FCKLang.PasteWordConfirm).

I hope this article will be helpful to everyone’s JavaScript programming design.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn