<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][9246] trunk/src/bp-core/js: Update atwho.js and caret.js to versions 0.5.2 and 0.2.1, respectively.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://buddypress.trac.wordpress.org/changeset/9246">9246</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://buddypress.trac.wordpress.org/changeset/9246","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>djpaul</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2014-12-21 11:08:39 +0000 (Sun, 21 Dec 2014)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Update atwho.js and caret.js to versions 0.5.2 and 0.2.1, respectively.
These libraries are used in the @mentions suggestions UI.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpcorejsjqueryatwhojs">trunk/src/bp-core/js/jquery.atwho.js</a></li>
<li><a href="#trunksrcbpcorejsjquerycaretjs">trunk/src/bp-core/js/jquery.caret.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpcorejsjqueryatwhojs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-core/js/jquery.atwho.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-core/js/jquery.atwho.js 2014-12-20 22:30:12 UTC (rev 9245)
+++ trunk/src/bp-core/js/jquery.atwho.js 2014-12-21 11:08:39 UTC (rev 9246)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,18 +1,24 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/*! jquery.atwho - v0.5.1 - 2014-09-21
-* Copyright (c) 2014 chord.luo <chord.luo@gmail.com>;
-* homepage: http://ichord.github.com/At.js
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/*! jquery.atwho - v0.5.2 %>
+* Copyright (c) 2014 chord.luo <chord.luo@gmail.com>;
+* homepage: http://ichord.github.com/At.js
</ins><span class="cx" style="display: block; padding: 0 10px"> * Licensed MIT
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+(function (root, factory) {
+ if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define(["jquery"], function ($) {
+ return (root.returnExportsGlobal = factory($));
+ });
+ } else if (typeof exports === 'object') {
+ // Node. Does not work with strict CommonJS, but
+ // only CommonJS-like enviroments that support module.exports,
+ // like Node.
+ module.exports = factory(require("jquery"));
+ } else {
+ factory(jQuery);
+ }
+}(this, function ($) {
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-(function() {
- (function(factory) {
- if (typeof define === 'function' && define.amd) {
- return define(['jquery'], factory);
- } else {
- return factory(window.jQuery);
- }
- })(function($) {
-
</del><span class="cx" style="display: block; padding: 0 10px"> var Api, App, Controller, DEFAULT_CALLBACKS, KEY_CODE, Model, View,
</span><span class="cx" style="display: block; padding: 0 10px"> __slice = [].slice;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -115,8 +121,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> })(this)).on('click.atwhoInner', (function(_this) {
</span><span class="cx" style="display: block; padding: 0 10px"> return function(e) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var _ref;
- return (_ref = _this.controller()) != null ? _ref.view.hide(e) : void 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return _this.dispatch();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> })(this));
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -300,10 +305,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> Controller.prototype.content = function() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var range;
</ins><span class="cx" style="display: block; padding: 0 10px"> if (this.$inputor.is('textarea, input')) {
</span><span class="cx" style="display: block; padding: 0 10px"> return this.$inputor.val();
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return this.$inputor.text();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!(range = this.mark_range())) {
+ return;
+ }
+ return (range.startContainer.textContent || "").slice(0, range.startOffset);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -388,15 +397,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> Controller.prototype.insert = function(content, $li) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var $inputor, content_node, pos, range, sel, source, start_str, text, wrapped_content;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $inputor, node, pos, range, sel, source, start_str, text, wrapped_contents, _i, _len, _ref;
</ins><span class="cx" style="display: block; padding: 0 10px"> $inputor = this.$inputor;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wrapped_content = this.callbacks('inserting_wrapper').call(this, $inputor, content, this.get_opt("suffix"));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wrapped_contents = this.callbacks('inserting_wrapper').call(this, $inputor, content, this.get_opt("suffix"));
</ins><span class="cx" style="display: block; padding: 0 10px"> if ($inputor.is('textarea, input')) {
</span><span class="cx" style="display: block; padding: 0 10px"> source = $inputor.val();
</span><span class="cx" style="display: block; padding: 0 10px"> start_str = source.slice(0, Math.max(this.query.head_pos - this.at.length, 0));
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- text = "" + start_str + wrapped_content + (source.slice(this.query['end_pos'] || 0));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ text = "" + start_str + wrapped_contents + (source.slice(this.query['end_pos'] || 0));
</ins><span class="cx" style="display: block; padding: 0 10px"> $inputor.val(text);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $inputor.caret('pos', start_str.length + wrapped_content.length, {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $inputor.caret('pos', start_str.length + wrapped_contents.length, {
</ins><span class="cx" style="display: block; padding: 0 10px"> iframe: this.app.iframe
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> } else if (range = this.range) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -404,16 +413,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> range.setStart(range.endContainer, Math.max(pos, 0));
</span><span class="cx" style="display: block; padding: 0 10px"> range.setEnd(range.endContainer, range.endOffset);
</span><span class="cx" style="display: block; padding: 0 10px"> range.deleteContents();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- content_node = $(wrapped_content, this.app.document)[0];
- range.insertNode(content_node);
- range.setEndAfter(content_node);
- range.collapse(false);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ _ref = $(wrapped_contents, this.app.document);
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ node = _ref[_i];
+ range.insertNode(node);
+ range.setEndAfter(node);
+ range.collapse(false);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> sel = this.app.window.getSelection();
</span><span class="cx" style="display: block; padding: 0 10px"> sel.removeAllRanges();
</span><span class="cx" style="display: block; padding: 0 10px"> sel.addRange(range);
</span><span class="cx" style="display: block; padding: 0 10px"> } else if (range = this.ie8_range) {
</span><span class="cx" style="display: block; padding: 0 10px"> range.moveStart('character', this.query.end_pos - this.query.head_pos - this.at.length);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- range.pasteHTML(wrapped_content);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ range.pasteHTML(wrapped_contents);
</ins><span class="cx" style="display: block; padding: 0 10px"> range.collapse(false);
</span><span class="cx" style="display: block; padding: 0 10px"> range.select();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -541,8 +553,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return $menu.on('mouseenter.atwho-view', 'li', function(e) {
</span><span class="cx" style="display: block; padding: 0 10px"> $menu.find('.cur').removeClass('cur');
</span><span class="cx" style="display: block; padding: 0 10px"> return $(e.currentTarget).addClass('cur');
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }).on('click', (function(_this) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }).on('click.atwho-view', 'li', (function(_this) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return function(e) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $menu.find('.cur').removeClass('cur');
+ $(e.currentTarget).addClass('cur');
</ins><span class="cx" style="display: block; padding: 0 10px"> _this.choose(e);
</span><span class="cx" style="display: block; padding: 0 10px"> return e.preventDefault();
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -593,7 +607,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if (!next.length) {
</span><span class="cx" style="display: block; padding: 0 10px"> next = this.$el.find('li:first');
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return next.addClass('cur');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ next.addClass('cur');
+ return this.$el.animate({
+ scrollTop: Math.max(0, cur.innerHeight() * (next.index() + 2) - this.$el.height())
+ }, 150);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> View.prototype.prev = function() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -603,7 +620,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if (!prev.length) {
</span><span class="cx" style="display: block; padding: 0 10px"> prev = this.$el.find('li:last');
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return prev.addClass('cur');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ prev.addClass('cur');
+ return this.$el.animate({
+ scrollTop: Math.max(0, cur.innerHeight() * (prev.index() + 2) - this.$el.height())
+ }, 150);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> View.prototype.show = function() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -615,6 +635,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> this.context.mark_range();
</span><span class="cx" style="display: block; padding: 0 10px"> if (!this.visible()) {
</span><span class="cx" style="display: block; padding: 0 10px"> this.$el.show();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.$el.scrollTop(0);
</ins><span class="cx" style="display: block; padding: 0 10px"> this.context.trigger('shown');
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> if (rect = this.context.rect()) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -702,12 +723,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return _results;
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> matcher: function(flag, subtext, should_start_with_space) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var match, regexp;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var match, regexp, _a, _y;
</ins><span class="cx" style="display: block; padding: 0 10px"> flag = flag.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
</span><span class="cx" style="display: block; padding: 0 10px"> if (should_start_with_space) {
</span><span class="cx" style="display: block; padding: 0 10px"> flag = '(?:^|\\s)' + flag;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- regexp = new RegExp(flag + '([A-Za-zÀ-ÿ0-9_\+\-]*)$|' + flag + '([^\\x00-\\xff]*)$', 'gi');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ _a = decodeURI("%C3%80");
+ _y = decodeURI("%C3%BF");
+ regexp = new RegExp("" + flag + "([A-Za-z" + _a + "-" + _y + "0-9_\+\-]*)$|" + flag + "([^\\x00-\\xff]*)$", 'gi');
</ins><span class="cx" style="display: block; padding: 0 10px"> match = regexp.exec(subtext);
</span><span class="cx" style="display: block; padding: 0 10px"> if (match) {
</span><span class="cx" style="display: block; padding: 0 10px"> return match[2] || match[1];
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -769,22 +792,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return value;
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> inserting_wrapper: function($inputor, content, suffix) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var new_suffix, wrapped_content;
- new_suffix = suffix === "" ? suffix : suffix || " ";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var wrapped_content;
+ suffix = suffix === "" ? suffix : suffix || " ";
</ins><span class="cx" style="display: block; padding: 0 10px"> if ($inputor.is('textarea, input')) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return '' + content + new_suffix;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return '' + content + suffix;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else if ($inputor.attr('contentEditable') === 'true') {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- new_suffix = suffix === "" ? suffix : suffix || " ";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ suffix = suffix === " " ? " " : suffix;
</ins><span class="cx" style="display: block; padding: 0 10px"> if (/firefox/i.test(navigator.userAgent)) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wrapped_content = "<span>" + content + new_suffix + "</span>";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wrapped_content = "<span>" + content + suffix + "</span>";
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- suffix = "<span contenteditable='false'>" + new_suffix + "<span>";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ suffix = "<span contenteditable='false'>" + suffix + "</span>";
</ins><span class="cx" style="display: block; padding: 0 10px"> wrapped_content = "<span contenteditable='false'>" + content + suffix + "</span>";
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> if (this.app.document.selection) {
</span><span class="cx" style="display: block; padding: 0 10px"> wrapped_content = "<span contenteditable='true'>" + content + "</span>";
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return wrapped_content;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return wrapped_content + "<span></span>";
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -847,5 +870,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> delay: null
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-}).call(this);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+
+}));
</ins></span></pre></div>
<a id="trunksrcbpcorejsjquerycaretjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-core/js/jquery.caret.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-core/js/jquery.caret.js 2014-12-20 22:30:12 UTC (rev 9245)
+++ trunk/src/bp-core/js/jquery.caret.js 2014-12-21 11:08:39 UTC (rev 9246)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -84,21 +84,34 @@
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> EditableCaret.prototype.getOffset = function(pos) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var clonedRange, offset, range, rect;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var clonedRange, offset, range, rect, shadowCaret;
</ins><span class="cx" style="display: block; padding: 0 10px"> if (oWindow.getSelection && (range = this.range())) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (range.endOffset - 1 < 0) {
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (range.endOffset - 1 > 0 && range.endContainer === !this.domInputor) {
+ clonedRange = range.cloneRange();
+ clonedRange.setStart(range.endContainer, range.endOffset - 1);
+ clonedRange.setEnd(range.endContainer, range.endOffset);
+ rect = clonedRange.getBoundingClientRect();
+ offset = {
+ height: rect.height,
+ left: rect.left + rect.width,
+ top: rect.top
+ };
+ clonedRange.detach();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- clonedRange = range.cloneRange();
- clonedRange.setStart(range.endContainer, range.endOffset - 1);
- clonedRange.setEnd(range.endContainer, range.endOffset);
- rect = clonedRange.getBoundingClientRect();
- offset = {
- height: rect.height,
- left: rect.left + rect.width,
- top: rect.top
- };
- clonedRange.detach();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!offset || (offset != null ? offset.height : void 0) === 0) {
+ clonedRange = range.cloneRange();
+ shadowCaret = $(oDocument.createTextNode("|"));
+ clonedRange.insertNode(shadowCaret[0]);
+ clonedRange.selectNode(shadowCaret[0]);
+ rect = clonedRange.getBoundingClientRect();
+ offset = {
+ height: rect.height,
+ left: rect.left,
+ top: rect.top
+ };
+ shadowCaret.remove();
+ clonedRange.detach();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> } else if (oDocument.selection) {
</span><span class="cx" style="display: block; padding: 0 10px"> offset = this.getOldIEOffset();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -211,7 +224,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> var $inputor, at_rect, end_range, format, html, mirror, start_range;
</span><span class="cx" style="display: block; padding: 0 10px"> $inputor = this.$inputor;
</span><span class="cx" style="display: block; padding: 0 10px"> format = function(value) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return $('<div></div>').text(value).html();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $('<div></div>').text(value).html().replace(/\r\n|\r|\n/g, "<br/>").replace(/\s/g, " ");
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> if (pos === void 0) {
</span><span class="cx" style="display: block; padding: 0 10px"> pos = this.getPos();
</span></span></pre>
</div>
</div>
</body>
</html>