Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | 65x 65x 65x 33x 29x 29x 29x 29x 28x 28x 28x 28x 31x 31x 31x 31x 10x 11x 11x 38x 38x | export default class DecorationsController { constructor(editor) { this.editor = editor; this.decorations = new Map(); this.editorDecorations = new Map(); } getAllDecorationsForModel(model) { if (!this.decorations.has(model.url)) return []; const modelDecorations = this.decorations.get(model.url); const decorations = []; modelDecorations.forEach((val) => decorations.push(...val)); return decorations; } addDecorations(model, decorationsKey, decorations) { const decorationMap = this.decorations.get(model.url) || new Map(); decorationMap.set(decorationsKey, decorations); this.decorations.set(model.url, decorationMap); this.decorate(model); } decorate(model) { Iif (!this.editor.instance) return; const decorations = this.getAllDecorationsForModel(model); const oldDecorations = this.editorDecorations.get(model.url) || []; this.editorDecorations.set( model.url, this.editor.instance.deltaDecorations(oldDecorations, decorations), ); } hasDecorations(model) { return this.decorations.has(model.url); } removeDecorations(model) { this.decorations.delete(model.url); this.editorDecorations.delete(model.url); } dispose() { this.decorations.clear(); this.editorDecorations.clear(); } } |