Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prosemirror-schema-basic

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prosemirror-schema-basic - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0-beta.1

dist/index.cjs

8

CHANGELOG.md

@@ -44,9 +44,9 @@ ## 1.1.2 (2019-11-20)

No longer exports the [specs](http://prosemirror.net/docs/ref/version/0.11.0.html#model.NodeSpec) for the nodes and
No longer exports the [specs](https://prosemirror.net/docs/ref/version/0.11.0.html#model.NodeSpec) for the nodes and
marks separately, since they are now plain objects, not subclasses.
They are still exported through [nodes](http://prosemirror.net/docs/ref/version/0.11.0.html#schema-basic.nodes) and
[marks](http://prosemirror.net/docs/ref/version/0.11.0.html#schema-basic.marks) objects.
They are still exported through [nodes](https://prosemirror.net/docs/ref/version/0.11.0.html#schema-basic.nodes) and
[marks](https://prosemirror.net/docs/ref/version/0.11.0.html#schema-basic.marks) objects.
The list-related nodes were moved to the [schema-list](http://prosemirror.net/docs/ref/version/0.11.0.html#schema-list)
The list-related nodes were moved to the [schema-list](https://prosemirror.net/docs/ref/version/0.11.0.html#schema-list)
module.

@@ -1,173 +0,175 @@

'use strict';
import { Schema } from 'prosemirror-model';
Object.defineProperty(exports, '__esModule', { value: true });
var prosemirrorModel = require('prosemirror-model');
var pDOM = ["p", 0], blockquoteDOM = ["blockquote", 0], hrDOM = ["hr"],
preDOM = ["pre", ["code", 0]], brDOM = ["br"];
// :: Object
// [Specs](#model.NodeSpec) for the nodes defined in this schema.
var nodes = {
// :: NodeSpec The top level document node.
doc: {
content: "block+"
},
// :: NodeSpec A plain paragraph textblock. Represented in the DOM
// as a `<p>` element.
paragraph: {
content: "inline*",
group: "block",
parseDOM: [{tag: "p"}],
toDOM: function toDOM() { return pDOM }
},
// :: NodeSpec A blockquote (`<blockquote>`) wrapping one or more blocks.
blockquote: {
content: "block+",
group: "block",
defining: true,
parseDOM: [{tag: "blockquote"}],
toDOM: function toDOM() { return blockquoteDOM }
},
// :: NodeSpec A horizontal rule (`<hr>`).
horizontal_rule: {
group: "block",
parseDOM: [{tag: "hr"}],
toDOM: function toDOM() { return hrDOM }
},
// :: NodeSpec A heading textblock, with a `level` attribute that
// should hold the number 1 to 6. Parsed and serialized as `<h1>` to
// `<h6>` elements.
heading: {
attrs: {level: {default: 1}},
content: "inline*",
group: "block",
defining: true,
parseDOM: [{tag: "h1", attrs: {level: 1}},
{tag: "h2", attrs: {level: 2}},
{tag: "h3", attrs: {level: 3}},
{tag: "h4", attrs: {level: 4}},
{tag: "h5", attrs: {level: 5}},
{tag: "h6", attrs: {level: 6}}],
toDOM: function toDOM(node) { return ["h" + node.attrs.level, 0] }
},
// :: NodeSpec A code listing. Disallows marks or non-text inline
// nodes by default. Represented as a `<pre>` element with a
// `<code>` element inside of it.
code_block: {
content: "text*",
marks: "",
group: "block",
code: true,
defining: true,
parseDOM: [{tag: "pre", preserveWhitespace: "full"}],
toDOM: function toDOM() { return preDOM }
},
// :: NodeSpec The text node.
text: {
group: "inline"
},
// :: NodeSpec An inline image (`<img>`) node. Supports `src`,
// `alt`, and `href` attributes. The latter two default to the empty
// string.
image: {
inline: true,
attrs: {
src: {},
alt: {default: null},
title: {default: null}
const pDOM = ["p", 0], blockquoteDOM = ["blockquote", 0], hrDOM = ["hr"], preDOM = ["pre", ["code", 0]], brDOM = ["br"];
/**
[Specs](https://prosemirror.net/docs/ref/#model.NodeSpec) for the nodes defined in this schema.
*/
const nodes = {
/**
NodeSpec The top level document node.
*/
doc: {
content: "block+"
},
group: "inline",
draggable: true,
parseDOM: [{tag: "img[src]", getAttrs: function getAttrs(dom) {
return {
src: dom.getAttribute("src"),
title: dom.getAttribute("title"),
alt: dom.getAttribute("alt")
}
}}],
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}] }
},
// :: NodeSpec A hard line break, represented in the DOM as `<br>`.
hard_break: {
inline: true,
group: "inline",
selectable: false,
parseDOM: [{tag: "br"}],
toDOM: function toDOM() { return brDOM }
}
/**
A plain paragraph textblock. Represented in the DOM
as a `<p>` element.
*/
paragraph: {
content: "inline*",
group: "block",
parseDOM: [{ tag: "p" }],
toDOM() { return pDOM; }
},
/**
A blockquote (`<blockquote>`) wrapping one or more blocks.
*/
blockquote: {
content: "block+",
group: "block",
defining: true,
parseDOM: [{ tag: "blockquote" }],
toDOM() { return blockquoteDOM; }
},
/**
A horizontal rule (`<hr>`).
*/
horizontal_rule: {
group: "block",
parseDOM: [{ tag: "hr" }],
toDOM() { return hrDOM; }
},
/**
A heading textblock, with a `level` attribute that
should hold the number 1 to 6. Parsed and serialized as `<h1>` to
`<h6>` elements.
*/
heading: {
attrs: { level: { default: 1 } },
content: "inline*",
group: "block",
defining: true,
parseDOM: [{ tag: "h1", attrs: { level: 1 } },
{ tag: "h2", attrs: { level: 2 } },
{ tag: "h3", attrs: { level: 3 } },
{ tag: "h4", attrs: { level: 4 } },
{ tag: "h5", attrs: { level: 5 } },
{ tag: "h6", attrs: { level: 6 } }],
toDOM(node) { return ["h" + node.attrs.level, 0]; }
},
/**
A code listing. Disallows marks or non-text inline
nodes by default. Represented as a `<pre>` element with a
`<code>` element inside of it.
*/
code_block: {
content: "text*",
marks: "",
group: "block",
code: true,
defining: true,
parseDOM: [{ tag: "pre", preserveWhitespace: "full" }],
toDOM() { return preDOM; }
},
/**
The text node.
*/
text: {
group: "inline"
},
/**
An inline image (`<img>`) node. Supports `src`,
`alt`, and `href` attributes. The latter two default to the empty
string.
*/
image: {
inline: true,
attrs: {
src: {},
alt: { default: null },
title: { default: null }
},
group: "inline",
draggable: true,
parseDOM: [{ tag: "img[src]", getAttrs(dom) {
return {
src: dom.getAttribute("src"),
title: dom.getAttribute("title"),
alt: dom.getAttribute("alt")
};
} }],
toDOM(node) { let { src, alt, title } = node.attrs; return ["img", { src, alt, title }]; }
},
/**
A hard line break, represented in the DOM as `<br>`.
*/
hard_break: {
inline: true,
group: "inline",
selectable: false,
parseDOM: [{ tag: "br" }],
toDOM() { return brDOM; }
}
};
var emDOM = ["em", 0], strongDOM = ["strong", 0], codeDOM = ["code", 0];
// :: Object [Specs](#model.MarkSpec) for the marks in the schema.
var marks = {
// :: MarkSpec A link. Has `href` and `title` attributes. `title`
// defaults to the empty string. Rendered and parsed as an `<a>`
// element.
link: {
attrs: {
href: {},
title: {default: null}
const emDOM = ["em", 0], strongDOM = ["strong", 0], codeDOM = ["code", 0];
/**
[Specs](https://prosemirror.net/docs/ref/#model.MarkSpec) for the marks in the schema.
*/
const marks = {
/**
A link. Has `href` and `title` attributes. `title`
defaults to the empty string. Rendered and parsed as an `<a>`
element.
*/
link: {
attrs: {
href: {},
title: { default: null }
},
inclusive: false,
parseDOM: [{ tag: "a[href]", getAttrs(dom) {
return { href: dom.getAttribute("href"), title: dom.getAttribute("title") };
} }],
toDOM(node) { let { href, title } = node.attrs; return ["a", { href, title }, 0]; }
},
inclusive: false,
parseDOM: [{tag: "a[href]", getAttrs: function getAttrs(dom) {
return {href: dom.getAttribute("href"), title: dom.getAttribute("title")}
}}],
toDOM: function toDOM(node) { var ref = node.attrs;
var href = ref.href;
var title = ref.title; return ["a", {href: href, title: title}, 0] }
},
// :: MarkSpec An emphasis mark. Rendered as an `<em>` element.
// Has parse rules that also match `<i>` and `font-style: italic`.
em: {
parseDOM: [{tag: "i"}, {tag: "em"}, {style: "font-style=italic"}],
toDOM: function toDOM() { return emDOM }
},
// :: MarkSpec A strong mark. Rendered as `<strong>`, parse rules
// also match `<b>` and `font-weight: bold`.
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: function (node) { return node.style.fontWeight != "normal" && null; }},
{style: "font-weight", getAttrs: function (value) { return /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null; }}],
toDOM: function toDOM() { return strongDOM }
},
// :: MarkSpec Code font mark. Represented as a `<code>` element.
code: {
parseDOM: [{tag: "code"}],
toDOM: function toDOM() { return codeDOM }
}
/**
An emphasis mark. Rendered as an `<em>` element. Has parse rules
that also match `<i>` and `font-style: italic`.
*/
em: {
parseDOM: [{ tag: "i" }, { tag: "em" }, { style: "font-style=italic" }],
toDOM() { return emDOM; }
},
/**
A strong mark. Rendered as `<strong>`, parse rules also match
`<b>` and `font-weight: bold`.
*/
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 strongDOM; }
},
/**
Code font mark. Represented as a `<code>` element.
*/
code: {
parseDOM: [{ tag: "code" }],
toDOM() { return codeDOM; }
}
};
/**
This schema roughly corresponds to the document schema used by
[CommonMark](http://commonmark.org/), minus the list elements,
which are defined in the [`prosemirror-schema-list`](https://prosemirror.net/docs/ref/#schema-list)
module.
// :: Schema
// This schema roughly corresponds to the document schema used by
// [CommonMark](http://commonmark.org/), minus the list elements,
// which are defined in the [`prosemirror-schema-list`](#schema-list)
// module.
//
// To reuse elements from this schema, extend or read from its
// `spec.nodes` and `spec.marks` [properties](#model.Schema.spec).
var schema = new prosemirrorModel.Schema({nodes: nodes, marks: marks});
To reuse elements from this schema, extend or read from its
`spec.nodes` and `spec.marks` [properties](https://prosemirror.net/docs/ref/#model.Schema.spec).
*/
const schema = new Schema({ nodes, marks });
exports.marks = marks;
exports.nodes = nodes;
exports.schema = schema;
//# sourceMappingURL=index.js.map
export { marks, nodes, schema };
{
"name": "prosemirror-schema-basic",
"version": "1.1.2",
"version": "1.2.0-beta.1",
"description": "Basic schema elements for ProseMirror",
"main": "dist/index.js",
"module": "dist/index.es.js",
"type": "module",
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"sideEffects": false,
"license": "MIT",

@@ -23,11 +30,9 @@ "maintainers": [

"devDependencies": {
"rollup": "^1.26.3",
"@rollup/plugin-buble": "^0.20.0"
"@prosemirror/buildhelper": "^0.1.5",
"prosemirror-test-builder": "^1.0.0"
},
"scripts": {
"test": "true",
"build": "rollup -c",
"watch": "rollup -c -w",
"prepare": "npm run build"
"test": "pm-runtests",
"prepare": "pm-buildhelper src/schema-basic.ts"
}
}
# prosemirror-schema-basic
[ [**WEBSITE**](http://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/blob/master/CHANGELOG.md) ]
[ [**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) ]
This is a [schema module](http://prosemirror.net/docs/ref/#schema-basic) for [ProseMirror](http://prosemirror.net).
This is a [schema module](https://prosemirror.net/docs/ref/#schema-basic) for [ProseMirror](https://prosemirror.net).
ProseMirror is a well-behaved rich semantic content editor based on

@@ -10,9 +10,9 @@ contentEditable, with support for collaborative editing and custom

This [module](http://prosemirror.net/docs/ref/#schema-basic) defines a
This [module](https://prosemirror.net/docs/ref/#schema-basic) defines a
basic ProseMirror document schema, whose elements can be reused in
other schemas.
The [project page](http://prosemirror.net) has more information, a
number of [examples](http://prosemirror.net/examples/) and the
[documentation](http://prosemirror.net/docs/).
The [project page](https://prosemirror.net) has more information, a
number of [examples](https://prosemirror.net/examples/) and the
[documentation](https://prosemirror.net/docs/).

@@ -19,0 +19,0 @@ This code is released under an

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc