From 20c5bfd22cadce1bfdab47a7c88cf559377f167b Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 19 Jan 2015 23:24:20 +0100 Subject: [PATCH] Improved text modules. --- .../app/lib/base/jquery.textmodule.js | 1 + .../app/lib/base/rangy-textrange.js | 1925 +++++++++++++++++ 2 files changed, 1926 insertions(+) create mode 100755 app/assets/javascripts/app/lib/base/rangy-textrange.js diff --git a/app/assets/javascripts/app/lib/base/jquery.textmodule.js b/app/assets/javascripts/app/lib/base/jquery.textmodule.js index cc955504e..f550cab41 100644 --- a/app/assets/javascripts/app/lib/base/jquery.textmodule.js +++ b/app/assets/javascripts/app/lib/base/jquery.textmodule.js @@ -191,6 +191,7 @@ // set height of widget Plugin.prototype.movePosition = function() { + if (!this._position) return var height = this.$element.height() + 20 var widgetHeight = this.$widget.find('ul').height() //+ 60 // + height var top = -( widgetHeight + height ) + this._position.top diff --git a/app/assets/javascripts/app/lib/base/rangy-textrange.js b/app/assets/javascripts/app/lib/base/rangy-textrange.js new file mode 100755 index 000000000..58d7528b5 --- /dev/null +++ b/app/assets/javascripts/app/lib/base/rangy-textrange.js @@ -0,0 +1,1925 @@ +/** + * Text range module for Rangy. + * Text-based manipulation and searching of ranges and selections. + * + * Features + * + * - Ability to move range boundaries by character or word offsets + * - Customizable word tokenizer + * - Ignores text nodes inside