1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-12 14:21:46 +03:00

Imported marks from example schema for customization

This commit is contained in:
Dan Brown
2022-01-14 14:55:07 +00:00
parent 0dc64d22ef
commit 07c8876e22
4 changed files with 87 additions and 22 deletions

30
TODO Normal file

@ -0,0 +1,30 @@
- Render color picker view menu item.
### Features
- Tables
- Links
- Images
- Image Resizing in editor
- Drawings
- LTR/RTL control
- Fullscreen
- Paste Image Uploading
- Drag + Drop Image Uploading
- Details/Summary
- Checkbox/TODO list items
- Code blocks
- Inline Code
- Indents
- Iframe/Media
- Clear formatting
- View Code
- Attachment integration (Drag & drop)
- Template system integration.
### Improvements
- List type changing.
- Color picker options should have "clear" option.
- Color picker buttons should be split, with button to re-apply last selected color.
- Color picker options should change color if different instead of remove.

17
package-lock.json generated

@ -15,7 +15,6 @@
"prosemirror-example-setup": "^1.1.2",
"prosemirror-markdown": "^1.6.0",
"prosemirror-model": "^1.15.0",
"prosemirror-schema-basic": "^1.1.2",
"prosemirror-schema-list": "^1.1.6",
"prosemirror-state": "^1.3.4",
"prosemirror-view": "^1.23.2",
@ -1503,14 +1502,6 @@
"orderedmap": "^1.1.0"
}
},
"node_modules/prosemirror-schema-basic": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/prosemirror-schema-basic/-/prosemirror-schema-basic-1.1.2.tgz",
"integrity": "sha512-G4q8WflNsR1Q33QAV4MQO0xWrHLOJ+BQcKswGXMy626wlQj6c/1n1v4eC9ns+h2y1r/fJHZEgSZnsNhm9lbrDw==",
"dependencies": {
"prosemirror-model": "^1.2.0"
}
},
"node_modules/prosemirror-schema-list": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/prosemirror-schema-list/-/prosemirror-schema-list-1.1.6.tgz",
@ -3074,14 +3065,6 @@
"orderedmap": "^1.1.0"
}
},
"prosemirror-schema-basic": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/prosemirror-schema-basic/-/prosemirror-schema-basic-1.1.2.tgz",
"integrity": "sha512-G4q8WflNsR1Q33QAV4MQO0xWrHLOJ+BQcKswGXMy626wlQj6c/1n1v4eC9ns+h2y1r/fJHZEgSZnsNhm9lbrDw==",
"requires": {
"prosemirror-model": "^1.2.0"
}
},
"prosemirror-schema-list": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/prosemirror-schema-list/-/prosemirror-schema-list-1.1.6.tgz",

@ -35,7 +35,6 @@
"prosemirror-example-setup": "^1.1.2",
"prosemirror-markdown": "^1.6.0",
"prosemirror-model": "^1.15.0",
"prosemirror-schema-basic": "^1.1.2",
"prosemirror-schema-list": "^1.1.6",
"prosemirror-state": "^1.3.4",
"prosemirror-view": "^1.23.2",

@ -1,6 +1,55 @@
import {schema as basicSchema} from "prosemirror-schema-basic";
const link = {
attrs: {
href: {},
title: {default: null}
},
inclusive: false,
parseDOM: [{
tag: "a[href]", getAttrs: function getAttrs(dom) {
return {href: dom.getAttribute("href"), title: dom.getAttribute("title")}
}
}],
toDOM: function toDOM(node) {
const ref = node.attrs;
const href = ref.href;
const title = ref.title;
return ["a", {href: href, title: title}, 0]
}
};
const baseMarks = basicSchema.spec.marks;
const em = {
parseDOM: [{tag: "i"}, {tag: "em"}, {style: "font-style=italic"}],
toDOM() {
return ["em", 0]
}
};
const 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() {
return ["strong", 0]
}
};
const code = {
parseDOM: [{tag: "code"}],
toDOM() {
return ["code", 0]
}
};
const underline = {
parseDOM: [{tag: "u"}, {style: "text-decoration=underline"}],
@ -60,13 +109,17 @@ const background_color = {
}
};
const marks = baseMarks.append({
const marks = {
link,
em,
strong,
code,
underline,
strike,
superscript,
subscript,
text_color,
background_color,
});
};
export default marks;