Fix #4731: Tag counter in edit boxes should only count unique tags, not repeated.
Just use the `uniq` function from lodash. Adds ~1kb to the build. Also rename `Utility.regexp_split` to `Utility.splitWords`.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import Rails from '@rails/ujs';
|
||||
import { hideAll } from 'tippy.js';
|
||||
import words from "lodash/words";
|
||||
|
||||
let Utility = {};
|
||||
|
||||
@@ -113,9 +114,8 @@ Utility.regexp_escape = function(string) {
|
||||
return string.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
|
||||
}
|
||||
|
||||
Utility.regexp_split = function(string) {
|
||||
string ??= "";
|
||||
return string.match(/\S+/g) ?? [];
|
||||
Utility.splitWords = function(string) {
|
||||
return words(string, /\S+/g);
|
||||
}
|
||||
|
||||
$.fn.selectEnd = function() {
|
||||
|
||||
Reference in New Issue
Block a user