[SSE] Autoexpansion undo/redo feature (Bug 18054).
This commit is contained in:
parent
2158b968b3
commit
54231ebed3
|
@ -275,6 +275,8 @@ define([
|
||||||
this.api.asc_registerCallback('asc_onFormulaCompleteMenu', _.bind(this.onFormulaCompleteMenu, this));
|
this.api.asc_registerCallback('asc_onFormulaCompleteMenu', _.bind(this.onFormulaCompleteMenu, this));
|
||||||
this.api.asc_registerCallback('asc_onShowSpecialPasteOptions', _.bind(this.onShowSpecialPasteOptions, this));
|
this.api.asc_registerCallback('asc_onShowSpecialPasteOptions', _.bind(this.onShowSpecialPasteOptions, this));
|
||||||
this.api.asc_registerCallback('asc_onHideSpecialPasteOptions', _.bind(this.onHideSpecialPasteOptions, this));
|
this.api.asc_registerCallback('asc_onHideSpecialPasteOptions', _.bind(this.onHideSpecialPasteOptions, this));
|
||||||
|
this.api.asc_registerCallback('asc_onShowAutoCorrectOptions', _.bind(this.onShowAutoCorrectOptions, this));
|
||||||
|
this.api.asc_registerCallback('asc_onHideAutoCorrectOptions', _.bind(this.onHideAutoCorrectOptions, this));
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
@ -1866,6 +1868,65 @@ define([
|
||||||
pasteContainer.hide();
|
pasteContainer.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onShowAutoCorrectOptions: function(autoCorrectOptions) {
|
||||||
|
var me = this,
|
||||||
|
documentHolderView = me.documentHolder,
|
||||||
|
coord = autoCorrectOptions.asc_getCellCoord(),
|
||||||
|
pasteContainer = documentHolderView.cmpEl.find('#autocorrect-paste-container'),
|
||||||
|
pasteItems = autoCorrectOptions.asc_getOptions();
|
||||||
|
|
||||||
|
// Prepare menu container
|
||||||
|
if (pasteContainer.length < 1) {
|
||||||
|
me._arrAutoCorrectPaste = [];
|
||||||
|
me._arrAutoCorrectPaste[Asc.c_oAscAutoCorrectOptions.UndoTableAutoExpansion] = me.txtUndoExpansion;
|
||||||
|
me._arrAutoCorrectPaste[Asc.c_oAscAutoCorrectOptions.RedoTableAutoExpansion] = me.txtRedoExpansion;
|
||||||
|
|
||||||
|
pasteContainer = $('<div id="autocorrect-paste-container" style="position: absolute;"><div id="id-document-holder-btn-autocorrect-paste"></div></div>');
|
||||||
|
documentHolderView.cmpEl.append(pasteContainer);
|
||||||
|
|
||||||
|
me.btnAutoCorrectPaste = new Common.UI.Button({
|
||||||
|
cls : 'btn-toolbar',
|
||||||
|
iconCls : 'btn-paste',
|
||||||
|
menu : new Common.UI.Menu({items: []})
|
||||||
|
});
|
||||||
|
me.btnAutoCorrectPaste.render($('#id-document-holder-btn-autocorrect-paste')) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pasteItems.length>0) {
|
||||||
|
var menu = me.btnAutoCorrectPaste.menu;
|
||||||
|
for (var i = 0; i < menu.items.length; i++) {
|
||||||
|
menu.removeItem(menu.items[i]);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
|
||||||
|
var group_prev = -1;
|
||||||
|
_.each(pasteItems, function(menuItem, index) {
|
||||||
|
var mnu = new Common.UI.MenuItem({
|
||||||
|
caption: me._arrAutoCorrectPaste[menuItem],
|
||||||
|
value: menuItem
|
||||||
|
}).on('click', function(item, e) {
|
||||||
|
me.api.asc_applyAutoCorrectOptions(item.value);
|
||||||
|
setTimeout(function(){menu.hide();}, 100);
|
||||||
|
});
|
||||||
|
menu.addItem(mnu);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( coord.asc_getX()<0 || coord.asc_getY()<0) {
|
||||||
|
if (pasteContainer.is(':visible')) pasteContainer.hide();
|
||||||
|
} else {
|
||||||
|
var showPoint = [coord.asc_getX() + coord.asc_getWidth() + 3, coord.asc_getY() + coord.asc_getHeight() + 3];
|
||||||
|
pasteContainer.css({left: showPoint[0], top : showPoint[1]});
|
||||||
|
pasteContainer.show();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onHideAutoCorrectOptions: function() {
|
||||||
|
var pasteContainer = this.documentHolder.cmpEl.find('#autocorrect-paste-container');
|
||||||
|
if (pasteContainer.is(':visible'))
|
||||||
|
pasteContainer.hide();
|
||||||
|
},
|
||||||
|
|
||||||
onCellsRange: function(status) {
|
onCellsRange: function(status) {
|
||||||
this.rangeSelectionMode = (status != Asc.c_oAscSelectionDialogType.None);
|
this.rangeSelectionMode = (status != Asc.c_oAscSelectionDialogType.None);
|
||||||
},
|
},
|
||||||
|
@ -2648,7 +2709,9 @@ define([
|
||||||
txtPastePicture: 'Picture',
|
txtPastePicture: 'Picture',
|
||||||
txtPasteLinkPicture: 'Linked Picture',
|
txtPasteLinkPicture: 'Linked Picture',
|
||||||
txtPasteSourceFormat: 'Source formatting',
|
txtPasteSourceFormat: 'Source formatting',
|
||||||
txtPasteDestFormat: 'Destination formatting'
|
txtPasteDestFormat: 'Destination formatting',
|
||||||
|
txtUndoExpansion: 'Undo table autoexpansion',
|
||||||
|
txtRedoExpansion: 'Redo table autoexpansion'
|
||||||
|
|
||||||
}, SSE.Controllers.DocumentHolder || {}));
|
}, SSE.Controllers.DocumentHolder || {}));
|
||||||
});
|
});
|
|
@ -311,6 +311,8 @@
|
||||||
"SSE.Controllers.DocumentHolder.txtTop": "Top",
|
"SSE.Controllers.DocumentHolder.txtTop": "Top",
|
||||||
"SSE.Controllers.DocumentHolder.txtUnderbar": "Bar under text",
|
"SSE.Controllers.DocumentHolder.txtUnderbar": "Bar under text",
|
||||||
"SSE.Controllers.DocumentHolder.txtWidth": "Width",
|
"SSE.Controllers.DocumentHolder.txtWidth": "Width",
|
||||||
|
"SSE.Controllers.DocumentHolder.txtUndoExpansion": "Undo table autoexpansion",
|
||||||
|
"SSE.Controllers.DocumentHolder.txtRedoExpansion": "Redo table autoexpansion",
|
||||||
"SSE.Controllers.LeftMenu.newDocumentTitle": "Unnamed spreadsheet",
|
"SSE.Controllers.LeftMenu.newDocumentTitle": "Unnamed spreadsheet",
|
||||||
"SSE.Controllers.LeftMenu.textByColumns": "By columns",
|
"SSE.Controllers.LeftMenu.textByColumns": "By columns",
|
||||||
"SSE.Controllers.LeftMenu.textByRows": "By rows",
|
"SSE.Controllers.LeftMenu.textByRows": "By rows",
|
||||||
|
|
|
@ -238,7 +238,8 @@
|
||||||
.background-ximage('@{app-image-path}/toolbar/math.png', '@{app-image-path}/toolbar/math@2x.png', 1500px);
|
.background-ximage('@{app-image-path}/toolbar/math.png', '@{app-image-path}/toolbar/math@2x.png', 1500px);
|
||||||
}
|
}
|
||||||
|
|
||||||
#special-paste-container {
|
#special-paste-container,
|
||||||
|
#autocorrect-paste-container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: @zindex-dropdown - 20;
|
z-index: @zindex-dropdown - 20;
|
||||||
background-color: @gray-light;
|
background-color: @gray-light;
|
||||||
|
|
Loading…
Reference in a new issue