continuation for ordered lists
This commit is contained in:
parent
52129a8868
commit
f137ff9562
|
|
@ -33,7 +33,7 @@
|
|||
- **Visual tree view** - Expandable/collapsible navigation
|
||||
- **Hide system folders** - Toggle to hide `_attachments`, `_templates` and other underscore-prefixed folders from sidebar
|
||||
- **Tab inserts tab** - Toggle to make Tab key insert a tab character in the editor instead of changing focus
|
||||
- **List & quote continuation (Enter)** - At the end of a line, Enter continues blockquotes (`>`), bullets (`-` / `*` / `+`), and task lists (`- [ ]` / `- [x]`); pressing Enter again on an empty continued line exits the list or quote. Disabled inside fenced code blocks and when using Shift+Enter (plain newline)
|
||||
- **List & quote continuation (Enter)** - At the end of a line, Enter continues blockquotes (`>`), bullets (`-` / `*` / `+`), ordered lists (`1.` / `1)`), and task lists (`- [ ]` / `- [x]`); pressing Enter again on an empty continued line exits the list or quote. Disabled inside fenced code blocks and when using Shift+Enter (plain newline)
|
||||
|
||||
### Export & Print
|
||||
- **HTML Export** - Download notes as standalone HTML files with all styling, images, diagrams, and math embedded
|
||||
|
|
|
|||
|
|
@ -859,7 +859,7 @@ function noteApp() {
|
|||
},
|
||||
|
||||
/**
|
||||
* Enter: continue blockquote / bullet / task list; second Enter on empty item exits (see editor-markdown-continue.js).
|
||||
* Enter: continue blockquote / bullet / ordered list / task list; second Enter on empty item exits (see editor-markdown-continue.js).
|
||||
*/
|
||||
handleEditorEnterKey(event) {
|
||||
if (typeof EditorMarkdownContinue === 'undefined') return;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Markdown editor helpers: Enter continues blockquotes, bullets, and task lists.
|
||||
* Markdown editor helpers: Enter continues blockquotes, bullets, ordered lists, and task lists.
|
||||
* Plain functions only; no DOM. Used by app.js handleEditorEnterKey.
|
||||
*/
|
||||
(function (global) {
|
||||
|
|
@ -70,6 +70,17 @@
|
|||
return { continuePrefix: quoteFull + inner + marker, isEmpty };
|
||||
}
|
||||
|
||||
const orderedMatch = rest.match(/^(\s*)(\d+)([.)])\s+(.*)$/);
|
||||
if (orderedMatch) {
|
||||
const inner = orderedMatch[1];
|
||||
const num = parseInt(orderedMatch[2], 10);
|
||||
const sep = orderedMatch[3];
|
||||
const cont = orderedMatch[4];
|
||||
const marker = (num + 1) + sep + ' ';
|
||||
const isEmpty = cont.trim() === '';
|
||||
return { continuePrefix: quoteFull + inner + marker, isEmpty };
|
||||
}
|
||||
|
||||
if (quoteFull) {
|
||||
const isEmpty = rest.trim() === '';
|
||||
return { continuePrefix: quoteFull, isEmpty };
|
||||
|
|
|
|||
Loading…
Reference in New Issue