mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-17 16:44:49 -04:00
feat: move first heading title extraction into an app extension
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
d8c1e35819
commit
8de8a50bec
17 changed files with 126 additions and 168 deletions
|
@ -13,7 +13,6 @@ import type { RendererProps } from '../../render-page/markdown-document'
|
|||
import { useEditorReceiveHandler } from '../../render-page/window-post-message-communicator/hooks/use-editor-receive-handler'
|
||||
import type {
|
||||
ExtensionEvent,
|
||||
OnFirstHeadingChangeMessage,
|
||||
OnHeightChangeMessage,
|
||||
RendererType,
|
||||
SetScrollStateMessage
|
||||
|
@ -45,7 +44,6 @@ const log = new Logger('RenderIframe')
|
|||
* @param markdownContentLines Array of lines of the markdown content
|
||||
* @param onTaskCheckedChange Callback that is fired when a task-list item in the iframe is checked
|
||||
* @param scrollState The current {@link ScrollState}
|
||||
* @param onFirstHeadingChange Callback that is fired when the first heading of the note changes
|
||||
* @param onScroll Callback that is fired when the user scrolls in the iframe
|
||||
* @param onMakeScrollSource Callback that is fired when the renderer requests to be set as the current scroll source
|
||||
* @param frameClasses CSS classes that should be applied to the iframe
|
||||
|
@ -57,7 +55,6 @@ const log = new Logger('RenderIframe')
|
|||
export const RenderIframe: React.FC<RenderIframeProps> = ({
|
||||
markdownContentLines,
|
||||
scrollState,
|
||||
onFirstHeadingChange,
|
||||
onScroll,
|
||||
onMakeScrollSource,
|
||||
frameClasses,
|
||||
|
@ -92,14 +89,6 @@ export const RenderIframe: React.FC<RenderIframeProps> = ({
|
|||
onRendererStatusChange?.(rendererReady)
|
||||
}, [onRendererStatusChange, rendererReady])
|
||||
|
||||
useEditorReceiveHandler(
|
||||
CommunicationMessageType.ON_FIRST_HEADING_CHANGE,
|
||||
useCallback(
|
||||
(values: OnFirstHeadingChangeMessage) => onFirstHeadingChange?.(values.firstHeading),
|
||||
[onFirstHeadingChange]
|
||||
)
|
||||
)
|
||||
|
||||
useEditorReceiveHandler(
|
||||
CommunicationMessageType.ENABLE_RENDERER_SCROLL_SOURCE,
|
||||
useCallback(() => onMakeScrollSource?.(), [onMakeScrollSource])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue