From 770c62fb13bb360230c8d184d255d334ec38ebff Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 23 Sep 2020 13:08:37 +0300 Subject: [PATCH] [DE] Cross-reference: add labels from caption dialog --- .../main/app/view/CrossReferenceDialog.js | 167 ++++++++++-------- 1 file changed, 98 insertions(+), 69 deletions(-) diff --git a/apps/documenteditor/main/app/view/CrossReferenceDialog.js b/apps/documenteditor/main/app/view/CrossReferenceDialog.js index d0e611e84..bf4f9871b 100644 --- a/apps/documenteditor/main/app/view/CrossReferenceDialog.js +++ b/apps/documenteditor/main/app/view/CrossReferenceDialog.js @@ -88,7 +88,7 @@ define([ '', '', '', - '', + '', '
', '', '', @@ -110,9 +110,27 @@ define([ $window = this.getChild(); $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); + var arr = Common.Utils.InternalSettings.get("de-settings-captions"); + if (arr==null || arr==undefined) { + arr = Common.localStorage.getItem("de-settings-captions") || ''; + Common.Utils.InternalSettings.set("de-settings-captions", arr); + } + arr = arr ? JSON.parse(arr) : []; + + // 0 - not removable + arr = arr.concat([{ value: 5, displayValue: this.textEquation }, + { value: 6, displayValue: this.textFigure }, + { value: 7, displayValue: this.textTable } + ]); + arr.sort(function(a,b){ + var sa = a.displayValue.toLowerCase(), + sb = b.displayValue.toLowerCase(); + return sa>sb ? 1 : (sa 4) { + // custom labels from caption dialog and Equation, Figure, Table + arr = [ + { value: Asc.c_oAscDocumentRefenceToType.Text, displayValue: this.textCaption }, + { value: Asc.c_oAscDocumentRefenceToType.OnlyLabelAndNumber, displayValue: this.textLabelNum }, + { value: Asc.c_oAscDocumentRefenceToType.OnlyCaptionText, displayValue: this.textOnlyCaption }, + { value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum }, + { value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow } + ]; + } else { + switch (record.value) { + case 0: // paragraph + arr = [ + { value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum }, + { value: Asc.c_oAscDocumentRefenceToType.ParaNum, displayValue: this.textParaNum }, + { value: Asc.c_oAscDocumentRefenceToType.ParaNumNoContext, displayValue: this.textParaNumNo }, + { value: Asc.c_oAscDocumentRefenceToType.ParaNumFullContex, displayValue: this.textParaNumFull }, + { value: Asc.c_oAscDocumentRefenceToType.Text, displayValue: this.textText }, + { value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow } + ]; + str = this.textWhichPara; + break; + case 1: // heading + arr = [ + { value: Asc.c_oAscDocumentRefenceToType.Text, displayValue: this.textHeadingText }, + { value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum }, + { value: Asc.c_oAscDocumentRefenceToType.ParaNum, displayValue: this.textHeadingNum }, + { value: Asc.c_oAscDocumentRefenceToType.ParaNumNoContext, displayValue: this.textHeadingNumNo }, + { value: Asc.c_oAscDocumentRefenceToType.ParaNumFullContex, displayValue: this.textHeadingNumFull }, + { value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow } + ]; + str = this.textWhichHeading; + break; + case 2: // bookmark + arr = [ + { value: Asc.c_oAscDocumentRefenceToType.Text, displayValue: this.textBookmarkText }, + { value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum }, + { value: Asc.c_oAscDocumentRefenceToType.ParaNum, displayValue: this.textParaNum }, + { value: Asc.c_oAscDocumentRefenceToType.ParaNumNoContext, displayValue: this.textParaNumNo }, + { value: Asc.c_oAscDocumentRefenceToType.ParaNumFullContex, displayValue: this.textParaNumFull }, + { value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow } + ]; + str = this.textWhichBookmark; + break; + case 3: // note + arr = [ + { value: Asc.c_oAscDocumentRefenceToType.NoteNumber, displayValue: this.textNoteNum }, + { value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum }, + { value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow }, + { value: Asc.c_oAscDocumentRefenceToType.NoteNumberFormatted, displayValue: this.textNoteNumForm } + ]; + str = this.textWhichNote; + break; + case 4: // end note + arr = [ + { value: Asc.c_oAscDocumentRefenceToType.NoteNumber, displayValue: this.textEndNoteNum }, + { value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum }, + { value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow }, + { value: Asc.c_oAscDocumentRefenceToType.NoteNumberFormatted, displayValue: this.textEndNoteNumForm } + ]; + str = this.textWhichEndnote; + break; + } } this.cmbReference.setData(arr); this.cmbReference.setValue(arr[0].value); + this.lblWhich.text(str); }, txtTitle: 'Cross-reference', @@ -284,7 +308,6 @@ define([ textInsertAs: 'Insert as hyperlink', textSeparate: 'Separate numbers with', textIncludeAbove: 'Include above/below', - textWhich: 'For which caption', textPageNum: 'Page number', textParaNum: 'Paragraph number', textParaNumNo: 'Paragraph number (no context)', @@ -311,7 +334,13 @@ define([ textEquation: 'Equation', textFigure: 'Figure', textTable: 'Table', - textInsert: 'Insert' + textInsert: 'Insert', + textWhich: 'For which caption', + textWhichHeading: 'For which heading', + textWhichBookmark: 'For which bookmark', + textWhichNote: 'For which footnote', + textWhichEndnote: 'For which endnote', + textWhichPara: 'For which numbered item' }, DE.Views.CrossReferenceDialog || {})) }); \ No newline at end of file