From 5b1d02e3c16d05eaacec39938cd139c5943d377f Mon Sep 17 00:00:00 2001 From: James Collins Date: Sat, 1 Jul 2023 19:36:55 +1000 Subject: [PATCH] reload value when late change --- resources/js/components/SMEditor.vue | 98 ++-------------------------- 1 file changed, 6 insertions(+), 92 deletions(-) diff --git a/resources/js/components/SMEditor.vue b/resources/js/components/SMEditor.vue index e9e94b4..c527413 100644 --- a/resources/js/components/SMEditor.vue +++ b/resources/js/components/SMEditor.vue @@ -51,98 +51,12 @@ const handleChange = (newValue) => { }, 50); }; -const tinyeditor = ref(null); - -// const editorContent = ref(props.modelValue); - -/* Updating value */ -// const handleInitialContentChange = (newContent) => { -// newContent = newContent === undefined ? "" : newContent; -// editorContent.value = newContent; -// }; - -// const initialContent = computed(() => { -// return props.modelValue; -// }); - -// watch(initialContent, handleInitialContentChange); - -// const handleBlur = (event) => { -// emits("blur", event); -// }; - -// const handleFocus = (event) => { -// emits("focus", event); -// }; - -// const handleChange = (event, editor) => { -// emits("update:modelValue", editor.getContent()); -// }; - -// const fetchLinkList = () => { -// const buildPageList = ( -// pageList, -// routeEntries, -// prefix_url = "", -// prefix_title = "" -// ) => { -// routeEntries.forEach((entry) => { -// if ( -// "path" in entry && -// entry.path.includes(":") == false && -// "meta" in entry && -// "title" in entry.meta && -// ("hideInEditor" in entry.meta == false || -// entry.meta.hideInEditor == false) && -// ("middleware" in entry.meta == false || -// ("showInEditor" in entry.meta == true && -// entry.meta.showInEditor == true)) -// ) { -// const sep = entry.path.substring(0, 1) == "/" ? "" : "/"; -// pageList[prefix_url + sep + entry.path] = -// prefix_title.length > 0 -// ? `${prefix_title} ${sep} ${entry.meta.title}` -// : entry.meta.title.toLowerCase() == "home" -// ? entry.meta.title -// : `Home / ${entry.meta.title}`; -// } - -// if ("children" in entry) { -// buildPageList( -// pageList, -// entry.children, -// prefix_url + entry.path, -// prefix_title + (entry.meta?.title || "") -// ); -// } -// }); -// }; - -// let pageRoutes: { [key: string]: string } = {}; -// buildPageList(pageRoutes, routes); - -// const pageList: PageList[] = []; -// for (const [key, value] of Object.entries(pageRoutes)) { -// pageList.push({ title: value, value: key }); -// } - -// pageList.sort((a, b) => { -// const titleA = a.title.toLowerCase(); -// const titleB = b.title.toLowerCase(); - -// if (titleA < titleB) { -// return -1; -// } - -// if (titleA > titleB) { -// return 1; -// } - -// return 0; -// }); - -// return pageList; -// }; +watch( + () => props.modelValue, + (newValue) => { + markdown.value = newValue; + } +);