Skip to content

Word Paste Plugin

Users paste a lot from Word and Excel. Froala WYSIWYG HTML Editor cleans all the unnecessary code and makes the HTML just look good.


Plugin options:

wordAllowedStyleProps
Array -
The list of allowed CSS attributes to be used for tags when pasting from Word.
Default:
['font-family', 'font-size', 'background', 'color', 'width', 'text-align', 'vertical-align', 'background-color', 'padding', 'margin', 'height', 'margin-top', 'margin-left', 'margin-right', 'margin-bottom', 'text-decoration', 'font-weight', 'font-style', 'text-indent', 'border', 'border-.*']
wordDeniedAttrs
Array -
Attributes that are removed when pasting something into the rich text editor from Word.
Default:[]
wordDeniedTags
Array -
Tags that are removed together with their content when pasting something into the rich text editor from Word.
Default:[]
wordPasteModal
Boolean -
Show modal to choose if to keep or not styles pasted from Word. If set to false, the default action is to keep the formatting.
Default: true
wordPasteKeepFormatting
Boolean -
Choose the default action when wordPasteModal option is enabled.
Default: true

Plugin events:

paste.after ()
Triggered after pasting something into the Froala Rich Text Editor.
afterCleanup (clipboard_html)
Triggered after the content was pasted from the clipboard into the Froala Rich Text Editor and it was cleaned up. If a string is returned, the new string will be used as the pasted content.
● clipboard_html
A string with the pasted content after it was cleaned up.
paste.before (original_event)
Triggered before pasting something into the Froala Rich Text Editor.
Note: Returning false in the handler assigned to the event will cancel the current action.
● original_event
The jQuery event object for the paste event.
paste.beforeCleanup (clipboard_html)
Triggered after the content is pasted from the clipboard into the Froala Rich Text Editor. If a string is returned the new string will be used as the pasted content.
● clipboard_html
The clipboard pasted HTML.
paste.wordPaste (clipboard_html)
Triggered after the content is pasted from the MS Office into the Froala Rich Text Editor.
● clipboard_html
The clipboard pasted HTML.

Add Plugin to your code:

Plugin name: wordPaste

Plugin JS Script: ../js/plugins/word_paste.min.js

Or from CDN https://cdn.jsdelivr.net/npm/froala-editor@latest/js/plugins/word_paste.min.js

Plugin CSS link:

File: 15772