A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
Add placeholder functionality to the editor
robin04b0313f94f6
diff --git a/ui/src/components/Editor/utils/index.ts b/ui/src/components/Editor/utils/index.tsindex 6debb3dc..9c65a923 100644--- a/ui/src/components/Editor/utils/index.ts+++ b/ui/src/components/Editor/utils/index.ts@@ -22,7 +22,13 @@ import { useEffect, useState } from 'react';import type { Position } from 'codemirror';import { EditorSelection, EditorState, StateEffect } from '@codemirror/state';-import { EditorView, keymap, KeyBinding, Command } from '@codemirror/view';+import {+ EditorView,+ keymap,+ KeyBinding,+ Command,+ placeholder,+} from '@codemirror/view';import { markdown } from '@codemirror/lang-markdown';import type CodeMirror from 'codemirror';import 'codemirror/lib/codemirror.css';@@ -305,7 +311,7 @@ const createEditorUtils = (editor: EditorView & ExtendEditor) => {};export const useEditor = ({editorRef,- placeholder,+ placeholder: placeholderText,autoFocus,onChange,onFocus,@@ -333,7 +339,7 @@ export const useEditor = ({},});let startState = EditorState.create({- extensions: [markdown(), theme],+ extensions: [markdown(), theme, placeholder(placeholderText)],});const view = new EditorView({