aboutsummaryrefslogtreecommitdiffhomepage
path: root/tpl
diff options
context:
space:
mode:
Diffstat (limited to 'tpl')
-rw-r--r--tpl/editlink.html24
1 files changed, 23 insertions, 1 deletions
diff --git a/tpl/editlink.html b/tpl/editlink.html
index a32748ab..3733ca21 100644
--- a/tpl/editlink.html
+++ b/tpl/editlink.html
@@ -42,7 +42,7 @@
42{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn())"} 42{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn())"}
43<script> 43<script>
44 $ = Awesomplete.$; 44 $ = Awesomplete.$;
45 new Awesomplete($('input[data-multiple]'), { 45 awesomplete = new Awesomplete($('input[data-multiple]'), {
46 filter: function(text, input) { 46 filter: function(text, input) {
47 return Awesomplete.FILTER_CONTAINS(text, input.match(/[^ ]*$/)[0]); 47 return Awesomplete.FILTER_CONTAINS(text, input.match(/[^ ]*$/)[0]);
48 }, 48 },
@@ -52,6 +52,28 @@
52 }, 52 },
53 minChars: 1 53 minChars: 1
54 }); 54 });
55
56 /**
57 * Remove already selected items from autocompletion list.
58 * HTML list is never updated, so removing a tag will add it back to awesomplete.
59 *
60 * FIXME: This a workaround waiting for awesomplete to handle this.
61 * https://github.com/LeaVerou/awesomplete/issues/16749
62 */
63 var input = document.querySelector('#lf_tags');
64 input.addEventListener('input', function()
65 {
66 proposedTags = input.getAttribute('data-list').replace(/,/g, '').split(' ');
67 reg = /(\w+) /g;
68 while((match = reg.exec(input.value)) !== null) {
69 id = proposedTags.indexOf(match[1]);
70 if(id != -1 ) {
71 proposedTags.splice(id, 1);
72 }
73 }
74
75 awesomplete.list = proposedTags;
76 });
55</script> 77</script>
56{/if} 78{/if}
57</body> 79</body>