Skip to content

fix missing markdown-it-mathjax npm package #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ lib/
node_modules/
*.egg-info/
*.ipynb_checkpoints
tsconfig.tsbuildinfo
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"fuzzyset": "0.0.4",
"markdown-it": "^9.0.1",
"markdown-it-ins": "^2.0.0",
"markdown-it-mathjax": "^2.0.0",
"material-design-icons-iconfont": "^5.0.1",
"mathjax": "^2.7.5",
"mathjax-node": "^2.1.1",
Expand Down
23 changes: 18 additions & 5 deletions src/RichTextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import { CodeMenu } from "./codemenu";
import { Widget } from '@phosphor/widgets';
import ReactDOM from "react-dom";
import { schema } from "./prosemirror/prosemirror-schema";
import { wrapInList } from "prosemirror-schema-list";
import { wrapInList, liftListItem, sinkListItem } from "prosemirror-schema-list";
import {undo, redo} from "prosemirror-history";

// import { PageConfig } from "@jupyterlab/coreutils";
// import { MenuWidgetObject } from './widget';
Expand Down Expand Up @@ -149,7 +150,7 @@ export default class RichTextMenu extends React.Component<{view: EditorView,
componentDidMount() {

if (!this.props.view) {
this.setState({inactiveMarks: ["strong", "em", "underline", "strikethrough", "heading", "bullet_list", "ordered_list", "blockquote", "code", "link", "image"]});
this.setState({inactiveMarks: ["undo", "redo", "strong", "em", "underline", "strikethrough", "heading", "bullet_list", "ordered_list", "blockquote", "code", "link", "image"]});
}
}
componentWillUnmount() {
Expand Down Expand Up @@ -311,6 +312,18 @@ export default class RichTextMenu extends React.Component<{view: EditorView,
case "ordered_list":
wrapInList(schema.nodes.ordered_list)(view.state, view.dispatch);
break;
case "indent_increase":
sinkListItem(schema.nodes.list_item)(view.state, view.dispatch);
break;
case "indent_decrease":
liftListItem(schema.nodes.list_item)(view.state, view.dispatch);
break;
case "undo":
undo(view.state, view.dispatch);
break;
case "redo":
redo(view.state, view.dispatch);
break;
default:
break;
};
Expand Down Expand Up @@ -480,10 +493,10 @@ export default class RichTextMenu extends React.Component<{view: EditorView,
*/
render() {

const formats = ["format_bold", "format_italic", "format_underline", "strikethrough_s",
"text_fields", "format_list_bulleted", "format_list_numbered", "format_quote", "code", "insert_link", "photo", ];
const formats = ["undo", "redo", "format_bold", "format_italic", "format_underline", "strikethrough_s",
"text_fields", "format_list_bulleted", "format_list_numbered", "format_indent_decrease", "format_indent_increase", "format_quote", "code", "insert_link", "photo", ];
const tooltips = ["bold", "italic", "underline", "strikethrough", "text-styles", "bulleted-list", "numbered-list", "blockquote", "code", "link", "image"];
const marks = ["strong", "em", "underline", "strikethrough", "heading", "bullet_list", "ordered_list", "blockquote", "code", "link", "image"];
const marks = ["undo", "redo", "strong", "em", "underline", "strikethrough", "heading", "bullet_list", "ordered_list", "indent_increase", "indent_decrease", "blockquote", "code", "link", "image"];
// const separators = ["strong", "bullet_list", "link"]
return (
<div className="menu">
Expand Down
10 changes: 9 additions & 1 deletion src/MenuItem.tsx → src/menuitem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ export default class MenuItem extends React.Component<{format: string, active: b
return "ordered_list";
case "text_fields":
return "heading";
case "undo":
return "undo";
case "redo":
return "redo";
case "format_indent_increase":
return "indent_increase";
case "format_indent_decrease":
return "indent_decrease";
default:
break;
}
Expand Down Expand Up @@ -153,4 +161,4 @@ export default class MenuItem extends React.Component<{format: string, active: b

}

}
}
3 changes: 3 additions & 0 deletions src/prosemirror/ProseMirrorEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { schema } from "./prosemirror-schema";
import { CodeBlockView, InlineMathView, BlockMathView, ImageView } from "./nodeviews";
import { createInputRules } from "./inputrules";
import { inputRules } from "prosemirror-inputrules";
import { history } from "prosemirror-history";
// import { Node } from "prosemirror-model";
// import markdownit from "markdown-it/lib";
// import { Transaction } from "prosemirror-state";
Expand Down Expand Up @@ -386,6 +387,8 @@ namespace Private {
initValue
),
plugins: [
// Load history plugin
history(),
keymap(buildKeymap(schema)),
keymap(baseKeymap),
inputRules({rules: createInputRules()}),
Expand Down