mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-07-15 21:31:36 +03:00
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:
@@ -149,4 +149,4 @@ export class ToolboxContents extends Component {
|
|||||||
class: 'sidebar-page-nav menu'
|
class: 'sidebar-page-nav menu'
|
||||||
}, headerItems);
|
}, headerItems);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ export class Actions {
|
|||||||
* Focus on the text for a specific header in the content.
|
* Focus on the text for a specific header in the content.
|
||||||
*/
|
*/
|
||||||
focusOnHeader(index: number): void {
|
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;
|
const codeBoundary = /^\s{0,3}```/i;
|
||||||
let currentIndex = -1;
|
let currentIndex = -1;
|
||||||
let inCodeBoundary = false;
|
let inCodeBoundary = false;
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import {MarkdownEditor} from "./index.mjs";
|
import {MarkdownEditor} from "./index.mjs";
|
||||||
import {focusOnHeader} from "../wysiwyg/utils/actions";
|
|
||||||
|
|
||||||
export interface HtmlOrMarkdown {
|
export interface HtmlOrMarkdown {
|
||||||
html: string;
|
html: string;
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ export function focusOnHeader(editor: LexicalEditor, headerIndex: number): void
|
|||||||
const headers = $getAllNodesOfType($isHeadingNode);
|
const headers = $getAllNodesOfType($isHeadingNode);
|
||||||
const target = headers[headerIndex];
|
const target = headers[headerIndex];
|
||||||
if (target) {
|
if (target) {
|
||||||
target.selectStart();
|
target.selectEnd();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user