Update CodeMirrorMobileEditor.vue
This commit is contained in:
@@ -140,19 +140,14 @@ const getLanguageExtension = async (lang: string) => {
|
|||||||
}
|
}
|
||||||
if (lang === 'css') {
|
if (lang === 'css') {
|
||||||
try {
|
try {
|
||||||
console.log('[CodeMirrorMobileEditor DEBUG] Attempting to import @codemirror/lang-css for language:', lang);
|
|
||||||
const cssModule = await import('@codemirror/lang-css');
|
const cssModule = await import('@codemirror/lang-css');
|
||||||
console.log('[CodeMirrorMobileEditor DEBUG] @codemirror/lang-css imported:', cssModule);
|
|
||||||
if (cssModule && typeof cssModule.css === 'function') {
|
if (cssModule && typeof cssModule.css === 'function') {
|
||||||
const cssExtension = cssModule.css();
|
const cssExtension = cssModule.css();
|
||||||
console.log('[CodeMirrorMobileEditor DEBUG] CSS extension object created:', cssExtension);
|
|
||||||
return cssExtension;
|
return cssExtension;
|
||||||
} else {
|
} else {
|
||||||
console.error('[CodeMirrorMobileEditor DEBUG] @codemirror/lang-css module or css function is invalid. Module:', cssModule);
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('[CodeMirrorMobileEditor DEBUG] Error loading/initializing CSS language support:', error);
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -211,16 +206,13 @@ watch(() => props.modelValue, (newValue) => {
|
|||||||
|
|
||||||
watch(() => props.language, async (newLanguage, oldLanguage) => {
|
watch(() => props.language, async (newLanguage, oldLanguage) => {
|
||||||
if (view.value && newLanguage !== oldLanguage) {
|
if (view.value && newLanguage !== oldLanguage) {
|
||||||
console.log(`Language changing from ${oldLanguage} to: ${newLanguage}.`);
|
|
||||||
const langExt = await getLanguageExtension(newLanguage);
|
const langExt = await getLanguageExtension(newLanguage);
|
||||||
console.log(`[CodeMirrorMobileEditor DEBUG] watch props.language - New language: ${newLanguage}, Fetched langExt:`, langExt);
|
|
||||||
view.value.dispatch({
|
view.value.dispatch({
|
||||||
effects: languageCompartment.reconfigure(langExt)
|
effects: languageCompartment.reconfigure(langExt)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Watch for changes from the store (e.g., if changed in settings panel)
|
|
||||||
watch(() => appearanceStore.currentMobileEditorFontSize, (newSize) => {
|
watch(() => appearanceStore.currentMobileEditorFontSize, (newSize) => {
|
||||||
if (newSize !== currentFontSize.value) {
|
if (newSize !== currentFontSize.value) {
|
||||||
currentFontSize.value = newSize;
|
currentFontSize.value = newSize;
|
||||||
@@ -237,15 +229,15 @@ defineExpose({
|
|||||||
.codemirror-mobile-editor-container {
|
.codemirror-mobile-editor-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
min-height: 200px; /* Adjust as needed for mobile */
|
min-height: 200px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
overflow: auto; /* Enable both horizontal and vertical scrolling */
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.codemirror-mobile-editor-container :deep(.cm-gutters) {
|
.codemirror-mobile-editor-container :deep(.cm-gutters) {
|
||||||
background-color: #1E1E1E !important; /* Match typical dark editor background */
|
background-color: #1E1E1E !important;
|
||||||
color: #858585 !important; /* Ensure line numbers are visible */
|
color: #858585 !important;
|
||||||
border-right: 1px solid var(--border-color, #cccccc) !important; /* Use theme border color */
|
border-right: 1px solid var(--border-color, #cccccc) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.codemirror-mobile-editor-container :deep(.cm-selectionBackground) {
|
.codemirror-mobile-editor-container :deep(.cm-selectionBackground) {
|
||||||
|
|||||||
Reference in New Issue
Block a user