diff --git a/app/assets/javascripts/legacy/controllers/posts/edit.js b/app/assets/javascripts/legacy/controllers/posts/edit.js index c73141c7e..18cbaa1bf 100644 --- a/app/assets/javascripts/legacy/controllers/posts/edit.js +++ b/app/assets/javascripts/legacy/controllers/posts/edit.js @@ -55,7 +55,7 @@ angular.module('cortex.controllers.posts.edit', [ ImageFitService.initRedactorImageFitPlugin(); $scope.redactorOptions = { - plugins: ['media', 'imageFit'], + plugins: ['media', 'imageFit', 'inlinestyle'], minHeight: 800, buttonSource: true, deniedTags: ['html', 'head', 'link', 'body', 'applet'] // Allow script, style diff --git a/app/assets/javascripts/legacy/vendor/redactor.js b/app/assets/javascripts/legacy/vendor/redactor.js index 2ac60a744..fe045dbe3 100644 --- a/app/assets/javascripts/legacy/vendor/redactor.js +++ b/app/assets/javascripts/legacy/vendor/redactor.js @@ -1,6 +1,6 @@ /* - Redactor v10.0.6 - Updated: January 7, 2015 + Redactor 10.2.1 + Updated: July 6, 2015 http://imperavi.com/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,11 @@ // Functionality $.Redactor = Redactor; - $.Redactor.VERSION = '10.0.6'; + $.Redactor.VERSION = '10.2.2'; $.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', + 'lang', 'line', 'link', 'linkify', 'list', 'modal', 'observe', 'paragraphize', 'paste', 'placeholder', 'progress', 'selection', 'shortcuts', 'tabifier', 'tidy', 'toolbar', 'upload', 'utils']; @@ -135,6 +133,7 @@ autosaveName: false, autosaveInterval: 60, // seconds autosaveOnChange: false, + autosaveFields: false, linkTooltip: true, linkProtocol: 'http', @@ -147,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, @@ -173,15 +172,18 @@ scrollTarget: false, toolbar: true, - toolbarFixed: true, + /* concrete5 */ + /*toolbarFixed: true,*/ + toolbarFixed: false, + /* end concrete5 */ toolbarFixedTarget: document, toolbarFixedTopOffset: 0, // pixels 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' + 'outdent', 'indent', 'image', /* concrete5 'file', */ 'link', 'alignment', 'horizontalrule'], // + 'underline' buttonsHide: [], buttonsHideOnMobile: [], @@ -191,12 +193,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"], @@ -238,6 +245,12 @@ }, shortcutsAdd: false, + concrete5: { + filemanager: false, + sitemap: false, + lightbox: false + }, + // private buffer: [], rebuffer: [], @@ -249,7 +262,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: { @@ -295,7 +311,7 @@ columns: 'Columns', add_head: 'Add Head', delete_head: 'Delete Head', - title: 'Title', + alt: 'Alt', image_position: 'Position', none: 'None', left: 'Left', @@ -320,12 +336,45 @@ deleted: 'Deleted', anchor: 'Anchor', link_new_tab: 'Open link in new tab', + /* concrete5 */ + link_same_window: 'Open link in same window', + in_lightbox: 'Open link in Lightbox', + lightbox_link_type: 'Link Type', + lightbox_link_type_iframe: 'Web Page', + lightbox_link_type_image: 'Image', + lightbox_link_type_iframe_options: 'Frame Options', + lightbox_link_type_iframe_width: 'Width', + lightbox_link_type_iframe_height: 'Height', + customStyles: 'Custom Styles', + remove_font: 'Remove font', + change_font_family: 'Change font family', + remove_font_size: 'Remove font size', + change_font_size: 'Change font size', + remove_style: 'Remove Style', + insert_character: 'Insert Character', + undo: 'Undo', + redo: 'Redo', + remove_font_family: 'Remove Font Family', + // Remember to add new strings also in in /concrete/controllers/frontend/assets_localization.php, function getRedactorJavascript + /* end concrete5 */ 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 @@ -334,6 +383,7 @@ keyCode: { BACKSPACE: 8, DELETE: 46, + UP: 38, DOWN: 40, ENTER: 13, SPACE: 32, @@ -371,6 +421,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(); @@ -425,7 +485,6 @@ this[module][methods[z]] = this[module][methods[z]].bind(this); } }, - alignment: function() { return { @@ -447,92 +506,129 @@ }, set: function(type) { + // focus if (!this.utils.browser('msie')) this.$editor.focus(); this.buffer.set(); this.selection.save(); + // get blocks this.alignment.blocks = this.selection.getBlocks(); - if (this.opts.linebreaks && this.alignment.blocks[0] === false) + this.alignment.type = type; + + // set alignment + if (this.alignment.isLinebreaksOrNoBlocks()) { - this.alignment.setText(type); + this.alignment.setText(); } else { - this.alignment.setBlocks(type); + this.alignment.setBlocks(); } + // sync this.selection.restore(); this.code.sync(); }, - setText: function(type) + setText: function() { var wrapper = this.selection.wrap('div'); - $(wrapper).attr('data-tagblock', 'redactor'); - $(wrapper).css('text-align', type); + $(wrapper).attr('data-tagblock', 'redactor').css('text-align', this.alignment.type); }, - setBlocks: function(type) + setBlocks: function() { $.each(this.alignment.blocks, $.proxy(function(i, el) { var $el = this.utils.getAlignmentElement(el); - if (!$el) return; - if (type === '' && typeof($el.data('tagblock')) !== 'undefined') + if (this.alignment.isNeedReplaceElement($el)) { - $el.replaceWith($el.html()); + this.alignment.replaceElement($el); } else { - $el.css('text-align', type); - this.utils.removeEmptyAttr($el, 'style'); + this.alignment.alignElement($el); } - }, this)); + }, + isLinebreaksOrNoBlocks: function() + { + return (this.opts.linebreaks && this.alignment.blocks[0] === false); + }, + isNeedReplaceElement: function($el) + { + return (this.alignment.type === '' && typeof($el.data('tagblock')) !== 'undefined'); + }, + replaceElement: function($el) + { + $el.replaceWith($el.html()); + }, + alignElement: function($el) + { + $el.css('text-align', this.alignment.type); + this.utils.removeEmptyAttr($el, 'style'); } }; }, 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) - { - this.autosaveInterval = setInterval($.proxy(this.autosave.load, this), this.opts.autosaveInterval * 1000); - } + if (this.opts.autosaveOnChange) return; + this.autosaveInterval = setInterval(this.autosave.load, this.opts.autosaveInterval * 1000); }, onChange: function() { if (!this.opts.autosaveOnChange) return; - this.autosave.load(); }, load: function() { - var html = this.code.get(); - if (this.autosave.html === html) return; - if (this.utils.isEmpty(html)) return; + this.autosave.source = this.code.get(); - $.ajax({ + if (this.autosave.html === this.autosave.source) return; + + // data + var data = {}; + data['name'] = this.autosave.name; + data[this.autosave.name] = this.autosave.source; + data = this.autosave.getHiddenFields(data); + + // ajax + var jsxhr = $.ajax({ url: this.opts.autosave, type: 'post', - data: 'name=' + this.autosave.name + '&' + this.autosave.name + '=' + escape(encodeURIComponent(html)), - success: $.proxy(function(data) - { - this.autosave.success(data, html); - - }, this) + data: data }); + + jsxhr.done(this.autosave.success); + }, + getHiddenFields: function(data) + { + if (this.opts.autosaveFields === false || typeof this.opts.autosaveFields !== 'object') + { + return data; + } + + $.each(this.opts.autosaveFields, $.proxy(function(k, v) + { + if (v !== null && v.toString().indexOf('#') === 0) v = $(v).val(); + data[k] = v; + + }, this)); + + return data; + }, - success: function(data, html) + success: function(data) { var json; try @@ -548,7 +644,7 @@ var callbackName = (typeof json.error == 'undefined') ? 'autosave' : 'autosaveError'; this.core.setCallback(callbackName, this.autosave.name, json); - this.autosave.html = html; + this.autosave.html = this.autosave.source; }, disable: function() { @@ -566,7 +662,7 @@ if (typeof this.formatting[name].data != 'undefined') type = 'data'; else if (typeof this.formatting[name].attr != 'undefined') type = 'attr'; - else if (typeof this.formatting[name].class != 'undefined') type = 'class'; + else if (typeof this.formatting[name]['class'] != 'undefined') type = 'class'; if (typeof this.formatting[name].clear != 'undefined') { @@ -590,6 +686,23 @@ // focus if (!this.utils.browser('msie')) this.$editor.focus(); + var html = $.trim(this.$editor.html()); + this.block.isEmpty = this.utils.isEmpty(html); + + // FF focus + if (this.utils.browser('mozilla') && !this.focus.isFocused()) + { + if (this.block.isEmpty) + { + var $first; + if (!this.opts.linebreaks) + { + $first = this.$editor.children().first(); + this.caret.setEnd($first); + } + } + } + this.block.blocks = this.selection.getBlocks(); this.block.blocksSize = this.block.blocks.length; @@ -603,10 +716,12 @@ this.selection.restore(); this.code.sync(); + this.observe.load(); }, set: function(tag) { + this.selection.get(); this.block.containerTag = this.range.commonAncestorContainer.tagName; @@ -621,6 +736,16 @@ }, setCollapsed: function(tag) { + if (this.opts.linebreaks && this.block.isEmpty && tag != 'p') + { + var node = document.createElement(tag); + this.$editor.html(node); + this.caret.setEnd(node); + + return; + } + + var block = this.block.blocks[0]; if (block === false) return; @@ -635,7 +760,6 @@ var isContainerTable = (this.block.containerTag == 'TD' || this.block.containerTag == 'TH'); if (isContainerTable && !this.opts.linebreaks) { - document.execCommand('formatblock', false, '<' + tag + '>'); block = this.selection.getBlock(); @@ -646,7 +770,7 @@ { if (this.opts.linebreaks && tag == 'p') { - $(block).prepend('
').append('
'); + $(block).append('
'); this.utils.replaceWithContents(block); } else @@ -667,7 +791,7 @@ // blockquote off if (this.opts.linebreaks) { - $(block).prepend('
').append('
'); + $(block).append('
'); this.utils.replaceWithContents(block); } else @@ -681,6 +805,13 @@ this.block.toggle($(block)); } + + + if (typeof this.block.type == 'undefined' && typeof this.block.value == 'undefined') + { + $(block).removeAttr('class').removeAttr('style'); + } + }, setMultiple: function(tag) { @@ -694,7 +825,7 @@ // blockquote off if (this.opts.linebreaks) { - $(block).prepend('
').append('
'); + $(block).append('
'); this.utils.replaceWithContents(block); } else @@ -756,14 +887,20 @@ { $.each(this.block.blocks, $.proxy(function(i,s) { + var $formatted = false; if (this.opts.linebreaks) { $(s).prepend('
').append('
'); - this.utils.replaceWithContents(s); + $formatted = this.utils.replaceWithContents(s); } else { - this.utils.replaceToTag(s, 'p'); + $formatted = this.utils.replaceToTag(s, 'p'); + } + + if ($formatted && typeof this.block.type == 'undefined' && typeof this.block.value == 'undefined') + { + $formatted.removeAttr('class').removeAttr('style'); } }, this)); @@ -782,7 +919,7 @@ if (this.block.type == 'class') { toggleType = 'toggle'; - classSize = $(this.block.blocks).filter('.' + this.block.value).size(); + classSize = $(this.block.blocks).filter('.' + this.block.value).length; if (this.block.blocksSize == classSize) toggleType = 'toggle'; else if (this.block.blocksSize > classSize) toggleType = 'set'; @@ -809,6 +946,11 @@ if (this.block.isRemoveInline) this.utils.removeInlineTags($formatted); if (tag == 'p' || this.block.headTag) $formatted.find('p').contents().unwrap(); + if (typeof this.block.type == 'undefined' && typeof this.block.value == 'undefined') + { + $formatted.removeAttr('class').removeAttr('style'); + } + }, this)); } @@ -871,7 +1013,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(); @@ -930,11 +1072,6 @@ var $elements = $formatted.find(this.opts.blockLevelElements.join(',') + ', td, table, thead, tbody, tfoot, th, tr'); - if ((this.opts.linebreaks && tag == 'p') || tag == 'pre' || tag == 'blockquote') - { - $elements.append('
'); - } - $elements.contents().unwrap(); if (tag != 'p' && tag != 'blockquote') $formatted.find('img').remove(); @@ -961,13 +1098,24 @@ this.utils.replaceWithContents($formatted); } + if (this.opts.linebreaks) + { + var $next = $formatted.next().next(); + if ($next.size() != 0 && $next[0].tagName === 'BR') + { + $next.remove(); + } + } + + + }, formatTableWrapping: function($formatted) { - if ($formatted.closest('table').size() === 0) return; + if ($formatted.closest('table', this.$editor[0]).length === 0) return; - if ($formatted.closest('tr').size() === 0) $formatted.wrap(''); - if ($formatted.closest('td').size() === 0 && $formatted.closest('th').size() === 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(''); } @@ -1122,13 +1270,11 @@ return { run: function() { - this.build.createContainerBox(); this.build.loadContent(); this.build.loadEditor(); this.build.enableEditor(); this.build.setCodeAndCall(); - }, isTextarea: function() { @@ -1136,7 +1282,7 @@ }, createContainerBox: function() { - this.$box = $('
'); + this.$box = $('
'); }, createTextarea: function() { @@ -1144,13 +1290,7 @@ }, getTextareaName: function() { - var name = this.$element.attr('id'); - if (typeof(name) == 'undefined') - { - name = 'content-' + this.uuid; - } - - return name; + return ((typeof(name) == 'undefined')) ? 'content-' + this.uuid : this.$element.attr('id'); }, loadContent: function() { @@ -1193,14 +1333,13 @@ this.build.callEditor(); // code mode - if (!this.opts.visual) - { - setTimeout($.proxy(this.code.showCode, this), 200); - } + if (this.opts.visual) return; + setTimeout($.proxy(this.code.showCode, this), 200); }, callEditor: function() { this.build.disableMozillaEditing(); + this.build.disableIeLinks(); this.build.setEvents(); this.build.setHelpers(); @@ -1236,6 +1375,21 @@ if (this.opts.maxHeight) this.$editor.css('maxHeight', this.opts.maxHeight); }, + setEventDropUpload: function(e) + { + e.preventDefault(); + + if (!this.opts.dragImageUpload || !this.opts.dragFileUpload) return; + + var files = e.dataTransfer.files; + this.upload.directUpload(files[0], e); + }, + setEventDrop: function(e) + { + this.code.sync(); + setTimeout(this.clean.clearUnverified, 1); + this.core.setCallback('drop', e); + }, setEvents: function() { // drop @@ -1245,28 +1399,16 @@ if (window.FormData === undefined || !e.dataTransfer) return true; - var length = e.dataTransfer.files.length; - if (length === 0) + if (e.dataTransfer.files.length === 0) { - this.code.sync(); - setTimeout($.proxy(this.clean.clearUnverified, this), 1); - this.core.setCallback('drop', e); - - return true; + return this.build.setEventDrop(e); } else { - e.preventDefault(); - - if (this.opts.dragImageUpload || this.opts.dragFileUpload) - { - var files = e.dataTransfer.files; - this.upload.directUpload(files[0], e); - } + this.build.setEventDropUpload(e); } - setTimeout($.proxy(this.clean.clearUnverified, this), 1); - + setTimeout(this.clean.clearUnverified, 1); this.core.setCallback('drop', e); }, this)); @@ -1275,11 +1417,8 @@ // click this.$editor.on('click.redactor', $.proxy(function(e) { - var type = 'click'; - if ((this.core.getEvent() == 'click' || this.core.getEvent() == 'arrow')) - { - type = false; - } + var event = this.core.getEvent(); + var type = (event == 'click' || event == 'arrow') ? false : 'click'; this.core.addEvent(type); this.utils.disableSelectAll(); @@ -1290,6 +1429,9 @@ // paste this.$editor.on('paste.redactor', $.proxy(this.paste.init, this)); + // cut + this.$editor.on('cut.redactor', $.proxy(this.code.sync, this)); + // keydown this.$editor.on('keydown.redactor', $.proxy(this.keydown.init, this)); @@ -1314,56 +1456,61 @@ this.$editor.on('focus.redactor', $.proxy(this.opts.focusCallback, this)); } - var clickedElement; - $(document).on('mousedown', function(e) { - clickedElement = $(e.target); - }); + $(document).on('mousedown.redactor.' + this.uuid, $.proxy(function(e) { this.blurClickedElement = e.target; }, this)); + // blur this.$editor.on('blur.redactor', $.proxy(function(e) { + if (this.start) return; if (this.rtePaste) return; + if (!this.build.isBlured()) return; + + this.utils.disableSelectAll(); + if ($.isFunction(this.opts.blurCallback)) this.core.setCallback('blur', e); - var $el = $(clickedElement); - if (!$el.hasClass('redactor-toolbar, redactor-dropdown') && !$el.is('#redactor-modal') && $el.parents('.redactor-toolbar, .redactor-dropdown, #redactor-modal').size() === 0) - { - this.utils.disableSelectAll(); - if ($.isFunction(this.opts.blurCallback)) this.core.setCallback('blur', e); - } }, this)); }, + isBlured: function() + { + if (this.blurClickedElement === true) return true; + + var $el = $(this.blurClickedElement); + + return (!$el.hasClass('redactor-toolbar, redactor-dropdown') && !$el.is('#redactor-modal') && $el.parents('.redactor-toolbar, .redactor-dropdown, #redactor-modal').length === 0); + }, setHelpers: function() { - // autosave - this.autosave.enable(); + // linkify + if (this.linkify.isEnabled()) + { + this.linkify.format(); + } // placeholder this.placeholder.enable(); // focus - if (this.opts.focus) setTimeout($.proxy(this.focus.setStart, this), 100); - if (this.opts.focusEnd) setTimeout($.proxy(this.focus.setEnd, this), 100); + if (this.opts.focus) setTimeout(this.focus.setStart, 100); + if (this.opts.focusEnd) setTimeout(this.focus.setEnd, 100); }, plugins: function() { if (!this.opts.plugins) return; - if (!RedactorPlugins) return; $.each(this.opts.plugins, $.proxy(function(i, s) { - if (typeof RedactorPlugins[s] === 'undefined') return; + var func = (typeof RedactorPlugins !== 'undefined' && typeof RedactorPlugins[s] !== 'undefined') ? RedactorPlugins : Redactor.fn; - if ($.inArray(s, $.Redactor.modules) !== -1) + if (!$.isFunction(func[s])) { - $.error('Plugin name "' + s + '" matches the name of the Redactor\'s module.'); return; } - if (!$.isFunction(RedactorPlugins[s])) return; - - this[s] = RedactorPlugins[s](); + this[s] = func[s](); + // get methods var methods = this.getModuleMethods(this[s]); var len = methods.length; @@ -1373,12 +1520,14 @@ this[s][methods[z]] = this[s][methods[z]].bind(this); } - if ($.isFunction(this[s].init)) this[s].init(); + if ($.isFunction(this[s].init)) + { + this[s].init(); + } }, this)); - }, disableMozillaEditing: function() { @@ -1389,44 +1538,85 @@ document.execCommand('enableObjectResizing', false, false); document.execCommand('enableInlineTableEditing', false, false); } catch (e) {} + }, + disableIeLinks: function() + { + if (!this.utils.browser('msie')) return; + + // IE prevent converting links + document.execCommand("AutoUrlDetect", false, false); } }; }, button: function() { return { + /* concrete5 */ + getClass: function(btnName) + { + switch(btnName) { + case 'html': + return 'fa fa-code'; + case 'formatting': + case 'formatting-concrete5': + return 'fa fa-paragraph'; + case 'orderedlist': + return 'fa fa-list-ol'; + case 'unorderedlist': + return 'fa fa-list-ul'; + case 'video': + return 'fa fa-file-video-o'; + case 'alignment': + return 'fa fa-align-left'; + case 'horizontalrule': + return 'fa fa-minus'; + case 'deleted': + return 'fa fa-strikethrough'; + case 'fontfamily': + return 'fa fa-font'; + case 'fontsize': + return 'fa fa-text-height'; + case 'fontcolor': + return 'fa fa-tint'; + case 'backcolor': + return 'fa fa-tint'; + case 'bold': + return 'fa fa-bold'; + case 'italic': + return 'fa fa-italic'; + case 'outdent': + return 'fa fa-outdent'; + case 'indent': + return 'fa fa-indent'; + case 'image': + return 'fa fa-image'; + case 'link': + return 'fa fa-link'; + } + }, + + /* end concrete5 */ build: function(btnName, btnObject) { - var $button = $('').attr('tabindex', '-1'); + /* concrete5 */ + //var $button = $('').attr('tabindex', '-1'); + var $button = $('').attr('tabindex', '-1'); + /* end concrete5 */ + // click if (btnObject.func || btnObject.command || btnObject.dropdown) { - $button.on('touchstart click', $.proxy(function(e) - { - if ($button.hasClass('redactor-button-disabled')) return false; - - var type = 'func'; - var callback = btnObject.func; - if (btnObject.command) - { - type = 'command'; - callback = btnObject.command; - } - else if (btnObject.dropdown) - { - type = 'dropdown'; - callback = false; - } - - this.button.onClick(e, btnName, type, callback); - - }, this)); + this.button.setEvent($button, btnName, btnObject); } // dropdown if (btnObject.dropdown) { - var $dropdown = $('