Commit 3a5bc698 authored by chris's avatar chris

more elements

parent 02fcfc0d
......@@ -145,7 +145,9 @@ export default {
source: {
title: "Toggle Source",
content: icons.source,
// active: markActive(schema.marks.code),
active: state => {
return markActive(state.config.schema.marks.source)(state);
},
run(state, dispatch) {
toggleMark(state.config.schema.marks.source)(state, dispatch);
},
......@@ -156,7 +158,9 @@ export default {
small_caps: {
title: "Toggle Small Caps",
content: icons.small_caps,
// active: markActive(schema.marks.code),
active: state => {
return markActive(state.config.schema.marks.small_caps)(state);
},
run(state, dispatch) {
toggleMark(state.config.schema.marks.small_caps)(state, dispatch);
},
......@@ -167,9 +171,9 @@ export default {
subscript: {
title: "Toggle subscript",
content: icons.subscript,
// active: state => {
// return markActive(state.config.schema.marks.subscript)(state);
// },
active: state => {
return markActive(state.config.schema.marks.subscript)(state);
},
run(state, dispatch) {
toggleMark(state.config.schema.marks.subscript)(state, dispatch);
},
......@@ -179,7 +183,9 @@ export default {
superscript: {
title: "Toggle superscript",
content: icons.superscript,
// active: markActive(schema.marks.superscript),
active: state => {
return markActive(state.config.schema.marks.superscript)(state);
},
run(state, dispatch) {
toggleMark(state.config.schema.marks.superscript)(state, dispatch);
},
......@@ -189,7 +195,9 @@ export default {
underline: {
title: "Toggle underline",
content: icons.underline,
// active: markActive(schema.marks.underline),
active: state => {
return markActive(state.config.schema.marks.underline)(state);
},
run(state, dispatch) {
toggleMark(state.config.schema.marks.underline)(state, dispatch);
},
......@@ -200,7 +208,9 @@ export default {
strikethrough: {
title: "Toggle strikethrough",
content: icons.strikethrough,
// active: markActive(schema.marks.strikethrough),
active: state => {
return markActive(state.config.schema.marks.strikethrough)(state);
},
run(state, dispatch) {
toggleMark(state.config.schema.marks.strikethrough)(state, dispatch);
},
......@@ -210,7 +220,9 @@ export default {
link: {
title: "Add or remove link",
content: icons.link,
// active: markActive(schema.marks.link),
active: state => {
return markActive(state.config.schema.marks.link)(state);
},
enable: state => !state.selection.empty,
run(state, dispatch) {
if (markActive(state.config.schema.marks.link)(state)) {
......
......@@ -86,6 +86,61 @@ const EditoriaSchema = {
toDOM() {
return codeDOM;
}
},
subscript: {
excludes: "superscript",
parseDOM: [{ tag: "sub" }, { style: "vertical-align=sub" }],
toDOM: () => ["sub"]
},
superscript: {
excludes: "subscript",
parseDOM: [{ tag: "sup" }, { style: "vertical-align=super" }],
toDOM: () => ["sup"]
},
strikethrough: {
parseDOM: [
{ tag: "strike" },
{ style: "text-decoration:line-through" },
{ style: "text-decoration-line:line-through" }
],
toDOM: () => [
"span",
{
style: "text-decoration-line:line-through"
}
]
},
underline: {
parseDOM: [{ tag: "u" }, { style: "text-decoration:underline" }],
toDOM: () => [
"span",
{
style: "text-decoration:underline"
}
]
},
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];
}
},
source: {
parseDOM: [{ tag: "cite" }],
toDOM() {
return ["cite", 0];
}
}
}
};
......
Markdown is supported
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