Merge pull request #1835 from ONLYOFFICE/fix/bugfix

[DE][PE] Fix subscript/superscript
This commit is contained in:
Julia Radzhabova 2022-06-29 21:38:42 +03:00 committed by GitHub
commit 1aa51adb56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 16 deletions

View file

@ -495,8 +495,8 @@ define([
onApiVerticalAlign: function(typeBaseline) {
if (this._state.valign !== typeBaseline) {
this.toolbar.btnSuperscript.toggle(typeBaseline==1, true);
this.toolbar.btnSubscript.toggle(typeBaseline==2, true);
this.toolbar.btnSuperscript.toggle(typeBaseline==Asc.vertalign_SuperScript, true);
this.toolbar.btnSubscript.toggle(typeBaseline==Asc.vertalign_SubScript, true);
this._state.valign = typeBaseline;
}
},
@ -1186,7 +1186,7 @@ define([
if (!this.toolbar.btnSubscript.pressed) {
this._state.valign = undefined;
if (this.api)
this.api.put_TextPrBaseline(btn.pressed ? 1 : 0);
this.api.put_TextPrBaseline(btn.pressed ? Asc.vertalign_SuperScript : Asc.vertalign_Baseline);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Superscript');
@ -1197,7 +1197,7 @@ define([
if (!this.toolbar.btnSuperscript.pressed) {
this._state.valign = undefined;
if (this.api)
this.api.put_TextPrBaseline(btn.pressed ? 2 : 0);
this.api.put_TextPrBaseline(btn.pressed ? Asc.vertalign_SubScript : Asc.vertalign_Baseline);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Subscript');

View file

@ -119,9 +119,9 @@ class EditTextController extends Component {
const api = Common.EditorApi.get();
if (api) {
if ('superscript' === type) {
api.put_TextPrBaseline(value ? 1 : 0);
api.put_TextPrBaseline(value ? Asc.vertalign_SuperScript : Asc.vertalign_Baseline);
} else {
api.put_TextPrBaseline(value ? 2 : 0);
api.put_TextPrBaseline(value ? Asc.vertalign_SubScript : Asc.vertalign_Baseline);
}
}
}

View file

@ -171,10 +171,10 @@ export class storeTextSettings {
this.typeBaseline = typeBaseline;
}
get isSuperscript() {
return (this.typeBaseline === 1);
return (this.typeBaseline === Asc.vertalign_SuperScript);
}
get isSubscript() {
return (this.typeBaseline === 2);
return (this.typeBaseline === Asc.vertalign_SubScript);
}
// bullets

View file

@ -471,8 +471,8 @@ define([
onApiVerticalAlign: function(typeBaseline) {
if (this._state.valign !== typeBaseline) {
this.toolbar.btnSuperscript.toggle(typeBaseline==1, true);
this.toolbar.btnSubscript.toggle(typeBaseline==2, true);
this.toolbar.btnSuperscript.toggle(typeBaseline==Asc.vertalign_SuperScript, true);
this.toolbar.btnSubscript.toggle(typeBaseline==Asc.vertalign_SubScript, true);
this._state.valign = typeBaseline;
}
},
@ -1194,7 +1194,7 @@ define([
if (!this.toolbar.btnSubscript.pressed) {
this._state.valign = undefined;
if (this.api)
this.api.put_TextPrBaseline(btn.pressed ? 1 : 0);
this.api.put_TextPrBaseline(btn.pressed ? Asc.vertalign_SuperScript : Asc.vertalign_Baseline);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Superscript');
@ -1205,7 +1205,7 @@ define([
if (!this.toolbar.btnSuperscript.pressed) {
this._state.valign = undefined;
if (this.api)
this.api.put_TextPrBaseline(btn.pressed ? 2 : 0);
this.api.put_TextPrBaseline(btn.pressed ? Asc.vertalign_SubScript : Asc.vertalign_Baseline);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Subscript');

View file

@ -204,9 +204,9 @@ class EditTextController extends Component {
const api = Common.EditorApi.get();
if ('superscript' === type) {
api.put_TextPrBaseline(value ? 1 : 0);
api.put_TextPrBaseline(value ? Asc.vertalign_SuperScript : Asc.vertalign_Baseline);
} else {
api.put_TextPrBaseline(value ? 2 : 0);
api.put_TextPrBaseline(value ? Asc.vertalign_SubScript : Asc.vertalign_Baseline);
}
}

View file

@ -191,11 +191,11 @@ export class storeTextSettings {
}
get isSuperscript() {
return (this.typeBaseline === 1);
return (this.typeBaseline === Asc.vertalign_SuperScript);
}
get isSubscript() {
return (this.typeBaseline === 2);
return (this.typeBaseline === Asc.vertalign_SubScript);
}
// bullets