mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-25 10:51:26 +01:00
Fix Editor.tsx wonkiness
This commit is contained in:
@@ -376,7 +376,7 @@ export function Editor({
|
||||
|
||||
// Initialize the editor when ref mounts
|
||||
const initEditorRef = useCallback(
|
||||
function initializeCodemirror(container: HTMLDivElement | null) {
|
||||
function initEditorRef(container: HTMLDivElement | null) {
|
||||
if (container === null) {
|
||||
cm.current?.view.destroy();
|
||||
cm.current = null;
|
||||
@@ -455,17 +455,9 @@ export function Editor({
|
||||
}
|
||||
},
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[],
|
||||
[forceUpdateKey],
|
||||
);
|
||||
|
||||
// Update editor doc when force update key changes
|
||||
useEffect(() => {
|
||||
if (cm.current?.view != null) {
|
||||
updateContents(cm.current.view, defaultValue || '');
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [forceUpdateKey]);
|
||||
|
||||
// For read-only mode, update content when `defaultValue` changes
|
||||
useEffect(
|
||||
function updateReadOnlyEditor() {
|
||||
|
||||
@@ -112,7 +112,6 @@ function fieldValueCompletions(
|
||||
): Completion[] | null {
|
||||
if (!def || !def.values) return null;
|
||||
const vals = Array.isArray(def.values) ? def.values : def.values();
|
||||
// console.log("HELLO", v, v.match(IDENT));
|
||||
return vals.map((v) => ({
|
||||
label: v.match(IDENT_ONLY) ? v : `"${v}"`,
|
||||
displayLabel: v,
|
||||
|
||||
Reference in New Issue
Block a user