Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import Delta from 'quill-delta';
import { ClassAttributor, Scope } from 'parchment';
import Inline from '../blots/inline';
import Quill from '../core/quill';
import Module from '../core/module';
import { blockDelta } from '../blots/block';
import BreakBlot from '../blots/break';
import CursorBlot from '../blots/cursor';
import TextBlot, { escapeText } from '../blots/text';
import CodeBlock, { CodeBlockContainer } from '../formats/code';
import { traverse } from './clipboard';
const TokenAttributor = new ClassAttributor('code-token', 'hljs', {
scope: Scope.INLINE,
});
class CodeToken extends Inline {
static formats(node, scroll) {
while (node != null && node !== scroll.domNode) {
if (node.classList.contains(CodeBlock.className)) {
return super.formats(node, scroll);
}
node = node.parentNode;
}
return undefined;
}
constructor(scroll, domNode, value) {
super(scroll, domNode, value);
TokenAttributor.add(this.domNode, value);
import Delta from 'quill-delta';
import { ClassAttributor, Scope } from 'parchment';
import Inline from '../blots/inline';
import Quill from '../core/quill';
import Module from '../core/module';
import { blockDelta } from '../blots/block';
import BreakBlot from '../blots/break';
import CursorBlot from '../blots/cursor';
import TextBlot, { escapeText } from '../blots/text';
import CodeBlock, { CodeBlockContainer } from '../formats/code';
import { traverse } from './clipboard';
const TokenAttributor = new ClassAttributor('code-token', 'hljs', {
scope: Scope.INLINE,
});
class CodeToken extends Inline {
static formats(node, scroll) {
while (node != null && node !== scroll.domNode) {
if (node.classList.contains(CodeBlock.className)) {
return super.formats(node, scroll);
}
node = node.parentNode;
}
return undefined;
}
constructor(scroll, domNode, value) {
super(scroll, domNode, value);
TokenAttributor.add(this.domNode, value);