This repository has been archived by the owner on Jan 20, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 589
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of github.com:outline/rich-markdown-editor int…
…o develop
- Loading branch information
Showing
5 changed files
with
77 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
dist | ||
node_modules/* | ||
.log | ||
.DS_Store | ||
.DS_Store | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import Node from "./Node"; | ||
import { isInTable } from "prosemirror-tables"; | ||
|
||
export default class HardBreak extends Node { | ||
get name() { | ||
return "br"; | ||
} | ||
|
||
get schema() { | ||
return { | ||
inline: true, | ||
group: "inline", | ||
selectable: false, | ||
parseDOM: [{ tag: "br" }], | ||
toDOM() { | ||
return ["br"]; | ||
}, | ||
}; | ||
} | ||
|
||
commands({ type }) { | ||
return () => (state, dispatch) => { | ||
dispatch(state.tr.replaceSelectionWith(type.create()).scrollIntoView()); | ||
return true; | ||
}; | ||
} | ||
|
||
keys({ type }) { | ||
return { | ||
"Shift-Enter": (state, dispatch) => { | ||
if (!isInTable(state)) return false; | ||
dispatch(state.tr.replaceSelectionWith(type.create()).scrollIntoView()); | ||
return true; | ||
}, | ||
}; | ||
} | ||
|
||
toMarkdown(state) { | ||
state.write(" \\n "); | ||
} | ||
|
||
parseMarkdown() { | ||
return { node: "br" }; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters