mirror of
https://github.com/danbulant/Nertivia-Client
synced 2026-06-13 11:31:41 +00:00
add attributes
This commit is contained in:
parent
64bfc691c9
commit
fd8448b5cc
2 changed files with 34 additions and 10 deletions
|
|
@ -16,7 +16,7 @@
|
|||
<div class="triangle">
|
||||
<div class="triangle-inner" />
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="content" @dblclick="contentDoubleClickEvent">
|
||||
<div class="user-info">
|
||||
<div class="username"
|
||||
@click="openUserInformation"
|
||||
|
|
@ -149,8 +149,12 @@ export default {
|
|||
|
||||
},
|
||||
editMessage() {
|
||||
if (this.uniqueID !== this.user.uniqueID) return;
|
||||
this.dropDownVisable = false;
|
||||
this.$store.dispatch("setEditMessage", {channelID: this.channelID, messageID: this.messageID, message: this.message});
|
||||
},
|
||||
contentDoubleClickEvent(event){
|
||||
if (event.target.classList.contains("content") || event.target.closest('.user-info')) this.editMessage();
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -449,6 +453,10 @@ export default {
|
|||
</style>
|
||||
|
||||
<style>
|
||||
|
||||
.code-inline{
|
||||
background: rgba(0, 0, 0, 0.322);
|
||||
}
|
||||
.msg-link {
|
||||
color: rgb(86, 159, 253);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,16 +28,32 @@ const markdown = new MarkdownIt({
|
|||
|
||||
|
||||
//add attributes to link tag
|
||||
const defaultRender = markdown.renderer.rules.link_open || function(tokens, idx, options, env, self) {
|
||||
return self.renderToken(tokens, idx, options);
|
||||
};
|
||||
(function() {
|
||||
const defaultRender = markdown.renderer.rules.link_open || function(tokens, idx, options, env, self) {
|
||||
return self.renderToken(tokens, idx, options);
|
||||
};
|
||||
|
||||
markdown.renderer.rules.link_open = function (tokens, idx, options, env, self) {
|
||||
tokens[idx].attrPush(['target', '_blank']); // add new attribute
|
||||
tokens[idx].attrPush(['class', 'msg-link']);
|
||||
// pass token to default renderer.
|
||||
return defaultRender(tokens, idx, options, env, self);
|
||||
};
|
||||
})();
|
||||
|
||||
markdown.renderer.rules.link_open = function (tokens, idx, options, env, self) {
|
||||
tokens[idx].attrPush(['target', '_blank']); // add new attribute
|
||||
tokens[idx].attrPush(['class', 'msg-link']);
|
||||
// pass token to default renderer.
|
||||
return defaultRender(tokens, idx, options, env, self);
|
||||
};
|
||||
// add addribute to code
|
||||
(function() {
|
||||
const defaultRender = markdown.renderer.rules.code_inline || function(tokens, idx, options, env, self) {
|
||||
return self.renderToken(tokens, idx, options);
|
||||
};
|
||||
|
||||
markdown.renderer.rules.code_inline = function (tokens, idx, options, env, self) {
|
||||
tokens[idx].attrPush(['class', 'code-inline']);
|
||||
// pass token to default renderer.
|
||||
return defaultRender(tokens, idx, options, env, self);
|
||||
};
|
||||
})();
|
||||
console.log(markdown.renderer.rules)
|
||||
|
||||
|
||||
export default (message) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue