- Issue created by @zegmant
- πΊπ¦Ukraine zegmant
Adding new filters (e.g. for
) -- also no effect
- Status changed to Postponed: needs info
over 1 year ago 4:40pm 10 May 2023 - π¨π¦Canada star-szr
Hi, thanks for the report. We have automated tests running that show the core functionality works as expected: https://www.drupal.org/pift-ci-job/2659054 β
Can you please confirm that you're pasting into the visual editor, not the source editing view? Right now that's the only thing I can think of that would cause this behaviour.
Can you also check the JavaScript console in your browser after pasting to see if it reports any errors?
Do you have any other CKEditor 5 modules installed?
- π¨π¦Canada star-szr
If you can also please share the browser and browser version you are using that may be helpful.
- π«π·France jossensei
Hi,
Tested on Drupal 10, and I had the same result on Firefox.
Another test is Chromium was a success so I think it's an issue with the way Firefox handle paste. - π¨π¦Canada star-szr
This module was developed almost exclusively using Firefox so it should work fine there. If the same module configuration is not working consistently across browsers I would need browser version information, and specific reproduction steps so that I can see the bug happening.
If the paste filtering is not working, please upload your exported config YAML for the text format, or screenshot your filter settings (or at least the custom parts), and provide sample text which did not have any filtering applied after pasting?
Finally, CKEditor 5 wonβt work without JavaScript enabled, but it is somewhat possible that the JS from this module is being blocked, perhaps a browser extension is interfering in Firefox in @jossenseiβs case.
- Status changed to Active
over 1 year ago 5:24pm 12 July 2023 - π©πͺGermany Anybody Porta Westfalica
I can sadly also confirm this issue. Just installed the module and tested pasting some rich text from Word or Thunderbird and it's still added with style="xxx" tags, like
<p class="MsoNormal" style="text-autospace:none;">
I only tried in Firefox 115.0.1 (64-Bit) on Windows 11.
The project uses Drupal 10.1.1Can you please confirm that you're pasting into the visual editor, not the source editing view?
I can also confirm this.
- Status changed to Needs work
over 1 year ago 5:32pm 12 July 2023 - π©πͺGermany Anybody Porta Westfalica
Okay I think I found the reason.
const r = this.editor.config.get("pasteFilter"); console.log(r); if (!r) { console.warn('HIT!'); return; }
HIT!
is in the console when pasting code andconsole.log(r);
results infalse
, so the cleanup is never executed.pasteFilter is missing.
- π©πͺGermany Anybody Porta Westfalica
Setting priority to Major as it's proven by the console output that the module doesn't have any effect currently, at least in latest FF.
- π¨π¦Canada star-szr
@Anybody, can you please confirm that you configured and enabled paste filtering in your text format, similarly to what can be seen on the module's project page? A screenshot would be appreciated too. I know you were looking at the configuration form in another issue but in your reproduction steps you don't indicate that you have enabled the functionality from the text format form.
So far, I have not been able to reproduce this bug. As mentioned we have automated tests (running on Drupal 10.1.x) that prove that the module works. The only explanation I can think of at this point is that folks are not enabling the plugin on the text format config form.
If anyone can please provide detailed numbered steps to reproduce from a clean install of D9 or D10 that would be hugely appreciated, then I can hopefully get to the bottom of this and fix it.
- π©πͺGermany Anybody Porta Westfalica
Thanks for your quick reply @star-szr. Indeed I saw the tests and was wondering, what might be wrong. Perhaps it's a conflict with another module or ckeditor plugin?
The affected project is quite large. I'll try the module at simplytest.me tomorrow and compare results.Yes, it's definitely enabled, even though the option can easily be overlooked, I think, see π Hide filter fields when plugin not enabled Fixed
I think we'll find the reason, but if it's a conflict within ckeditor, it might be hard for me, because I don't know it very well.
- π¨π¦Canada star-szr
Thanks! That error you pasted earlier may be coming from another CKEditor 5 contrib, so it could be their bug causing this module to not work. I know CKEditor 5 has had a number of breaking changes and some contrib modules have had to release different versions for different core branches to maintain compatibility across multiple CKEditor 5 versions.
- Status changed to Closed: works as designed
over 1 year ago 7:54am 13 July 2023 - π©πͺGermany Anybody Porta Westfalica
Thanks @star-szr,
now after re-saving, clearing all caches etc., I can see this pasteFilter array in the console:
βpasteFilter: Array(14) [ {β¦}, {β¦}, {β¦}, β¦ ]βββ 0: Object { enabled: true, weight: -10, search: "<o:p><\\/o:p>", β¦ }βββ 1: Object { enabled: true, weight: -9, search: '(<[^>]*) (style="[^"]*")', β¦ }βββ 2: Object { enabled: true, weight: -8, search: '(<[^>]*) (face="[^"]*")', β¦ }βββ 3: Object { enabled: true, weight: -7, search: '(<[^>]*) (class="[^"]*")', β¦ } βββ4: Object { enabled: true, weight: -6, search: '(<[^>]*) (valign="[^"]*")', β¦ }βββ 5: Object { enabled: true, weight: -5, search: "<font[^>]*>", β¦ }βββ 6: Object { enabled: true, weight: -4, search: "<\\/font>", β¦ }βββ 7: Object { enabled: true, weight: -3, search: "<span[^>]*>", β¦ }βββ 8: Object { enabled: true, weight: -2, search: "<\\/span>", β¦ }βββ 9: Object { enabled: true, weight: -1, search: "<p> <\\/p>", β¦ }βββ 10: Object { enabled: true, weight: 0, search: "<p><\\/p>", β¦ }βββ 11: Object { enabled: true, weight: 1, search: "<b><\\/b>", β¦ } βββ12: Object { enabled: true, weight: 2, search: "<i><\\/i>", β¦ }βββ 13: Object { enabled: true, weight: 3, search: '<a name="OLE_LINK[^"]*">(.*?)<\\/a>', β¦ }βββ length: 14 βββ<prototype>: Array []
And the loop runs! And it WORKS!
I didn't uninstall or update any module, so this is really strange. I guess in most cases it's the UX that people forget to enable the setting. And perhaps that combined with browser or Drupal caching...
So let's close this works as designed. I'll reopen, if it should happen again or in another project.