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

feat: subscript service

parent 976e242d
No related branches found
No related tags found
1 merge request!45Develop
export { default as Blockquote } from "./Blockquote";
export { default as SmallCaps } from "./SmallCaps";
export { default as StrikeThrough } from "./StrikeThrough";
export { default as Subscript } from "./Subscript";
// export { default as Subscript } from "./Subscript";
export { default as Superscript } from "./Superscript";
export { default as Underline } from "./Underline";
export { default as Table } from "./Table";
......
import Service from "wax-prosemirror-core/src/services/Service";
import { codeMark } from "wax-prosemirror-schema";
import Code from "./Code";
class CodeService extends Service {
......@@ -7,15 +8,7 @@ class CodeService extends Service {
register() {
this.container
.bind("schema")
.toConstantValue({
code: {
parseDOM: { tag: "code" },
toDOM(hook, next) {
hook.value = ["code", 0];
next();
}
}
})
.toConstantValue({ code: codeMark })
.whenTargetNamed("mark");
this.container.bind("Code").to(Code);
......
import Service from "wax-prosemirror-core/src/services/Service";
import { subscriptMark } from "wax-prosemirror-schema";
import Subscript from "./Subscript";
class SubscriptService extends Service {
boot() {}
register() {
this.container
.bind("schema")
.toConstantValue({ subscript: subscriptMark })
.whenTargetNamed("mark");
this.container.bind("Subscript").to(Subscript);
}
}
export default SubscriptService;
import CodeService from "./CodeService/CodeService";
import StrongService from "./StrongService/StrongService";
import EmphasisService from "./EmphasisService/EmphasisService";
export default [new CodeService(), new StrongService(), new EmphasisService()];
import SubscriptService from "./SubscriptService/SubscriptService";
export default [
new CodeService(),
new StrongService(),
new EmphasisService(),
new SubscriptService()
];
......@@ -5,3 +5,4 @@ export { default as codeMark } from "./src/marks/codeMark";
export { default as strongMark } from "./src/marks/strongMark";
export { default as linkMark } from "./src/marks/linkMark";
export { default as emphasisMark } from "./src/marks/emphasisMark";
export { default as subscriptMark } from "./src/marks/subscriptMark";
......@@ -3,11 +3,6 @@ const emDOM = ["em", 0],
codeDOM = ["code", 0];
const marks = {
subscript: {
excludes: "superscript",
parseDOM: [{ tag: "sub" }, { style: "vertical-align=sub" }],
toDOM: () => ["sub"]
},
superscript: {
excludes: "subscript",
parseDOM: [{ tag: "sup" }, { style: "vertical-align=super" }],
......
const subscript = {
excludes: "superscript",
parseDOM: [{ tag: "sub" }, { style: "vertical-align=sub" }],
toDOM(hook, next) {
hook.value = ["sub"];
next();
}
};
export default subscript;
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