]> git.mxchange.org Git - friendica.git/commitdiff
tinymce tag complete stuff
authorFriendika <info@friendika.com>
Fri, 4 Nov 2011 03:40:56 +0000 (20:40 -0700)
committerFriendika <info@friendika.com>
Fri, 4 Nov 2011 03:40:56 +0000 (20:40 -0700)
js/fk.autocomplete.js
view/jot-header.tpl

index c17d61fc575c627b03f1805dd226e0115f2a4ade..45de0cb2dd306bd53bd7bab1c8a7d878085de592 100644 (file)
@@ -13,20 +13,28 @@ function ACPopup(elm,backend_url){
        this.ready=true;
        this.kp_timer = false;
        this.url = backend_url;
-       
-       style = $(elm).offset();
-       w = $(elm).width();
-       h = $(elm).height();
+
+       if(typeof elm.editorId == "undefined") {        
+               style = $(elm).offset();
+               w = $(elm).width();
+               h = $(elm).height();
+       }
+       else {
+               style = $('.profile-jot-text').offset();
+               w = 300;
+               h = 150;
+
+       } 
        style.top=style.top+h;
        style.width = w;
        style.position = 'absolute';
-/*     style['max-height'] = '150px';
-       style.border = '1px solid red';
-       style.background = '#cccccc';
+       /*      style['max-height'] = '150px';
+               style.border = '1px solid red';
+               style.background = '#cccccc';
        
-       style.overflow = 'auto';
-       style['z-index'] = '100000';
-*/
+               style.overflow = 'auto';
+               style['z-index'] = '100000';
+       */
        style.display = 'none';
        
        this.cont = $("<div class='acpopup'></div>");
index ecf27e1b179647b0643371c88d4726f6799b6536..9ded3e9b43061f57dc7000724c71bd3aa65f503b 100644 (file)
@@ -30,9 +30,26 @@ function initEditor(cb){
                        content_css: "$baseurl/view/custom_tinymce.css",
                        theme_advanced_path : false,
                        setup : function(ed) {
-                                //Character count
+                               cPopup = null;
+                               ed.onKeyDown.add(function(ed,e) {
+                                       if(cPopup !== null)
+                                               cPopup.onkey(e);
+                               });
+
                                ed.onKeyUp.add(function(ed, e) {
                                        var txt = tinyMCE.activeEditor.getContent();
+                                       match = txt.match(/@([^ \n]+)$/);
+                                       if(match!==null) {
+                                               if(cPopup === null) {
+                                                       cPopup = new ACPopup(this,baseurl+"/acl");
+                                               }
+                                               if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
+                                               if(! cPopup.ready) cPopup = null;
+                                       }
+                                       else {
+                                               if(cPopup !== null) { cPopup.close(); cPopup = null; }
+                                       }
+
                                        textlen = txt.length;
                                        if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
                                                $('#profile-jot-desc').html(ispublic);
@@ -41,6 +58,8 @@ function initEditor(cb){
                                                $('#profile-jot-desc').html('&nbsp;');
                                        }        
 
+                                //Character count
+
                                        if(textlen <= 140) {
                                                $('#character-counter').removeClass('red');
                                                $('#character-counter').removeClass('orange');
@@ -71,8 +90,8 @@ function initEditor(cb){
                editor = true;
                // setup acl popup
                $("a#jot-perms-icon").fancybox({
-                       'transitionIn' : 'none',
-                       'transitionOut' : 'none'
+                       'transitionIn' : 'elastic',
+                       'transitionOut' : 'elastic'
                }); 
        } else {
                if (typeof cb!="undefined") cb();