feat: 键盘设置里面,支持设置回车发送还是按键发送

This commit is contained in:
weifashi 2023-11-15 11:19:50 +08:00
parent d541397594
commit cdc7e671ce
6 changed files with 62 additions and 31 deletions

View File

@ -176,7 +176,7 @@ services:
okr: okr:
container_name: "dootask-okr-${APP_ID}" container_name: "dootask-okr-${APP_ID}"
image: "kuaifan/doookr:0.0.21" image: "kuaifan/doookr:0.0.22"
environment: environment:
TZ: "${TIMEZONE:-PRC}" TZ: "${TIMEZONE:-PRC}"
DOO_TASK_URL: "http://${APP_IPPR}.3" DOO_TASK_URL: "http://${APP_IPPR}.3"

View File

@ -1390,3 +1390,5 @@ APP推送
包含消息发送的文件 包含消息发送的文件
特殊设置 特殊设置
打包列表 打包列表
使用独立的发送按钮
开启后,键盘上的发送按钮会被替换成换行

View File

@ -492,6 +492,11 @@ export default {
} }
return null; return null;
}, },
separateSendButton() {
return $A.jsonParse(window.localStorage.getItem("__keyboard:data__"))?.separate_send_button === 'open';
},
}, },
watch: { watch: {
// Watch content change // Watch content change
@ -663,6 +668,11 @@ export default {
shortKey: true, shortKey: true,
handler: _ => { handler: _ => {
if (!this.isEnterSend) { if (!this.isEnterSend) {
if (this.separateSendButton) {
const length = this.quill.getSelection(true).index;
this.quill.insertText(length, "\r\n");
return false;
}
this.onSend(); this.onSend();
return false; return false;
} }
@ -674,6 +684,11 @@ export default {
shiftKey: false, shiftKey: false,
handler: _ => { handler: _ => {
if (this.isEnterSend) { if (this.isEnterSend) {
if (this.separateSendButton) {
const length = this.quill.getSelection(true).index;
this.quill.insertText(length, "\r\n");
return false;
}
this.onSend(); this.onSend();
return false; return false;
} }
@ -786,7 +801,9 @@ export default {
this.quill.insertText(length, "\r\n"); this.quill.insertText(length, "\r\n");
} }
}); });
if (!this.separateSendButton) {
this.quill.root.setAttribute('enterkeyhint', 'send') this.quill.root.setAttribute('enterkeyhint', 'send')
}
}) })
// Ready event // Ready event

View File

@ -158,7 +158,7 @@
</RadioGroup> </RadioGroup>
<div class="form-tip">{{$L('是否将消息中的网络图片保存到本地服务器。')}}</div> <div class="form-tip">{{$L('是否将消息中的网络图片保存到本地服务器。')}}</div>
</FormItem> </FormItem>
<FormItem v-if="$A.isDooServer()" :label="$L('文件上传限制')" prop="fileUploadLimit"> <FormItem :label="$L('文件上传限制')" prop="fileUploadLimit">
<div style="width: 192px;"> <div style="width: 192px;">
<Input type="number" number v-model="formDatum.file_upload_limit" :placeholder="$L('默认不限制')"> <Input type="number" number v-model="formDatum.file_upload_limit" :placeholder="$L('默认不限制')">
<template #append> <template #append>

View File

@ -79,7 +79,7 @@ export default {
{path: 'theme', name: '主题设置'}, {path: 'theme', name: '主题设置'},
] ]
if (this.$Electron) { if (this.$Electron || this.$isEEUiApp) {
menu.push({path: 'keyboard', name: '键盘设置', desc: ' (Beta)'}) menu.push({path: 'keyboard', name: '键盘设置', desc: ' (Beta)'})
} }

View File

@ -1,6 +1,7 @@
<template> <template>
<div class="setting-item submit"> <div class="setting-item submit">
<Form ref="formData" :model="formData" :rules="ruleData" label-width="auto" @submit.native.prevent> <Form ref="formData" :model="formData" :rules="ruleData" label-width="auto" @submit.native.prevent>
<template v-if="this.$Electron">
<FormItem :label="$L('截图快捷键')" prop="screenshot_key"> <FormItem :label="$L('截图快捷键')" prop="screenshot_key">
<div class="input-box"> <div class="input-box">
{{mateName}}<div class="input-box-push">+</div>Shift<div class="input-box-push">+</div><Input class="input-box-key" v-model="formData.screenshot_key" :maxlength="2"/> {{mateName}}<div class="input-box-push">+</div>Shift<div class="input-box-push">+</div><Input class="input-box-key" v-model="formData.screenshot_key" :maxlength="2"/>
@ -26,6 +27,16 @@
{{mateName}}<div class="input-box-push">+</div>, {{mateName}}<div class="input-box-push">+</div>,
</div> </div>
</FormItem> </FormItem>
</template>
<template>
<FormItem :label="$L('使用独立的发送按钮')" prop="anonMessage">
<RadioGroup v-model="formData.separate_send_button">
<Radio label="open">{{$L('开启')}}</Radio>
<Radio label="close">{{$L('关闭')}}</Radio>
</RadioGroup>
<div class="form-tip">{{$L('开启后,键盘上的发送按钮会被替换成换行')}}</div>
</FormItem>
</template>
</Form> </Form>
<div class="setting-footer"> <div class="setting-footer">
<Button :loading="loadIng > 0" type="primary" @click="submitForm">{{$L('保存')}}</Button> <Button :loading="loadIng > 0" type="primary" @click="submitForm">{{$L('保存')}}</Button>
@ -58,6 +69,7 @@ export default {
formData: { formData: {
screenshot_key: '', screenshot_key: '',
separate_send_button: 'close'
}, },
ruleData: { ruleData: {
@ -90,6 +102,7 @@ export default {
initData() { initData() {
this.formData = Object.assign({ this.formData = Object.assign({
screenshot_key: '', screenshot_key: '',
separate_send_button: 'close',
}, $A.jsonParse(window.localStorage.getItem("__keyboard:data__")) || {}); }, $A.jsonParse(window.localStorage.getItem("__keyboard:data__")) || {});
// //
this.formData_bak = $A.cloneJSON(this.formData); this.formData_bak = $A.cloneJSON(this.formData);
@ -107,7 +120,6 @@ export default {
submitForm() { submitForm() {
this.$refs.formData.validate((valid) => { this.$refs.formData.validate((valid) => {
if (valid) { if (valid) {
console.log(this.formData);
window.localStorage.setItem("__keyboard:data__", $A.jsonStringify(this.formData)); window.localStorage.setItem("__keyboard:data__", $A.jsonStringify(this.formData));
$A.bindScreenshotKey(this.formData); $A.bindScreenshotKey(this.formData);
$A.messageSuccess('保存成功'); $A.messageSuccess('保存成功');