To ensure we only clean style and classes, first we select the inside
of those attributes and "replace" them with handler functions. Those
functions scan the actual attribute values for class or styles that
we want to exclude.
The first level regex has 3 groups. group1 selects everything in the
tag leading up to the attribute values, group2 has the attributes,
group3 has the trailing quote mark. We work on group2 then return
the combination of group1, group2, and group3.
Browsers may not provide html content in the clipboard object event
though it will really be pasted as such. This includes Firefox on
Windows, Internet Explorer, and some niche cases in Safari.
Because of this, we need to scrub the entire editor anytime we can't
intercept a paste event.
In some magical day in the future when there is better cross browser
support, we can undo this.
Apply different, stricter, code cleanup when we receive HTML (WYSIWYG)
paste events, but be more lax the rest of the time.
Also, update the regexes to be more targeted for specific code patterns
pasted from office packages.
Old code failed to clean the editor div which resulted in
undesirable code being being left in the div for editing. To properly
handel incoming code, we should try to intercept and clean before the
paste, or clean the entire editable div.
The 'drop' event fires before the native ContentEditable drop handler, so
in order to update the underlying textarea we need to call updateOriginal
with a brief delay so that the dropped content has actually been added to
the editor.
Adds the ability to drag and drop images directly into Atto, uploading the image and embedding it
correctly. Contains fixes from 1.0.2, as well as a policy change - images dragged and dropped into
Atto now have role=presentation by default.
This reverts commit cb6e1d5270.
This reverts commit 7a5e605424, reversing
changes made to 7b9fb265d2.
This reverts commit 06404b0118, reversing
changes made to 0f87473fed.
Conflicts:
theme/bootstrapbase/style/moodle.css
Sadly, there is no easy way to do this. When a range is empty, we need to
create a new span, make the changes there, and then select it. Rangy does
not provide a helper to do this yet (will be in 1.3) so we have to do it
manually in the mean time.