fix: Fix removal of textStyle mark when any style resets (#1465)

I built some extensions based on the textStyle extension but whenever I reset a style/attribute, the whole textStyle mark gets removed when there are still other styles defined in the mark.
This commit is contained in:
Tom Boettger
2021-06-14 22:28:16 +02:00
committed by GitHub
parent 8624505ce1
commit fbf442269d

View File

@@ -51,7 +51,7 @@ export const TextStyle = Mark.create<TextStyleOptions>({
return { return {
removeEmptyTextStyle: () => ({ state, commands }) => { removeEmptyTextStyle: () => ({ state, commands }) => {
const attributes = getMarkAttributes(state, this.type) const attributes = getMarkAttributes(state, this.type)
const hasStyles = Object.entries(attributes).every(([, value]) => !!value) const hasStyles = Object.entries(attributes).some(([, value]) => !!value)
if (hasStyles) { if (hasStyles) {
return true return true