refactor: 优化eslint配置,提升代码质量 (#1341)
* feat: 统一并标准化eslint * lint: napcat.webui * lint: napcat.webui * lint: napcat.core * build: fix * lint: napcat.webui * refactor: 重构eslint * Update README.md
This commit is contained in:
1 parent
c9b1d3fafa
commit
2185a884b4
651 files changed
+37978
-37584
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import Quill from 'quill'
|
||||
import Quill from 'quill';
|
||||
|
||||
// eslint-disable-next-line
|
||||
const Embed = Quill.import('blots/embed') as any
|
||||
@@ -8,34 +8,34 @@ export interface EmojiValue {
|
||||
id: string
|
||||
}
|
||||
class EmojiBlot extends Embed {
|
||||
static blotName: string = 'emoji'
|
||||
static tagName: string = 'img'
|
||||
static classNames: string[] = ['w-6', 'h-6']
|
||||
static blotName: string = 'emoji';
|
||||
static tagName: string = 'img';
|
||||
static classNames: string[] = ['w-6', 'h-6'];
|
||||
|
||||
static create(value: HTMLImageElement) {
|
||||
const node = super.create(value)
|
||||
node.setAttribute('alt', value.alt)
|
||||
node.setAttribute('src', value.src)
|
||||
node.setAttribute('data-id', value.id)
|
||||
node.classList.add(...EmojiBlot.classNames)
|
||||
return node
|
||||
static create (value: HTMLImageElement) {
|
||||
const node = super.create(value);
|
||||
node.setAttribute('alt', value.alt);
|
||||
node.setAttribute('src', value.src);
|
||||
node.setAttribute('data-id', value.id);
|
||||
node.classList.add(...EmojiBlot.classNames);
|
||||
return node;
|
||||
}
|
||||
|
||||
static formats(node: HTMLImageElement): EmojiValue {
|
||||
static formats (node: HTMLImageElement): EmojiValue {
|
||||
return {
|
||||
alt: node.getAttribute('alt') ?? '',
|
||||
src: node.getAttribute('src') ?? '',
|
||||
id: node.getAttribute('data-id') ?? ''
|
||||
}
|
||||
id: node.getAttribute('data-id') ?? '',
|
||||
};
|
||||
}
|
||||
|
||||
static value(node: HTMLImageElement): EmojiValue {
|
||||
static value (node: HTMLImageElement): EmojiValue {
|
||||
return {
|
||||
alt: node.getAttribute('alt') ?? '',
|
||||
src: node.getAttribute('src') ?? '',
|
||||
id: node.getAttribute('data-id') ?? ''
|
||||
}
|
||||
id: node.getAttribute('data-id') ?? '',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export default EmojiBlot
|
||||
export default EmojiBlot;
|
||||
Reference in new issue
Block a user