Opened 12 years ago

Closed 12 years ago

Last modified 5 years ago

#33 closed New Feature (fixed)

Improve the Paste from word clean up function

Reported by: Alfonso Martínez de Lizarrondo Owned by: Alfonso Martínez de Lizarrondo
Priority: Normal Milestone: FCKeditor 2.4
Component: Plugin : Paste from Word Version:
Keywords: Cc:

Description

Check the changes proposed in https://sourceforge.net/tracker/index.php?func=detail&aid=1443472&group_id=75348&atid=543655
and http://wiki.fckeditor.net/ImprovingPasteFromWord
then try to define a clean up code that we can agree on and also provide an easy way for the developer to add their own clean up code if he doesn't like the function.

Change History (12)

comment:1 Changed 12 years ago by Alfonso Martínez de Lizarrondo

Status: newassigned

I've added the code to my branch.

I've moved the code to FCKTools so it's possible from a plugin to easily change that code if a developer feels that he needs other code.

Besides that, I've added a configuration setting FCKConfig.CleanWordKeepsStructure (default false to keep the old behavior) so that for all the people that wants to keep the basic HTML clean instead of the mess that it's generated right now can change the behavior without the need to use a custom plugin.

I think that indeed the default for the new option should be to keep the HTML, I don't understand why anyone would really want to change the <h1> to <div><b><font size="6">

comment:2 in reply to:  1 ; Changed 12 years ago by Frederico Caldeira Knabben

Replying to alfonsoml:

I've moved the code to FCKTools so it's possible from a plugin to easily change that code if a developer feels that he needs other code.

The main reason of not having the code in FCKTools, is just because it will make the final code bigger (2KB compressed) for something that is not used by the main interface. It is actually used in a specific dialog, giving us the possibility of making that load only when that popup is loaded.

I would suggest to leave the default code in the dialog. To make is easily extensible, we can check in the dialog for the presence of the FCK.CustomCleanWord function. Then we document that the word cleanup function can be replaced by defining FCK.CustomCleanWord in a plugin.

Besides that, I've added a configuration setting FCKConfig.CleanWordKeepsStructure (default false to keep the old behavior) so that for all the people that wants to keep the basic HTML clean instead of the mess that it's generated right now can change the behavior without the need to use a custom plugin.

Ok for now. Maybe we gonna change this for the 3.0.

I think that indeed the default for the new option should be to keep the HTML, I don't understand why anyone would really want to change the <h1> to <div><b><font size="6">

The current Word cleanup has been a sponsored development. They wanted to have the output as much as closer as the original word. So, things like <h1> to <div><b><font size="6"> came up.

I don't like it too, and I strongly believe we'll be completely reviewing this feature. Actually, it seams that this one is one of the most important one.

comment:3 in reply to:  2 Changed 12 years ago by Alfonso Martínez de Lizarrondo

Replying to FredCK:

The main reason of not having the code in FCKTools, is just because it will make the final code bigger (2KB compressed) for something that is not used by the main interface. It is actually used in a specific dialog, giving us the possibility of making that load only when that popup is loaded.

I would suggest to leave the default code in the dialog. To make is easily extensible, we can check in the dialog for the presence of the FCK.CustomCleanWord function. Then we document that the word cleanup function can be replaced by defining FCK.CustomCleanWord in a plugin.

Ok, I've changed it that way, it's just as easy for any developer and keeps the main code base clean.

I think that indeed the default for the new option should be to keep the HTML, I don't understand why anyone would really want to change the <h1> to <div><b><font size="6">

The current Word cleanup has been a sponsored development. They wanted to have the output as much as closer as the original word. So, things like <h1> to <div><b><font size="6"> came up.

The fact is that too many people doesn't understand that logic as it's quite easy to get the same effect using css and the output html will be easier to handle. With these changes everybody should be happy.

comment:4 Changed 12 years ago by Frederico Caldeira Knabben

Ok Alfonso... go ahead with this one. Thanks again.

comment:5 Changed 12 years ago by Alfonso Martínez de Lizarrondo

Resolution: fixed
Status: assignedclosed

merged in revision 65

comment:6 Changed 12 years ago by Alfonso Martínez de Lizarrondo

I've added the description of the configuration setting and the ability to use a custom function in http://wiki.fckeditor.net/Developer%27s_Guide/Configuration/Configurations_Settings

comment:7 Changed 12 years ago by Frederico Caldeira Knabben

Milestone: FCKeditor 2.4
Resolution: fixed
Status: closedreopened

Hi Alfonso... it seams that the CleanWordKeepStructure configuration is not used in any place in the code:
https://sourceforge.net/forum/message.php?msg_id=4119659

Maybe it got lost when moving the code from the core files to the Paste dialog.

Do you think you can check it?

comment:8 Changed 12 years ago by Frederico Caldeira Knabben

Sorry... it was a type in the code.... an extra "s" was added in the code, resulting in CleanWordKeepsStructure. I'm fixing it.

comment:9 Changed 12 years ago by Frederico Caldeira Knabben

Resolution: fixed
Status: reopenedclosed

comment:10 Changed 12 years ago by Alfonso Martínez de Lizarrondo

Ops, too many things in my head. Although I would rather have fixed the config file so the name looks like a proper English sentence: Clean Word Keeps Structure I can bet that sometime in the future some purist will file a bug to fix the typo :-)

comment:11 Changed 12 years ago by Frederico Caldeira Knabben

Well... I'm a kind a purist I think... I'm so tempted to put that "s" back again! I'll do it!

comment:12 Changed 5 years ago by Frederico Caldeira Knabben

Component: GeneralPlugin : Paste from Word
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy