feat: ajouter la fonctionnalité de saisie automatique pour les tags dans les formulaires d'ajout et d'édition de liens
This commit is contained in:
@@ -20,6 +20,29 @@
|
||||
{loop="$plugins_footer.js"}
|
||||
<script src="{$root_path}/{$value}"></script>
|
||||
{/loop}
|
||||
{if="$pageName=='editlink' || $pageName=='addlink' || $pageName=='editlinkbatch'"}
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var inputs = document.querySelectorAll('input[data-list]');
|
||||
Array.prototype.forEach.call(inputs, function(input) {
|
||||
new Awesomplete(input, {
|
||||
minChars: 1,
|
||||
maxItems: 15,
|
||||
filter: function(text, input) {
|
||||
return Awesomplete.FILTER_CONTAINS(text, input.match(/[^ ]*$/)[0]);
|
||||
},
|
||||
item: function(text, input) {
|
||||
return Awesomplete.ITEM(text, input.match(/[^ ]*$/)[0]);
|
||||
},
|
||||
replace: function(text) {
|
||||
var before = this.input.value.match(/.* /);
|
||||
this.input.value = (before ? before[0] : "") + text + " ";
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/if}
|
||||
</footer>
|
||||
</div>
|
||||
<!-- Bulk Actions Bar (for multi-select) -->
|
||||
|
||||
Reference in New Issue
Block a user