Skip to content

Commit

Permalink
Don't treat <b style=font-weight: normal> as strong
Browse files Browse the repository at this point in the history
Because Google Docs spits out such HTML to the clipboard.

Closes #459
  • Loading branch information
marijnh committed Sep 26, 2016
1 parent 138e172 commit cbbdc1a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/schema-basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ const marks = {
},

strong: {
parseDOM: [{tag: "b"}, {tag: "strong"},
parseDOM: [{tag: "strong"},
// This works around a Google Docs misbehavior where
// pasted content will be inexplicably wrapped in `<b>`
// tags with a font-weight normal.
{tag: "b", getAttrs: node => node.style.fontWeight != "normal" && null},
{style: "font-weight", getAttrs: value => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null}],
toDOM() { return ["strong"] }
},
Expand Down

0 comments on commit cbbdc1a

Please sign in to comment.