fix: resolve TypeScript errors in frontend build

This commit is contained in:
Hiro
2026-03-30 23:16:07 +00:00
parent b733306773
commit 24925e1acb
2941 changed files with 418042 additions and 49 deletions

8
node_modules/prosemirror-schema-basic/.tern-project generated vendored Normal file
View File

@@ -0,0 +1,8 @@
{
"libs": ["browser"],
"plugins": {
"node": {},
"complete_strings": {},
"es_modules": {}
}
}

81
node_modules/prosemirror-schema-basic/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,81 @@
## 1.2.4 (2025-03-18)
### Bug fixes
Add a `code` flag to the code mark.
## 1.2.3 (2024-07-14)
### Bug fixes
Add attribute type validation for headings, images, and link marks.
## 1.2.2 (2023-05-17)
### Bug fixes
Include CommonJS type declarations in the package to please new TypeScript resolution settings.
## 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)
### New features
Include TypeScript type declarations.
## 1.1.2 (2019-11-20)
### Bug fixes
Rename ES module files to use a .js extension, since Webpack gets confused by .mjs
## 1.1.1 (2019-11-19)
### Bug fixes
The file referred to in the package's `module` field now is compiled down to ES5.
## 1.1.0 (2019-11-08)
### New features
Add a `module` field to package json file.
## 1.0.1 (2019-04-18)
### Bug fixes
Make sure images and links don't render whatever happens to be in `node.attrs` to the DOM.
## 0.19.0 (2017-03-16)
### Breaking changes
Link marks are now non-inclusive by default.
## 0.12.0 (2016-10-21)
### Bug fixes
Don't treat \<b style=font-weight: normal> as strong when parsing.
(Google Docs puts such ridiculous HTML on the clipboard.)
## 0.11.0 (2016-09-21)
### Breaking changes
Moved into a separate module.
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](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](https://prosemirror.net/docs/ref/version/0.11.0.html#schema-list)
module.

100
node_modules/prosemirror-schema-basic/CONTRIBUTING.md generated vendored Normal file
View File

@@ -0,0 +1,100 @@
# How to contribute
- [Getting help](#getting-help)
- [Submitting bug reports](#submitting-bug-reports)
- [Contributing code](#contributing-code)
## Getting help
Community discussion, questions, and informal bug reporting is done on the
[discuss.ProseMirror forum](http://discuss.prosemirror.net).
## Submitting bug reports
Report bugs on the
[GitHub issue tracker](http://github.com/prosemirror/prosemirror/issues).
Before reporting a bug, please read these pointers.
- The issue tracker is for *bugs*, not requests for help. Questions
should be asked on the [forum](http://discuss.prosemirror.net).
- Include information about the version of the code that exhibits the
problem. For browser-related issues, include the browser and browser
version on which the problem occurred.
- Mention very precisely what went wrong. "X is broken" is not a good
bug report. What did you expect to happen? What happened instead?
Describe the exact steps a maintainer has to take to make the
problem occur. A screencast can be useful, but is no substitute for
a textual description.
- A great way to make it easy to reproduce your problem, if it can not
be trivially reproduced on the website demos, is to submit a script
that triggers the issue.
## Contributing code
- Make sure you have a [GitHub Account](https://github.com/signup/free)
- Fork the relevant repository
([how to fork a repo](https://help.github.com/articles/fork-a-repo))
- Create a local checkout of the code. You can use the
[main repository](https://github.com/prosemirror/prosemirror) to
easily check out all core modules.
- Make your changes, and commit them
- Follow the code style of the rest of the project (see below). Run
`npm run lint` (in the main repository checkout) to make sure that
the linter is happy.
- If your changes are easy to test or likely to regress, add tests in
the relevant `test/` directory. Either put them in an existing
`test-*.js` file, if they fit there, or add a new file.
- Make sure all tests pass. Run `npm run test` to verify tests pass
(you will need Node.js v6+).
- Submit a pull request ([how to create a pull request](https://help.github.com/articles/fork-a-repo)).
Don't put more than one feature/fix in a single pull request.
By contributing code to ProseMirror you
- Agree to license the contributed code under the project's [MIT
license](https://github.com/ProseMirror/prosemirror/blob/master/LICENSE).
- Confirm that you have the right to contribute and license the code
in question. (Either you hold all rights on the code, or the rights
holder has explicitly granted the right to use it like this,
through a compatible open source license or through a direct
agreement with you.)
### Coding standards
- ES6 syntax, targeting an ES5 runtime (i.e. don't use library
elements added by ES6, don't use ES7/ES.next syntax).
- 2 spaces per indentation level, no tabs.
- No semicolons except when necessary.
- Follow the surrounding code when it comes to spacing, brace
placement, etc.
- Brace-less single-statement bodies are encouraged (whenever they
don't impact readability).
- [getdocs](https://github.com/marijnh/getdocs)-style doc comments
above items that are part of the public API.
- When documenting non-public items, you can put the type after a
single colon, so that getdocs doesn't pick it up and add it to the
API reference.
- The linter (`npm run lint`) complains about unused variables and
functions. Prefix their names with an underscore to muffle it.
- ProseMirror does *not* follow JSHint or JSLint prescribed style.
Patches that try to 'fix' code to pass one of these linters will not
be accepted.

19
node_modules/prosemirror-schema-basic/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,19 @@
Copyright (C) 2015-2017 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

28
node_modules/prosemirror-schema-basic/README.md generated vendored Normal file
View File

@@ -0,0 +1,28 @@
# prosemirror-schema-basic
[ [**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) ]
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
contentEditable, with support for collaborative editing and custom
document schemas.
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](https://prosemirror.net) has more information, a
number of [examples](https://prosemirror.net/examples/) and the
[documentation](https://prosemirror.net/docs/).
This code is released under an
[MIT license](https://github.com/prosemirror/prosemirror/tree/master/LICENSE).
There's a [forum](http://discuss.prosemirror.net) for general
discussion and support requests, and the
[Github bug tracker](https://github.com/prosemirror/prosemirror/issues)
is the place to report issues.
We aim to be an inclusive, welcoming community. To make that explicit,
we have a [code of
conduct](http://contributor-covenant.org/version/1/1/0/) that applies
to communication around the project.

246
node_modules/prosemirror-schema-basic/dist/index.cjs generated vendored Normal file
View File

@@ -0,0 +1,246 @@
'use strict';
var prosemirrorModel = require('prosemirror-model');
var pDOM = ["p", 0],
blockquoteDOM = ["blockquote", 0],
hrDOM = ["hr"],
preDOM = ["pre", ["code", 0]],
brDOM = ["br"];
var nodes = {
doc: {
content: "block+"
},
paragraph: {
content: "inline*",
group: "block",
parseDOM: [{
tag: "p"
}],
toDOM: function toDOM() {
return pDOM;
}
},
blockquote: {
content: "block+",
group: "block",
defining: true,
parseDOM: [{
tag: "blockquote"
}],
toDOM: function toDOM() {
return blockquoteDOM;
}
},
horizontal_rule: {
group: "block",
parseDOM: [{
tag: "hr"
}],
toDOM: function toDOM() {
return hrDOM;
}
},
heading: {
attrs: {
level: {
"default": 1,
validate: "number"
}
},
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];
}
},
code_block: {
content: "text*",
marks: "",
group: "block",
code: true,
defining: true,
parseDOM: [{
tag: "pre",
preserveWhitespace: "full"
}],
toDOM: function toDOM() {
return preDOM;
}
},
text: {
group: "inline"
},
image: {
inline: true,
attrs: {
src: {
validate: "string"
},
alt: {
"default": null,
validate: "string|null"
},
title: {
"default": null,
validate: "string|null"
}
},
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 _node$attrs = node.attrs,
src = _node$attrs.src,
alt = _node$attrs.alt,
title = _node$attrs.title;
return ["img", {
src: src,
alt: alt,
title: title
}];
}
},
hard_break: {
inline: true,
group: "inline",
selectable: false,
parseDOM: [{
tag: "br"
}],
toDOM: function toDOM() {
return brDOM;
}
}
};
var emDOM = ["em", 0],
strongDOM = ["strong", 0],
codeDOM = ["code", 0];
var marks = {
link: {
attrs: {
href: {
validate: "string"
},
title: {
"default": null,
validate: "string|null"
}
},
inclusive: false,
parseDOM: [{
tag: "a[href]",
getAttrs: function getAttrs(dom) {
return {
href: dom.getAttribute("href"),
title: dom.getAttribute("title")
};
}
}],
toDOM: function toDOM(node) {
var _node$attrs2 = node.attrs,
href = _node$attrs2.href,
title = _node$attrs2.title;
return ["a", {
href: href,
title: title
}, 0];
}
},
em: {
parseDOM: [{
tag: "i"
}, {
tag: "em"
}, {
style: "font-style=italic"
}, {
style: "font-style=normal",
clearMark: function clearMark(m) {
return m.type.name == "em";
}
}],
toDOM: function toDOM() {
return emDOM;
}
},
strong: {
parseDOM: [{
tag: "strong"
}, {
tag: "b",
getAttrs: function getAttrs(node) {
return node.style.fontWeight != "normal" && null;
}
}, {
style: "font-weight=400",
clearMark: function clearMark(m) {
return m.type.name == "strong";
}
}, {
style: "font-weight",
getAttrs: function getAttrs(value) {
return /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null;
}
}],
toDOM: function toDOM() {
return strongDOM;
}
},
code: {
code: true,
parseDOM: [{
tag: "code"
}],
toDOM: function toDOM() {
return codeDOM;
}
}
};
var schema = new prosemirrorModel.Schema({
nodes: nodes,
marks: marks
});
exports.marks = marks;
exports.nodes = nodes;
exports.schema = schema;

87
node_modules/prosemirror-schema-basic/dist/index.d.cts generated vendored Normal file
View File

@@ -0,0 +1,87 @@
import { NodeSpec, MarkSpec, Schema } from 'prosemirror-model';
/**
[Specs](https://prosemirror.net/docs/ref/#model.NodeSpec) for the nodes defined in this schema.
*/
declare const nodes: {
/**
NodeSpec The top level document node.
*/
doc: NodeSpec;
/**
A plain paragraph textblock. Represented in the DOM
as a `<p>` element.
*/
paragraph: NodeSpec;
/**
A blockquote (`<blockquote>`) wrapping one or more blocks.
*/
blockquote: NodeSpec;
/**
A horizontal rule (`<hr>`).
*/
horizontal_rule: 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: 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: NodeSpec;
/**
The text node.
*/
text: NodeSpec;
/**
An inline image (`<img>`) node. Supports `src`,
`alt`, and `href` attributes. The latter two default to the empty
string.
*/
image: NodeSpec;
/**
A hard line break, represented in the DOM as `<br>`.
*/
hard_break: NodeSpec;
};
/**
[Specs](https://prosemirror.net/docs/ref/#model.MarkSpec) for the marks in the schema.
*/
declare const marks: {
/**
A link. Has `href` and `title` attributes. `title`
defaults to the empty string. Rendered and parsed as an `<a>`
element.
*/
link: MarkSpec;
/**
An emphasis mark. Rendered as an `<em>` element. Has parse rules
that also match `<i>` and `font-style: italic`.
*/
em: MarkSpec;
/**
A strong mark. Rendered as `<strong>`, parse rules also match
`<b>` and `font-weight: bold`.
*/
strong: MarkSpec;
/**
Code font mark. Represented as a `<code>` element.
*/
code: MarkSpec;
};
/**
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.
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).
*/
declare const schema: Schema<"blockquote" | "image" | "text" | "doc" | "paragraph" | "horizontal_rule" | "heading" | "code_block" | "hard_break", "link" | "code" | "em" | "strong">;
export { marks, nodes, schema };

87
node_modules/prosemirror-schema-basic/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,87 @@
import { NodeSpec, MarkSpec, Schema } from 'prosemirror-model';
/**
[Specs](https://prosemirror.net/docs/ref/#model.NodeSpec) for the nodes defined in this schema.
*/
declare const nodes: {
/**
NodeSpec The top level document node.
*/
doc: NodeSpec;
/**
A plain paragraph textblock. Represented in the DOM
as a `<p>` element.
*/
paragraph: NodeSpec;
/**
A blockquote (`<blockquote>`) wrapping one or more blocks.
*/
blockquote: NodeSpec;
/**
A horizontal rule (`<hr>`).
*/
horizontal_rule: 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: 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: NodeSpec;
/**
The text node.
*/
text: NodeSpec;
/**
An inline image (`<img>`) node. Supports `src`,
`alt`, and `href` attributes. The latter two default to the empty
string.
*/
image: NodeSpec;
/**
A hard line break, represented in the DOM as `<br>`.
*/
hard_break: NodeSpec;
};
/**
[Specs](https://prosemirror.net/docs/ref/#model.MarkSpec) for the marks in the schema.
*/
declare const marks: {
/**
A link. Has `href` and `title` attributes. `title`
defaults to the empty string. Rendered and parsed as an `<a>`
element.
*/
link: MarkSpec;
/**
An emphasis mark. Rendered as an `<em>` element. Has parse rules
that also match `<i>` and `font-style: italic`.
*/
em: MarkSpec;
/**
A strong mark. Rendered as `<strong>`, parse rules also match
`<b>` and `font-weight: bold`.
*/
strong: MarkSpec;
/**
Code font mark. Represented as a `<code>` element.
*/
code: MarkSpec;
};
/**
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.
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).
*/
declare const schema: Schema<"blockquote" | "image" | "text" | "doc" | "paragraph" | "horizontal_rule" | "heading" | "code_block" | "hard_break", "link" | "code" | "em" | "strong">;
export { marks, nodes, schema };

183
node_modules/prosemirror-schema-basic/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,183 @@
import { Schema } from 'prosemirror-model';
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+"
},
/**
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, validate: "number" } },
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: { validate: "string" },
alt: { default: null, validate: "string|null" },
title: { default: null, validate: "string|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; }
}
};
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: { validate: "string" },
title: { default: null, validate: "string|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]; }
},
/**
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" },
{ style: "font-style=normal", clearMark: m => m.type.name == "em" }
],
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=400", clearMark: m => m.type.name == "strong" },
{ 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: {
code: true,
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.
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 });
export { marks, nodes, schema };

37
node_modules/prosemirror-schema-basic/package.json generated vendored Normal file
View File

@@ -0,0 +1,37 @@
{
"name": "prosemirror-schema-basic",
"version": "1.2.4",
"description": "Basic schema elements for ProseMirror",
"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",
"maintainers": [
{
"name": "Marijn Haverbeke",
"email": "marijn@haverbeke.berlin",
"web": "http://marijnhaverbeke.nl"
}
],
"repository": {
"type": "git",
"url": "git://github.com/prosemirror/prosemirror-schema-basic.git"
},
"dependencies": {
"prosemirror-model": "^1.25.0"
},
"devDependencies": {
"@prosemirror/buildhelper": "^0.1.5",
"prosemirror-test-builder": "^1.0.0"
},
"scripts": {
"test": "pm-runtests",
"prepare": "pm-buildhelper src/schema-basic.ts"
}
}

8
node_modules/prosemirror-schema-basic/src/README.md generated vendored Normal file
View File

@@ -0,0 +1,8 @@
This module defines a simple schema. You can use it directly, extend
it, or just pick out a few node and mark specs to use in a new schema.
@schema
@nodes
@marks

View File

@@ -0,0 +1,166 @@
import {Schema, NodeSpec, MarkSpec, DOMOutputSpec} from "prosemirror-model"
const pDOM: DOMOutputSpec = ["p", 0], blockquoteDOM: DOMOutputSpec = ["blockquote", 0],
hrDOM: DOMOutputSpec = ["hr"], preDOM: DOMOutputSpec = ["pre", ["code", 0]],
brDOM: DOMOutputSpec = ["br"]
/// [Specs](#model.NodeSpec) for the nodes defined in this schema.
export const nodes = {
/// NodeSpec The top level document node.
doc: {
content: "block+"
} as NodeSpec,
/// A plain paragraph textblock. Represented in the DOM
/// as a `<p>` element.
paragraph: {
content: "inline*",
group: "block",
parseDOM: [{tag: "p"}],
toDOM() { return pDOM }
} as NodeSpec,
/// A blockquote (`<blockquote>`) wrapping one or more blocks.
blockquote: {
content: "block+",
group: "block",
defining: true,
parseDOM: [{tag: "blockquote"}],
toDOM() { return blockquoteDOM }
} as NodeSpec,
/// A horizontal rule (`<hr>`).
horizontal_rule: {
group: "block",
parseDOM: [{tag: "hr"}],
toDOM() { return hrDOM }
} as 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, validate: "number"}},
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] }
} as 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() { return preDOM }
} as NodeSpec,
/// The text node.
text: {
group: "inline"
} as 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: {validate: "string"},
alt: {default: null, validate: "string|null"},
title: {default: null, validate: "string|null"}
},
group: "inline",
draggable: true,
parseDOM: [{tag: "img[src]", getAttrs(dom: HTMLElement) {
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}] }
} as NodeSpec,
/// A hard line break, represented in the DOM as `<br>`.
hard_break: {
inline: true,
group: "inline",
selectable: false,
parseDOM: [{tag: "br"}],
toDOM() { return brDOM }
} as NodeSpec
}
const emDOM: DOMOutputSpec = ["em", 0], strongDOM: DOMOutputSpec = ["strong", 0], codeDOM: DOMOutputSpec = ["code", 0]
/// [Specs](#model.MarkSpec) for the marks in the schema.
export 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: {validate: "string"},
title: {default: null, validate: "string|null"}
},
inclusive: false,
parseDOM: [{tag: "a[href]", getAttrs(dom: HTMLElement) {
return {href: dom.getAttribute("href"), title: dom.getAttribute("title")}
}}],
toDOM(node) { let {href, title} = node.attrs; return ["a", {href, title}, 0] }
} as 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"},
{style: "font-style=normal", clearMark: m => m.type.name == "em"}
],
toDOM() { return emDOM }
} as 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: (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 }
} as MarkSpec,
/// Code font mark. Represented as a `<code>` element.
code: {
code: true,
parseDOM: [{tag: "code"}],
toDOM() { return codeDOM }
} as MarkSpec
}
/// 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).
export const schema = new Schema({nodes, marks})