Built from https://develop.svn.wordpress.org/trunk@29458


git-svn-id: http://core.svn.wordpress.org/trunk@29236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-08-09 20:56:15 +00:00
parent 1c93f05e2a
commit efd52cb860
10 changed files with 93 additions and 42 deletions

View File

@ -22,7 +22,8 @@
(function(tinymce) {
var reported;
function noop() {}
function noop() {
}
function log(apiCall) {
if (!reported && window && window.console) {
@ -170,7 +171,9 @@
onAdd: new Dispatcher(),
onPostRender: new Dispatcher(),
add: function(obj) { return obj; },
add: function(obj) {
return obj;
},
createButton: cmNoop,
createColorSplitButton: cmNoop,
createControl: cmNoop,

View File

@ -17,6 +17,7 @@ tinymce.PluginManager.add('media', function(editor, url) {
{regex: /youtu\.be\/([\w\-.]+)/, type: 'iframe', w: 425, h: 350, url: '//www.youtube.com/embed/$1'},
{regex: /youtube\.com(.+)v=([^&]+)/, type: 'iframe', w: 425, h: 350, url: '//www.youtube.com/embed/$2'},
{regex: /vimeo\.com\/([0-9]+)/, type: 'iframe', w: 425, h: 350, url: '//player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc'},
{regex: /vimeo\.com\/(.*)\/([0-9]+)/, type: "iframe", w: 425, h: 350, url: "//player.vimeo.com/video/$2?title=0&byline=0"},
{regex: /maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/, type: 'iframe', w: 425, h: 350, url: '//maps.google.com/maps/ms?msid=$2&output=embed"'}
];

File diff suppressed because one or more lines are too long

View File

@ -250,7 +250,7 @@ define("tinymce/pasteplugin/Clipboard", [
"tinymce/pasteplugin/Utils"
], function(Env, VK, Utils) {
return function(editor) {
var self = this, pasteBinElm, lastRng, keyboardPasteTimeStamp = 0;
var self = this, pasteBinElm, lastRng, keyboardPasteTimeStamp = 0, draggingInternally = false;
var pasteBinDefaultContent = '%MCEPASTEBIN%', keyboardPastePlainTextState;
/**
@ -455,16 +455,20 @@ define("tinymce/pasteplugin/Clipboard", [
function getDataTransferItems(dataTransfer) {
var data = {};
if (dataTransfer && dataTransfer.types) {
// Use old WebKit API
var legacyText = dataTransfer.getData('Text');
if (legacyText && legacyText.length > 0) {
data['text/plain'] = legacyText;
if (dataTransfer) {
// Use old WebKit/IE API
if (dataTransfer.getData) {
var legacyText = dataTransfer.getData('Text');
if (legacyText && legacyText.length > 0) {
data['text/plain'] = legacyText;
}
}
for (var i = 0; i < dataTransfer.types.length; i++) {
var contentType = dataTransfer.types[i];
data[contentType] = dataTransfer.getData(contentType);
if (dataTransfer.types) {
for (var i = 0; i < dataTransfer.types.length; i++) {
var contentType = dataTransfer.types[i];
data[contentType] = dataTransfer.getData(contentType);
}
}
}
@ -675,6 +679,11 @@ define("tinymce/pasteplugin/Clipboard", [
removePasteBin();
// If we got nothing from clipboard API and pastebin then we could try the last resort: plain/text
if (!content.length) {
plainTextMode = true;
}
// Grab plain text from Clipboard API or convert existing HTML to plain text
if (plainTextMode) {
// Use plain text contents from Clipboard API unless the HTML contains paragraphs then
@ -704,20 +713,14 @@ define("tinymce/pasteplugin/Clipboard", [
}, 0);
});
editor.on('dragstart', function(e) {
if (e.dataTransfer.types) {
try {
e.dataTransfer.setData('mce-internal', editor.selection.getContent());
} catch (ex) {
// IE 10 throws an error since it doesn't support custom data items
}
}
editor.on('dragstart dragend', function(e) {
draggingInternally = e.type == 'dragstart';
});
editor.on('drop', function(e) {
var rng = getCaretRangeFromEvent(e);
if (e.isDefaultPrevented()) {
if (e.isDefaultPrevented() || draggingInternally) {
return;
}
@ -725,7 +728,7 @@ define("tinymce/pasteplugin/Clipboard", [
return;
}
if (rng) {
if (rng && editor.settings.paste_filter_drop !== false) {
var dropContent = getDataTransferItems(e.dataTransfer);
var content = dropContent['mce-internal'] || dropContent['text/html'] || dropContent['text/plain'];
@ -739,6 +742,8 @@ define("tinymce/pasteplugin/Clipboard", [
editor.selection.setRng(rng);
content = Utils.trimHtml(content);
if (!dropContent['text/html']) {
pasteText(content);
} else {
@ -830,6 +835,38 @@ define("tinymce/pasteplugin/WordFilter", [
);
}
/**
* Checks if the specified text starts with "1. " or "a. " etc.
*/
function isNumericList(text) {
var found, patterns;
patterns = [
/^[IVXLMCD]{1,2}\.[ \u00a0]/, // Roman upper case
/^[ivxlmcd]{1,2}\.[ \u00a0]/, // Roman lower case
/^[a-z]{1,2}[\.\)][ \u00a0]/, // Alphabetical a-z
/^[A-Z]{1,2}[\.\)][ \u00a0]/, // Alphabetical A-Z
/^[0-9]+\.[ \u00a0]/, // Numeric lists
/^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/, // Japanese
/^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/ // Chinese
];
text = text.replace(/^[\u00a0 ]+/, '');
Tools.each(patterns, function(pattern) {
if (pattern.test(text)) {
found = true;
return false;
}
});
return found;
}
function isBulletList(text) {
return /^[\s\u00a0]*[\u2022\u00b7\u00a7\u00d8\u25CF]\s*/.test(text);
}
function WordFilter(editor) {
var settings = editor.settings;
@ -951,16 +988,15 @@ define("tinymce/pasteplugin/WordFilter", [
if (node.name == 'p' && node.firstChild) {
// Find first text node in paragraph
var nodeText = getText(node);
var listStartTextNode = node.firstChild;
// Detect unordered lists look for bullets
if (/^[\s\u00a0]*[\u2022\u00b7\u00a7\u00d8\u25CF]\s*/.test(nodeText)) {
if (isBulletList(nodeText)) {
convertParagraphToLi(node, 'ul');
continue;
}
// Detect ordered lists 1., a. or ixv.
if (/^[\s\u00a0]*\w+\./.test(nodeText) && !/^[\s\u00a0]*\w+\.\s*[^\s]+/.test(listStartTextNode.value)) {
if (isNumericList(nodeText)) {
// Parse OL start number
var matches = /([0-9])\./.exec(nodeText);
var start = 1;

File diff suppressed because one or more lines are too long

View File

@ -33,11 +33,16 @@ tinymce.PluginManager.add( 'wpautoresize', function( editor ) {
return;
}
function getInt( n ) {
return parseInt( n, 10 ) || 0;
}
/**
* This method gets executed each time the editor needs to resize.
*/
function resize( e ) {
var deltaSize, doc, body, docElm, DOM = tinymce.DOM, resizeHeight, myHeight, marginTop, marginBottom;
var deltaSize, doc, body, docElm, DOM = tinymce.DOM, resizeHeight, myHeight,
marginTop, marginBottom, paddingTop, paddingBottom, borderTop, borderBottom;
if ( ! isActive ) {
return;
@ -65,7 +70,13 @@ tinymce.PluginManager.add( 'wpautoresize', function( editor ) {
// Calculate outer height of the body element using CSS styles
marginTop = editor.dom.getStyle( body, 'margin-top', true );
marginBottom = editor.dom.getStyle( body, 'margin-bottom', true );
myHeight = body.offsetHeight + parseInt( marginTop, 10 ) + parseInt( marginBottom, 10 );
paddingTop = editor.dom.getStyle( body, 'padding-top', true );
paddingBottom = editor.dom.getStyle( body, 'padding-bottom', true );
borderTop = editor.dom.getStyle( body, 'border-top-width', true );
borderBottom = editor.dom.getStyle( body, 'border-bottom-width', true );
myHeight = body.offsetHeight + getInt( marginTop ) + getInt( marginBottom ) +
getInt( paddingTop ) + getInt( paddingBottom ) +
getInt( borderTop ) + getInt( borderBottom );
// IE < 11, other?
if ( myHeight && myHeight < docElm.offsetHeight ) {
@ -97,7 +108,7 @@ tinymce.PluginManager.add( 'wpautoresize', function( editor ) {
// Resize content element
if (resizeHeight !== oldSize) {
deltaSize = resizeHeight - oldSize;
DOM.setStyle( DOM.get( editor.id + '_ifr'), 'height', resizeHeight + 'px' );
DOM.setStyle( editor.iframeElement, 'height', resizeHeight + 'px' );
oldSize = resizeHeight;
// WebKit doesn't decrease the size of the body element until the iframe gets resized

View File

@ -1 +1 @@
tinymce.PluginManager.add("wpautoresize",function(a){function b(){return a.plugins.fullscreen&&a.plugins.fullscreen.isFullscreen()}function c(d){var e,f,j,k,l,m,n,o,p=tinymce.DOM;if(i&&(f=a.getDoc())){if(d=d||{},j=f.body,k=f.documentElement,l=g.autoresize_min_height,!j||d&&"setcontent"===d.type&&d.initial||b())return void(j&&k&&(j.style.overflowY="auto",k.style.overflowY="auto"));n=a.dom.getStyle(j,"margin-top",!0),o=a.dom.getStyle(j,"margin-bottom",!0),m=j.offsetHeight+parseInt(n,10)+parseInt(o,10),m&&m<k.offsetHeight&&(m=k.offsetHeight),(isNaN(m)||0>=m)&&(m=tinymce.Env.ie?j.scrollHeight:tinymce.Env.webkit&&0===j.clientHeight?0:j.offsetHeight),m>g.autoresize_min_height&&(l=m),g.autoresize_max_height&&m>g.autoresize_max_height?(l=g.autoresize_max_height,j.style.overflowY="auto",k.style.overflowY="auto"):(j.style.overflowY="hidden",k.style.overflowY="hidden",j.scrollTop=0),l!==h&&(e=l-h,p.setStyle(p.get(a.id+"_ifr"),"height",l+"px"),h=l,tinymce.isWebKit&&0>e&&c(d),a.fire("wp-autoresize",{height:l}))}}function d(a,b,e){setTimeout(function(){c(),a--?d(a,b,e):e&&e()},b)}function e(){a.dom.hasClass(a.getBody(),"wp-autoresize")||(i=!0,a.dom.addClass(a.getBody(),"wp-autoresize"),a.on("nodechange setcontent keyup FullscreenStateChanged",c),c())}function f(){var b;g.wp_autoresize_on||(i=!1,b=a.getDoc(),a.dom.removeClass(a.getBody(),"wp-autoresize"),a.off("nodechange setcontent keyup FullscreenStateChanged",c),b.body.style.overflowY="auto",b.documentElement.style.overflowY="auto",h=0)}var g=a.settings,h=0,i=!1;a.settings.inline||(g.autoresize_min_height=parseInt(a.getParam("autoresize_min_height",a.getElement().offsetHeight),10),g.autoresize_max_height=parseInt(a.getParam("autoresize_max_height",0),10),g.wp_autoresize_on&&(i=!0,a.on("init",function(){a.dom.addClass(a.getBody(),"wp-autoresize")}),a.on("nodechange keyup FullscreenStateChanged",c),a.on("setcontent",function(){d(3,100)}),a.getParam("autoresize_on_init",!0)&&a.on("init",function(){d(10,200,function(){d(5,1e3)})})),a.on("show",function(){h=0}),a.addCommand("wpAutoResize",c),a.addCommand("wpAutoResizeOn",e),a.addCommand("wpAutoResizeOff",f))});
tinymce.PluginManager.add("wpautoresize",function(a){function b(){return a.plugins.fullscreen&&a.plugins.fullscreen.isFullscreen()}function c(a){return parseInt(a,10)||0}function d(e){var f,g,k,l,m,n,o,p,q,r,s,t,u=tinymce.DOM;if(j&&(g=a.getDoc())){if(e=e||{},k=g.body,l=g.documentElement,m=h.autoresize_min_height,!k||e&&"setcontent"===e.type&&e.initial||b())return void(k&&l&&(k.style.overflowY="auto",l.style.overflowY="auto"));o=a.dom.getStyle(k,"margin-top",!0),p=a.dom.getStyle(k,"margin-bottom",!0),q=a.dom.getStyle(k,"padding-top",!0),r=a.dom.getStyle(k,"padding-bottom",!0),s=a.dom.getStyle(k,"border-top-width",!0),t=a.dom.getStyle(k,"border-bottom-width",!0),n=k.offsetHeight+c(o)+c(p)+c(q)+c(r)+c(s)+c(t),n&&n<l.offsetHeight&&(n=l.offsetHeight),(isNaN(n)||0>=n)&&(n=tinymce.Env.ie?k.scrollHeight:tinymce.Env.webkit&&0===k.clientHeight?0:k.offsetHeight),n>h.autoresize_min_height&&(m=n),h.autoresize_max_height&&n>h.autoresize_max_height?(m=h.autoresize_max_height,k.style.overflowY="auto",l.style.overflowY="auto"):(k.style.overflowY="hidden",l.style.overflowY="hidden",k.scrollTop=0),m!==i&&(f=m-i,u.setStyle(a.iframeElement,"height",m+"px"),i=m,tinymce.isWebKit&&0>f&&d(e),a.fire("wp-autoresize",{height:m}))}}function e(a,b,c){setTimeout(function(){d(),a--?e(a,b,c):c&&c()},b)}function f(){a.dom.hasClass(a.getBody(),"wp-autoresize")||(j=!0,a.dom.addClass(a.getBody(),"wp-autoresize"),a.on("nodechange setcontent keyup FullscreenStateChanged",d),d())}function g(){var b;h.wp_autoresize_on||(j=!1,b=a.getDoc(),a.dom.removeClass(a.getBody(),"wp-autoresize"),a.off("nodechange setcontent keyup FullscreenStateChanged",d),b.body.style.overflowY="auto",b.documentElement.style.overflowY="auto",i=0)}var h=a.settings,i=0,j=!1;a.settings.inline||(h.autoresize_min_height=parseInt(a.getParam("autoresize_min_height",a.getElement().offsetHeight),10),h.autoresize_max_height=parseInt(a.getParam("autoresize_max_height",0),10),h.wp_autoresize_on&&(j=!0,a.on("init",function(){a.dom.addClass(a.getBody(),"wp-autoresize")}),a.on("nodechange keyup FullscreenStateChanged",d),a.on("setcontent",function(){e(3,100)}),a.getParam("autoresize_on_init",!0)&&a.on("init",function(){e(10,200,function(){e(5,1e3)})})),a.on("show",function(){i=0}),a.addCommand("wpAutoResize",d),a.addCommand("wpAutoResizeOn",f),a.addCommand("wpAutoResizeOff",g))});

File diff suppressed because one or more lines are too long

View File

@ -18,7 +18,7 @@ $wp_db_version = 29188;
*
* @global string $tinymce_version
*/
$tinymce_version = '4102-20140721';
$tinymce_version = '4103-20140809';
/**
* Holds the required PHP version