mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 03:22:19 +03:00
TSK-412 Do not allow to post empty comments
Signed-off-by: Alexander Onnikov <alexander.onnikov@xored.com>
This commit is contained in:
parent
2df58960d2
commit
7e829e3724
@ -51,6 +51,7 @@
|
||||
let isFormatting = false
|
||||
let activeModes = new Set<FormatMode>()
|
||||
let isSelectionEmpty = true
|
||||
let isEmpty = true
|
||||
|
||||
interface RefAction {
|
||||
label: IntlString
|
||||
@ -275,6 +276,7 @@
|
||||
<div class="inputMsg">
|
||||
<TextEditor
|
||||
bind:content
|
||||
bind:isEmpty
|
||||
bind:this={textEditor}
|
||||
on:content={(ev) => {
|
||||
dispatch('message', ev.detail)
|
||||
@ -286,7 +288,9 @@
|
||||
/>
|
||||
</div>
|
||||
{#if showSend}
|
||||
<button class="sendButton" on:click={submit}><div class="icon"><Send size={'medium'} /></div></button>
|
||||
<button class="sendButton" on:click={submit} disabled={isEmpty}>
|
||||
<div class="icon"><Send size={'medium'} /></div>
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="buttons-group large-gap ml-4 mt-2">
|
||||
@ -418,6 +422,15 @@
|
||||
color: var(--theme-caption-color);
|
||||
}
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
pointer-events: none;
|
||||
|
||||
.icon {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
export let placeholder: IntlString = textEditorPlugin.string.EditorPlaceholder
|
||||
export let extensions: AnyExtension[] = []
|
||||
export let supportSubmit = true
|
||||
export let isEmpty = true
|
||||
|
||||
let element: HTMLElement
|
||||
let editor: Editor
|
||||
@ -41,8 +42,10 @@
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
export function submit (): void {
|
||||
content = editor.getHTML()
|
||||
dispatch('content', content)
|
||||
if (!editor.isEmpty) {
|
||||
content = editor.getHTML()
|
||||
dispatch('content', content)
|
||||
}
|
||||
}
|
||||
|
||||
export function clear (): void {
|
||||
@ -159,6 +162,7 @@
|
||||
},
|
||||
onUpdate: () => {
|
||||
content = editor.getHTML()
|
||||
isEmpty = editor.isEmpty
|
||||
dispatch('value', content)
|
||||
},
|
||||
onSelectionUpdate: () => dispatch('selection-update')
|
||||
|
Loading…
Reference in New Issue
Block a user