Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resources/css/components/fieldtypes/markdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
}

.editor {
@apply relative mx-auto my-6 max-w-5xl rounded-xl bg-white dark:bg-gray-900! px-2 shadow-ui-md md:px-8 md:pt-8;
@apply relative mx-auto my-6 max-w-5xl rounded-lg bg-white dark:bg-gray-900! px-2 shadow-ui-md md:px-8 md:pt-8;

.CodeMirror-scroll {
@apply m-0;
Expand Down
9 changes: 8 additions & 1 deletion resources/js/components/fieldtypes/bard/BardFieldtype.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@
</div>

<div
class="bard-editor @container/bard focus-within:focus-outline"
class="bard-editor @container/bard"
:class="{
'mode:read-only': readOnly,
'mode:minimal': !showFixedToolbar,
'mode:inline': inputIsInline,
'focus-within:focus-outline': !fullScreenMode,
}"
tabindex="0"
>
Expand Down Expand Up @@ -440,6 +441,12 @@ export default {

if (fullScreenMode) {
this.escBinding = this.$keys.bindGlobal('esc', this.closeFullscreen);
// Focus the editor content when entering fullscreen mode
this.$nextTick(() => {
if (this.editor) {
this.editor.commands.focus();
}
});
} else {
this.escBinding?.destroy();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
@drop="draggingFile = false"
@keydown="shortcut"
>
<div class="editor relative top-[0.5px] z-(--z-index-above) st-text-legibility focus-within:focus-outline" ref="codemirror">
<div class="editor relative top-[0.5px] z-(--z-index-above) st-text-legibility" ref="codemirror" :class="{ 'focus-within:focus-outline': !fullScreenMode }">
<div
v-if="showFloatingToolbar && toolbarIsFloating && !isReadOnly"
class="markdown-floating-toolbar absolute z-50 flex items-center gap-1 rounded-lg border border-gray-300 bg-white px-2 py-1 shadow-lg dark:border-white/10 dark:bg-gray-900"
Expand Down Expand Up @@ -328,6 +328,12 @@ export default {
this.fullScreenMode = true;
this.escBinding = this.$keys.bindGlobal('esc', this.closeFullScreen);
this.trackHeightUpdates();
// Focus the CodeMirror editor when entering fullscreen mode
this.$nextTick(() => {
if (this.codemirror) {
this.codemirror.focus();
}
});
},

toggleFullscreen() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div data-markdown-toolbar>
<div class="flex items-center" v-if="!isReadOnly">
<div class="flex items-center" :class="{ 'gap-2': isFullscreen }" v-if="!isReadOnly">
<Button
:aria-label="button.text"
:icon="button.svg"
Expand Down