vendor/assets/javascripts/sir-trevor.js in blacklight-spotlight-0.29.1 vs vendor/assets/javascripts/sir-trevor.js in blacklight-spotlight-0.30.0

- old
+ new

@@ -1875,20 +1875,20 @@ /***/ }, /* 26 */ /***/ function(module, exports) { - module.exports = function(module) { - if(!module.webpackPolyfill) { - module.deprecate = function() {}; - module.paths = []; - // module.parent = undefined by default - module.children = []; - module.webpackPolyfill = 1; - } - return module; - } + module.exports = function(module) { + if(!module.webpackPolyfill) { + module.deprecate = function() {}; + module.paths = []; + // module.parent = undefined by default + module.children = []; + module.webpackPolyfill = 1; + } + return module; + } /***/ }, /* 27 */ /***/ function(module, exports) { @@ -1897,11 +1897,11 @@ /***/ }, /* 28 */ /***/ function(module, exports) { - module.exports = function() { throw new Error("define cannot be used indirect"); }; + module.exports = function() { throw new Error("define cannot be used indirect"); }; /***/ }, /* 29 */ /***/ function(module, exports, __webpack_require__) { @@ -17052,11 +17052,16 @@ getScribeInnerContent: function getScribeInnerContent(block) { var content = ''; if (this._scribe.getTextContent() !== '') { var fakeContent = document.createElement('div'); fakeContent.innerHTML = this.getTextBlockHTML(); - content = fakeContent.firstChild.innerHTML || fakeContent.innerHTML; + + // We concatenate the content of each paragraph and take into account the new lines + content = fakeContent.children && Array.prototype.slice.call(fakeContent.children).reduce(function (res, child) { + return res + child.innerHTML; + }, '') || fakeContent.innerHTML; + return content.replace(/^[\s\uFEFF\xA0]+|$/g, ''); } return content; }, @@ -18788,11 +18793,11 @@ var onDeleteDeny = function onDeleteDeny(e) { e.preventDefault(); _this3.deleteEl.classList.remove("active"); }; - this.ui.insertAdjacentHTML("beforeend", DELETE_TEMPLATE); + this.ui.insertAdjacentHTML("beforeend", DELETE_TEMPLATE()); Events.delegate(this.el, ".js-st-block-confirm-delete", "click", this.onDeleteConfirm); Events.delegate(this.el, ".js-st-block-deny-delete", "click", onDeleteDeny); }, onDeleteClick: function onDeleteClick(e) { @@ -18880,23 +18885,12 @@ this.options.formatBar.commands.forEach(function (cmd) { if (_.isUndefined(cmd.keyCode)) { return; } - var ctrlDown = false; - - Events.delegate(block.el, '.st-text-block', 'keyup', function (ev) { - if (ev.which === 17 || ev.which === 224 || ev.which === 91) { - ctrlDown = false; - } - }); Events.delegate(block.el, '.st-text-block', 'keydown', function (ev) { - if (ev.which === 17 || ev.which === 224 || ev.which === 91) { - ctrlDown = true; - } - - if (ev.which === cmd.keyCode && ctrlDown) { + if ((ev.metaKey || ev.ctrlKey) && ev.keyCode === cmd.keyCode) { ev.preventDefault(); block.execTextBlockCommand(cmd.cmd); } }); }); @@ -19623,13 +19617,15 @@ /***/ }, /* 252 */ /***/ function(module, exports) { - 'use strict'; + "use strict"; - module.exports = '\n <div class="st-block__ui-delete-controls">\n <label class="st-block__delete-label">\n ' + i18n.t('general:delete') + '\n </label>\n <button class=\'st-block-ui__confirm js-st-block-confirm-delete\' type="button">\n ' + i18n.t('general:yes') + '\n </button>\n <button class=\'st-block-ui__confirm js-st-block-deny-delete\' type="button">\n ' + i18n.t('general:no') + '\n </button>\n </div>\n'; + module.exports = function () { + return '\n <div class="st-block__ui-delete-controls">\n <label class="st-block__delete-label">\n ' + i18n.t('general:delete') + '\n </label>\n <button class=\'st-block-ui__confirm js-st-block-confirm-delete\' type="button">\n ' + i18n.t('general:yes') + '\n </button>\n <button class=\'st-block-ui__confirm js-st-block-deny-delete\' type="button">\n ' + i18n.t('general:no') + '\n </button>\n </div>\n '; + }; /***/ }, /* 253 */ /***/ function(module, exports, __webpack_require__) { @@ -19762,10 +19758,18 @@ var selection = new scribe.api.Selection(); var range = selection.range.cloneRange(); range.setStartBefore(scribe.el.firstChild, 0); + var node = range.endContainer.nodeType === 3 ? range.endContainer.parentNode : range.endContainer; + + // We make sure that the caret must be inside the first element to consider + // it at the beginning of the block + if (scribe.el.firstChild !== node) { + return false; + } + return rangeToHTML(range, false) === ''; }; var getTotalLength = function getTotalLength() { var selection = new scribe.api.Selection(); @@ -20497,12 +20501,12 @@ loadData: function loadData(data) { if (_.isUndefined(data.status_url)) { data.status_url = ''; } - var iframe = this.inner.querySelector('iframe'); - Dom.remove(iframe); + var twitterwidget = this.inner.querySelector('twitterwidget'); + Dom.remove(twitterwidget); this.inner.insertAdjacentHTML("afterbegin", tweet_template(data)); var script = Dom.createElement('script', { src: '//platform.twitter.com/widgets.js' }); this.inner.appendChild(script); @@ -21630,6 +21634,6 @@ /***/ }, /* 280 */ 17 /******/ ]))) }); -; \ No newline at end of file +;