]> BookStack Code Mirror - bookstack/commitdiff
Imported marks from example schema for customization
authorDan Brown <redacted>
Fri, 14 Jan 2022 14:55:07 +0000 (14:55 +0000)
committerDan Brown <redacted>
Fri, 14 Jan 2022 14:55:07 +0000 (14:55 +0000)
TODO [new file with mode: 0644]
package-lock.json
package.json
resources/js/editor/schema-marks.js

diff --git a/TODO b/TODO
new file mode 100644 (file)
index 0000000..977e71e
--- /dev/null
+++ b/TODO
@@ -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.
\ No newline at end of file
index df713a1b98d1bbbe8aa9dd6586a41b17e7bd6343..1215895807ba574bc04e3defe59a5e446900efaf 100644 (file)
@@ -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",
         "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",
         "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",
index c4ea1a302b33371e4077e53a73b2b9d339308b2b..bd16a728d6d412eaa772f6d33bb24c0f42bdfd88 100644 (file)
@@ -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",
index 52335fac6da320feb2f737fe7c2beb0b26ed090a..c8b8da3464a20052dd73b79c771774b756f342f2 100644 (file)
@@ -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;
\ No newline at end of file