diff --git a/ImperaviRedactorWidget.php b/ImperaviRedactorWidget.php index c1476d3..58ffaae 100644 --- a/ImperaviRedactorWidget.php +++ b/ImperaviRedactorWidget.php @@ -9,7 +9,7 @@ * @author Veaceslav Medvedev * @author Alexander Makarov * - * @version 1.3.8 + * @version 1.3.9 * * @link https://github.com/yiiext/imperavi-redactor-widget * @link http://imperavi.com/redactor diff --git a/assets/redactor.css b/assets/redactor.css index 57aa6e2..a3109f0 100755 --- a/assets/redactor.css +++ b/assets/redactor.css @@ -38,29 +38,31 @@ .redactor-box textarea:focus { outline: none; } -/* - Z-index setup -*/ .redactor-editor, .redactor-box { background: #fff; } +/* + Z-index setup +*/ .redactor-editor, .redactor-box, .redactor-box textarea { - z-index: auto !important; + z-index: auto; } .redactor-box-fullscreen { - z-index: 1052 !important; + z-index: 1051; +} +.redactor-toolbar { + z-index: 100; } -.redactor-toolbar, .redactor-dropdown { - z-index: 1053 !important; + z-index: 1052; } #redactor-modal-overlay, #redactor-modal-box, #redactor-modal { - z-index: 1054 !important; + z-index: 1053; } /* Resize @@ -111,6 +113,9 @@ body .redactor-box-fullscreen { .redactor-editor:focus { outline: none; } +.toolbar-fixed-box + .redactor-editor { + padding-top: 32px !important; +} /* Placeholder */ @@ -650,7 +655,7 @@ body .redactor-box-fullscreen { padding-left: 0; list-style: none; max-height: 250px; - overflow-x: scroll; + overflow-x: auto; } #redactor-modal #redactor-modal-list li { border-bottom: 1px solid #ddd; diff --git a/assets/redactor.js b/assets/redactor.js index 23baa5c..3705a16 100755 --- a/assets/redactor.js +++ b/assets/redactor.js @@ -1,6 +1,6 @@ /* - Redactor v10.0.7 - Updated: January 31, 2015 + Redactor v10.0.9 + Updated: March 16, 2015 http://imperavi.com/redactor/ @@ -94,7 +94,7 @@ // Functionality $.Redactor = Redactor; - $.Redactor.VERSION = '10.0.7'; + $.Redactor.VERSION = '10.0.9'; $.Redactor.modules = ['alignment', 'autosave', 'block', 'buffer', 'build', 'button', 'caret', 'clean', 'code', 'core', 'dropdown', 'file', 'focus', 'image', 'indent', 'inline', 'insert', 'keydown', 'keyup', @@ -135,6 +135,7 @@ autosaveName: false, autosaveInterval: 60, // seconds autosaveOnChange: false, + autosaveFields: false, linkTooltip: true, linkProtocol: 'http', @@ -191,7 +192,7 @@ tabifier: true, - deniedTags: ['html', 'head', 'link', 'body', 'meta', 'script', 'style', 'applet'], + deniedTags: ['script', 'style'], allowedTags: false, // or array removeComments: false, @@ -323,7 +324,9 @@ underline: 'Underline', alignment: 'Alignment', filename: 'Name (optional)', - edit: 'Edit' + edit: 'Edit', + upload_label: 'Drop file here or ' + } } }; @@ -371,6 +374,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(); @@ -541,7 +554,8 @@ // data var data = {}; data['name'] = this.autosave.name; - data[this.autosave.name] = escape(encodeURIComponent(this.autosave.source)); + data[this.autosave.name] = this.autosave.source; + data = this.autosave.getHiddenFields(data); // ajax var jsxhr = $.ajax({ @@ -552,6 +566,23 @@ 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) { var json; @@ -586,7 +617,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') { @@ -701,6 +732,11 @@ this.block.toggle($(block)); } + if (typeof this.block.type == 'undefined' && typeof this.block.value == 'undefined') + { + $(block).removeAttr('class').removeAttr('style'); + } + }, setMultiple: function(tag) { @@ -777,14 +813,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)); @@ -831,6 +873,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)); } @@ -1422,7 +1469,7 @@ // dropdown if (btnObject.dropdown) { - var $dropdown = $('