Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent code-token attribute in deltas #2259

Merged
merged 2 commits into from
Aug 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion blots/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 0 additions & 12 deletions modules/syntax.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down