diff --git a/packages/text-editor/src/components/FullDescriptionBox.svelte b/packages/text-editor/src/components/FullDescriptionBox.svelte
index 3a34fcea9d..072dc8255a 100644
--- a/packages/text-editor/src/components/FullDescriptionBox.svelte
+++ b/packages/text-editor/src/components/FullDescriptionBox.svelte
@@ -16,7 +16,7 @@
@@ -44,57 +43,6 @@
- {#if !hideButtons && !alwaysEdit}
-
- {#if editMode}
-
- {/if}
- {#if !editMode && (content === '' || content === '' || content === undefined) && !alwaysEdit}
-
-
-
- {:else}
- {
- dispatch('change', evt.detail)
- }}
- />
- {/if}
+
diff --git a/packages/text-editor/src/components/StyledTextBox.svelte b/packages/text-editor/src/components/StyledTextBox.svelte
index 072558fb2b..3de50c6b69 100644
--- a/packages/text-editor/src/components/StyledTextBox.svelte
+++ b/packages/text-editor/src/components/StyledTextBox.svelte
@@ -36,16 +36,21 @@
mode = Mode.View
}
export function cancelEdit (): void {
+ rawValue = content
mode = Mode.View
}
let rawValue: string
let oldContent = ''
+ let modified: boolean = false
$: if (oldContent !== content) {
oldContent = content
rawValue = content
+ modified = false
}
+ $: if (!modified && rawValue !== content) modified = true
+ $: dispatch('change', modified)
let textEditor: StyledTextEditor
diff --git a/packages/ui/src/components/EditBox.svelte b/packages/ui/src/components/EditBox.svelte
index ea37ca6a85..72161b6f68 100644
--- a/packages/ui/src/components/EditBox.svelte
+++ b/packages/ui/src/components/EditBox.svelte
@@ -127,6 +127,7 @@
on:change
on:keydown
on:keypress
+ on:blur
/>
{:else if format === 'number'}
{:else}
{/if}
diff --git a/plugins/lead-resources/src/components/EditFunnel.svelte b/plugins/lead-resources/src/components/EditFunnel.svelte
index 5098655f80..f2eb02572f 100644
--- a/plugins/lead-resources/src/components/EditFunnel.svelte
+++ b/plugins/lead-resources/src/components/EditFunnel.svelte
@@ -29,6 +29,8 @@
export let _id: Ref
let object: Required
+ let rawName: string = ''
+ let rawDesc: string = ''
const dispatch = createEventDispatcher()
@@ -40,6 +42,8 @@
function updateObject (_id: Ref): void {
query.query(lead.class.Funnel, { _id }, (result) => {
object = result[0] as Required
+ rawName = object.name
+ rawDesc = object.description
})
}
@@ -85,13 +89,8 @@
kind={'large-style'}
focus
focusable
- on:change={() => {
- if (object.name.trim().length > 0) {
- onChange('name', object.name)
- } else {
- // Revert previos object.name
- updateObject(_id)
- }
+ on:blur={() => {
+ if (rawName !== object.name) onChange('name', object.name)
}}
/>
{
- onChange('description', object.description)
+ on:blur={() => {
+ if (rawDesc !== object.description) onChange('description', object.description)
}}
/>
{
- if (result.detail !== undefined) onChange('fullDescription', result.detail)
+ on:save={(res) => {
+ onChange('fullDescription', res.detail)
}}
/>
change('title', object.title)}
+ on:blur={() => {
+ if (rawTitle !== object.title) change('title', rawTitle)
+ }}
/>
let object: Required
+ let rawName: string = ''
+ let rawDesc: string = ''
const dispatch = createEventDispatcher()
@@ -40,6 +42,8 @@
function updateObject (_id: Ref): void {
query.query(recruit.class.Vacancy, { _id }, (result) => {
object = result[0] as Required
+ rawName = object.name
+ rawDesc = object.description
})
}
@@ -85,13 +89,8 @@
kind={'large-style'}
focus
focusable
- on:change={() => {
- if (object.name.trim().length > 0) {
- onChange('name', object.name)
- } else {
- // Revert previos object.name
- updateObject(_id)
- }
+ on:blur={() => {
+ if (rawName !== object.name) onChange('name', object.name)
}}
/>
{
- onChange('description', object.description)
+ on:blur={() => {
+ if (rawDesc !== object.description) onChange('description', object.description)
}}
/>
{
- if (result.detail !== undefined) onChange('fullDescription', result.detail)
+ on:save={(res) => {
+ onChange('fullDescription', res.detail)
}}
/>
{
dispatch('open', {
ignoreKeys: ['number', 'comments', 'title', 'description', 'verdict'],
@@ -49,11 +56,13 @@
client.update(object, { title: object.title })}
+ on:blur={() => {
+ if (rawTitle !== object.title) client.update(object, { title: rawTitle })
+ }}
/>
{
- client.update(object, { description: evt.detail })
+ on:save={(res) => {
+ client.update(object, { description: res.detail })
}}
/>