prosemirror-schema-basic
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -7,2 +7,8 @@ 'use strict'; | ||
var pDOM = ["p", 0]; | ||
var blockquoteDOM = ["blockquote", 0]; | ||
var hrDOM = ["hr"]; | ||
var preDOM = ["pre", ["code", 0]]; | ||
var brDOM = ["br"]; | ||
// :: Object | ||
@@ -22,3 +28,3 @@ // [Specs](#model.NodeSpec) for the nodes defined in this schema. | ||
parseDOM: [{tag: "p"}], | ||
toDOM: function toDOM() { return ["p", 0] } | ||
toDOM: function toDOM() { return pDOM } | ||
}, | ||
@@ -32,3 +38,3 @@ | ||
parseDOM: [{tag: "blockquote"}], | ||
toDOM: function toDOM() { return ["blockquote", 0] } | ||
toDOM: function toDOM() { return blockquoteDOM } | ||
}, | ||
@@ -40,3 +46,3 @@ | ||
parseDOM: [{tag: "hr"}], | ||
toDOM: function toDOM() { return ["hr"] } | ||
toDOM: function toDOM() { return hrDOM } | ||
}, | ||
@@ -71,3 +77,3 @@ | ||
parseDOM: [{tag: "pre", preserveWhitespace: "full"}], | ||
toDOM: function toDOM() { return ["pre", ["code", 0]] } | ||
toDOM: function toDOM() { return preDOM } | ||
}, | ||
@@ -99,3 +105,6 @@ | ||
}}], | ||
toDOM: function toDOM(node) { return ["img", node.attrs] } | ||
toDOM: function toDOM(node) { var ref = node.attrs; | ||
var src = ref.src; | ||
var alt = ref.alt; | ||
var title = ref.title; return ["img", {src: src, alt: alt, title: title}] } | ||
}, | ||
@@ -109,6 +118,10 @@ | ||
parseDOM: [{tag: "br"}], | ||
toDOM: function toDOM() { return ["br"] } | ||
toDOM: function toDOM() { return brDOM } | ||
} | ||
}; | ||
var emDOM = ["em", 0]; | ||
var strongDOM = ["strong", 0]; | ||
var codeDOM = ["code", 0]; | ||
// :: Object [Specs](#model.MarkSpec) for the marks in the schema. | ||
@@ -128,3 +141,5 @@ var marks = { | ||
}}], | ||
toDOM: function toDOM(node) { return ["a", node.attrs] } | ||
toDOM: function toDOM(node) { var ref = node.attrs; | ||
var href = ref.href; | ||
var title = ref.title; return ["a", {href: href, title: title}, 0] } | ||
}, | ||
@@ -136,3 +151,3 @@ | ||
parseDOM: [{tag: "i"}, {tag: "em"}, {style: "font-style=italic"}], | ||
toDOM: function toDOM() { return ["em"] } | ||
toDOM: function toDOM() { return emDOM } | ||
}, | ||
@@ -149,3 +164,3 @@ | ||
{style: "font-weight", getAttrs: function (value) { return /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null; }}], | ||
toDOM: function toDOM() { return ["strong"] } | ||
toDOM: function toDOM() { return strongDOM } | ||
}, | ||
@@ -156,3 +171,3 @@ | ||
parseDOM: [{tag: "code"}], | ||
toDOM: function toDOM() { return ["code"] } | ||
toDOM: function toDOM() { return codeDOM } | ||
} | ||
@@ -159,0 +174,0 @@ }; |
{ | ||
"name": "prosemirror-schema-basic", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Basic schema elements for ProseMirror", | ||
@@ -19,3 +19,3 @@ "main": "dist/schema-basic.js", | ||
"dependencies": { | ||
"prosemirror-model": "^1.0.0" | ||
"prosemirror-model": "^1.2.0" | ||
}, | ||
@@ -22,0 +22,0 @@ "devDependencies": { |
import {Schema} from "prosemirror-model" | ||
const pDOM = ["p", 0], blockquoteDOM = ["blockquote", 0], hrDOM = ["hr"], | ||
preDOM = ["pre", ["code", 0]], brDOM = ["br"] | ||
// :: Object | ||
@@ -17,3 +20,3 @@ // [Specs](#model.NodeSpec) for the nodes defined in this schema. | ||
parseDOM: [{tag: "p"}], | ||
toDOM() { return ["p", 0] } | ||
toDOM() { return pDOM } | ||
}, | ||
@@ -27,3 +30,3 @@ | ||
parseDOM: [{tag: "blockquote"}], | ||
toDOM() { return ["blockquote", 0] } | ||
toDOM() { return blockquoteDOM } | ||
}, | ||
@@ -35,3 +38,3 @@ | ||
parseDOM: [{tag: "hr"}], | ||
toDOM() { return ["hr"] } | ||
toDOM() { return hrDOM } | ||
}, | ||
@@ -66,3 +69,3 @@ | ||
parseDOM: [{tag: "pre", preserveWhitespace: "full"}], | ||
toDOM() { return ["pre", ["code", 0]] } | ||
toDOM() { return preDOM } | ||
}, | ||
@@ -94,3 +97,3 @@ | ||
}}], | ||
toDOM(node) { return ["img", node.attrs] } | ||
toDOM(node) { let {src, alt, title} = node.attrs; return ["img", {src, alt, title}] } | ||
}, | ||
@@ -104,6 +107,8 @@ | ||
parseDOM: [{tag: "br"}], | ||
toDOM() { return ["br"] } | ||
toDOM() { return brDOM } | ||
} | ||
} | ||
const emDOM = ["em", 0], strongDOM = ["strong", 0], codeDOM = ["code", 0] | ||
// :: Object [Specs](#model.MarkSpec) for the marks in the schema. | ||
@@ -123,3 +128,3 @@ export const marks = { | ||
}}], | ||
toDOM(node) { return ["a", node.attrs] } | ||
toDOM(node) { let {href, title} = node.attrs; return ["a", {href, title}, 0] } | ||
}, | ||
@@ -131,3 +136,3 @@ | ||
parseDOM: [{tag: "i"}, {tag: "em"}, {style: "font-style=italic"}], | ||
toDOM() { return ["em"] } | ||
toDOM() { return emDOM } | ||
}, | ||
@@ -144,3 +149,3 @@ | ||
{style: "font-weight", getAttrs: value => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null}], | ||
toDOM() { return ["strong"] } | ||
toDOM() { return strongDOM } | ||
}, | ||
@@ -151,3 +156,3 @@ | ||
parseDOM: [{tag: "code"}], | ||
toDOM() { return ["code"] } | ||
toDOM() { return codeDOM } | ||
} | ||
@@ -154,0 +159,0 @@ } |
Sorry, the diff of this file is not supported yet
27978
11
309
Updatedprosemirror-model@^1.2.0