prosemirror-schema-basic
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -0,1 +1,7 @@ | ||
## 1.2.1 (2023-01-18) | ||
### Bug fixes | ||
Add parse rules to clear `em` and `strong` marks for styles that reset font style/weight. | ||
## 1.2.0 (2022-05-30) | ||
@@ -2,0 +8,0 @@ |
@@ -85,4 +85,4 @@ import { NodeSpec, MarkSpec, Schema } from 'prosemirror-model'; | ||
*/ | ||
declare const schema: Schema; | ||
declare const schema: Schema<"blockquote" | "image" | "text" | "doc" | "paragraph" | "horizontal_rule" | "heading" | "code_block" | "hard_break", "link" | "code" | "em" | "strong">; | ||
export { marks, nodes, schema }; |
@@ -140,3 +140,7 @@ import { Schema } from 'prosemirror-model'; | ||
em: { | ||
parseDOM: [{ tag: "i" }, { tag: "em" }, { style: "font-style=italic" }], | ||
parseDOM: [ | ||
{ tag: "i" }, { tag: "em" }, | ||
{ style: "font-style=italic" }, | ||
{ style: "font-style=normal", clearMark: m => m.type.name == "em" } | ||
], | ||
toDOM() { return emDOM; } | ||
@@ -149,3 +153,4 @@ }, | ||
strong: { | ||
parseDOM: [{ tag: "strong" }, | ||
parseDOM: [ | ||
{ tag: "strong" }, | ||
// This works around a Google Docs misbehavior where | ||
@@ -155,3 +160,5 @@ // pasted content will be inexplicably wrapped in `<b>` | ||
{ tag: "b", getAttrs: (node) => node.style.fontWeight != "normal" && null }, | ||
{ style: "font-weight", getAttrs: (value) => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null }], | ||
{ style: "font-weight=400", clearMark: m => m.type.name == "strong" }, | ||
{ style: "font-weight", getAttrs: (value) => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null }, | ||
], | ||
toDOM() { return strongDOM; } | ||
@@ -158,0 +165,0 @@ }, |
{ | ||
"name": "prosemirror-schema-basic", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Basic schema elements for ProseMirror", | ||
@@ -27,3 +27,3 @@ "type": "module", | ||
"dependencies": { | ||
"prosemirror-model": "^1.2.0" | ||
"prosemirror-model": "^1.19.0" | ||
}, | ||
@@ -30,0 +30,0 @@ "devDependencies": { |
# prosemirror-schema-basic | ||
[ [**WEBSITE**](https://prosemirror.net) | [**ISSUES**](https://github.com/prosemirror/prosemirror/issues) | [**FORUM**](https://discuss.prosemirror.net) | [**GITTER**](https://gitter.im/ProseMirror/prosemirror) | [**CHANGELOG**](https://github.com/ProseMirror/prosemirror-schema-basic/blob/master/CHANGELOG.md) ] | ||
[ [**WEBSITE**](https://prosemirror.net) | [**ISSUES**](https://github.com/prosemirror/prosemirror/issues) | [**FORUM**](https://discuss.prosemirror.net) | [**CHANGELOG**](https://github.com/ProseMirror/prosemirror-schema-basic/blob/master/CHANGELOG.md) ] | ||
@@ -5,0 +5,0 @@ This is a [schema module](https://prosemirror.net/docs/ref/#schema-basic) for [ProseMirror](https://prosemirror.net). |
@@ -128,3 +128,7 @@ import {Schema, NodeSpec, MarkSpec, DOMOutputSpec} from "prosemirror-model" | ||
em: { | ||
parseDOM: [{tag: "i"}, {tag: "em"}, {style: "font-style=italic"}], | ||
parseDOM: [ | ||
{tag: "i"}, {tag: "em"}, | ||
{style: "font-style=italic"}, | ||
{style: "font-style=normal", clearMark: m => m.type.name == "em"} | ||
], | ||
toDOM() { return emDOM } | ||
@@ -136,8 +140,11 @@ } as MarkSpec, | ||
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: HTMLElement) => node.style.fontWeight != "normal" && null}, | ||
{style: "font-weight", getAttrs: (value: string) => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null}], | ||
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: HTMLElement) => node.style.fontWeight != "normal" && null}, | ||
{style: "font-weight=400", clearMark: m => m.type.name == "strong"}, | ||
{style: "font-weight", getAttrs: (value: string) => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null}, | ||
], | ||
toDOM() { return strongDOM } | ||
@@ -144,0 +151,0 @@ } as MarkSpec, |
Sorry, the diff of this file is not supported yet
26718
11
651
Updatedprosemirror-model@^1.19.0