2017-05-08 01:32:46 -04:00
( function ( ) {
2018-04-25 18:35:21 -04:00
var paste = ( function ( ) {
'use strict' ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var Cell = function ( initial ) {
var value = initial ;
var get = function ( ) {
return value ;
2017-09-26 17:15:47 -04:00
} ;
2018-04-25 18:35:21 -04:00
var set = function ( v ) {
value = v ;
2017-09-26 17:15:47 -04:00
} ;
2018-04-25 18:35:21 -04:00
var clone = function ( ) {
return Cell ( get ( ) ) ;
2017-09-26 17:15:47 -04:00
} ;
return {
2018-04-25 18:35:21 -04:00
get : get ,
set : set ,
clone : clone
2017-09-26 17:15:47 -04:00
} ;
2018-04-25 18:35:21 -04:00
} ;
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-28 18:53:15 -05:00
2018-04-25 18:35:21 -04:00
var global = tinymce . util . Tools . resolve ( 'tinymce.PluginManager' ) ;
2015-09-09 15:45:26 -04:00
2018-04-25 18:35:21 -04:00
var hasProPlugin = function ( editor ) {
if ( /(^|[ ,])powerpaste([, ]|$)/ . test ( editor . settings . plugins ) && global . get ( 'powerpaste' ) ) {
if ( typeof window . console !== 'undefined' && window . console . log ) {
window . console . log ( 'PowerPaste is incompatible with Paste plugin! Remove \'paste\' from the \'plugins\' option.' ) ;
}
return true ;
} else {
return false ;
}
} ;
2018-07-16 04:07:26 -04:00
var $ _15bf6siejjgwect1 = { hasProPlugin : hasProPlugin } ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var get = function ( clipboard , quirks ) {
return {
clipboard : clipboard ,
quirks : quirks
2017-05-08 01:32:46 -04:00
} ;
2018-04-25 18:35:21 -04:00
} ;
2018-07-16 04:07:26 -04:00
var $ _6gtliyigjjgwecte = { get : get } ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var firePastePreProcess = function ( editor , html , internal , isWordHtml ) {
return editor . fire ( 'PastePreProcess' , {
content : html ,
internal : internal ,
wordContent : isWordHtml
} ) ;
} ;
var firePastePostProcess = function ( editor , node , internal , isWordHtml ) {
return editor . fire ( 'PastePostProcess' , {
node : node ,
internal : internal ,
wordContent : isWordHtml
} ) ;
} ;
var firePastePlainTextToggle = function ( editor , state ) {
return editor . fire ( 'PastePlainTextToggle' , { state : state } ) ;
} ;
var firePaste = function ( editor , ieFake ) {
return editor . fire ( 'paste' , { ieFake : ieFake } ) ;
} ;
2018-07-16 04:07:26 -04:00
var $ _8tki3zijjjgwectj = {
2018-04-25 18:35:21 -04:00
firePastePreProcess : firePastePreProcess ,
firePastePostProcess : firePastePostProcess ,
firePastePlainTextToggle : firePastePlainTextToggle ,
firePaste : firePaste
} ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var shouldPlainTextInform = function ( editor ) {
return editor . getParam ( 'paste_plaintext_inform' , true ) ;
} ;
var shouldBlockDrop = function ( editor ) {
return editor . getParam ( 'paste_block_drop' , false ) ;
} ;
var shouldPasteDataImages = function ( editor ) {
return editor . getParam ( 'paste_data_images' , false ) ;
} ;
var shouldFilterDrop = function ( editor ) {
return editor . getParam ( 'paste_filter_drop' , true ) ;
} ;
var getPreProcess = function ( editor ) {
return editor . getParam ( 'paste_preprocess' ) ;
} ;
var getPostProcess = function ( editor ) {
return editor . getParam ( 'paste_postprocess' ) ;
} ;
var getWebkitStyles = function ( editor ) {
return editor . getParam ( 'paste_webkit_styles' ) ;
} ;
var shouldRemoveWebKitStyles = function ( editor ) {
return editor . getParam ( 'paste_remove_styles_if_webkit' , true ) ;
} ;
var shouldMergeFormats = function ( editor ) {
return editor . getParam ( 'paste_merge_formats' , true ) ;
} ;
var isSmartPasteEnabled = function ( editor ) {
return editor . getParam ( 'smart_paste' , true ) ;
} ;
var isPasteAsTextEnabled = function ( editor ) {
return editor . getParam ( 'paste_as_text' , false ) ;
} ;
var getRetainStyleProps = function ( editor ) {
return editor . getParam ( 'paste_retain_style_properties' ) ;
} ;
var getWordValidElements = function ( editor ) {
var defaultValidElements = '-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,' + '-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,' + 'td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody' ;
return editor . getParam ( 'paste_word_valid_elements' , defaultValidElements ) ;
} ;
var shouldConvertWordFakeLists = function ( editor ) {
return editor . getParam ( 'paste_convert_word_fake_lists' , true ) ;
} ;
var shouldUseDefaultFilters = function ( editor ) {
return editor . getParam ( 'paste_enable_default_filters' , true ) ;
} ;
2018-07-16 04:07:26 -04:00
var $ _xr8b0ikjjgwectl = {
2018-04-25 18:35:21 -04:00
shouldPlainTextInform : shouldPlainTextInform ,
shouldBlockDrop : shouldBlockDrop ,
shouldPasteDataImages : shouldPasteDataImages ,
shouldFilterDrop : shouldFilterDrop ,
getPreProcess : getPreProcess ,
getPostProcess : getPostProcess ,
getWebkitStyles : getWebkitStyles ,
shouldRemoveWebKitStyles : shouldRemoveWebKitStyles ,
shouldMergeFormats : shouldMergeFormats ,
isSmartPasteEnabled : isSmartPasteEnabled ,
isPasteAsTextEnabled : isPasteAsTextEnabled ,
getRetainStyleProps : getRetainStyleProps ,
getWordValidElements : getWordValidElements ,
shouldConvertWordFakeLists : shouldConvertWordFakeLists ,
shouldUseDefaultFilters : shouldUseDefaultFilters
} ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var shouldInformUserAboutPlainText = function ( editor , userIsInformedState ) {
2018-07-16 04:07:26 -04:00
return userIsInformedState . get ( ) === false && $ _xr8b0ikjjgwectl . shouldPlainTextInform ( editor ) ;
2018-04-25 18:35:21 -04:00
} ;
var displayNotification = function ( editor , message ) {
editor . notificationManager . open ( {
text : editor . translate ( message ) ,
type : 'info'
} ) ;
} ;
var togglePlainTextPaste = function ( editor , clipboard , userIsInformedState ) {
if ( clipboard . pasteFormat . get ( ) === 'text' ) {
clipboard . pasteFormat . set ( 'html' ) ;
2018-07-16 04:07:26 -04:00
$ _8tki3zijjjgwectj . firePastePlainTextToggle ( editor , false ) ;
2018-04-25 18:35:21 -04:00
} else {
clipboard . pasteFormat . set ( 'text' ) ;
2018-07-16 04:07:26 -04:00
$ _8tki3zijjjgwectj . firePastePlainTextToggle ( editor , true ) ;
2018-04-25 18:35:21 -04:00
if ( shouldInformUserAboutPlainText ( editor , userIsInformedState ) ) {
displayNotification ( editor , 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.' ) ;
userIsInformedState . set ( true ) ;
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
}
editor . focus ( ) ;
} ;
2018-07-16 04:07:26 -04:00
var $ _2j7vw7iijjgwecti = { togglePlainTextPaste : togglePlainTextPaste } ;
2015-09-09 15:45:26 -04:00
2018-04-25 18:35:21 -04:00
var register = function ( editor , clipboard , userIsInformedState ) {
editor . addCommand ( 'mceTogglePlainTextPaste' , function ( ) {
2018-07-16 04:07:26 -04:00
$ _2j7vw7iijjgwecti . togglePlainTextPaste ( editor , clipboard , userIsInformedState ) ;
2018-04-25 18:35:21 -04:00
} ) ;
editor . addCommand ( 'mceInsertClipboardContent' , function ( ui , value ) {
if ( value . content ) {
clipboard . pasteHtml ( value . content , value . internal ) ;
}
if ( value . text ) {
clipboard . pasteText ( value . text ) ;
}
} ) ;
} ;
2018-07-16 04:07:26 -04:00
var $ _fldd1mihjjgwecth = { register : register } ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var global$1 = tinymce . util . Tools . resolve ( 'tinymce.Env' ) ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var global$2 = tinymce . util . Tools . resolve ( 'tinymce.util.Delay' ) ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var global$3 = tinymce . util . Tools . resolve ( 'tinymce.util.Tools' ) ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var global$4 = tinymce . util . Tools . resolve ( 'tinymce.util.VK' ) ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var internalMimeType = 'x-tinymce/html' ;
var internalMark = '<!-- ' + internalMimeType + ' -->' ;
var mark = function ( html ) {
return internalMark + html ;
} ;
var unmark = function ( html ) {
return html . replace ( internalMark , '' ) ;
} ;
var isMarked = function ( html ) {
return html . indexOf ( internalMark ) !== - 1 ;
} ;
2018-07-16 04:07:26 -04:00
var $ _4x13hjirjjgwecu1 = {
2018-04-25 18:35:21 -04:00
mark : mark ,
unmark : unmark ,
isMarked : isMarked ,
internalHtmlMime : function ( ) {
return internalMimeType ;
}
} ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var global$5 = tinymce . util . Tools . resolve ( 'tinymce.html.Entities' ) ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var isPlainText = function ( text ) {
return ! /<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i . test ( text ) ;
} ;
var toBRs = function ( text ) {
return text . replace ( /\r?\n/g , '<br>' ) ;
} ;
var openContainer = function ( rootTag , rootAttrs ) {
var key ;
var attrs = [ ] ;
var tag = '<' + rootTag ;
if ( typeof rootAttrs === 'object' ) {
for ( key in rootAttrs ) {
if ( rootAttrs . hasOwnProperty ( key ) ) {
attrs . push ( key + '="' + global$5 . encodeAllRaw ( rootAttrs [ key ] ) + '"' ) ;
2017-05-08 01:32:46 -04:00
}
}
2018-04-25 18:35:21 -04:00
if ( attrs . length ) {
tag += ' ' + attrs . join ( ' ' ) ;
}
}
return tag + '>' ;
} ;
var toBlockElements = function ( text , rootTag , rootAttrs ) {
var blocks = text . split ( /\n\n/ ) ;
var tagOpen = openContainer ( rootTag , rootAttrs ) ;
var tagClose = '</' + rootTag + '>' ;
var paragraphs = global$3 . map ( blocks , function ( p ) {
return p . split ( /\n/ ) . join ( '<br />' ) ;
} ) ;
var stitch = function ( p ) {
return tagOpen + p + tagClose ;
2017-09-26 17:15:47 -04:00
} ;
2018-04-25 18:35:21 -04:00
return paragraphs . length === 1 ? paragraphs [ 0 ] : global$3 . map ( paragraphs , stitch ) . join ( '' ) ;
} ;
var convert = function ( text , rootTag , rootAttrs ) {
return rootTag ? toBlockElements ( text , rootTag , rootAttrs ) : toBRs ( text ) ;
} ;
2018-07-16 04:07:26 -04:00
var $ _4h3hnrisjjgwecu2 = {
2018-04-25 18:35:21 -04:00
isPlainText : isPlainText ,
convert : convert ,
toBRs : toBRs ,
toBlockElements : toBlockElements
} ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var global$6 = tinymce . util . Tools . resolve ( 'tinymce.html.DomParser' ) ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var global$7 = tinymce . util . Tools . resolve ( 'tinymce.html.Node' ) ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var global$8 = tinymce . util . Tools . resolve ( 'tinymce.html.Schema' ) ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var global$9 = tinymce . util . Tools . resolve ( 'tinymce.html.Serializer' ) ;
2017-09-26 17:15:47 -04:00
2018-04-25 18:35:21 -04:00
function filter ( content , items ) {
global$3 . each ( items , function ( v ) {
if ( v . constructor === RegExp ) {
content = content . replace ( v , '' ) ;
} else {
content = content . replace ( v [ 0 ] , v [ 1 ] ) ;
}
} ) ;
return content ;
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
function innerText ( html ) {
var schema = global$8 ( ) ;
var domParser = global$6 ( { } , schema ) ;
var text = '' ;
var shortEndedElements = schema . getShortEndedElements ( ) ;
var ignoreElements = global$3 . makeMap ( 'script noscript style textarea video audio iframe object' , ' ' ) ;
var blockElements = schema . getBlockElements ( ) ;
function walk ( node ) {
2018-07-16 04:07:26 -04:00
var name$$1 = node . name , currentNode = node ;
if ( name$$1 === 'br' ) {
2018-04-25 18:35:21 -04:00
text += '\n' ;
return ;
}
2018-07-16 04:07:26 -04:00
if ( shortEndedElements [ name$$1 ] ) {
2018-04-25 18:35:21 -04:00
text += ' ' ;
}
2018-07-16 04:07:26 -04:00
if ( ignoreElements [ name$$1 ] ) {
2018-04-25 18:35:21 -04:00
text += ' ' ;
return ;
}
if ( node . type === 3 ) {
text += node . value ;
}
if ( ! node . shortEnded ) {
if ( node = node . firstChild ) {
do {
walk ( node ) ;
} while ( node = node . next ) ;
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
}
2018-07-16 04:07:26 -04:00
if ( blockElements [ name$$1 ] && currentNode . next ) {
2018-04-25 18:35:21 -04:00
text += '\n' ;
2018-07-16 04:07:26 -04:00
if ( name$$1 === 'p' ) {
2018-04-25 18:35:21 -04:00
text += '\n' ;
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
}
}
html = filter ( html , [ /<!\[[^\]]+\]>/g ] ) ;
walk ( domParser . parse ( html ) ) ;
return text ;
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
function trimHtml ( html ) {
function trimSpaces ( all , s1 , s2 ) {
if ( ! s1 && ! s2 ) {
return ' ' ;
}
return '\xA0' ;
}
html = filter ( html , [
/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/ig ,
/<!--StartFragment-->|<!--EndFragment-->/g ,
[
/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g ,
trimSpaces
] ,
/<br class="Apple-interchange-newline">/g ,
/<br>$/i
] ) ;
return html ;
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
function createIdGenerator ( prefix ) {
var count = 0 ;
return function ( ) {
return prefix + count ++ ;
} ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
var isMsEdge = function ( ) {
return navigator . userAgent . indexOf ( ' Edge/' ) !== - 1 ;
} ;
2018-07-16 04:07:26 -04:00
var $ _4bi2o9j0jjgwecui = {
2018-04-25 18:35:21 -04:00
filter : filter ,
innerText : innerText ,
trimHtml : trimHtml ,
createIdGenerator : createIdGenerator ,
isMsEdge : isMsEdge
} ;
2017-09-26 17:15:47 -04:00
2018-04-25 18:35:21 -04:00
function isWordContent ( content ) {
return /<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i . test ( content ) || /class="OutlineElement/ . test ( content ) || /id="?docs\-internal\-guid\-/ . test ( content ) ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
function isNumericList ( text ) {
var found , patterns ;
patterns = [
/^[IVXLMCD]{1,2}\.[ \u00a0]/ ,
/^[ivxlmcd]{1,2}\.[ \u00a0]/ ,
/^[a-z]{1,2}[\.\)][ \u00a0]/ ,
/^[A-Z]{1,2}[\.\)][ \u00a0]/ ,
/^[0-9]+\.[ \u00a0]/ ,
/^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/ ,
/^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/
] ;
text = text . replace ( /^[\u00a0 ]+/ , '' ) ;
global$3 . each ( patterns , function ( pattern ) {
if ( pattern . test ( text ) ) {
found = true ;
return false ;
}
} ) ;
return found ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
function isBulletList ( text ) {
return /^[\s\u00a0]*[\u2022\u00b7\u00a7\u25CF]\s*/ . test ( text ) ;
}
function convertFakeListsToProperLists ( node ) {
var currentListNode , prevListNode , lastLevel = 1 ;
function getText ( node ) {
var txt = '' ;
if ( node . type === 3 ) {
return node . value ;
}
if ( node = node . firstChild ) {
do {
txt += getText ( node ) ;
} while ( node = node . next ) ;
}
return txt ;
}
function trimListStart ( node , regExp ) {
if ( node . type === 3 ) {
if ( regExp . test ( node . value ) ) {
node . value = node . value . replace ( regExp , '' ) ;
return false ;
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
}
if ( node = node . firstChild ) {
do {
if ( ! trimListStart ( node , regExp ) ) {
return false ;
}
} while ( node = node . next ) ;
}
return true ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
function removeIgnoredNodes ( node ) {
if ( node . _listIgnore ) {
node . remove ( ) ;
return ;
}
if ( node = node . firstChild ) {
do {
removeIgnoredNodes ( node ) ;
} while ( node = node . next ) ;
}
}
function convertParagraphToLi ( paragraphNode , listName , start ) {
var level = paragraphNode . _listLevel || lastLevel ;
if ( level !== lastLevel ) {
if ( level < lastLevel ) {
if ( currentListNode ) {
currentListNode = currentListNode . parent . parent ;
}
} else {
prevListNode = currentListNode ;
currentListNode = null ;
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
}
if ( ! currentListNode || currentListNode . name !== listName ) {
prevListNode = prevListNode || currentListNode ;
currentListNode = new global$7 ( listName , 1 ) ;
if ( start > 1 ) {
currentListNode . attr ( 'start' , '' + start ) ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
paragraphNode . wrap ( currentListNode ) ;
} else {
currentListNode . append ( paragraphNode ) ;
}
paragraphNode . name = 'li' ;
if ( level > lastLevel && prevListNode ) {
prevListNode . lastChild . append ( currentListNode ) ;
}
lastLevel = level ;
removeIgnoredNodes ( paragraphNode ) ;
trimListStart ( paragraphNode , /^\u00a0+/ ) ;
trimListStart ( paragraphNode , /^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/ ) ;
trimListStart ( paragraphNode , /^\u00a0+/ ) ;
}
var elements = [ ] ;
var child = node . firstChild ;
while ( typeof child !== 'undefined' && child !== null ) {
elements . push ( child ) ;
child = child . walk ( ) ;
if ( child !== null ) {
while ( typeof child !== 'undefined' && child . parent !== node ) {
child = child . walk ( ) ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
}
}
for ( var i = 0 ; i < elements . length ; i ++ ) {
node = elements [ i ] ;
if ( node . name === 'p' && node . firstChild ) {
var nodeText = getText ( node ) ;
if ( isBulletList ( nodeText ) ) {
convertParagraphToLi ( node , 'ul' ) ;
continue ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
if ( isNumericList ( nodeText ) ) {
var matches = /([0-9]+)\./ . exec ( nodeText ) ;
var start = 1 ;
if ( matches ) {
start = parseInt ( matches [ 1 ] , 10 ) ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
convertParagraphToLi ( node , 'ol' , start ) ;
continue ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
if ( node . _listLevel ) {
convertParagraphToLi ( node , 'ul' , 1 ) ;
continue ;
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
currentListNode = null ;
} else {
prevListNode = currentListNode ;
currentListNode = null ;
2017-09-26 17:15:47 -04:00
}
}
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
function filterStyles ( editor , validStyles , node , styleValue ) {
var outputStyles = { } , matches ;
var styles = editor . dom . parseStyle ( styleValue ) ;
global$3 . each ( styles , function ( value , name ) {
switch ( name ) {
case 'mso-list' :
matches = /\w+ \w+([0-9]+)/i . exec ( styleValue ) ;
if ( matches ) {
node . _listLevel = parseInt ( matches [ 1 ] , 10 ) ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
if ( /Ignore/i . test ( value ) && node . firstChild ) {
node . _listIgnore = true ;
node . firstChild . _listIgnore = true ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
break ;
case 'horiz-align' :
name = 'text-align' ;
break ;
case 'vert-align' :
name = 'vertical-align' ;
break ;
case 'font-color' :
case 'mso-foreground' :
name = 'color' ;
break ;
case 'mso-background' :
case 'mso-highlight' :
name = 'background' ;
break ;
case 'font-weight' :
case 'font-style' :
if ( value !== 'normal' ) {
outputStyles [ name ] = value ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
return ;
case 'mso-element' :
if ( /^(comment|comment-list)$/i . test ( value ) ) {
2017-09-26 17:15:47 -04:00
node . remove ( ) ;
return ;
}
2018-04-25 18:35:21 -04:00
break ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
if ( name . indexOf ( 'mso-comment' ) === 0 ) {
node . remove ( ) ;
return ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
if ( name . indexOf ( 'mso-' ) === 0 ) {
return ;
2017-09-26 17:15:47 -04:00
}
2018-07-16 04:07:26 -04:00
if ( $ _xr8b0ikjjgwectl . getRetainStyleProps ( editor ) === 'all' || validStyles && validStyles [ name ] ) {
2018-04-25 18:35:21 -04:00
outputStyles [ name ] = value ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
} ) ;
if ( /(bold)/i . test ( outputStyles [ 'font-weight' ] ) ) {
delete outputStyles [ 'font-weight' ] ;
node . wrap ( new global$7 ( 'b' , 1 ) ) ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
if ( /(italic)/i . test ( outputStyles [ 'font-style' ] ) ) {
delete outputStyles [ 'font-style' ] ;
node . wrap ( new global$7 ( 'i' , 1 ) ) ;
}
outputStyles = editor . dom . serializeStyle ( outputStyles , node . name ) ;
if ( outputStyles ) {
return outputStyles ;
}
return null ;
}
var filterWordContent = function ( editor , content ) {
var retainStyleProperties , validStyles ;
2018-07-16 04:07:26 -04:00
retainStyleProperties = $ _xr8b0ikjjgwectl . getRetainStyleProps ( editor ) ;
2018-04-25 18:35:21 -04:00
if ( retainStyleProperties ) {
validStyles = global$3 . makeMap ( retainStyleProperties . split ( /[, ]/ ) ) ;
}
2018-07-16 04:07:26 -04:00
content = $ _4bi2o9j0jjgwecui . filter ( content , [
2018-04-25 18:35:21 -04:00
/<br class="?Apple-interchange-newline"?>/gi ,
/<b[^>]+id="?docs-internal-[^>]*>/gi ,
/<!--[\s\S]+?-->/gi ,
/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi ,
[
/<(\/?)s>/gi ,
'<$1strike>'
] ,
[
/ /gi ,
'\xA0'
] ,
[
/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi ,
function ( str , spaces ) {
return spaces . length > 0 ? spaces . replace ( /./ , ' ' ) . slice ( Math . floor ( spaces . length / 2 ) ) . split ( '' ) . join ( '\xA0' ) : '' ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
]
] ) ;
2018-07-16 04:07:26 -04:00
var validElements = $ _xr8b0ikjjgwectl . getWordValidElements ( editor ) ;
2018-04-25 18:35:21 -04:00
var schema = global$8 ( {
valid _elements : validElements ,
valid _children : '-li[p]'
} ) ;
global$3 . each ( schema . elements , function ( rule ) {
if ( ! rule . attributes . class ) {
rule . attributes . class = { } ;
rule . attributesOrder . push ( 'class' ) ;
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
if ( ! rule . attributes . style ) {
rule . attributes . style = { } ;
rule . attributesOrder . push ( 'style' ) ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
} ) ;
var domParser = global$6 ( { } , schema ) ;
domParser . addAttributeFilter ( 'style' , function ( nodes ) {
var i = nodes . length , node ;
while ( i -- ) {
node = nodes [ i ] ;
node . attr ( 'style' , filterStyles ( editor , validStyles , node , node . attr ( 'style' ) ) ) ;
if ( node . name === 'span' && node . parent && ! node . attributes . length ) {
node . unwrap ( ) ;
}
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
} ) ;
domParser . addAttributeFilter ( 'class' , function ( nodes ) {
var i = nodes . length , node , className ;
while ( i -- ) {
node = nodes [ i ] ;
className = node . attr ( 'class' ) ;
if ( /^(MsoCommentReference|MsoCommentText|msoDel)$/i . test ( className ) ) {
node . remove ( ) ;
}
node . attr ( 'class' , null ) ;
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
} ) ;
domParser . addNodeFilter ( 'del' , function ( nodes ) {
var i = nodes . length ;
while ( i -- ) {
nodes [ i ] . remove ( ) ;
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
} ) ;
domParser . addNodeFilter ( 'a' , function ( nodes ) {
var i = nodes . length , node , href , name ;
while ( i -- ) {
node = nodes [ i ] ;
href = node . attr ( 'href' ) ;
name = node . attr ( 'name' ) ;
if ( href && href . indexOf ( '#_msocom_' ) !== - 1 ) {
node . remove ( ) ;
continue ;
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
if ( href && href . indexOf ( 'file://' ) === 0 ) {
href = href . split ( '#' ) [ 1 ] ;
if ( href ) {
href = '#' + href ;
2017-05-08 01:32:46 -04:00
}
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
if ( ! href && ! name ) {
node . unwrap ( ) ;
} else {
if ( name && ! /^_?(?:toc|edn|ftn)/i . test ( name ) ) {
2017-09-26 17:15:47 -04:00
node . unwrap ( ) ;
2018-04-25 18:35:21 -04:00
continue ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
node . attr ( {
href : href ,
name : name
} ) ;
2017-05-08 01:32:46 -04:00
}
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
} ) ;
var rootNode = domParser . parse ( content ) ;
2018-07-16 04:07:26 -04:00
if ( $ _xr8b0ikjjgwectl . shouldConvertWordFakeLists ( editor ) ) {
2018-04-25 18:35:21 -04:00
convertFakeListsToProperLists ( rootNode ) ;
}
content = global$9 ( { validate : editor . settings . validate } , schema ) . serialize ( rootNode ) ;
return content ;
} ;
var preProcess = function ( editor , content ) {
2018-07-16 04:07:26 -04:00
return $ _xr8b0ikjjgwectl . shouldUseDefaultFilters ( editor ) ? filterWordContent ( editor , content ) : content ;
2018-04-25 18:35:21 -04:00
} ;
2018-07-16 04:07:26 -04:00
var $ _dfatuiivjjgwecu8 = {
2018-04-25 18:35:21 -04:00
preProcess : preProcess ,
isWordContent : isWordContent
} ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var processResult = function ( content , cancelled ) {
2017-09-26 17:15:47 -04:00
return {
2018-04-25 18:35:21 -04:00
content : content ,
cancelled : cancelled
2017-09-26 17:15:47 -04:00
} ;
2018-04-25 18:35:21 -04:00
} ;
var postProcessFilter = function ( editor , html , internal , isWordHtml ) {
var tempBody = editor . dom . create ( 'div' , { style : 'display:none' } , html ) ;
2018-07-16 04:07:26 -04:00
var postProcessArgs = $ _8tki3zijjjgwectj . firePastePostProcess ( editor , tempBody , internal , isWordHtml ) ;
2018-04-25 18:35:21 -04:00
return processResult ( postProcessArgs . node . innerHTML , postProcessArgs . isDefaultPrevented ( ) ) ;
} ;
var filterContent = function ( editor , content , internal , isWordHtml ) {
2018-07-16 04:07:26 -04:00
var preProcessArgs = $ _8tki3zijjjgwectj . firePastePreProcess ( editor , content , internal , isWordHtml ) ;
2018-04-25 18:35:21 -04:00
if ( editor . hasEventListeners ( 'PastePostProcess' ) && ! preProcessArgs . isDefaultPrevented ( ) ) {
return postProcessFilter ( editor , preProcessArgs . content , internal , isWordHtml ) ;
} else {
return processResult ( preProcessArgs . content , preProcessArgs . isDefaultPrevented ( ) ) ;
}
} ;
var process = function ( editor , html , internal ) {
2018-07-16 04:07:26 -04:00
var isWordHtml = $ _dfatuiivjjgwecu8 . isWordContent ( html ) ;
var content = isWordHtml ? $ _dfatuiivjjgwecu8 . preProcess ( editor , html ) : html ;
2018-04-25 18:35:21 -04:00
return filterContent ( editor , content , internal , isWordHtml ) ;
} ;
2018-07-16 04:07:26 -04:00
var $ _3scw66iujjgwecu4 = { process : process } ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var pasteHtml = function ( editor , html ) {
editor . insertContent ( html , {
2018-07-16 04:07:26 -04:00
merge : $ _xr8b0ikjjgwectl . shouldMergeFormats ( editor ) ,
2018-04-25 18:35:21 -04:00
paste : true
} ) ;
return true ;
} ;
var isAbsoluteUrl = function ( url ) {
return /^https?:\/\/[\w\?\-\/+=.&%@~#]+$/i . test ( url ) ;
} ;
var isImageUrl = function ( url ) {
return isAbsoluteUrl ( url ) && /.(gif|jpe?g|png)$/ . test ( url ) ;
} ;
var createImage = function ( editor , url , pasteHtmlFn ) {
editor . undoManager . extra ( function ( ) {
pasteHtmlFn ( editor , url ) ;
} , function ( ) {
editor . insertContent ( '<img src="' + url + '">' ) ;
} ) ;
return true ;
} ;
var createLink = function ( editor , url , pasteHtmlFn ) {
editor . undoManager . extra ( function ( ) {
pasteHtmlFn ( editor , url ) ;
} , function ( ) {
editor . execCommand ( 'mceInsertLink' , false , url ) ;
} ) ;
return true ;
} ;
var linkSelection = function ( editor , html , pasteHtmlFn ) {
return editor . selection . isCollapsed ( ) === false && isAbsoluteUrl ( html ) ? createLink ( editor , html , pasteHtmlFn ) : false ;
} ;
var insertImage = function ( editor , html , pasteHtmlFn ) {
return isImageUrl ( html ) ? createImage ( editor , html , pasteHtmlFn ) : false ;
} ;
var smartInsertContent = function ( editor , html ) {
global$3 . each ( [
linkSelection ,
insertImage ,
pasteHtml
] , function ( action ) {
return action ( editor , html , pasteHtml ) !== true ;
} ) ;
} ;
var insertContent = function ( editor , html ) {
2018-07-16 04:07:26 -04:00
if ( $ _xr8b0ikjjgwectl . isSmartPasteEnabled ( editor ) === false ) {
2018-04-25 18:35:21 -04:00
pasteHtml ( editor , html ) ;
} else {
smartInsertContent ( editor , html ) ;
}
} ;
2018-07-16 04:07:26 -04:00
var $ _d8pzpej1jjgwecum = {
2018-04-25 18:35:21 -04:00
isImageUrl : isImageUrl ,
isAbsoluteUrl : isAbsoluteUrl ,
insertContent : insertContent
} ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var pasteHtml$1 = function ( editor , html , internalFlag ) {
2018-07-16 04:07:26 -04:00
var internal = internalFlag ? internalFlag : $ _4x13hjirjjgwecu1 . isMarked ( html ) ;
var args = $ _3scw66iujjgwecu4 . process ( editor , $ _4x13hjirjjgwecu1 . unmark ( html ) , internal ) ;
2018-04-25 18:35:21 -04:00
if ( args . cancelled === false ) {
2018-07-16 04:07:26 -04:00
$ _d8pzpej1jjgwecum . insertContent ( editor , args . content ) ;
2018-04-25 18:35:21 -04:00
}
} ;
var pasteText = function ( editor , text ) {
text = editor . dom . encode ( text ) . replace ( /\r\n/g , '\n' ) ;
2018-07-16 04:07:26 -04:00
text = $ _4h3hnrisjjgwecu2 . convert ( text , editor . settings . forced _root _block , editor . settings . forced _root _block _attrs ) ;
2018-04-25 18:35:21 -04:00
pasteHtml$1 ( editor , text , false ) ;
} ;
var getDataTransferItems = function ( dataTransfer ) {
var items = { } ;
var mceInternalUrlPrefix = 'data:text/mce-internal,' ;
if ( dataTransfer ) {
if ( dataTransfer . getData ) {
var legacyText = dataTransfer . getData ( 'Text' ) ;
if ( legacyText && legacyText . length > 0 ) {
if ( legacyText . indexOf ( mceInternalUrlPrefix ) === - 1 ) {
items [ 'text/plain' ] = legacyText ;
}
2017-09-26 17:15:47 -04:00
}
}
2018-04-25 18:35:21 -04:00
if ( dataTransfer . types ) {
for ( var i = 0 ; i < dataTransfer . types . length ; i ++ ) {
var contentType = dataTransfer . types [ i ] ;
try {
items [ contentType ] = dataTransfer . getData ( contentType ) ;
} catch ( ex ) {
items [ contentType ] = '' ;
2017-09-26 17:15:47 -04:00
}
}
}
2018-04-25 18:35:21 -04:00
}
return items ;
} ;
var getClipboardContent = function ( editor , clipboardEvent ) {
var content = getDataTransferItems ( clipboardEvent . clipboardData || editor . getDoc ( ) . dataTransfer ) ;
2018-07-16 04:07:26 -04:00
return $ _4bi2o9j0jjgwecui . isMsEdge ( ) ? global$3 . extend ( content , { 'text/html' : '' } ) : content ;
2018-04-25 18:35:21 -04:00
} ;
var hasContentType = function ( clipboardContent , mimeType ) {
return mimeType in clipboardContent && clipboardContent [ mimeType ] . length > 0 ;
} ;
var hasHtmlOrText = function ( content ) {
return hasContentType ( content , 'text/html' ) || hasContentType ( content , 'text/plain' ) ;
} ;
var getBase64FromUri = function ( uri ) {
var idx ;
idx = uri . indexOf ( ',' ) ;
if ( idx !== - 1 ) {
return uri . substr ( idx + 1 ) ;
}
return null ;
} ;
var isValidDataUriImage = function ( settings , imgElm ) {
return settings . images _dataimg _filter ? settings . images _dataimg _filter ( imgElm ) : true ;
} ;
var extractFilename = function ( editor , str ) {
var m = str . match ( /([\s\S]+?)\.(?:jpeg|jpg|png|gif)$/i ) ;
return m ? editor . dom . encode ( m [ 1 ] ) : null ;
} ;
2018-07-16 04:07:26 -04:00
var uniqueId = $ _4bi2o9j0jjgwecui . createIdGenerator ( 'mceclip' ) ;
2018-04-25 18:35:21 -04:00
var pasteImage = function ( editor , rng , reader , blob ) {
if ( rng ) {
editor . selection . setRng ( rng ) ;
rng = null ;
}
var dataUri = reader . result ;
var base64 = getBase64FromUri ( dataUri ) ;
var id = uniqueId ( ) ;
2018-07-16 04:07:26 -04:00
var name$$1 = editor . settings . images _reuse _filename && blob . name ? extractFilename ( editor , blob . name ) : id ;
2018-04-25 18:35:21 -04:00
var img = new Image ( ) ;
img . src = dataUri ;
if ( isValidDataUriImage ( editor . settings , img ) ) {
var blobCache = editor . editorUpload . blobCache ;
var blobInfo = void 0 , existingBlobInfo = void 0 ;
existingBlobInfo = blobCache . findFirst ( function ( cachedBlobInfo ) {
return cachedBlobInfo . base64 ( ) === base64 ;
} ) ;
if ( ! existingBlobInfo ) {
2018-07-16 04:07:26 -04:00
blobInfo = blobCache . create ( id , blob , base64 , name$$1 ) ;
2018-04-25 18:35:21 -04:00
blobCache . add ( blobInfo ) ;
} else {
blobInfo = existingBlobInfo ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
pasteHtml$1 ( editor , '<img src="' + blobInfo . blobUri ( ) + '">' , false ) ;
} else {
pasteHtml$1 ( editor , '<img src="' + dataUri + '">' , false ) ;
}
} ;
2018-07-16 04:07:26 -04:00
var isClipboardEvent = function ( event$$1 ) {
return event$$1 . type === 'paste' ;
2018-04-25 18:35:21 -04:00
} ;
var pasteImageData = function ( editor , e , rng ) {
var dataTransfer = isClipboardEvent ( e ) ? e . clipboardData : e . dataTransfer ;
function processItems ( items ) {
var i , item , reader , hadImage = false ;
if ( items ) {
for ( i = 0 ; i < items . length ; i ++ ) {
item = items [ i ] ;
if ( /^image\/(jpeg|png|gif|bmp)$/ . test ( item . type ) ) {
var blob = item . getAsFile ? item . getAsFile ( ) : item ;
reader = new window . FileReader ( ) ;
reader . onload = pasteImage . bind ( null , editor , rng , reader , blob ) ;
reader . readAsDataURL ( blob ) ;
e . preventDefault ( ) ;
hadImage = true ;
}
2017-09-26 17:15:47 -04:00
}
}
2018-04-25 18:35:21 -04:00
return hadImage ;
}
if ( editor . settings . paste _data _images && dataTransfer ) {
return processItems ( dataTransfer . items ) || processItems ( dataTransfer . files ) ;
}
} ;
var isBrokenAndroidClipboardEvent = function ( e ) {
var clipboardData = e . clipboardData ;
return navigator . userAgent . indexOf ( 'Android' ) !== - 1 && clipboardData && clipboardData . items && clipboardData . items . length === 0 ;
} ;
var isKeyboardPasteEvent = function ( e ) {
return global$4 . metaKeyPressed ( e ) && e . keyCode === 86 || e . shiftKey && e . keyCode === 45 ;
} ;
var registerEventHandlers = function ( editor , pasteBin , pasteFormat ) {
var keyboardPasteTimeStamp = 0 ;
var keyboardPastePlainTextState ;
editor . on ( 'keydown' , function ( e ) {
function removePasteBinOnKeyUp ( e ) {
if ( isKeyboardPasteEvent ( e ) && ! e . isDefaultPrevented ( ) ) {
pasteBin . remove ( ) ;
2017-05-08 01:32:46 -04:00
}
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
if ( isKeyboardPasteEvent ( e ) && ! e . isDefaultPrevented ( ) ) {
keyboardPastePlainTextState = e . shiftKey && e . keyCode === 86 ;
if ( keyboardPastePlainTextState && global$1 . webkit && navigator . userAgent . indexOf ( 'Version/' ) !== - 1 ) {
return ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
e . stopImmediatePropagation ( ) ;
keyboardPasteTimeStamp = new Date ( ) . getTime ( ) ;
if ( global$1 . ie && keyboardPastePlainTextState ) {
e . preventDefault ( ) ;
2018-07-16 04:07:26 -04:00
$ _8tki3zijjjgwectj . firePaste ( editor , true ) ;
2018-04-25 18:35:21 -04:00
return ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
pasteBin . remove ( ) ;
pasteBin . create ( ) ;
editor . once ( 'keyup' , removePasteBinOnKeyUp ) ;
editor . once ( 'paste' , function ( ) {
editor . off ( 'keyup' , removePasteBinOnKeyUp ) ;
} ) ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
} ) ;
function insertClipboardContent ( clipboardContent , isKeyBoardPaste , plainTextMode , internal ) {
var content , isPlainTextHtml ;
if ( hasContentType ( clipboardContent , 'text/html' ) ) {
content = clipboardContent [ 'text/html' ] ;
} else {
content = pasteBin . getHtml ( ) ;
2018-07-16 04:07:26 -04:00
internal = internal ? internal : $ _4x13hjirjjgwecu1 . isMarked ( content ) ;
2018-04-25 18:35:21 -04:00
if ( pasteBin . isDefaultContent ( content ) ) {
plainTextMode = true ;
}
2017-09-26 17:15:47 -04:00
}
2018-07-16 04:07:26 -04:00
content = $ _4bi2o9j0jjgwecui . trimHtml ( content ) ;
2018-04-25 18:35:21 -04:00
pasteBin . remove ( ) ;
2018-07-16 04:07:26 -04:00
isPlainTextHtml = internal === false && $ _4h3hnrisjjgwecu2 . isPlainText ( content ) ;
2018-04-25 18:35:21 -04:00
if ( ! content . length || isPlainTextHtml ) {
plainTextMode = true ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
if ( plainTextMode ) {
if ( hasContentType ( clipboardContent , 'text/plain' ) && isPlainTextHtml ) {
content = clipboardContent [ 'text/plain' ] ;
} else {
2018-07-16 04:07:26 -04:00
content = $ _4bi2o9j0jjgwecui . innerText ( content ) ;
2017-09-26 17:15:47 -04:00
}
}
2018-04-25 18:35:21 -04:00
if ( pasteBin . isDefaultContent ( content ) ) {
if ( ! isKeyBoardPaste ) {
editor . windowManager . alert ( 'Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.' ) ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
return ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
if ( plainTextMode ) {
pasteText ( editor , content ) ;
2017-09-26 17:15:47 -04:00
} else {
2018-04-25 18:35:21 -04:00
pasteHtml$1 ( editor , content , internal ) ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
}
var getLastRng = function ( ) {
return pasteBin . getLastRng ( ) || editor . selection . getRng ( ) ;
2017-09-26 17:15:47 -04:00
} ;
2018-04-25 18:35:21 -04:00
editor . on ( 'paste' , function ( e ) {
var clipboardTimer = new Date ( ) . getTime ( ) ;
var clipboardContent = getClipboardContent ( editor , e ) ;
var clipboardDelay = new Date ( ) . getTime ( ) - clipboardTimer ;
var isKeyBoardPaste = new Date ( ) . getTime ( ) - keyboardPasteTimeStamp - clipboardDelay < 1000 ;
var plainTextMode = pasteFormat . get ( ) === 'text' || keyboardPastePlainTextState ;
2018-07-16 04:07:26 -04:00
var internal = hasContentType ( clipboardContent , $ _4x13hjirjjgwecu1 . internalHtmlMime ( ) ) ;
2018-04-25 18:35:21 -04:00
keyboardPastePlainTextState = false ;
if ( e . isDefaultPrevented ( ) || isBrokenAndroidClipboardEvent ( e ) ) {
pasteBin . remove ( ) ;
return ;
}
if ( ! hasHtmlOrText ( clipboardContent ) && pasteImageData ( editor , e , getLastRng ( ) ) ) {
pasteBin . remove ( ) ;
return ;
}
if ( ! isKeyBoardPaste ) {
e . preventDefault ( ) ;
}
if ( global$1 . ie && ( ! isKeyBoardPaste || e . ieFake ) && ! hasContentType ( clipboardContent , 'text/html' ) ) {
pasteBin . create ( ) ;
editor . dom . bind ( pasteBin . getEl ( ) , 'paste' , function ( e ) {
e . stopPropagation ( ) ;
2017-09-26 17:15:47 -04:00
} ) ;
2018-04-25 18:35:21 -04:00
editor . getDoc ( ) . execCommand ( 'Paste' , false , null ) ;
clipboardContent [ 'text/html' ] = pasteBin . getHtml ( ) ;
}
if ( hasContentType ( clipboardContent , 'text/html' ) ) {
e . preventDefault ( ) ;
if ( ! internal ) {
2018-07-16 04:07:26 -04:00
internal = $ _4x13hjirjjgwecu1 . isMarked ( clipboardContent [ 'text/html' ] ) ;
2018-04-25 18:35:21 -04:00
}
insertClipboardContent ( clipboardContent , isKeyBoardPaste , plainTextMode , internal ) ;
} else {
global$2 . setEditorTimeout ( editor , function ( ) {
insertClipboardContent ( clipboardContent , isKeyBoardPaste , plainTextMode , internal ) ;
2017-09-26 17:15:47 -04:00
} , 0 ) ;
2018-04-25 18:35:21 -04:00
}
} ) ;
} ;
var registerEventsAndFilters = function ( editor , pasteBin , pasteFormat ) {
registerEventHandlers ( editor , pasteBin , pasteFormat ) ;
var src ;
2018-07-16 04:07:26 -04:00
editor . parser . addNodeFilter ( 'img' , function ( nodes , name$$1 , args ) {
2018-04-25 18:35:21 -04:00
var isPasteInsert = function ( args ) {
return args . data && args . data . paste === true ;
2017-09-26 17:15:47 -04:00
} ;
2018-04-25 18:35:21 -04:00
var remove = function ( node ) {
if ( ! node . attr ( 'data-mce-object' ) && src !== global$1 . transparentSrc ) {
node . remove ( ) ;
2017-09-26 17:15:47 -04:00
}
} ;
2018-04-25 18:35:21 -04:00
var isWebKitFakeUrl = function ( src ) {
return src . indexOf ( 'webkit-fake-url' ) === 0 ;
2017-09-26 17:15:47 -04:00
} ;
2018-04-25 18:35:21 -04:00
var isDataUri = function ( src ) {
return src . indexOf ( 'data:' ) === 0 ;
} ;
if ( ! editor . settings . paste _data _images && isPasteInsert ( args ) ) {
var i = nodes . length ;
while ( i -- ) {
src = nodes [ i ] . attributes . map . src ;
if ( ! src ) {
continue ;
}
if ( isWebKitFakeUrl ( src ) ) {
remove ( nodes [ i ] ) ;
} else if ( ! editor . settings . allow _html _data _urls && isDataUri ( src ) ) {
remove ( nodes [ i ] ) ;
}
}
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
} ) ;
} ;
2017-05-08 01:32:46 -04:00
2018-07-16 04:07:26 -04:00
var getPasteBinParent = function ( editor ) {
return global$1 . ie && editor . inline ? document . body : editor . getBody ( ) ;
} ;
var isExternalPasteBin = function ( editor ) {
return getPasteBinParent ( editor ) !== editor . getBody ( ) ;
} ;
var delegatePasteEvents = function ( editor , pasteBinElm ) {
if ( isExternalPasteBin ( editor ) ) {
editor . dom . bind ( pasteBinElm , 'paste keyup' , function ( e ) {
setTimeout ( function ( ) {
editor . fire ( 'paste' ) ;
} , 0 ) ;
} ) ;
}
} ;
2018-04-25 18:35:21 -04:00
var create = function ( editor , lastRngCell , pasteBinDefaultContent ) {
var dom = editor . dom , body = editor . getBody ( ) ;
var pasteBinElm ;
lastRngCell . set ( editor . selection . getRng ( ) ) ;
2018-07-16 04:07:26 -04:00
pasteBinElm = editor . dom . add ( getPasteBinParent ( editor ) , 'div' , {
2018-04-25 18:35:21 -04:00
'id' : 'mcepastebin' ,
2018-07-16 04:07:26 -04:00
'class' : 'mce-pastebin' ,
2018-04-25 18:35:21 -04:00
'contentEditable' : true ,
'data-mce-bogus' : 'all' ,
2018-07-16 04:07:26 -04:00
'style' : 'position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0'
2018-04-25 18:35:21 -04:00
} , pasteBinDefaultContent ) ;
if ( global$1 . ie || global$1 . gecko ) {
dom . setStyle ( pasteBinElm , 'left' , dom . getStyle ( body , 'direction' , true ) === 'rtl' ? 65535 : - 65535 ) ;
2017-09-26 17:15:47 -04:00
}
2018-04-25 18:35:21 -04:00
dom . bind ( pasteBinElm , 'beforedeactivate focusin focusout' , function ( e ) {
e . stopPropagation ( ) ;
} ) ;
2018-07-16 04:07:26 -04:00
delegatePasteEvents ( editor , pasteBinElm ) ;
2018-04-25 18:35:21 -04:00
pasteBinElm . focus ( ) ;
editor . selection . select ( pasteBinElm , true ) ;
} ;
var remove = function ( editor , lastRngCell ) {
if ( getEl ( editor ) ) {
var pasteBinClone = void 0 ;
var lastRng = lastRngCell . get ( ) ;
while ( pasteBinClone = editor . dom . get ( 'mcepastebin' ) ) {
editor . dom . remove ( pasteBinClone ) ;
editor . dom . unbind ( pasteBinClone ) ;
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
if ( lastRng ) {
editor . selection . setRng ( lastRng ) ;
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
}
lastRngCell . set ( null ) ;
} ;
var getEl = function ( editor ) {
return editor . dom . get ( 'mcepastebin' ) ;
} ;
var getHtml = function ( editor ) {
var pasteBinElm , pasteBinClones , i , dirtyWrappers , cleanWrapper ;
var copyAndRemove = function ( toElm , fromElm ) {
toElm . appendChild ( fromElm ) ;
editor . dom . remove ( fromElm , true ) ;
2017-05-08 01:32:46 -04:00
} ;
2018-07-16 04:07:26 -04:00
pasteBinClones = global$3 . grep ( getPasteBinParent ( editor ) . childNodes , function ( elm ) {
2018-04-25 18:35:21 -04:00
return elm . id === 'mcepastebin' ;
} ) ;
pasteBinElm = pasteBinClones . shift ( ) ;
global$3 . each ( pasteBinClones , function ( pasteBinClone ) {
copyAndRemove ( pasteBinElm , pasteBinClone ) ;
} ) ;
dirtyWrappers = editor . dom . select ( 'div[id=mcepastebin]' , pasteBinElm ) ;
for ( i = dirtyWrappers . length - 1 ; i >= 0 ; i -- ) {
cleanWrapper = editor . dom . create ( 'div' ) ;
pasteBinElm . insertBefore ( cleanWrapper , dirtyWrappers [ i ] ) ;
copyAndRemove ( cleanWrapper , dirtyWrappers [ i ] ) ;
}
return pasteBinElm ? pasteBinElm . innerHTML : '' ;
} ;
var getLastRng = function ( lastRng ) {
return lastRng . get ( ) ;
} ;
var isDefaultContent = function ( pasteBinDefaultContent , content ) {
return content === pasteBinDefaultContent ;
} ;
var isPasteBin = function ( elm ) {
return elm && elm . id === 'mcepastebin' ;
} ;
var isDefault = function ( editor , pasteBinDefaultContent ) {
var pasteBinElm = getEl ( editor ) ;
return isPasteBin ( pasteBinElm ) && isDefaultContent ( pasteBinDefaultContent , pasteBinElm . innerHTML ) ;
} ;
var PasteBin = function ( editor ) {
var lastRng = Cell ( null ) ;
var pasteBinDefaultContent = '%MCEPASTEBIN%' ;
2017-09-26 17:15:47 -04:00
return {
2018-04-25 18:35:21 -04:00
create : function ( ) {
return create ( editor , lastRng , pasteBinDefaultContent ) ;
} ,
remove : function ( ) {
return remove ( editor , lastRng ) ;
} ,
getEl : function ( ) {
return getEl ( editor ) ;
} ,
getHtml : function ( ) {
return getHtml ( editor ) ;
} ,
getLastRng : function ( ) {
return getLastRng ( lastRng ) ;
} ,
isDefault : function ( ) {
return isDefault ( editor , pasteBinDefaultContent ) ;
} ,
isDefaultContent : function ( content ) {
return isDefaultContent ( pasteBinDefaultContent , content ) ;
}
2017-09-26 17:15:47 -04:00
} ;
2018-04-25 18:35:21 -04:00
} ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var Clipboard = function ( editor , pasteFormat ) {
var pasteBin = PasteBin ( editor ) ;
editor . on ( 'preInit' , function ( ) {
return registerEventsAndFilters ( editor , pasteBin , pasteFormat ) ;
} ) ;
return {
pasteFormat : pasteFormat ,
pasteHtml : function ( html , internalFlag ) {
return pasteHtml$1 ( editor , html , internalFlag ) ;
} ,
pasteText : function ( text ) {
return pasteText ( editor , text ) ;
} ,
pasteImageData : function ( e , rng ) {
return pasteImageData ( editor , e , rng ) ;
} ,
getDataTransferItems : getDataTransferItems ,
hasHtmlOrText : hasHtmlOrText ,
hasContentType : hasContentType
} ;
} ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var noop = function ( ) {
} ;
var hasWorkingClipboardApi = function ( clipboardData ) {
2018-07-16 04:07:26 -04:00
return global$1 . iOS === false && clipboardData !== undefined && typeof clipboardData . setData === 'function' && $ _4bi2o9j0jjgwecui . isMsEdge ( ) !== true ;
2018-04-25 18:35:21 -04:00
} ;
var setHtml5Clipboard = function ( clipboardData , html , text ) {
if ( hasWorkingClipboardApi ( clipboardData ) ) {
try {
clipboardData . clearData ( ) ;
clipboardData . setData ( 'text/html' , html ) ;
clipboardData . setData ( 'text/plain' , text ) ;
2018-07-16 04:07:26 -04:00
clipboardData . setData ( $ _4x13hjirjjgwecu1 . internalHtmlMime ( ) , html ) ;
2018-04-25 18:35:21 -04:00
return true ;
} catch ( e ) {
return false ;
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
} else {
return false ;
}
} ;
var setClipboardData = function ( evt , data , fallback , done ) {
if ( setHtml5Clipboard ( evt . clipboardData , data . html , data . text ) ) {
evt . preventDefault ( ) ;
done ( ) ;
} else {
fallback ( data . html , done ) ;
}
} ;
var fallback = function ( editor ) {
return function ( html , done ) {
2018-07-16 04:07:26 -04:00
var markedHtml = $ _4x13hjirjjgwecu1 . mark ( html ) ;
2018-04-25 18:35:21 -04:00
var outer = editor . dom . create ( 'div' , {
'contenteditable' : 'false' ,
'data-mce-bogus' : 'all'
} ) ;
var inner = editor . dom . create ( 'div' , { contenteditable : 'true' } , markedHtml ) ;
editor . dom . setStyles ( outer , {
position : 'fixed' ,
top : '0' ,
left : '-3000px' ,
width : '1000px' ,
overflow : 'hidden'
} ) ;
outer . appendChild ( inner ) ;
editor . dom . add ( editor . getBody ( ) , outer ) ;
var range = editor . selection . getRng ( ) ;
inner . focus ( ) ;
var offscreenRange = editor . dom . createRng ( ) ;
offscreenRange . selectNodeContents ( inner ) ;
editor . selection . setRng ( offscreenRange ) ;
setTimeout ( function ( ) {
editor . selection . setRng ( range ) ;
outer . parentNode . removeChild ( outer ) ;
done ( ) ;
} , 0 ) ;
} ;
} ;
var getData = function ( editor ) {
return {
html : editor . selection . getContent ( { contextual : true } ) ,
text : editor . selection . getContent ( { format : 'text' } )
} ;
} ;
var cut = function ( editor ) {
return function ( evt ) {
if ( editor . selection . isCollapsed ( ) === false ) {
setClipboardData ( evt , getData ( editor ) , fallback ( editor ) , function ( ) {
setTimeout ( function ( ) {
editor . execCommand ( 'Delete' ) ;
} , 0 ) ;
} ) ;
}
} ;
} ;
var copy = function ( editor ) {
return function ( evt ) {
if ( editor . selection . isCollapsed ( ) === false ) {
setClipboardData ( evt , getData ( editor ) , fallback ( editor ) , noop ) ;
}
} ;
} ;
var register$1 = function ( editor ) {
editor . on ( 'cut' , cut ( editor ) ) ;
editor . on ( 'copy' , copy ( editor ) ) ;
} ;
2018-07-16 04:07:26 -04:00
var $ _32blojj3jjgwecv4 = { register : register$1 } ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var global$10 = tinymce . util . Tools . resolve ( 'tinymce.dom.RangeUtils' ) ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var getCaretRangeFromEvent = function ( editor , e ) {
return global$10 . getCaretRangeFromPoint ( e . clientX , e . clientY , editor . getDoc ( ) ) ;
} ;
var isPlainTextFileUrl = function ( content ) {
var plainTextContent = content [ 'text/plain' ] ;
return plainTextContent ? plainTextContent . indexOf ( 'file://' ) === 0 : false ;
} ;
var setFocusedRange = function ( editor , rng ) {
editor . focus ( ) ;
editor . selection . setRng ( rng ) ;
} ;
var setup = function ( editor , clipboard , draggingInternallyState ) {
2018-07-16 04:07:26 -04:00
if ( $ _xr8b0ikjjgwectl . shouldBlockDrop ( editor ) ) {
2018-04-25 18:35:21 -04:00
editor . on ( 'dragend dragover draggesture dragdrop drop drag' , function ( e ) {
e . preventDefault ( ) ;
e . stopPropagation ( ) ;
} ) ;
}
2018-07-16 04:07:26 -04:00
if ( ! $ _xr8b0ikjjgwectl . shouldPasteDataImages ( editor ) ) {
2018-04-25 18:35:21 -04:00
editor . on ( 'drop' , function ( e ) {
var dataTransfer = e . dataTransfer ;
if ( dataTransfer && dataTransfer . files && dataTransfer . files . length > 0 ) {
e . preventDefault ( ) ;
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
} ) ;
}
editor . on ( 'drop' , function ( e ) {
var dropContent , rng ;
rng = getCaretRangeFromEvent ( editor , e ) ;
if ( e . isDefaultPrevented ( ) || draggingInternallyState . get ( ) ) {
return ;
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
dropContent = clipboard . getDataTransferItems ( e . dataTransfer ) ;
2018-07-16 04:07:26 -04:00
var internal = clipboard . hasContentType ( dropContent , $ _4x13hjirjjgwecu1 . internalHtmlMime ( ) ) ;
2018-04-25 18:35:21 -04:00
if ( ( ! clipboard . hasHtmlOrText ( dropContent ) || isPlainTextFileUrl ( dropContent ) ) && clipboard . pasteImageData ( e , rng ) ) {
return ;
2017-05-08 01:32:46 -04:00
}
2018-07-16 04:07:26 -04:00
if ( rng && $ _xr8b0ikjjgwectl . shouldFilterDrop ( editor ) ) {
2018-04-25 18:35:21 -04:00
var content _1 = dropContent [ 'mce-internal' ] || dropContent [ 'text/html' ] || dropContent [ 'text/plain' ] ;
if ( content _1 ) {
e . preventDefault ( ) ;
global$2 . setEditorTimeout ( editor , function ( ) {
editor . undoManager . transact ( function ( ) {
if ( dropContent [ 'mce-internal' ] ) {
editor . execCommand ( 'Delete' ) ;
}
setFocusedRange ( editor , rng ) ;
2018-07-16 04:07:26 -04:00
content _1 = $ _4bi2o9j0jjgwecui . trimHtml ( content _1 ) ;
2018-04-25 18:35:21 -04:00
if ( ! dropContent [ 'text/html' ] ) {
clipboard . pasteText ( content _1 ) ;
} else {
clipboard . pasteHtml ( content _1 , internal ) ;
}
} ) ;
} ) ;
2017-05-08 01:32:46 -04:00
}
}
2018-04-25 18:35:21 -04:00
} ) ;
editor . on ( 'dragstart' , function ( e ) {
draggingInternallyState . set ( true ) ;
} ) ;
editor . on ( 'dragover dragend' , function ( e ) {
2018-07-16 04:07:26 -04:00
if ( $ _xr8b0ikjjgwectl . shouldPasteDataImages ( editor ) && draggingInternallyState . get ( ) === false ) {
2018-04-25 18:35:21 -04:00
e . preventDefault ( ) ;
setFocusedRange ( editor , getCaretRangeFromEvent ( editor , e ) ) ;
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
if ( e . type === 'dragend' ) {
draggingInternallyState . set ( false ) ;
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
} ) ;
} ;
2018-07-16 04:07:26 -04:00
var $ _b4etj0j4jjgwecv7 = { setup : setup } ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var setup$1 = function ( editor ) {
var plugin = editor . plugins . paste ;
2018-07-16 04:07:26 -04:00
var preProcess = $ _xr8b0ikjjgwectl . getPreProcess ( editor ) ;
2018-04-25 18:35:21 -04:00
if ( preProcess ) {
editor . on ( 'PastePreProcess' , function ( e ) {
preProcess . call ( plugin , plugin , e ) ;
} ) ;
}
2018-07-16 04:07:26 -04:00
var postProcess = $ _xr8b0ikjjgwectl . getPostProcess ( editor ) ;
2018-04-25 18:35:21 -04:00
if ( postProcess ) {
editor . on ( 'PastePostProcess' , function ( e ) {
postProcess . call ( plugin , plugin , e ) ;
} ) ;
}
} ;
2018-07-16 04:07:26 -04:00
var $ _c5bihmj6jjgwecva = { setup : setup$1 } ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
function addPreProcessFilter ( editor , filterFunc ) {
editor . on ( 'PastePreProcess' , function ( e ) {
e . content = filterFunc ( editor , e . content , e . internal , e . wordContent ) ;
} ) ;
}
function addPostProcessFilter ( editor , filterFunc ) {
editor . on ( 'PastePostProcess' , function ( e ) {
filterFunc ( editor , e . node ) ;
} ) ;
}
function removeExplorerBrElementsAfterBlocks ( editor , html ) {
2018-07-16 04:07:26 -04:00
if ( ! $ _dfatuiivjjgwecu8 . isWordContent ( html ) ) {
2018-04-25 18:35:21 -04:00
return html ;
}
var blockElements = [ ] ;
global$3 . each ( editor . schema . getBlockElements ( ) , function ( block , blockName ) {
blockElements . push ( blockName ) ;
} ) ;
var explorerBlocksRegExp = new RegExp ( '(?:<br> [\\s\\r\\n]+|<br>)*(<\\/?(' + blockElements . join ( '|' ) + ')[^>]*>)(?:<br> [\\s\\r\\n]+|<br>)*' , 'g' ) ;
2018-07-16 04:07:26 -04:00
html = $ _4bi2o9j0jjgwecui . filter ( html , [ [
2018-04-25 18:35:21 -04:00
explorerBlocksRegExp ,
'$1'
] ] ) ;
2018-07-16 04:07:26 -04:00
html = $ _4bi2o9j0jjgwecui . filter ( html , [
2018-04-25 18:35:21 -04:00
[
/<br><br>/g ,
'<BR><BR>'
] ,
[
/<br>/g ,
' '
] ,
[
/<BR><BR>/g ,
'<br>'
]
] ) ;
return html ;
}
function removeWebKitStyles ( editor , content , internal , isWordHtml ) {
if ( isWordHtml || internal ) {
return content ;
}
2018-07-16 04:07:26 -04:00
var webKitStylesSetting = $ _xr8b0ikjjgwectl . getWebkitStyles ( editor ) ;
2018-04-25 18:35:21 -04:00
var webKitStyles ;
2018-07-16 04:07:26 -04:00
if ( $ _xr8b0ikjjgwectl . shouldRemoveWebKitStyles ( editor ) === false || webKitStylesSetting === 'all' ) {
2018-04-25 18:35:21 -04:00
return content ;
}
if ( webKitStylesSetting ) {
webKitStyles = webKitStylesSetting . split ( /[, ]/ ) ;
}
if ( webKitStyles ) {
var dom _1 = editor . dom , node _1 = editor . selection . getNode ( ) ;
content = content . replace ( /(<[^>]+) style="([^"]*)"([^>]*>)/gi , function ( all , before , value , after ) {
var inputStyles = dom _1 . parseStyle ( dom _1 . decode ( value ) ) ;
var outputStyles = { } ;
if ( webKitStyles === 'none' ) {
return before + after ;
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
for ( var i = 0 ; i < webKitStyles . length ; i ++ ) {
var inputValue = inputStyles [ webKitStyles [ i ] ] , currentValue = dom _1 . getStyle ( node _1 , webKitStyles [ i ] , true ) ;
if ( /color/ . test ( webKitStyles [ i ] ) ) {
inputValue = dom _1 . toHex ( inputValue ) ;
currentValue = dom _1 . toHex ( currentValue ) ;
}
if ( currentValue !== inputValue ) {
outputStyles [ webKitStyles [ i ] ] = inputValue ;
}
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
outputStyles = dom _1 . serializeStyle ( outputStyles , 'span' ) ;
if ( outputStyles ) {
return before + ' style="' + outputStyles + '"' + after ;
}
return before + after ;
2017-05-08 01:32:46 -04:00
} ) ;
2018-04-25 18:35:21 -04:00
} else {
content = content . replace ( /(<[^>]+) style="([^"]*)"([^>]*>)/gi , '$1$3' ) ;
}
content = content . replace ( /(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi , function ( all , before , value , after ) {
return before + ' style="' + value + '"' + after ;
} ) ;
return content ;
}
function removeUnderlineAndFontInAnchor ( editor , root ) {
editor . $ ( 'a' , root ) . find ( 'font,u' ) . each ( function ( i , node ) {
editor . dom . remove ( node , true ) ;
} ) ;
}
var setup$2 = function ( editor ) {
if ( global$1 . webkit ) {
addPreProcessFilter ( editor , removeWebKitStyles ) ;
}
if ( global$1 . ie ) {
addPreProcessFilter ( editor , removeExplorerBrElementsAfterBlocks ) ;
addPostProcessFilter ( editor , removeUnderlineAndFontInAnchor ) ;
}
} ;
2018-07-16 04:07:26 -04:00
var $ _36tmgyj7jjgwecvc = { setup : setup$2 } ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var curry = function ( f ) {
var x = [ ] ;
for ( var _i = 1 ; _i < arguments . length ; _i ++ ) {
x [ _i - 1 ] = arguments [ _i ] ;
}
var args = new Array ( arguments . length - 1 ) ;
for ( var i = 1 ; i < arguments . length ; i ++ )
args [ i - 1 ] = arguments [ i ] ;
return function ( ) {
var x = [ ] ;
for ( var _i = 0 ; _i < arguments . length ; _i ++ ) {
x [ _i ] = arguments [ _i ] ;
}
var newArgs = new Array ( arguments . length ) ;
for ( var j = 0 ; j < newArgs . length ; j ++ )
newArgs [ j ] = arguments [ j ] ;
var all = args . concat ( newArgs ) ;
return f . apply ( null , all ) ;
} ;
} ;
2017-05-08 01:32:46 -04:00
2018-04-25 18:35:21 -04:00
var stateChange = function ( editor , clipboard , e ) {
var ctrl = e . control ;
ctrl . active ( clipboard . pasteFormat . get ( ) === 'text' ) ;
editor . on ( 'PastePlainTextToggle' , function ( e ) {
ctrl . active ( e . state ) ;
2017-05-08 01:32:46 -04:00
} ) ;
2018-04-25 18:35:21 -04:00
} ;
var register$2 = function ( editor , clipboard ) {
2018-07-16 04:07:26 -04:00
var postRender = curry ( stateChange , editor , clipboard ) ;
2018-04-25 18:35:21 -04:00
editor . addButton ( 'pastetext' , {
active : false ,
icon : 'pastetext' ,
tooltip : 'Paste as text' ,
cmd : 'mceTogglePlainTextPaste' ,
onPostRender : postRender
} ) ;
editor . addMenuItem ( 'pastetext' , {
text : 'Paste as text' ,
selectable : true ,
active : clipboard . pasteFormat ,
cmd : 'mceTogglePlainTextPaste' ,
onPostRender : postRender
} ) ;
} ;
2018-07-16 04:07:26 -04:00
var $ _g9yhwdj8jjgwecvf = { register : register$2 } ;
2018-04-25 18:35:21 -04:00
global . add ( 'paste' , function ( editor ) {
2018-07-16 04:07:26 -04:00
if ( $ _15bf6siejjgwect1 . hasProPlugin ( editor ) === false ) {
2018-04-25 18:35:21 -04:00
var userIsInformedState = Cell ( false ) ;
var draggingInternallyState = Cell ( false ) ;
2018-07-16 04:07:26 -04:00
var pasteFormat = Cell ( $ _xr8b0ikjjgwectl . isPasteAsTextEnabled ( editor ) ? 'text' : 'html' ) ;
2018-04-25 18:35:21 -04:00
var clipboard = Clipboard ( editor , pasteFormat ) ;
2018-07-16 04:07:26 -04:00
var quirks = $ _36tmgyj7jjgwecvc . setup ( editor ) ;
$ _g9yhwdj8jjgwecvf . register ( editor , clipboard ) ;
$ _fldd1mihjjgwecth . register ( editor , clipboard , userIsInformedState ) ;
$ _c5bihmj6jjgwecva . setup ( editor ) ;
$ _32blojj3jjgwecv4 . register ( editor ) ;
$ _b4etj0j4jjgwecv7 . setup ( editor , clipboard , draggingInternallyState ) ;
return $ _6gtliyigjjgwecte . get ( clipboard , quirks ) ;
2018-04-25 18:35:21 -04:00
}
} ) ;
function Plugin ( ) {
2017-05-08 01:32:46 -04:00
}
2018-04-25 18:35:21 -04:00
return Plugin ;
} ( ) ) ;
2017-05-08 01:32:46 -04:00
} ) ( ) ;