Skip to content

Commit

Permalink
feat: implement length limitation for prompt text during editing
Browse files Browse the repository at this point in the history
Signed-off-by: DingChil <xu.dingchao@gmail.com>
  • Loading branch information
DingChil committed Nov 6, 2023
1 parent 876ce85 commit 159e955
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/components/PromptEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
ref="textareaRef"
v-model="command"
:class="$style.content__textarea"
maxlength="2048"
:placeholder="prompt.command || $gettext('Set a prompt here')"
/>
<article :class="$style.content__back">
Expand Down
12 changes: 12 additions & 0 deletions src/components/image/IconDraggingDark.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/components/image/IconDraggingLight.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 18 additions & 5 deletions src/csui/Index/TheEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
}"
>
<ThePopupBox id="webpilot_popup" :is-ask-page="isAskPage" @close-popup="handleClosePopup" />
<section ref="refDragHandle" :class="$style.dragHandle"></section>
<section ref="refDragHandle" :class="$style.draggingBody" />
</section>
</template>

Expand Down Expand Up @@ -277,13 +277,26 @@ const shortcutText = computed(() => {
background-color: #fff;
}
.dragHandle {
.draggingBody {
position: absolute;
top: 0;
top: -14px;
left: 0;
width: 612px;
height: 8px;
cursor: move;
height: 22px;
background: var(--webpilot-theme-content-background-color, #fff) center / 14px no-repeat;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
user-select: none;
&:hover {
background-image: url('data-base64:~src/components/image/IconDraggingLight.svg');
cursor: pointer;
}
}
@media (prefers-color-scheme: dark) {
.draggingBody:hover {
background-image: url('data-base64:~src/components/image/IconDraggingDark.svg');
}
}
</style>
2 changes: 1 addition & 1 deletion src/csui/Index/ThePopupBox/ThePopupBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ const handleCommandChange = () => {
}
const handleInputFocus = () => {
if (showPrompts.value && !showResult.value) inputCommand.value = ''
// if (showPrompts.value && !showResult.value) inputCommand.value = ''
if (!showPrompts.value && showResult.value) handleShowMenu()
}
Expand Down

0 comments on commit 159e955

Please sign in to comment.