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

Prevent code-token attribute in deltas #2259

merged 2 commits into from
Aug 21, 2018

Conversation

dgreensp
Copy link
Contributor

Fixes #2178.

While it feels a bit odd to make a function called bubbleFormats always exclude a particular format from its result, this function could really be called something like collectFormatsForDelta; it is only called to get the formats for a delta (or the public Quill API, quill.getFormat()).

It follows (I believe) that SyntaxCodeBlock no longer needs a custom delta() method.

@dgreensp dgreensp requested a review from jhchen August 20, 2018 23:04
blots/block.js Outdated
if (typeof blot.formats === 'function') {
if (
typeof blot.formats === 'function' &&
blot.statics.blotName !== 'code-token'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible for the code token blot to have attributes which may have desirable formats to preserve. For example comments are often implemented this way which would produce a blot that looks like:

<span class="ql-token hljs-literal comment-07d9be3c>false</span>

In this case we still do want to call formats() to get the comment format.

@dgreensp
Copy link
Contributor Author

dgreensp commented Aug 20, 2018

Ah ok. How about this (updated the code).

@jhchen jhchen merged commit a5894ab into develop Aug 21, 2018
@jhchen jhchen deleted the dg-no-code-token branch August 21, 2018 00:47
@jhchen
Copy link
Member

jhchen commented Aug 21, 2018

👍

@dgreensp
Copy link
Contributor Author

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants