diff --git a/bbcode/IconView.vue b/bbcode/IconView.vue
new file mode 100644
index 0000000..6cd745a
--- /dev/null
+++ b/bbcode/IconView.vue
@@ -0,0 +1,75 @@
+
+
+
+
+
diff --git a/bbcode/standard.ts b/bbcode/standard.ts
index bc3c251..806c7ec 100644
--- a/bbcode/standard.ts
+++ b/bbcode/standard.ts
@@ -5,7 +5,7 @@ import * as Utils from '../site/utils';
import {analyzeUrlTag, CoreBBCodeParser} from './core';
import {BBCodeCustomTag, BBCodeSimpleTag, BBCodeTextTag} from './parser';
import UrlTagView from './UrlTagView.vue';
-
+import {default as IconView} from '../bbcode/IconView.vue';
const usernameRegex = /^[a-zA-Z0-9_\-\s]+$/;
@@ -118,16 +118,26 @@ export class StandardBBCodeParser extends CoreBBCodeParser {
parser.warning('Unexpected parameter on icon tag.');
if(!usernameRegex.test(content))
return;
- const a = parser.createElement('a');
- a.href = `${Utils.siteDomain}c/${content}`;
- a.target = '_blank';
- const img = parser.createElement('img');
- img.src = `${Utils.staticDomain}images/avatar/${content.toLowerCase()}.png`;
- img.className = 'character-avatar icon';
- img.title = img.alt = content;
- a.appendChild(img);
- parent.appendChild(a);
- return a;
+
+ const root = parser.createElement('span');
+ const el = parser.createElement('span');
+ parent.appendChild(root);
+ root.appendChild(el);
+ const view = new IconView({ el, propsData: { character: content }});
+
+ this.cleanup.push(view);
+ return root;
+
+ // const a = parser.createElement('a');
+ // a.href = `${Utils.siteDomain}c/${content}`;
+ // a.target = '_blank';
+ // const img = parser.createElement('img');
+ // img.src = `${Utils.staticDomain}images/avatar/${content.toLowerCase()}.png`;
+ // img.className = 'character-avatar icon';
+ // img.title = img.alt = content;
+ // a.appendChild(img);
+ // parent.appendChild(a);
+ // return a;
}));
this.addTag(new BBCodeTextTag('eicon', (parser, parent, param, content) => {
if(param !== '')
diff --git a/chat/bbcode.ts b/chat/bbcode.ts
index a8ef4c9..7579b06 100644
--- a/chat/bbcode.ts
+++ b/chat/bbcode.ts
@@ -4,10 +4,11 @@ import {BBCodeElement, CoreBBCodeParser, analyzeUrlTag} from '../bbcode/core';
import BaseEditor from '../bbcode/Editor.vue';
import {BBCodeTextTag} from '../bbcode/parser';
import ChannelView from './ChannelTagView.vue';
-import {characterImage} from './common';
+// import {characterImage} from './common';
import core from './core';
-import {Character} from './interfaces';
+// import {Character} from './interfaces';
import {default as UrlView} from '../bbcode/UrlTagView.vue';
+import {default as IconView} from '../bbcode/IconView.vue';
import UserView from './UserView.vue';
export class Editor extends BaseEditor {
@@ -36,14 +37,24 @@ export default class BBCodeParser extends CoreBBCodeParser {
const uregex = /^[a-zA-Z0-9_\-\s]+$/;
if(!uregex.test(content))
return;
- const img = parser.createElement('img');
+
+ const root = parser.createElement('span');
+ const el = parser.createElement('span');
+ parent.appendChild(root);
+ root.appendChild(el);
+ const view = new IconView({ el, propsData: { character: content }});
+
+ this.cleanup.push(view);
+ return root;
+
+ /* const img = parser.createElement('img');
img.src = characterImage(content);
img.style.cursor = 'pointer';
img.className = 'character-avatar icon';
img.title = img.alt = content;
(img).character = core.characters.get(content);
parent.appendChild(img);
- return img;
+ return img; */
}));
this.addTag(new BBCodeTextTag('eicon', (parser, parent, param, content) => {
if(param.length > 0)