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 isFormatting = false
|
||||||
let activeModes = new Set<FormatMode>()
|
let activeModes = new Set<FormatMode>()
|
||||||
let isSelectionEmpty = true
|
let isSelectionEmpty = true
|
||||||
|
let isEmpty = true
|
||||||
|
|
||||||
interface RefAction {
|
interface RefAction {
|
||||||
label: IntlString
|
label: IntlString
|
||||||
@ -275,6 +276,7 @@
|
|||||||
<div class="inputMsg">
|
<div class="inputMsg">
|
||||||
<TextEditor
|
<TextEditor
|
||||||
bind:content
|
bind:content
|
||||||
|
bind:isEmpty
|
||||||
bind:this={textEditor}
|
bind:this={textEditor}
|
||||||
on:content={(ev) => {
|
on:content={(ev) => {
|
||||||
dispatch('message', ev.detail)
|
dispatch('message', ev.detail)
|
||||||
@ -286,7 +288,9 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{#if showSend}
|
{#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}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div class="buttons-group large-gap ml-4 mt-2">
|
<div class="buttons-group large-gap ml-4 mt-2">
|
||||||
@ -418,6 +422,15 @@
|
|||||||
color: var(--theme-caption-color);
|
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 placeholder: IntlString = textEditorPlugin.string.EditorPlaceholder
|
||||||
export let extensions: AnyExtension[] = []
|
export let extensions: AnyExtension[] = []
|
||||||
export let supportSubmit = true
|
export let supportSubmit = true
|
||||||
|
export let isEmpty = true
|
||||||
|
|
||||||
let element: HTMLElement
|
let element: HTMLElement
|
||||||
let editor: Editor
|
let editor: Editor
|
||||||
@ -41,8 +42,10 @@
|
|||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
export function submit (): void {
|
export function submit (): void {
|
||||||
content = editor.getHTML()
|
if (!editor.isEmpty) {
|
||||||
dispatch('content', content)
|
content = editor.getHTML()
|
||||||
|
dispatch('content', content)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function clear (): void {
|
export function clear (): void {
|
||||||
@ -159,6 +162,7 @@
|
|||||||
},
|
},
|
||||||
onUpdate: () => {
|
onUpdate: () => {
|
||||||
content = editor.getHTML()
|
content = editor.getHTML()
|
||||||
|
isEmpty = editor.isEmpty
|
||||||
dispatch('value', content)
|
dispatch('value', content)
|
||||||
},
|
},
|
||||||
onSelectionUpdate: () => dispatch('selection-update')
|
onSelectionUpdate: () => dispatch('selection-update')
|
||||||
|
Loading…
Reference in New Issue
Block a user