diff --git a/blots/block.js b/blots/block.js index c065f2b19c..fbb6975c7d 100644 --- a/blots/block.js +++ b/blots/block.js @@ -180,10 +180,12 @@ function bubbleFormats(blot, formats = {}) { if (blot == null) return formats; if (typeof blot.formats === 'function') { formats = extend(formats, blot.formats()); + // exclude syntax highlighting from deltas and getFormat() + delete formats['code-token']; } if ( blot.parent == null || - blot.parent.blotName === 'scroll' || + blot.parent.statics.blotName === 'scroll' || blot.parent.statics.scope !== blot.statics.scope ) { return formats; diff --git a/modules/syntax.js b/modules/syntax.js index 0720ef6e64..b9dbddc377 100644 --- a/modules/syntax.js +++ b/modules/syntax.js @@ -65,18 +65,6 @@ class SyntaxCodeBlock extends CodeBlock { static register() {} // Syntax module will register - delta() { - if (this.cache.delta == null) { - const delta = super.delta(); - this.cache.delta = delta.compose( - new Delta().retain(delta.length(), { - [CodeToken.blotName]: null, - }), - ); - } - return this.cache.delta; - } - format(name, value) { if (name === this.statics.blotName && value) { this.domNode.setAttribute('data-language', value);