feat: $ skills mention
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
marked.use(footnoteExtension(options));
|
||||
marked.use(disableSingleTilde);
|
||||
marked.use({
|
||||
extensions: [mentionExtension({ triggerChar: '@' }), mentionExtension({ triggerChar: '#' })]
|
||||
extensions: [mentionExtension({ triggerChar: '@' }), mentionExtension({ triggerChar: '#' }), mentionExtension({ triggerChar: '$' })]
|
||||
});
|
||||
|
||||
$: (async () => {
|
||||
|
||||
@@ -25,8 +25,23 @@
|
||||
|
||||
const init = () => {
|
||||
const _id = token?.id;
|
||||
// split by : and take first part as idType and second part as id
|
||||
triggerChar = token?.triggerChar ?? '@';
|
||||
|
||||
if (triggerChar === '$') {
|
||||
// Skill mention: id format is "skillId|label"
|
||||
const pipeIdx = _id?.indexOf('|') ?? -1;
|
||||
if (pipeIdx > 0) {
|
||||
id = _id.substring(0, pipeIdx);
|
||||
label = _id.substring(pipeIdx + 1);
|
||||
} else {
|
||||
id = _id;
|
||||
label = _id;
|
||||
}
|
||||
idType = null;
|
||||
return;
|
||||
}
|
||||
|
||||
// split by : and take first part as idType and second part as id
|
||||
const parts = _id?.split(':');
|
||||
if (parts) {
|
||||
idType = parts[0];
|
||||
@@ -37,7 +52,6 @@
|
||||
}
|
||||
|
||||
label = token?.label ?? id;
|
||||
triggerChar = token?.triggerChar ?? '@';
|
||||
|
||||
if (triggerChar === '#') {
|
||||
if (idType === 'C') {
|
||||
|
||||
Reference in New Issue
Block a user