From 44561baa915a7576beeb807a01f8c1f6f4a87b01 Mon Sep 17 00:00:00 2001 From: Jason Hutchens Date: Tue, 19 Sep 2017 11:09:54 +0800 Subject: [PATCH] upgrade to 1.5.4 --- bower.json | 4 +- .../javascripts/jquery.atwho/jquery.atwho.js | 47 +++++++++---------- lib/jquery-atwho-rails/version.rb | 2 +- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/bower.json b/bower.json index 122e915..52b79cb 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "jquery-atwho-rails", - "version": "1.5.2", + "version": "1.5.4", "homepage": "https://github.com/ichord/jquery-atwho-rails", "authors": [ "ichord " @@ -14,6 +14,6 @@ "tests" ], "dependencies": { - "At.js": "~1.5.2" + "At.js": "~1.5.4" } } diff --git a/lib/assets/javascripts/jquery.atwho/jquery.atwho.js b/lib/assets/javascripts/jquery.atwho/jquery.atwho.js index 1349388..795b6c6 100644 --- a/lib/assets/javascripts/jquery.atwho/jquery.atwho.js +++ b/lib/assets/javascripts/jquery.atwho/jquery.atwho.js @@ -1,6 +1,6 @@ /** - * at.js - 1.5.2 - * Copyright (c) 2016 chord.luo ; + * at.js - 1.5.4 + * Copyright (c) 2017 chord.luo ; * Homepage: http://ichord.github.com/At.js * License: MIT */ @@ -88,7 +88,7 @@ DEFAULT_CALLBACKS = { }); }, tplEval: function(tpl, map) { - var error, template; + var error, error1, template; template = tpl; try { if (typeof tpl !== 'string') { @@ -142,7 +142,7 @@ App = (function() { }; App.prototype.setupRootElement = function(iframe, asRoot) { - var error; + var error, error1; if (asRoot == null) { asRoot = false; } @@ -408,7 +408,7 @@ Controller = (function() { }; Controller.prototype.callDefault = function() { - var args, error, funcName; + var args, error, error1, funcName; funcName = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : []; try { return DEFAULT_CALLBACKS[funcName].apply(this, args); @@ -434,7 +434,7 @@ Controller = (function() { }; Controller.prototype.getOpt = function(at, default_value) { - var e; + var e, error1; try { return this.setting[at]; } catch (error1) { @@ -809,7 +809,7 @@ EditableController = (function(superClass) { EditableController.prototype.rect = function() { var $iframe, iframeOffset, rect; rect = this.query.el.offset(); - if (!rect) { + if (!(rect && this.query.el[0].getClientRects().length)) { return; } if (this.app.iframe && !this.app.iframeAsRoot) { @@ -826,26 +826,25 @@ EditableController = (function(superClass) { if (!this.$inputor.is(':focus')) { this.$inputor.focus(); } - overrides = this.getOpt("functionOverrides"); + overrides = this.getOpt('functionOverrides'); if (overrides.insert) { - return overrides.insert.bind(this)(content, $li); - } else { - suffix = (suffix = this.getOpt('suffix')) === "" ? suffix : suffix || "\u00A0"; - data = $li.data('item-data'); - this.query.el.removeClass('atwho-query').addClass('atwho-inserted').html(content).attr('data-atwho-at-query', "" + data['atwho-at'] + this.query.text).attr('contenteditable', "false"); - if (range = this._getRange()) { - if (this.query.el.length) { - range.setEndAfter(this.query.el[0]); - } - range.collapse(false); - range.insertNode(suffixNode = this.app.document.createTextNode("\u200D" + suffix)); - this._setRange('after', suffixNode, range); - } - if (!this.$inputor.is(':focus')) { - this.$inputor.focus(); + return overrides.insert.call(this, content, $li); + } + suffix = (suffix = this.getOpt('suffix')) === "" ? suffix : suffix || "\u00A0"; + data = $li.data('item-data'); + this.query.el.removeClass('atwho-query').addClass('atwho-inserted').html(content).attr('data-atwho-at-query', "" + data['atwho-at'] + this.query.text).attr('contenteditable', "false"); + if (range = this._getRange()) { + if (this.query.el.length) { + range.setEndAfter(this.query.el[0]); } - return this.$inputor.change(); + range.collapse(false); + range.insertNode(suffixNode = this.app.document.createTextNode("" + suffix)); + this._setRange('after', suffixNode, range); + } + if (!this.$inputor.is(':focus')) { + this.$inputor.focus(); } + return this.$inputor.change(); }; return EditableController; diff --git a/lib/jquery-atwho-rails/version.rb b/lib/jquery-atwho-rails/version.rb index ed10b16..a6241d0 100644 --- a/lib/jquery-atwho-rails/version.rb +++ b/lib/jquery-atwho-rails/version.rb @@ -1,7 +1,7 @@ module Jquery module Atwho module Rails - VERSION = '1.5.2' + VERSION = '1.5.4' end end end