mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-02-10 18:05:32 +08:00
refactored
This commit is contained in:
@ -3961,6 +3961,8 @@ define([], function () {
|
||||
};
|
||||
|
||||
dh.onShowSpecialPasteOptions = function(specialPasteShowOptions) {
|
||||
console.log(specialPasteShowOptions)
|
||||
console.log(specialPasteShowOptions.asc_getLastSelectedPasteProperty())
|
||||
if (this.permissions && !this.permissions.isEdit) return;
|
||||
|
||||
var me = this,
|
||||
@ -3969,6 +3971,26 @@ define([], function () {
|
||||
pasteContainer = documentHolderView.cmpEl.find('#special-paste-container'),
|
||||
pasteItems = specialPasteShowOptions.asc_getOptions(),
|
||||
isTable = !!specialPasteShowOptions.asc_getContainTables();
|
||||
|
||||
var lastSelected = specialPasteShowOptions.asc_getLastSelectedPasteProperty();
|
||||
if (lastSelected) {
|
||||
var foundItem = null;
|
||||
|
||||
if (me.btnSpecialPaste && me.btnSpecialPaste.menu && me.btnSpecialPaste.menu.items.length > 0) {
|
||||
for (var i = 0; i < me.btnSpecialPaste.menu.items.length; i++) {
|
||||
var menuItem = me.btnSpecialPaste.menu.items[i];
|
||||
if (menuItem.value === lastSelected) {
|
||||
foundItem = menuItem;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (foundItem) {
|
||||
foundItem.setChecked(true, true);
|
||||
// me._state.lastSpecPasteChecked = foundItem;
|
||||
}
|
||||
}
|
||||
if (!pasteItems) return;
|
||||
|
||||
// Prepare menu container
|
||||
@ -4177,6 +4199,7 @@ define([], function () {
|
||||
setTimeout(function(){menu.hide();}, 100);
|
||||
} else {
|
||||
me._state.lastSpecPasteChecked = item;
|
||||
console.log(me._state.lastSpecPasteChecked)
|
||||
var props = new Asc.SpecialPasteProps();
|
||||
props.asc_setProps(item.value);
|
||||
me.api.asc_SpecialPaste(props);
|
||||
|
||||
@ -438,7 +438,6 @@ define([
|
||||
toolbar.btnWrap.on('click', _.bind(this.onWrap, this));
|
||||
toolbar.btnTextOrient.menu.on('item:click', _.bind(this.onTextOrientationMenu, this));
|
||||
toolbar.btnInsertTable.on('click', _.bind(this.onBtnInsertTableClick, this));
|
||||
toolbar.btnPasteOptions.on('click', _.bind(this.onBtnPasteOptionsClick, this));
|
||||
toolbar.btnInsertImage.menu.on('item:click', _.bind(this.onInsertImageMenu, this));
|
||||
toolbar.btnInsertHyperlink.on('click', _.bind(this.onHyperlink, this));
|
||||
toolbar.btnInsertText.on('click', _.bind(this.onBtnInsertTextClick, this));
|
||||
@ -483,6 +482,7 @@ define([
|
||||
toolbar.cmbNumberFormat.cmpEl.on('click', '#id-toolbar-mnu-item-more-formats a', _.bind(this.onNumberFormatSelect, this));
|
||||
toolbar.btnCurrencyStyle.menu.on('item:click', _.bind(this.onNumberFormatMenu, this));
|
||||
$('#id-toolbar-menu-new-bordercolor').on('click', _.bind(this.onNewBorderColor, this));
|
||||
$('#slot-btn-paste').on('click','.dropdown-toggle', _.bind(this.onBtnPasteOptionsClick, this));
|
||||
toolbar.btnPageOrient.menu.on('item:click', _.bind(this.onPageOrientSelect, this));
|
||||
toolbar.btnPageMargins.menu.on('item:click', _.bind(this.onPageMarginsSelect, this));
|
||||
toolbar.mnuPageSize.on('item:click', _.bind(this.onPageSizeClick, this));
|
||||
@ -1062,7 +1062,6 @@ define([
|
||||
var me = this;
|
||||
var pasteItems = options.asc_getOptions(),
|
||||
isTable = !!options.asc_getContainTables();
|
||||
console.log(options, 'OPTIONS')
|
||||
if (!pasteItems) return;
|
||||
|
||||
me._arrSpecialPaste = [];
|
||||
@ -1087,7 +1086,7 @@ define([
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.useTextImport] = [me.txtUseTextImport, 3];
|
||||
|
||||
if (pasteItems.length>0) {
|
||||
var menu = me.toolbar.btnPasteOptions.menu;
|
||||
var menu = me.toolbar.btnPaste.menu;
|
||||
for (var i = 0; i < menu.items.length; i++) {
|
||||
menu.removeItem(menu.items[i]);
|
||||
i--;
|
||||
@ -1142,14 +1141,10 @@ define([
|
||||
}
|
||||
}
|
||||
|
||||
(menu.items.length>0) && menu.items[0].setChecked(true, true);
|
||||
me._state.lastSpecPasteChecked = (menu.items.length>0) ? menu.items[0] : null;
|
||||
|
||||
if (importText) {
|
||||
menu.addItem(new Common.UI.MenuItem({ caption: '--' }));
|
||||
menu.addItem(importText);
|
||||
}
|
||||
console.log(options.asc_getShowPasteSpecial(), 'SPECIAL')
|
||||
if (menu.items.length>0 && options.asc_getShowPasteSpecial()) {
|
||||
menu.addItem(new Common.UI.MenuItem({ caption: '--' }));
|
||||
var mnu = new Common.UI.MenuItem({
|
||||
@ -1161,9 +1156,6 @@ define([
|
||||
isTable: isTable,
|
||||
handler: function (result, settings) {
|
||||
if (result == 'ok') {
|
||||
me._state.lastSpecPasteChecked && me._state.lastSpecPasteChecked.setChecked(false, true);
|
||||
me._state.lastSpecPasteChecked = settings && me._arrSpecialPaste[settings.asc_getProps()] ? me._arrSpecialPaste[settings.asc_getProps()][2] : null;
|
||||
me._state.lastSpecPasteChecked && me._state.lastSpecPasteChecked.setChecked(true, true);
|
||||
if (me && me.api) {
|
||||
me.api.asc_SpecialPaste(settings);
|
||||
}
|
||||
@ -1179,7 +1171,7 @@ define([
|
||||
|
||||
onSpecialPasteItemClick: function (item, e) {
|
||||
var me = this,
|
||||
menu = this.toolbar.btnPasteOptions.menu;
|
||||
menu = this.toolbar.btnPaste.menu;
|
||||
if (item.value == Asc.c_oSpecialPasteProps.useTextImport) {
|
||||
(new Common.Views.OpenDialog({
|
||||
title: me.txtImportWizard,
|
||||
@ -1195,28 +1187,18 @@ define([
|
||||
props.asc_setAdvancedOptions(settings.textOptions);
|
||||
me.api.asc_SpecialPaste(props);
|
||||
}
|
||||
me._state.lastSpecPasteChecked = item;
|
||||
} else if (item.cmpEl) {
|
||||
item.setChecked(false, true);
|
||||
// me._state.lastSpecPasteChecked && me._state.lastSpecPasteChecked.setChecked(true, true);
|
||||
}
|
||||
}
|
||||
})).show();
|
||||
setTimeout(function(){menu.hide();}, 100);
|
||||
} else {
|
||||
me._state.lastSpecPasteChecked = item;
|
||||
var props = new Asc.SpecialPasteProps();
|
||||
props.asc_setProps(item.value);
|
||||
me.api.asc_SpecialPaste(props);
|
||||
setTimeout(function(){menu.hide();}, 100);
|
||||
}
|
||||
if (!item.cmpEl && me._state.lastSpecPasteChecked) {
|
||||
for (var i = 0; i < menu.items.length; i++) {
|
||||
menu.items[i].setChecked(menu.items[i].value===me._state.lastSpecPasteChecked.value, true);
|
||||
if (menu.items[i].value===me._state.lastSpecPasteChecked.value)
|
||||
me._state.lastSpecPasteChecked = menu.items[i];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<div class="group small">
|
||||
<div class="elset">
|
||||
<span class="btn-slot split" id="slot-btn-copy"></span>
|
||||
<span class="btn-slot" id="slot-btn-paste"></span>
|
||||
<span class="btn-slot split" id="slot-btn-paste"></span>
|
||||
</div>
|
||||
<div class="elset">
|
||||
<span class="btn-slot split" id="slot-btn-undo"></span>
|
||||
@ -144,7 +144,6 @@
|
||||
</section>
|
||||
<section class="panel" data-tab="ins" role="tabpanel" aria-labelledby="ins">
|
||||
<div class="group">
|
||||
<span class="btn-slot text x-huge" id="slot-btn-paste-options"></span>
|
||||
<span class="btn-slot text x-huge slot-add-pivot"></span>
|
||||
<span class="btn-slot text x-huge" id="slot-btn-instable"></span>
|
||||
</div>
|
||||
|
||||
@ -231,6 +231,8 @@ define([
|
||||
iconCls : 'toolbar__icon btn-paste',
|
||||
lock : [/*_set.editCell,*/ _set.coAuth, _set.lostConnect, _set.editVisibleArea, _set.userProtected, _set.externalChartProtected],
|
||||
dataHint : '1',
|
||||
menu: new Common.UI.Menu({items: []}),
|
||||
split: true,
|
||||
dataHintDirection: (config.isEditDiagram || config.isEditMailMerge || config.isEditOle) ? 'bottom' : 'top',
|
||||
dataHintTitle: 'V'
|
||||
});
|
||||
@ -1554,18 +1556,6 @@ define([
|
||||
dataHintOffset: 'small'
|
||||
});
|
||||
|
||||
me.btnPasteOptions = new Common.UI.Button({
|
||||
id : 'tlbtn-inserttable',
|
||||
cls : 'btn-toolbar x-huge icon-top',
|
||||
iconCls : 'toolbar__icon btn-freeze-panes',
|
||||
caption : me.capPasteOptions,
|
||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.multiselect, _set.cantModifyFilter, _set.ruleMerge, _set.editPivot, _set.wsLock, _set.userProtected],
|
||||
menu : new Common.UI.Menu({items: []}),
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'bottom',
|
||||
dataHintOffset: 'small'
|
||||
});
|
||||
|
||||
me.listStyles = new Common.UI.ComboDataView({
|
||||
cls : 'combo-cell-styles',
|
||||
enableKeyEvents : true,
|
||||
@ -2465,7 +2455,7 @@ define([
|
||||
me.cmbFontName, me.cmbFontSize, me.btnIncFontSize, me.btnDecFontSize, me.btnChangeCase, me.btnBold,
|
||||
me.btnItalic, me.btnUnderline, me.btnStrikeout, me.btnSubscript, me.btnTextColor, me.btnAlignLeft,
|
||||
me.btnAlignCenter,me.btnAlignRight,me.btnAlignJust, me.btnAlignTop,
|
||||
me.btnAlignMiddle, me.btnAlignBottom, me.btnWrap, me.btnTextOrient, me.btnBackColor, me.btnInsertTable, me.btnPasteOptions,
|
||||
me.btnAlignMiddle, me.btnAlignBottom, me.btnWrap, me.btnTextOrient, me.btnBackColor, me.btnInsertTable,
|
||||
me.btnMerge, me.btnTextDir, me.btnInsertFormula, me.btnNamedRange, me.btnFillNumbers, me.btnIncDecimal, me.btnInsertShape, me.btnInsertSmartArt, me.btnInsertEquation, me.btnInsertSymbol, me.btnInsertSlicer,
|
||||
me.btnInsertText, me.btnInsertTextArt, me.btnSortUp, me.btnSortDown, me.btnSetAutofilter, me.btnClearAutofilter,
|
||||
me.btnTableTemplate, me.btnCellStyle, me.btnPercentStyle, me.btnCommaStyle, me.btnCurrencyStyle, me.btnDecDecimal, me.btnAddCell, me.btnDeleteCell, me.btnFormatCell, me.btnCondFormat,
|
||||
@ -2635,7 +2625,6 @@ define([
|
||||
_injectComponent('#slot-btn-text-orient', this.btnTextOrient);
|
||||
_injectComponent('#slot-btn-insimage', this.btnInsertImage);
|
||||
_injectComponent('#slot-btn-instable', this.btnInsertTable);
|
||||
_injectComponent('#slot-btn-paste-options', this.btnPasteOptions);
|
||||
_injectComponent('#slot-btn-inshyperlink', this.btnInsertHyperlink);
|
||||
_injectComponent('#slot-btn-insshape', this.btnInsertShape);
|
||||
_injectComponent('#slot-btn-instext', this.btnInsertText);
|
||||
@ -2724,7 +2713,6 @@ define([
|
||||
_updateHint(this.btnWrap, this.tipWrap);
|
||||
_updateHint(this.btnTextOrient, this.tipTextOrientation);
|
||||
_updateHint(this.btnInsertTable, this.tipInsertTable);
|
||||
_updateHint(this.btnPasteOptions, this.tipPasteOptions);
|
||||
_updateHint(this.btnInsertImage, this.tipInsertImage);
|
||||
_updateHint(this.btnInsertChart, this.tipInsertChartSpark);
|
||||
_updateHint(this.btnInsertChartRecommend, this.tipInsertChartRecommend);
|
||||
|
||||
@ -4802,7 +4802,6 @@
|
||||
"SSE.Views.Toolbar.capInsertShape": "Shape",
|
||||
"SSE.Views.Toolbar.capInsertSpark": "Sparkline",
|
||||
"SSE.Views.Toolbar.capInsertTable": "Table",
|
||||
"SSE.Views.Toolbar.capPasteOptions": "Paste Options",
|
||||
"SSE.Views.Toolbar.capInsertText": "Text Box",
|
||||
"SSE.Views.Toolbar.capInsertTextart": "Text Art",
|
||||
"SSE.Views.Toolbar.capShapesMerge": "Merge Shapes",
|
||||
@ -5030,7 +5029,6 @@
|
||||
"SSE.Views.Toolbar.tipInsertSpark": "Insert sparkline",
|
||||
"SSE.Views.Toolbar.tipInsertSymbol": "Insert symbol",
|
||||
"SSE.Views.Toolbar.tipInsertTable": "Insert table",
|
||||
"SSE.Views.Toolbar.tipPasteOptions": "Paste options",
|
||||
"SSE.Views.Toolbar.tipInsertText": "Insert text box",
|
||||
"SSE.Views.Toolbar.tipInsertTextart": "Insert Text Art",
|
||||
"SSE.Views.Toolbar.tipInsertVerticalText": "Insert vertical text box",
|
||||
|
||||
Reference in New Issue
Block a user