Refactoring documnt info changing

This commit is contained in:
Julia Radzhabova 2019-06-21 15:37:11 +03:00
parent e07a6caca4
commit e6fb81e205
3 changed files with 24 additions and 18 deletions

View file

@ -788,8 +788,8 @@ define([
style : 'width: 200px;', style : 'width: 200px;',
placeHolder : this.txtAddText, placeHolder : this.txtAddText,
validateOnBlur: false validateOnBlur: false
}).on('changed:after', function() { }).on('changed:after', function(input, newValue, oldValue) {
if (me.coreProps && me.api) { if (newValue !== oldValue && me.coreProps && me.api) {
me.coreProps.asc_putTitle(me.inputTitle.getValue()); me.coreProps.asc_putTitle(me.inputTitle.getValue());
me.api.asc_setCoreProps(me.coreProps); me.api.asc_setCoreProps(me.coreProps);
} }
@ -799,8 +799,8 @@ define([
style : 'width: 200px;', style : 'width: 200px;',
placeHolder : this.txtAddText, placeHolder : this.txtAddText,
validateOnBlur: false validateOnBlur: false
}).on('changed:after', function() { }).on('changed:after', function(input, newValue, oldValue) {
if (me.coreProps && me.api) { if (newValue !== oldValue && me.coreProps && me.api) {
me.coreProps.asc_putSubject(me.inputSubject.getValue()); me.coreProps.asc_putSubject(me.inputSubject.getValue());
me.api.asc_setCoreProps(me.coreProps); me.api.asc_setCoreProps(me.coreProps);
} }
@ -810,8 +810,8 @@ define([
style : 'width: 200px;', style : 'width: 200px;',
placeHolder : this.txtAddText, placeHolder : this.txtAddText,
validateOnBlur: false validateOnBlur: false
}).on('changed:after', function() { }).on('changed:after', function(input, newValue, oldValue) {
if (me.coreProps && me.api) { if (newValue !== oldValue && me.coreProps && me.api) {
me.coreProps.asc_putDescription(me.inputComment.getValue()); me.coreProps.asc_putDescription(me.inputComment.getValue());
me.api.asc_setCoreProps(me.coreProps); me.api.asc_setCoreProps(me.coreProps);
} }
@ -848,6 +848,8 @@ define([
validateOnBlur: false, validateOnBlur: false,
placeHolder: this.txtAddAuthor placeHolder: this.txtAddAuthor
}).on('changed:after', function(input, newValue, oldValue) { }).on('changed:after', function(input, newValue, oldValue) {
if (newValue == oldValue) return;
var val = newValue.trim(); var val = newValue.trim();
if (!!val && val !== oldValue.trim()) { if (!!val && val !== oldValue.trim()) {
val.split(/\s*[,;]\s*/).forEach(function(item){ val.split(/\s*[,;]\s*/).forEach(function(item){

View file

@ -678,8 +678,8 @@ define([
style : 'width: 200px;', style : 'width: 200px;',
placeHolder : this.txtAddText, placeHolder : this.txtAddText,
validateOnBlur: false validateOnBlur: false
}).on('changed:after', function() { }).on('changed:after', function(input, newValue, oldValue) {
if (me.coreProps && me.api) { if (newValue !== oldValue && me.coreProps && me.api) {
me.coreProps.asc_putTitle(me.inputTitle.getValue()); me.coreProps.asc_putTitle(me.inputTitle.getValue());
me.api.asc_setCoreProps(me.coreProps); me.api.asc_setCoreProps(me.coreProps);
} }
@ -689,8 +689,8 @@ define([
style : 'width: 200px;', style : 'width: 200px;',
placeHolder : this.txtAddText, placeHolder : this.txtAddText,
validateOnBlur: false validateOnBlur: false
}).on('changed:after', function() { }).on('changed:after', function(input, newValue, oldValue) {
if (me.coreProps && me.api) { if (newValue !== oldValue && me.coreProps && me.api) {
me.coreProps.asc_putSubject(me.inputSubject.getValue()); me.coreProps.asc_putSubject(me.inputSubject.getValue());
me.api.asc_setCoreProps(me.coreProps); me.api.asc_setCoreProps(me.coreProps);
} }
@ -700,8 +700,8 @@ define([
style : 'width: 200px;', style : 'width: 200px;',
placeHolder : this.txtAddText, placeHolder : this.txtAddText,
validateOnBlur: false validateOnBlur: false
}).on('changed:after', function() { }).on('changed:after', function(input, newValue, oldValue) {
if (me.coreProps && me.api) { if (newValue !== oldValue && me.coreProps && me.api) {
me.coreProps.asc_putDescription(me.inputComment.getValue()); me.coreProps.asc_putDescription(me.inputComment.getValue());
me.api.asc_setCoreProps(me.coreProps); me.api.asc_setCoreProps(me.coreProps);
} }
@ -738,6 +738,8 @@ define([
validateOnBlur: false, validateOnBlur: false,
placeHolder: this.txtAddAuthor placeHolder: this.txtAddAuthor
}).on('changed:after', function(input, newValue, oldValue) { }).on('changed:after', function(input, newValue, oldValue) {
if (newValue == oldValue) return;
var val = newValue.trim(); var val = newValue.trim();
if (!!val && val !== oldValue.trim()) { if (!!val && val !== oldValue.trim()) {
val.split(/\s*[,;]\s*/).forEach(function(item){ val.split(/\s*[,;]\s*/).forEach(function(item){

View file

@ -1129,8 +1129,8 @@ define([
style : 'width: 200px;', style : 'width: 200px;',
placeHolder : this.txtAddText, placeHolder : this.txtAddText,
validateOnBlur: false validateOnBlur: false
}).on('changed:after', function() { }).on('changed:after', function(input, newValue, oldValue) {
if (me.coreProps && me.api) { if (newValue !== oldValue && me.coreProps && me.api) {
me.coreProps.asc_putTitle(me.inputTitle.getValue()); me.coreProps.asc_putTitle(me.inputTitle.getValue());
me.api.asc_setCoreProps(me.coreProps); me.api.asc_setCoreProps(me.coreProps);
} }
@ -1140,8 +1140,8 @@ define([
style : 'width: 200px;', style : 'width: 200px;',
placeHolder : this.txtAddText, placeHolder : this.txtAddText,
validateOnBlur: false validateOnBlur: false
}).on('changed:after', function() { }).on('changed:after', function(input, newValue, oldValue) {
if (me.coreProps && me.api) { if (newValue !== oldValue && me.coreProps && me.api) {
me.coreProps.asc_putSubject(me.inputSubject.getValue()); me.coreProps.asc_putSubject(me.inputSubject.getValue());
me.api.asc_setCoreProps(me.coreProps); me.api.asc_setCoreProps(me.coreProps);
} }
@ -1151,8 +1151,8 @@ define([
style : 'width: 200px;', style : 'width: 200px;',
placeHolder : this.txtAddText, placeHolder : this.txtAddText,
validateOnBlur: false validateOnBlur: false
}).on('changed:after', function() { }).on('changed:after', function(input, newValue, oldValue) {
if (me.coreProps && me.api) { if (newValue !== oldValue && me.coreProps && me.api) {
me.coreProps.asc_putDescription(me.inputComment.getValue()); me.coreProps.asc_putDescription(me.inputComment.getValue());
me.api.asc_setCoreProps(me.coreProps); me.api.asc_setCoreProps(me.coreProps);
} }
@ -1189,6 +1189,8 @@ define([
validateOnBlur: false, validateOnBlur: false,
placeHolder: this.txtAddAuthor placeHolder: this.txtAddAuthor
}).on('changed:after', function(input, newValue, oldValue) { }).on('changed:after', function(input, newValue, oldValue) {
if (newValue == oldValue) return;
var val = newValue.trim(); var val = newValue.trim();
if (!!val && val !== oldValue.trim()) { if (!!val && val !== oldValue.trim()) {
val.split(/\s*[,;]\s*/).forEach(function(item){ val.split(/\s*[,;]\s*/).forEach(function(item){