Merge pull request #1864 from ONLYOFFICE/feature/equation-settings

Feature/equation settings
This commit is contained in:
Julia Radzhabova 2022-07-21 14:40:02 +03:00 committed by GitHub
commit bb5d6cf388
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 175 additions and 2 deletions

View file

@ -422,6 +422,8 @@ define([
view.menuTableTOC.menu.on('item:click', _.bind(me.onTOCMenu, me));
view.menuParaTOCRefresh.menu.on('item:click', _.bind(me.onTOCMenu, me));
view.menuParaTOCSettings.on('click', _.bind(me.onParaTOCSettings, me));
view.menuTableEquation.menu.on('item:click', _.bind(me.convertEquation, me));
view.menuParagraphEquation.menu.on('item:click', _.bind(me.convertEquation, me));
},
getView: function (name) {
@ -2294,6 +2296,17 @@ define([
return false;
},
convertEquation: function(menu, item, e) {
if (this.api) {
if (item.options.type=='input')
this.api.asc_SetMathInputType(item.value);
else if (item.options.type=='view')
this.api.asc_ConvertMathView(item.value.linear, item.value.all);
else if (item.options.type=='mode')
this.api.asc_ConvertMathDisplayMode(item.checked);
}
},
editComplete: function() {
this.documentHolder && this.documentHolder.fireEvent('editcomplete', this.documentHolder);
}

View file

@ -1143,6 +1143,68 @@ define([
caption : '--'
});
me.menuTableEquation = new Common.UI.MenuItem({
caption : me.advancedEquationText,
menu : new Common.UI.Menu({
cls: 'ppm-toolbar shifted-right',
menuAlign: 'tl-tr',
items : [
new Common.UI.MenuItem({
caption : me.unicodeText,
iconCls : 'menu__icon unicode',
checkable : true,
checkmark : false,
checked : false,
toggleGroup : 'popupparaeqinput',
type : 'input',
value : Asc.c_oAscMathInputType.Unicode
}),
new Common.UI.MenuItem({
caption : me.latexText,
iconCls : 'menu__icon latex',
checkable : true,
checkmark : false,
checked : false,
toggleGroup : 'popupparaeqinput',
type : 'input',
value : Asc.c_oAscMathInputType.LaTeX
}),
{ caption : '--' },
new Common.UI.MenuItem({
caption : me.currProfText,
iconCls : 'menu__icon professional-equation',
type : 'view',
value : {all: false, linear: false}
}),
new Common.UI.MenuItem({
caption : me.currLinearText,
iconCls : 'menu__icon linear-equation',
type : 'view',
value : {all: false, linear: true}
}),
new Common.UI.MenuItem({
caption : me.allProfText,
iconCls : 'menu__icon professional-equation',
type : 'view',
value : {all: true, linear: false}
}),
new Common.UI.MenuItem({
caption : me.allLinearText,
iconCls : 'menu__icon linear-equation',
type : 'view',
value : {all: true, linear: true}
}),
{ caption : '--' },
new Common.UI.MenuItem({
caption : me.eqToInlineText,
checkable : true,
checked : false,
type : 'mode'
})
]
})
});
me.menuTableSelectText = new Common.UI.MenuItem({
caption : me.selectText,
menu : new Common.UI.Menu({
@ -1388,6 +1450,15 @@ define([
me.clearEquationMenu(false, 10);
menuEquationSeparatorInTable.setVisible(isEquation && eqlen>0);
me.menuTableEquation.setVisible(isEquation);
me.menuTableEquation.setDisabled(disabled);
if (isEquation) {
var eq = me.api.asc_GetMathInputType();
me.menuTableEquation.menu.items[0].setChecked(eq===Asc.c_oAscMathInputType.Unicode);
me.menuTableEquation.menu.items[1].setChecked(eq===Asc.c_oAscMathInputType.LaTeX);
me.menuTableEquation.menu.items[8].setChecked(me.api.asc_IsInlineMath());
}
var control_lock = (value.paraProps) ? (!value.paraProps.value.can_DeleteBlockContentControl() || !value.paraProps.value.can_EditBlockContentControl() ||
!value.paraProps.value.can_DeleteInlineContentControl() || !value.paraProps.value.can_EditInlineContentControl()) : false;
var in_toc = me.api.asc_GetTableOfContentsPr(true),
@ -1470,7 +1541,8 @@ define([
me.menuTableRemoveForm,
menuTableControl,
me.menuTableTOC,
me.menuParagraphAdvancedInTable
me.menuParagraphAdvancedInTable,
me.menuTableEquation
]
}).on('hide:after', function(menu, e, isFromInputControl) {
if (me.suppressEditComplete) {
@ -1584,6 +1656,68 @@ define([
caption : me.advancedDropCapText
});
me.menuParagraphEquation = new Common.UI.MenuItem({
caption : me.advancedEquationText,
menu : new Common.UI.Menu({
cls: 'ppm-toolbar shifted-right',
menuAlign: 'tl-tr',
items : [
new Common.UI.MenuItem({
caption : me.unicodeText,
iconCls : 'menu__icon unicode',
checkable : true,
checkmark : false,
checked : false,
toggleGroup : 'popupparaeqinput',
type : 'input',
value : Asc.c_oAscMathInputType.Unicode
}),
new Common.UI.MenuItem({
caption : me.latexText,
iconCls : 'menu__icon latex',
checkable : true,
checkmark : false,
checked : false,
toggleGroup : 'popupparaeqinput',
type : 'input',
value : Asc.c_oAscMathInputType.LaTeX
}),
{ caption : '--' },
new Common.UI.MenuItem({
caption : me.currProfText,
iconCls : 'menu__icon professional-equation',
type : 'view',
value : {all: false, linear: false}
}),
new Common.UI.MenuItem({
caption : me.currLinearText,
iconCls : 'menu__icon linear-equation',
type : 'view',
value : {all: false, linear: true}
}),
new Common.UI.MenuItem({
caption : me.allProfText,
iconCls : 'menu__icon professional-equation',
type : 'view',
value : {all: true, linear: false}
}),
new Common.UI.MenuItem({
caption : me.allLinearText,
iconCls : 'menu__icon linear-equation',
type : 'view',
value : {all: true, linear: true}
}),
{ caption : '--' },
new Common.UI.MenuItem({
caption : me.eqToInlineText,
checkable : true,
checked : false,
type : 'mode'
})
]
})
});
/** coauthoring begin **/
var menuCommentSeparatorPara = new Common.UI.MenuItem({
caption : '--'
@ -1954,6 +2088,15 @@ define([
me.menuEquationInsertCaption.setVisible(isEquation);
menuEquationInsertCaptionSeparator.setVisible(isEquation);
me.menuParagraphEquation.setVisible(isEquation);
me.menuParagraphEquation.setDisabled(disabled);
if (isEquation) {
var eq = me.api.asc_GetMathInputType();
me.menuParagraphEquation.menu.items[0].setChecked(eq===Asc.c_oAscMathInputType.Unicode);
me.menuParagraphEquation.menu.items[1].setChecked(eq===Asc.c_oAscMathInputType.LaTeX);
me.menuParagraphEquation.menu.items[8].setChecked(me.api.asc_IsInlineMath());
}
var frame_pr = value.paraProps.value.get_FramePr();
me.menuFrameAdvanced.setVisible(frame_pr !== undefined);
me.menuDropCapAdvanced.setVisible(frame_pr !== undefined);
@ -2057,6 +2200,7 @@ define([
me.menuParagraphAdvanced,
me.menuFrameAdvanced,
me.menuDropCapAdvanced,
me.menuParagraphEquation,
/** coauthoring begin **/
menuCommentSeparatorPara,
me.menuAddCommentPara,
@ -3077,7 +3221,15 @@ define([
txtWarnUrl: 'Clicking this link can be harmful to your device and data.<br>Are you sure you want to continue?',
textEditPoints: 'Edit Points',
textAccept: 'Accept Change',
textReject: 'Reject Change'
textReject: 'Reject Change',
advancedEquationText: 'Equation Settings',
unicodeText: 'Unicode',
latexText: 'LaTeX',
currProfText: 'Current - Professional',
currLinearText: 'Current - Linear',
allProfText: 'All - Professional',
allLinearText: 'All - Linear',
eqToInlineText: 'Change to Inline'
}, DE.Views.DocumentHolder || {}));
});

View file

@ -1657,6 +1657,14 @@
"DE.Views.DocumentHolder.txtWarnUrl": "Clicking this link can be harmful to your device and data.<br>Are you sure you want to continue?",
"DE.Views.DocumentHolder.updateStyleText": "Update %1 style",
"DE.Views.DocumentHolder.vertAlignText": "Vertical Alignment",
"DE.Views.DocumentHolder.advancedEquationText": "Equation Settings",
"DE.Views.DocumentHolder.unicodeText": "Unicode",
"DE.Views.DocumentHolder.latexText": "LaTeX",
"DE.Views.DocumentHolder.currProfText": "Current - Professional",
"DE.Views.DocumentHolder.currLinearText": "Current - Linear",
"DE.Views.DocumentHolder.allProfText": "All - Professional",
"DE.Views.DocumentHolder.allLinearText": "All - Linear",
"DE.Views.DocumentHolder.eqToInlineText": "Change to Inline",
"DE.Views.DropcapSettingsAdvanced.strBorders": "Borders & Fill",
"DE.Views.DropcapSettingsAdvanced.strDropcap": "Drop Cap",
"DE.Views.DropcapSettingsAdvanced.strMargins": "Margins",