From 98597e7d16a182a2ef45500b782b7525a74c91ba Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 5 Aug 2019 11:59:52 +0300 Subject: [PATCH] [DE][PE] Spellcheck: add words to dictionary --- .../main/app/view/DocumentHolder.js | 39 ++++++++++++++----- apps/documenteditor/main/locale/en.json | 1 + apps/documenteditor/main/locale/ru.json | 1 + .../main/app/view/DocumentHolder.js | 39 ++++++++++++++----- apps/presentationeditor/main/locale/en.json | 1 + apps/presentationeditor/main/locale/ru.json | 1 + 6 files changed, 62 insertions(+), 20 deletions(-) diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index df1935404..e3374f2ed 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -2746,6 +2746,13 @@ define([ } }); + var menuToDictionaryTable = new Common.UI.MenuItem({ + caption : me.toDictionaryText + }).on('click', function(item, e) { + me.api.asc_AddToDictionary(me._currentSpellObj); + me.fireEvent('editcomplete', me); + }); + var menuIgnoreSpellTableSeparator = new Common.UI.MenuItem({ caption : '--' }); @@ -2764,6 +2771,7 @@ define([ menuIgnoreSpellTableSeparator, menuIgnoreSpellTable, menuIgnoreAllSpellTable, + menuToDictionaryTable, { caption: '--' }, me.langTableMenu ] @@ -3366,6 +3374,13 @@ define([ me.fireEvent('editcomplete', me); }); + var menuToDictionaryPara = new Common.UI.MenuItem({ + caption : me.toDictionaryText + }).on('click', function(item, e) { + me.api.asc_AddToDictionary(me._currentSpellObj); + me.fireEvent('editcomplete', me); + }); + var menuIgnoreSpellParaSeparator = new Common.UI.MenuItem({ caption : '--' }); @@ -3553,15 +3568,17 @@ define([ menuParaPaste.setDisabled(disabled); // spellCheck - me.menuSpellPara.setVisible(value.spellProps!==undefined && value.spellProps.value.get_Checked()===false); - menuSpellcheckParaSeparator.setVisible(value.spellProps!==undefined && value.spellProps.value.get_Checked()===false); - menuIgnoreSpellPara.setVisible(value.spellProps!==undefined && value.spellProps.value.get_Checked()===false); - menuIgnoreAllSpellPara.setVisible(value.spellProps!==undefined && value.spellProps.value.get_Checked()===false); - me.langParaMenu.setVisible(value.spellProps!==undefined && value.spellProps.value.get_Checked()===false); + var spell = (value.spellProps!==undefined && value.spellProps.value.get_Checked()===false); + me.menuSpellPara.setVisible(spell); + menuSpellcheckParaSeparator.setVisible(spell); + menuIgnoreSpellPara.setVisible(spell); + menuIgnoreAllSpellPara.setVisible(spell); + menuToDictionaryPara.setVisible(spell); + me.langParaMenu.setVisible(spell); me.langParaMenu.setDisabled(disabled); - menuIgnoreSpellParaSeparator.setVisible(value.spellProps!==undefined && value.spellProps.value.get_Checked()===false); + menuIgnoreSpellParaSeparator.setVisible(spell); - if (value.spellProps!==undefined && value.spellProps.value.get_Checked()===false && value.spellProps.value.get_Variants() !== null && value.spellProps.value.get_Variants() !== undefined) { + if (spell && value.spellProps.value.get_Variants() !== null && value.spellProps.value.get_Variants() !== undefined) { me.addWordVariants(true); } else { me.menuSpellPara.setCaption(me.loadSpellText, true); @@ -3576,9 +3593,9 @@ define([ //equation menu var eqlen = 0; if (isEquation) { - eqlen = me.addEquationMenu(true, 11); + eqlen = me.addEquationMenu(true, 12); } else - me.clearEquationMenu(true, 11); + me.clearEquationMenu(true, 12); menuEquationSeparator.setVisible(isEquation && eqlen>0); menuFrameAdvanced.setVisible(value.paraProps.value.get_FramePr() !== undefined); @@ -3635,6 +3652,7 @@ define([ menuSpellcheckParaSeparator, menuIgnoreSpellPara, menuIgnoreAllSpellPara, + menuToDictionaryPara, me.langParaMenu, menuIgnoreSpellParaSeparator, menuParaCut, @@ -4055,7 +4073,8 @@ define([ textCrop: 'Crop', textCropFill: 'Fill', textCropFit: 'Fit', - textFollow: 'Follow move' + textFollow: 'Follow move', + toDictionaryText: 'Add to Dictionary' }, DE.Views.DocumentHolder || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index de8f90112..ea9460706 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -1100,6 +1100,7 @@ "DE.Views.DocumentHolder.hyperlinkText": "Hyperlink", "DE.Views.DocumentHolder.ignoreAllSpellText": "Ignore All", "DE.Views.DocumentHolder.ignoreSpellText": "Ignore", + "DE.Views.DocumentHolder.toDictionaryText": "Add to Dictionary", "DE.Views.DocumentHolder.imageText": "Image Advanced Settings", "DE.Views.DocumentHolder.insertColumnLeftText": "Column Left", "DE.Views.DocumentHolder.insertColumnRightText": "Column Right", diff --git a/apps/documenteditor/main/locale/ru.json b/apps/documenteditor/main/locale/ru.json index ce3eab5f6..25b07b4bb 100644 --- a/apps/documenteditor/main/locale/ru.json +++ b/apps/documenteditor/main/locale/ru.json @@ -1099,6 +1099,7 @@ "DE.Views.DocumentHolder.hyperlinkText": "Гиперссылка", "DE.Views.DocumentHolder.ignoreAllSpellText": "Пропустить все", "DE.Views.DocumentHolder.ignoreSpellText": "Пропустить", + "DE.Views.DocumentHolder.toDictionaryText": "Добавить в словарь", "DE.Views.DocumentHolder.imageText": "Дополнительные параметры изображения", "DE.Views.DocumentHolder.insertColumnLeftText": "Столбец слева", "DE.Views.DocumentHolder.insertColumnRightText": "Столбец справа", diff --git a/apps/presentationeditor/main/app/view/DocumentHolder.js b/apps/presentationeditor/main/app/view/DocumentHolder.js index ce8338258..ca89c9c8b 100644 --- a/apps/presentationeditor/main/app/view/DocumentHolder.js +++ b/apps/presentationeditor/main/app/view/DocumentHolder.js @@ -2181,6 +2181,13 @@ define([ } }); + var menuToDictionaryTable = new Common.UI.MenuItem({ + caption : me.toDictionaryText + }).on('click', function(item, e) { + me.api.asc_AddToDictionary(me._currentSpellObj); + me.fireEvent('editcomplete', me); + }); + var menuIgnoreSpellTableSeparator = new Common.UI.MenuItem({ caption : '--' }); @@ -2199,6 +2206,7 @@ define([ menuIgnoreSpellTableSeparator, menuIgnoreSpellTable, menuIgnoreAllSpellTable, + menuToDictionaryTable, { caption: '--' }, me.langTableMenu ] @@ -2244,6 +2252,13 @@ define([ me.fireEvent('editcomplete', me); }); + var menuToDictionaryPara = new Common.UI.MenuItem({ + caption : me.toDictionaryText + }).on('click', function(item, e) { + me.api.asc_AddToDictionary(me._currentSpellObj); + me.fireEvent('editcomplete', me); + }); + var menuIgnoreSpellParaSeparator = new Common.UI.MenuItem({ caption : '--' }); @@ -2971,15 +2986,17 @@ define([ menuParaPaste.setDisabled(disabled); // spellCheck - me.menuSpellPara.setVisible(value.spellProps!==undefined && value.spellProps.value.get_Checked()===false); - menuSpellcheckParaSeparator.setVisible(value.spellProps!==undefined && value.spellProps.value.get_Checked()===false); - menuIgnoreSpellPara.setVisible(value.spellProps!==undefined && value.spellProps.value.get_Checked()===false); - menuIgnoreAllSpellPara.setVisible(value.spellProps!==undefined && value.spellProps.value.get_Checked()===false); - me.langParaMenu.setVisible(value.spellProps!==undefined && value.spellProps.value.get_Checked()===false); + var spell = (value.spellProps!==undefined && value.spellProps.value.get_Checked()===false); + me.menuSpellPara.setVisible(spell); + menuSpellcheckParaSeparator.setVisible(spell); + menuIgnoreSpellPara.setVisible(spell); + menuIgnoreAllSpellPara.setVisible(spell); + menuToDictionaryPara.setVisible(spell); + me.langParaMenu.setVisible(spell); me.langParaMenu.setDisabled(disabled); - menuIgnoreSpellParaSeparator.setVisible(value.spellProps!==undefined && value.spellProps.value.get_Checked()===false); + menuIgnoreSpellParaSeparator.setVisible(spell); - if (value.spellProps!==undefined && value.spellProps.value.get_Checked()===false && value.spellProps.value.get_Variants() !== null && value.spellProps.value.get_Variants() !== undefined) { + if (spell && value.spellProps.value.get_Variants() !== null && value.spellProps.value.get_Variants() !== undefined) { me.addWordVariants(true); } else { me.menuSpellPara.setCaption(me.loadSpellText, true); @@ -2994,9 +3011,9 @@ define([ //equation menu var eqlen = 0; if (isEquation) { - eqlen = me.addEquationMenu(true, 11); + eqlen = me.addEquationMenu(true, 12); } else - me.clearEquationMenu(true, 11); + me.clearEquationMenu(true, 12); menuEquationSeparator.setVisible(isEquation && eqlen>0); }, items: [ @@ -3005,6 +3022,7 @@ define([ menuSpellcheckParaSeparator, menuIgnoreSpellPara, menuIgnoreAllSpellPara, + menuToDictionaryPara, me.langParaMenu, menuIgnoreSpellParaSeparator, menuParaCut, @@ -3557,7 +3575,8 @@ define([ textRotate: 'Rotate', textCrop: 'Crop', textCropFill: 'Fill', - textCropFit: 'Fit' + textCropFit: 'Fit', + toDictionaryText: 'Add to Dictionary' }, PE.Views.DocumentHolder || {})); }); \ No newline at end of file diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index 1a72b5110..2e1bcae5b 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -977,6 +977,7 @@ "PE.Views.DocumentHolder.hyperlinkText": "Hyperlink", "PE.Views.DocumentHolder.ignoreAllSpellText": "Ignore All", "PE.Views.DocumentHolder.ignoreSpellText": "Ignore", + "PE.Views.DocumentHolder.toDictionaryText": "Add to Dictionary", "PE.Views.DocumentHolder.insertColumnLeftText": "Column Left", "PE.Views.DocumentHolder.insertColumnRightText": "Column Right", "PE.Views.DocumentHolder.insertColumnText": "Insert Column", diff --git a/apps/presentationeditor/main/locale/ru.json b/apps/presentationeditor/main/locale/ru.json index 2b24d84e0..d2249cde4 100644 --- a/apps/presentationeditor/main/locale/ru.json +++ b/apps/presentationeditor/main/locale/ru.json @@ -977,6 +977,7 @@ "PE.Views.DocumentHolder.hyperlinkText": "Гиперссылка", "PE.Views.DocumentHolder.ignoreAllSpellText": "Пропустить все", "PE.Views.DocumentHolder.ignoreSpellText": "Пропустить", + "PE.Views.DocumentHolder.toDictionaryText": "Добавить в словарь", "PE.Views.DocumentHolder.insertColumnLeftText": "Столбец слева", "PE.Views.DocumentHolder.insertColumnRightText": "Столбец справа", "PE.Views.DocumentHolder.insertColumnText": "Вставить столбец",