diff --git a/app/assets/javascripts/redactor.js b/app/assets/javascripts/redactor.js index fe77a60..e494c14 100755 --- a/app/assets/javascripts/redactor.js +++ b/app/assets/javascripts/redactor.js @@ -1,10 +1,10 @@ /* - Redactor v10.0.1 - Updated: October 6, 2014 + Redactor 10.2.5 + Updated: October 1, 2015 http://imperavi.com/redactor/ - Copyright (c) 2009-2014, Imperavi LLC. + Copyright (c) 2009-2015, Imperavi LLC. License: http://imperavi.com/redactor/license/ Usage: $('#content').redactor(); @@ -12,6 +12,7 @@ (function($) { + 'use strict'; if (!Function.prototype.bind) @@ -28,9 +29,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,11 +92,13 @@ // Functionality $.Redactor = Redactor; - $.Redactor.VERSION = '10.0.1'; - $.Redactor.modules = ['core', 'build', 'lang', 'toolbar', 'button', 'dropdown', 'code', - 'clean', 'tidy', 'paragraphize', 'tabifier', 'focus', 'placeholder', 'autosave', 'buffer', 'indent', 'alignment', 'paste', - 'keydown', 'keyup', 'shortcuts', 'line', 'list', 'block', 'inline', 'insert', 'caret', 'selection', 'observe', - 'link', 'image', 'file', 'modal', 'progress', 'upload', 'utils']; + $.Redactor.VERSION = '10.2.5'; + $.Redactor.modules = ['alignment', 'autosave', 'block', 'buffer', 'build', 'button', + 'caret', 'clean', 'code', 'core', 'dropdown', 'file', 'focus', + 'image', 'indent', 'inline', 'insert', 'keydown', 'keyup', + 'lang', 'line', 'link', 'linkify', 'list', 'modal', 'observe', 'paragraphize', + 'paste', 'placeholder', 'progress', 'selection', 'shortcuts', + 'tabifier', 'tidy', 'toolbar', 'upload', 'utils']; $.Redactor.opts = { @@ -133,6 +133,7 @@ autosaveName: false, autosaveInterval: 60, // seconds autosaveOnChange: false, + autosaveFields: false, linkTooltip: true, linkProtocol: 'http', @@ -145,14 +146,14 @@ imageFloatMargin: '10px', imageResizable: true, - imageUpload: false, + imageUpload: null, imageUploadParam: 'file', uploadImageField: false, dragImageUpload: true, - fileUpload: false, + fileUpload: null, fileUploadParam: 'file', dragFileUpload: true, @@ -166,7 +167,7 @@ preSpaces: 4, // or false tabAsSpaces: false, // true or number of spaces - tabFocus: true, + tabKey: true, scrollTarget: false, @@ -177,7 +178,7 @@ toolbarExternal: false, // ID selector toolbarOverflow: false, - buttonSource: false, + source: true, buttons: ['html', 'formatting', 'bold', 'italic', 'deleted', 'unorderedlist', 'orderedlist', 'outdent', 'indent', 'image', 'file', 'link', 'alignment', 'horizontalrule'], // + 'underline' @@ -189,12 +190,17 @@ tabifier: true, - deniedTags: ['html', 'head', 'link', 'body', 'meta', 'script', 'style', 'applet'], + deniedTags: ['script', 'style'], allowedTags: false, // or array + paragraphizeBlocks: ['table', 'div', 'pre', 'form', 'ul', 'ol', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'dl', 'blockquote', 'figcaption', + 'address', 'section', 'header', 'footer', 'aside', 'article', 'object', 'style', 'script', 'iframe', 'select', 'input', 'textarea', + 'button', 'option', 'map', 'area', 'math', 'hr', 'fieldset', 'legend', 'hgroup', 'nav', 'figure', 'details', 'menu', 'summary', 'p'], + removeComments: false, replaceTags: [ - ['strike', 'del'] + ['strike', 'del'], + ['b', 'strong'] ], replaceStyles: [ ['font-weight:\\s?bold', "strong"], @@ -247,7 +253,10 @@ inlineTags: ['strong', 'b', 'u', 'em', 'i', 'code', 'del', 'ins', 'samp', 'kbd', 'sup', 'sub', 'mark', 'var', 'cite', 'small'], alignmentTags: ['P', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'DL', 'DT', 'DD', 'DIV', 'TD', 'BLOCKQUOTE', 'OUTPUT', 'FIGCAPTION', 'ADDRESS', 'SECTION', 'HEADER', 'FOOTER', 'ASIDE', 'ARTICLE'], blockLevelElements: ['PRE', 'UL', 'OL', 'LI'], - + highContrast: false, + observe: { + dropdowns: [] + }, // lang langs: { @@ -321,9 +330,21 @@ underline: 'Underline', alignment: 'Alignment', filename: 'Name (optional)', - edit: 'Edit' + edit: 'Edit', + 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: /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/ig, + } + }, + + codemirror: false }; // Functionality @@ -332,6 +353,7 @@ keyCode: { BACKSPACE: 8, DELETE: 46, + UP: 38, DOWN: 40, ENTER: 13, SPACE: 32, @@ -341,6 +363,7 @@ META: 91, SHIFT: 16, ALT: 18, + RIGHT: 39, LEFT: 37, LEFT_WIN: 91 }, @@ -368,6 +391,16 @@ // setup allowed and denied tags this.tidy.setupAllowed(); + // setup denied tags + if (this.opts.deniedTags !== false) + { + var tags = ['html', 'head', 'link', 'body', 'meta', 'applet']; + for (var i = 0; i < tags.length; i++) + { + this.opts.deniedTags.push(tags[i]); + } + } + // load lang this.lang.load(); @@ -422,2871 +455,6 @@ this[module][methods[z]] = this[module][methods[z]].bind(this); } }, - - core: function() - { - return { - getObject: function() - { - return $.extend({}, this); - }, - getEditor: function() - { - return this.$editor; - }, - getBox: function() - { - return this.$box; - }, - getElement: function() - { - return this.$element; - }, - getTextarea: function() - { - return this.$textarea; - }, - getToolbar: function() - { - return (this.$toolbar) ? this.$toolbar : false; - }, - addEvent: function(name) - { - this.core.event = name; - }, - getEvent: function() - { - return this.core.event; - }, - setCallback: function(type, e, data) - { - var callback = this.opts[type + 'Callback']; - if ($.isFunction(callback)) - { - return (typeof data == 'undefined') ? callback.call(this, e) : callback.call(this, e, data); - } - else - { - return (typeof data == 'undefined') ? e : data; - } - }, - destroy: function() - { - this.core.setCallback('destroy'); - - // off events and remove data - this.$element.off('.redactor').removeData('redactor'); - this.$editor.off('.redactor'); - - // common - this.$editor.removeClass('redactor-editor redactor-linebreaks redactor-placeholder'); - this.$editor.removeAttr('contenteditable'); - - var html = this.code.get(); - - if (this.build.isTextarea()) - { - this.$box.after(this.$element); - this.$box.remove(); - this.$element.val(html).show(); - } - else - { - this.$box.after(this.$editor); - this.$box.remove(); - this.$element.html(html).show(); - } - - // paste box - if (this.$pasteBox) this.$pasteBox.remove(); - - // modal - if (this.$modalBox) this.$modalBox.remove(); - if (this.$modalOverlay) this.$modalOverlay.remove(); - - // buttons tooltip - $('.redactor-toolbar-tooltip').remove(); - - // autosave - clearInterval(this.autosaveInterval); - - } - }; - }, - build: function() - { - return { - run: function() - { - - this.build.createContainerBox(); - this.build.loadContent(); - this.build.loadEditor(); - this.build.enableEditor(); - this.build.setCodeAndCall(); - - }, - isTextarea: function() - { - return (this.$element[0].tagName === 'TEXTAREA'); - }, - createContainerBox: function() - { - this.$box = $('
'); - }, - createTextarea: function() - { - this.$textarea = $('