Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix(nc-gui): fix long text modal width and height in mobile view

Ramesh Manebcc909f52158
diff --git a/packages/nc-gui/components/cell/Decimal/DecimalInput.vue b/packages/nc-gui/components/cell/Decimal/DecimalInput.vue
index c34e839ddc..694f993a62 100644
--- a/packages/nc-gui/components/cell/Decimal/DecimalInput.vue
+++ b/packages/nc-gui/components/cell/Decimal/DecimalInput.vue
@@ -20,6 +20,8 @@ const props = defineProps<Props>()
const emits = defineEmits<Emits>()
const vModel = useVModel(props, 'modelValue', emits)
+const { isMobileMode } = useGlobal()
+
const inputRef = templateRef('input-ref')
const pasteText = (target: HTMLInputElement, value: string) => {
@@ -178,6 +180,15 @@ const registerEvents = (input: HTMLInputElement) => {
input.addEventListener('blur', onInputBlur)
}
+const onBeforeInput = (e: InputEvent) => {
+ if (!e.data || !isMobileMode.value) return // may be null for deletions etc.
+
+ // allow only digits, minus, dot
+ if (!/^[0-9.\-]$/.test(e.data)) {
+ e.preventDefault()
+ }
+}
+
onMounted(() => {
if (inputRef.value) {
registerEvents(inputRef.value as HTMLInputElement)
@@ -207,6 +218,7 @@ onMounted(() => {
@keydown.alt.stop
@selectstart.capture.stop
@mousedown.stop
+ @beforeinput="onBeforeInput"
/>
</template>
diff --git a/packages/nc-gui/components/cell/RichText.vue b/packages/nc-gui/components/cell/RichText.vue
index 66fe829710..bf06d28e8e 100644
--- a/packages/nc-gui/components/cell/RichText.vue
+++ b/packages/nc-gui/components/cell/RichText.vue
@@ -435,6 +435,10 @@ onClickOutside(editorDom, (e) => {
resize: vertical;
min-width: 100%;
max-height: min(800px, calc(100vh - 200px)) !important;
+
+ @supports (height: 100dvh) {
+ max-height: min(800px, calc(100dvh - 200px)) !important;
+ }
}
}
}
@@ -442,7 +446,7 @@ onClickOutside(editorDom, (e) => {
.nc-rich-text-full {
@apply px-3;
.ProseMirror {
- @apply !p-2 h-[min(797px,100vh_-_170px)] w-[min(1256px,100vw_-_124px)];
+ @apply !p-2 h-[min(797px,100dvh_-_170px)] w-[min(1256px,100vw_-_124px)];
overflow-y: auto;
overflow-x: hidden;
scrollbar-width: thin !important;
@@ -451,6 +455,15 @@ onClickOutside(editorDom, (e) => {
max-height: min(797px, calc(100vh - 170px));
min-width: 256px;
max-width: min(1256px, 100vw - 126px);
+
+ @supports (height: 100dvh) {
+ max-height: min(797px, calc(100dvh - 170px));
+ }
+
+ @media (max-width: 767px) {
+ min-width: 100%;
+ max-width: min(1256px, 100vw - 58px);
+ }
}
&.readonly {
.ProseMirror {
diff --git a/packages/nc-gui/components/cell/TextArea.vue b/packages/nc-gui/components/cell/TextArea.vue
index 305d141d61..7a14c5767f 100644
--- a/packages/nc-gui/components/cell/TextArea.vue
+++ b/packages/nc-gui/components/cell/TextArea.vue
@@ -937,6 +937,15 @@ textarea:focus {
max-width: min(1280px, 100vw - 100px);
max-height: min(864px, 100vh - 100px);
+ @supports (height: 100dvh) {
+ max-height: min(864px, 100dvh - 100px);
+ }
+
+ @media (max-width: 767px) {
+ max-width: min(1280px, 100vw - 32px);
+ min-width: min(1280px, 100vw - 32px);
+ }
+
.nc-longtext-scrollbar {
@apply scrollbar-thin scrollbar-thumb-gray-200 hover:scrollbar-thumb-gray-300 scrollbar-track-transparent;
}
@@ -944,6 +953,10 @@ textarea:focus {
.expanded-cell-input-ai {
.nc-text-area-expanded {
max-height: min(783px - 76px, 100vh - 180px);
+
+ @supports (height: 100dvh) {
+ max-height: min(783px - 76px, 100dvh - 180px);
+ }
}
}
}