New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#33796] TinyMCE clean up on paste #3661
Conversation
@@ -69,6 +69,8 @@ PLG_TINY_FIELD_PASTE_DESC="Show/Hide the Paste buttons. Only applies in Extended | |||
PLG_TINY_FIELD_PASTE_LABEL="Paste" | |||
PLG_TINY_FIELD_PATH_DESC="If set to ON, it displays the set classes for the marked text." | |||
PLG_TINY_FIELD_PATH_LABEL="Element Path" | |||
PLG_TINY_FIELD_PASTE_CLEAN_UP_DESC="If set to ON, the pasted code will be cleared and left only the tags." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean this? This to me reads the text is removed and the tags are kept. I don't think that's what you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, text not removed. In fact it not jsut remove the styles, it replace some styles with tags and remove unnecessary tags. I'm trying to find the correct description of this function...
In the TinyMCE documentation about this function says simply "clean up", without details.
This description would suit?
"If enabled contents will be automatically cleaned up when you paste using Ctrl+V or similar methods."
{ | ||
$plugins[] = 'paste'; | ||
} | ||
$clean_up_plugin = 'paste'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review coding styles vs Joomla! Coding Standards .
A space is required after an if statement. Also for var names use camelCase. $clean_up
should be $cleanUp
and same for the rest of variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required after an if statement
You mean empty line?
'$clean_up' should be '$cleanUp'
I will fix that, but all other variables in this file is in '$clean_up' style
Not sure about this patch: |
I totally agree with you, I'm just not familiar with the Joomla policy about changing the default behavior. And because in Joomla this feature is not used so far, then to not change habitual behavior, I turned off this option by default. |
I see now better the issue in your patch: As we indeed only propose the paste plugin in Extended mode, this change
is useless
Also please indeed default option to ON. |
If I remove 'paste' plugin from "Advanced mode", then 'clean up' option will works only in "Extended mode". |
Go for Simple and default ON 👍 |
As we use Paste only in extended mode, I guess we should implement clean up on paste there only. |
@tested=OK |
Ok, now 'clean up' option works only in extended mode. So to test it, you need to switch to extended mode. |
Incidentally, in the extended mode clean up happens without this PR (perhaps in another way). Therefore, if the use of cleaning up is not planned for the simple and advanced mode, this PR can be closed. |
I suggest we discuss this on list also, we just merged Tiny 4.0.28 version. Please test again with master |
It seems that parameter 'paste_auto_cleanup_on_paste' not work in Tiny 4. Changes necessary to add 'clean up' to extended mode only: |
@tQuant can you update your branche to staging? |
I have tested this item 🔴 unsuccessfully on 9c93fa0 This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/3661. |
I am closing this as it can not work This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/3661. |
This PR adds "clean up on paste" option to TinyMCE settings. I think this is very basic and usefull settings.
For example, if you copy just 4 short string from MS Word document (attached to tracker item: http://joomlacode.org/gf/download/trackeritem/33796/159223/List%20for%20example.docx) to TinyMCE, then you will get plenty of garbage code: http://pastebin.com/7S43SQhC
If you apply PR and enable "clean up on paste" option, then when copying the same document to TinyMCE you will get this: http://pastebin.com/cwzE8Tqn
Tracker item
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33796&start=0