From 4e5c3884557c70886479cd27ea2a1748116b6fab Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 18 Apr 2015 14:37:17 +0200 Subject: [PATCH] Upgraded to Redactor 10.1.0 --- .../files/js/3rdParty/redactor/redactor.js | 458 +++++++++++------- 1 file changed, 285 insertions(+), 173 deletions(-) diff --git a/wcfsetup/install/files/js/3rdParty/redactor/redactor.js b/wcfsetup/install/files/js/3rdParty/redactor/redactor.js index 99e89a5b98..0de969aa86 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/redactor.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/redactor.js @@ -1,6 +1,6 @@ /* - Redactor v10.0.9 - Updated: March 16, 2015 + Redactor v10.1.0 + Updated: April 16, 2015 http://imperavi.com/redactor/ @@ -28,9 +28,6 @@ var uuid = 0; - var reUrlYoutube = /https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com\S*[^\w\-\s])([\w\-]{11})(?=[^\w\-]|$)(?![?=&+%\w.\-]*(?:['"][^<>]*>|<\/a>))[?=&+%\w.-]*/ig; - var reUrlVimeo = /https?:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/; - // Plugin $.fn.redactor = function(options) { @@ -94,13 +91,13 @@ // Functionality $.Redactor = Redactor; - $.Redactor.VERSION = '10.0.9'; + $.Redactor.VERSION = '10.1.0'; $.Redactor.modules = ['alignment', 'autosave', 'block', 'buffer', 'build', 'button', 'caret', 'clean', 'code', 'core', 'dropdown', 'file', 'focus', 'image', 'indent', 'inline', 'insert', 'keydown', 'keyup', 'lang', 'line', 'link', 'list', 'modal', 'observe', 'paragraphize', 'paste', 'placeholder', 'progress', 'selection', 'shortcuts', - 'tabifier', 'tidy', 'toolbar', 'upload', 'utils']; + 'tabifier', 'tidy', 'toolbar', 'upload', 'utils', 'linkify']; $.Redactor.opts = { @@ -328,7 +325,18 @@ upload_label: 'Drop file here or ' } - } + }, + + linkify: { + regexps: { + youtube: /https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com\S*[^\w\-\s])([\w\-]{11})(?=[^\w\-]|$)(?![?=&+%\w.\-]*(?:['"][^<>]*>|<\/a>))[?=&+%\w.-]*/ig, + vimeo: /https?:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/, + image: /((https?|www)[^\s]+\.)(jpe?g|png|gif)(\?[^\s-]+)?/ig, + url: /((?:http[s]?:\/\/(?:www\.)?|www\.){1}(?:[0-9A-Za-z\-%_]+\.)+[a-zA-Z]{2,}(?::[0-9]+)?(?:(?:\/[0-9A-Za-z\-#\.%\+_]*)+)?(?:\?(?:[0-9A-Za-z\-\.%_]+(?:=[0-9A-Za-z\-\.%_\+]*)?)?(?:&(?:[0-9A-Za-z\-\.%_]+(?:=[0-9A-Za-z\-\.%_\+]*)?)?)*)?(?:#[0-9A-Za-z\-\.%_\+=\?&;]*)?)/ig, + } + }, + + codemirror: false }; // Functionality @@ -529,11 +537,11 @@ autosave: function() { return { + html: false, enable: function() { if (!this.opts.autosave) return; - this.autosave.html = false; this.autosave.name = (this.opts.autosaveName) ? this.opts.autosaveName : this.$textarea.attr('name'); if (this.opts.autosaveOnChange) return; @@ -549,7 +557,7 @@ this.autosave.source = this.code.get(); if (this.autosave.html === this.autosave.source) return; - if (this.utils.isEmpty(this.autosave.source)) return; + //if (this.utils.isEmpty(this.autosave.source)) return; // data var data = {}; @@ -940,7 +948,7 @@ }, formatListToBlockquote: function() { - var block = $(this.block.blocks[0]).closest('ul, ol'); + var block = $(this.block.blocks[0]).closest('ul, ol', this.$editor[0]); $(block).find('ul, ol').contents().unwrap(); $(block).find('li').append($('
')).contents().unwrap(); @@ -1033,10 +1041,10 @@ }, formatTableWrapping: function($formatted) { - if ($formatted.closest('table').length === 0) return; + if ($formatted.closest('table', this.$editor[0]).length === 0) return; - if ($formatted.closest('tr').length === 0) $formatted.wrap(''); - if ($formatted.closest('td').length === 0 && $formatted.closest('th').length === 0) + if ($formatted.closest('tr', this.$editor[0]).length === 0) $formatted.wrap(''); + if ($formatted.closest('td', this.$editor[0]).length === 0 && $formatted.closest('th').length === 0) { $formatted.wrap(''); } @@ -1395,8 +1403,11 @@ }, setHelpers: function() { - // autosave - this.autosave.enable(); + // linkify + if (this.linkify.isEnabled()) + { + this.linkify.format(); + } // placeholder this.placeholder.enable(); @@ -1469,7 +1480,7 @@ // dropdown if (btnObject.dropdown) { - var $dropdown = $('