Page Editor: Minor fixes

- Removed unused import
- Added some trailing newlines to code files
- Prevented <hr>s confusing logic in MD editor
- Aligned logic to select end of header across editors
This commit is contained in:
Dan Brown
2026-05-26 13:27:48 +01:00
parent 99e405f80f
commit 0de1196b62
4 changed files with 4 additions and 5 deletions

View File

@@ -149,4 +149,4 @@ export class ToolboxContents extends Component {
class: 'sidebar-page-nav menu'
}, headerItems);
}
}
}

View File

@@ -195,7 +195,7 @@ export class Actions {
* Focus on the text for a specific header in the content.
*/
focusOnHeader(index: number): void {
const headerPattern = /^\s{0,3}(#+|<h)/i;
const headerPattern = /^\s{0,3}(#+|<h[1-6][\s>])/i;
const codeBoundary = /^\s{0,3}```/i;
let currentIndex = -1;
let inCodeBoundary = false;

View File

@@ -1,5 +1,4 @@
import {MarkdownEditor} from "./index.mjs";
import {focusOnHeader} from "../wysiwyg/utils/actions";
export interface HtmlOrMarkdown {
html: string;

View File

@@ -109,7 +109,7 @@ export function focusOnHeader(editor: LexicalEditor, headerIndex: number): void
const headers = $getAllNodesOfType($isHeadingNode);
const target = headers[headerIndex];
if (target) {
target.selectStart();
target.selectEnd();
}
});
}
}