|
|
@@ -2,7 +2,7 @@ import { useCallback } from 'react';
|
|
|
|
|
|
|
|
|
import { useCodeMirrorEditorIsolated } from '../../../stores';
|
|
|
-import { useTemplateModalForEditor } from '../../../stores/use-templete';
|
|
|
+import { useTemplateModal } from '../../../stores/use-template';
|
|
|
|
|
|
type Props = {
|
|
|
editorKey: string,
|
|
|
@@ -11,14 +11,14 @@ type Props = {
|
|
|
export const TemplateButton = (props: Props): JSX.Element => {
|
|
|
const { editorKey } = props;
|
|
|
const { data: codeMirrorEditor } = useCodeMirrorEditorIsolated(editorKey);
|
|
|
- const { open: openTempleteModal } = useTemplateModalForEditor();
|
|
|
+ const { open: openTemplateModal } = useTemplateModal();
|
|
|
|
|
|
const onClickTempleteButton = useCallback(() => {
|
|
|
const editor = codeMirrorEditor?.view;
|
|
|
const insertText = (text: string) => editor?.dispatch(editor.state.replaceSelection(text));
|
|
|
const onSubmit = (templateText: string) => insertText(templateText);
|
|
|
- openTempleteModal({ onSubmit });
|
|
|
- }, [codeMirrorEditor?.view, openTempleteModal]);
|
|
|
+ openTemplateModal({ onSubmit });
|
|
|
+ }, [codeMirrorEditor?.view, openTemplateModal]);
|
|
|
|
|
|
return (
|
|
|
<button type="button" className="btn btn-toolbar-button" onClick={onClickTempleteButton}>
|