mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
removed logging
This commit is contained in:
parent
846dea24db
commit
5ffec65c27
@ -15,7 +15,6 @@ export const Layer = (props: LayerProps) => {
|
||||
|
||||
|
||||
const tags = useTags();
|
||||
console.log(tags);
|
||||
|
||||
|
||||
|
||||
@ -23,23 +22,17 @@ export const Layer = (props: LayerProps) => {
|
||||
|
||||
// create a JS-Map with all Tags
|
||||
const tagMap = new Map(tags?.map(key => [key.id, key]));
|
||||
console.log(tagMap);
|
||||
|
||||
|
||||
|
||||
// returns all tags for passed item
|
||||
const getTags = (item: Item) => {
|
||||
console.log(item.text);
|
||||
const regex = /(^|\B)#(?![0-9_]+\b)([a-zA-Z0-9_]{1,30})(\b|\r)/g;
|
||||
const strings = item.text.toLocaleLowerCase().match(regex);
|
||||
console.log(strings);
|
||||
const tags: Tag[] = [];
|
||||
strings?.map(tag => {
|
||||
console.log(tag.slice(1));
|
||||
|
||||
if (tagMap.has(tag.slice(1))) { tags.push(tagMap.get(tag.slice(1))!) }
|
||||
})
|
||||
console.log(tags);
|
||||
|
||||
return tags;
|
||||
};
|
||||
|
||||
@ -8,8 +8,6 @@ export function heighlightTags(message: string, tags: Tag[]): string {
|
||||
|
||||
const hashTagRegex = /(^|\B)#(?![0-9_]+\b)([a-zA-Z0-9_]{1,30})(\b|\r)/g;
|
||||
message = message.replace(hashTagRegex, function (string) {
|
||||
console.log(string);
|
||||
|
||||
const tag = tags.find(t => t.id.toLowerCase() == string.slice(1).toLowerCase())
|
||||
return `<span style="background-color: ${tag ? tag.color : '#aaa' };padding: 0px 5px;border-radius: 7px;cursor: pointer;color:#fff">` + string + '</span>'
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user