How does Atto work? | seems to be stripping out BS4 code

How does Atto work? | seems to be stripping out BS4 code

ved Derek Chirnside -
Antal besvarelser: 5

I've posted over here in the text editors forum, but got no reply: https://moodle.org/mod/forum/discuss.php?d=347847#p1403179

When I cut and paste any text (even a phrase) into Atto in some BS4 tabs (in WISWYG view) it instantly strips out some of the code vital to get the tabs working.

Under the hood, how does Atto work?  Does it not now know about some of the new BS4 stuff and removes it?

I'm not really a coder, not even a hacker.  I thought someone may have a suggestion.

What I want: Cut and paste the code into code view, then type/cut and paste in the panes in the other view.

-Derek

Gennemsnitsbedømmelse: -
I svar til Derek Chirnside

Re: How does Atto work? | seems to be stripping out BS4 code

ved Joost Elshoff -
Billede af Particularly helpful Moodlers Billede af Testers

I suppose your question has more to do with the overall HTML and CSS clean up policy than with the inner workings of the ATTO editor. I know Moodle cleans up any HTML and CSS from text, if it might conflict with site css or create other undesirable situations. It also seems to clean up styled and colored tables people created in Excel or Word, for the same reasons.

I svar til Joost Elshoff

Re: How does Atto work? | seems to be stripping out BS4 code

ved Derek Chirnside -

Joost, where is the 'cleanup policy'??

I note this in the tracker: https://tracker.moodle.org/browse/MDL-56557  (What is closed by deferred mean?)

I have created a tracker item today: https://tracker.moodle.org/browse/MDL-58084

-Derek

I svar til Derek Chirnside

Re: How does Atto work? | seems to be stripping out BS4 code

ved Derek Chirnside -

Joost, this is what I am seeing:


Any thoughts?  It seems to be cut and paste from another document that fails.  tYPING IS FINE.

-Derek

I svar til Derek Chirnside

Re: How does Atto work? | seems to be stripping out BS4 code

ved Mark Sharp -
Billede af Core developers Billede af Particularly helpful Moodlers Billede af Plugin developers

Thanks for posting up the video. That really helped.

So, when you paste into atto, it is expecting some kind of formatting to come along with it. e.g. Pasting from Word or from a website. It identifies it as such and does some clean up, then pastes your text from the clipboard. And, actually that works. If you paste from a website, you don't lose all your formatting.

However, if you try to be clean and paste from a text editor, the clipboard doesn't having any formatting information, so atto runs a function called fallbackPasteCleanup (you can see this in your browser console if you have the dev tools open - usually F12 opens that). This cleanup seems to be a little more rigourous and applies this._cleanPasteHTML to all the content rather than just the pasted content.

If you save your text content as a html page, then paste from that html page loaded in the browser, you don't get the issue you have there.

I'm adding this info to the tracker item you raised.

Gennemsnitsbedømmelse:Useful (1)