Skip to content
Snippets Groups Projects
Commit e0e39610 authored by chris's avatar chris
Browse files

remove unused from core

parent c91c1740
No related branches found
No related tags found
1 merge request!5Develop
......@@ -2,11 +2,7 @@ import { history } from "prosemirror-history";
import { dropCursor } from "prosemirror-dropcursor";
import { gapCursor } from "prosemirror-gapcursor";
import "prosemirror-gapcursor/style/gapcursor.css";
//TODO remove everything in comments
// import "prosemirror-tables/style/tables.css";
import placeholderPlugin from "./plugins/placeholderPlugin";
// import { columnResizing, tableEditing } from "prosemirror-tables";
// import rules from "./rules";
......@@ -16,10 +12,4 @@ export default [
gapCursor(),
history(),
placeholderPlugin
// columnResizing(),
// tableEditing()
];
// for tables
// document.execCommand("enableObjectResizing", false, false);
// document.execCommand("enableInlineTableEditing", false, false);
import { marks } from "prosemirror-schema-basic";
const subscript = {
excludes: "superscript",
parseDOM: [{ tag: "sub" }, { style: "vertical-align=sub" }],
toDOM: () => ["sub"]
};
const superscript = {
excludes: "subscript",
parseDOM: [{ tag: "sup" }, { style: "vertical-align=super" }],
toDOM: () => ["sup"]
};
const strikethrough = {
parseDOM: [
{ tag: "strike" },
{ style: "text-decoration:line-through" },
{ style: "text-decoration-line:line-through" }
],
toDOM: () => [
"span",
{
style: "text-decoration-line:line-through"
}
]
};
const underline = {
parseDOM: [{ tag: "u" }, { style: "text-decoration:underline" }],
toDOM: () => [
"span",
{
style: "text-decoration:underline"
}
]
};
const source = {
parseDOM: [{ tag: "cite" }],
toDOM() {
return ["cite", 0];
}
};
const small_caps = {
attrs: {
class: { default: "small-caps" }
},
inclusive: false,
parseDOM: [
{
tag: "span",
getAttrs(dom) {
return { class: dom.getAttribute("class") };
}
}
],
toDOM(node) {
return ["span", node.attrs, 0];
}
};
export default {
...marks,
subscript,
superscript,
strikethrough,
underline,
source,
small_caps
};
import { schema } from "prosemirror-schema-basic";
import { orderedList, bulletList, listItem } from "prosemirror-schema-list";
import { tableNodes } from "prosemirror-tables";
const 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.
export const 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",
attrs: {
class: { default: "paragraph" }
},
parseDOM: [
{
tag: "p",
getAttrs(dom) {
return {
class: dom.getAttribute("class")
};
}
}
],
toDOM(node) {
return ["p", node.attrs, 0];
}
},
figureTitle: {
content: "inline*",
group: "block",
attrs: {
class: { default: "figureTitle" }
},
parseDOM: [
{
tag: "p",
getAttrs(dom) {
return {
class: dom.getAttribute("class")
};
}
}
],
toDOM(node) {
return ["p", node.attrs, 0];
}
},
figureCaption: {
content: "inline*",
group: "block",
attrs: {
class: { default: "figureCaption" }
},
parseDOM: [
{
tag: "p",
getAttrs(dom) {
return {
class: dom.getAttribute("class")
};
}
}
],
toDOM(node) {
return ["p", node.attrs, 0];
}
},
// :: NodeSpec A horizontal rule (`<hr>`).
horizontal_rule: {
group: "block",
parseDOM: [{ tag: "hr" }],
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: { class: { default: "ct" }, 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) {
if (node.attrs.level === 1) {
return ["h" + node.attrs.level, node.attrs, 0];
} else {
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.
codeBlock: {
content: "block+",
group: "block",
defining: true,
attrs: {
class: { default: "code-block" }
},
parseDOM: [{ tag: "pre" }],
toDOM(node) {
return ["pre", node.attrs, 0];
}
},
// :: 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 }
},
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) {
return ["img", node.attrs];
}
},
// :: 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;
}
}
};
const extraNodes = {
ordered_list: {
...orderedList,
content: "list_item+",
group: "block"
},
bullet_list: {
...bulletList,
content: "list_item+",
group: "block"
},
list_item: {
...listItem,
content: "paragraph block*",
group: "block"
},
// codeMirrorNode: {
// group: "block",
// content: "text*",
// code: true,
// defining: true,
// attrs: {
// text: { default: "" },
// language: { default: "text/plain" }
// },
// parseDOM: [
// {
// tag: "pre",
// getAttrs: dom => ({
// text: dom.textContent,
// language: dom.getAttribute("data-language") || "text/plain"
// })
// }
// ],
// toDOM(node) {
// return ["pre", { "data-language": node.attrs.language }, node.attrs.text];
// },
// marks: schema.markSpec
// },
subtitle: {
content: "inline*",
group: "block",
priority: 0,
defining: true,
attrs: {
class: { default: "cst" }
},
parseDOM: [
{
tag: "p",
getAttrs(dom) {
return {
class: dom.getAttribute("class")
};
}
}
],
toDOM(node) {
return ["p", node.attrs, 0];
}
},
// :: NodeSpec A blockquote (`<blockquote>`) wrapping one or more blocks.
epigraph: {
content: "block+",
group: "block",
defining: true,
attrs: {
class: { default: "epigraph" }
},
parseDOM: [{ tag: "blockquote" }],
toDOM(node) {
return ["blockquote", node.attrs, 0];
}
},
quote: {
content: "block+",
group: "block",
defining: true,
attrs: {
class: { default: "quote" }
},
parseDOM: [{ tag: "blockquote" }],
toDOM(node) {
return ["blockquote", node.attrs, 0];
}
},
special: {
content: "block+",
group: "block",
defining: true,
attrs: {
class: { default: "block-special" }
},
parseDOM: [
{
tag: "div",
getAttrs(dom) {
return {
class: dom.getAttribute("class")
};
}
}
],
toDOM(node) {
return ["div", node.attrs, 0];
}
},
important: {
content: "block+",
group: "block",
defining: true,
attrs: {
class: { default: "block-important" }
},
parseDOM: [
{
tag: "div",
getAttrs(dom) {
return {
class: dom.getAttribute("class")
};
}
}
],
toDOM(node) {
return ["div", node.attrs, 0];
}
},
recommended: {
content: "block+",
group: "block",
defining: true,
attrs: {
class: { default: "block-recommended" }
},
parseDOM: [
{
tag: "div",
getAttrs(dom) {
return {
class: dom.getAttribute("class")
};
}
}
],
toDOM(node) {
return ["div", node.attrs, 0];
}
},
caution: {
content: "block+",
group: "block",
defining: true,
attrs: {
class: { default: "block-caution" }
},
parseDOM: [
{
tag: "div",
getAttrs(dom) {
return {
class: dom.getAttribute("class")
};
}
}
],
toDOM(node) {
return ["div", node.attrs, 0];
}
},
tip: {
content: "block+",
group: "block",
defining: true,
attrs: {
class: { default: "block-tip" }
},
parseDOM: [
{
tag: "div",
getAttrs(dom) {
return {
class: dom.getAttribute("class")
};
}
}
],
toDOM(node) {
return ["div", node.attrs, 0];
}
},
footnote: {
group: "inline",
content: "inline*",
inline: true,
// This makes the view treat the node as a leaf, even though it
// technically has content
atom: true,
toDOM: () => ["footnote", 0],
parseDOM: [{ tag: "footnote" }]
}
};
export default {
...nodes,
...extraNodes,
...tableNodes({
tableGroup: "block",
cellContent: "block+"
})
};
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment