diff --git a/apps/documenteditor/main/app/controller/Links.js b/apps/documenteditor/main/app/controller/Links.js
index 660ea25c0..b2b244a59 100644
--- a/apps/documenteditor/main/app/controller/Links.js
+++ b/apps/documenteditor/main/app/controller/Links.js
@@ -41,7 +41,8 @@
define([
'core',
- 'documenteditor/main/app/view/Links'
+ 'documenteditor/main/app/view/Links',
+ 'documenteditor/main/app/view/NoteSettingsDialog'
], function () {
'use strict';
@@ -59,7 +60,8 @@ define([
this.addListeners({
'Links': {
'links:contents': this.onTableContents,
- 'links:update': this.onTableContentsUpdate
+ 'links:update': this.onTableContentsUpdate,
+ 'links:notes': this.onNotesClick
}
});
},
@@ -102,9 +104,12 @@ define([
onApiFocusObject: function(selectedObjects) {
if (!this.editMode) return;
- var i = -1, type, pr,
+ var pr, i = -1, type,
paragraph_locked = false,
- header_locked = false;
+ header_locked = false,
+ in_header = false,
+ in_equation = false,
+ in_image = false;
while (++i < selectedObjects.length) {
type = selectedObjects[i].get_ObjectType();
@@ -114,9 +119,19 @@ define([
paragraph_locked = pr.get_Locked();
} else if (type === Asc.c_oAscTypeSelectElement.Header) {
header_locked = pr.get_Locked();
+ in_header = true;
+ } else if (type === Asc.c_oAscTypeSelectElement.Image) {
+ in_image = true;
+ } else if (type === Asc.c_oAscTypeSelectElement.Math) {
+ in_equation = true;
}
}
+ var need_disable = paragraph_locked || in_equation || in_image || in_header;
+ _.each (this.view.btnsNotes, function(item){
+ item.setDisabled(need_disable);
+ }, this);
+
// var need_disable = paragraph_locked || header_locked;
// _.each (this.view.btnsContents, function(item){
// item.setDisabled(need_disable);
@@ -141,6 +156,54 @@ define([
this.api.asc_updateTableOfContents();
else
this.api.asc_updateaddTableOfContents();
+ },
+
+ onNotesClick: function(type) {
+ var me = this;
+ switch (type) {
+ case 'ins_footnote':
+ this.api.asc_AddFootnote();
+ break;
+ case 'delele':
+ Common.UI.warning({
+ msg: this.view.confirmDeleteFootnotes,
+ buttons: ['yes', 'no'],
+ primary: 'yes',
+ callback: _.bind(function (btn) {
+ if (btn == 'yes') {
+ this.api.asc_RemoveAllFootnotes();
+ }
+ Common.NotificationCenter.trigger('edit:complete', this.toolbar);
+ }, this)
+ });
+ break;
+ case 'settings':
+ (new DE.Views.NoteSettingsDialog({
+ api: me.api,
+ handler: function (result, settings) {
+ if (settings) {
+ me.api.asc_SetFootnoteProps(settings.props, settings.applyToAll);
+ if (result == 'insert')
+ me.api.asc_AddFootnote(settings.custom);
+ }
+ Common.NotificationCenter.trigger('edit:complete', me.toolbar);
+ },
+ props: me.api.asc_GetFootnoteProps()
+ })).show();
+ break;
+ case 'prev':
+ this.api.asc_GotoFootnote(false);
+ setTimeout(function() {
+ Common.NotificationCenter.trigger('edit:complete', me.toolbar);
+ }, 50);
+ break;
+ case 'next':
+ this.api.asc_GotoFootnote(true);
+ setTimeout(function() {
+ Common.NotificationCenter.trigger('edit:complete', me.toolbar);
+ }, 50);
+ break;
+ }
}
}, DE.Controllers.Links || {}));
diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js
index 743e05f00..75858b112 100644
--- a/apps/documenteditor/main/app/controller/Toolbar.js
+++ b/apps/documenteditor/main/app/controller/Toolbar.js
@@ -54,7 +54,6 @@ define([
'documenteditor/main/app/view/StyleTitleDialog',
'documenteditor/main/app/view/PageMarginsDialog',
'documenteditor/main/app/view/PageSizeDialog',
- 'documenteditor/main/app/view/NoteSettingsDialog',
'documenteditor/main/app/controller/PageLayout',
'documenteditor/main/app/view/CustomColumnsDialog'
], function () {
@@ -309,10 +308,6 @@ define([
toolbar.mnuZoomIn.on('click', _.bind(this.onZoomInClick, this));
toolbar.mnuZoomOut.on('click', _.bind(this.onZoomOutClick, this));
toolbar.btnInsertEquation.on('click', _.bind(this.onInsertEquationClick, this));
- toolbar.btnNotes.on('click', _.bind(this.onNotesClick, this));
- toolbar.btnNotes.menu.on('item:click', _.bind(this.onNotesMenuClick, this));
- toolbar.mnuGotoFootPrev.on('click', _.bind(this.onFootnotePrevClick, this));
- toolbar.mnuGotoFootNext.on('click', _.bind(this.onFootnoteNextClick, this));
$('#id-save-style-plus, #id-save-style-link', toolbar.$el).on('click', this.onMenuSaveStyle.bind(this));
@@ -754,9 +749,6 @@ define([
toolbar.btnEditHeader.setDisabled(in_equation);
- need_disable = paragraph_locked || in_equation || in_image || in_header;
- if (need_disable !== toolbar.btnNotes.isDisabled())
- toolbar.btnNotes.setDisabled(need_disable);
need_disable = paragraph_locked || header_locked || in_image;
if (need_disable != toolbar.btnColumns.isDisabled())
@@ -2060,68 +2052,6 @@ define([
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
- onNotesClick: function() {
- if (this.api)
- this.api.asc_AddFootnote();
- },
-
- onNotesMenuClick: function(menu, item) {
- if (this.api) {
- if (item.value == 'ins_footnote')
- this.api.asc_AddFootnote();
- else if (item.value == 'delele')
- Common.UI.warning({
- msg: this.confirmDeleteFootnotes,
- buttons: ['yes', 'no'],
- primary: 'yes',
- callback: _.bind(function(btn) {
- if (btn == 'yes') {
- this.api.asc_RemoveAllFootnotes();
- }
- Common.NotificationCenter.trigger('edit:complete', this.toolbar);
- }, this)
- });
- else if (item.value == 'settings') {
- var me = this;
- (new DE.Views.NoteSettingsDialog({
- api: me.api,
- handler: function(result, settings) {
- if (settings) {
- me.api.asc_SetFootnoteProps(settings.props, settings.applyToAll);
- if (result == 'insert')
- me.api.asc_AddFootnote(settings.custom);
- }
- Common.NotificationCenter.trigger('edit:complete', me.toolbar);
- },
- props : me.api.asc_GetFootnoteProps()
- })).show();
- } else
- return;
-
- Common.NotificationCenter.trigger('edit:complete', this.toolbar);
- }
- },
-
- onFootnotePrevClick: function(btn) {
- if (this.api)
- this.api.asc_GotoFootnote(false);
-
- var me = this;
- setTimeout(function() {
- Common.NotificationCenter.trigger('edit:complete', me.toolbar);
- }, 50);
- },
-
- onFootnoteNextClick: function(btn) {
- if (this.api)
- this.api.asc_GotoFootnote(true);
-
- var me = this;
- setTimeout(function() {
- Common.NotificationCenter.trigger('edit:complete', me.toolbar);
- }, 50);
- },
-
_clearBullets: function() {
this.toolbar.btnMarkers.toggle(false, true);
this.toolbar.btnNumbers.toggle(false, true);
@@ -3264,8 +3194,7 @@ define([
confirmAddFontName: 'The font you are going to save is not available on the current device.
The text style will be displayed using one of the device fonts, the saved font will be used when it is available.
Do you want to continue?',
notcriticalErrorTitle: 'Warning',
txtMarginsW: 'Left and right margins are too high for a given page wight',
- txtMarginsH: 'Top and bottom margins are too high for a given page height',
- confirmDeleteFootnotes: 'Do you want to delete all footnotes?'
+ txtMarginsH: 'Top and bottom margins are too high for a given page height'
}, DE.Controllers.Toolbar || {}));
});
\ No newline at end of file
diff --git a/apps/documenteditor/main/app/template/Toolbar.template b/apps/documenteditor/main/app/template/Toolbar.template
index 2d8b33c76..d88c57e1b 100644
--- a/apps/documenteditor/main/app/template/Toolbar.template
+++ b/apps/documenteditor/main/app/template/Toolbar.template
@@ -123,7 +123,7 @@