Skip to content

Commit

Permalink
feat: use continue list addon
Browse files Browse the repository at this point in the history
closes #183
  • Loading branch information
pd4d10 committed May 17, 2022
1 parent efcb96c commit c25bf95
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/bytemd/src/editor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
useGfm,
useYaml,
useYamlFrontmatter,
useContinuelist,
createEditorUtils,
findStartIndex,
getBuiltinActions,
Expand Down Expand Up @@ -170,6 +171,7 @@
useGfm(codemirror)
useYaml(codemirror)
useYamlFrontmatter(codemirror)
useContinuelist(codemirror)
// @ts-ignore TODO: type
editor = codemirror(editorEl, {
Expand All @@ -178,6 +180,9 @@
lineWrapping: true,
tabSize: 8, // keep consistent with preview: https://developer.mozilla.org/en-US/docs/Web/CSS/tab-size#formal_definition
indentUnit: 4, // nested ordered list does not work with 2 spaces
extraKeys: {
Enter: 'newlineAndIndentContinueMarkdownList',
}, // https://github.com/codemirror/CodeMirror/blob/c955a0fb02d9a09cf98b775cb94589e4980303c1/mode/markdown/index.html#L359
...editorConfig,
placeholder,
})
Expand Down
2 changes: 2 additions & 0 deletions packages/bytemd/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import useMarkdown from 'codemirror-ssr/mode/markdown/markdown'
import useGfm from 'codemirror-ssr/mode/gfm/gfm'
import useYaml from 'codemirror-ssr/mode/yaml/yaml'
import useYamlFrontmatter from 'codemirror-ssr/mode/yaml-frontmatter/yaml-frontmatter'
import useContinuelist from 'codemirror-ssr/addon/edit/continuelist'
import { icons } from './icons'

export type { DelegateInstance, Root, Element, VFile, Plugin }
Expand All @@ -35,6 +36,7 @@ export {
useGfm,
useYaml,
useYamlFrontmatter,
useContinuelist,
//
icons,
}
Expand Down

0 comments on commit c25bf95

Please sign in to comment.